> For the complete documentation index, see [llms.txt](https://jeffgthompsons-organization.gitbook.io/red-team/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jeffgthompsons-organization.gitbook.io/red-team/methodologies-and-resources/cheat-sheets/file-info-gathering-and-script-abuse.md).

# File Info Gathering & Script Abuse

## **Gather info from script or file**

If it's a file we can't read like a binary file we might be able to still gather some info of how it works or maybe even credentials.

**Examples**

[Valley](/red-team/walkthroughs/tryhackme/valley.md)

**Kali**

```
strings $FILE > out.txt
```

## Abusing Library paths&#x20;

**Examples**

[Wonderland](/red-team/walkthroughs/tryhackme/wonderland.md)[Opacity](/red-team/walkthroughs/tryhackme/opacity.md)[Valley](/red-team/walkthroughs/tryhackme/valley.md)

If a script is using libraries check if the paths can be abused. It may be possible to instead of importing the library to go to a script we create instead or modify the existing one if we have access to do so.

Check the script and which libraries it uses.

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2FMlBIIcKlcR5ArqbvziCA%2Fimage.png?alt=media&amp;token=e29f1256-5c61-41da-917e-427f7ca82033" alt=""><figcaption></figcaption></figure>

Check to see what takes precedence. For example in the screenshot below it says ' ' has the highest priority which means the current working directory.

**Victim**

```
python3 -c 'import sys; print (sys.path)'
locate $FILE
```

<figure><img src="https://1447300783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHtr6mVUoafpQhzSYJEjI%2Fuploads%2F5onA3Ri4kuxUhGQd4Ct3%2Fimage.png?alt=media&amp;token=39ef6be2-c63a-4c69-9651-07a83c25db6e" alt=""><figcaption></figcaption></figure>

Check if we have access to modify any of the libraries' that the script uses.

**Victim**

```
locate $FILE
ls -lah /path/to/file/$FILE
groups
```

**Kali**

```
cd db
cat joomladb.sql | grep admin
```

## Ghidra

[Madeye's Castle](/red-team/walkthroughs/tryhackme/madeyes-castle.md#ghidra)[Wonderland](/red-team/walkthroughs/tryhackme/wonderland.md#ghidra)[FINISH - Linux Agency](/red-team/walkthroughs/tryhackme/finish-linux-agency.md)[Tokyo Ghoul](/red-team/walkthroughs/tryhackme/tokyo-ghoul.md#ghidra)[Bookstore](/red-team/walkthroughs/tryhackme/bookstore.md#ghidra)[Obscure](/red-team/walkthroughs/tryhackme/obscure.md)
