> For the complete documentation index, see [llms.txt](https://book.redsquad.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.redsquad.xyz/web-hacking/ctfs-shortcuts.md).

# CTFs shortcuts

<figure><img src="https://2862490475-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCKp14jVUu79ovRyJ9YuQ%2Fuploads%2Fgit-blob-756e1c67cfa71d46fc57cd91658930a8aa225cd4%2Fctf.gif?alt=media" alt="" width="360"><figcaption></figcaption></figure>

## Find flag

```bash
# if the flag looks like : flag{*****}
grep -irl flag{ $path

# if the flag is a .txt file
find / -iname "*.txt" 2>/dev/null
find / -iname "config.php" 2>/dev/null
find / -iname "flag.txt" 2>/dev/null

# find presence of chrootkit
find / -type f -name chkrootkit 2>/dev/null
```

## Web Dev

### Mozilla Firefox

`CTRL + SHIFT + I`

## HTTP Headers Response

```bash
curl -sSL -D - $ip -o /dev/null
curl -s -I -X POST http://$ip
```

## Stabilize Reverse shell

### use CTRL + C

```bash
# In reverse shell
python -c 'import pty; pty.spawn("/bin/bash")'
Ctrl-Z
# In OS
stty raw -echo
fg
```

There's three popular ways I use to stabilize a reverse shell;

* *Python*, as mentioned above.
* *riwrap*, which prepends to a netcat shell for additional terminal features.
* *Socat*, which is a step above netcat but must be manually transferred over and launched on the target machine.
