mirror of
https://github.com/Gallopsled/pwntools.git
synced 2026-11-08 17:13:31 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52b8f4fa29 | ||
|
|
4552624883 | ||
|
|
b171f1e2e3 | ||
|
|
85523e6d8a | ||
|
|
8b761fc0e3 | ||
|
|
8953dc3d5c | ||
|
|
d586d6f660 | ||
|
|
6709a4f747 | ||
|
|
1a4a1e11ba | ||
|
|
f82c0aa3a2 | ||
|
|
646ca1eb26 | ||
|
|
aa1f3f7f5a | ||
|
|
bbe20c9748 | ||
|
|
c700f9194c | ||
|
|
71a3e43be3 | ||
|
|
267b9990c2 | ||
|
|
cfee8e0b24 | ||
|
|
32a767d469 | ||
|
|
9bda42e45d | ||
|
|
0903f9055b | ||
|
|
0a23a457c5 | ||
|
|
4772a22fed | ||
|
|
aa3acc162f | ||
|
|
676e6869a0 | ||
|
|
289109f499 | ||
|
|
3b9c0db1a2 | ||
|
|
dd7a67b6d7 | ||
|
|
ad87c17f73 | ||
|
|
348f6dfbe7 | ||
|
|
bac44542ed | ||
|
|
a54e697b55 | ||
|
|
5f1294af09 | ||
|
|
7cc4ced8d6 | ||
|
|
5c72d62c90 | ||
|
|
925cb43024 | ||
|
|
6f42e1c337 | ||
|
|
8a7bb9b9f4 | ||
|
|
512c2544b5 |
No files matched your search
+31
-7
@@ -9,9 +9,11 @@ The table below shows which release corresponds to each branch, and what date th
|
||||
|
||||
| Version | Branch | Release Date |
|
||||
| ---------------- | -------- | ---------------------- |
|
||||
| [3.8.0](#380) | `dev` | Jul 28, 2017 (planned)
|
||||
| [3.7.0](#370) | `beta` | Jun 17, 2017 (planned)
|
||||
| [3.6.0](#360) | `stable` | May 8, 2017
|
||||
| [3.9.0](#390) | `dev` | Sep 8, 2017 (planned)
|
||||
| [3.8.0](#380) | `beta` | Jul 28, 2017 (planned)
|
||||
| [3.7.0](#370) | `stable` | Jun 19, 2017
|
||||
| [3.6.1](#361) | | May 12, 2017
|
||||
| [3.6.0](#360) | | May 8, 2017
|
||||
| [3.5.1](#351) | | Apr 15, 2017
|
||||
| [3.5.0](#350) | | Mar 26, 2017
|
||||
| [3.4.1](#341) | | Feb 17, 2017
|
||||
@@ -32,17 +34,39 @@ The table below shows which release corresponds to each branch, and what date th
|
||||
| [3.0.0](#300) | | Aug 20, 2016
|
||||
| [2.2.0](#220) | | Jan 5, 2015
|
||||
|
||||
## 3.9.0
|
||||
|
||||
To be released on Sep 8, 2017.
|
||||
|
||||
## 3.8.0
|
||||
|
||||
To be on Jul 28, 2017.
|
||||
To be released on Jul 28, 2017.
|
||||
|
||||
- [#981][981] Fixed RELRO detection logic
|
||||
- [#986][986] Enhancements to DynELF for controlling usage of LibcDB
|
||||
|
||||
[981]: https://github.com/Gallopsled/pwntools/issues/981
|
||||
[986]: https://github.com/Gallopsled/pwntools/issues/986
|
||||
|
||||
## 3.7.0
|
||||
|
||||
To be on Jun 17, 2017.
|
||||
- [#933][933] DynELF works better with different base addresses
|
||||
- [#952][952] A few small fixes were made to `pwn template`, and the CRC database was updated.
|
||||
- [5c72d62c][5c72d62c] Updated the CRC database
|
||||
|
||||
As of May 4, 2017, there have been no new features or major notable changes since 3.6.0.
|
||||
[933]: https://github.com/Gallopsled/pwntools/issues/933
|
||||
[952]: https://github.com/Gallopsled/pwntools/issues/952
|
||||
[5c72d62c]: https://github.com/Gallopsled/pwntools/commit/5c72d62c
|
||||
|
||||
A few typos were fixed, a few Linux kernel configuration flags were added, and a few error messages were enhanced.
|
||||
## 3.6.1
|
||||
|
||||
- [#979][979]+[1a4a1e1][1a4a1e1] Fixed [#974][974], a bug related to the terminal handling and numlock.
|
||||
- [#980][980] Fixed the `pwn template` command.
|
||||
|
||||
[974]: https://github.com/Gallopsled/pwntools/issues/974
|
||||
[979]: https://github.com/Gallopsled/pwntools/pull/979
|
||||
[980]: https://github.com/Gallopsled/pwntools/pull/980
|
||||
[1a4a1e1]: https://github.com/Gallopsled/pwntools/commit/1a4a1e1
|
||||
|
||||
## 3.6.0
|
||||
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@ graft examples
|
||||
graft extra
|
||||
include *.md *.txt *.sh *.yml MANIFEST.in
|
||||
recursive-include docs *.rst *.png Makefile *.py *.txt
|
||||
recursive-include pwnlib *.py *.asm *.rst *.md *.txt *.sh __doc__
|
||||
recursive-include pwnlib *.py *.asm *.rst *.md *.txt *.sh __doc__ *.mako
|
||||
recursive-include pwn *.py *.asm *.rst *.md *.txt *.sh
|
||||
recursive-exclude *.pyc
|
||||
@@ -2,7 +2,7 @@
|
||||

|
||||
|
||||
[](https://docs.pwntools.com/)
|
||||
[](https://pypi.python.org/pypi/pwntools/)
|
||||
[](https://pypi.python.org/pypi/pwntools/)
|
||||
[](https://travis-ci.org/Gallopsled/pwntools)
|
||||
[](https://coveralls.io/github/Gallopsled/pwntools?branch=dev)
|
||||
[](https://twitter.com/pwntools)
|
||||
|
||||
@@ -72,7 +72,7 @@ a ``process`` tube.
|
||||
|
||||
::
|
||||
|
||||
>>> shell = ssh('bandit0', 'bandit.labs.overthewire.org', password='bandit0')
|
||||
>>> shell = ssh('bandit0', 'bandit.labs.overthewire.org', password='bandit0', port=2220)
|
||||
>>> shell['whoami']
|
||||
'bandit0'
|
||||
>>> shell.download_file('/etc/motd')
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ Example showing how to use the ssh class.
|
||||
|
||||
from pwn import *
|
||||
|
||||
shell = ssh(host='bandit.labs.overthewire.org',user='bandit0',password='bandit0')
|
||||
shell = ssh(host='bandit.labs.overthewire.org',user='bandit0',password='bandit0', port=2220)
|
||||
|
||||
# Show basic command syntax
|
||||
log.info("username: %s" % shell.whoami())
|
||||
|
||||
@@ -15,7 +15,7 @@ parser = common.parser_commands.add_parser(
|
||||
|
||||
parser.add_argument('exe', nargs='?', help='Target binary')
|
||||
parser.add_argument('--host', help='Remote host / SSH server')
|
||||
parser.add_argument('--port', help='Remote port / SSH port')
|
||||
parser.add_argument('--port', help='Remote port / SSH port', type=int)
|
||||
parser.add_argument('--user', help='SSH Username')
|
||||
parser.add_argument('--pass', help='SSH Password', dest='password')
|
||||
parser.add_argument('--path', help='Remote path of file on SSH server')
|
||||
@@ -34,7 +34,7 @@ def main(args):
|
||||
# For the SSH scenario, check that the binary is at the
|
||||
# same path on the remote host.
|
||||
if args.user:
|
||||
if not args.path or args.exe:
|
||||
if not (args.path or args.exe):
|
||||
log.error("Must specify --path or a exe")
|
||||
|
||||
s = ssh(args.user, args.host, args.port or 22, args.password or None)
|
||||
|
||||
Vendored
+99
-72
@@ -4,75 +4,102 @@
|
||||
# At the time of download, that page was available under the GPLv3 license, which can found here:
|
||||
# https://www.gnu.org/licenses/gpl.html
|
||||
#
|
||||
crc.cat-bits.3 width=3 poly=0x3 init=0x7 refin=true refout=true xorout=0x0 check=0x6 name="CRC-3/ROHC"
|
||||
crc.cat-bits.4 width=4 poly=0x3 init=0x0 refin=true refout=true xorout=0x0 check=0x7 name="CRC-4/ITU"
|
||||
crc.cat-bits.5 width=5 poly=0x09 init=0x09 refin=false refout=false xorout=0x00 check=0x00 name="CRC-5/EPC"
|
||||
crc.cat.crc-5-itu width=5 poly=0x15 init=0x00 refin=true refout=true xorout=0x00 check=0x07 name="CRC-5/ITU"
|
||||
crc.cat.crc-5-usb width=5 poly=0x05 init=0x1f refin=true refout=true xorout=0x1f check=0x19 name="CRC-5/USB"
|
||||
crc.cat-bits.6 width=6 poly=0x27 init=0x3f refin=false refout=false xorout=0x00 check=0x0d name="CRC-6/CDMA2000-A"
|
||||
crc.cat.crc-6-cdma2000-b width=6 poly=0x07 init=0x3f refin=false refout=false xorout=0x00 check=0x3b name="CRC-6/CDMA2000-B"
|
||||
crc.cat.crc-6-darc width=6 poly=0x19 init=0x00 refin=true refout=true xorout=0x00 check=0x26 name="CRC-6/DARC"
|
||||
crc.cat.crc-6-itu width=6 poly=0x03 init=0x00 refin=true refout=true xorout=0x00 check=0x06 name="CRC-6/ITU"
|
||||
crc.cat-bits.7 width=7 poly=0x09 init=0x00 refin=false refout=false xorout=0x00 check=0x75 name="CRC-7"
|
||||
crc.cat.crc-7-rohc width=7 poly=0x4f init=0x7f refin=true refout=true xorout=0x00 check=0x53 name="CRC-7/ROHC"
|
||||
crc.cat-bits.8 width=8 poly=0x07 init=0x00 refin=false refout=false xorout=0x00 check=0xf4 name="CRC-8"
|
||||
crc.cat.crc-8-cdma2000 width=8 poly=0x9b init=0xff refin=false refout=false xorout=0x00 check=0xda name="CRC-8/CDMA2000"
|
||||
crc.cat.crc-8-darc width=8 poly=0x39 init=0x00 refin=true refout=true xorout=0x00 check=0x15 name="CRC-8/DARC"
|
||||
crc.cat.crc-8-dvb-s2 width=8 poly=0xd5 init=0x00 refin=false refout=false xorout=0x00 check=0xbc name="CRC-8/DVB-S2"
|
||||
crc.cat.crc-8-ebu width=8 poly=0x1d init=0xff refin=true refout=true xorout=0x00 check=0x97 name="CRC-8/EBU"
|
||||
crc.cat.crc-8-i-code width=8 poly=0x1d init=0xfd refin=false refout=false xorout=0x00 check=0x7e name="CRC-8/I-CODE"
|
||||
crc.cat.crc-8-itu width=8 poly=0x07 init=0x00 refin=false refout=false xorout=0x55 check=0xa1 name="CRC-8/ITU"
|
||||
crc.cat.crc-8-maxim width=8 poly=0x31 init=0x00 refin=true refout=true xorout=0x00 check=0xa1 name="CRC-8/MAXIM"
|
||||
crc.cat.crc-8-rohc width=8 poly=0x07 init=0xff refin=true refout=true xorout=0x00 check=0xd0 name="CRC-8/ROHC"
|
||||
crc.cat.crc-8-wdcma width=8 poly=0x9b init=0x00 refin=true refout=true xorout=0x00 check=0x25 name="CRC-8/WCDMA"
|
||||
crc.cat-bits.10 width=10 poly=0x233 init=0x000 refin=false refout=false xorout=0x000 check=0x199 name="CRC-10"
|
||||
crc.cat.crc-10-cdma2000 width=10 poly=0x3d9 init=0x3ff refin=false refout=false xorout=0x000 check=0x233 name="CRC-10/CDMA2000"
|
||||
crc.cat-bits.11 width=11 poly=0x385 init=0x01a refin=false refout=false xorout=0x000 check=0x5a3 name="CRC-11"
|
||||
crc.cat-bits.12 width=12 poly=0x80f init=0x000 refin=false refout=true xorout=0x000 check=0xdaf name="CRC-12/3GPP"
|
||||
crc.cat.crc-12-cdma2000 width=12 poly=0xf13 init=0xfff refin=false refout=false xorout=0x000 check=0xd4d name="CRC-12/CDMA2000"
|
||||
crc.cat.crc-12-dect width=12 poly=0x80f init=0x000 refin=false refout=false xorout=0x000 check=0xf5b name="CRC-12/DECT"
|
||||
crc.cat-bits.13 width=13 poly=0x1cf5 init=0x0000 refin=false refout=false xorout=0x0000 check=0x04fa name="CRC-13/BBC"
|
||||
crc.cat-bits.14 width=14 poly=0x0805 init=0x0000 refin=true refout=true xorout=0x0000 check=0x082d name="CRC-14/DARC"
|
||||
crc.cat-bits.15 width=15 poly=0x4599 init=0x0000 refin=false refout=false xorout=0x0000 check=0x059e name="CRC-15"
|
||||
crc.cat.crc-15-mpt1327 width=15 poly=0x6815 init=0x0000 refin=false refout=false xorout=0x0001 check=0x2566 name="CRC-15/MPT1327"
|
||||
crc.cat-bits.16 width=16 poly=0x8005 init=0x0000 refin=true refout=true xorout=0x0000 check=0xbb3d name="ARC"
|
||||
crc.cat.crc-16-aug-ccitt width=16 poly=0x1021 init=0x1d0f refin=false refout=false xorout=0x0000 check=0xe5cc name="CRC-16/AUG-CCITT"
|
||||
crc.cat.crc-16-buypass width=16 poly=0x8005 init=0x0000 refin=false refout=false xorout=0x0000 check=0xfee8 name="CRC-16/BUYPASS"
|
||||
crc.cat.crc-16-ccitt-false width=16 poly=0x1021 init=0xffff refin=false refout=false xorout=0x0000 check=0x29b1 name="CRC-16/CCITT-FALSE"
|
||||
crc.cat.crc-16-cdma2000 width=16 poly=0xc867 init=0xffff refin=false refout=false xorout=0x0000 check=0x4c06 name="CRC-16/CDMA2000"
|
||||
crc.cat.crc-16-dds-110 width=16 poly=0x8005 init=0x800d refin=false refout=false xorout=0x0000 check=0x9ecf name="CRC-16/DDS-110"
|
||||
crc.cat.crc-16-dect-r width=16 poly=0x0589 init=0x0000 refin=false refout=false xorout=0x0001 check=0x007e name="CRC-16/DECT-R"
|
||||
crc.cat.crc-16-dect-x width=16 poly=0x0589 init=0x0000 refin=false refout=false xorout=0x0000 check=0x007f name="CRC-16/DECT-X"
|
||||
crc.cat.crc-16-dnp width=16 poly=0x3d65 init=0x0000 refin=true refout=true xorout=0xffff check=0xea82 name="CRC-16/DNP"
|
||||
crc.cat.crc-16-en-13757 width=16 poly=0x3d65 init=0x0000 refin=false refout=false xorout=0xffff check=0xc2b7 name="CRC-16/EN-13757"
|
||||
crc.cat.crc-16-genibus width=16 poly=0x1021 init=0xffff refin=false refout=false xorout=0xffff check=0xd64e name="CRC-16/GENIBUS"
|
||||
crc.cat.crc-16-maxim width=16 poly=0x8005 init=0x0000 refin=true refout=true xorout=0xffff check=0x44c2 name="CRC-16/MAXIM"
|
||||
crc.cat.crc-16-mcrf4xx width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0x0000 check=0x6f91 name="CRC-16/MCRF4XX"
|
||||
crc.cat.crc-16-riello width=16 poly=0x1021 init=0xb2aa refin=true refout=true xorout=0x0000 check=0x63d0 name="CRC-16/RIELLO"
|
||||
crc.cat.crc-16-t10-dif width=16 poly=0x8bb7 init=0x0000 refin=false refout=false xorout=0x0000 check=0xd0db name="CRC-16/T10-DIF"
|
||||
crc.cat.crc-16-teledisk width=16 poly=0xa097 init=0x0000 refin=false refout=false xorout=0x0000 check=0x0fb3 name="CRC-16/TELEDISK"
|
||||
crc.cat.crc-16-tms37157 width=16 poly=0x1021 init=0x89ec refin=true refout=true xorout=0x0000 check=0x26b1 name="CRC-16/TMS37157"
|
||||
crc.cat.crc-16-usb width=16 poly=0x8005 init=0xffff refin=true refout=true xorout=0xffff check=0xb4c8 name="CRC-16/USB"
|
||||
crc.cat.crc-a width=16 poly=0x1021 init=0xc6c6 refin=true refout=true xorout=0x0000 check=0xbf05 name="CRC-A"
|
||||
crc.cat.kermit width=16 poly=0x1021 init=0x0000 refin=true refout=true xorout=0x0000 check=0x2189 name="KERMIT"
|
||||
crc.cat.modbus width=16 poly=0x8005 init=0xffff refin=true refout=true xorout=0x0000 check=0x4b37 name="MODBUS"
|
||||
crc.cat.x-25 width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0xffff check=0x906e name="X-25"
|
||||
crc.cat.xmodem width=16 poly=0x1021 init=0x0000 refin=false refout=false xorout=0x0000 check=0x31c3 name="XMODEM"
|
||||
crc.cat-bits.24 width=24 poly=0x864cfb init=0xb704ce refin=false refout=false xorout=0x000000 check=0x21cf02 name="CRC-24"
|
||||
crc.cat.crc-24-flexray-a width=24 poly=0x5d6dcb init=0xfedcba refin=false refout=false xorout=0x000000 check=0x7979bd name="CRC-24/FLEXRAY-A"
|
||||
crc.cat.crc-24-flexray-b width=24 poly=0x5d6dcb init=0xabcdef refin=false refout=false xorout=0x000000 check=0x1f23b8 name="CRC-24/FLEXRAY-B"
|
||||
crc.cat-bits.31 width=31 poly=0x04c11db7 init=0x7fffffff refin=false refout=false xorout=0x7fffffff check=0x0ce9e46c name="CRC-31/PHILIPS"
|
||||
crc.cat-bits.32 width=32 poly=0x04c11db7 init=0xffffffff refin=true refout=true xorout=0xffffffff check=0xcbf43926 name="CRC-32"
|
||||
crc.cat.crc-32-bzip2 width=32 poly=0x04c11db7 init=0xffffffff refin=false refout=false xorout=0xffffffff check=0xfc891918 name="CRC-32/BZIP2"
|
||||
crc.cat.crc-32c width=32 poly=0x1edc6f41 init=0xffffffff refin=true refout=true xorout=0xffffffff check=0xe3069283 name="CRC-32C"
|
||||
crc.cat.crc-32d width=32 poly=0xa833982b init=0xffffffff refin=true refout=true xorout=0xffffffff check=0x87315576 name="CRC-32D"
|
||||
crc.cat.crc-32-mpeg-2 width=32 poly=0x04c11db7 init=0xffffffff refin=false refout=false xorout=0x00000000 check=0x0376e6e7 name="CRC-32/MPEG-2"
|
||||
crc.cat.crc-32-posix width=32 poly=0x04c11db7 init=0x00000000 refin=false refout=false xorout=0xffffffff check=0x765e7680 name="CRC-32/POSIX"
|
||||
crc.cat.crc-32q width=32 poly=0x814141ab init=0x00000000 refin=false refout=false xorout=0x00000000 check=0x3010bf7f name="CRC-32Q"
|
||||
crc.cat.jamcrc width=32 poly=0x04c11db7 init=0xffffffff refin=true refout=true xorout=0x00000000 check=0x340bc6d9 name="JAMCRC"
|
||||
crc.cat.xfer width=32 poly=0x000000af init=0x00000000 refin=false refout=false xorout=0x00000000 check=0xbd0be338 name="XFER"
|
||||
crc.cat-bits.40 width=40 poly=0x0004820009 init=0x0000000000 refin=false refout=false xorout=0xffffffffff check=0xd4164fc646 name="CRC-40/GSM"
|
||||
crc.cat-bits.64 width=64 poly=0x42f0e1eba9ea3693 init=0x0000000000000000 refin=false refout=false xorout=0x0000000000000000 check=0x6c40df5f0b497347 name="CRC-64"
|
||||
crc.cat.crc-64-we width=64 poly=0x42f0e1eba9ea3693 init=0xffffffffffffffff refin=false refout=false xorout=0xffffffffffffffff check=0x62ec59e3f1a4f00a name="CRC-64/WE"
|
||||
crc.cat.crc-64-xz width=64 poly=0x42f0e1eba9ea3693 init=0xffffffffffffffff refin=true refout=true xorout=0xffffffffffffffff check=0x995dc9bbdf1939fa name="CRC-64/XZ"
|
||||
crc.cat-bits.82 width=82 poly=0x0308c0111011401440411 init=0x000000000000000000000 refin=true refout=true xorout=0x000000000000000000000 check=0x09ea83f625023801fd612 name="CRC-82/DARC"
|
||||
crc.cat.crc-3-rohc width=3 poly=0x3 init=0x7 refin=true refout=true xorout=0x0 check=0x6 residue=0x0 name="CRC-3/ROHC"
|
||||
crc.cat-bits.3 width=3 poly=0x3 init=0x0 refin=false refout=false xorout=0x7 check=0x4 residue=0x2 name="CRC-3/GSM"
|
||||
crc.cat-bits.4 width=4 poly=0x3 init=0xf refin=false refout=false xorout=0xf check=0xb residue=0x2 name="CRC-4/INTERLAKEN"
|
||||
crc.cat.crc-4-itu width=4 poly=0x3 init=0x0 refin=true refout=true xorout=0x0 check=0x7 residue=0x0 name="CRC-4/ITU"
|
||||
crc.cat-bits.5 width=5 poly=0x09 init=0x09 refin=false refout=false xorout=0x00 check=0x00 residue=0x00 name="CRC-5/EPC"
|
||||
crc.cat.crc-5-itu width=5 poly=0x15 init=0x00 refin=true refout=true xorout=0x00 check=0x07 residue=0x00 name="CRC-5/ITU"
|
||||
crc.cat.crc-5-usb width=5 poly=0x05 init=0x1f refin=true refout=true xorout=0x1f check=0x19 residue=0x06 name="CRC-5/USB"
|
||||
crc.cat-bits.6 width=6 poly=0x27 init=0x3f refin=false refout=false xorout=0x00 check=0x0d residue=0x00 name="CRC-6/CDMA2000-A"
|
||||
crc.cat.crc-6-cdma2000-b width=6 poly=0x07 init=0x3f refin=false refout=false xorout=0x00 check=0x3b residue=0x00 name="CRC-6/CDMA2000-B"
|
||||
crc.cat.crc-6-darc width=6 poly=0x19 init=0x00 refin=true refout=true xorout=0x00 check=0x26 residue=0x00 name="CRC-6/DARC"
|
||||
crc.cat.crc-6-gsm width=6 poly=0x2f init=0x00 refin=false refout=false xorout=0x3f check=0x13 residue=0x3a name="CRC-6/GSM"
|
||||
crc.cat.crc-6-itu width=6 poly=0x03 init=0x00 refin=true refout=true xorout=0x00 check=0x06 residue=0x00 name="CRC-6/ITU"
|
||||
crc.cat-bits.7 width=7 poly=0x09 init=0x00 refin=false refout=false xorout=0x00 check=0x75 residue=0x00 name="CRC-7"
|
||||
crc.cat.crc-7-rohc width=7 poly=0x4f init=0x7f refin=true refout=true xorout=0x00 check=0x53 residue=0x00 name="CRC-7/ROHC"
|
||||
crc.cat.crc-7-umts width=7 poly=0x45 init=0x00 refin=false refout=false xorout=0x00 check=0x61 residue=0x00 name="CRC-7/UMTS"
|
||||
crc.cat-bits.8 width=8 poly=0x07 init=0x00 refin=false refout=false xorout=0x00 check=0xf4 residue=0x00 name="CRC-8"
|
||||
crc.cat.crc-8-autosar width=8 poly=0x2f init=0xff refin=false refout=false xorout=0xff check=0xdf residue=0x42 name="CRC-8/AUTOSAR"
|
||||
crc.cat.crc-8-cdma2000 width=8 poly=0x9b init=0xff refin=false refout=false xorout=0x00 check=0xda residue=0x00 name="CRC-8/CDMA2000"
|
||||
crc.cat.crc-8-darc width=8 poly=0x39 init=0x00 refin=true refout=true xorout=0x00 check=0x15 residue=0x00 name="CRC-8/DARC"
|
||||
crc.cat.crc-8-dvb-s2 width=8 poly=0xd5 init=0x00 refin=false refout=false xorout=0x00 check=0xbc residue=0x00 name="CRC-8/DVB-S2"
|
||||
crc.cat.crc-8-ebu width=8 poly=0x1d init=0xff refin=true refout=true xorout=0x00 check=0x97 residue=0x00 name="CRC-8/EBU"
|
||||
crc.cat.crc-8-gsm-a width=8 poly=0x1d init=0x00 refin=false refout=false xorout=0x00 check=0x37 residue=0x00 name="CRC-8/GSM-A"
|
||||
crc.cat.crc-8-gsm-b width=8 poly=0x49 init=0x00 refin=false refout=false xorout=0xff check=0x94 residue=0x53 name="CRC-8/GSM-B"
|
||||
crc.cat.crc-8-i-code width=8 poly=0x1d init=0xfd refin=false refout=false xorout=0x00 check=0x7e residue=0x00 name="CRC-8/I-CODE"
|
||||
crc.cat.crc-8-itu width=8 poly=0x07 init=0x00 refin=false refout=false xorout=0x55 check=0xa1 residue=0xac name="CRC-8/ITU"
|
||||
crc.cat.crc-8-lte width=8 poly=0x9b init=0x00 refin=false refout=false xorout=0x00 check=0xea residue=0x00 name="CRC-8/LTE"
|
||||
crc.cat.crc-8-maxim width=8 poly=0x31 init=0x00 refin=true refout=true xorout=0x00 check=0xa1 residue=0x00 name="CRC-8/MAXIM"
|
||||
crc.cat.crc-8-opensafety width=8 poly=0x2f init=0x00 refin=false refout=false xorout=0x00 check=0x3e residue=0x00 name="CRC-8/OPENSAFETY"
|
||||
crc.cat.crc-8-rohc width=8 poly=0x07 init=0xff refin=true refout=true xorout=0x00 check=0xd0 residue=0x00 name="CRC-8/ROHC"
|
||||
crc.cat.crc-8-sae-j1850 width=8 poly=0x1d init=0xff refin=false refout=false xorout=0xff check=0x4b residue=0xc4 name="CRC-8/SAE-J1850"
|
||||
crc.cat.crc-8-wdcma width=8 poly=0x9b init=0x00 refin=true refout=true xorout=0x00 check=0x25 residue=0x00 name="CRC-8/WCDMA"
|
||||
crc.cat-bits.10 width=10 poly=0x233 init=0x000 refin=false refout=false xorout=0x000 check=0x199 residue=0x000 name="CRC-10"
|
||||
crc.cat.crc-10-cdma2000 width=10 poly=0x3d9 init=0x3ff refin=false refout=false xorout=0x000 check=0x233 residue=0x000 name="CRC-10/CDMA2000"
|
||||
crc.cat.crc-10-gsm width=10 poly=0x175 init=0x000 refin=false refout=false xorout=0x3ff check=0x12a residue=0x0c6 name="CRC-10/GSM"
|
||||
crc.cat-bits.11 width=11 poly=0x385 init=0x01a refin=false refout=false xorout=0x000 check=0x5a3 residue=0x000 name="CRC-11"
|
||||
crc.cat.crc-11-umts width=11 poly=0x307 init=0x000 refin=false refout=false xorout=0x000 check=0x061 residue=0x000 name="CRC-11/UMTS"
|
||||
crc.cat-bits.12 width=12 poly=0xf13 init=0xfff refin=false refout=false xorout=0x000 check=0xd4d residue=0x000 name="CRC-12/CDMA2000"
|
||||
crc.cat.crc-12-dect width=12 poly=0x80f init=0x000 refin=false refout=false xorout=0x000 check=0xf5b residue=0x000 name="CRC-12/DECT"
|
||||
crc.cat.crc-12-gsm width=12 poly=0xd31 init=0x000 refin=false refout=false xorout=0xfff check=0xb34 residue=0x178 name="CRC-12/GSM"
|
||||
crc.cat.crc-12-umts width=12 poly=0x80f init=0x000 refin=false refout=true xorout=0x000 check=0xdaf residue=0x000 name="CRC-12/UMTS"
|
||||
crc.cat-bits.13 width=13 poly=0x1cf5 init=0x0000 refin=false refout=false xorout=0x0000 check=0x04fa residue=0x0000 name="CRC-13/BBC"
|
||||
crc.cat-bits.14 width=14 poly=0x0805 init=0x0000 refin=true refout=true xorout=0x0000 check=0x082d residue=0x0000 name="CRC-14/DARC"
|
||||
crc.cat.crc-14-gsm width=14 poly=0x202d init=0x0000 refin=false refout=false xorout=0x3fff check=0x30ae residue=0x031e name="CRC-14/GSM"
|
||||
crc.cat-bits.15 width=15 poly=0x4599 init=0x0000 refin=false refout=false xorout=0x0000 check=0x059e residue=0x0000 name="CRC-15"
|
||||
crc.cat.crc-15-mpt1327 width=15 poly=0x6815 init=0x0000 refin=false refout=false xorout=0x0001 check=0x2566 residue=0x6815 name="CRC-15/MPT1327"
|
||||
crc.cat-bits.16 width=16 poly=0x8005 init=0x0000 refin=true refout=true xorout=0x0000 check=0xbb3d residue=0x0000 name="ARC"
|
||||
crc.cat.crc-16-aug-ccitt width=16 poly=0x1021 init=0x1d0f refin=false refout=false xorout=0x0000 check=0xe5cc residue=0x0000 name="CRC-16/AUG-CCITT"
|
||||
crc.cat.crc-16-buypass width=16 poly=0x8005 init=0x0000 refin=false refout=false xorout=0x0000 check=0xfee8 residue=0x0000 name="CRC-16/BUYPASS"
|
||||
crc.cat.crc-16-ccitt-false width=16 poly=0x1021 init=0xffff refin=false refout=false xorout=0x0000 check=0x29b1 residue=0x0000 name="CRC-16/CCITT-FALSE"
|
||||
crc.cat.crc-16-cdma2000 width=16 poly=0xc867 init=0xffff refin=false refout=false xorout=0x0000 check=0x4c06 residue=0x0000 name="CRC-16/CDMA2000"
|
||||
crc.cat.crc-16-cms width=16 poly=0x8005 init=0xffff refin=false refout=false xorout=0x0000 check=0xaee7 residue=0x0000 name="CRC-16/CMS"
|
||||
crc.cat.crc-16-dds-110 width=16 poly=0x8005 init=0x800d refin=false refout=false xorout=0x0000 check=0x9ecf residue=0x0000 name="CRC-16/DDS-110"
|
||||
crc.cat.crc-16-dect-r width=16 poly=0x0589 init=0x0000 refin=false refout=false xorout=0x0001 check=0x007e residue=0x0589 name="CRC-16/DECT-R"
|
||||
crc.cat.crc-16-dect-x width=16 poly=0x0589 init=0x0000 refin=false refout=false xorout=0x0000 check=0x007f residue=0x0000 name="CRC-16/DECT-X"
|
||||
crc.cat.crc-16-dnp width=16 poly=0x3d65 init=0x0000 refin=true refout=true xorout=0xffff check=0xea82 residue=0x66c5 name="CRC-16/DNP"
|
||||
crc.cat.crc-16-en-13757 width=16 poly=0x3d65 init=0x0000 refin=false refout=false xorout=0xffff check=0xc2b7 residue=0xa366 name="CRC-16/EN-13757"
|
||||
crc.cat.crc-16-genibus width=16 poly=0x1021 init=0xffff refin=false refout=false xorout=0xffff check=0xd64e residue=0x1d0f name="CRC-16/GENIBUS"
|
||||
crc.cat.crc-16-gsm width=16 poly=0x1021 init=0x0000 refin=false refout=false xorout=0xffff check=0xce3c residue=0x1d0f name="CRC-16/GSM"
|
||||
crc.cat.crc-16-lj1200 width=16 poly=0x6f63 init=0x0000 refin=false refout=false xorout=0x0000 check=0xbdf4 residue=0x0000 name="CRC-16/LJ1200"
|
||||
crc.cat.crc-16-maxim width=16 poly=0x8005 init=0x0000 refin=true refout=true xorout=0xffff check=0x44c2 residue=0xb001 name="CRC-16/MAXIM"
|
||||
crc.cat.crc-16-mcrf4xx width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0x0000 check=0x6f91 residue=0x0000 name="CRC-16/MCRF4XX"
|
||||
crc.cat.crc-16-opensafety-a width=16 poly=0x5935 init=0x0000 refin=false refout=false xorout=0x0000 check=0x5d38 residue=0x0000 name="CRC-16/OPENSAFETY-A"
|
||||
crc.cat.crc-16-opensafety-a width=16 poly=0x755b init=0x0000 refin=false refout=false xorout=0x0000 check=0x20fe residue=0x0000 name="CRC-16/OPENSAFETY-B"
|
||||
crc.cat.crc-16-profibus width=16 poly=0x1dcf init=0xffff refin=false refout=false xorout=0xffff check=0xa819 residue=0xe394 name="CRC-16/PROFIBUS"
|
||||
crc.cat.crc-16-riello width=16 poly=0x1021 init=0xb2aa refin=true refout=true xorout=0x0000 check=0x63d0 residue=0x0000 name="CRC-16/RIELLO"
|
||||
crc.cat.crc-16-t10-dif width=16 poly=0x8bb7 init=0x0000 refin=false refout=false xorout=0x0000 check=0xd0db residue=0x0000 name="CRC-16/T10-DIF"
|
||||
crc.cat.crc-16-teledisk width=16 poly=0xa097 init=0x0000 refin=false refout=false xorout=0x0000 check=0x0fb3 residue=0x0000 name="CRC-16/TELEDISK"
|
||||
crc.cat.crc-16-tms37157 width=16 poly=0x1021 init=0x89ec refin=true refout=true xorout=0x0000 check=0x26b1 residue=0x0000 name="CRC-16/TMS37157"
|
||||
crc.cat.crc-16-usb width=16 poly=0x8005 init=0xffff refin=true refout=true xorout=0xffff check=0xb4c8 residue=0xb001 name="CRC-16/USB"
|
||||
crc.cat.crc-a width=16 poly=0x1021 init=0xc6c6 refin=true refout=true xorout=0x0000 check=0xbf05 residue=0x0000 name="CRC-A"
|
||||
crc.cat.kermit width=16 poly=0x1021 init=0x0000 refin=true refout=true xorout=0x0000 check=0x2189 residue=0x0000 name="KERMIT"
|
||||
crc.cat.modbus width=16 poly=0x8005 init=0xffff refin=true refout=true xorout=0x0000 check=0x4b37 residue=0x0000 name="MODBUS"
|
||||
crc.cat.x-25 width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0xffff check=0x906e residue=0xf0b8 name="X-25"
|
||||
crc.cat.xmodem width=16 poly=0x1021 init=0x0000 refin=false refout=false xorout=0x0000 check=0x31c3 residue=0x0000 name="XMODEM"
|
||||
crc.cat-bits.24 width=24 poly=0x864cfb init=0xb704ce refin=false refout=false xorout=0x000000 check=0x21cf02 residue=0x000000 name="CRC-24"
|
||||
crc.cat.crc-24-ble width=24 poly=0x00065b init=0x555555 refin=true refout=true xorout=0x000000 check=0xc25a56 residue=0x000000 name="CRC-24/BLE"
|
||||
crc.cat.crc-24-flexray-a width=24 poly=0x5d6dcb init=0xfedcba refin=false refout=false xorout=0x000000 check=0x7979bd residue=0x000000 name="CRC-24/FLEXRAY-A"
|
||||
crc.cat.crc-24-flexray-b width=24 poly=0x5d6dcb init=0xabcdef refin=false refout=false xorout=0x000000 check=0x1f23b8 residue=0x000000 name="CRC-24/FLEXRAY-B"
|
||||
crc.cat.crc-24-interlaken width=24 poly=0x328b63 init=0xffffff refin=false refout=false xorout=0xffffff check=0xb4f3e6 residue=0x144e63 name="CRC-24/INTERLAKEN"
|
||||
crc.cat.crc-24-lte-a width=24 poly=0x864cfb init=0x000000 refin=false refout=false xorout=0x000000 check=0xcde703 residue=0x000000 name="CRC-24/LTE-A"
|
||||
crc.cat.crc-24-lte-b width=24 poly=0x800063 init=0x000000 refin=false refout=false xorout=0x000000 check=0x23ef52 residue=0x000000 name="CRC-24/LTE-B"
|
||||
crc.cat-bits.30 width=30 poly=0x2030b9c7 init=0x3fffffff refin=false refout=false xorout=0x3fffffff check=0x04c34abf residue=0x34efa55a name="CRC-30/CDMA"
|
||||
crc.cat-bits.31 width=31 poly=0x04c11db7 init=0x7fffffff refin=false refout=false xorout=0x7fffffff check=0x0ce9e46c residue=0x4eaf26f1 name="CRC-31/PHILIPS"
|
||||
crc.cat-bits.32 width=32 poly=0x04c11db7 init=0xffffffff refin=true refout=true xorout=0xffffffff check=0xcbf43926 residue=0xdebb20e3 name="CRC-32"
|
||||
crc.cat.crc-32-autosar width=32 poly=0xf4acfb13 init=0xffffffff refin=true refout=true xorout=0xffffffff check=0x1697d06a residue=0x904cddbf name="CRC-32/AUTOSAR"
|
||||
crc.cat.crc-32-bzip2 width=32 poly=0x04c11db7 init=0xffffffff refin=false refout=false xorout=0xffffffff check=0xfc891918 residue=0xc704dd7b name="CRC-32/BZIP2"
|
||||
crc.cat.crc-32c width=32 poly=0x1edc6f41 init=0xffffffff refin=true refout=true xorout=0xffffffff check=0xe3069283 residue=0xb798b438 name="CRC-32C"
|
||||
crc.cat.crc-32d width=32 poly=0xa833982b init=0xffffffff refin=true refout=true xorout=0xffffffff check=0x87315576 residue=0x45270551 name="CRC-32D"
|
||||
crc.cat.crc-32-mpeg-2 width=32 poly=0x04c11db7 init=0xffffffff refin=false refout=false xorout=0x00000000 check=0x0376e6e7 residue=0x00000000 name="CRC-32/MPEG-2"
|
||||
crc.cat.crc-32-posix width=32 poly=0x04c11db7 init=0x00000000 refin=false refout=false xorout=0xffffffff check=0x765e7680 residue=0xc704dd7b name="CRC-32/POSIX"
|
||||
crc.cat.crc-32q width=32 poly=0x814141ab init=0x00000000 refin=false refout=false xorout=0x00000000 check=0x3010bf7f residue=0x00000000 name="CRC-32Q"
|
||||
crc.cat.jamcrc width=32 poly=0x04c11db7 init=0xffffffff refin=true refout=true xorout=0x00000000 check=0x340bc6d9 residue=0x00000000 name="JAMCRC"
|
||||
crc.cat.xfer width=32 poly=0x000000af init=0x00000000 refin=false refout=false xorout=0x00000000 check=0xbd0be338 residue=0x00000000 name="XFER"
|
||||
crc.cat-bits.40 width=40 poly=0x0004820009 init=0x0000000000 refin=false refout=false xorout=0xffffffffff check=0xd4164fc646 residue=0xc4ff8071ff name="CRC-40/GSM"
|
||||
crc.cat-bits.64 width=64 poly=0x42f0e1eba9ea3693 init=0x0000000000000000 refin=false refout=false xorout=0x0000000000000000 check=0x6c40df5f0b497347 residue=0x0000000000000000 name="CRC-64"
|
||||
crc.cat.crc-64-go-iso width=64 poly=0x000000000000001b init=0xffffffffffffffff refin=true refout=true xorout=0xffffffffffffffff check=0xb90956c775a41001 residue=0x5300000000000000 name="CRC-64/GO-ISO"
|
||||
crc.cat.crc-64-we width=64 poly=0x42f0e1eba9ea3693 init=0xffffffffffffffff refin=false refout=false xorout=0xffffffffffffffff check=0x62ec59e3f1a4f00a residue=0xfcacbebd5931a992 name="CRC-64/WE"
|
||||
crc.cat.crc-64-xz width=64 poly=0x42f0e1eba9ea3693 init=0xffffffffffffffff refin=true refout=true xorout=0xffffffffffffffff check=0x995dc9bbdf1939fa residue=0x49958c9abd7d353f name="CRC-64/XZ"
|
||||
crc.cat-bits.82 width=82 poly=0x0308c0111011401440411 init=0x000000000000000000000 refin=true refout=true xorout=0x000000000000000000000 check=0x09ea83f625023801fd612 residue=0x000000000000000000000 name="CRC-82/DARC"
|
||||
@@ -117,9 +117,9 @@ start = local if args.LOCAL else remote
|
||||
%else:
|
||||
def start(argv=[], *a, **kw):
|
||||
if args.GDB:
|
||||
io = gdb.debug([${binary_repr}] + argv, gdbscript=gdbscript, *a, **kw)
|
||||
return gdb.debug([${binary_repr}] + argv, gdbscript=gdbscript, *a, **kw)
|
||||
else:
|
||||
io = process([${binary_repr}] + argv, *a, **kw)
|
||||
return process([${binary_repr}] + argv, *a, **kw)
|
||||
%endif
|
||||
|
||||
#===========================================================
|
||||
|
||||
+46
-13
@@ -157,6 +157,7 @@ class DynELF(object):
|
||||
elf(str,ELF): Path to the ELF file on disk, or a loaded :class:`pwnlib.elf.ELF`.
|
||||
'''
|
||||
self._elfclass = None
|
||||
self._elftype = None
|
||||
self._link_map = None
|
||||
self._waitfor = None
|
||||
self._bases = {}
|
||||
@@ -204,6 +205,22 @@ class DynELF(object):
|
||||
constants.ELFCLASS64: 64}[elfclass]
|
||||
return self._elfclass
|
||||
|
||||
@property
|
||||
def elftype(self):
|
||||
"""e_type from the elf header. In practice the value will almost always
|
||||
be 'EXEC' or 'DYN'. If the value is architecture-specific (between
|
||||
ET_LOPROC and ET_HIPROC) or invalid, KeyError is raised.
|
||||
"""
|
||||
if not self._elftype:
|
||||
Ehdr = {32: elf.Elf32_Ehdr, 64: elf.Elf64_Ehdr}[self.elfclass]
|
||||
elftype = self.leak.field(self.libbase, Ehdr.e_type)
|
||||
self._elftype = {constants.ET_NONE: 'NONE',
|
||||
constants.ET_REL: 'REL',
|
||||
constants.ET_EXEC: 'EXEC',
|
||||
constants.ET_DYN: 'DYN',
|
||||
constants.ET_CORE: 'CORE'}[elftype]
|
||||
return self._elftype
|
||||
|
||||
@property
|
||||
def link_map(self):
|
||||
"""Pointer to the runtime link_map object"""
|
||||
@@ -356,9 +373,7 @@ class DynELF(object):
|
||||
dynamic = leak.field(phead, Phdr.p_vaddr)
|
||||
self.status("PT_DYNAMIC @ %#x" % dynamic)
|
||||
|
||||
#Sometimes this is an offset instead of an address
|
||||
if 0 < dynamic < 0x400000:
|
||||
dynamic += base
|
||||
dynamic = self._make_absolute_ptr(dynamic)
|
||||
|
||||
return dynamic
|
||||
|
||||
@@ -392,9 +407,7 @@ class DynELF(object):
|
||||
self.status("Found %s at %#x" % (name, dynamic))
|
||||
ptr = leak.field(dynamic, Dyn.d_ptr)
|
||||
|
||||
# Sometimes this is an offset rather than an actual pointer.
|
||||
if 0 < ptr < 0x400000:
|
||||
ptr += self.libbase
|
||||
ptr = self._make_absolute_ptr(ptr)
|
||||
|
||||
return ptr
|
||||
|
||||
@@ -438,8 +451,7 @@ class DynELF(object):
|
||||
w.failure("Could not find DT_PLTGOT or DT_DEBUG")
|
||||
return None
|
||||
|
||||
if 0 < result < 0x400000:
|
||||
result += self.libbase
|
||||
result = self._make_absolute_ptr(result)
|
||||
|
||||
w.success('%#x' % result)
|
||||
return result
|
||||
@@ -672,11 +684,9 @@ class DynELF(object):
|
||||
if not all([strtab, symtab, hshtab]):
|
||||
self.failure("Could not find all tables")
|
||||
|
||||
# glibc pointers are relocated but uclibc are not
|
||||
if 0 < strtab < 0x400000:
|
||||
strtab += self.libbase
|
||||
symtab += self.libbase
|
||||
hshtab += self.libbase
|
||||
strtab = self._make_absolute_ptr(strtab)
|
||||
symtab = self._make_absolute_ptr(symtab)
|
||||
hshtab = self._make_absolute_ptr(hshtab)
|
||||
|
||||
#
|
||||
# Perform the hash lookup
|
||||
@@ -843,6 +853,29 @@ class DynELF(object):
|
||||
self.status("Magic did not match")
|
||||
pass
|
||||
|
||||
def _make_absolute_ptr(self, ptr_or_offset):
|
||||
"""For shared libraries (or PIE executables), many ELF fields may
|
||||
contain offsets rather than actual pointers. If the ELF type is 'DYN',
|
||||
the argument may be an offset. It will not necessarily be an offset,
|
||||
because the run-time linker may have fixed it up to be a real pointer
|
||||
already. In this case an educated guess is made, and the ELF base
|
||||
address is added to the value if it is determined to be an offset.
|
||||
"""
|
||||
if_ptr = ptr_or_offset
|
||||
if_offset = ptr_or_offset + self.libbase
|
||||
|
||||
# if the ELF type is not DYN, the value is a pointer
|
||||
|
||||
if self.elftype != 'DYN':
|
||||
return if_ptr
|
||||
|
||||
# if the ELF type may be DYN, guess
|
||||
|
||||
if 0 < ptr_or_offset < self.libbase:
|
||||
return if_offset
|
||||
else:
|
||||
return if_ptr
|
||||
|
||||
def stack(self):
|
||||
"""Finds a pointer to the stack via __environ, which is an exported
|
||||
symbol in libc, which points to the environment block.
|
||||
|
||||
@@ -127,6 +127,7 @@ kernel_configuration = [
|
||||
Enabled('SECURITY_DMESG_RESTRICT'),
|
||||
Enabled('SECURITY_NETWORK'),
|
||||
Enabled('SECURITY_SELINUX'),
|
||||
Enabled('ARCH_HAS_ELF_RANDOMIZE'),
|
||||
EnabledIfPresent('MSM_KERNEL_PROTECT'),
|
||||
|
||||
# Not really security relevant, but come on guys
|
||||
@@ -182,6 +183,8 @@ kernel_configuration = [
|
||||
Enabled('CPU_SW_DOMAIN_PAN', requires=['ARM'], minver=4.3),
|
||||
Enabled('CONFIG_ARM64_PAN', requires=['ARM64'], minver=4.3),
|
||||
Disabled('OABI_COMPAT'),
|
||||
Disabled('CP_ACCESS', requires=['ARM']),
|
||||
Disabled('CP_ACCESS64', requires=['ARM64']),
|
||||
|
||||
# Only relevant of MODULES are enabled
|
||||
Enabled('MODULE_SIG', requires=['MODULES']),
|
||||
|
||||
@@ -102,9 +102,9 @@ prstatus_types = {
|
||||
'aarch64': elf_prstatus_aarch64
|
||||
}
|
||||
|
||||
prspinfo_types = {
|
||||
32: elf_prspinfo_32,
|
||||
64: elf_prspinfo_64,
|
||||
prpsinfo_types = {
|
||||
32: elf_prpsinfo_32,
|
||||
64: elf_prpsinfo_64,
|
||||
}
|
||||
|
||||
siginfo_types = {
|
||||
@@ -437,8 +437,8 @@ class Corefile(ELF):
|
||||
#: The NT_PRSTATUS object.
|
||||
self.prstatus = None
|
||||
|
||||
#: The NT_PRSPINFO object
|
||||
self.prspinfo = None
|
||||
#: The NT_PRPSINFO object
|
||||
self.prpsinfo = None
|
||||
|
||||
#: The NT_SIGINFO object
|
||||
self.siginfo = None
|
||||
@@ -484,7 +484,7 @@ class Corefile(ELF):
|
||||
log.warn_once("%s does not use a supported corefile architecture, registers are unavailable" % self.file.name)
|
||||
|
||||
prstatus_type = prstatus_types.get(self.arch, None)
|
||||
prspinfo_type = prspinfo_types.get(self.bits, None)
|
||||
prpsinfo_type = prpsinfo_types.get(self.bits, None)
|
||||
siginfo_type = siginfo_types.get(self.bits, None)
|
||||
|
||||
with log.waitfor("Parsing corefile...") as w:
|
||||
@@ -505,10 +505,10 @@ class Corefile(ELF):
|
||||
# Try to find NT_PRPSINFO
|
||||
# Note that pyelftools currently mis-identifies the enum name
|
||||
# as 'NT_GNU_BUILD_ID'
|
||||
if note.n_descsz == ctypes.sizeof(prspinfo_type) and \
|
||||
if note.n_descsz == ctypes.sizeof(prpsinfo_type) and \
|
||||
note.n_type == 'NT_GNU_BUILD_ID':
|
||||
self.NT_PRSPINFO = note
|
||||
self.prspinfo = prspinfo_type.from_buffer_copy(note.n_desc)
|
||||
self.NT_PRPSINFO = note
|
||||
self.prpsinfo = prpsinfo_type.from_buffer_copy(note.n_desc)
|
||||
|
||||
# Try to find NT_SIGINFO so we can see the fault
|
||||
if note.n_type == 0x53494749:
|
||||
|
||||
@@ -595,7 +595,7 @@ class Elf64_auxv_t(ctypes.Structure):
|
||||
_fields_ = [('a_type', ctypes.c_uint64),
|
||||
('a_val', ctypes.c_uint64),]
|
||||
|
||||
def generate_prspinfo(long):
|
||||
def generate_prpsinfo(long):
|
||||
return [
|
||||
('pr_state', byte),
|
||||
('pr_sname', char),
|
||||
@@ -612,11 +612,11 @@ def generate_prspinfo(long):
|
||||
('pr_psargs', char * 80)
|
||||
]
|
||||
|
||||
class elf_prspinfo_32(ctypes.Structure):
|
||||
_fields_ = generate_prspinfo(Elf32_Addr)
|
||||
class elf_prpsinfo_32(ctypes.Structure):
|
||||
_fields_ = generate_prpsinfo(Elf32_Addr)
|
||||
|
||||
class elf_prspinfo_64(ctypes.Structure):
|
||||
_fields_ = generate_prspinfo(Elf64_Addr)
|
||||
class elf_prpsinfo_64(ctypes.Structure):
|
||||
_fields_ = generate_prpsinfo(Elf64_Addr)
|
||||
|
||||
def generate_siginfo(int_t, long_t):
|
||||
class siginfo_t(ctypes.Structure):
|
||||
|
||||
+4
-4
@@ -524,7 +524,7 @@ def attach(target, gdbscript = None, exe = None, need_ptrace_scope = True, gdb_a
|
||||
.. code-block:: python
|
||||
|
||||
# Connect to the SSH server
|
||||
shell = ssh('bandit0', 'bandit.labs.overthewire.org', password='bandit0')
|
||||
shell = ssh('bandit0', 'bandit.labs.overthewire.org', password='bandit0', port=2220)
|
||||
|
||||
# Start a process on the server
|
||||
cat = shell.process(['cat'])
|
||||
@@ -596,7 +596,7 @@ def attach(target, gdbscript = None, exe = None, need_ptrace_scope = True, gdb_a
|
||||
cmd = ['sshpass', '-p', shell.password] + cmd
|
||||
if shell.keyfile:
|
||||
cmd += ['-i', shell.keyfile]
|
||||
cmd += ['gdb %r %s -x "%s"' % (target.executable,
|
||||
cmd += ['gdb -q %r %s -x "%s"' % (target.executable,
|
||||
target.pid,
|
||||
tmpfile)]
|
||||
|
||||
@@ -763,7 +763,7 @@ def find_module_addresses(binary, ssh=None, ulimit=False):
|
||||
Example:
|
||||
|
||||
>>> with context.local(log_level=9999): # doctest: +SKIP
|
||||
... shell = ssh(host='bandit.labs.overthewire.org',user='bandit0',password='bandit0')
|
||||
... shell = ssh(host='bandit.labs.overthewire.org',user='bandit0',password='bandit0', port=2220)
|
||||
... bash_libs = gdb.find_module_addresses('/bin/bash', shell)
|
||||
>>> os.path.basename(bash_libs[0].path) # doctest: +SKIP
|
||||
'libc.so.6'
|
||||
@@ -790,7 +790,7 @@ def find_module_addresses(binary, ssh=None, ulimit=False):
|
||||
# Get the addresses from GDB
|
||||
#
|
||||
libs = {}
|
||||
cmd = "gdb --args %s" % (binary)
|
||||
cmd = "gdb -q --args %s" % (binary)
|
||||
expr = re.compile(r'(0x\S+)[^/]+(.*)')
|
||||
|
||||
if ulimit:
|
||||
|
||||
+23
-4
@@ -11,7 +11,9 @@ from pwnlib.term import termcap
|
||||
|
||||
__all__ = ['getch', 'getraw', 'get', 'unget']
|
||||
|
||||
|
||||
# When set, convert keypad codes into regular key presses, e.g. "+" instead of
|
||||
# `<kp plus>`
|
||||
FLAG_CONVERTKP = True
|
||||
|
||||
try: _fd = sys.stdin.fileno()
|
||||
except Exception: _fd = file('/dev/null', 'r').fileno()
|
||||
@@ -310,7 +312,24 @@ _csi_ss3s = {
|
||||
}
|
||||
|
||||
_csi_ss3kp = {
|
||||
|
||||
'M': (kc.TYPE_KEYSYM, kc.KEY_KPENTER , None),
|
||||
'X': (kc.TYPE_KEYSYM, kc.KEY_KPEQUALS, '='),
|
||||
'j': (kc.TYPE_KEYSYM, kc.KEY_KPMULT , '*'),
|
||||
'k': (kc.TYPE_KEYSYM, kc.KEY_KPPLUS , '+'),
|
||||
'l': (kc.TYPE_KEYSYM, kc.KEY_KPCOMMA , ','),
|
||||
'm': (kc.TYPE_KEYSYM, kc.KEY_KPMINUS , '-'),
|
||||
'n': (kc.TYPE_KEYSYM, kc.KEY_KPPERIOD, '.'),
|
||||
'o': (kc.TYPE_KEYSYM, kc.KEY_KPDIV , '/'),
|
||||
'p': (kc.TYPE_KEYSYM, kc.KEY_KP0 , '0'),
|
||||
'q': (kc.TYPE_KEYSYM, kc.KEY_KP1 , '1'),
|
||||
'r': (kc.TYPE_KEYSYM, kc.KEY_KP2 , '2'),
|
||||
's': (kc.TYPE_KEYSYM, kc.KEY_KP3 , '3'),
|
||||
't': (kc.TYPE_KEYSYM, kc.KEY_KP4 , '4'),
|
||||
'u': (kc.TYPE_KEYSYM, kc.KEY_KP5 , '5'),
|
||||
'v': (kc.TYPE_KEYSYM, kc.KEY_KP6 , '6'),
|
||||
'w': (kc.TYPE_KEYSYM, kc.KEY_KP7 , '7'),
|
||||
'x': (kc.TYPE_KEYSYM, kc.KEY_KP8 , '8'),
|
||||
'y': (kc.TYPE_KEYSYM, kc.KEY_KP9 , '9'),
|
||||
}
|
||||
|
||||
_csi_funcs = {
|
||||
@@ -373,14 +392,14 @@ def _peekkey_ss3(offset):
|
||||
cmd = _cbuf[offset]
|
||||
if cmd < 0x40 or cmd >= 0x80:
|
||||
return
|
||||
_cbuf = _cbuf[numb:] # XXX: numb is not defined
|
||||
_cbuf = _cbuf[offset:]
|
||||
|
||||
if chr(cmd) in _csi_ss3s:
|
||||
return Key(*_csi_ss3s[chr(cmd)])
|
||||
|
||||
if chr(cmd) in _csi_ss3kp:
|
||||
t, c, a = _csi_ss3kp[chr(cmd)]
|
||||
if CONVERTKP and a: # XXX: CONVERTKP is not defined
|
||||
if FLAG_CONVERTKP and a:
|
||||
return Key(kc.TYPE_UNICODE, a)
|
||||
else:
|
||||
return Key(t, c)
|
||||
|
||||
@@ -11,6 +11,7 @@ import pty
|
||||
import resource
|
||||
import select
|
||||
import signal
|
||||
import stat
|
||||
import subprocess
|
||||
import time
|
||||
import tty
|
||||
@@ -551,7 +552,7 @@ class process(tube):
|
||||
elif os.path.sep not in executable:
|
||||
tmp = executable
|
||||
executable = os.path.join(cwd, executable)
|
||||
log.warn_once("Could not find executable %r in $PATH, using %r instead" % (tmp, executable))
|
||||
self.warn_once("Could not find executable %r in $PATH, using %r instead" % (tmp, executable))
|
||||
|
||||
if not os.path.exists(executable):
|
||||
self.error("%r does not exist" % executable)
|
||||
|
||||
@@ -73,7 +73,7 @@ class remote(sock):
|
||||
except socket.gaierror as e:
|
||||
if e.errno != socket.EAI_NONAME:
|
||||
raise
|
||||
log.error('Could not resolve hostname: %r' % host)
|
||||
self.error('Could not resolve hostname: %r' % host)
|
||||
if self.sock:
|
||||
self.settimeout(self.timeout)
|
||||
self.lhost, self.lport = self.sock.getsockname()[:2]
|
||||
|
||||
+1
-1
@@ -1908,7 +1908,7 @@ from ctypes import *; libc = CDLL('libc.so.6'); print(libc.getenv(%r))
|
||||
|
||||
Example:
|
||||
|
||||
>>> s = ssh("esoteric3", "wargame.w3challs.com", 20202, "esoteric3")
|
||||
>>> s = ssh("travis", "example.pwnme")
|
||||
>>> s.aslr
|
||||
True
|
||||
"""
|
||||
|
||||
+846
-602
File diff suppressed because it is too large.
Load diff
+6
-9
@@ -213,25 +213,22 @@ def run_in_new_terminal(command, terminal = None, args = None):
|
||||
elif 'TERM_PROGRAM' in os.environ:
|
||||
terminal = os.environ['TERM_PROGRAM']
|
||||
args = []
|
||||
elif 'DISPLAY' in os.environ:
|
||||
elif 'DISPLAY' in os.environ and which('x-terminal-emulator'):
|
||||
terminal = 'x-terminal-emulator'
|
||||
args = ['-e']
|
||||
elif 'TMUX' in os.environ:
|
||||
elif 'TMUX' in os.environ and which('tmux'):
|
||||
terminal = 'tmux'
|
||||
args = ['splitw']
|
||||
|
||||
if not terminal:
|
||||
log.error('Argument `terminal` is not set, and could not determine a default')
|
||||
|
||||
terminal_path = which(terminal)
|
||||
|
||||
if not terminal_path:
|
||||
log.error('Could not find terminal: %s' % terminal)
|
||||
log.error('Could not find a terminal binary to use. Set context.terminal to your terminal.')
|
||||
elif not which(terminal):
|
||||
log.error('Could not find terminal binary %r. Set context.terminal to your terminal.' % terminal)
|
||||
|
||||
if isinstance(args, tuple):
|
||||
args = list(args)
|
||||
|
||||
argv = [terminal_path] + args
|
||||
argv = [which(terminal)] + args
|
||||
|
||||
if isinstance(command, str):
|
||||
if ';' in command:
|
||||
|
||||
+23
-26
@@ -697,36 +697,33 @@ def dd(dst, src, count = 0, skip = 0, seek = 0, truncate = False):
|
||||
The seek offset of file objects will be preserved.
|
||||
|
||||
Arguments:
|
||||
dst: Supported types are `:class:file`, `:class:list`, `:class:tuple`,
|
||||
`:class:str`, `:class:bytearray` and `:class:unicode`.
|
||||
src: An iterable of byte values (characters or integers), a unicode
|
||||
string or a file object.
|
||||
count (int): How many bytes to copy. If `count` is 0 or larger than
|
||||
``len(src[seek:])``, all bytes until the end of `src` are
|
||||
copied.
|
||||
skip (int): Offset in `dst` to copy to.
|
||||
seek (int): Offset in `src` to copy from.
|
||||
truncate (bool): If `:const:True`, `dst` is truncated at the last copied
|
||||
byte.
|
||||
dst: Supported types are `:class:file`, `:class:list`, `:class:tuple`,
|
||||
`:class:str`, `:class:bytearray` and `:class:unicode`.
|
||||
src: An iterable of byte values (characters or integers), a unicode
|
||||
string or a file object.
|
||||
count (int): How many bytes to copy. If `count` is 0 or larger than
|
||||
``len(src[seek:])``, all bytes until the end of `src` are
|
||||
copied.
|
||||
skip (int): Offset in `dst` to copy to.
|
||||
seek (int): Offset in `src` to copy from.
|
||||
truncate (bool): If `:const:True`, `dst` is truncated at the last copied
|
||||
byte.
|
||||
|
||||
Returns:
|
||||
A modified version of `dst`. If `dst` is a mutable type it will be
|
||||
modified in-place.
|
||||
A modified version of `dst`. If `dst` is a mutable type it will be
|
||||
modified in-place.
|
||||
|
||||
Examples:
|
||||
>>> dd(tuple('Hello!'), '?', skip = 5)
|
||||
('H', 'e', 'l', 'l', 'o', '?')
|
||||
>>> dd(list('Hello!'), (63,), skip = 5)
|
||||
['H', 'e', 'l', 'l', 'o', '?']
|
||||
>>> write('/tmp/foo', 'A' * 10)
|
||||
... dd(file('/tmp/foo'), file('/dev/zero'), skip = 3, count = 4)
|
||||
... read('/tmp/foo')
|
||||
'AAA\x00\x00\x00\x00AAA'
|
||||
>>> write('/tmp/foo', 'A' * 10)
|
||||
... dd(file('/tmp/foo'), file('/dev/zero'), skip = 3, count = 4, truncate = True)
|
||||
... read('/tmp/foo')
|
||||
'AAA\x00\x00\x00\x00'
|
||||
|
||||
>>> dd(tuple('Hello!'), '?', skip = 5)
|
||||
('H', 'e', 'l', 'l', 'o', '?')
|
||||
>>> dd(list('Hello!'), (63,), skip = 5)
|
||||
['H', 'e', 'l', 'l', 'o', '?']
|
||||
>>> file('/tmp/foo', 'w').write('A' * 10)
|
||||
>>> dd(file('/tmp/foo'), file('/dev/zero'), skip = 3, count = 4).read()
|
||||
'AAA\\x00\\x00\\x00\\x00AAA'
|
||||
>>> file('/tmp/foo', 'w').write('A' * 10)
|
||||
>>> dd(file('/tmp/foo'), file('/dev/zero'), skip = 3, count = 4, truncate = True).read()
|
||||
'AAA\\x00\\x00\\x00\\x00'
|
||||
"""
|
||||
|
||||
# Re-open file objects to make sure we have the mode right
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
__version__ = '3.6.0'
|
||||
__version__ = '3.7.0'
|
||||
@@ -86,7 +86,7 @@ except Exception as e:
|
||||
setup(
|
||||
name = 'pwntools',
|
||||
packages = find_packages(),
|
||||
version = '3.6.0',
|
||||
version = '3.7.0',
|
||||
data_files = [('',
|
||||
glob.glob('*.md') + glob.glob('*.txt')),
|
||||
],
|
||||
@@ -97,6 +97,7 @@ setup(
|
||||
'data/binutils/*',
|
||||
'data/includes/*.h',
|
||||
'data/includes/*/*.h',
|
||||
'data/templates/*.mako',
|
||||
] + templates,
|
||||
},
|
||||
entry_points = {'console_scripts': console_scripts},
|
||||
|
||||
+8
-3
@@ -65,9 +65,14 @@ setup_travis()
|
||||
setup_linux()
|
||||
{
|
||||
sudo apt-get install -y software-properties-common openssh-server libncurses5-dev libncursesw5-dev openjdk-8-jre-headless
|
||||
sudo apt-add-repository --yes ppa:pwntools/binutils
|
||||
sudo apt-get update
|
||||
sudo apt-get install binutils-arm-linux-gnu binutils-mips-linux-gnu binutils-powerpc-linux-gnu
|
||||
RELEASE="$(lsb-release -sr)"
|
||||
if [[ "$RELEASE" < "16.04" ]]; then
|
||||
sudo apt-add-repository --yes ppa:pwntools/binutils
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y binutils-arm-linux-gnu binutils-mips-linux-gnu binutils-powerpc-linux-gnu
|
||||
else
|
||||
sudo apt-get install -y binutils-arm-linux-gnueabihf binutils-mips-linux-gnu binutils-powerpc-linux-gnu
|
||||
fi
|
||||
}
|
||||
|
||||
setup_android_emulator()
|
||||
|
||||
Reference in new issue
Block a user