# Attachments: Scripting Files

Scripting files are used commonly in Linux distributions with the files doing things such as, setting up an Operating System to the Company policies, Automate Tasks, Development, Monitoring and Logging, Managing User Permissions and much more, a sample script on a SH Script file just running the calculator:

```
#!/bin/bash
 
# Print welcome message
echo "========================="
echo "Hello to my first script!!"
echo "========================="
# Launch GNOME Calculator
gnome-calculator
```

The previous script would Print out a message and then finally proceed into executing the calculator app, but we can also call a simple reverse shell, we can utilize pentestmonkey one-liners for this

<figure><img src="https://315180959-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRh03Vwd4nuiUi3Oje7%2Fuploads%2FfSx3DIYMC5BmFrYeqOgF%2Fimage.png?alt=media&#x26;token=18d07422-45c1-4e92-8f42-bd185fbd5bca" alt=""><figcaption></figcaption></figure>

Our Shell

<figure><img src="https://315180959-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRh03Vwd4nuiUi3Oje7%2Fuploads%2FQXsua9xv8niiAixSpEMl%2Fimage.png?alt=media&#x26;token=042b5cf1-3665-4abe-a542-df945b590645" alt=""><figcaption></figcaption></figure>

As seen here, we gain a reverse shell connection back to our attacking host, but do realize this requires extra social engineering steps as Linux considers everything a file until you tell it that it's something else like a scripting language or an executable so the user needs to run a setup to this before executing.

{% hint style="info" %}


Now in my testing I've noticed that if files come inside a container their execution feature isn't removed just as working with a Windows OS, take a notice in the image below an SH script that has execution properties from another Linux machine
{% endhint %}

<figure><img src="https://315180959-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRh03Vwd4nuiUi3Oje7%2Fuploads%2FxOeDQ1kyzKK0UXurMaLF%2Fimage.png?alt=media&#x26;token=dfe054cb-da19-4ce8-86fd-9a9f04a4917e" alt=""><figcaption></figcaption></figure>

Execution properties have been removed, these applies to files downloaded from browsers or using LOLBINs, but if the file is placed inside a container lets say a ZIP container the execution properties aren't removed

<figure><img src="https://315180959-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRh03Vwd4nuiUi3Oje7%2Fuploads%2Fnp1qIAzUaSbZM9ppGPAX%2Fimage.png?alt=media&#x26;token=bdbcfdc3-ec44-4a8d-a296-255906a1695d" alt=""><figcaption></figcaption></figure>
