Skip to content

Commit

Permalink
Merge branch 'stable' into beta-staging
Browse files Browse the repository at this point in the history
  • Loading branch information
heapcrash committed Jun 6, 2020
2 parents 371ddc1 + 72a93f7 commit aec8d9e
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 42 deletions.
54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: backport-required, bug
assignees: ''

---

Thanks for contributing to Pwntools!

## Update Pwntools First

When reporting an issue, be sure that you are running the latest released version of pwntools (`pip install --upgrade pwntools`).

## Debug Output

Having the extra debug output really helps us, and might help you diagnose the problem yourself.

When submitting an issue that has output from Pwntools, make sure to run your script as shown below, to enable the extra debugging data.

```sh
$ python exploit.py DEBUG LOG_FILE=log.txt
```

You should see `[DEBUG]` statements that show what's happening behind the scenes:

```
[+] Starting local process '/bin/sh' argv=['sh'] : pid 16823
[DEBUG] Sent 0x7 bytes:
'whoami\n'
[DEBUG] Sent 0x5 bytes:
'exit\n'
[+] Receiving all data: Done (11B)
[DEBUG] Received 0xb bytes:
'crashheap\n'
[*] Process '/bin/sh' stopped with exit code 0 (pid 16823)
```

## Verify on Ubuntu

If possible, please verify that your issue occurs on 64-bit Ubuntu 18.04. We provide a Dockerfile based on Ubuntu 18.04 via `docker.io` to make this super simple, no VM required!

```sh
# Download the Docker image
$ docker pull pwntools/pwntools:stable

# Boot the image
$ docker run -it pwntools/pwntools:stable

pwntools@7dc3ef409476:~$ python
>>> from pwn import *
>>> # Test your code here
```
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature
assignees: ''

---

Thanks for contributing to Pwntools! Ideas from the community help make Pwntools an amazing tool for everybody.

If you've got an idea for a new feature, please provide information about:

* What the feature does
* Why the feature should exit
* What tests should be included

If you think you can write the feature yourself, please submit a Pull Request and we can review your changes!
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Question
about: Ask us a question about Pwntools
title: ''
labels: question
assignees: ''

---

Thanks for using Pwntools! If you have a question, here are some tips that will make it easier for us to help you.

## Check the Documentation

Pwntools has REALLY extensive documentation. Please check there first! https://docs.pwntools.com

## Debug Output

If you're having an issue with an exploit, run your script with full debugging output, i.e. `python exploit.py DEBUG`. This may help you to see what's happening under the hood, and the debug output will help to diagnose any issues you're encountering.
35 changes: 19 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10 # used only for optimizing jre away
fetch-depth: 0

- name: Git History 2
run: git log --oneline --graph -10

- name: Cache for pip
uses: actions/cache@v1
Expand Down Expand Up @@ -57,7 +60,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \
ash bash-static dash ksh mksh zsh \
pandoc gdb socat sshpass \
pandoc gdb gdbserver socat sshpass \
binutils-multiarch qemu-user-static \
binutils-aarch64-linux-gnu \
binutils-arm-linux-gnueabihf \
Expand All @@ -77,16 +80,7 @@ jobs:
- name: Set up SSH
run: |
chmod og-rw ~ # see https://stackoverflow.com/a/60367309/3869724
ssh-keygen -t ed25519 -f ~/.ssh/pwntools-ci -N ''
cat > ~/.ssh/config <<EOF
Host example.pwnme
User $USER
HostName 127.0.0.1
IdentityFile ~/.ssh/pwntools-ci
EOF
echo -n 'from="127.0.0.1" ' | cat - ~/.ssh/pwntools-ci.pub > ~/.ssh/authorized_keys
ssh -o 'StrictHostKeyChecking no' example.pwnme id
travis/ssh_setup.sh
- name: Install dependencies
run: |
Expand All @@ -101,6 +95,14 @@ jobs:
- name: Install documentation dependencies
run: pip install -r docs/requirements.txt

