# Upgrading simple shells

### Spawning TTY

If Python is present on the target machine, the first method below is very reliable.  Otherwise, the other options are worth trying but don't always work.

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

{% hint style="info" %}
Be sure to check for other versions of Python!
{% endhint %}

```
echo os.system('/bin/bash')
```

```
/bin/sh -i
```

### Tab auto completion

The following commands will give tab autocompletion, but other features such as SIGINT, history, and clear screen will not work.

```
CTRL + Z (background the session)
stty raw -echo 
fg
reset
```

### Full TTY

The following commands will correct formatting errors and provide the remaining features including SIGINT, history, and the ability to clear your screen.

```
# on attack machine
stty -a (note number of rows and columns)
echo $TERM

#on target machine
export TERM=xterm-256color (match term from attack machine)
stty row XX columns XXX (match from attack machine)

echo $SHELL -- if not bash, export SHELL=bash
```


---

# 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://notes.oncyberwar.com/5.-maintaining-access/shells.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.
