# TTY Upgrade

## Tools

### LazyRevShell

{% embed url="<https://github.com/aniqfakhrul/LazyShell>" %}

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

### pty4all

{% embed url="<https://github.com/laluka/pty4all?tab=readme-ov-file>" %}

## 4 different methods

```
# Attacker
nc -nlvp [PORT]
(...)
$ su admin
su: must be run from a terminal

# 1
/bin/bash

# 2
python -c "import pty; pty.spawn('/bin/bash')"

# 3 
$ /usr/bin/script -qc /bin/bash /dev/null
www-data@ubuntu:/var/www/Magic/images$

# 4
perl -e 'exec "/bin/bash";'
```

## Python

```shell-session
python -c 'import pty; pty.spawn("/bin/bash")'
```

```shell-session
python -c 'import pty; pty.spawn("/bin/sh")' 
```

## /bin/sh -i

```shell-session
/bin/sh -i
sh: no job control in this shell
sh-4.2$
```

## Perl

```shell-session
perl —e 'exec "/bin/sh";'
```

```shell-session
perl: exec "/bin/sh";
```

The command directly above should be run from a script.

## Ruby

```shell-session
ruby: exec "/bin/sh"
```

The command directly above should be run from a script.

## Lua

```shell-session
lua: os.execute('/bin/sh')
```

The command directly above should be run from a script.

## AWK

```shell-session
awk 'BEGIN {system("/bin/sh")}'
```

## Find

```shell-session
find / -name nameoffile -exec /bin/awk 'BEGIN {system("/bin/sh")}' \;
```

## VIM

```shell-session
vim -c ':!/bin/sh'
```

```shell-session
vim
:set shell=/bin/sh
:shell
```

## [Earn Free Crypto / BTC with Cointiply](https://cointiply.com/r/pkZxp)

[**Play Games Earn Cash Rewards**](https://cointiply.com/r/pkZxp)

<figure><img src="/files/a876wNYE568SJIfTZVxL" 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://0xss0rz.gitbook.io/0xss0rz/pentest/shells/tty-upgrade.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.