- name: Disable broken tests
run: |
rm -f docs/source/elf/corefile.rst
rm -f docs/source/ui.rst
- name: Manually install non-broken Unicorn
run: pip install unicorn==1.0.2rc3

- name: Coverage doctests
run: |
source .android.env || :
Expand All @@ -110,8 +112,9 @@ jobs:
- name: Coverage running examples
run: |
export TERM=linux
set -x
python travis/coverage_chdir.py examples/fmtstr examples/fmtstr/exploit.py
python travis/coverage_chdir.py examples/fmtstr examples/fmtstr/exploit2.py
python travis/coverage_chdir.py examples/fmtstr examples/fmtstr/exploit2.py || : # can fail randomly?
coverage run examples/asm.py
coverage run examples/asm.py
coverage run examples/text.py
Expand All @@ -126,9 +129,9 @@ jobs:
pwn cyclic 32
pwn cyclic -l 0x62616161
pwn shellcraft amd64.linux.sh
pwn shellcraft -f asm --color amd64.linux.sh
pwn disasm ff3424c3ebfe
pwn disasm --color ff3424c3ebfe
pwn hex abcd
pwn unhex 4141 4141
Expand All @@ -138,7 +141,7 @@ jobs:
pwn errno 2
pwn constgrep -c freebsd -m ^PROT_ '3 + 4'
pwn constgrep ^MAP_
pwn constgrep ^MAP_ 0
pwn constgrep ^O_
- name: Build source and wheel distributions
Expand Down
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: python
addons:
apt:
packages:
- gcc-multilib
- lib32stdc++6
- ash
- bash
Expand All @@ -21,6 +20,10 @@ addons:
- binutils-arm-linux-gnueabihf
- binutils-mips-linux-gnu
- binutils-powerpc-linux-gnu
- gcc-aarch64-linux-gnu
- gcc-arm-linux-gnueabihf
- bash-static

cache:
- pip
- directories:
Expand Down Expand Up @@ -54,7 +57,6 @@ script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7 --show-source --statistics --exclude=android-?dk # TODO: Add F82
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=pwnlib/constants,android-?dk,.git,__pycache__
- PWNLIB_NOTERM=1 coverage run -m sphinx -b doctest docs/source docs/build/doctest
- coverage combine
after_success:
Expand Down
11 changes: 6 additions & 5 deletions pwnlib/gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, **kw
by using the ``ssh=`` keyword to pass in your :class:`.ssh` instance.
>>> # Connect to the SSH server
>>> shell = ssh('runner', 'example.pwnme', password='demopass')
>>> # Start a process on the server
>>> shell = ssh('travis', 'example.pwnme', password='demopass')
>>> io = gdb.debug(['bash'],
... ssh = shell,
... gdbscript = '''
Expand Down Expand Up @@ -561,9 +561,9 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr
... continue
... ''')
>>> # Interact with the process
>>> bash.sendline("whoami")
>>> bash.sendline("/bin/echo hello")
>>> bash.recvline()
b'runner\n'
b'hello\n'
>>> bash.close()
>>> # Start a forking server
Expand All @@ -584,7 +584,8 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr
>>> io.close()
>>> # Connect to the SSH server
>>> shell = ssh('runner', 'example.pwnme', password='demopass')
>>> shell = ssh('travis', 'example.pwnme', password='demopass')
>>> # Start a process on the server
>>> cat = shell.process(['cat'])
>>> # Attach a debugger to it
Expand Down Expand Up @@ -855,7 +856,7 @@ def find_module_addresses(binary, ssh=None, ulimit=False):
Example:
>>> with context.local(log_level=9999):
... shell = ssh(host='example.pwnme', user='runner', password='demopass')
... shell = ssh(host='example.pwnme', user='travis', password='demopass')
... bash_libs = gdb.find_module_addresses('/bin/bash', shell)
>>> os.path.basename(bash_libs[0].path)
'libc.so.6'
Expand Down

0 comments on commit aec8d9e

Please sign in to comment.