Compare commits

..
4018 Commits
Author SHA1 Message Date
peace-maker 8bc6f6cd2b Merge pull request #2796 from peace-maker/stable_backports
Backport bugfixes from 5.0 to stable
2026-11-08 08:49:07 +01:00
peace-maker 455c8c02c3 Backport: Test on Python 3.15 (#2792)
* Test on Python 3.15

* Use `RLIM_INFINITY` instead of `-1` constant for rlimit modification

Python 3.15 warns against using negative values instead of the constant:

DeprecationWarning: Use RLIM_INFINITY instead of negative limit value.

It has been available since Python 2.

* Update CHANGELOG
2026-10-30 20:49:30 +01:00
Carlos Luna-Pena dbc618de0d Backport: fix #2737: pwnlib.shellcraft submodule imports on python 3.12+ (#2739)
* shellcraft: migrate lazy importer to find_spec for py3.12+

* shellcraft: changelog entry + mypy baseline sync for #2739
2026-10-30 20:49:06 +01:00
peace-maker 34b8345d1d Backport: Support paginated libc.rip API requests (#2767)
* Support paginated libc.rip API requests

libc.rip used to truncate the result set but supports pagination now. Fetch all results reliably now by requesting all pages.

Fixes #2651

* Update CHANGELOG
2026-10-30 20:49:05 +01:00
Peace-Maker 771c7f81ac Backport: Skip ssh.ibt doctest since some runners appear to support it now 2026-10-30 20:49:05 +01:00
Taran 8d69dc6142 Backport: fix(srop): correct amd64 SigreturnFrame uc_sigmask offset (#2762)
* fix(srop): correct amd64 SigreturnFrame uc_sigmask offset

* changelog: add entry for #2762
2026-10-30 20:49:05 +01:00
peace-maker 3911a6a12e Backport: Fix libcdb CI cache not forwarding URI path (#2749)
The nginx docs say that you have to specify the $request_uri manually when a variable is used in the `proxy_pass` value.
Since we just put `/` at the end, all requests were rewritten to `/` instead of the intended e.g. `/api/find` endpoints.

https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

This broke in #2718 but didn't manifest right away since the responses were still cached in CI. Now after the cache expired the fetch failed.
2026-10-30 20:49:05 +01:00
ChrisJr404andChris a5f3873194 Backport: safeeval: allow LIST_APPEND and SET_ADD opcodes (Python 3.14) (#2722)
* safeeval: allow LIST_APPEND and SET_ADD opcodes (Python 3.14)

* changelog: add entry for #2722 (safeeval Python 3.14 opcodes)

* ci: retrigger after transient libcdb network failure

---------

Co-authored-by: Chris (ChrisJr404) <[email protected]>
2026-10-30 20:49:05 +01:00
peace-maker 481704bfd8 Backport: ssh: Discard stderr of lsb_release for Distro lookup (#2704)
* ssh: Discard stderr of `lsb_release`

The "No LSB modules are available." spam interferes with parsing the output for the initial checksec distro parsing when connecting to a new host.

* Update CHANGELOG
2026-10-30 20:49:05 +01:00
zackary 5196a1a0f0 Backport: fix: delay upstream DNS resolution to prevent startup failures (#2718)
Use nginx variable pattern (set $upstream + proxy_pass https://$upstream)
to defer DNS resolution until first request instead of at config parse time.

This fixes the occasional 'host not found in upstream' error in CI when
nginx container starts before Docker DNS is fully available.

Fixes #2712
2026-10-30 20:49:05 +01:00
Peace-Maker be705326a7 Backport: libcdb CI cache: Resolve upstream hostnames on request
Instead of trying to resolve all of them when nginx starts and exit
if any of them fail to resolve.

[emerg] 1#1: host not found in upstream "debuginfod.elfutils.org" in /etc/nginx/nginx.conf:23
2026-10-30 20:49:05 +01:00
Peace-Maker c7e6ef37c8 Backport: Cache gitlab.com libcdb responses in CI
The reponses set a cloudflare `_cfuvid` cookie and had a cache time of 60 seconds.
nginx doesn't cache responses with a `Set-Cookie` header by default,
so ignore the cookie and override the cache time to 12 weeks.

Fixes #2494
2026-10-30 20:49:05 +01:00
Arusekk 210faac75b Backport: no atexit, OS will suffice 2026-10-30 20:49:05 +01:00
peace-maker 8e0e4c6c90 Backport: Close SSH client connection when authentication failed (#2688)
* Close SSH client when authentication failed

The TCP connection stayed open after an exception was thrown
during authentication, even when a `with`-statement guarding the call.
Close the connection before re-raising the exception.

Fixes #2678

* Update CHANGELOG
2026-10-30 20:49:05 +01:00
peace-maker bbac6660b2 Backport: Fix tty and raw arguments in ssh.process (#2699)
* Fix `tty` and `raw` arguments in ssh.process

The arguments were unused and not passed through to the underlying `ssh_process` class.

Fixes #2038

* Add tty tests

* Update CHANGELOG

* Fix buffered process environment output without tty
2026-10-30 20:49:05 +01:00
Rin 2a986f12c1 Backport: refactor: replace unsafe eval with ast.literal_eval in ROP cache loading (#2677)
* refactor: replace unsafe eval with ast.literal_eval in ROP cache loading

* docs: add PR link to CHANGELOG reference section

* docs: restore full CHANGELOG and correctly add PR #2677 reference
2026-10-30 20:49:05 +01:00
peace-maker b60ed9928d Backport: Fix typo causing doctests not getting skipped (#2681)
Downloading all those libcs slowed down the CI a lot.
2026-10-30 20:49:05 +01:00
peace-maker b1391984d1 Backport: asm: try native binutils before fallback architectures (#2669)
* asm: try native binutils before fallback architectures

Some binutils builds support multiple architectures,
like the x86_64 assembler supports i386 too in most
package builds and vice versa. We support this by trying
the other binutils as well when looking for the right tool.
That support is optional though and there are packages
that don't include the "cross" compilation.

When assembling for the host's native architecture, we
still prefer the explicitly named `x86_64-linux-gnu-as`
instead of the native `as` binary. That native binary is
tried as a last resort after looking for any other explictly
named binary. If the fallback package is installed but
compiled without the cross-compiler support, we'd still
find the `i386-as` binary while looking for `x86_64-as`
before trying the native `as` binary.
That would fail to assemble.

This patch moves the native `as` binary forward in the list
to try it before checking the other fallback architecture ones.

Fixes #2509

* Update CHANGELOG
2026-10-30 20:49:05 +01:00
Th3S dd747e1062 Backport: fix(libcdb-cli): return early if no matched libc found (#2646)
* Fix: return early if no matched libc found

* Update CHANGELOG
2026-10-30 20:49:05 +01:00
peace-maker 78fccc055f Backport: Remove "pip" as explicit dependency (#2642)
It looks like this was done to work around a bug in an old pip version years ago.
It caused problems when freezing dependencies which unnecessarily forced pip to the version used at freeze time when installing again.

Fixes #2625
2026-10-30 20:49:05 +01:00
OBarronCS 4f50b45586 Backport: Add aarch64_be qemu mapping (#2653) 2026-10-30 20:49:05 +01:00
a1c7d07db8 Backport: GitHub Actions: Test on Python 3.14 (#2627)
* GitHub Actions: Test on Python 3.14

Python v3.14 -- October 7th
* https://www.python.org/download/pre-releases
* https://www.python.org/downloads/release/python-3140rc3
* https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#allow-pre-releases

* Allow new LOAD_SMALL_INT opcode in safeeval

* Support lambdas in mbruteforce

* Drop pwnlib.util.iters.lookahead

---------

Co-authored-by: Peace-Maker <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2026-10-30 20:49:05 +01:00
Arusekk 6691e8476a Backport: template: error message and fallback on no docker 2026-10-30 20:49:05 +01:00
peace-maker a8bcdf6f8d Backport: Fix log.progress ignoring context.log_console (#2610)
* Fix `log.progress` ignoring `context.log_console`

When setting `context.log_console` to something other than stdout, spinners while using `log.progress` would still be printed to stdout.
Redirect them to the stream specified by `context.log_console` and don't animate if it's not a tty.

Fixes #1702

* Update CHANGELOG
2026-10-30 20:49:05 +01:00
k4lizen bf5e4df220 Backport: Fix aarch64 ABI (#2598)
* upd aarch64 abi

* changelog
2026-10-30 20:49:05 +01:00
Shordenandpeace-maker 68b5bbf16b Backport: Support context.timeout in ~/.pwn.conf (#2592)
* Add float to supported config types

This change functionally just allows setting `context.timeout` in
~/.pwn.conf.

* update changelog

---------

Co-authored-by: peace-maker <[email protected]>
2026-10-30 20:49:05 +01:00
Arusekk 9a7e197754 Backport: Fix double exception on gaierror
Closes #2581
2026-10-30 20:49:05 +01:00
Zach Hanson 96c3ede156 Backport: Fix a bug that incorrectly reports GNU_STACK missing when its not. (#2493) 2026-10-30 20:49:05 +01:00
RocketDev f2eba7c8fd Backport: ROP: fix ROP(ELF(exe)).leave is None in some ELF (#2506)
* ROP: fix `self.leave is None` in some libc

When `pop rbp; pop rsp; ret;` exists in libc, it is chosen instead of
`leave`. Add a specific `order` to filter out the former one.

* add changelog for #2506

* ROP: add sp_move when `pop rsp`

* CHANGELOG: mv #2506 to `5.0.0`
2026-10-30 20:49:05 +01:00
peace-maker 1c7d917432 Backport: CI: Test on Python 3.13 (#2534) 2026-10-30 20:49:05 +01:00
tesujiandpeace-maker 1553670f9d Backport: checksec: Do NOT error when passing directory arguments to commandline tool (#2530)
I often use `checksec *` to lazily avoid typing filenames in a directory.
If the directory contains any other sub-dirs, the command fails.
With this patch, checksec will silently skip dir paths. There's still
TOCTOU issue but I don't think checksec do anything important enough
to explicitly use try/catch to account for that.

Co-authored-by: peace-maker <[email protected]>
2026-10-30 20:49:05 +01:00
peace-maker 8f67b7b7b5 Backport: Raise EOFError during process.recv when stdout closes on Windows (#2524)
* Windows: Raise EOFError during process.recv when stdout closes

If the receiving thread terminates while we're waiting for data to arrive we'd be waiting endlessly. Raise EOFError when .recv()ing on a process with stdout closed and no more data queued up from the receiver thread.

* Update CHANGELOG
2026-10-30 20:49:05 +01:00
Rahulandrahul05ranjan 459dfd7e35 fix(regsort): drop self-assignments through register aliases (#2795)
* fix(regsort): drop self-assignments through register aliases

The self-assignment drop compared register names only (k != v), so an
assignment through an alias (e.g. {'ax': 'eax'} with registers.native32)
was not recognized as a no-op.  It then surfaced as a spurious
1-register dependency cycle, which either raised PwnlibException with
xchg=False or emitted a useless 'mov' of a register into its own alias.

With xchg=False and other registers present, the bogus cycle also
forced the temporary-register code path, reordering unrelated moves and
silently leaving registers with wrong values (see the linked issue).

Compare the mapped names instead, like the rest of the function.

Fixes #2794

Co-authored-by: rahul05ranjan <[email protected]>

* docs(changelog): add regsort register-alias self-assignment fix entry

---------

Co-authored-by: Rahul Ranjan <[email protected]>
2026-10-30 16:20:25 +01:00
peace-maker d8d47977ac gdb.corefile: Run gdb directly to prevent detach race (#2787)
* gdb.corefile: Run gdb directly to prevent detach race

`attach()` waits for the debugger to attach by polling the `TracerPid` regularly. `corefile()` runs `detach` in gdb after dumping the core, so the debugger might attach and detach between two `TracerPid` polls and `wait_for_debugger()` thinks gdb exited before attaching and returns `None` as gdb's pid is no longer valid.

Later `corefile()` ran `psutil.Process(pid).wait()` with `pid = None` which effectively waited on the Python process itself to exit.
This caused a hang in the doctest CI sometimes, which was killed by the watchdog timer eventually.

Run `gdb` directly and just observe the exit code instead of relying on the more advanced `attach` logic for longer running debug sessions.

* Update CHANGELOG
2026-10-26 06:15:28 +00:00
Max Freedom Pollardandpeace-maker 3daf28b6be fix(packing): dd() raises TypeError on a bytearray destination (#2772)
* fix(packing): dd() raises TypeError on a bytearray destination

dd() documents bytearray as a supported destination type, but
dd(bytearray(b'Hello!'), b'?', skip=5) raises
"TypeError: 'bytes' object cannot be interpreted as an integer".

pwnlib/util/packing.py:1108 handled list and bytearray destinations in a
single branch and filled both with list(map(p8, bytearray(src))). p8()
returns a length-1 bytes object, which is what a list destination is
documented to hold (see the existing dd(list('Hello!'), (63,), skip=5)
doctest), but a bytearray slice assignment needs an iterable of int, so
every bytearray destination crashed.

Assign the byte string src directly when the destination is a bytearray.
Every src branch above the destination dispatch (packing.py:1039-1089)
has already reduced src to a byte string, so the slice assignment is
always valid. This also makes a bytearray destination agree with the
bytes and str destinations, which already copy src verbatim.

Add a doctest covering the returned value and the in-place update of the
caller's bytearray.

* Add changelog entry for #2772

---------

Co-authored-by: peace-maker <[email protected]>
2026-10-24 12:15:03 +02:00
h4kk4p4kk4andpeace-maker f4b3e6e1c4 fix(elf): prevent elf.libc returning the executable when its name starts with libc[.-] (#2781)
Co-authored-by: peace-maker <[email protected]>
2026-10-24 12:12:47 +02:00
Max Freedom PollardandPeace-Maker 2b39684912 Disable debuginfod doctests in libcdb.unstrip_libc on stable (#2773)
* Disable debuginfod tests in libcdb.unstrip_libc

The external debuginfod servers are really slow or won't respond at all like debuginfod.ubuntu.com.
The caching in CI doesn't help since we only cache it for 3 month and the query fails afterwards most of the time. We cache the negative response too which doesn't help if the service is flakey itself :D

(cherry picked from commit 86cafce196)

* Add changelog entry for #2773

---------

Co-authored-by: Peace-Maker <[email protected]>
2026-10-21 20:04:53 +02:00
peace-maker 7e5e79d00f Allow running with Unicorn 2.1.[34] but throw when emulating MIPS (#2721)
* Allow running with Unicorn 2.1.[34] but throw when emulating MIPS

Unicorn 2.1.5 wasn't released for a while and 2.1.2 doesn't have binary wheels for Python 3.14.
This made installing pwntools on newer Python versions more annoying since you had to build Unicorn yourself.

The only problem with the blocked versions is MIPS emulation, so only avoid that while allowing to use Unicorn 2.1.3 or 2.1.4 for other architectures.

Refs #2621

* Update CHANGELOG
2026-04-27 18:23:01 +02:00
0xDanielandpeace-maker e551b4ae56 fix: apply force_to_bytes to readline result in non-term_mode path (#2707)
Co-authored-by: peace-maker <[email protected]>
2026-04-07 11:28:48 +02:00
43ef1b494c Fix _build_date() crash on non-standard locale date strings (#2701)
* Fix _build_date() crash on non-standard locale date strings (#2513)

Some Android devices return locale-dependent strings in ro.build.date
(e.g. '2017年 11月 14日 星期二 09:55:07 CST' for Chinese locale) that
dateutil.parser.parse() cannot handle, causing wait_for_device() to
crash with a ParserError.

Fix: prefer ro.build.date.utc (integer epoch timestamp) which is
locale-independent and available on all Android devices. Fall back
to ro.build.date with error handling if the UTC property is missing.

* Add CHANGELOG entry for #2513 fix

* Simplify _build_date(): prefer ro.build.date.utc, keep minimal fallback

Address review: ro.build.date.utc is set by the AOSP build system
and available on all standard Android devices. Simplified comments
to reflect this is the primary path, with ro.build.date kept only
as a fallback for non-standard builds.

* Move CHANGELOG entry

* Fix Python 2.7 compatibility

* Disable intro doctest connecting to `ftp.ubuntu.com`

The FTP server is throttled in CI or just really slow. We already test the basic tcp tubes in the `remote` tests.

---------

Co-authored-by: coder999999999 <[email protected]>
Co-authored-by: peace-maker <[email protected]>
2026-04-07 11:09:01 +02:00
be92aa1b4c fix: pad bytes fields to correct field size in FileStructure (#2694)
* fix: pad bytes fields to correct field size in FileStructure

When setting bytes fields (e.g. _IO_save_base) on FileStructure, the
value was padded to context.bytes instead of the actual field size from
self.length[val]. This caused struct.pack errors for fields whose size
differs from the pointer size.

Fixes #2693

* Cleanup test and add CHANGELOG

---------

Co-authored-by: nightcityblade <[email protected]>
Co-authored-by: Peace-Maker <[email protected]>
2026-04-05 20:37:31 +00:00
Peace-Maker 07f3caadc4 Stay with pylint < 4.0 until recursion errors are fixed
https://github.com/pylint-dev/pylint/issues/9190
2025-10-16 16:17:08 +02:00
Peace-Maker 3ad86ec5ad Release 4.15.0 2025-10-12 16:48:05 +02:00
Arusekk b5076d9262 Merge branch 'stable' into beta 2025-09-26 09:54:54 +02:00
ArusekkandHackrrr 77b4f06b07 docs: warn that .libs/.libc/.maps are dangerous (#2626)
Co-authored-by: Hackrrr <[email protected]>
2025-09-26 07:36:34 +00:00
Arusekk 4968499d11 ffix: ugly ELF docs (whitespace only) 2025-09-26 09:20:53 +02:00
Peace-Maker f38991bc02 Merge branch 'stable' into beta 2025-09-16 21:41:00 +02:00
peace-maker d0e6ee4b37 Fix regression: gdbserver can't handle command-line argument containing whitespace (#2624)
* Fix regression: gdbserver can't handle command-line argument containing whitespace

The `--no-startup-with-shell` argument was passed in an attempt to
fix gdbserver startup with `SHELL=/bin/fish`. (#2377) It caused a regression
which disallowed passing arguments containing whitespace to the debuggee in `gdb.debug`.

gdbserver would exit with a message:
"can't handle command-line argument containing whitespace"

There is a 3 second timeout waiting for gdbserver to startup and
printing a message with a workaround already suggesting to set
`SHELL=/bin/bash` to allow gdbserver to launch. This has to be
our best effort to guide users of such shells until we find time
to investigate a better solution.

Fixes #2550

* Update CHANGELOG
2025-09-16 21:06:29 +02:00
peace-makerandArusekk 48ea09b27f Fix lookup of binutils for mipsel architecture (#2612)
* Fix lookup of binutils for `mipsel` architecture

The endianness is encoded in the architecture name for mips targets which wasn't respected while looking for the correct binutils binary.

Sync the CI and Dockerfile binutils packages while we're at it.

Fixes #2591

* Update CHANGELOG

* still fall back to the other endianness

---------

Co-authored-by: Arusekk <[email protected]>
2025-09-11 13:09:28 +00:00
Arusekk 9f22a2f202 Merge branch 'stable' into beta 2025-09-11 14:55:56 +02:00
Arusekk 7413a3da31 Exclude Unicorn versions segfaulting on MIPS PLT (#2621)
Fixes #2619
2025-09-11 12:55:51 +00:00
Peace-Maker 95aac6e367 Merge branch 'stable' into beta 2025-09-05 13:59:45 +02:00
Peace-Maker 9ed93a5281 Fix race condition in process mapping tests
We could try to lookup the mapped libraries before they are actually loaded in the process.
Wait until the program is up and running before trying to fetch the memory maps.
2025-09-05 13:14:57 +02:00
peace-maker 3579fb1384 Fix log level of child remotes of server tube (#2609)
* Fix log level of child remotes of `server` tube

The log level of the `server` tube wasn't passed
on to the `remote` wrappers created upon receiving
a new child connection. This caused the connection
closed message to be logged even when the server
object was created with `level='error'`.

* Update CHANGELOG
2025-09-05 12:25:49 +02:00
Peace-Maker 485bf0a0b7 Merge branch 'stable' into beta 2025-08-28 14:36:00 +02:00
William Tan b133b76b4e Allow setting debugger path via context.gdb_binary (#2602)
* Allow setting debugger path via context

* Update changelog
2025-08-19 10:30:05 +02:00
ffc46d277a Fix poll error in process.libs() and clean up maps parsing (#2579)
Co-authored-by: Raccoon <raccoon@42>
Co-authored-by: peace-maker <[email protected]>
2025-08-09 14:47:57 +00:00
Peace-Maker dd3a5f6974 libcdb: Fix cache handling of debuginfo
When trying multiple debuginfod servers, the first one to fail would save the failed attempt and block the remaining servers to be tried.

Only save that we couldn't find the debuginfo if we tried all the configured servers.
2025-08-06 14:32:08 +02:00
Peace-Maker 9a275b2db0 Fix libcdb cache in CI
Requests to debuginfod.elfutils.org had the wrong SNI in their request.

Cache requests to debuginfod.ubuntu.com too.
2025-08-06 12:16:10 +02:00
Peace-Maker 1c28222fe6 Merge remote-tracking branch 'stable' into beta-staging 2025-08-05 21:47:13 +02:00
peace-maker b93c5ace10 Ignore colored_traceback error when TERM is unset (#2596)
* Ignore colored_traceback error when TERM is unset

Fixes using pwntools in non-interactive sage scripts with newer colored_traceback versions.

Fixes #2594

* Update CHANGELOG
2025-08-05 21:25:21 +02:00
peace-maker da9797c1c2 Support longer function names in Windows getexport shellcode (#2587)
* Support longer function names in Windows getexport shellcode

Previously, an arbitrary name length limit of 8 characters was in place due to the lack of a proper strcmp loop. Implement a cheap strcmp for longer function names.
This trashes a bunch of registers and we might be able to optimize it further to reduce the damage.

Use a unique label too to avoid redefinition when using the shellcraft template twice in the same shellcode. Use the mov shellcraft template for the destination register to avoid an instruction if the result is already in the desired register.

* Update CHANGELOG
2025-08-05 14:55:35 +00:00
Shordenandpeace-maker 6dfe8b6f72 Use unicorn on macOS w/ SIP enabled (#2593)
* __ensure_memory_to_run_unicorn: don't request wx memory

macOS systems with SIP enabled prohibit mmaping WX memory.
unicorn doesn't run into this issue because it uses the MAP_JIT
protection flag.

See also:
https://github.com/unicorn-engine/unicorn/blob/803fe5a47770360d1942de72600d3b295b521e31/qemu/accel/tcg/translate-all.c#L1021-L1032
https://github.com/pwndbg/pwndbg/blob/2f6b5bbaea484391f55850a09a16efda161498f2/pwndbg/aglib/disasm/__init__.py#L305-L316

* update changelog

---------

Co-authored-by: peace-maker <[email protected]>
2025-08-05 11:39:28 +00:00
peace-maker 425221fb30 Add Ubuntu and Debian debuginfod servers (#2595)
* Add Ubuntu and Debian debuginfod servers

Most CTF challenges are hosted on Ubuntu or Debian [citation needed], so check their debuginfod servers before trying the federating one as a fallback.

This is required since the elfutils.org server seems down for maintenance occasionally.

* Update CHANGELOG
2025-08-05 13:02:00 +02:00
Chaitanya RahalkarandPeace-Maker 004a6dab88 Add automatic detection of statically linked binaries in detect_missing_binaries function. (#2570)
* Add automatic detection of statically linked binaries in `detect_missing_binaries` function.

* Add entry for PR #2570 to CHANGELOG.md: fix `pwn template` for statically linked binaries.

* Remove partial test implementation

The commands should be tested end-to-end instead of using doctests (later).

---------

Co-authored-by: Peace-Maker <[email protected]>
2025-07-11 13:10:40 +02:00
Arusekk 6098f28bfa Merge branch 'stable' into beta 2025-04-02 18:00:52 +02:00
Arusekk 1205b1aaa3 regsort: respect register aliases (#2576)
Closes #2481
2025-04-02 15:57:59 +00:00
tesujiandArusekk ce6d2ca847 Fix invalid parsing of loader error message in elf.libc (#2567)
For example, on my machine:

  > ./main_no_flag
  ./main_no_flag: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by ./main_no_flag)

Co-authored-by: Arusekk <[email protected]>
2025-04-02 14:17:30 +02:00
Peace-Maker 9e0ca3a415 Move changelog entry to stable log 2025-03-30 12:21:08 +02:00
Daniel Kilimnik b60b2e897f SSH: fix download/upload with -1 exit status (#2545)
* SSH: fix download/upload with -1 exit status

* Add Changelog
2025-03-30 10:19:42 +00:00
Arusekk 2c3e783f96 Release 4.15.0beta1 2025-03-24 13:21:16 +01:00
Arusekk 15bdd4a766 Release 4.14.1 2025-03-24 13:01:50 +01:00
Arusekk 7c95e838f4 Merge branch 'stable' into beta 2025-03-24 12:15:36 +01:00
Maxime Meignan 92aa64ce01 Fixed bound on memcpy loop in thumb,arm,aarch64 (#2552) 2025-03-24 10:30:14 +00:00
peace-maker ae4bb08c3e Fix syntax highlighting of multiline comments in ASM (#2562)
Enable DOT_ALL next to the default MULTILINE regex flags to match newlines too with the `.*?`.
```
/* this works */
/*
this is not highlighted as a comment
*/
```
2025-03-21 20:55:23 +00:00
6739525ebe Show ELF symbols defined to value 0 (#2451)
Lets say we have an ELF with the following symbols

```
Symbol table '.symtab' contains 5 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000035     0 NOTYPE  LOCAL  DEFAULT    2 aaaa
     2: 0000000000000022     0 NOTYPE  LOCAL  DEFAULT    2 bbbb
     3: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    2 cccc
     4: 0000000000000054     0 NOTYPE  GLOBAL DEFAULT    2 dddd
```

Then pwnlib's ELF(binary).symbols will be `{'aaaa': 53, 'bbbb': 34, 'dddd': 84}`.
This is missing the symbol `cccc`, because its value is 0.

This change checks the name instead of the value, because the value can
be 0 if the symbol points to the beginning.

The new and correct value of pwnlib's ELF(binary).symbols will be
`{'aaaa': 53, 'cccc': 0, 'bbbb': 34, 'dddd': 84}`.

* Do not unresolve zeros
* Do not add undefined symbols

Co-authored-by: peace-maker <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2025-03-21 11:34:33 +01:00
Arusekk d10b7aee4c Exclude broken Unicorn version (#2565)
Closes #2560
2025-03-19 08:47:55 +00:00
Arusekk aeb4c26bf0 Fix parsing corefile with missing auxv (#2559)
Closes #2543
2025-03-03 16:01:05 +00:00
Peace-Maker ec6b8cd87c Merge branch 'stable' into beta 2025-01-26 23:47:08 +01:00
Meetesh SainiandPeace-Maker b2345f214e fix: update apport coredump path handling for CorefileFinder (#2518)
* fix: update apport coredump path handling for CorefileFinder

* chore: update comment on Apport core path handling

* Update CHANGELOG

---------

Co-authored-by: Peace-Maker <[email protected]>
2025-01-26 22:28:14 +00:00
peace-maker e9d9bd9ddb Fix installation on Python 3.5 and lower on stable (#2533)
* Fix installation on Python 3.5 and lower on stable

The unix-ar package requires Python 3.6. Only install it on Python 3.6 then and use the Python 2 fallback for Python <= 3.5 too.

* Update CHANGELOG
2025-01-26 23:18:16 +01:00
Peace-Maker d7a7376eca Merge branch 'stable' into beta 2025-01-15 20:34:56 +01:00
Peace-Maker 9472ec1e93 Fix building docs on stable
Pin to Python 3.12.
2025-01-15 16:49:27 +01:00
peace-maker e4b939dc1a Poll before reading /proc/maps in process.libs() (#2516)
Try to avoid race condition of reading memory maps before libraries are loaded.
2025-01-15 16:49:02 +01:00
Peace-Maker c02190b5d4 Release 4.15.0beta0 2025-01-15 08:48:06 +01:00
Peace-Maker e341e238ca Release 4.14.0 2025-01-15 08:46:49 +01:00
Luca Bancale 7741a187ea Ignore a warning with unused args in asm on NIX (#2508)
* Ignore a warning when compiling with asm

* Add pr to changelog
2025-01-14 22:50:23 +01:00
Findus 4ef3c16d09 ssh: replaced nonexistent key with str(e) in error handling (#2512) 2025-01-06 22:43:21 +01:00
fb2ee19b90 Deprecate direct commandline scripts invocation and exclude nonsense ones (#2364)
* deprecate direct commandline scripts invocation and exclude nonsense ones

* Don't deprecate all commandline tools

---------

Co-authored-by: Arusekk <[email protected]>
Co-authored-by: Peace-Maker <[email protected]>
2024-12-10 22:47:47 +01:00
Jakub Nowakandpeace-maker 74a300db6c Deprecate 'keepends' argument in favor of 'drop' (#2476)
* Replace 'keepends' with 'drop'

Add 'drop' argument in place of 'keepends' for tubes. 'keepends' still
works but raises depreciation warning.

* changelog

* Ignore line numbers in PyLint check

---------

Co-authored-by: peace-maker <[email protected]>
2024-12-10 22:31:29 +01:00
peace-maker 57b9eb9107 Fix loading ELF files without valid .dynamic section (#2502)
* Fix loading ELF files without valid .dynamic section

This allows to load separate debuginfo files and access their symbols.

* Update CHANGELOG
2024-12-10 21:36:33 +01:00
Peace-Maker b2d56fa37c Merge branch 'beta' into dev 2024-12-10 21:17:16 +01:00
Peace-Maker a0ddbf5e16 Tests: Revert timeout changes from gdb tests
There were additional `timeout=X` additions in #2382 which caused tests to fail randomly when a timeout was reached. The tests run through occationally, so it's not an infinite loop. But flakey tests are annoying and I don't see a reason for the timeout additions to the doctests for the core patch of that PR other than failing early during manual tests of new functionality. CI running smoothly is more important than fast failing during development on the gdb module imo.
2024-12-10 20:34:39 +01:00
Peace-Maker 1be8ad7770 Merge branch 'stable' into beta 2024-12-10 20:34:14 +01:00
Peace-Maker 24d217cfbd Docs: Fix link to source for class properties
The property has setters and getters. Link to the getter if it's available. This adds line numbers to the source link for properties.

Fixes #2401
2024-12-09 13:09:10 +01:00
peace-maker ec262d8d01 Update sphinx for Python 3.13 support (#2503)
* Fix sphinx warnings in docstrings

* Update sphinx for Python 3.13 support

Could not import extension sphinx.builders.epub3 (exception: No module named 'imghdr')

`imghdr` was removed in Python 3.13.
2024-12-08 21:16:39 +01:00
Justin ApplegateandPeace-Maker 55ac6e11fc Update documentation for format strings (#2501)
* Update fmtstr.py documentation

Clarified that the `value` in the `writes` dict (for `fmtstr_payload()`) should be a bytestring if the value to be written is shorter than a long

* Update fmtstr.py documentation for FmtStr class

Updated example and definition for `write()` function in `FmtStr` class to include bytes as the value.

* Fix code formatting

---------

Co-authored-by: Peace-Maker <[email protected]>
2024-12-08 19:33:32 +01:00
Leopold 96d98cf192 fix fromsocket to deal with ipv6 socket (#2497)
* fix fromsocket to deal with ipv6 socket

* add remote.fromsocket ipv6 test and update CHANGELOG.md

* skip fromsocket ipv6 test
2024-11-01 13:36:30 +00:00
peace-maker 6f0793eebc Add tube.upload_manually to upload files in chunks (#2410)
* Add `tube.upload_manually`

Upload data in chunks when having a tube connected to a shell.
This is useful when doing kernel or qemu challenges where you can't use the ssh tube's file upload features.

* Add tests and fix corner cases

* Update CHANGELOG

* Fix character escaping in tests

* Fix gzip compression on Python 2
2024-10-28 21:11:36 +01:00
ckxckxandPeace-Maker 51cbdb465d Fix attaching to a gdbserver with tuple gdb.attach(('0.0.0.0',12345)) (#2291)
* Patch for #issues/2290

* Return listening process on `pidof(("0.0.0.0", 1234))`

Instead of returning the process which is connected to port 1234,
return the process which is listening on that port.

* Update CHANGELOG

---------

Co-authored-by: Peace-Maker <[email protected]>
2024-10-28 21:06:56 +01:00
Peace-Maker 61804b169b Merge branch 'beta' into dev 2024-10-24 23:28:53 +02:00
Peace-Maker 04e90bc754 Merge branch 'stable' into beta 2024-10-24 23:28:20 +02:00
Peace-Maker 8926a3a2bc Fix checksec commandline output after Python 3.12 fixes
This reverts #2346 which apparently didn't do what was expected. The logger has to be initialized for the checksec output to show up, so some other file imported * from pwn before too.
With the double registration of subparsers removed in f28d3ebb6c this didn't happen anymore making checksec print nothing.
2024-10-24 23:24:43 +02:00
peace-maker bb7a85c8df Allow to disable caching (#2484)
* Allow to disable caching

By setting `context.cache_dir = None`. Generate default cache dir again by setting `context.cache_dir = True`.

* Disable cache in `asm` caching test

* Update CHANGELOG

* Fix asm cache test
2024-10-24 17:04:50 +02:00
Peace-Maker 3303ea949d Merge branch 'beta' into dev 2024-10-24 16:44:19 +02:00
Peace-Maker cef48f4085 Merge branch 'stable' into beta 2024-10-24 16:32:29 +02:00
Peace-Maker 2ce27dab0d CI: Install coveralls without --break-system-packages
ubuntu-latest doesn't seem to point to Ubuntu 24.04 anymore? Allow this to work on Ubuntu 22.04 too.
2024-10-24 16:20:50 +02:00
Th3Sandpeace-maker fa14663243 libcdb-cli: add --offline-only, refactor unstrip and add fetch parser for download libc-database (#2478)
* Add `return_raw` for `search_by_symbol_offsets`

* Add `--offline-only` and unstrip libc as default behavior

* Add short arg name for `--download-libc`

* Fix bugs

* Add fetch parser

* Fix bugs

* file parse not unstrip default

* Update function docs

* Update CHANGELOG

* Edit dest of `--no-strip`

* Update CHANGELOG

* Unstrip before `return cache`

* Revert `--unstrip` help

* Improve `libcdb fetch` default behavior

* Perf fetch command

* Fix fetch command `-u`

---------

Co-authored-by: peace-maker <[email protected]>
2024-10-24 16:11:07 +02:00
peace-maker d2253110bd Add caching proxy for libcdb debuginfod files to CI (#2487) 2024-10-24 15:59:24 +02:00
peace-maker a3b22b748d Throw error when using sni and setting server_hostname manually in remote (#2482)
* Throw error when using `sni` and setting `server_hostname` manually in `remote`

Prevents silently replacing the `server_hostname` that was provided in `ssl_args`.

Fixes #2425

* Update CHANGELOG
2024-10-24 15:56:47 +02:00
peace-maker 584eccaa33 Only print checksec output of ELF.libc when it was printed for the ELF already (#2483)
* Only print `checksec` output of `ELF.libc` when it was printed for the `ELF` already

* Update CHANGELOG
2024-10-24 15:55:37 +02:00
robbert1978 7dceeddca8 Stop using cmd.exe to keep current directory (#2488)
* Stop using cmd.exe to keep current directory

* Update misc.py

* Update misc.py, deal with cmd.exe

* Update misc.py
2024-10-24 15:51:07 +02:00
Peace-Maker 34da249779 Bump Ubuntu versions in README and bug report template 2024-10-12 18:04:01 +02:00
Peace-Maker c68c00c316 Merge branch 'beta' into dev 2024-10-12 18:01:08 +02:00
Peace-Maker 2e86d8afe2 Merge branch 'stable' into beta 2024-10-12 17:48:59 +02:00
peace-maker f28d3ebb6c Test Python version >= 3.10 in CI and fix tests on Python 3.12 (#2486)
* Bump tested python version to >= 3.10

Some workflows were using 3.8 still. Start testing on 3.12 too.

* Fix installing rpyc in CI on ubuntu 24.04

`ubuntu-latest` now points to 24.04 which requires the --break-system-packages dance.

* Test Python 2 on Ubuntu 22.04

Ubuntu 24.04 dropped the python2.7 packages.

* Test on android-34

* Fix ARM binutils disassembly output test expectation

It used to print "; 0x4" but changed to "@ 0x4" in some version.

* Skip QEMU LD_PREFIX path test

Ubuntu 24.04 seemed to have switched the qemu-user --help output to show `/usr/gnemul/qemu-$ARCH` instead of `/etc/qemu-binfmt`. Ignore the actual path in the test.

* Fix x86 ascii shellcode encoder test

The alphabet was using `\` escape sequences badly.

<stdin>:1: SyntaxWarning: invalid escape sequence '\]'

* Fix mips xor encoder unaligned memory access

qemu throws a SIGBUS error when the shellcode tries to access unaligned memory since some version. Align the "stack" properly.

* Fix util.lists.partition test output on Python 3.12

The __repr__ output of OrderedDict was changed to look like ordinary {} dicts.

* Fix safeeval test on Python 3.12

There is a 151 RESUME opcode in Python 3.12 now.

* Fix registering commandline subparsers multiple times for Python 3.11

Python 3.11 added a sanity check to argparse to prevent registering the same subparser multiple times.

argparse.ArgumentError: argument command: conflicting subparser: cyclic

Avoid importing the command twice.
`python -m pwnlib.commandline.cyclic` failed on Python 3.11 triggered in CI when running the commandline tools while collecting coverage.

* Fix pip cache in CI
2024-10-12 17:48:12 +02:00
Lorenzo Cian cfc021d88e Extract libraries from Docker image (#2479)
* feat: extract libraries from Docker image

* docs: update CHANGELOG.md

* fix: python2.7 compatibility

* address comments

* address linter
2024-10-07 11:46:05 +02:00
Peace-Maker 9f92ed04fc Fix docs of ELF.{libs,maps}
Fixes #2400
2024-10-03 12:17:06 +02:00
k4lizen b08f4b7bc8 redirect kitty kill command stderr to /dev/null (#2472) 2024-10-01 19:37:52 +02:00
Peace-Maker d664bb49d4 Merge branch 'beta' into dev 2024-09-30 00:45:22 +02:00
Peace-Maker c0d6e07f1c Release 4.14.0beta1 2024-09-30 00:34:36 +02:00
peace-maker fa5a288a69 Fix waiting for gdb under WSL2 (#2470)
* Fix returning wrong pid in WSL for run_in_new_terminal

We run cmd.exe which and other Windows processes before going back into WSL. The returned pid would be the one for the ephemeral cmd.exe process instead of the real command we wanted to launch.

I don't know how to properly trace the execution and get the command pid, so scan for newer pids matching the command for a while instead as a workaround.

We wrap the command in a script so psutil.Process.exe() returns the path to the shell instead of the real command. Look at psutil.Process.cmdline() too which contains the real program running right now.

* Make `proc.wait_for_debugger` return the debugger pid

If we fail to get the pid when launching gdb, grab it after tracing the debugger at least. gdb won't be closed when the exploit exits but at least we have the correct pid.

* Fix working directory of run_in_new_terminal in WSL

The process' cwd would be %WINDIR% due to cmd.exe not supporting WSL paths.

* Update CHANGELOG
2024-09-30 00:27:40 +02:00
peace-maker 69ab2054e8 Fix collecting coverage in CI (#2477)
The upload-artifact action v4.4.0 excluded hidden files from uploads by default. We want to upload only hidden `.coverage*` files though. Enable hidden files again using the `include-hidden-files` input.

https://github.com/actions/upload-artifact/releases/tag/v4.4.0
2024-09-30 00:20:59 +02:00
Peace-Maker 907e921043 Merge branch 'beta' into dev 2024-09-30 00:08:31 +02:00
Peace-Maker a3f14df14d Merge branch 'stable' into beta 2024-09-29 23:56:06 +02:00
Peace-Maker 78dd777735 Release 4.13.1 2024-09-29 23:41:04 +02:00
Th3Sandpeace-maker ee63072930 libcdb: improve the search speed of search_by_symbol_offsets (#2413)
* Add `hash_type` for `search_by_symbol_offsets`

* Add docs

* Update CHANGELOG

* Allow search `id` in search_by_hash

* Fix py2.7 test

* Rename `hash_type` to `search_type`

* Rename `TYPES['id']` to `TYPES['libs_id']`

* Rename part `hex_encoded_id` to `search_target`

* Turbofast extract build id

* Fix docs

* Add a map for types key

* Extract proper buildid

* Fix docs

* Fix E0606

* Simplify get `mapped_type`

* Add `search_by_libs_id` to `__all__`

* Modify docs

* Fix py2.7

* Fix reference

---------

Co-authored-by: peace-maker <[email protected]>
2024-09-29 01:53:06 +02:00
Arusekk 824d67d8f4 gdb: fix pid attach (#2474) 2024-09-28 07:32:15 +00:00
k4lizen 785ed9fdda Properly close spawned kitty window (#2471)
* properly close spawned kitty window

* python2 support

* changelog
2024-09-27 09:23:06 +02:00
Jordan ERNST 5c1fb1d11b Fix: GDB 15.1 rpyc detection (#2469)
* Fix: GDB 15 rpyc detection

* Update CHANGELOG.md

* Changelog on the right version

* Remove extra newline in CHANGELOG.md
2024-09-26 22:25:04 +02:00
peace-maker cdfd64f6de Install pwntools on Windows and import it once (#2450)
This is just a basic smoke test for now.
2024-09-26 13:44:52 +02:00
peace-maker 3727c93859 Add ELF.close() to release resources (#2444)
* Add ELF.close() to release resources

`ELFFile.close()` just closes the mmap'd file, but our own wrapper keeps the file handle open.

This is annoying when using a temporary file on Windows since they can't be deleted if there is
a dangling handle. This can be used together with the inherited context manager from ELFFile.

* Update CHANGELOG
2024-09-26 13:41:18 +02:00
Peace-Maker bc453b46c3 Merge branch 'beta' into dev 2024-09-26 01:57:52 +02:00
Peace-Maker f47e417e4e Merge branch 'stable' into beta 2024-09-26 01:29:24 +02:00
peace-maker 7c79c73a5f Backport: Fix typo for fallback to default number of console colors on windows (#2467)
* Fix typo for fallback to default number of console colors on windows

* Update CHANGELOG
2024-09-25 23:20:04 +00:00
peace-maker 3e9849f0ca Fix PLT emulation with Unicorn 2.1.0 (#2466)
* Fix PLT emulation with Unicorn 2.1.0

You cannot add multiple hooks at once anymore, so add them individually - still to the same callback.

https://github.com/unicorn-engine/unicorn/blob/f164769a9a973a3e981f279ed7aa90459ae68545/bindings/python/unicorn/unicorn_py3/unicorn.py#L970-L976

* Update CHANGELOG

* Switch to PyPi Simple API for update checks

Fault: <Fault -32500: 'RuntimeError: PyPI no longer supports the XMLRPC package_releases method. Use JSON or Simple API instead. See https://github.com/pypi/warehouse/issues/16642 and https://warehouse.pypa.io/api-reference/xml-rpc.html#deprecated-methods for more information.'>

* Update CHANGELOG

* Disable ssh.user_shstk test

Github Actions Runners have userland shadow stack enabled now apparently.
Don't test for this system state.
2024-09-25 23:01:08 +00:00
peace-maker 149ebe0c47 Fix parsing the PLT on Windows (#2445)
* Fix parsing the PLT on Windows

The Unicorn Engine 1GB workaround doesn't work since `mmap` has different semantics on Windows.

* Update CHANGELOG

* Catch ImportError instead

* Remove unused sys import
2024-09-25 23:14:58 +02:00
tesuji d7817a7eac Nicely handle non ELF files in checksec (#2457) 2024-09-11 11:22:13 +02:00
patryk4815 df620d7449 darwin: generate syscalls sdk 15.1 (#2448) 2024-08-25 12:59:14 +02:00
peace-maker 67678c2e1c Cache output of asm() (#2358)
* Cache output of `asm()`

To speed up repeated runs of an exploit, cache the assembled output.

Use a sha1 hash of the shellcode as well as relevant context values
like `context.arch` and `context.bits` to see if the exact same
shellcode was assembled for the same context before.

Fixes #2312

* Return path to cache file if `not extract`

* Update CHANGELOG

* Create temporary copy of cached file

* Add debug log about using the cache

* Include full assembler and linker commandlines in hash

This should catch any changes across pwntools updates and system environment changes.

* Include pwntools version in hash
2024-08-12 20:59:22 +02:00
Peace-Maker 734cb3bf82 Begin working on 4.15.0 2024-08-12 19:45:10 +02:00
Peace-Maker adaa6abc08 Release 4.14.0beta0 2024-08-12 19:27:23 +02:00
Peace-Maker dbb034a867 Pin colored_traceback < 0.4 for Python 2 2024-08-12 18:39:04 +02:00
Peace-Maker 997e51c709 Release 4.13.0 2024-08-12 18:33:09 +02:00
Peace-Maker 3e21808da9 Cleanup CHANGELOG order 2024-08-12 18:13:05 +02:00
k4lizen 405357c075 Add resolution_addr parameter to Ret2dlresolvePayload (#2436)
* add documentation for data_addr and resolution_addr

* add resolution_addr

* changelog

* changelog^2
2024-08-09 12:33:38 +02:00
peace-maker 248f4510c6 Support asm/disasm on Windows (#2437)
* Support asm/disasm on Windows

Find binutils toolchains like https://gnutoolchains.com/ if they exist in the PATH.

* Update CHANGELOG

* Update binutils install docs

* cpp reads from stdin when no infile is given

No need for a tempfile here.
2024-08-08 14:13:37 +02:00
Peace-Maker de67c86432 Fix tty_escape on Python 2 2024-08-07 23:52:33 +02:00
Peace-Maker 101f9bc76b Add documentation for tty_escape 2024-08-07 23:27:05 +02:00
Peace-Maker 4879590a37 Fix typo for fallback to default number of console colors on windows 2024-08-07 00:14:54 +02:00
dependabot[bot] 7194ced044 Bump docker/build-push-action from 5 to 6 (#2420) 2024-08-06 14:17:36 +00:00
k4lizenandpeace-maker 6a9deffbfb Add functions for retrieving process mappings (#2371)
* add to process mapping function, and stack, heap, vdso, vvar, libc _mapping properties

* better libc string mapping detection #2370

* return all mappings instead of just the first one

* add single/multiple option to every _mapping function

* undo @property tags

* added function doc comments

* added elf_mapping

* add get_mapping and refactor helpers to use it

* better doc

* add _location functions

* _location_from_mappings for libc and musl locations

* _location_from_mappings doc

* change comment

* fix executable -> path

* change comment

* python2.7 support

* changelog

* add address_mapping()

* get_mapping comment typo

* mention the path is an exact match

* add references to wrapped functions

* add missing 'the's, make sentences one line, fix 'exact' path description in get_mapping_location

* add private and shared fields to permissions object

* maps doctest

* get_mapping doctest

* stack_mapping doctest

* heap_mapping doctest

* improve stack_mapping and heap_mapping with address example

* vvar and vdso _mapping doctest

* libc_mapping doctest

* elf_mapping doctest

* _location_from_mappings doctest

* get_mapping_location doctest

* heap and stack _location doctest

* vdso vvar _location doctest

* improved vdso and vvar doctest

* elf_location doctest

* libc_location doctest

* address_mapping bugfix

* address_mapping doctest

* fix meow check

* fix len(mappings) check

* actually fix meow check

* why dont docs support format string?

* removed _location functions

* removed the rest of the _location related functions

* added lib_size()

* add lib_size() example

* replace f'' with correct syntax

* remove _location() from other doctests

* cleanup == in doctest

* change " to ' in doctests

---------

Co-authored-by: peace-maker <[email protected]>
2024-08-06 11:10:10 +02:00
mephi42 26e72f2b3e gdb.debug: avoid 2s timeout if possible (#2435)
On Ubuntu 22.04 gdb.debug() takes at least 2 seconds. This is because
it prints only "Remote debugging from host 127.0.0.1, port 33398", but
the code expects 2 lines.

It's very unclear what the second line is supposed to be; the only lead
is "* Handle extra newline printed by gdb" in commit 338fbeba ("Improve
pwnup template, gdbserver detection (#1148)"), but I could not trace it
back to the GDB source code, both historic and modern. Perhaps, there
is a non-upstreamed patch in some distro that introduces it.

It should still be safe to skip waiting for the second line if the
first one already starts with "Remote debugging ...", so do it.
2024-08-05 13:05:25 +02:00
00663aa1bf Add port, gdb_args, and gdbserver_args to gdb.debug() (#2382)
* added two arguments to gdb.debug:
+ port: specifies the port that should be used by the gdbserver (this is useful for alpine)
+ gdb_args: allows forwarding arguments to the gdb binary spawned by gdb.attach() (just a passthrough)

aslo downgraded "GDB Python API is supported only for local processes" to a warning, because it seems to work on some systems.

* added changelog entry and fixed python2.7 compatibility

* also added optional gdbserver_args parameter to gdb.debug()

* implemented requested fixes for #2382:
+ gdb.debug port is now also used for qemu
+ GDB Python API is now tested for tubes.process.process a warning for ssh.process and an error for everything else
+ updated docs to use mention that gdbserver ports are randomized by default
+ now using gdbserver_port to check if the correct port was set
+ fixed CHANGELOG.md structure

* implemented requested fixes for #2382:
+ gdb.debug port is now also used for qemu
+ GDB Python API is now tested for tubes.process.process a warning for ssh.process and an error for everything else
+ updated docs to use mention that gdbserver ports are randomized by default
+ now using gdbserver_port to check if the correct port was set
+ fixed CHANGELOG.md structure
+ added timeouts for recvline() gdb tests
+ also run gdb api tests for ssh runner

---------

Co-authored-by: gfelber <@users.noreply.github.com>
Co-authored-by: peace-maker <[email protected]>
2024-07-23 13:53:35 +02:00
Peace-Maker 18c8bfba3d Pin colored_traceback < 0.4 for Python 2 2024-07-23 13:37:26 +02:00
Jakub Nowak 4284c3fcdf Improve remote() documentation (#2427)
* Improve remote() documentation

* changelog
2024-07-09 09:23:46 +02:00
Arusekk a366e91038 Add TTY escape function for file transfer (#2422) 2024-07-02 07:04:14 +02:00
CocoaandArusekk 736cf9d112 feat: multi shellcraft cmd (#2398)
* added support for multiple shellcraft commands

* updated CHANGELOG.md

* fix `pwn shellcraft -l shellcode`

* fix `get_template`

* strip strings after spliting by the delimiter

* fix `pwn shellcraft --show shellcode`

* added some tests in ci

* better handling for splitting by delimiter

---------

Co-authored-by: Arusekk <[email protected]>
2024-06-23 16:51:23 +02:00
peace-maker 4dc8d60b9e Add "none" ssh authentication method (#2405)
* Add "none" ssh authentication method

Allow to "disable" ssh authentication if the remote server has it enabled.

Fixes #2380

* Add CHANGELOG
2024-06-17 10:03:55 +02:00
Dvorhack d5fffb6769 Shellcode socket IPV6 (#2415) 2024-06-15 18:56:45 +02:00
Th3Sandpeace-maker 51e8eb09ee libcdb: add offline_only to search_by_symbol_offsets (#2388)
* Add `offline_only` for `search_by_symbol_offsets`

* Fix bug

* Update CHANGELOG

* Remove redundant code

* Update

---------

Co-authored-by: peace-maker <[email protected]>
2024-05-23 16:57:19 +02:00
Sanjit Kumarandpeace-maker e92a30bbf7 Convert bytes-like object to string in apport_corefile() method (#2387)
* converting bytes-like object to string

* updated changelog

---------

Co-authored-by: peace-maker <[email protected]>
2024-05-12 13:26:08 +02:00
peace-maker fcec11784a Fix access of undefined ssh._tried_sftp in raw mode (#2396)
* Fix access of undefined `ssh._tried_sftp` in `raw` mode

The attribute was never set when setting `ssh(raw=True)` which caused the code to run `ssh.__getattr__` which raised an AttributeError due to `_tried_sftp` starting with an `_` on Python 3.12.

* Document all `ssh` attributes
2024-05-12 11:31:46 +02:00
qux-bbb fe560c9835 Add sudo for apt-get (#2395) 2024-04-24 12:46:07 +02:00
Peace-Maker 27366fdeb8 Merge branch 'beta' into dev 2024-04-22 00:05:28 +02:00
Peace-Maker 5f79e1dc51 ci: Install rpyc from pip instead of apt
The apt package appears outdated and incompatible with the latest version on pypi.

>>> ValueError: invalid message type: 18
2024-04-21 23:44:04 +02:00
Peace-Maker af6c8c8878 gdb.debug: gdbserver --wrapper requires startup-with-shell
Only add it when we don't want to manipulate the environment or argv[0].
This will cause the problem with fish shell to reappear in those cases, but
it's another step for compatibility at least.

#2378
2024-04-21 23:31:29 +02:00
Peace-Maker 55390f1bf6 Merge branch 'stable' into beta 2024-04-21 22:46:36 +02:00
peace-maker f2f55f3e1c Return buffered data on first EOF in tube.readline() (#2376)
* Return buffered data on first EOF in tube.readline()

When there is still data available in the tube buffer when an EOFError occurs in
`tube.recvline()`, return that data even though it doesn't contain a newline.
The next time `tube.recvline()` is called afterwards will raise EOFError normally.

This behavior is in line with the GNU readline implementation and avoids
loss of data. It allows `tube.stream()` to print everything that's received before
the receiving end terminates.

A new warning is logged when data is returned due to an EOF informing
about the lack of the trailing newline character.

Fixes #2366

* Update CHANGELOG

* Add context.throw_eof_on_incomplete_line

Allow to control the behavior of `tube.recvline` and
be able to suppress the new warning.

* Cleanup docs
2024-04-21 22:37:46 +02:00
peace-maker db98e5edfb Don't go through a shell in gdb.debug (#2378)
* Don't go though a shell in `gdb.debug`

gdbserver starts a shell and runs the target process through it.
This behavior was added in gdbserver 8.0 together with the
commandline flag --no-startup-with-shell to disable it.

* Update CHANGELOG
2024-04-21 20:33:34 +00:00
peace-maker 60072487f1 Fix displaying bright color variation in terminal output (#2373)
* Recompute text.has_bright when num_colors changes

The number of simultaneous colors in the current terminal are queried
later during initialization and the text.num_colors attribute is updated accordingly.
The text.has_bright attribute wasn't updated when that happened and always
remained set to False. Calculate those properties based on num_colors dynamically.

* Update CHANGELOG

* Enable bright colors on Windows too

Only get "colors" on Windows to avoid #1201 again.

* Fix support for old terminals on windows
2024-04-21 22:24:35 +02:00
7ac5a34a59 Change from pop to keys for reporting proper error message (#2391)
* Change from pop to keys for reporting proper error message

* update changelog

* add doctest for xor

* Add newline to run xor doctests

* Switch to `dict.popitem()`

---------

Co-authored-by: marinelay <[email protected]>
Co-authored-by: Peace-Maker <[email protected]>
2024-04-21 22:22:46 +02:00
eec3321ae9 Fix passing bytes to context.log_file and crc.BitPolynom (#2389)
* Fix incosistent usage of bytes/str

* update changelog

* Update CHANGELOG

---------

Co-authored-by: marinelay <[email protected]>
Co-authored-by: Peace-Maker <[email protected]>
2024-04-21 22:18:28 +02:00
Lewis Watson d2a02a7b37 Updated Mac OS Install Documentation (#2392)
* Added Missing MacOS Requirements

* Updated Binutils Install Docs

Due to security reasons Homebrew has removed direct formula references, this is the workaround.

* Updated changelog for #2392

* reverting changelog
2024-04-21 22:14:55 +02:00
peace-maker c1ce1897df Fix duplicate definition of ssh.sftp (#2394) 2024-04-21 22:13:56 +02:00
peace-maker 5981c7290d Change newline when setting context.os to "windows" (#2330)
* Change newline when setting `context.os`

Windows uses `b'\r\n'` for newlines while unix uses `b'\n'`. Change the expected newline to `b'\r\n'` when setting `context.os = "windows"` automatically for convenience.

* Update CHANGELOG

* Fix other tests setting os
2024-03-29 17:52:34 +01:00
peace-makerandLevitatingLion cb540857cc Add basic RISCV64 shellcraft support (#2322)
* Add basic RISCV64 shellcraft support

The `mov` template isn't 100% null-byte and newline free
for all inputs. Certain larger values are just emitted using
the `li` pseudo-instruction by the assembler which might
contain null-bytes.

Co-authored-by: LevitatingLion <[email protected]>

* Generate RISCV syscall constants from musl-libc

diet-libc doesn't support RISCV, so borrow from musl.
Need to consider their license.

* Update CHANGELOG

* Fix CHANGELOG

---------

Co-authored-by: LevitatingLion <[email protected]>
2024-03-29 17:28:50 +01:00
peace-maker 8ba1bdf0b6 Add basic support to debug processes on Windows (#2327)
* Add basic support to debug processes on Windows

Currently only `windbg.debug()` and `windbg.attach()` are implemented,
which open a WinDbg instance and attach to the process.

* Update CHANGELOG

* Cleanup CheckRemoteDebuggerPresent call

Only require PROCESS_QUERY_INFORMATION access and check for errors when opening the process.

* process.close: Move closing of std fds after kill

Windows processes would block on fd.close() when the main thread is suspended.
2024-03-29 16:04:56 +01:00
Th3S 4ac98cd11a Add offline parameter for libcdb.search_by_hash series function (#2360)
* Add offline parameter

* Add CHANGELOG

* Rename `offline` to `offline_only`
2024-03-29 15:27:38 +01:00
Swastik Sarkar 75cc3c3d5c libcdb.unstrip_libc: debug symbols are fetched only if not present (#2374)
* libcdb.unstrip_libc: debug symbols are fetched only if not present

* Usage of `ELF.debuginfo` to check if debug symbols exist

closes #2324

---------

Signed-off-by: sswastik02 <[email protected]>

* Add CHANGELOG

Signed-off-by: sswastik02 <[email protected]>

---------

Signed-off-by: sswastik02 <[email protected]>
2024-03-24 13:19:31 +01:00
Peace-Maker a2acdf9bd9 Pin pyelftools<0.30 for Python 2 in docs/requirements.txt
Docs only installs fail under python2 due to trying to install pyelftools>=0.30 which dropped py2 support.

Fixes #2372
2024-03-22 20:32:57 +01:00
Pratik Raj 14c0d73f89 feat : use --no-cache-dir flag to pip in dockerfiles to save space (#2357)
using the "--no-cache-dir" flag in pip install, make sure downloaded packages by pip don't cache on the system. This is a best practice that makes sure to fetch from a repo instead of using a local cached one. Further, in the case of Docker Containers, by restricting caching, we can reduce image size. In terms of stats, it depends upon the number of python packages multiplied by their respective size. e.g for heavy packages with a lot of dependencies it reduces a lot by don't cache pip packages.

Further, more detailed information can be found at

https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6

Signed-off-by: Pratik Raj <[email protected]>
2024-03-07 13:38:36 +01:00
Th3S 3b4b261b5a Add local libc database provider for libcdb (#2356)
* Add local libc database provider for libcdb

* Remove unnecessary assert

* Add docstring for local_libcdb

* Suppress warning output while `context.libdb` sets default

* Testing the local system's libc first

* Set falsely `context.lcoal_libcdb` to turn off local libc-database integration

* Fix docstring

* Make path check in validator

* Fix doctests

* Add CHANGELOG
2024-03-01 13:01:09 +01:00
Peace-Maker 000c31c155 ci: Install rpyc from pip instead of apt
The apt package appears outdated and incompatible with the latest version on pypi.

>>> ValueError: invalid message type: 18
2024-02-25 14:39:51 +01:00
Peace-Maker 197f00806e Merge branch 'beta' into dev 2024-02-22 23:08:02 +01:00
Peace-Maker a06d378e8c Merge branch 'stable' into beta 2024-02-22 23:05:43 +01:00
Peace-Maker e1770a3045 Begin working on 4.14.0 2024-02-22 22:49:41 +01:00
Peace-Maker c983f1c232 Release 4.13.0beta0 2024-02-22 22:43:33 +01:00
Peace-Maker f046fdd93e Release 4.12.0 2024-02-22 22:15:10 +01:00
Peace-Maker eb7e2c3568 Merge branch 'beta' into dev 2024-02-22 22:01:37 +01:00
Peace-Maker 4c0e08c2c8 Merge branch 'stable' into beta 2024-02-22 21:59:14 +01:00
peace-maker 2b7ec5e77a Fix gdb and other doctests (#2355)
* Fix gdb.debug doctests

* Accept bytes in ssh.which

But still return a `str` return for backwards-compatibility.

* CI: Make rpyc visible in gdb's python

* Fix not running all doctests

They appear to have to be a free standing block of `>>>` with an empty line above.

* Remove unnecessary text type check in ssh.which
2024-02-22 18:30:23 +01:00
peace-maker c17f835b3e pwn template: Don't search for challenge binary when already given (#2354) 2024-02-21 15:21:57 +01:00
eriklefflerandPeace-Maker 1b47ae1c20 Add RETURN_CONST as an allowed _const_code in safeeval (#2352)
* better error message when process creation fails in ssh.process

* add RETURN_CONST as an allowed _const_code in safeeval

* fix lint

* add to changelog

* fix changelog

* add couldn't find python warning

* Deduplicate error message code

---------

Co-authored-by: Peace-Maker <[email protected]>
2024-02-20 18:28:20 +00:00
peace-maker eb0043afc6 Enable UI tests on dev branch again (#2353)
They might be more stable now after the term changes.
Ref #1647
2024-02-19 12:25:20 +01:00
d9b3e17b66 gdb.debug: exe parameter now respected, allow empty argv (#2233)
* Bugfix gdb.debug: exe parameter now respected

This commit now properly supports the exe parameter in
`pwnlib/gdb.py:debug()`, allowing a different argv[0] than the
executable.

It achieves this by leveraging the gdbsever`--wrapper` argument
with a python script that calls execve with the specified args.

* Backintegration for python2

* Update Changelog.md

* pwnlib gdb.py, try to pass these tests...

* Encode script in ssh.process(run=False) for tests

* Re-trigger Pull request tests

* gdb.py: easier script if argv[0] == exe

* gdb.py: Add test case for LD_Preload

* Add check that "=" not in misc.normalize_argv_env

This check checks prevents the use of "=" in the
key of an environment variable, which is generally
impossible.

* gdb.py Correct handling of LD_ env-variables

* Update pwnlib/gdb.py

Co-authored-by: peace-maker <[email protected]>

* gdb.py address comments

1. explicit ctypes.CDLL('libc.so.6'), handle execve failing
2. consistent namedTempFile
3. drop packing._encode() since it's done earlier
4. testcases solve argv-args confusion

* gdb.py: Fix Namedtempfile-prefix + Bugfix

* Restore prefix for gdbscript

* Unify execve wrapper script under one function

* gdb.py, Remove leftover script

* Fix logging scope and ignore_environ argument

---------

Co-authored-by: Youheng Lü <[email protected]>
Co-authored-by: peace-maker <[email protected]>
Co-authored-by: peace-maker <[email protected]>
2024-02-17 00:47:56 +01:00
peace-maker 2114692513 Fix readline omitting a trailing \n (#2349)
* Fix readline omitting a trailing \n

This is a regression from #2129 which was based on a bogus test which mixed `input` and `readline` calls.

Only `input` (and `raw_input`) are documented to strip the newline, but `readline` itself should include it.

Fixes #2342

* Update CHANGELOG
2024-02-16 23:43:19 +01:00
Peace-Maker b5e4ff137a Android: Install emulator in CI and switch to x86_64 platform 2024-02-16 23:11:12 +01:00
Peace-Maker c049837c54 Update docs for running doctests locally 2024-02-14 21:08:06 +01:00
Disconnect3dandpeace-maker 9e4b11adb7 Fix Unicorn Engine 1GB limit that calls exit: raise OSError instead (Fixes #2343) (#2347)
* Fix Unicorn Engine 1GB limit exit(): raise OSError instead (Fixes #2343)

This commit fixes #2343: an issue where `pwn checksec <binary>` would fail with a bogus error of:

```
$ pwn checksec /root/x/bin/main
Could not allocate dynamic translator buffer
```

This actually comes from Unicorn Engine which tries to allocate a 1GB RWX mapping:
```
root@pwndbg:~# strace -e openat,mmap pwn checksec /root/x/bin/main 2>&1 | tail -n 10
openat(AT_FDCWD, "/usr/lib/python3/dist-packages/mpmath-0.0.0.egg-info/PKG-INFO", O_RDONLY|O_CLOEXEC) = 7
openat(AT_FDCWD, "/usr/local/lib/python3.10/dist-packages/unicorn/lib/libunicorn.so.2", O_RDONLY|O_CLOEXEC) = 7
mmap(NULL, 22447520, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 7, 0) = 0x7f2604f9d000
mmap(0x7f2605339000, 13496320, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x39c000) = 0x7f2605339000
mmap(0x7f2606018000, 3039232, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x107b000) = 0x7f2606018000
mmap(0x7f26062fe000, 1601536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x1360000) = 0x7f26062fe000
mmap(0x7f2606485000, 525728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2606485000
mmap(NULL, 1073741824, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)
Could not allocate dynamic translator buffer
+++ exited with 1 +++
```

...and if it fails, it calls `exit()`. This can be seen in Unicorn Engine code: https://github.com/unicorn-engine/unicorn/blob/56f3bdedb42d26bee1532cc01baf5eaf44a9aa23/qemu/accel/tcg/translate-all.c#L960-L963

This issue has been reported to Unicorn Engine in https://github.com/unicorn-engine/unicorn/issues/1766 but since it hasn't been fixed, this commit applies a workaround for it.

* CI: add test for pwn checksec with 500MB limit for UE 1GB limit

* Add changelog entry

* Update .github/workflows/ci.yml

---------

Co-authored-by: peace-maker <[email protected]>
2024-02-09 16:39:12 +01:00
47dfc57922 Add a flatten argument to ssh.libs (#2268)
* Add a `flatten` argument to `ssh.libs`

This option makes us able to avoid getting the file tree of the remote
server and just downloads the desired files in the output folder

* Update changelog

* Add a warning in ssh.libs for duplicate filenames

* Add documentation in ssh.libs for duplicate filenames fallback

* [ssh.libs] Fix flatten's duplicate check

Fix this: https://github.com/Gallopsled/pwntools/pull/2268#discussion_r1325404026

* [ssh.libs] Add better warning for flatten's duplicates

Fix this: https://github.com/Gallopsled/pwntools/pull/2268#discussion_r1325405234

* [ssh.libs] Add doctests

This commit adds:

- The `no_duplicate` binary that depends on
    - `a/lib.so`
    - `b/lib2.so`
- The `duplicate` binary that depends on
    - `a/lib.so`
    - `b/lib.so`

Then, the doctest tries to pull the libs from both binaries with
different `flatten` values.

* [ssh.libs] Add `remote` arg to documentation

* [ssh.libs] Remove fallback to unflattened when flatten fails

* [ssh.libs] Fix doctests

* [ssh.libs] Import pwnlib.data.elf.ssh_libs in pwnlib.data.elf

* [ssh.libs] Fix corrupted binaries

* [ssh.libs] We actually need to set the cwd since libs paths are relative

* [ssh.libs] Fix permission issues for CI

* [ssh.libs] Fix doctest

* Remove doctest attempts

---------

Co-authored-by: peace-maker <[email protected]>
Co-authored-by: Arusekk <[email protected]>
Co-authored-by: Peace-Maker <[email protected]>
2024-02-09 16:06:26 +01:00
Peace-Maker f5a119ffe5 Fix checksec commandline wrapper invocation 2024-02-09 10:56:14 +01:00
Peace-Maker 545d8f748a Remove f-string for Python 2 2024-02-08 10:41:47 +01:00
Stefan StefanovandBl4ckC4t a2b6771fe6 Improved DynELF address resolutions and symbol lookups (#2335)
* Optimized dynelf when using an ELF object

* Fixed minor bugs, added a new way to lookup symbols

Improved _rel_lookup and added Elf64_Rel datatype

Added support for _rel_lookup in x86 binaries

* Spelling fix

* Converted prints to python2 style

    + changelog entry

* Fixed a bug with real leaker not being resotred

---------

Co-authored-by: Bl4ckC4t <[email protected]>
2024-02-08 10:24:51 +01:00
teddavandpeace-maker 73f2a31d8b fix: split current iterm window during gdb.debug process (#2341)
* fix: split current iterm window during gdb.debug process

* add change to changelog

* escape cmd before writing osascript file

* use the previously sanitized command to run the osascript

---------

Co-authored-by: peace-maker <[email protected]>
2024-02-08 10:22:15 +01:00
Disconnect3d 604b98c035 Fix pwn constgrep when it matches a non-constant type (Fixes #2344) (#2345)
* Fix pwn constgrep when it matches a non-constant type

This commit fixes the following issue:

```
root@pwndbg:~# pwn constgrep a
Traceback (most recent call last):
  File "/usr/local/bin/pwn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/pwnlib/commandline/main.py", line 58, in main
    commands[args.command](args)
  File "/usr/local/lib/python3.10/dist-packages/pwnlib/commandline/constgrep.py", line 110, in main
    for _, k in sorted(out):
TypeError: '<' not supported between instances of 'Constant' and 'type'
```

Note that it was caused because of the following type object being matched and fetched from the module object:

```
ipdb> out[25:27]
[(Constant('CS', 0xd), 'CS'), (<class 'pwnlib.constants.constant.Constant'>, 'Constant')]
ipdb> sorted(out[24:27])
*** TypeError: '<' not supported between instances of 'type' and 'Constant'
```

* Add test for `pwn constgrep C` to the CI

* Add changelog entry
2024-02-08 10:17:47 +01:00
Disconnect3d 3fbd21a6e4 checksec.py: import ELF instead of * (#2346) 2024-02-08 10:15:29 +01:00
Arusekk b2cba039d4 Merge pull request #2161 from patryk4815/basic-darwin
basic darwin support for shellcrafter
2024-02-04 16:34:56 +01:00
Arusekk 10d1c5a1ab Merge branch 'dev' into basic-darwin 2024-02-04 16:24:02 +01:00
psondej 954d54665f #2161 Add basic support for darwin shellcraft/asm/disasm/run_shellcode/run_assembly 2024-02-04 16:22:02 +01:00
psondej e78fb02b9e -macosx_version_min has been renamed to -macos_version_min 2024-02-04 03:15:02 +01:00
peace-maker bf7abc054a Add ELF.stripped and ELF.debuginfo properties (#2336)
* Add `ELF.stripped` and `ELF.debuginfo`

Show status in checksec output too.

* Update CHANGELOG

* Show stripped and debuginfo status in red in checksec
2024-01-30 12:40:28 +01:00
peace-maker 27bc31e978 Match against local system libc first in libcdb (#2325)
* Match against local system libc first in libcdb

Don't do any requests if the libc currently in use on the system
running the exploit matches already. This is a small short circuit
optimization when the remote target uses the same libc as the
local one.

This looks at the libc loaded by the local shell binary. This appears
more dynamic than hardcoding library paths.

Refs #983

* Update CHANGELOG

* Handle missing SHELL envvar

* Fix hash lookup
2024-01-30 12:20:20 +01:00
peace-maker 993f590ac2 Retry failed lookups after one week in libcdb (#2323)
* Retry failed lookups after one week in libcdb

The libc databases might be updated to include the searched version,
so a request that failed once might work in the future.

Refs #983

* Update CHANGELOG
2024-01-30 11:29:31 +01:00
peace-maker e466f5c2a6 Make sure TERM_PROGRAM points to a valid program (#2329)
Visual Studio Code sets the $TERM_PROGRAM environment variable to `"vscode"` in its terminal pane,
but doesn't support opening new panes from the command line and there is no "vscode" binary.

Make sure the target binary exists before trying to launch it.
2024-01-30 11:08:57 +01:00
Nils1729 171d9dfb39 Fix: Allow setting attributes on gdb Breakpoints (#2339)
* fix: Allow setting attributes on gdb Breakpoints

* Update CHANGELOG

* Add __getattr__ accidentally deleted from FinishBreakpoint
2024-01-29 17:20:31 +01:00
teddav cb3fda4a7e fix: follow symlink for libs() on ssh connection (#2338) 2024-01-23 00:24:58 +01:00
dependabot[bot] 4e11ee7d99 Bump actions/cache from 3 to 4 (#2337) 2024-01-22 12:17:27 +00:00
Arusekk f6bee59b46 elf.maps: Less nullbytes + update hardcoded shellcodes 2024-01-22 13:06:10 +01:00
peace-maker 6dc1c2f72f Explicitly define p64/u64 functions for IDE support (#2189)
* Explicitly define p64/u64 functions for IDE support

Instead of dynamically generating the packing and unpacking helper functions using `setattr(module, name, routine)` at runtime, unroll the loop and explicitly declare all 8 helpers.

This allows IDEs to know about the function statically without running the code.

Fixes  #1657

* Update CHANGELOG

* Fix u16 comment
2024-01-21 18:22:09 +01:00
Arusekk 14309dc111 elf.maps: Update hardcoded shellcodes 2024-01-21 12:14:53 +01:00
Arusekk b5253fa510 shellcraft.amd64.mov: fix logic once again 2024-01-21 05:19:41 +01:00
Arusekk ea22cc8cef shellcraft.amd64.mov: fix logic 2024-01-20 22:39:34 +01:00
peace-maker d427844465 Lookup using $PATHEXT file extensions in which on Windows (#2328)
* Lookup process executable using PATHEXT file extensions

Windows uses some file extensions to determine which file to run when given
a non-existing file.

This allows to run `calc` instead of `calc.exe`.

* Try PATHEXT in `which` directly

* Update CHANGELOG
2024-01-18 00:57:43 +01:00
Peace-Maker 7b78334ac4 Android: Install emulator in CI 2024-01-17 21:57:38 +01:00
vsylandPeace-Maker 5805f5e9d7 Speed up disasm with color (#2334)
* Speed up disasm with color

* Update CHANGELOG

---------

Co-authored-by: Peace-Maker <[email protected]>
2024-01-17 21:44:52 +01:00
vsylandArusekk 000ca1f637 Fix unhex for odd length bytes (#2333)
* Fix unhex for odd length bytes

* Update pwnlib/util/fiddling.py

---------

Co-authored-by: Arusekk <[email protected]>
2024-01-13 17:47:51 +01:00
Arusekk 0339b46450 Update pwnlib/elf/corefile.py 2024-01-03 21:26:12 +01:00
Arusekk ad6ef0e372 Update pwnlib/shellcraft/templates/aarch64/mov.asm 2024-01-03 21:25:42 +01:00
psondej a814be2604 refactor aarch64 pushstr_array, use "xzr" reg 2024-01-03 19:40:05 +01:00
psondej bc6228e8bc fix freebsd amd64 syscall arguments 2024-01-03 18:56:14 +01:00
psondej 976f7cc175 revert "powerpc64" typo 2024-01-03 18:37:38 +01:00
psondej 15748d082d fix aarch64: mov, pushstr, pushstr_array
fixes:
- https://github.com/Gallopsled/pwntools/issues/2160
- https://github.com/Gallopsled/pwntools/issues/2284
2024-01-03 18:34:26 +01:00
psondej 8b56039d88 add auto generated files for darwin (make generate_darwin) 2024-01-03 18:28:05 +01:00
psondej 5d32b24998 add darwin shellcrafter templates 2024-01-03 18:27:33 +01:00
psondej 43aef76a37 initial darwin support 2024-01-03 18:26:36 +01:00
dependabot[bot]andArusekk d289e177fe Bump actions/upload-artifact from 3 to 4 (#2318)
* Bump actions/upload-artifact from 3 to 4

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* ci: use separate coverage artifacts

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arusekk <[email protected]>
2024-01-03 12:23:39 +01:00
peace-maker c4a3d349d6 Add support to start a process on Windows (#2310)
* Add support to start a process on Windows

This is heavily inspired by https://github.com/masthoon/pwintools

Allows to use the `process` tube on a Windows host running local
processes. I've tried to keep the changes at a minimum. Windows doesn't
support non-blocking reads, so I've opted to handle the reading in a
separate thread to simulate the non-blocking check.

* Fix `misc.which()` on Windows

`os.getuid()` is only supported on unix.

* Support [read|write]mem, libs and cwd

* Update CHANGELOG

* Don't cache loaded modules

* Wait output on stdout in `process.can_recv_raw`

Instead of handling the timeout for reading poorly in `process.recv_raw`,
wait for any bytes to be available in `process.can_recv_raw` like on linux.

This prevents a 100% spin of one core in `tube.interactive()` since it
expects the thread to block for `timeout` seconds while we would return
immediately previously.

* Remove PythonForWindows dependency

This loses the `readmem` and `writemem` feature, but that's not
necessary for this basic process startup support.

* Fix cyclic imports

* Ignore errors in reading thread

This could cause a deadlock / fastfail on shutdown when stdout is closed, thus read(1) fails
and the exception is tried to be printed to the console while stderr is in the process of getting
closed.
2024-01-02 21:11:57 +01:00
Lennard Hofmann 3bb756db45 Add timeout to gdbserver startup (#2321) 2024-01-02 15:40:09 +01:00
Florian Kothmeierandpeace-maker cd0c34a6ed Make pwn template always set context.binary (#2279)
* Make pwn template always set context.binary

* Update CHANGELOG.md

* Allow args.EXE override in all templates

* Fall back to old behavior for remote only challenges

---------

Co-authored-by: peace-maker <[email protected]>
2023-12-30 19:35:29 +01:00
Arusekk 5409174aed elf/corefile: Clean up pyelftools workarounds (#2319) 2023-12-30 00:01:07 +01:00
c7649c95e2 Make sure winexec shellcode is 16 byte aligned and add nCmdShow option (#2308)
* Make sure winexec is 16 byte aligned and add nCmdShow option

* fix typo and add changelog

* Update pwnlib/shellcraft/templates/amd64/windows/winexec.asm

Co-authored-by: peace-maker <[email protected]>

* tidied up winexec 16-byte alignment

* fix stack alignment on return

* Use stable alignment

* Avoid null-bytes in `add` instruction for long commands

---------

Co-authored-by: peace-maker <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2023-12-14 16:39:36 +01:00
peace-maker 8367da6500 Bump unicorn dependency to >=2.0.1 (#2315)
* Bump unicorn dependency to >=2.0.1

We're using riscv constants now which were added in unicorn2.

Fixes #2303

* Add RISCV64 plt emulation test binaries
2023-12-14 16:29:46 +01:00
dependabot[bot] b9cece5526 Bump actions/setup-python from 4 to 5 (#2316) 2023-12-12 21:39:27 +00:00
Peace-Maker 95fd121e1f android: suppress filenotfound error when looking for partitions 2023-12-12 21:31:49 +01:00
Peace-Maker 8ec092522e android: fix tests for amd64 emulator 2023-12-12 21:11:30 +01:00
Peace-Maker 8baa27e7a6 android: switch to x86_64 emulator
armeabi-v7a crashes :(
2023-12-12 20:24:02 +01:00
Arusekk d094156606 android: disable accel 2023-12-12 19:57:58 +01:00
peace-makerandArusekk 5f5554fa1c Detect challenge binary and libc in pwn template (#2309)
* Detect challenge binary and libc in `pwn template`

When the `args.exe` or `args.libc` arguments are missing, look for the
files in the current working directory.
This allows to quickly get a template by just running `pwn template`
(and maybe --host --port for remote instances).

This is inspired by https://github.com/io12/pwninit

* Update CHANGELOG

* Add --no-auto argument to disable automatic detection

Allow to keep the old static template behavior.

* Add logging about detection outcome

Inform the user that we're looking for the binaries and if we found one.

* Be more strict about libc filename detection

Check about common name patterns instead of plainly the presence of "libc" in the name.

Co-authored-by: Arusekk <[email protected]>

* Change --no-auto argument to reduce double negation

Co-authored-by: Arusekk <[email protected]>

---------

Co-authored-by: Arusekk <[email protected]>
2023-12-12 19:02:13 +01:00
Peace-Maker 0c6d5f5e71 android: Disable emulator GPU
Android Emulator 33.1.23 received a Graphics backend upgrade
2023-12-11 23:35:55 +01:00
Peace-Maker fbce30675a Enable unprotected grpc in Android tests
WARNING | The emulator now requires a signed jwt token for gRPC access! Use the -grpc flag if you really want an open unprotected grpc port
2023-12-11 23:04:08 +01:00
Arusekk 6f4682a41a android: enable kvm 2023-12-11 20:00:50 +01:00
Arusekk 07ea0fa185 term: hotfix 2023-12-11 18:41:15 +01:00
Arusekk 84b6c82ff3 term: simplify even further 2023-12-11 18:10:21 +01:00
peace-maker b1e2b56445 Nicer error when running tmux exploit outside tmux (#2314)
When you set the `context.terminal` to be tmux related but then try
to run the exploit outside a tmux session, you'd get a cryptic ValueError
while trying to parse the pid of the new pane in tmux.

Print a nicer reminder to start tmux first.
2023-12-06 23:48:33 +01:00
peace-maker b3d40438fb Fix support for amd64 x32 ABI (#2305)
* Add back support for amd64 x32 ABI

Recognize x32 ELF files as amd64.

* Add x32 test binaries

Regressed in fbf2727ac6
2023-12-04 20:18:20 +01:00
Arusekk 43071cd6e5 Term rework (#2242)
* term rework

* towards floating cells

* redraw when screen clears

* term: working completion

* Display non-printable characters

* ui: fix options with new term

* term: Clean up and fix examples/spinners

* changelog and lint

* Fix SSH in NOTERM mode

* defer termios setup

* term: py2 compat

* py2: compat fixup

* appease pylint

* fix scroll on winch

* term: fix hang on winch during readline
2023-12-02 13:31:40 +01:00
Michal AmbrozandPeace-Maker a8f4093695 Fix pwn libcdb file crashing if "/bin/sh" string was not found (#2307)
* next fails if string is not found in binary

fixes #2306

* Only display "str_bin_sh" symbol if it's available

* Update CHANGELOG

---------

Co-authored-by: Peace-Maker <[email protected]>
2023-11-29 22:29:35 +01:00
peace-maker f03582fb92 Explicitly select readthedocs theme (#2311)
The `sphinx_rtd_theme` has to be selected manually and isn't the default
on RTD anymore. This seems to be part of a wave of deprecations in their
build system.

https://github.com/readthedocs/tutorial-template/blob/f594c40889a4d9949339bd4e0d64275fc99c22f5/docs/source/conf.py#L32
2023-11-29 16:08:55 +01:00
d10c70fb32 Allow to add to the existing environment in ssh instead of replacing it (#1764)
* Add env_add to the ssh module

* Use ignore_environ like process

---------

Co-authored-by: peace-maker <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2023-11-25 17:08:48 +01:00
65f9d5761d Allow to add to the existing environment in process instead of replacing it (#1763)
* Add env_add to the process module

* Don't mutate passed `env` parameter dictionary

Co-authored-by: Arusekk <[email protected]>

* Update CHANGELOG

* Use a boolean flag instead of env_add

There should be preferably only one obvious way to pass env.

* Update CHANGELOG

---------

Co-authored-by: peace-maker <[email protected]>
Co-authored-by: peace-maker <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2023-11-24 14:02:53 +01:00
Michal AmbrozandPeace-Maker 4ef4746243 Remove python2 shebang lines from commandline tools (#2301)
* remove python2 shabangs

* Remove execute bit from commandline implementation

---------

Co-authored-by: Peace-Maker <[email protected]>
2023-11-24 13:37:29 +01:00
Michal Ambrozandpeace-maker 77957b4b41 Fix SyntaxWarning in Python 3.12 (#2302)
* libcdb.py - python 3.12

Python 3.12 would complain if the \d atom is not escaped in the binary string.

/usr/lib/python3.12/site-packages/pwnlib/commandline/libcdb.py:224: SyntaxWarning: invalid escape sequence '\d'
  libc_version = re.search(b'libc[ -](\d+\.\d+)', exe.data)

* Use raw string

---------

Co-authored-by: peace-maker <[email protected]>
2023-11-24 13:32:08 +01:00
Arusekk bb1d16c3c6 rop: Make stack move faster (#2300)
This defers calculation of all 'add (e|r)sp, 0xHUGE' payload until the gadget
gets actually used in a chain.

Fixes #2253
2023-11-20 15:31:42 +01:00
Arusekk e4d3c82501 ssh: Fix unstable cpuinfo on dynscaled CPUs 2023-11-14 23:41:41 +01:00
ArusekkandMichał Radwański 2f2e0dc48c elf: Resolve more relocations into GOT entries (#2277)
So far only relocations pointing to external symbols were considered
when filling GOT.  Relocations in libc are a different thing, often
found in CTF challenges (libc with partial RELRO has many interesting
overridable function pointers, like strlen & strchrnul).

Co-authored-by: Michał Radwański <[email protected]>
2023-11-14 23:13:21 +01:00
peace-maker b53d476977 Add x86 CET status to checksec output (#2293)
* Add x86 CET status to checksec output

The ELF class now features two properties:
- ibt for indirect branch tracking `-fcf-protection=branch`
- shstk for shadow stack `-fcf-protection=return`

Both checking the presence of the respective feature bit in the
note property x86 feature segment.

* Check if user shadowstack is enabled on SSH target

Look for "user_shstk" in /proc/cpuinfo for ssh.checksec()

* Add ELF.iter_notes and ELF.iter_properties helpers

Allows to easily iterate the PT_NOTE segment and the properties in "GNU"
notes.

* Check for ibt on remote ssh machine

* Update CHANGELOG

* Suppress error when /proc/cpuinfo cannot be read
2023-11-14 21:08:55 +01:00
Arusekk 0bf914e9e2 Merge branch 'beta' into dev 2023-11-14 20:59:20 +01:00
Arusekk 1b21f7a043 Release 4.12.0beta1 2023-11-14 20:15:36 +01:00
Arusekk 2e09b7dd91 Release 4.11.1 2023-11-14 20:01:02 +01:00
Arusekk 89650ace0d Merge branch 'beta' into dev 2023-11-14 19:48:03 +01:00
Arusekk d643a33233 Merge branch 'stable' into beta 2023-11-14 19:47:35 +01:00
peace-maker 8d6dc0b121 Python 2: Fix installing from source (#2298)
* Python 2: Fix installing from source

`python2.7 -m pip install git+https://github.com...`  doesn't install
any packages.

The auto-discovery doesn't work for the old setuptools version used in
Python 2.
https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#flat-layout

* Use Python 3 commandline tools in Docker images

Since the Python 2 version was installed first, the Python 3 install
didn't touch the existing shell script wrapper files.
2023-11-14 19:44:05 +01:00
Arusekk a7c03851fe Merge branch 'beta' into dev 2023-11-01 23:44:23 +01:00
Arusekk 2f58fe7ae5 Merge branch 'stable' into beta 2023-11-01 23:44:00 +01:00
Arusekk 64d52b09f3 shellcraft.aarch64: Fix atexit SEGV in loader (#2294)
Fixes #2289
2023-11-01 22:26:43 +00:00
Arusekk 5ff96409fc Merge branch 'beta' into dev 2023-10-29 16:30:25 +01:00
Arusekk 8cf3ecdc5b Merge branch 'stable' into beta 2023-10-29 16:30:08 +01:00
Kexuan Shen 0c1121d32c FIX: Generated shebang with path to python invalid if path contains spaces (#2285)
* modify script shebang to accept path with white space

* add changelog for 2271
2023-10-29 14:38:57 +00:00
peace-makerandArusekk dafd42b2c3 Fix tube.clean_and_log not logging buffered data (#2272)
* Fix tube.clean_and_log not logging buffered data

Only new data received after the `clean_and_log` call is printed while
data already received and buffered earlier is not.
Print the buffered data first before waiting for more so we don't miss
anything.

* Only show buffered data if DEBUG is off

* Update CHANGELOG.md

---------

Co-authored-by: Arusekk <[email protected]>
2023-10-29 14:05:16 +00:00
Tanix 3ff37a8b7e Fix _countdown_handler not invoking timeout_change; Fix value is value < 0 (#2287) 2023-10-29 11:23:31 +00:00
Arusekk 48fbffe449 Merge branch 'beta' into dev 2023-10-01 14:07:45 +02:00
Arusekk e9f73bf440 Merge branch 'stable' into beta 2023-10-01 13:48:12 +02:00
Gordiig 045b8c2186 FIX: Getting right amount of data for search fix (#2281) 2023-10-01 13:47:30 +02:00
Gordiig 32840ad806 FIX: Getting right amount of data for search fix (#2281)
* Getting right amount of data for search fix

* Add line to CHANGELOG.md
2023-10-01 13:39:11 +02:00
dependabot[bot] 81d17c701c Bump docker/login-action from 2 to 3 (#2274)
Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-23 18:48:47 +02:00
dependabot[bot] dd6b754453 Bump docker/setup-buildx-action from 2 to 3 (#2275)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-23 18:48:28 +02:00
dependabot[bot] 57d810acb1 Bump docker/build-push-action from 4 to 5 (#2273)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-23 18:48:05 +02:00
Peace-Maker fd50d4c995 Begin working on 4.13.0 2023-09-16 00:44:57 +02:00
Peace-Maker 01e6970971 Release 4.12.0beta0 2023-09-16 00:20:18 +02:00
Peace-Maker 6aaaf84586 Release 4.11.0 2023-09-15 23:16:19 +02:00
92cd96999f Allow empty argv in ssh.process() (#2217) (#2234)
* Fix bug at ssh.py:process() - empty argv[0] Error

Before this, process.py relied on `os.execve` which disallows an empty
argv or argv[0] == "".
This commit replaces `os.execve` with  `ctypes.CDLL(None).execve` to
call the C-Library function directly which allows an empty argv.

* Add #2225 to stable changelog

* Better ctypes syntax

* Add error message if cytpes.execve fails.

* Updata CHANGELOG.md

* ssh.py: python2 compatibility for os.environb

* Add check that "=" not in misc.normalize_argv_env

This check checks prevents the use of "=" in the
key of an environment variable, which is generally
impossible.

* ssh.process: Seperate cases for empty argv[0]

This commit seperates the cases for an empty argv[0]
from normal cases.

* ssh.py delete leftover comment

---------

Co-authored-by: Youheng Lü <[email protected]>
Co-authored-by: Arusekk <[email protected]>
Co-authored-by: peace-maker <[email protected]>
2023-09-15 01:10:14 +02:00
Hannes WeissteinerandHannes Weissteiner 8b86cc3ba6 Allow creating custom templates in user-config directory (#2257)
* Allow creating custom templates in user-config directory

* Update changelog

* add cmdline parameter for template

* direct template file selection, added more help

* added template path to help string

* remove testing template

* allow crash on invalid template file

* python2 compatibility

* improved documentation for template

---------

Co-authored-by: Hannes Weissteiner <[email protected]>
2023-09-13 18:03:29 +02:00
dependabot[bot] 20f07795f0 Bump actions/checkout from 3 to 4 (#2265)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 19:00:26 +02:00
Peace-Maker d12d2ea78c Merge branch 'beta' into dev 2023-09-12 13:37:43 +02:00
Peace-Maker 2d998a4082 Merge branch 'stable' into beta 2023-09-12 13:15:04 +02:00
peace-maker 8be72238b0 Rename wd parameter to cwd in ssh.system and ssh.run_to_end (#2251)
The current working directory should be called the same everywhere.
The `wd` argument is deprecated and `cwd` takes precedence.
2023-09-12 09:37:27 +02:00
peace-maker d762fe0c31 Fix corefile module after pyelftools update (#2261)
* Fix corefile module after pyelftools update

The `bytes2str` internal method was moved while Python 2 support was
removed in pyelftools 0.3.0.
Just use our own python aware decoder wrapper.

Fixes #2260

* Pin pyelftools < 0.3 for Python 2

* Fix pyelftools version number scheme

* Update CHANGELOG
2023-09-12 09:27:40 +02:00
Arusekk e608a46490 Merge branch 'beta' into dev 2023-08-20 20:54:18 +02:00
Arusekk fa2d47753b Merge branch 'stable' into beta 2023-08-20 20:53:42 +02:00
Arusekk 6ff74256d8 plt: remove stale MIPS workaround (#2256)
Fixes #2042
2023-08-20 18:49:35 +00:00
peace-maker 340b0bf0bc Only run docker workflow on upstream repo (#2252)
Don't run it in forks which can't push to the dockerhub.
2023-08-02 01:34:17 +02:00
Furkan 2e5a33cfea Remove unused and broken rop.find_stack_adjustment (#2249)
* Added missing return to rop.find_stack_adjustment

* Removed ROP.find_stack_adjustment()
2023-07-31 21:44:37 +02:00
peace-maker b8b29e1cc7 Fix pushing docker images on manual workflow run (#2250)
* Fix pushing docker images on manual workflow run

Running the docker workflow manually would associate the run with the
`dev` branch. The generated tags would all point to the `dev` tag, so
tag the image manually to the correct branch.

* Fix building ci image

It's called `python2.7` instead of `python`.

* Add riscv64 binutils to base image
2023-07-30 17:49:54 +02:00
dependabot[bot] ff178aad6a Bump actions/download-artifact from 2 to 3 (#2247)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-30 15:34:24 +02:00
dependabot[bot] 8c8e49cc10 Bump actions/upload-artifact from 2 to 3 (#2246)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-30 15:33:47 +02:00
dependabot[bot] 0b0f786002 Bump actions/checkout from 2 to 3 (#2248)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-30 09:38:24 +02:00
Arusekk 9ba65eb414 Merge branch 'beta' into dev 2023-07-29 22:31:37 +02:00
Arusekk cf53c4b219 Merge branch 'stable' into beta 2023-07-29 22:31:12 +02:00
peace-maker a0c9da07ac Fix ssh.process not setting ssh_process.cwd (#2241)
* Fix ssh.process not setting ssh_process.cwd

The cwd wasn't passed to the ssh_process created in ssh.process,
so the ssh_process.cwd attribute was never set.

This passes the cwd along now.
```
s = ssh(..)
io = s.process("pwd", cwd="/tmp")
io.cwd # "."
io.recvall() # b"/tmp\n"
```

* Update changelog
2023-07-29 22:29:21 +02:00
peace-maker 5b783feabd Keep Github Actions up-to-date with Dependabot (#2238)
Check every week if there are newer versions of the Github Actions we use.
2023-07-29 22:16:08 +02:00
Furkan 5589e15051 Decoded data from recv_all in packages to a string (#2237)
* Decoded data from recv_all in packages to a string

* Added sources for UTF-8 usage in Android

* Updated adb source
2023-07-29 21:23:27 +02:00
peace-maker 40c1ef5890 Do not overwrite global bytes in examples (#2240) 2023-07-28 15:50:18 +02:00
Arusekk e5af2bc3a3 Fix format string badbytes inconsistency (#1895)
* Fix format string badbytes inconsistency

Fixes #1888

* fmtstr: Make sure initial atom is considered
2023-07-28 15:49:00 +02:00
Furkan 6fa13de917 Added MAP_ADD opcode to list of opcodes in safeeval.py (#2243) 2023-07-28 14:45:22 +02:00
Arusekk 216e3edcde ci: stabilize coverage (#2235)
* ci: stabilize coverage

* fix cache dirs
2023-07-27 16:41:05 +02:00
peace-maker c334d46026 Publish Docker images through CI (#2236)
Rebuild the images on push to the respective branch.
2023-07-27 14:41:10 +02:00
peace-makerandArusekk 3e4e8b7055 Add --libc libc.so argument to pwn template (#2212)
* Add ELF.set_runpath()

Shells out to the `patchelf` tool to patch the ELF's RUNPATH. This lets the dynamic loader look for needed shared libraries in the given path first before the system libraries when running the binary.

* Add ELF.set_interpreter()

Shells out to the `patchelf` tool to patch the ELF's PT_INTERP segment. This allows to change the ld.so used when running the binary.

* Add convenience wrapper to set runpath & interpreter

A helper function to patch the ELF such that it uses the dynamic loader and other libraries in the given folder.

* Add method to download libraries matching a libc

Download the matching libraries for the given libc binary and cache them in a local directory using `libcdb.download_libraries()`. The libraries are looked up using libc.rip and fetched from the official package repositories if available.

Only .deb and .pkg.tar.* packages are currently supported (Debian/Ubuntu, Arch).

* Add --libc argument to pwnup template

This generates code into the template which allows you to run the binary using the given libc.

The foreign libc is used by default, but you can choose to run the binary against your system's local libc using the `LOCAL_LIBC` command line argument when executing the exploit script.

* Work around Python 2 tarfile not supporting xz

* Fix crash when libc wasn't found on libc.rip

* Update README

* Use subprocess.check_output instead of pwnlib.process

* Special case Python 2 instead of 3

* Only catch Exceptions instead of everything

Co-authored-by: Arusekk <[email protected]>

* Check launchpad.net for Ubuntu libcs

This mimics the way io12/pwninit obtains the ld.so.
If the download from libc.rip fails, try launchpad.net.

* Hide comment in template when --quiet

* Please confused pylint in PY2 context

Co-authored-by: Arusekk <[email protected]>

---------

Co-authored-by: Arusekk <[email protected]>
2023-07-26 13:58:32 +02:00
Arusekk 0696c5cb4f shellcraft/*/freebsd: match linux in switching cs (#2232)
* shellcraft/*/freebsd: match linux in switching cs

* shellcraft: note trashed registers in switching cs
2023-07-24 19:34:12 +02:00
Arusekk ac855ab179 shellcraft/i386: optimize stackhunter (#2231)
* shellcraft/i386: optimize stackhunter

* shellcraft/i386: add+opt long-gone stackhunter_helper

* shellcraft/i386: concise doctests
2023-07-24 19:33:26 +02:00
Arusekk 42c0798077 Merge branch 'beta' into dev 2023-07-17 19:26:41 +02:00
Arusekk cc3b28b23c Merge branch 'stable' into beta 2023-07-17 19:26:27 +02:00
Arusekk d69e294d54 py2: fix long hex in shellcraft etc. (#2230) 2023-07-17 17:10:15 +02:00
d679252ba9 Fix ret2csu with PIE binaries (#2158)
* fix indentation

* Allow ret2csu to find non-pie binaries

* ret2csu: fix detection logic

---------

Co-authored-by: peace-maker <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2023-07-17 10:08:43 +00:00
whokilleddbandDebjeet Banerjee 94fc5d2769 Update ssh.py (#1946)
Two minor changes were made in the commit:
- `which` was replaced with `command -v`
- Minor bug fix

## Why bother with `which` ?
- `POSIX` compatible
-  `which` is an external process you're launching for doing very little (meaning builtins like hash, type or command are way cheaper), you can also rely on the builtins to actually do what you want, while the effects of external commands can easily vary from system to system.
- Many operating systems have a which that doesn't even set an exit status, meaning the if which foo won't even work there and will always report that foo exists, even if it doesn't (note that some POSIX shells appear to do this for hash too).
- Many operating systems make which do custom and evil stuff like change the output or even hook into the package manager.

Reference [here](https://stackoverflow.com/a/677212)

Co-authored-by: Debjeet Banerjee <[email protected]>
2023-07-16 20:44:59 +02:00
Furkan fbe88c06db Improve error handling of serial-tube constructor (#2228)
* Resolved issue #1411 abt serial-tube misbehaving.

* Removed redundant docstrings
2023-07-15 12:41:10 +02:00
Disconnect3d dd1edaa6c9 shellcraft: more explicit sleep.asm docstring (#2226)
This commit adds information that the sleep shellcraft function does not check if it returned as part of an interrupt and it does not retry the syscall if this occured.
2023-07-12 00:24:54 +02:00
peace-maker b23251d05b Fix Python 2 editable user install (#2224)
This appears to be fixed in setuptools 62, but Python 2 is stuck at
version 44. Use a workaround which overrides the disabled user installs
temporarily.

This fixes our develop Dockerfile too!
2023-07-10 08:53:15 +02:00
peace-maker 83e19216ab Don't change log level for Corefile._parse_stack() (#2222)
* Don't change log level for Corefile._parse_stack()

If we don't want to see the log, don't print it. There are no spammy
debug logs anymore.

Fixes #1666

* Fix doctest
2023-07-09 22:02:44 +02:00
ArusekkandPeace-Maker 1399c7a969 Shellcraft stackargs (#2219)
From: Peace-Maker <[email protected]>

* Shellcraft: Fix spilling syscall args to the stack

There was a typo in the generated syscall template causing only the last
stack argument to be generated.

$ shellcraft -f asm mips.linux.sendto 3 0x123456 0x100 0 0xabcdefff 0x10
The 0xabcdefff argument was missing.

* Shellcraft: Generate 6 syscall arguments for unknown functions

There are syscalls with 6 arguments like mmap and sendto which couldn't
be called with all 6 arguments set.

$ shellcraft -f asm mips.linux.mmap2 0 0x1000
'PROT_READ | PROT_WRITE | PROT_EXEC' 'MAP_PRIVATE | MAP_ANONYMOUS' -1 0

* Shellcraft: Fix typo in error message

The `syscalls` variable is only present in the generate.py, not the
generated template.

* Regenerate syscall templates

* MIPS shellcraft: Push last two syscall arguments to the stack

The mips.linux.syscall template was only handling 4 syscall arguments
and silently discarded the remaining ones. Push the arguments to the stack
instead.

$ shellcraft -f asm mips.linux.syscall SYS_sendto 3 0x123456 0x100 0 0xabcdefff 0x10

Fixes #2153

* Fix mips syscall doctest

* Update CHANGELOG

Co-authored-by: Peace-Maker <[email protected]>
2023-07-09 22:00:54 +02:00
peace-makerandArusekk 8d104851ad Add shellcraft.sleep template wrapping SYS_nanosleep (#2221)
* Add shellcraft.sleep template wrapping SYS_nanosleep

Accepts the time in seconds as a float argument and calls SYS_nanosleep.

Fixes #1428

* Update CHANGELOG

* Use nanosleep wrapper

Co-authored-by: Arusekk <[email protected]>
2023-07-09 21:27:53 +02:00
peace-maker 9c83fa1099 Remove Travis CI Badge (#2220)
We don't use Travis CI anymore.

Closes #1740
2023-07-09 20:36:26 +02:00
Arusekk f1d5afe328 Merge branch 'beta' into dev 2023-07-09 15:25:06 +02:00
LY 05783e98c9 Change temp path in binutils install script (#2097)
Use $TMPDIR first. If $TMPDIR is unset/empty, use /tmp
(AFAIK most distros don't set $TMPDIR by default)
2023-07-09 15:21:40 +02:00
Arusekk d90cfd8b50 Merge branch 'stable' into beta 2023-07-09 15:13:11 +02:00
Youheng Lü c397626530 Fix bug at ssh.py:get() with relative path (#2214)
* Fix bug at ssh.py:get() with relative path

* Add doctest for bug at ssh.py:get()

* doctest for download and download_file
* remove os.path.join, since _download_raw already seem
  handle remote paths

* Add #2214 to stable changelog

* Fix Doctest for ssh.py to not be dependent on user dir

* Update CHANGELOG.md
2023-07-09 12:57:17 +00:00
peace-maker 9f072e3d0b Fix BytesWarning in ssh.interactive() (#2218)
When the current working directory was changed, `interactive()` changes
into that directory using `cd X` which wasn't encoded.
2023-07-09 12:30:04 +00:00
Arusekk 7547518e7c Merge branch 'beta' into dev 2023-07-09 12:57:50 +02:00
Arusekk edb93986ef Merge branch 'stable' into beta 2023-07-09 12:57:04 +02:00
peace-maker 8c62a58a18 Add pathlib2 to install_requirements for python_version < 3.4 (#2205)
The dynamic addition of the dependency which was used previously wasn't
included in the published egg on pypi.
2023-07-09 10:50:20 +00:00
zt20xx 96a8db0243 Update elf.py (#2211) 2023-07-09 10:36:39 +02:00
peace-makerandArusekk 8b4cacf8b8 Fix typo in ssh trying to access non-existent log.Progress.error (#2200)
* Fix typo in ssh trying to access log.Progress.error

That function doesn't exist and .failure() is used everywhere else.

* Use log.error instead of manually raising

The log.Progress logger doesn't print the exception when exiting the scope.

---------

Co-authored-by: Arusekk <[email protected]>
2023-07-03 19:29:39 +02:00
Arusekk 5f15b53ee6 Merge branch 'beta' into dev 2023-07-02 22:16:47 +02:00
peace-maker 7d4b80fc48 Fix stable changelog in beta (#2213) 2023-07-02 19:59:07 +00:00
maple b73e74f1ff Replace isSet with is_set as the former is deprecated in 3.10+ (#2208)
`threading.Event.isSet` is deprecated here: https://github.com/python/cpython/commit/9825bdfbd5c966abf1f1b7264992d722a94c9613
2023-06-26 13:50:11 +02:00
Arusekk 909d5833cd Merge branch 'beta' into dev 2023-06-26 01:45:34 +02:00
Arusekk b9cc118a15 Clean up CI workflow 2023-06-26 01:44:54 +02:00
Arusekk 1f63615085 Merge branch 'stable' into beta 2023-06-24 02:20:19 +02:00
peace-maker 23ef84e45a Fix Python 2 CI (#2210)
* Fix Python 2 CI

* Fix python symlink related tests
2023-06-24 02:16:53 +02:00
91be8af121 Add -p (--prefix) and -s (--separator) arguments to hex command (#2117)
* Add formats for hex

* Add formats for hex coverage

Relates to #2117. Adding coverage as requested.

* Use util.lists.group

* Update CHANGELOG

* Fix Python 2 support

* Simplify hex formatting

Co-authored-by: Arusekk <[email protected]>

---------

Co-authored-by: marcan2020 <[email protected]>
Co-authored-by: carydrew <[email protected]>
Co-authored-by: Peace-Maker <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2023-06-04 22:23:11 +02:00
peace-maker 61bce7f6cf Fix remote and listen in sagemath (#2202)
* Fix `remote` and `listen` in sagemath

sage's Integer doesn't seem to inherit from python's base int.

```
----> 1 listen(Integer(1337))
OSError: Int or String expected
```

Fixes #2201

* Update CHANGELOG
2023-06-02 16:57:00 +02:00
Arusekk c195c14b13 Merge branch 'beta' into dev 2023-06-01 11:40:37 +02:00
Arusekk 17fa832443 Merge branch 'stable' into beta 2023-06-01 11:40:03 +02:00
peace-maker c72886a9b9 Fix 4.11 beta changelog (#2198)
It included the changes in stable again.
2023-06-01 01:56:59 +02:00
Arusekk e09112b7d4 Merge branch 'beta' into dev 2023-05-21 16:38:42 +02:00
Arusekk f8fd03c2c2 Do not pollute PyPI with half-handed packages 2023-05-21 16:38:09 +02:00
Arusekk d590a0b77f Begin working on 4.12.0 2023-05-21 16:16:11 +02:00
Arusekk f0ffaee217 Release 4.11.0beta0 2023-05-21 15:56:09 +02:00
Arusekk 9dfc4d7ee4 Release 4.10.0 2023-05-21 15:46:14 +02:00
Arusekk cb5b8af5f3 Merge branch 'beta' into dev 2023-05-21 15:18:06 +02:00
Arusekk 78196db658 Merge branch 'stable' into beta 2023-05-21 15:07:18 +02:00
peace-maker d76c9fc704 Fix typo in mips mov shellcraft template (#2195) 2023-05-21 13:01:48 +00:00
Jonathan KellerandArusekk 8f122c3e00 Fix encoding & escaping in ssh.upload_dir (#2165)
remote_tar is a `bytes`, so the string interpolation resulted in the
command `cd ... && tar -xzf b'/tmp/...tar.gz`. It also would have failed
had either path contained spaces.

To fix this, make everything a bytes and use proper escaping.

Co-authored-by: Arusekk <[email protected]>
2023-05-21 12:51:03 +00:00
peace-makerandArusekk 123f68f096 Fix highlight of unaligned nullbyte in disasm cmd (#2182)
"1001" would highlight the "00" even though it's not a null byte in the
input. Group the bytes correctly to look for real null bytes and
newlines only ignoring accidental matches of adjacent bytes.

Co-authored-by: Arusekk <[email protected]>
2023-05-21 12:42:05 +00:00
James R T 5a84bbf775 Force ELF.path to be of type string (#2174)
This commit forces the `path` class variable of the `ELF` class to be of
type string, even if a byte string argument is passed. This also makes
the implementation consistent with the documentation, which states that
`ELF.path` is of type `str`.

Fixes #2166

Cherry-picked from 60af3a26d0

Signed-off-by: James Raphael Tiovalen <[email protected]>
2023-05-21 14:23:22 +02:00
James R T 60af3a26d0 Force ELF.path to be of type string (#2174)
This commit forces the `path` class variable of the `ELF` class to be of
type string, even if a byte string argument is passed. This also makes
the implementation consistent with the documentation, which states that
`ELF.path` is of type `str`.

Fixes #2166

Signed-off-by: James Raphael Tiovalen <[email protected]>
2023-05-21 14:20:38 +02:00
Arusekk 060746e274 pypi: Use trusted publishing (OIDC) (#2194)
Recently introduced [auth mechanism][1] makes it possible to not keep
any long-lived tokens in GH secrets, reducing attack surface.

[1]: https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/

Cherry-picked from 74c37037e2
2023-05-21 14:02:13 +02:00
peace-maker 0499631429 Fix failing libcdb.unstrip_libc tests (#2196)
* Fix libcdb.unstrip_libc tests

The old debugsymbols seem to have been pruned.
Update hashes to recent Ubuntu 22.04 libcs.

* Switch wget test to httpbingo.org

httpbin.org is very slow to respond.

Cherry-picked from 1998ff0920
2023-05-21 14:02:13 +02:00
Arusekk 74c37037e2 pypi: Use trusted publishing (OIDC) (#2194)
Recently introduced [auth mechanism][1] makes it possible to not keep
any long-lived tokens in GH secrets, reducing attack surface.

[1]: https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
2023-05-21 13:39:01 +02:00
peace-maker 58222ccf8b Handle context.newline correctly in tube.interactive() (#2129)
* Handle `context.newline` correctly in `tube.interactive()`

The `context.newline` or `self.newline` variable isn't obeyed when typing in interactive mode. It is used when sending and receiving lines through `tube.sendline` though, causing a mismatch.

The receiving end of the `tube.interactive()` already has handling of newlines, but the sending side does not.

Example:
```python
from pwn import *
io = process('cat')
io.newline = b'\r\n'
io.sendline(b'auto')
io.interactive()
```

```
$ python testinteractive.py DEBUG
[x] Starting local process '/usr/bin/cat' argv=[b'cat']
[+] Starting local process '/usr/bin/cat' argv=[b'cat'] : pid 19060
[DEBUG] Sent 0x6 bytes:
    b'auto\r\n'
[*] Switching to interactive mode
[DEBUG] Received 0x6 bytes:
    b'auto\r\n'
auto
$ test
[DEBUG] Sent 0x5 bytes:
    b'test\n'
[DEBUG] Received 0x5 bytes:
    b'test\n'
test
```

The expected outcome would be to send `b'test\r\n'.

The same problem arises in non-term mode (`PWNLIB_NOTERM=1`), where stdin is read in binary mode causing the OS line seperators to come through. Correctly replacing them with the `context.newline` setting allows to use the interactive input on windows hosts as well, without constantly sending `\r\n`.

* Update CHANGELOG.md

* Only replace newlines in TTYs

Don't mess with the line endings when piping data through.

* Always send bytes immediately on receive

Only replace newlines in a tty if NOTERM wasn't explicitly set or
the `newline` setting was set.

* Don't return a newline after term.readline lines

The builtin `input()` doesn't include the newline.

* Remove bogous newline from CHANGELOG
2023-05-18 22:32:08 +02:00
peace-maker 1998ff0920 Fix failing libcdb.unstrip_libc tests (#2196)
* Fix libcdb.unstrip_libc tests

The old debugsymbols seem to have been pruned.
Update hashes to recent Ubuntu 22.04 libcs.

* Switch wget test to httpbingo.org

httpbin.org is very slow to respond.
2023-05-18 17:59:16 +02:00
yuvalpo ab60471266 ELF.nx and ELF.execstack enhancements (#2186)
* ELF.nx and ELF.execstack enhancements

* Update CHANGELOG.md

* Detect NX state whenever possible when GNU_STACK is missing
2023-05-15 14:16:19 +02:00
ElouanFiore d16da4f8a8 Fixing a typo (Procedure Linkate Table -> Procedure Linkage Table) (#2192) 2023-05-13 11:11:45 +02:00
Arusekk 731f4a9219 Fix readthedocs hopefully (#2191)
* Fix readthedocs hopefully

* Make colored_traceback an optional dep

* Add python-dateutil to docs req

* Add more docs reqs
2023-05-13 11:09:17 +02:00
mthangandArusekk 83e3b5bbaa Fmtstr no dollar payload (#2185)
* added feature to the fmtstr module, now able to generate payload without the dollar syntax.

* made some improvements in the no_dollar feature implemented

* reduced different lines

* removed some blank lines and debug stuff

* (fix) missing check for no_dollar option

* (fix) updatet argument type for documentation

* updated CHANGELOG.md

* (fix) typo in the CHANGELOG.md version

* Update pwnlib/fmtstr.py

suggested change, dont need comparison in calling the make_payload_dollar

Co-authored-by: Arusekk <[email protected]>

* Update pwnlib/fmtstr.py

suggestion; better use a non null byte thing to fill the values used by the %c to pad before writing.

Co-authored-by: Arusekk <[email protected]>

* (fix) minor fixes, typos on comments

* update pwnlib/fmtstr.py : suggestion from Arusekk, made improvements to save some bytes in the generation of the payload

* added tests to fmtstr_payload with no dollar flag

* update CHANGELOG.md with correct version

---------

Co-authored-by: Arusekk <[email protected]>
2023-04-30 21:01:14 +02:00
Arusekk c1ed0e6f10 Declarative setup (#2179)
* Move most settings to pyproject.toml

* py2 minimal compat

* Make it not crash nor include spurious files

* Use PEP517

* Update workflows

* Limit workflows

Closes #1587
2023-04-18 22:33:01 +02:00
Arusekk ef3bb56be9 ci: leverage stock Android SDK present on GHA (#2175)
* ci: leverage built-in Android SDK of GHA runners

* android: more robust NDK detection
2023-04-18 15:12:17 +02:00
peace-maker 1a1124cf46 Fix debugging and assembly for RISCV (#2180)
* Fix debugging and assembly for RISCV

They are broken since the riscv architecture was split into riscv32
and riscv64 internally in #2177.

* Always look for riscv32. riscv64 or riscv toolchains

* Look for riscv64 for riscv64 first
2023-04-11 16:40:33 +02:00
XeonacidandArusekk fbf2727ac6 Determine elf arch by e_machine and bits (#2177)
* Determine elf arch by e_machine and bits

Separate 32/64 for riscv and mips
Trim some trailing space

* Fix missing comma

Co-authored-by: Arusekk <[email protected]>

* Add CHANGELOG

* unicorn: Use fixed version

* Cosmetic enhancements

---------

Co-authored-by: Arusekk <[email protected]>
2023-04-09 02:18:59 +02:00
Arusekk a51a06a36f ci: Update CI workflow YAML devops engineering 2023-04-08 00:37:47 +02:00
peace-makerandArusekk aa48227781 Add search for libc binary by leaked function addresses (#2103)
* libcdb: Add option to search by function offsets

When you're able to leak addresses of the libc library, use `libcdb.search_by_symbol_offsets()` to find and download the matching libc library from https://libc.rip.

If there are multiple matches, the user is prompted to select one interactively. The selection can be saved in the code for future executions of the script.

Fixes #1867

* libcdb: Handle multiple results when looking up by hash

Sometimes the same library appears to be indexed multiple times (see 0b52d2e713d243f0f65d808fcd3fbe372bb3cd32). Handle that situation by selecting the first in the list, since they should all be identical given the same hash value.

* Update CHANGELOG

* Fix off-by-one when pre-selecting a libc

* Do .json() only once

---------

Co-authored-by: Arusekk <[email protected]>
2023-03-22 12:26:39 +01:00
Minei3oat 1461b486ab Fix documentation of tube.recvall (#2163) 2023-03-22 12:14:18 +01:00
Ivan Komarov 98778d2277 Fix a couple of typos in the comments for unpack*() functions (#2167) 2023-02-06 13:33:12 +01:00
Liam Siegel ba7c7e5545 Noticed a small typo and corrected the word "whith." (#2157)
This is only a cosmetic change to an incorrect word in the documentation.
2023-01-14 12:57:57 +01:00
Yulian 60e91b7fd6 Fix typo and comment consistency (#2115) 2023-01-12 15:12:10 +01:00
36ad53b4ff Fixes for download_dir (#2151)
* Fixes for download_dir.

* Adds support to use SFTP if available

* Update pwnlib/tubes/ssh.py

Co-authored-by: Arusekk <[email protected]>

* Removal of unnecessary parens after 'if' keyword

Co-authored-by: Juuso Käenmäki <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2023-01-10 07:17:53 +01:00
peace-maker 44d514119e Add basic shellcode for Win64 to shellcraft (#2154)
* Add initial set of shellcode to run WinExec("cmd.exe")

* Remove nullbyte from getexport

* Generate docs for windows shellcode
2023-01-08 22:51:58 +01:00
Jusb3andJuuso Käenmäki 55c304328a Changes _get_fingerprint to accept variety of output formats (#2152)
Co-authored-by: Juuso Käenmäki <[email protected]>
2023-01-06 18:32:26 +01:00
Arusekk 39ef958bfe Begin working on 4.11.0 2022-12-29 14:42:14 +01:00
Arusekk 082c55dd78 Release 4.10.0beta0 2022-12-29 14:11:52 +01:00
Arusekk c45e92d78b Release 4.9.0 2022-12-29 14:08:51 +01:00
Tobias JostandArusekk 7673ce8ea2 Make template respect args.EXE (#2111)
* Make template respect args.EXE

To be able to execute a script using an executable with another name and/or location than specified at template generation, `args.EXE` will be used as path for ELF file loading, only using the preconfigured value when no arg was supplied

* Update CHANGELOG.md

* FIXUP: properly test for EXE arg

* Style fixes and revert changelog

Co-authored-by: Arusekk <[email protected]>
2022-12-29 13:16:04 +01:00
Patryk KrawaczyńskiandArusekk 6a9f78ac46 Upgrade to Ubuntu Focal 20.04 LTS (#2118)
* Update Dockerfile

* Move to Ubuntu Jammy 22.04 and keep python2.7

* Apparently Debian intentionally broke ensurepip

Co-authored-by: Arusekk <[email protected]>
2022-12-29 13:08:23 +01:00
peace-makerandArusekk 48d76ed0af Support adding lists in ROP.raw() (#2128)
* Support adding lists in `ROP.raw()`

Allow to add multiple raw entries on a rop chain using an array instead of multiple calls to `raw()`.

```py
rop = ROP('/bin/ls')
# before
rop.raw(1)
rop.raw(2)
rop.raw(rop.ret)

# after
rop.raw([1, 2, rop.ret])
```

Fixes #2017

* Update CHANGELOG.md

* Update pwnlib/rop/rop.py

Co-authored-by: Arusekk <[email protected]>
2022-12-29 02:19:50 +01:00
Johnson 838e9ec947 Support FinishBreakpoint for GDB API (#2114)
* Support FinishBreakpoint for GDB API

* Evaluate args outside FinishBreakpoint callbacks
2022-12-29 02:17:50 +01:00
Arusekk 826f4f39da Create SECURITY.md
Closes #2015
2022-12-29 01:58:19 +01:00
peace-maker 188632cd96 Fix docker image building and local testing (#2146)
The base image was missing the patchelf utility and the develop image
didn't update the apt cache. That caused building the image to fail when
pulling the outdated pwntools:base image from dockerhub.
The docker Makefile was using an invalid `-depth 1` argument which appear
to have been replaced by `-mindepth` and `-maxdepth` arguments recently.

The testing container is based on the develop image's Dockerfile which
copies new files into the container. Grab them from the appropriate folder.
pwndbg was installed twice when running the testing container for the
doctests.
2022-12-29 00:55:39 +01:00
Ian Laird e5407603f0 Added arch and bits specific flag to asm call from elf wrapper (#2137) 2022-12-29 00:21:34 +01:00
peace-maker f1693e3005 Support non-bytes argument in packing._need_text() (#2127)
* Support non-bytes argument to `packing._need_text()`

Allow to pass everything to `_need_text` and be sure to get a string back. This allows to log any object without the need for a format string by calling `repr` on it.

```py
# before:
log.info('%r', 5)
# now
log.info(5)
```

Fixes #2018
2022-12-29 00:19:35 +01:00
clubby789 4d81cb5d3f Reduce Pylint CI false positives (#2142) 2022-12-29 00:15:11 +01:00
Arusekk fa08f5a7bf Fix spurious AttributeError on None stdio
Fixes #2036
Closes #2102
2022-12-29 00:08:14 +01:00
Arusekk 69132c66e3 Fix CI after careless merging of #2144
This is why CI should always be green.
Make it green, dear contributor, because the maintainers might merge
something without checking if it is green.  Please.
2022-12-29 00:08:14 +01:00
Arusekk 74cf13eb58 Update README.md
The old API was a hack apparently, but it looks like GitHub Actions slowly gets less and less sketchy over time, and even goes as far as providing well-designed APIs.
Ref. https://github.com/badges/shields/issues/8671
2022-12-29 00:03:41 +01:00
PeterD1524 448914a5aa Fix logging in wait_for_debugger (#2143) 2022-12-28 23:14:58 +01:00
Disconnect3d 2f21f1bedb Fix PwntoolsLexer number matching (#2139)
This commit fixes a small bug with PwntoolsLexer where it matched negative numbers incorrectly in Arm assembly.

See https://github.com/pwndbg/pwndbg/pull/1367 for more information
2022-12-28 23:13:19 +01:00
BinSong 165452a0ab fix a bug in ret2dlresolve when pie is enabled. (#2136) 2022-12-28 23:12:46 +01:00
ThatOnePizzaandArusekk b771fc560b Fix asm() instruction consistency (#2144)
* sets p2align header to 0 for x86-32 x86-64 and thumb

* updates changelog

* adds PR link to changelog

* Update pwnlib/asm.py

Co-authored-by: Arusekk <[email protected]>

Co-authored-by: Arusekk <[email protected]>
2022-12-28 23:12:23 +01:00
Arusekk 21131bd5e8 Merge branch 'beta' into dev 2022-12-28 22:34:59 +01:00
Arusekk a76c7b0ca1 Defer import of optional dependency 2022-12-28 22:29:50 +01:00
Arusekk b8fad78d3e Fix binutils version checking and RWX warnings
Fixes #2140
Closes #2098
Closes #2141
2022-12-28 22:19:35 +01:00
Arusekk 8f42bef2b1 Use modern inspect.signature
While at it, drop the hard-to-maintain code.
We lose the signature in py2, but its support is second-class anyway.

Fixes #2145
Closes #2148
2022-12-28 22:13:55 +01:00
Arusekk 020143f0f9 Compatibility with python 3.11 (#2070)
Closes #2057
Closes #2052
2022-12-28 21:46:26 +01:00
Arusekk 416c33ed00 New toolchain, new doctests 2022-12-28 21:46:26 +01:00
Arusekk 3884d606b7 ci: Use default elfutils from 22.04 2022-12-28 21:19:42 +01:00
Arusekk 4628627943 Bump setup-python GH action 2022-12-28 20:15:06 +01:00
Arusekk d86ae5794a Merge branch 'stable' into beta 2022-12-28 19:43:01 +01:00
minaminao 9e065adae8 fix: str -> bytes in doc (#2133) 2022-12-02 23:04:40 +01:00
Arusekk 0a7c0b62a7 Make term resistant against SIGWINCH storm 2022-11-06 17:39:28 +01:00
peace-maker 67d49a693d Fix tube.recvpred() timout argument (#2124)
* Fix tube.recvpred() timout argument

The `timeout` argument wasn't implemented correctly causing the function to hang instead of timing out.

* Update CHANGELOG.md
2022-11-01 19:21:37 +01:00
peace-maker 4ddb702ba7 Mention need for listen.wait_for_connection() in docs (#2126)
You have to call `listen.wait_for_connection()` before using the listen socket or you face raceconditions with the thread accepting the client connection.

Fixes #2100
2022-10-27 14:39:25 +02:00
peace-maker 30f55d33f4 Allow tube.recvregex to return capture groups (#2125)
* Allow tube.recvregex to return capture groups

When wanting to extract a value from the received data, one had to receive up until the value and the value itself in two steps without carving the data out of a large blob like this:

```
io.recvuntil(b'The address is: ')
address = int(io.recvline(), 16)
```

or use a regex twice:

```
pattern = re.compile(rb'The address is: (0x[0-9a-fA-F]+)')
data = io.recvregex(pattern)
address = int(pattern.search(data).group(1), 16)
```

This patch allows to pass `capture=True` to `tube.recvregex()` to return a `re.Match` object instead of the raw bytes.

```
addr = int(io.recvregex(rb'The address is: (0x[0-9a-fA-F]+)', capture=True).group(1), 16)
```

This allows for slicker data extraction!

Fixes #1962

* Update CHANGELOG.md
2022-10-27 14:37:23 +02:00
peace-maker a7cb54931c Fix ROP without a writeable cache directory (#2123)
* Fix ROP without a writeable cache directory

`context.cache_dir` can be None, but the ROP class assumed it would always be a valid path and crash. Disable rop-cache if we can't save it.

Fixes #2072

* Update CHANGELOG.md
2022-10-27 14:33:54 +02:00
锋临 dc4108d6f2 Fix boundary judgment error (#2116) 2022-10-23 09:37:20 +02:00
peace-maker 7d1dae1071 Update libcdb debuginfod default URL to federating server (#2101)
* Switch to federated debuginfod service

elfutils.org offers a federating proxy server which forwards the requests to all other debuginfod servers of the different linux distributions.

https://sourceware.org/elfutils/Debuginfod.html

Use that instead by default to increase our successrate and potentially include new servers automatically once the distro sets one up.

* Use DEBUGINFOD_URLS envvar for server selection

The `DEBUGINFOD_URLS` environment variable is what you use for your normal debuginfod setup to tell it where to look for debug symbols.

Parse it as well and prepend it to the list of servers to try to allow for dynamic adjusting of the target servers.
2022-09-25 14:56:19 +02:00
锋临 302a4ef4ed Fix format string badbytes not working (#2113)
* Fix format string badbytes not working

* update boundary conditions
2022-09-24 12:10:24 +02:00
Aidan W 6457c33280 Spelling mistake fix (#2104) 2022-08-30 10:10:33 +02:00
Arusekk 87e37ee121 setresuid: generic implementation for all arches (#2093)
* setresuid: generic implementation for all arches

Closes #1324

* Update changelog
2022-08-15 12:41:25 +02:00
Arusekk e53c7f7350 shellcraft: consistently name dupio and optimize (#2092)
* shellcraft: consistently name dupio and optimize

* Update changelog
2022-08-08 23:10:10 +02:00
Gustaf Blomqvist a5c0809f38 Do not skip chars after non-printable characters
Closes #2094
2022-08-08 23:00:30 +02:00
01df19d360 Stable: ret2csu: fix a silent failure when rdx is populated from r14 (#2063)
* Fix for overwritten env when parsing core file

* warn_once message when dealing with overwritten pointer to env variable in core file

* Check for sha256 and sha256sum before trying openssl sha256 as "openssl sha256" doesn't return an error code in some old versions of openssl (OpenSSL 0.9.8g 19 Oct 2007 at least) that doesn't support sha256.

* ret2csu: fix a silent failure when rdx is populated from r14.
One such binary can be found at https://github.com/nobodyisnobody/write-ups/tree/main/FCSC.2022/pwn/Deflation

* Clean up the code a bit

Co-authored-by: Zach Riggle <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2022-08-07 17:02:13 +02:00
Lasne OlivierandArusekk e63e685bc7 make pwn cyclic -l work with entry larger than 4 bytes (#2062)
* make pwn cyclic -l work with entry larger than 4 bytes

* Do not assume py3, do not assume little-endian

* Update changelog

* pack all bytes instead

Co-authored-by: Arusekk <[email protected]>
2022-08-07 16:47:37 +02:00
LYandArusekk 002ac9e03e Change prefix in install script to $PREFIX (#2079)
* Change prefix in install script to $PREFIX

On special envrionments like Termux, /usr/local is not the proper path.

* Change prefix in binutils install script to $PREFIX

* PREFIX not everywhere

Co-authored-by: Arusekk <[email protected]>
2022-08-07 12:41:29 +02:00
Arusekk b825e977f3 shellcraft: fix and optimize itoa
Fixes #2073
2022-08-07 10:56:17 +02:00
Arusekk 0533ba01c8 Make setRegisters more robust
Closes #1683
2022-08-07 10:31:33 +02:00
Carlos Silva f084699341 Don't pass basename to coredumpctl (#1879)
coredumpctl saves the coredumps with full path to the binary. Passing only the basename makes it fail to find the coredump when it is actually there.

Closes #1879
2022-08-06 19:47:49 +02:00
Florian Kothmeier 955b6d4cbd Enable sysroot parameter for native gdb.attach() (#2084) 2022-08-06 19:34:37 +02:00
Zhi-Qiang ZhouandArusekk 1b5a00cad9 code style (add abstractmethod) (#2069)
Co-authored-by: Arusekk <[email protected]>
2022-08-06 18:40:04 +02:00
aviyae a7b362e1c0 gdb: fix #1493 (#2083)
Fix wrong branch taken when trying to debug non native arch via ssh
(resulting qemu_port being referenced without being set).

This is done by setting the condition in line 571 to be the same
as in line 534

Signed-off-by: Aviya Erenfeld <[email protected]>
2022-08-06 18:25:44 +02:00
S1lv3rGh0st eb67d55f0d Fix typo (#2080)
For issue #2074
2022-08-06 17:44:44 +02:00
Arusekk 807f534c24 Compatibility with python 3.11 (#2070)
Closes #2057
Closes #2052
2022-06-17 21:50:47 +02:00
Arusekk 11f34c3bc5 Follow-up after #2061 which broke CI 2022-06-04 21:52:37 +02:00
u91o dbf066b89c Fix links (#2061) 2022-05-18 16:00:28 +02:00
u91o 45551f4bc4 Fix dash build (#2059) 2022-05-18 16:00:08 +02:00
Arusekk 7f5866ab8d Begin working on 4.10.0 2022-04-21 01:23:52 +02:00
Arusekk e450f6c247 Release 4.9.0beta0 2022-04-21 01:14:48 +02:00
Arusekk 493a3e3d92 Release 4.8.0 2022-04-21 01:05:15 +02:00
Arusekk 3e4d4a2115 Allow non-numeric ports with remote() 2022-04-21 00:51:54 +02:00
Arusekk b3b6d52bdd Clean up usages of getattr/__getattr__ (#2028) 2022-04-21 00:38:24 +02:00
sourqueandLMS57 6ba46d4eec Add the 'raw' option to SSH shell initialization (#2037)
* Add the 'raw' option to SSH shell initialization

This permits the use of the SSH shell as an arbitrary TCP tunnel by
bypassing the startup environmental checks.

Co-authored-by: LMS57 <[email protected]>

* Add changelog items

* Add assignment to self variable

Co-authored-by: LMS57 <[email protected]>
2022-04-21 00:37:25 +02:00
PaulandArusekk 5af2d92100 Quote file and core path in generated GDB script (#2033)
* Quote file and core path in generated GDB script

* Update changelog

Co-authored-by: Arusekk <[email protected]>
2022-04-21 00:36:03 +02:00
3fadc67327 clean ioerror (#2039)
* clean ioerror

* enforce stricter checks on broken pipe

* Apply suggestions from code review

Co-authored-by: caprinux <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2022-04-21 00:32:40 +02:00
peace-maker 91c1b20c7b Detect Windows Terminal and split gdb into new pane (#2056)
Split the terminal window similar to tmux debugging experience when we're running in Windows Terminal instead of the plain old console host.
2022-04-20 23:46:42 +02:00
Justin StevenandArusekk 0351219903 Add js_escape and js_unescape (#1979)
* Add js_escape and js_unescape

* Add entry for js packing functions

* Use hardcoded data for doctest

* Fix js_escape data iteration for Python 2

* Move js packing functions to util.fiddling

* Apply suggestions from code review

Co-authored-by: Arusekk <[email protected]>
2022-04-20 17:49:00 +02:00
peace-makerandArusekk 4b067d2ec5 Add libcdb commandline tool (#1975)
* Add libcdb commandline tool

Allows to dump information about a local libc binary or lookup matching libc versions based on a build hash or symbol offsets (querying https://libc.rip).

It's possible to download and unstrip a matching libc binary from the command line.

* Fix Python 2 compatibility

* Remove main_arena heuristic

* Update CHANGELOG

Co-authored-by: Arusekk <[email protected]>
2022-04-20 16:35:36 +02:00
Heap Crash d9f9e7ca6f Add documentation on the rop.register=foo assignment option (#1924)
* Add documentation on the rop.register=foo assignment option

* Add looking up ROP gadgets by name as well, and manual ROP construction
2022-04-20 16:34:30 +02:00
Emanuel HauptandArusekk 9e55d8f4c8 Add badge packaging status badge (#2054)
* Add badge packaging status badge

Add a repology badge to show packaging status.

* Update README.md

Use shields.io everywhere

Co-authored-by: Arusekk <[email protected]>
2022-04-20 15:56:37 +02:00
Arusekk 97a760a0dd Merge branch 'beta' into dev 2022-04-20 15:47:08 +02:00
Arusekk f491bc6a22 Merge branch 'stable' into beta 2022-04-20 15:46:34 +02:00
Arusekk cde1b89615 Release 4.7.1 2022-04-20 15:37:20 +02:00
zup 17fc0aeaad fix double decoding of bytestring when logging (#2051) 2022-04-20 13:20:40 +00:00
maybe-sybr c93bdfeed8 fix: Fallback to temp dir if cache does not exist (#1784)
This fixes a misbehaviour in environments where `XDG_CACHE_DIR` is not
set and `~/.cache` does not exist, e.g. in the docker image. We simply
attempt to create a temporary directory which will be registered with
`atexit` to be deleted on exit using `shutil.rmtree()`. A Python 3
approach for future would be to use a `TemporaryDirectory` instead which
would get cleaned up when the held object gets dropped out of the TLS
stack.

It is still possible for the `context.cache_dir` to be `None` if the
default directory exists but is not writable, which means some code
which uses this property is liable to blow up in such a circumstance.
2022-04-20 12:09:41 +00:00
TestzeroandT3stzer0 4fd08b0b00 fix packing error (#2040)
Co-authored-by: T3stzer0 <[email protected]>
2022-04-20 12:00:35 +00:00
Spencer Pogorzelski 8dd566b9e9 Fix env command not found in gdb.debug (#2007) 2022-04-20 11:47:57 +00:00
Sebastiano MarianiandArusekk fca2929de0 Fix download_dir method when using an ssh tube (#1961)
Signed-off-by: Sebastiano Mariani <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2022-04-20 10:51:21 +00:00
lucasg d67bdbc550 [asm] pwn.disam can return <text+0x0> instead of <text> (#1912)
Unit test:

```
(pwntools_mips_bug) lucasg@home:/tmp/pwntools$ git show
commit 78c6b8c2a9 (HEAD -> dev, origin/dev, origin/HEAD)
Merge: e3a5ac58 d7139997
Author: heapcrash <[email protected]>
Date:   Mon May 31 16:06:34 2021 -0500

    Merge branch 'beta' into dev

(pwntools_mips_bug) lucasg@home:/tmp/pwntools$ python
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pwn, binascii
>>> print(pwn.disasm(binascii.unhexlify("000000000d0000000000000000"), vma=0x00000000, arch="mips"))
   0:   00000000        nop
   4:   0000000d        break
   8:   00000000        nop
        ...
>>> print(pwn.disasm(binascii.unhexlify("000000000d0000000000000000"), vma=0x80000000, arch="mips"))
[ERROR] Could not find .text in objdump output:

    /tmp/pwn-disasm-77tu42pr/step2:     file format elf32-tradlittlemips

    Disassembly of section .text:

    80000000 <.text+0x0>:
    80000000:   00000000        nop
    80000004:   0000000d        break
    80000008:   00000000        nop
        ...
[ERROR] An error occurred while disassembling:
    b'\x00\x00\x00\x00\r\x00\x00\x00\x00\x00\x00\x00\x00'
    Traceback (most recent call last):
      File "/tmp/pwntools/pwnlib/asm.py", line 814, in disasm
        log.error('Could not find .text in objdump output:\n%s' % output0)
      File "/tmp/pwntools/pwnlib/log.py", line 424, in error
        raise PwnlibException(message % args)
    pwnlib.exception.PwnlibException: Could not find .text in objdump output:

    /tmp/pwn-disasm-77tu42pr/step2:     file format elf32-tradlittlemips

    Disassembly of section .text:

    80000000 <.text+0x0>:
    80000000:   00000000        nop
    80000004:   0000000d        break
    80000008:   00000000        nop
        ...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/pwntools/pwnlib/context/__init__.py", line 1524, in setter
    return function(*a, **kw)
  File "/tmp/pwntools/pwnlib/asm.py", line 818, in disasm
    log.exception("An error occurred while disassembling:\n%s" % data)
  File "/tmp/pwntools/pwnlib/asm.py", line 814, in disasm
    log.error('Could not find .text in objdump output:\n%s' % output0)
  File "/tmp/pwntools/pwnlib/log.py", line 424, in error
    raise PwnlibException(message % args)
pwnlib.exception.PwnlibException: Could not find .text in objdump output:

/tmp/pwn-disasm-77tu42pr/step2:     file format elf32-tradlittlemips

Disassembly of section .text:

80000000 <.text+0x0>:
80000000:       00000000        nop
80000004:       0000000d        break
80000008:       00000000        nop
        ...
```
2022-04-20 10:25:58 +00:00
Alan YeeandArusekk c3894c24de Make ELF symbol dict accept bytes (#1973)
DynElf symbol lookup uses bytes as key

Fixes #1951

Co-authored-by: Arusekk <[email protected]>
2022-04-20 09:48:13 +00:00
Arusekk 208b11df69 Avoid name clash of plain and android-related test 2022-04-20 11:14:45 +02:00
Will 0a860bd964 Fix incorrect disasm output (#2031)
Use objdump --wide option to ensure we don't have new lines in large instructions (>7 bytes).
2022-04-20 08:58:08 +00:00
0x3c3e 15efc3f1dc Cast int target pid to str (#2012) 2022-04-20 08:24:06 +00:00
gogo2464 2d0f03b66c Update Sphinx in order to fix jinja2 deprecated dependency. (#2053) 2022-04-20 08:44:02 +02:00
Justin Steven d7e9d313a2 Fix hexdump docstring. s should by bytes. (#1982) 2022-04-20 00:27:25 +02:00
Roderick 7a246e7887 fix Gallopsled/pwntools#2044 (#2045)
Specify the distro name when pop up a debugging window in wsl
2022-04-20 00:16:10 +02:00
QuqqU c04dbdb9e9 Correct a return type in Docstring (#2055) 2022-04-19 23:25:45 +02:00
Arusekk fc372d17a2 rop: Improve density (#2048)
When the last gadget has no arguments and the gadget before has stack
arguments, put the last gadget directly in its return address slot
(instead of a stack adjustment gadget).
2022-04-19 23:25:23 +02:00
gogo2464 79986d8262 Update Sphinx in order to fix jinja2 deprecated dependency. (#2053) 2022-04-13 17:49:01 +02:00
tkmikan ef698d4562 change Buffer's parent class to object (#2035)
* change Buffer's parent class to object

* update CHANGELOG.md
2022-02-15 17:31:01 +01:00
Swapnadeep Som 1238fc359e Fix UPX packer identifier (#1947)
Fixes #1855
Closes #1947
2022-02-01 11:53:12 +01:00
Arusekk 79d150061c Merge branch 'beta' into dev 2022-02-01 11:09:35 +01:00
peace-maker 2198b74df9 Fix CI after Groovy Gorilla went away for libc unstrip test (#2025)
* Fix CI after Groovy Gorilla went away for libc unstrip test

Build elfutils 0.181 from source since we can't use builds
from a newer ubuntu version anymore.

* Install python wheels in CI
2022-02-01 11:07:39 +01:00
TomasGl bf37947a99 Use a more reliable way to split the KDE konsole (#2026)
* Use a more reliable way to split the KDE konsole

* Changed xml parsing to pure parsing

* Update CHANGELOG.md
2022-02-01 11:01:31 +01:00
peace-maker 1fe9b3e693 Fix ELF.libc_start_main_return with glibc 2.34 (#2027)
* Fix ELF.libc_start_main_return with glibc 2.34

The actual call to `main` was split out into a new `__libc_start_call_main` function in glibc 2.34.

Update the heuristic to find main's return address by looking into all direct calls in `__libc_start_main` until the old heuristic matches.

The other direct calls could be e.g. `atexit` which doesn't call `exit`.

* Update CHANGELOG.md
2022-01-31 18:41:42 +01:00
peace-maker 762591bf35 Fix CI after Groovy Gorilla went away for libc unstrip test (#2025)
* Fix CI after Groovy Gorilla went away for libc unstrip test

Build elfutils 0.181 from source since we can't use builds
from a newer ubuntu version anymore.

* Install python wheels in CI
2022-01-28 11:58:23 +01:00
TomasGl 04f401c70e Support KDE Konsole in run_in_new_terminal function (#2023)
* Support KDE Konsole in run_in_new_terminal function

* Rewrite '.stdout.read()' to '.communicate()[0]'
2022-01-26 00:07:20 +01:00
jammychiou1 84b51fc1a5 Update filepointer.py (#2022)
Fix typo in documentation: "defination" to "definition"
2022-01-23 22:37:58 +01:00
tkmikan 1573957cc8 fix tube's debug output of same byte compression (#2011)
* fix tube's debug output of same byte compression

* Update CHANGELOG.md

* move code to `log.maybe_hexdump`

* update doc string
2022-01-08 13:22:38 +01:00
Arusekk 038e50fa0c Replace reserved argument names in syscalls (#1998)
Just stick to the replaced names everywhere.
This actually only broke linkat(2) and symlinkat(2),
but it touches many len -> length renames as well
for the sake of consistency.
Fixes #1964
2022-01-04 11:05:08 +01:00
Disconnect3d 58d6aea217 Add arch alias: x86-64 -> amd64 (#1967)
While we have an alias for "x86_64" some software (like Pwndbg) uses the "x86-64" string.
2021-11-21 23:54:24 +01:00
Arusekk 4c78e188ce Begin working on 4.9.0 2021-11-15 12:49:32 +01:00
Arusekk 9d8060496c Release 4.8.0beta0 2021-11-15 12:44:33 +01:00
Arusekk 67b28491a4 Release 4.7.0 2021-11-15 12:36:25 +01:00
Arusekk 7ea1f1d492 Merge branch 'beta' into dev 2021-11-15 12:25:01 +01:00
Arusekk 1b86e89efb Fix CI failures (#1997)
Ubuntu, why are you doing this to us?
I seriously mean that Ubuntu is the most silly distro.

Like, they probably updated their docker (or VM) images last week,
then Github got it, and we started getting failures.
They totally changed the behaviour of that 'apport' thing,
and it now drops core files in /var/lib/apport/coredump
instead of the current working directory.

Why is that even... ugh.  Nevermind.  It works now, at least.
But for how long?
2021-11-15 12:22:25 +01:00
Arusekk 0c769bdba9 Add cat2 to shellcraft (#1995)
* Introduce shellcraft.linux.cat2 to avoid sendfile

Fixes #1871

* Switch CAT_PROC_MAPS_EXIT to shellcraft.linux.cat2
2021-11-15 12:22:12 +01:00
Arusekk e80a6978ec Fix CI failures (#1994)
* Try to fix build failures by updating sphinx

See sphinx-doc/sphinx#9811

* Does not work with py2, so pin old docutils
2021-11-15 12:22:00 +01:00
Arusekk da8bf2667d Fix CI failures (#1997)
Ubuntu, why are you doing this to us?
I seriously mean that Ubuntu is the most silly distro.

Like, they probably updated their docker (or VM) images last week,
then Github got it, and we started getting failures.
They totally changed the behaviour of that 'apport' thing,
and it now drops core files in /var/lib/apport/coredump
instead of the current working directory.

Why is that even... ugh.  Nevermind.  It works now, at least.
But for how long?
2021-11-15 12:14:18 +01:00
Arusekk a37bce2bdc Display nice error message on unavailable ret2csu (#1991)
Fixes #1941
2021-11-14 15:20:59 +01:00
Arusekk 3dd0b24cc3 Add cat2 to shellcraft (#1995)
* Introduce shellcraft.linux.cat2 to avoid sendfile

Fixes #1871

* Switch CAT_PROC_MAPS_EXIT to shellcraft.linux.cat2
2021-11-14 15:20:43 +01:00
Arusekk a8c8c28f00 Fix CI failures (#1994)
* Try to fix build failures by updating sphinx

See sphinx-doc/sphinx#9811

* Does not work with py2, so pin old docutils
2021-11-11 17:53:45 +01:00
Justin Steven 315a462603 Make cyclic_find work with large int values (#1981)
* Make cyclic_find work with large int values

* Add entry for cyclic_find() large int fix

* Tweak cyclic_find() large int warning
2021-11-11 14:59:05 +01:00
ElJeffeandArusekk ddeddd455e Fix: TypeError: can't concat str to bytes (#1953)
* Fix: TypeError: can't concat str to bytes

sh_string returns a string, but two lines try to concat it with bytes, which throws a TypeError.  Either convert them all to bytes or all to string.

* Update to use packing._need_bytes

I just followed the format from surrounding conversions.  Hopefully that works correctly.

* Update pwnlib/tubes/ssh.py

Co-authored-by: Arusekk <[email protected]>

* Conversion to bytes

* Going for higher level conversion

Co-authored-by: Arusekk <[email protected]>
2021-11-01 00:35:10 +01:00
Alan Yee d3140ed983 Using native features of built-in functions over built-in operations config.py (#1980)
Use lazy logging and use second argument of `.get()` instead of relying on `or`
2021-11-01 00:33:32 +01:00
Arusekk fc250a33a1 Add missing copyright notice to ARM alphanumeric (#1955)
Closes #1954
2021-10-07 09:33:34 +02:00
peace-makerandArusekk 92911cbabd libcdb: Load debug info and unstrip libc binary (#1828)
* libcdb: Load debug info and unstrip libc binary

The debug info is obtained from a debuginfod server maintained by systemtap.org. elfutils is used to unstrip the binary and merge the debug info back.

Try to unstrip every libc binary downloaded by the libcdb module by default. #1818

* Install elfutils on CI

* Update CHANGELOG.md

* Add more tests

* Fix negative test

* Raise an exception when eu-unstrip fails

This will hopefully get logged during doctests.

* Install elfutils 0.181 from groovy

Use APT Pinning to select the newer elfutils version from groovy instead of the buggy 0.176 version available in focal.

* Fix missing import of requests

pylint?

Co-authored-by: Arusekk <[email protected]>
2021-10-03 10:51:30 +02:00
Alan Yee a9715d8c74 Use lazy logging instead of native string interpolation (#1972)
https://docs.python.org/3/howto/logging.html#logging-variable-data
2021-10-01 07:48:57 +02:00
Darin Mao bd12d1874f Fix KB, MB, GB globals (#1926) 2021-07-29 19:17:17 +02:00
clubby789 11b8537d17 Fix validation of log level name for Python 3 (#1939)
* Fix validation of log level name for Python 3

* Add changelog

* Reorder changelog and use try/except
2021-07-29 19:16:36 +02:00
Connor NelsonandArusekk f7283bf2eb Fix logic in wait_for_debugger (#1922)
* Fix logic in `wait_for_debugger`

* Update CHANGELOG.md

* Fix CHANGELOG.md

* Fix CHANGELOG.md

Co-authored-by: Arusekk <[email protected]>
2021-07-15 11:42:42 +02:00
Arusekk d5d7b8385c Begin working on 4.8.0 2021-07-12 23:06:17 +02:00
Arusekk d8abd074df Release 4.7.0beta0 2021-07-12 23:04:23 +02:00
Arusekk 56d43680f1 Release 4.6.0 2021-07-12 23:00:40 +02:00
Arusekk 03df22a4c5 Fix MIPS PLT on newer Unicorn versions (#1932)
Apparently it is us who used unicorn The Wrong Way,
e.g. trying to fetch instructions @ 0xdbdbdbdb,
which is both unaligned and high-address-space.
Unicorn just changed the exception to throw exception with the address
of an offending jump instruction, instead of the incorrect address.
Making the debugs actually work and changing address to 0x7c7c7c7c
solves the issue.

Closes #1538
Ping pentoo/pentoo-overlay#734 @blshkv
2021-07-12 21:42:01 +02:00
Heap Crash bbdb5dbb23 Various docs improvements (#1925)
* Expose elf/* instead of just elf
* Remove rop/call, since it is not supposed to be a public API
* Make QEMU examples into code blocks
2021-06-27 20:34:03 +02:00
WittsEnd2 6b2cdbb74d Added basic support for bare-metal ARM by adding pattern for finding binutils. (#1921)
* Added basic support for bare-metal ARM by adding the pattern to find arm-none-eabi in which_binutils()

* Updated CHANGELOG.md
2021-06-22 11:26:41 +02:00
Arusekk 90930e2bb8 Unified args (#1896)
* Introduce _need_bytes(min_wrong=0x80) for ASCII-ok contexts

* Unify argv and env preparation

Fixes #1804

* Switch sh_prepare to bytes

Fixes #1808

* Python 2 again

* Actually fix py2
2021-06-19 11:14:11 +02:00
Paul 35260c4c31 Keep gadgets when setting registers via setattr/call (#1891)
* Keep gadgets when setting registers via setattr/call

* Update changelog
2021-06-18 19:59:41 -05:00
Sean 684f06b760 Check binutils version is GNU or Clang (#1915) 2021-06-13 13:16:31 +02:00
Arusekk 1e34fb4a4f Add basic support for RISC-V (#1897)
* Add basic support for RISC-V

Closes #1777

* Update CHANGELOG.md
2021-06-09 18:56:21 +02:00
Rhythm Chopra e2ec6d0381 Fix i386 xor encoder issue #1761 (#1767)
* Fix i386 encoder issue #1761

Don't encode `avoid` parameter in `fiddler.py` if type is `bytearray`

* Pass `avoid` as `bytes` instead of `set` when `encoder.encode()` is called

* Requested change: Increase readability

* Update doctest in XOR encoder

Add my failing testcase to ensure the code is fixed
2021-06-05 21:34:20 +02:00
heapcrash 78c6b8c2a9 Merge branch 'beta' into dev 2021-05-31 16:06:34 -05:00
heapcrash d7139997dd Merge branch 'stable' into beta 2021-05-31 15:55:40 -05:00
heapcrash 5b0bec0c09 [4.5.1] Update setup.py 2021-05-31 15:44:49 -05:00
Heap Crash e3a5ac5818 Dockerfile changes for quality-of-life with "make develop" (#1905)
* [docker:develop] Use zsh by default, enable sharing host history file

* [docker] Simplify makefile and break up develop command into second rule

* [docker:develop] Use zsh by default 2

* [docker:develop] Add ipdb, ipython, vim, and pwndbg

* [docker:buster] Add buster Dockerfile for testing #1899

* [docker:develop] Add pwn autocomplete

* [docker:develop] Add ipython configuration
2021-05-31 15:31:22 -05:00
Heap Crash 12af84f19f Defer import of requests and urllib (#1906)
* Defer import of requests and urllib

This saves 100ms-150ms of startup time on "from pwn import *"

* Update CHANGELOG

* More deferred imports to save ~20ms
2021-05-31 15:30:58 -05:00
Heap Crash 2d460e5738 [4.5.1] Update version.py (#1908) 2021-05-31 20:29:49 +00:00
Heap Crash dff64e2366 For tmux, always specify -F and -P (#1902)
* For tmux, always specify -F and -P

Fixes #1898

* [4.5.1] Update CHANGELOG
2021-05-31 15:20:35 -05:00
Heap Crash 0aa1a231c3 Add bash autocompletion (#1904)
* Add bash autocompletion

* Update CHANGELOG
2021-05-30 19:32:28 -05:00
Heap Crash d991c898ac Add zsh completion (#1903)
* Add zsh completion

* Update CHANGELOG
2021-05-30 19:28:05 -05:00
Heap Crash ca4eeaa196 [docker] Update base image to use UTF-8 and also install tmux (#1900) 2021-05-30 17:47:38 -05:00
Heap Crash ef37e991d8 Add documentation for ROP magic register properties and setRegisters (#1894)
* Show magic gadgets and setRegsiters in the top of the documentation

* Show the cool way to set registers magically, with fewer lines of code

* Try simple fix for doctest
2021-05-26 11:22:54 +02:00
Arusekk 9426df0095 Fix ELF error on vmlinux with version like 4.4.78+ 2021-05-26 11:15:10 +02:00
Heap Crash 29fd2fe1c1 Fix warning that bytes != string (#1893)
* Fix warning that bytes != string

* Update CHANGELOG
2021-05-17 09:32:02 -05:00
Heap Crash 3c85afdbf5 Silence SIGPIPE error for phd (#1892)
* Silence SIGPIPE error for phd

* Update CHANGELOG
2021-05-17 08:43:24 -05:00
Arusekk 7893e6124d Merge branch 'beta' into dev 2021-05-13 14:01:26 +02:00
Arusekk fcf008b4fd Merge branch 'stable' into beta 2021-05-13 14:01:07 +02:00
tirefire b2c83a7cd0 Change the regex for the rop verifier to handle 2 character registers (#1884)
* Change the regex for the rop verifier to handle 2 character registers as well

* Update changelog
2021-05-13 06:52:48 +00:00
Arusekk 2d1e0616a7 Update dietlibc headers and all that jazz (#1733)
* Update dietlibc headers

Closes #691

* Generated files

* Enable easy updating of syscall numbers

* Generated files

* Generate new syscalls

* Update CHANGELOG.md

* Workaround for py2

* Revert CGC deletion
2021-05-07 17:17:46 +02:00
Arusekk 6b25687454 Merge branch 'beta' into dev 2021-05-07 16:01:28 +02:00
Arusekk 882fd6a926 [testing] Google strikes back once again 2021-05-07 15:59:04 +02:00
Arusekk cdc36a8597 Merge branch 'beta' into dev 2021-05-07 10:46:31 +02:00
Arusekk f16cead9d7 [testing] Google strikes back 2021-05-07 10:46:01 +02:00
Arusekk d7e7ecce3f Merge branch 'stable' into beta 2021-05-07 10:39:35 +02:00
Arusekk 3914b212ae Get a sane CHANGELOG 2021-05-07 10:38:33 +02:00
Hunter GregalandArusekk 8af69b3261 add self.message and change sys.exc_type to sys.exec_info() in Pwnlib… (#1876)
* add self.message and change sys.exc_type to sys.exec_info() in PwnlibException class

* update changelog

* Update pwnlib/exception.py

tru

Co-authored-by: Arusekk <[email protected]>

Co-authored-by: Arusekk <[email protected]>
2021-05-07 10:26:51 +02:00
Hunter GregalandArusekk 21d1cd0519 encoders: support avoid == bytes in error message (#1877)
* encoders: support `avoid == bytes` in error message

* update changelog

* Update pwnlib/encoders/encoder.py

Co-authored-by: Arusekk <[email protected]>

Co-authored-by: Arusekk <[email protected]>
2021-05-07 10:23:46 +02:00
Arusekk c7119c7bc5 Merge branch 'beta' into dev 2021-04-30 18:14:53 +02:00
Arusekk 6780c890cd Update CHANGELOG.md 2021-04-30 18:14:36 +02:00
Arusekk 9241ea80f8 Begin working on 4.7.0 2021-04-30 18:13:20 +02:00
Arusekk bf023053fc Release 4.6.0beta0 2021-04-30 18:11:16 +02:00
Arusekk c8681de1ee Merge branch 'beta' into dev 2021-04-30 18:10:57 +02:00
Arusekk 34bcb02a3f Release 4.5.0 2021-04-30 18:09:40 +02:00
Arusekk 4b8cac5557 Fix tests 2021-04-30 18:09:14 +02:00
Saleem RashidandArusekk 8926425aed Add ignore_config argument to pwnlib.tubes.ssh and improve allow_agent implementation (#1566)
* ssh: Use paramiko allow_agent parameter

* ssh: Add ignore_config parameter to opt out of using ~/.ssh

* [changelog] Add `ignore_config` argument to `pwnlib.tubes.ssh` and improve `allow_agent` implementation (#1566)

Co-authored-by: Arusekk <[email protected]>
2021-04-29 19:20:14 +02:00
mephi42andArusekk e27209469e Fix process() with executable relative to cwd (#1751)
* Add PyCharm project directory to .gitignore

* Fix process() with executable relative to cwd

* Update CHANGELOG.md

Co-authored-by: Arusekk <[email protected]>
2021-04-29 19:13:22 +02:00
Heap CrashandArusekk 797c3ee178 [process] Add writemem with tests, alias readmem == leak (#1652)
* [process] Add writemem with tests, alias readmem == leak

* Update CHANGELOG

* Explicitly show result for easier debugging on CI

* Explicitly set arch to i386

* Troubleshooting and avoid overwriting top-level asm

* Update pwnlib/tubes/process.py

* Fix nasty race condition

Co-authored-by: Arusekk <[email protected]>
2021-04-29 19:10:21 +02:00
Arusekk e3bd4212de Respect context.bytes when counting ROP padding
Closes #1862
2021-04-29 16:26:27 +02:00
Heap CrashandArusekk a7b34f7d79 [android] Split Android AVD testing into its own Workflow (#1594)
* [android] Split Android AVD testing into its own Workflow

* [android] Modify to trigger tests

* [android] Make paths more succinct and explicit

* Remove environment variable

* Rename to test

* Always run Android jobs for debugging

* Enhance Android workflow

* Disable gdbserver download

* Make the workflow actually work

* Travis missing gdbserver

* Try to fix travis

* Add good ol' SIGALRM-based debugs for tests

* Revert changes made to Travis

* But fix GHA

* Actually enable the android tests

* Actually enable

* Not necessary anymore

* Actually run the tests with AVD installation

Also fix incorrect text-vs-bytes usages in protocols.adb.

Co-authored-by: Arusekk <[email protected]>
2021-04-29 15:56:18 +02:00
Arusekk 4b196c7d96 Cleanup unconditional imports (#1753)
* Cleanup unconditional imports

This may aid #1725

* Import explicitly

* Add good ol' SIGALRM-based debugs for tests

* Fix py2 GDB tests somehow

XXX: see why this matters

* Update CHANGELOG.md
2021-04-29 11:23:09 +02:00
Heap CrashandArusekk ad251a8285 Make gdb.attach work with arrays instead of string concatenation (#1846)
* Make gdb.attach work with arrays instead of string concatenation

This results in a simpler set of code that is more resilient to
issues with quoting and files with spaces in their name.

* Remove detach_and_quit for now, this was for Docker CI testing

* Fix typo

* Fix lint errors

* shlex.quote is unavailable on Python3

* Update CHANGELOG.md

* With no escaping comes no escaping

Co-authored-by: Arusekk <[email protected]>
2021-04-28 22:11:29 +02:00
ArusekkandCptGibbon 603e5ba0f1 Another attempt for rop.ret2csu (#1429)
* Add rop.ret2csu()

* Removed magic numbers

* Replaced if elf.sym.has_key(u'__libc_csu_init') with if u'__libc_csu_init' in elf.symbols

* Consistently used unicode strings to search for symbols

* Used the Capstone SKIPDATA option to deal with endbr64 instructions

* Added comment to clarify why we set rbp and rbx

* Account for newer versions of gcc populating registers in a different order

* Code style issues

* Add padding functionality

* Split files and add tests at last

* Implement flat interface in ROP

* Make linters happy

* Update changelog

* Add a more detailed doctest

* Actually set uid and hopefully solve all the corefile problems

* Show me the bug

* More verbosity

BTW fix py3 sockets incosistency

* The most debug

* Should finally work

* It must work now

Co-authored-by: CptGibbon <[email protected]>
2021-04-28 22:10:46 +02:00
Heap CrashandArusekk cb24f376ce Prefer Python3 for the remotely-executed Python script (#1746)
* Prefer Python3 for the remotely-executed Python script

This should be done as part of our general transition to Python3,
but should also be done because some systems with e.g. Python2.6
do not support OrderedDict, but DO have a Python3 version that works.

* Make the script actually work in py2 and py3

* Fix & update CHANGELOG.md

This actually is a behavior change, and can be a breaking change for some,
so must be stated prominently in the changelog.

Co-authored-by: Arusekk <[email protected]>
2021-04-28 22:00:53 +02:00
Arusekk f3b08ed289 Merge branch 'beta' into dev 2021-04-19 10:21:02 +02:00
Arusekk 21da0e1c46 Release 4.5.0beta1 2021-04-19 10:06:31 +02:00
clubby789 9e9531ff0d Fix atexit on Python 3 (#1852)
* Fix atexit on Python 3

`sys.exitfunc` was removed in Python 3, meaning that any handlers
registered with the `pwnlib/atexit.py` module wouldn't run. This PR
reigsters the handlers with the stdlib atexit.

* Update changelog
2021-04-19 07:56:26 +00:00
Arusekk 835bc6ad56 Address code review from #1861 (#1866)
* Address code review from #1861

Review by @heapcrash

* Fix regression
2021-04-19 09:06:46 +02:00
Robert ReithandArusekk 2b71971821 fixed wrong description for shellcraft.amd64.linux.kill()... (#1739)
* fixed wrong description for shellcraft.amd64.linux.kill(). new desciption copied from pwntools/pwnlib/shellcraft/templates/common/linux/syscalls/kill.asm

* updated changelog with PR #1739

* Fix more syscalls and generify

Co-authored-by: Arusekk <[email protected]>
2021-04-15 13:01:35 +02:00
084890f739 mips: do not use $t0 temporary variable in dupio (#1776)
* mips: do not use $t0 temporary variable in dupio

dupio currently uses $t0 which is a temporary callee saved register.
The dup2 call is thus allowed to trash the register.
Use $v0 instead. $v0 is the return value register.
Either dup2 returns the provided $v0 (newfd) or -1 if it fails,
and therefore $v0 can be used safely here.

Reference:
 https://courses.cs.washington.edu/courses/cse410/09sp/examples/MIPSCallingConventionsSummary.pdf

* Update changelog

* Update dupio.asm

Make a small change to kick Github Actions

* Fix CHANGELOG

Co-authored-by: Heap Crash <[email protected]>
Co-authored-by: Arusekk <[email protected]>
2021-04-15 12:05:25 +02:00
Arusekk 3121f68e39 Try to catch more errors by using python -bb (#1861)
* Try to catch more errors by using python -bb

* Apply changes to travis dockerfiles as well

* Introduce context._need_bytes and context._need_text

...and resolve many issues
2021-04-15 12:04:56 +02:00
martinclauss 9066a68879 fix #1803 and #1860 (#1864)
* fix #1803 and #1860

* bring back Python2 shebang and imports
2021-04-15 12:03:20 +02:00
Arusekk 7e03bfd5a6 Fix unreliable doctest 2021-04-09 18:19:37 +02:00
Arusekk cf7ee859c9 Prevent CHANGELOG checks on non-code changes 2021-04-09 18:18:01 +02:00
Arusekk 7ececc6bce Support forking terminals (#1717)
* Support forking terminals

Closes #1677

* Update proc.py
2021-04-09 17:52:41 +02:00
Arusekk b3fe1eb6ed Enhance x86 bitsmode-switching templates (#1756) 2021-04-09 16:38:10 +02:00
Heap Crash 5d54e0d66d Work around bash complaining about setlocale on some servers (#1745)
Fixes #1744
2021-04-09 16:15:26 +02:00
Arusekk 3e0e0a5833 Merge branch 'beta' into dev 2021-03-31 23:10:34 +02:00
Arusekk 3d5ca378ec No more failing UI tests! (#1857)
* Better debug for UI tests

* No more failing UI tests!
2021-03-31 21:01:46 +00:00
Arusekk c6fd41b733 Begin working on 4.6.0 2021-03-29 12:02:45 +02:00
Arusekk faba1351fc Release 4.5.0beta0 2021-03-29 12:01:20 +02:00
Arusekk d07a86d556 Release 4.4.0 2021-03-29 11:49:32 +02:00
WGHandHeap Crash ec9dfe108b Support XDG_CONFIG_HOME dir for pwn.conf (#1827)
~/.pwn.conf support is not removed.

Co-authored-by: Heap Crash <[email protected]>
2021-03-07 20:48:38 -06:00
Heap Crash d20ceacd7b Fix typo (#1844) 2021-03-05 16:53:46 -05:00
Heap Crash 3bfb3ff135 Add colored_traceback for colorized exception tracebacks (#1841)
* Add colored_traceback for colorized exception tracebacks

* Add CHANGELOG
2021-03-05 16:13:22 -05:00
Heap Crash 2114708210 [ssh] Apparently this is broken? (#1842)
/bin/sh seems to be sending the cd command to the background, instead of
changing directories and then running the selected command.

This has worked forever, not sure why it's failing in CI now
2021-03-05 00:29:39 -05:00
Heap Crash e8c03edebf Add Pwnlib IO (#1833)
* [io] Introduce first draft of IO module

This is designed to make it easier to do file management when a piece of code
has to deal with creating a file that might need to be local, OR might need
to reside on some SSH server somewhere.

Specifically, the GDB code needs this for future enhancements

* [docs] Add documentation and doctests

* Update CHANGELOG

* Add pathlib2 requirement for Python2

* Use Python3 documentation

* Remove pwnlib.io module

* [filesystem] Add filesystem module, with Path and SSHPath

* Use @classmethod monkey patching instead of subclassing

This means that isinstance(Path, ssh_path_instance) returns True

* Make doctests work again

* Remove debugging code

* Rename context.ssh to context.ssh_session

This is needed because @LocalContext will pop off 'ssh' and some functions
take 'ssh' as an argument, and it would all break.

* [debug] Try to figure out why CI is failing

* [ssh] Fix failing doctest

* Fix README

* Fix README

* Fix failing doctest harder

* Remove unneeded internal file
2021-03-04 22:51:15 -05:00
Heap Crash 216d24875d [run_in_new_terminal] Create a wrapper script automatically if we are given a list or tuple (#1839)
* [run_in_new_terminal] Create a wrapper script automatically if we are given a list or tuple

* Update CHANGELOG
2021-03-03 16:20:27 -05:00
Heap Crash e8979928d6 Clean up some GDB doctests (#1834) 2021-02-28 22:53:45 -05:00
Heap Crash efce48cddf [gdb] Add a timeout to GDB faketerminal operations (#1836) 2021-02-28 22:47:04 -05:00
Heap Crash 19cf23b3ac [ssh] Add instructions for removing host key from known_hosts (#1770)
* [ssh] Add instructions for removing host key from known_hosts

* Fix hostname
2021-02-28 21:35:36 -05:00
Heap Crash d98d82d664 [ssh] Minor enhancements (#1831)
- ssh.runner() now accepts mixed bytes and strings, by forcing everything to a string
- ssh.runner() now takes e.g. log_level='debug' as a kwarg
- Simplify ">/dev/null 2>&1" into "&>/dev/null"
2021-02-28 21:10:57 -05:00
Heap Crash 639be2dc82 Add more doctests for context module around handling verbosity (#1832)
* [docs] Add docs and tests for context.quietfunc

* [docs] Add more doctests for context.quiet and context.verbose

* [docs] Fix doctests
2021-02-28 20:52:39 -05:00
XeonacidandHeap Crash 082de2cc7e Remove unnecessary pwn.toplevel.__all__ (#1811)
* Remove unnecessary pwn.toplevel.__all__

The default behavior of `from import *` is enough and better, to make Pylance work
fix #1810

* Update CHANGELOG.md

* Add a comment for removed pwn.toplevel.__all__

Co-authored-by: Heap Crash <[email protected]>
2021-02-27 00:55:47 -05:00
Heap Crash 95200fc351 Add DOCKER.md (#1802)
* Add DOCKER.md

* Add note about VS Code
2021-02-26 17:07:21 -05:00
Heap Crash b2274da946 [logging] Disable logging the calculated PLT entries of every loaded ELF object (#1817)
In the future, we can revisit this with something like a log.trace that doesnt show up with DEBUG
2021-02-26 17:06:39 -05:00
Heap Crash 5ff4375c7b [travis] Switch to a different server that still has the magic gdbserver, make RPyC tests work (#1825)
* [travis] Switch to a different server that still has the magic gdbserver

* [travis] Install rpyc using pwndbg's method for finding the GDB-built Python

* [travis] Forgot pip dropped support for Python 3.5

* [gdb] Rewrite timeout logic for GDB API and fix doctests to use "skipif"

* [gdb] I'm not sure how this GDB API stuff ever worked in the first place

But it works now, at least locally

* [gdb] Fix broken doctests

* Update timeout to 10 seconds
2021-02-26 17:06:22 -05:00
Heap CrashandArusekk 2f094b74e5 [corefile] Fix some broken tests, add several more (#1823)
* [corefile] Fix some broken tests, add several more

Notably, some were outright incorrect (corefile.libc for a statically-linked ELF)

Also fixed up some of the documentation to add more links, and added examples
of reading / writing / saving / reloading a corefile.

* [corefile] Some fixes for things but also some canaries for finding out what is happening on GHA

* [testing] More canaries to pull files down from GHA

* That was a bad idea

* Fix implementation bug in Corefile.exe

Basically we returned the segment that contained the entry point,
but need to return the first segment which shares the same filename

We also no longer handle the case where the mapping is anonymous
and set the name to AT_EXECFN.  This probably breaks some QEMU stuff.

* Yep, the code used AT_EXECFN for the QEMU case

For an ARM corefile generated by qemu-user, the mappings are:

In [10]: print(core.maps)
10000000-10001000 r-xp 1000
ff7ef000-ff7f0000 ---p 1000
ff7f0000-ffff0000 rw-p 800000 [stack]

So we need to pull the name out of AT_EXECFN

* [core] Eagerly fetch self.exe so that the Mapping always has the right name

This means that Corefile.maps and Corefile.mappings will be updated for the single mapping
that contains the AT_ENTRY

* Attempt to debug getenv failure

* Fix some temporary edits and broken tests

* [ssh] Lets try and see if this works

* Remove unnecessary test and disable diagnostic logging

* [misc] Refactor kill_at_exit code for simplicity

Also catch the OSError from when the process has already died, which
was showing up at the end of CI runs

* Remove debug print

* Hail mary debugging attempt

* Try workaround that manually sets SHELL, since it may not be set on GHA

* [corefile] Remove debugging code, and consume setdefault result

* [corefile] Hide the bash-static fuckery in the RST file setup

* Update docs/source/elf/corefile.rst

Co-authored-by: Arusekk <[email protected]>

* Update pwnlib/elf/corefile.py

Co-authored-by: Arusekk <[email protected]>

Co-authored-by: Arusekk <[email protected]>
2021-02-25 17:11:31 -05:00
Heap Crash 8f8adf7b71 Enable PWNLIB_COLOR=always environment variable (#1816)
This allows piping with color into tools like ansifilter, which take
ANSI-escape-coded colorized text and emits data in other formats,
notably HTML.

This is useful for writing blog posts with PWNLIB_DEBUG=1 to display
hex-dumped data written to stdout that would not normally be colorized.

Currently this ONLY works for the environment variable PWNLIB_COLOR,
and does not make use of pwnlib.args due to cyclic imports.
2021-02-25 20:29:37 +01:00
Heap Crash cc4210041b [docs] Use older sphinx that doesnt cause recursion errors (#1821)
Per these resources:
* https://github.com/sphinx-doc/sphinx/issues/8119
* https://github.com/sphinx-doc/sphinx/pull/8125

Sphinx 3.4.0 now handles autodoc-skip-member differently, causing us to run
some tests multiple times due to imported code getting tested.
2021-02-25 10:58:44 -05:00
Heap Crash 93316b724d [ci] Disable Android and ADB protocol tests for Dockerfile-based CI (#1822)
These modules are deprecated, so we don't test them anymore, and
the Docker image does not perform any setup to install an Android
SDK or AVD.
2021-02-25 07:18:19 -05:00
Heap Crash 8a6383a55d Refactor dockerfiles for simplicity (#1786)
* Remove likely-unused Dockerfiles, which are not being supported in the future anyway

This leaves base, stable, beta, and dev as the only Dockerfile images

Simplify extra/Docker so that Pwntools is already checked out, and build precedence works

* Base image always gets built first
* Branch-tracking Dockerfiles now require base to be built
* Use locally-checked-out-repo instead of e.g. git+https://github.com/Gallopsled/pwntools@beta
* Install tested with both Python2 and Python3
* Add Python3 user-script directory to $PATH

Update CHANGELOG with Docker changes

Add develop to Makefile, restore old Dockerfiles

Make development target separate, and automatically launch "docker run -it" with suggested arguments

Add develop Dockerfile

* Add README for the Dockerfiles

* Merge dependencies, add NOPASSWD, use hostname localhost to avoid sudo errors

* Better Dockerfile for testing, working on making all of the tests work

* wip

* WORK-IN-PROGRESS

* Remove from pwn import *

* Fix incorrect usage of progress() in SSH

* WIPWIPWIP

* MORE WIP

* [srop] Fix SROP unit tests by allocating enough stack

* [todo] Test canary in MIPS pushstr to make sure tests are actually being run

* [ROP] Make ROP doctests work from Docker and more minimal

* [srop] Simplify SROP imports

* [mips] Simplify MIPS doctest imports

* [corefile] Handle race condition against kernel / qemu

* [web] Handle file permission failure in Docker

* [core] Actually implement timeout

* Revert "[corefile] Handle race condition against kernel / qemu"

This reverts commit e02a3dce19.

* [context] Handle file permission issue in Docker

* [aarch64] Just run the shellcode, dont dump it out

* [tests] Remove test canary from mips pushstr

* [timeout] Use ELLIPSIS for time-flaky tests

* [update] Remove DONT_CHECK_FOR_UPDATES

* [context] Handle another path access error in Docker

* [timeout] Just leave it the way it was, hardly ever fails

* [context] Fix broken test because of quotes

* WIP save Docker stuff just in case

* [mips] Do not replace "asm" in the global scope with doctest

* Clear context between invocations so we dont end up with e.g. 64-bit i386

* [process] Fix timeout to actually work

* [mips] Do not replace "asm" in the global scope with doctest (Part 2)

* [rop] Fix ROP doctests

* [mips] Do not replace "asm" in the global scope with doctest (Part 3)

* Re-add all of the Py2OutputChecker stuff so I can start testing Python2

* Restore libcdb checks

* Tests work on Python2 now with "make -C travis/docker doctest2"

* Handle issue caught by Pylint

* Install pwndbg for the pwntools user

* Add trailing newline

* Remove un-necessary ELLIPSIS

* Add trailing newline

* Convert assert to simple statement

* This is an empty commit for testing webhook integrations

* [travis] Use bash as the default shell

* Commit compiled Dockerfile for use on hub.docker.com

* [gdb] Restore gdb.rst and manually disable doctests from inside Docker container
2021-02-25 11:34:56 +01:00
Heap Crash aa7b6f77a5 Add description= to subcommand parsers (#1814)
The help= does not show up in docs.pwntools.com, but description= does.
2021-02-24 04:16:42 -05:00
heapcrash a3870d3ede Fix typo in docs 2021-02-23 22:32:19 -05:00
heapcrash f716b4e9ff Need to reclaim a Cloudflare page rule, just use the real link 2021-02-23 22:04:06 -05:00
Heap Crash 559543984f Update installation instructions (#1813)
* Note newer Ubuntu versions
* State preference for Python3
* Provide working instructions for Python2 installation due to pip deprecation
* Provide information on command-line tools not being in $PATH
2021-02-23 21:22:45 -05:00
Xeonacid 3acbd0596b Fix feat_req issue template typo (#1809) 2021-02-19 10:19:13 +01:00
heapcrash 4e6ccb0da1 Make Discord invite link consistent and permanent 2021-02-16 23:15:24 -06:00
Arusekk 15f85de4d8 Add links to README (#1798)
* a Discord invite link from Discord #online badge
* a link to relevant GH Actions from GHA status badge
2021-02-16 21:18:27 +01:00
Heap Crash 3b909651aa [android] Skip all Android tests (#1791)
* [android] Skip all Android tests

* Update README to indicate Android tests are no longer supported

* Remove Android AVD setup from GHA setup
2021-02-15 00:43:21 -06:00
Heap Crash 7cc55d039d Add Discord badge (#1796) 2021-02-14 23:57:28 -06:00
Heap Crash c978ad0668 Fix test to use ellipsis, since which() may not return /bin/sh (#1795)
* Fix test to use ellipsis, since which() may not return /bin/sh

* Fix another case where /bin/true may not be used given $PATH

* Fix another absolute path failure in doctests

* Fix another issue where /usr/bin may intercede
2021-02-14 23:40:38 -06:00
Heap Crash 08a96ff859 Fix unreliable test (#1794)
Updated or alternative versions of binutils cannot be relied upon to create
very small versions of ELFs (e.g. when running on macos).

However, we can ensure that the non-symbolized version is SMALLER.
2021-02-14 23:01:33 -06:00
Heap Crash 4cf71b4593 Pin autoprogram to v0.1.5 which supports Python2 (#1793) 2021-02-14 22:14:43 -06:00
Heap Crash ea1301806d Add link to discord server (#1790) 2021-02-14 18:39:00 -06:00
Heap Crash 2086a31954 Re-add Python2 to the various Dockerfiles (#1780)
* Re-add Python2 to the various Dockerfiles

This fixes #1774

* Update CHANGELOG
2021-02-02 06:05:29 -06:00
heapcrash 747d30a3a6 Empty commit to force Docker Hub to rebuild images 2021-01-16 18:03:53 -06:00
Heap Crash 4c390c04d6 [docker] It looks like the symlink was breaking the "base" build, so replace it with the actual file from the Xenial subdirectory (#1768)
Fixes regression introduced in ddf5cdc
2021-01-16 17:39:33 -06:00
152334H 153b35ba68 Remove eval from cli (#1758)
* Remove eval from cli

* fix changelog

* shut up pylint
2021-01-10 16:25:58 +01:00
152334H 2f4c5cbf48 update cache directories (#1757)
* update cache directories

* changelog
2021-01-05 12:46:39 +01:00
Arusekk fd280b266b Fix ROP call miscalculating offsets (#1755) 2021-01-05 12:44:32 +01:00
Tim Gates 281b64bb96 docs: fix simple typo, inforation -> information (#1750)
There is a small typo in pwnlib/elf/corefile.py.

Should read `information` rather than `inforation`.
2020-12-29 11:27:34 +01:00
Andreas Oberritter af80848208 Add baremetal os (#1742)
* Add baremetal os

This allows to run and debug a raw binary, e.g. an MBR, with
the help of qemu-system-$(arch).

Tested with:
pwn.context.arch = "i386"
pwn.context.os = "baremetal"
pwn.gdb.debug(["./mbr.bin"])

* Add changelog entry for 'baremetal' os
2020-12-23 23:32:59 +01:00
naweissandArusekk 9de743810e Add PATH argument to which function (#1738)
* Add PATH argument to which function

* [changelog] Add info on the path argument for which

* Move comment back to original location

* Sort CHANGELOG.md

Co-authored-by: Arusekk <[email protected]>

Co-authored-by: Arusekk <[email protected]>
2020-12-07 20:28:13 +01:00
Arusekk f4237d9b7d Minimal fix in encoders (#1736)
This must have been somehow overlooked before.
2020-12-07 17:06:23 +01:00
Arusekk 52ba4b8a17 Add cpython 3.9 constant opcodes to safeeval (#1735)
* Add cpython 3.9 constant opcodes to safeeval

Closes #1734

* Update CHANGELOG.md
2020-12-07 17:06:06 +01:00
Atte Niemi db8df476b2 Fix typo in pwnlib.util.fiddling.bits docstring (#1730) 2020-11-30 01:06:22 +01:00
Arusekk d796cc7dc0 Fix DynELF issues mentioned by @zachriggle in #1426 (#1719)
https://github.com/Gallopsled/pwntools/pull/1426#discussion_r517086024
2020-11-30 01:05:00 +01:00
Jakub Nowak 679463220f Remove unused import from toplevel (#1731)
`debug` is overwritten by line 82 — `debug   = log.debug`.
2020-11-30 01:04:30 +01:00
Arusekk 145b606a06 Merge branch 'beta' into dev 2020-11-30 00:29:52 +01:00
Arusekk b76d045a40 Release 4.4.0beta1 2020-11-30 00:27:41 +01:00
Arusekk 957a5a5835 Release 4.3.1 2020-11-30 00:26:51 +01:00
Arusekk 2efb5a0a73 Merge branch 'issue-1427' into stable 2020-11-30 00:25:25 +01:00
Arusekk 442fedeef0 Auto-generated files 2020-11-30 00:24:01 +01:00
Arusekk 138188eb1c Fix pwntools shellcraft SSTI vulnerability
This looks like the first major pwntools vuln!
And it even got its own task on Hitcon CTF 2020.

Fixes #1427
2020-11-30 00:23:49 +01:00
Arusekk 5dfcb53964 Apparently python 2 does not have lru_cache. 2020-11-29 14:04:24 +01:00
mephi42andArusekk d466fa9017 Allow using GDB Python API (#1617) (#1695)
Co-authored-by: Arusekk <[email protected]>
2020-11-16 20:43:20 +01:00
Arusekk 0b1f430935 Fix #1261 regression
There is no such thing as rwb in py3 apparently
2020-11-03 23:49:05 +01:00
Ricky ZhouandArusekk 9e76e50c9a Misc run_in_new_terminal improvements. (#1261)
* run_in_new_terminal: Prefer tmux/screen over TERM_PROGRAM and x-terminal-emulator.

* run_in_new_terminal: Kill running commands when the main process exits.

Currently, when a gdb window is opened via gdb.debug(), terminating the
main pwntools process leaves the gdb window/process around. It is
inconvenient to have to close these leftover gdb windows when iterating
on an exploit.

Add a kill_at_exit parameter to run_in_new_terminal() which attempts to
terminate the command at main process exit.

This only works for terminals which do not daemonize, or for tmux, which
supports returning the command's PID.

This change also removes the special case for closing
stdin/stdout/stderr on Mac OS X, as the problem no longer reproduces
under tmux 2.8.

* Fix regression and add CHANGELOG

Co-authored-by: Arusekk <[email protected]>
2020-11-01 20:02:58 +01:00
Arusekk 42b060e48a Improve tubes.ssh test coverage, fix discovered issues (#1711)
* Improve tubes.ssh test coverage, fix discovered issues

* Fix test under py2
2020-11-01 12:46:00 +01:00
Arusekk d98e60e4e5 Revert "alternative to PR #563; this works by simply never emitting CR" (#1716)
This reverts commit 08c8c2e8e4.

Closes #1653
2020-11-01 12:27:16 +01:00
Arusekk 4572f8711a Extend shellcraft forbidden names (#1715)
Closes #1664
2020-10-31 21:51:38 +01:00
Arusekk b6bb1ea17e Don't introduce null bytes in MIPS shellcode. (#1710)
* Don't introduce null bytes in MIPS shellcode.

As a verification, you can run:

```sh
pwn shellcraft mips.linux.sh |pwn phd
```

Closes #807

* Add a test

* Fix doctest under py2
2020-10-28 12:33:25 +01:00
Arusekk 681be1284c Apparently python 2 does not have lru_cache. 2020-10-27 10:09:30 +01:00
Arusekk 40b01582b8 Use caching to avoid being hit by rate limiting
Closes #1708
2020-10-27 09:18:07 +01:00
Arusekk 031b3cbadf Fix races in server tube from #1067 and apply #1569 (#1707) 2020-10-26 22:57:14 +01:00
peace-makerandArusekk 545f8dddd4 Try libc.rip for libc lookup (#1704)
* Try libc.rip for libc lookup

As of #1171 the libcdb repository isn't seeing any updates anymore. When looking up a libc by a hash or build_id try the libc database maintained by @niklasb as well.

The database uses a REST api documented at https://github.com/niklasb/libc-database/blob/master/searchengine/api.yml

* Catch exceptions properly

* Update CHANGELOG

* Add doctests

Co-authored-by: Arusekk <[email protected]>
2020-10-24 13:53:50 +02:00
Allen GuanandArusekk 7aa22dd6f5 Remove data_files (#1643)
Co-authored-by: Arusekk <[email protected]>
2020-10-20 18:17:29 +02:00
Arusekk 447aa551f6 Begin working on 4.5.0 2020-10-20 17:57:56 +02:00
Arusekk e004aa6566 Release 4.4.0beta0 2020-10-20 17:44:56 +02:00
Arusekk 5db149adc2 Release 4.3.0 2020-10-20 17:39:40 +02:00
Arusekk 23f5075d93 Merge branch 'beta' into dev 2020-10-20 17:12:12 +02:00
Arusekk ddb5798b8c Merge branch 'stable' into beta 2020-10-20 15:53:07 +02:00
Arusekk f1624dc8ac Release 4.2.2 2020-10-20 15:21:59 +02:00
Arusekk a824e83bcb Only require changelog if major changes present 2020-10-20 14:57:36 +02:00
Arusekk dff2e807cd Fix udp socket server AttributeError (#1706)
Closes #1690
2020-10-20 14:29:54 +02:00
Arusekk b8ca473a39 Use descriptive workflow names 2020-10-20 12:17:58 +02:00
peace-maker cde51065bf Update libcdb buildid offsets (#1703)
* Update libcdb buildid offsets

Recent libcs from Debian and Ubuntu have different offsets for the build id.

* Update CHANGELOG
2020-10-20 11:52:33 +02:00
lucasgandArusekk 09541e042b [elf.py] convert linux string banner into an actual str (#1700)
* [elf.py] convert linux string banner into an actual str 

``self.string(address)`` actually return a bytes object containing the raw bytes, not a string in a pythonesque sense !
Since quite some time on Python3, ``re.search`` only works on proper str so we need to convert it before feeding it to ``re.search``

``.decode()`` works both on Python2 and Python3

* Update kernel ELF handling

Co-authored-by: Arusekk <[email protected]>
2020-10-17 16:10:22 +02:00
Heap CrashandArusekk e47c65c6fc Implement property getter/setter for context.newline, and make tubes honor it (#1541)
* Implement property getter/setter for context.newline, and make tubes honor it

The default newline can now be set context-wide, or per-tube.

* [changelog] Update for 1541

* [docs] Use r-prefix for embedded newlines

Co-authored-by: Arusekk <[email protected]>
2020-10-14 01:08:37 +02:00
Kyle ZengandArusekk d6859eb744 FmtStr module enhancement (#1696)
* use non-greedy operator to handle corner cases where the program output contains END in it

* END can appear in the string leak

Co-authored-by: Arusekk <[email protected]>

Co-authored-by: Arusekk <[email protected]>
2020-10-13 22:33:50 +02:00
Aapo SaaristoandArusekk 79cd784383 Place ROP cache in user's homedir like "regular" cache (#1453)
* Keep ROP cache in user's home like regular cache

I don't have statistics numbers on which would be more likely to be writable, an user's home directory or the OS's temp directory, but seems to me it'd make sense to try and write all caches to the same location.

Optimally this would be easily configurable to allow adjusting to different set-ups, obviously.

* Use cache_dir instead

Co-authored-by: Arusekk <[email protected]>
2020-10-13 19:51:28 +02:00
James O'NealandJames O'Neal dd92ca6c61 Fix broken shellcraft linux templates (#1699)
* fixing broken linux templates

* adding change to changelog

Co-authored-by: James O'Neal <[email protected]>
2020-10-13 14:13:21 +02:00
Mariusz SkoneczkoandArusekk 1c0ca55627 Actually import requests when doing from pwn import * (#1687)
* Actually import `requests` when doing `from pwn import *`

As per documentation, we claim to be importing `requests` globally
(https://github.com/Gallopsled/pwntools/blame/dev/docs/source/globals.rst#L100)

We should actually do this :)

* Update CHANGELOG

Co-authored-by: Arusekk <[email protected]>
2020-10-05 12:49:16 +02:00
Mariusz Skoneczko 1d6aa2e276 Remove python2 shebangs where appropriate (#1692)
* Remove python2 shebangs where appropriate

* Update CHANGELOG.md
2020-10-05 12:32:02 +02:00
Ron a0b3b24984 Fix documentation of #1667 (#1693)
* add parameter max_subs to __init__

(cherry picked from commit d331be51d3bdb791d5d19d9d9b8d60706dddf5fa)

* Beautify doc string

(cherry picked from commit ceebf47a956073eee43efe0a5f6e9399e6a1ec65)

* Fix some typos

(cherry picked from commit 6bbbdcedf4c8ae075c30d01d447c372925f0a29d)

* Update CHANGELOG.md

* Revert changelog

https://github.com/Gallopsled/pwntools/pull/1693#discussion_r499236894

* Trigger CI
2020-10-05 11:08:53 +02:00
Arusekk 26ccb97f63 Speak as simple as it can be (#1694)
Fixes #1434
2020-10-04 22:42:59 +02:00
Arusekk 23ac852023 Make bruteforcewrap picklable (#1685)
Closes #1665
2020-10-01 20:08:51 +02:00
Mariusz SkoneczkoandArusekk bcb6e066aa Add __setattr__ and __call__ interfaces to ROP for setting registers (closes #1636) (#1688)
* Implement ROP.__call__ shorthand for setting registers

* Fix broken doctests by ensuring they set context.arch

* Implement ROP.__setattr__ shorthand for setting registers

* Update CHANGELOG.md

Co-authored-by: Arusekk <[email protected]>
2020-10-01 20:07:45 +02:00
152334H 2a5aac1101 ROPGadget multibr hotfix (#1682)
* fix --multibr issue

* modify changelong

* In which I learn how to count

* put doctest for ROP().syscall in unfortunate place

* fix context malapropism
2020-10-01 19:50:44 +02:00
Teddy Heinen 5e279e7993 fix #1684 (ROP gadget loading fails when it matches "add esp, esi") (#1686)
* fix ROP gadget loading when binary contains a gadget with add rsp, <register>

* add documentation regarding the fact that loading gadget "add $sp, <reg>" will fail
2020-09-27 11:55:39 +02:00
RonandArusekk dc8d0e310c I386 ascii shellcode (#1667)
* Add module ascii_shellcode

* Add doctests

* Make the ascii_shellcode module accessible from pwn star import

* Remove unused imports

* Update docstr

* Update CHANGELOG.md

* Also test private functions

* Undo accidental modification of CHANGELOG.md

* Fix python 2

* Fix python 2 doctests

* Use bytes object in doctests instead of converting from/to hex strings

* Add doctest to shellcraft>asciify>run shellcode

* Move to pwnlib.encoders.i386

* Fix python 2

* Apply some of the suggestions from Arusekk's code review

Co-authored-by: Arusekk <[email protected]>

* Fix some broken code from the suggestions

https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491699166
https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491700154
https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491700397

* Beautify code by using bytearrays everywhere

https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491698062
https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491701007
https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491700313
https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491700853
https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491698916
https://github.com/Gallopsled/pwntools/pull/1667#discussion_r491699243

* Fix python2 doctests

Forgot to update a few doctests to use bytearrays instead of bytes

* Try to improve test coverage

Test correctness of avoid parameter processing

* Remove unused imports

Co-authored-by: Arusekk <[email protected]>
2020-09-26 10:59:21 +02:00
152334H 72ca730f4b ROPGadget multibr (#1678)
* ROPGadget multibr

* Update CHANGELOG.md

* Fix docstrings to match
2020-09-19 16:09:05 +02:00
Jan Mazur 6b7c3d99c4 Gdbserver now correctly accepts multiple libraries in LD_PRELOAD and LD_LIBRARY_PATH (#1675)
* Gdbserver now correctly accepts multiple libraries in LD_PRELOAD and
LD_LIBRARY_PATH.

* modify changelog
2020-09-17 19:23:02 +02:00
152334H 4dec08b4bd ROP: add base= argument for .chain() and .dump() (#1673)
* Allow using specific base for ROP.chain() and ROP.dump()

* Update CHANGELOG.md
2020-09-13 20:32:29 +02:00
Jacopo Tediosi 9ccf404dde Wrong doc for recvline_endswith() (#1661)
* Wrong doc of recvline_endswith()

* Fixed "see also" link
2020-08-29 20:10:23 +02:00
magrasandArusekk 4b5969f582 Fix syscall instruction lists for SROP on i386 and amd64 (#1669)
All three instructions: `int 0x80`, `sysenter`, and `syscall` require
different stack frames and registers to pass arguments, but
`ROP._srop_call` uses them interchangeably.

This fix limits syscall instruction lists to gadgets that work.

Co-authored-by: Arusekk <[email protected]>
2020-08-29 14:24:52 +02:00
magras fb2bf934ac Fix migration to another ROP (#1668) 2020-08-29 14:22:32 +02:00
Jonas 846f98294f Change lookup algorithm of adb.which (#1663)
* Change lookup algorithm of `adb.which`.

This is done because the current algorithm does not work when the binary (e.g. `su`) is installed in the last element of $PATH.

Example:

```shell
$ echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
$ echo $PATH | while read -r -d: directory; do
>     echo  "$directory/su";
> done
/sbin/su
/vendor/bin/su
/system/sbin/su
/system/bin/su
$ (IFS=:
>   for directory in $PATH; do
>       echo "$directory/su";
>   done
> )
/sbin/su
/vendor/bin/su
/system/sbin/su
/system/bin/su
/system/xbin/su
```

* Update CHANGELOG
2020-08-24 17:19:09 +02:00
Arusekk df76e24e7c Fix SSL timeout error on py2 (#1660)
Turns out that python 2 does not raise correct socket.timeout, but
SSLError instead.  With no errno.  Just a message that might be
localized in some circumstances.

**THIS IS NOT THE ONLY TIME PYTHON 2 IS CAUSING PROBLEMS.**
Time to stop using it, dear exploit developers.  It is dead now.
But here you are: the simple fix.

Closes #1356
2020-08-17 18:37:37 +02:00
Arusekk f98c4fbe2a Disable term if initialization fails (#1659)
Closes #1658
2020-08-17 18:37:13 +02:00
Heap Crash 9e0aa3200c [docker] Upgrade Docker images of Pwntools to use Python3 (#1654)
* [docker] Upgrade Docker images of Pwntools to use Python3

Also installs qemu-user-static and various binutils packages for building (binutils)
and running (qemu) cross-arch binaries.

Fixes #1500

* Update CHANGELOG

* Switch to Python3 for stable/beta/dev Docker images

* [changelog] Add missing links
2020-07-29 23:56:06 -05:00
Heap Crash 8080af8866 [shellcraft] Avoid recursive walk of all templates for command line (#1651)
* [shellcraft] Avoid recursive walk of all templates for command line

Fixes #1650

* Avoid double-fetch

* Add changelog

* [pylint] Only warn for additions
2020-07-27 19:24:31 -05:00
peace-maker f227796a09 Fix detection of WSL2 to open new terminal (#1646)
The osrelease is e.g., `4.19.104-microsoft-standard` in WSL2. microsoft being lowercase. Ignore casing for detection.
2020-07-25 10:36:14 +02:00
Mrmaxmeier b6fc0f3536 tubes/remote: Support Server Name Indication and enable by default (#1644)
* tubes/remote: Support Server Name Indication and enable by default

This allows customizing the server_name via sni="custom" or sending the
name specified in the host parameter via sni=True.

We switch to the SSLContext.wrap_socket API because ssl.wrap_socket is
deprecated and does not support SNI.

Unfortunately, SSLContext.wrap_socket dropped some of the parameters
that are supported by ssl.wrap_socket. These parameters have been moved
to the SSLContext API and can now be used by passing a custom SSLContext
to the ssl_context parameter of `remote`.

* update CHANGELOG.md
2020-07-25 10:31:13 +02:00
Heap Crash 556685e150 [ci] Disable pwnlib.ui tests for branch dev (#1647)
These still run for all other branches and tags
2020-07-22 01:39:04 -05:00
Arusekk eb60b5d6b6 Enhance gdb error message when unable to launch binary (#1614)
* Enhance gdb error message when unable to launch

A common issue is when the binary is not executable,
or the binary is simply missing.

* Use six.ensure_str
2020-07-11 23:39:24 -05:00
Heap Crash 84a139f55b [template] Drop into a shell if downloading the file fails (#1633)
* [ssh] An error should be thrown when download fails, not a silent failure

* [changelog] Add to changelog
2020-07-11 23:38:40 -05:00
Heap Crash 70f3b6fa79 [tests] Change test slightly so that failing output will be emitted (#1634)
* [tests] Change test slightly so that failing output will be emitted

* Disable flaky UI test on Github Actions

* [ui] Try a sleep rather than disabling tests
2020-07-11 23:37:54 -05:00
Arusekk 2d45903ee3 Merge branch 'beta' into dev 2020-07-11 16:26:10 +02:00
Arusekk baa4fc5a9f Merge branch 'stable' into beta 2020-07-11 16:12:03 +02:00
ArusekkandHeap Crash 78df70c986 Inform GDB of file when using QEMU (#1630)
* Inform GDB of file when using QEMU

Fixes #1625

* Sync CHANGELOG from dev + version bump

Co-authored-by: Heap Crash <[email protected]>
2020-07-11 15:58:16 +02:00
Heap Crash a8d34166c4 [ci] Prevent And-roid AVD tests from running every force-push (#1641)
Dash is to prevent triggering installation due to And-roid reference
2020-07-10 13:33:52 -05:00
Heap Crash a6edf2689d [ci] Add pylint stage (#1640) 2020-07-10 13:25:53 -05:00
heapcrash 3940631e21 Silence module-not-imported warning from coverage 2020-07-10 12:29:34 -05:00
heapcrash 7141e93243 Merge branch 'beta' into dev 2020-07-10 12:26:04 -05:00
heapcrash 53ecb27948 [six] Add missing imports to six 2020-07-10 12:09:57 -05:00
Heap Crash f1d8d5b8fe [term] Automatically set PWNLIB_NOTERM when running inside Jupyter (#1632)
* [term] Automatically set PWNLIB_NOTERM when running inside Jupyter

* [changelog] Update changelog
2020-07-10 00:58:52 -05:00
ArusekkandHeap Crash 48a482df24 Enhance tubes.ssh bytes handling (#1602)
* Enhance tubes.ssh bytes handling

Closes #1437

* Add tests

* grep is actually nasty

* Update CHANGELOG.md

Co-authored-by: Heap Crash <[email protected]>
2020-07-10 00:37:21 -05:00
Heap Crash 08ab1b6adf [docs] Add a link to the tutorials (#1631) 2020-07-10 00:29:58 -05:00
Arusekk b5de88e118 [ci] Look for merge conflict markers commited (#1623)
Inspired by #1606
Fixes #1622
2020-07-09 23:08:08 -05:00
Jakub KądziołkaandArusekk 2c33601a86 Add a bfdname for msp430 to make asm and disasm work (#1606)
* Add a bfdname for msp430 to make asm and disasm work

* Add a bfdname for s390 to make asm and disasm work for all architectures

* Add tests for new bfdnames

* ci: Add binutils for newly-tested architectures

Co-authored-by: Arusekk <[email protected]>
2020-07-08 01:15:46 +02:00
Arusekk 55552cd6a2 Merge branch 'beta' into dev 2020-07-07 22:01:20 +02:00
Asger Hautop Drewsen 7e0e644564 Fix cyclic cli for 64 bit integers (#1616)
* Fix cyclic cli for 64 bit integers

* Update changelog

* Use bytes instead of word_size
2020-07-07 21:48:28 +02:00
Arusekk 8b1c25f441 Fix python2 regression from #1608 (#1629)
Closes #1627
2020-07-05 18:49:10 -05:00
Jakub Kądziołka ca06098649 Fix documentation formatting for pwnlib.util.packing.flat (#1624) 2020-07-03 23:30:28 -05:00
heapcrash d2b0a5913b [changelog] Update release date and version list 2020-07-03 20:31:52 -05:00
heapcrash 2fafbfb291 Merge branch 'beta-staging' into dev 2020-07-03 20:13:35 -05:00
Heap Crash 08d900994d [changelog] Update changelog for new release (#1626) 2020-07-03 20:13:17 -05:00
heapcrash 427066d937 [memleak] Fix missing import 2020-07-03 20:12:32 -05:00
heapcrash db0312e0fe Merge branch 'stable' into beta-staging 2020-07-03 19:48:48 -05:00
heapcrash 0337387f97 Add Python3 to supported languages for PyPi 2020-07-03 19:45:49 -05:00
heapcrash 6afccefb01 Merge branch 'beta' into dev 2020-07-03 19:42:03 -05:00
heapcrash db7312b43f Merge branch 'stable' into beta 2020-07-03 19:41:45 -05:00
heapcrash 89e3f2bee0 [dev] Version bump for dev 2020-07-03 19:39:19 -05:00
heapcrash 7b130aec79 [4.3.0] dev is now beta 2020-07-03 19:24:47 -05:00
heapcrash 2e61a6be7f [release] 4.2.0 is now "stable" 2020-07-03 19:10:40 -05:00
heapcrash 13960bac08 Merge branch 'beta' into dev 2020-07-03 19:08:00 -05:00
heapcrash 7647ea6ca9 [ci] Remove failing testsetup block 2020-07-03 18:49:07 -05:00
heapcrash 21215ac22f [gha] Remove canary test for skipif section 2020-07-03 18:47:56 -05:00
heapcrash 3390eafab3 [doctest] Try testsetup / failing doctest 2020-07-03 18:37:52 -05:00
heapcrash 1cc5deca50 [gha] Add doctest to verify that skipif works 2020-07-03 18:11:45 -05:00
heapcrash bae22da550 Merge branch 'stable' into beta 2020-07-03 17:32:35 -05:00
Kyle Zeng 230a42ffc0 OSError is not subscriptable (#1608) 2020-07-02 22:37:20 +02:00
Heap Crash 31465d7570 Permit negative indices in fit() and flat() (#1621)
* [packing] Support negative indices for flat() and fit()

Fixes #1531

* [changelog] Add Changelog for PR

* [packing] Only take negative path if there are any

min([]) is not valid Python

* [packing] Move out_negative to a higher scope
2020-06-30 02:02:36 -05:00
heapcrash cc6d272760 [release] Version bump to 4.1.7 2020-06-30 00:26:37 -05:00
heapcrash 07c7dd6242 Merge branch 'beta' into dev 2020-06-29 23:56:01 -05:00
heapcrash 6443d82835 Merge branch 'stable' into beta 2020-06-29 23:53:30 -05:00
Heap Crash 8d0745628c [stable] Fix incorrectly-merged code (#1620)
* [stable] Fix incorrectly-merged code

* [aarch64] Use byte-strings instead of strings

* [aarch64] Have different tests for str vs bytes

* [aarch64] Convert all items to binary before processing

* [aarch64] Fix doctest results

* [aarch64] Stopgap to fix Py3 CI tests

* [aarch64] Remove failing test, will address in a future release
2020-06-29 23:52:44 -05:00
heapcrash 6f8319519b Merge branch 'beta' into dev 2020-06-29 20:22:46 -05:00
heapcrash fcfce6ca67 Merge branch 'stable' into beta 2020-06-29 20:21:52 -05:00
Heap Crash 4c2fba6912 [aarch64] Fix aarch64.pushstr and pushstr_array (#1618)
* [aarch64] Fix aarch64.pushstr and pushstr_array

* pushstr
  * We were pushing the correct values, and each 16-byte span was correct, but the 16-byte segments were ordered wrong

* pushstr_array:
  * Was entirely broken.  This commit has a non-optmimized version but it works

Closes #1549
2020-06-29 20:20:52 -05:00
heapcrash 3469f4a4f7 [changelog] Fix release schedule 2020-06-27 20:33:27 -05:00
heapcrash b22e3e611d [changelog] Fix release schedule 2020-06-27 20:33:12 -05:00
Heap Crash 3be97b7ab5 [pwn template] Permit --password in addition to --pass (#1613)
* [pwn template] Permit --password in addition to --pass

* Add to CHANGELOG
2020-06-27 20:31:19 -05:00
Heap Crash 1a9dce025f [asm] Fix disasm() for mips64, powerpc64, sparc64 (#1603)
* [asm] Fix disasm() for mips64, powerpc64, sparc64

Closes #1564

* [asm] Add tests for disasm on mips/powerpc/sparc 64-bit

* [asm] Find powerpc, sparc, mips utilities even for 64-bit variants

* [asm] Remove leftover debug trace

* [ci] Add Sparc64 binutils

* [changelog] Add entry
2020-06-27 20:30:49 -05:00
heapcrash cbb57c0148 [example] Add ssh.process to example code 2020-06-27 19:24:34 -05:00
Arusekk 92810cbeb2 Follow-up after #1611 2020-06-28 01:22:15 +02:00
Arusekk 039f2439b5 Don't pollute global namespace
Fixes #1611
2020-06-28 01:16:13 +02:00
Arusekk a190726caf Type fix 2020-06-28 01:13:32 +02:00
heapcrash 745f8e7716 Merge branch 'beta' into dev 2020-06-27 15:52:49 -05:00
heapcrash 21c7864b79 Merge branch 'stable' into beta 2020-06-27 15:52:16 -05:00
Heap Crash 0acf366070 [flag] Fix packing.flat for filler=b'AB' (#1612)
Fixes #1517
2020-06-27 15:49:34 -05:00
heapcrash a3bf833a9a Merge branch 'beta' into dev 2020-06-26 18:06:21 -05:00
heapcrash 8cd4d2b589 Merge branch 'stable' into beta 2020-06-26 18:05:32 -05:00
Heap CrashandArusekk 568af5b7d6 Fix features in pack() and add more doctests (#1610)
* [packing] Better alternative to #1580

pack() was failing for dictionaries that are not ordered

Closes #1582
Closes #1579

* [docs] Add better documentation for flat()

* [changelog] Add 4.1.4

* [release] Bump version to 4.1.4

Co-authored-by: Arusekk <[email protected]>
2020-06-26 18:03:59 -05:00
Heap Crash f2cb7babcf [docker] Get Travis CI dockerfile working more (#1607)
* [docker] Get Travis CI dockerfile working more

* [docker] Do not upgrade all packages, only update if required

* [docker] Move requirements installation higher up before the copy
2020-06-26 17:22:26 -05:00
Saullo Carvalho Castelo Branco ce0966d186 Add to fiddling.hexdump a way to suppress the total at the end (#1605)
* Add `total=` argument to `hexdump` and `hexdump_iter`

* Update `hexdump` docstring

* Add PR to CHANGELOG.md
2020-06-24 11:44:14 +02:00
Jiaming Yi e3a7515f81 Update binutils.rst (#1604)
Update the path to binutils-$ARCH.rb file for Macos.
2020-06-23 21:47:38 -05:00
heapcrash d143af398e Merge branch 'beta' into dev-staging 2020-06-23 20:56:10 -05:00
Heap Crash a1b0ff6b29 Fix extremely verbosel logging of environment when no changes were made (#1592)
* Fix extremely verbosel logging of environment when no changes were made

* [changelog] Update changelog for #1592

Fixes #1448
2020-06-23 11:05:58 -05:00
Heap Crash 1b130cfe5d [ci] Delete foo-staging branch after merging and pushing foo (#1600) 2020-06-23 11:04:55 -05:00
Arusekk c3e39f57f8 Code style enhancements and less sphinx warnings (#1570)
* Fix several sphinx warnings

* Several code style fixes

Mostly grep -Er '[=!]= (None|True|False)'

* Compile-time str concat

also reduced redundant characters at line ends

* Fix python2 toplevel regression

* No equality comparison with singletons again

* Clarification: lambda: [] is just list

* Reintroduce reverted fragment
2020-06-23 11:04:19 -05:00
heapcrash ede4ed13e0 [ci] Add NOTERM to invocation 2020-06-23 11:03:16 -05:00
heapcrash 316cf359c1 [pwn version] Include branch name in output 2020-06-23 11:03:16 -05:00
heapcrash 343dff5c51 [changelog] Update dev changelog 2020-06-23 11:03:16 -05:00
heapcrash a0d61dcea5 [ci] Add "pwn version" step during CI 2020-06-23 11:03:16 -05:00
heapcrash f02e5b5e45 [pwn[ Add "pwn version" command to show installed version 2020-06-23 11:03:16 -05:00
heapcrash 871afd1188 Merge branch 'stable' into beta 2020-06-23 01:50:55 -05:00
heapcrash 47c9cfe4eb [release] Update to version 4.1.3 2020-06-23 01:33:12 -05:00
heapcrash 642fcb0b29 [docs] Add doctest for ssh.process(..., timeout=) 2020-06-23 01:31:49 -05:00
heapcrash 89d73c8047 [ssh] Fix timeout issue with ssh.process()
Also has documentation enhancements for SSH module

Fixes #1591
2020-06-23 01:31:49 -05:00
heapcrash c293318cbd [ci] Re-enable Corefile tests on Github Actions 2020-06-22 23:52:48 -05:00
heapcrash ddf5cdcb3f [docker] Update Docker images to use Bionic 2020-06-22 22:23:58 -05:00
heapcrash 761d446fa3 Add to changelog 2020-06-22 20:18:17 -05:00
heapcrash 5e012ebf95 [ui] Colorize output of "pwn template" if it is a TTY 2020-06-22 20:18:17 -05:00
heapcrash 7d6cb3f61f Merge branch 'beta' into dev
Conflicts:
	CHANGELOG.md
	pwnlib/util/proc.py
2020-06-21 20:59:23 -05:00
heapcrash 6c0017e617 [ci] Fix error with "name" vs "global name" bar 2020-06-21 20:37:10 -05:00
heapcrash 0f2f91a29d Merge branch 'stable' into beta
Conflicts:
	pwnlib/gdb.py
	pwnlib/tubes/ssh.py
	pwnlib/util/proc.py
2020-06-20 19:40:29 -05:00
Arusekk e8b4f0b07f [ci] Increase coverage of commandline tools 2020-06-20 19:36:57 -05:00
heapcrash c0202f9c65 [ci] Fix backported test to work with stable 2020-06-20 19:36:57 -05:00
heapcrash ddab95e5cb [docs] Update FmtStr documentation to use pre-compiled binary 2020-06-20 19:36:57 -05:00
heapcrash f4ab2d2700 [shellcraft] Backport CI changes from dev to stable 2020-06-20 19:36:57 -05:00
heapcrash aad7eb9241 [ci] Add libc6-dbg to requirements 2020-06-20 19:36:57 -05:00
heapcrash 2f9f759839 [ci] Backport CI scripts from dev branch 2020-06-20 19:36:57 -05:00
heapcrash 3934a04536 [gdb] Fix automatic debugging for listen, remote, and ssh
* sock-based GDB connections didn't set the PID, so it didn't work
  * Now uses a real Timeout object
  * Added special case handling for socat, since we were attaching to the wrong process
* ssh-based doctests improved
  * Works locally on everything I tested
  * One test is ignored, since it doesnt work on Travis CI
  * Added libc6-dbg to Github Actions
* run_in_new_terminal supports unicode strings now
  * This fixes SSH-based debugging
* wait_for_debugger now has a timeout
  * Fixes the case where the debugger never comes up, mostly for tests
2020-06-20 19:36:57 -05:00
Saullo Carvalho Castelo Branco a414d788fe Add PR #1576 to CHANGELOG.md (#1588) 2020-06-17 20:51:41 -05:00
Saullo Carvalho Castelo Branco 4134e60c8d Add jmp_esp/jmp_rsp attribute to ROP (#1584) 2020-06-17 15:51:20 -05:00
heapcrash 88084975ad [GHA] Add workflow to require modifications to CHANGELOG.md 2020-06-16 19:31:01 -05:00
heapcrash 4b14e27523 Ask users to update the changelog in the Pull Request template 2020-06-16 19:31:01 -05:00
heapcrash 45eb8bcc81 Re-enable UI tests in Github Actions
I suspect this will not work because of curses failing to initialize in GHA
2020-06-15 23:28:47 -05:00
Arusekk 8b6e6ed67d Enhance py2 32-bit archs support
This was a quick `grep -r isinstance | grep '\<int\>'`
2020-06-15 23:28:32 -05:00
Arusekk 18a7a9458c Ensure tag matches files version 2020-06-15 23:14:03 -05:00
Arusekk 3cca881881 Cyclic CLI functionality 2020-06-15 23:12:29 -05:00
Arusekk 2a68da3dad More coverage 2020-06-15 23:12:29 -05:00
Arusekk 9f5b24d889 Move socket matching to util.net. 2020-06-15 23:12:15 -05:00
Arusekk e9b24a6159 Add support fox mixed-stack connections in proc 2020-06-15 23:12:15 -05:00
Arusekk 39a3b2e8ff Use dual-stack sockets when family is 'any'
Also a minor cleanup in sock.py.
Tested on Linux and FreeBSD.
Closes #1552
2020-06-15 23:12:15 -05:00
ShiftCrops 09caa4ba63 add ".plt.sec" to search section (#1577)
* add .plt.sec to search section

* add test ELFs for .plt.sec
2020-06-14 12:13:00 +02:00
heapcrash 3d76872a28 Reset context so packing works as expected 2020-06-13 19:50:28 -05:00
heapcrash 92aa3d3c16 Add additional workaround for Python2 2020-06-13 19:50:28 -05:00
heapcrash f36bbecc6e Add mixed-ordering test 2020-06-13 19:50:28 -05:00
heapcrash 1a66766c30 Add tests for mis-ordered cyclic fields 2020-06-13 19:50:28 -05:00
heapcrash 74560c80e6 Sort dictionary fields before attempting to flatten them
Fixes #1579
2020-06-13 19:50:28 -05:00
Saullo Carvalho Castelo Branco a0eeb30e0b Add executable= argument to ELF.search (#1576)
* Add `executable=` argument like `writable=` to ELF.search

* Add doctest using ELF.search with `executable = True`

* Fix `__next__()` issue.
2020-06-11 22:10:06 +02:00
jlewis200andArusekk f1628b80fe Update pwnlib/gdb.py
Identity comparison

Co-authored-by: Arusekk <[email protected]>
2020-06-07 19:05:34 -05:00
jlewis200 5c65b8a03e gdb.debug() environment variables fix
If passed an empty dictionary defining the environment variables, the process invoked by gdb.debug() has environment variable 'PWD' set to the directory containing the executable.  This behaviour is not observered when NOPTRACE is enabled:  the program runs without any environment variables set.  Similarly, if an empty environment variable dictionary is passed to process(), it appears to also run under a truly empty environment.  Additionally, attempts to overwrite the "PWD" environment variable with a dictionary entry are not successful under gdb.debug().

This fix brings the gdb.debug() treatment of environment variables in line with and process() and gdb.debug() with NOPTRACE enabled. 
 It allows both empty environments, and overwriting of the 'PWD' environment variable.
2020-06-07 19:05:34 -05:00
heapcrash c2a61b30db [README] Update Twitter badge to include follower count 2020-06-07 14:01:00 -05:00
heapcrash 82a7074d86 [README] Add Coveralls badge logo 2020-06-07 13:58:56 -05:00
heapcrash 8a21b0306d [README] Urlencode badge URL 2020-06-07 13:57:40 -05:00
heapcrash c0afb8ef29 [README] Add Travis logo to Travis CI build badge 2020-06-07 13:56:16 -05:00
heapcrash baed2d5bbc [README] Add Github Workflow status badge 2020-06-07 13:54:02 -05:00
heapcrash cccbc4555c [docs] Add Ubuntu 20.04, remove 12.04 2020-06-07 13:18:38 -05:00
heapcrash df3835a611 [docs] Version should come before docs 2020-06-07 13:17:23 -05:00
heapcrash 758b86c4b0 [docs] Reformat filepointer documentation 2020-06-07 13:15:52 -05:00
heapcrash 16f8c419bc Remove unused update_demo.sh script 2020-06-07 12:27:26 -05:00
heapcrash 1eca50e421 [changelog] Update 4.1.2 2020-06-07 12:24:52 -05:00
heapcrash d2e84c1a30 [travis] Update CI image in README.md 2020-06-07 12:21:49 -05:00
heapcrash 1c1615da2f [docs] Update FmtStr documentation to use pre-compiled binary 2020-06-06 17:58:44 -05:00
heapcrash cb4e01b4df [docs] Make the ret2dlresolve documentation useful 2020-06-06 17:58:44 -05:00
heapcrash 00f65f2c53 [docs] Remove compilation step from ret2dlresolve 2020-06-06 17:58:44 -05:00
heapcrash ac2522fe91 [GHA] Remove dependencies on cross-arch compilers 2020-06-06 17:58:44 -05:00
heapcrash 82f20b28cf [travis] Use gcc-multilib for i386/amd64 compilation 2020-06-06 17:58:44 -05:00
heapcrash fd8ed5883e [travis] Enable IPv6 interfaces, fixes net.interfaces() test 2020-06-06 17:58:44 -05:00
heapcrash 5fea8d25a8 [docs] Fix __doc__ block indentation 2020-06-06 17:58:44 -05:00
heapcrash 01fb378320 [docs] Fix warnings generated during "make doctest" 2020-06-06 17:58:44 -05:00
heapcrash 3f8c92b233 [docs] Silence warning generated by Sphinx about missing code-block language 2020-06-06 17:58:44 -05:00
heapcrash c846f94c8e [shellcraft] Update loader_append examples to build ELFs on the fly
This removes our dependencies against having various compilers installed
2020-06-06 17:58:44 -05:00
Jakub Kądziołka a5bf7c50f4 Make AVR's binutils detection strategy a fallback for all architectures 2020-06-06 14:45:47 -05:00
Jakub Kądziołka 8066b2353b Specify the _bfdname for AVR 2020-06-06 14:45:47 -05:00
Jakub Kądziołka b81c61cae4 Detect AVR binutils
Both Debian and Ubuntu provide a `binutils-avr` package, which contains
an assembler for AVR as `avr-as`. However, pwntools was looking for
something with `linux` in the name, such as `avr-linux-gnu-as`. Of course,
such a target triplet is nonsense, Linux does not run on AVRs
(apart from that one hack that actually emulated some other CPU which
therefore doesn't count).
2020-06-06 14:45:47 -05:00
heapcrash 54d3f674e1 [GHA] Move the lint step to its own workflow 2020-06-05 20:53:19 -05:00
heapcrash 14f5ab6b90 Merge branch 'beta' into dev 2020-06-05 20:26:07 -05:00
heapcrash aec8d9ea9f Merge branch 'stable' into beta-staging 2020-06-05 20:24:45 -05:00
heapcrash 72a93f7a3c [Travis] Make Travis CI work with some newly-added doctests 2020-06-05 20:21:21 -05:00
heapcrash c520efca42 [GHA] Use travis/ssh_setup.sh for SSH configuration
This creates the 'travis' user required for CI

Updated tests in ssh.py to reflect the change
2020-06-05 20:21:21 -05:00
heapcrash a743ccc7fe [GHA] Clone entire repo and print the history 2020-06-05 20:21:21 -05:00
heapcrash 0eb7fdbd88 [GHA] Disable extremely verbose Flake8 tests that make Travis CI hard to read 2020-06-05 20:21:21 -05:00
heapcrash ec4cc53bd0 [GHA] Pull updated CI steps from "dev" 2020-06-05 20:21:21 -05:00
heapcrash 99d3cd708f Version bump 2020-06-05 20:21:21 -05:00
heapcrash 0ee2939a9d Add six >= 1.12.0 to requirements 2020-06-05 20:21:21 -05:00
Heap Crash 555dec78d9 Recommend people use "pip install --upgrade pwntools" (#1558)
We should not encourage most users to use the `dev` branch
2020-06-05 23:07:16 +02:00
heapcrash 267879c91a Set timeout to 30 minutes 2020-06-05 14:34:49 -05:00
Arusekk 2d48220165 Enhance the tests 2020-06-05 11:05:04 +02:00
Arusekk 4d9242ae89 Merge branch 'beta' into dev 2020-06-05 10:50:59 +02:00
heapcrash fae86c3dec Remove demo link
Fixes #1495
2020-06-05 01:52:07 -05:00
heapcrash 24211219d8 Use tmux or screen if the environment variables are present, even if we detect an X11 terminal.
See #1261 for original comments
2020-06-05 01:47:16 -05:00
Yonghwi Jin 2c0d63b569 Cache iter_symbols and iter_sections 2020-06-05 01:41:35 -05:00
heapcrash e254c5fa62 Increase fetch depth to 100 to increase cache hits
AVD installation is one of the longest parts of the CI process
2020-06-05 01:20:19 -05:00
heapcrash aba16247b4 Add workaround for #1538 until Unicorn is fixed 2020-06-05 01:19:28 -05:00
Heap Crash 6fc0914dc0 Convert logging status messages to text (#1540)
Fixes #1510
2020-06-05 01:08:32 -05:00
Heap Crash 8137494932 Make Github Actions pass, even if we have to disable some things (#1546)
* Disable corefile tests for Github Actions

* Disable the UI tests, as theyre broken

* Install gdbserver

* Rename step

* Remove SIGALARM to see if it fixes tests

* Set PWNLIB_NOTERM for command-line runs
2020-06-05 00:41:48 -05:00
Arusekk 371ddc1f01 Fix cli tests 2020-06-04 11:28:27 +02:00
Arusekk baad3927b9 Merge branch 'beta' into dev 2020-06-04 00:00:35 +02:00
Arusekk f5c4a069b6 Hopefully working PyPI + doctests on cli tools 2020-06-03 23:56:51 +02:00
Arusekk 94647d6c10 Merge branch 'beta' into dev 2020-06-03 23:32:08 +02:00
Arusekk 441b0851c9 Merge branch 'stable' into beta 2020-06-03 23:14:47 +02:00
Arusekk 917ffd8667 Release 4.1.1 2020-06-03 23:08:35 +02:00
Arusekk 3ff46ff8d4 Fix cyclic (cf. #1518) 2020-06-03 22:41:30 +02:00
Arusekk 2fcc39eb6e Fix cyclic command under py3 2020-06-03 22:28:40 +02:00
Kyle Zeng ccb49abe35 several py2-py3 issues (#1451)
* in python3 pidof returns a generator

* make cyclic commandline work again
2020-06-03 22:28:29 +02:00
Bruce Chen 0a978df7bf Fix CHANGELOG.md (#1504)
* Fix bunch of invalid PR/commit link  
* Merge two 3.12.1 into one 3.12.1  
* Add 3.12.2
2020-06-03 22:27:06 +02:00
Tijani ad4c62b9fd Update about.rst (#1501)
Fix grammatical error
2020-06-03 22:01:14 +02:00
peace-makerandArusekk 21c9d00078 Fix updating of ELF.functions addresses after changing ELF.address #1512 (#1513)
`ELF.functions` wasn't updated after the binary base address was changed using `ELF.address` like `ELF.symbols` is. The documentation mentions `ELF.functions` getting updated as well, the update was missing though.

Closes #1512

Co-authored-by: Arusekk <[email protected]>
2020-06-03 20:20:22 +02:00
1b6393f381 Updated install documentation to reflect the README (#1430)
Co-authored-by: Arusekk <[email protected]>
Co-authored-by: heapcrash <[email protected]>
2020-06-03 19:27:31 +02:00
Heap CrashandArusekk 1f68bf6560 Update Corefile warnings and replace asserts with normal checks (#1526)
* Update Corefile warnings and replace asserts with normal checks

This means that most of the Corefile will still work, even if
we encounter issues while parsing data from the stack.

* Update pwnlib/elf/corefile.py

* Add missing return statement

Co-authored-by: Arusekk <[email protected]>
2020-06-03 19:10:39 +02:00
Arusekk 9706275a3d Auto-merging possible 2020-06-03 17:43:43 +02:00
Arusekk 8210bba2ab Try to make actions behave 2020-06-03 15:36:11 +02:00
Arusekk c0e4db94f1 Try pull before push 2020-06-03 08:06:03 +02:00
Arusekk 163c19dd49 Freeze unicorn (see #1538) 2020-06-03 00:57:28 +02:00
Arusekk c4c11a37f8 Fix random test regression 2020-06-02 21:59:51 +02:00
Arusekk 9b56b58f95 Auto-merge staging branches to protected ones 2020-06-02 21:10:54 +02:00
mauricesvp e1aedff092 remove unused argument and add missing documentation 2020-05-31 01:45:46 -05:00
Antinomique 8a2b77131e Repair download_dir 2020-05-29 15:23:00 -05:00
heapcrash b5dd858897 Update issue templates 2020-05-29 15:19:00 -05:00
heapcrash 70d42fb076 Update issue templates 2020-05-29 15:15:57 -05:00
heapcrash 9ede4b8eea Add "Question" issue template 2020-05-29 15:08:10 -05:00
laydervus d944a9ec68 __str__ to __bytes__ in python2 (#1521) 2020-05-29 11:50:38 +02:00
Jinmo bbd82ac6fe Initialize unicorn outside loop in plt emulation (#1515) 2020-05-28 23:17:01 +02:00
layderv 4439849d66 ROP representation with short chars (#1505)
Closes #1494
2020-05-28 15:33:13 +02:00
Sacha KOZMA 061d0fd953 Take numbwritten bytes into account in FmtString (#1471)
The number of bytes already written is now taken into account when executing format string writes.
2020-05-27 23:06:46 +02:00
Bruce Chen 43c4eef53b Fix CHANGELOG.md (#1504)
* Fix bunch of invalid PR/commit link  
* Merge two 3.12.1 into one 3.12.1  
* Add 3.12.2
2020-05-27 22:14:20 +02:00
peace-maker ef40a31ac8 Support opening of new windows in WSL (#1503)
Detect if pwntools is running in a Windows Subsystem for Linux "VM" and set the terminal to open a new `cmd.exe` window on the host.

This replaces the need to add `context.terminal = ['cmd.exe', '/c', 'start', 'ubuntu', 'run']` to every script.

Debugging using `gdb.attach` under WSL with gdb in a new window out of the box!
2020-05-27 22:11:01 +02:00
Arusekk c4dd1c22ba Auto-uploading releases to PyPI 2020-05-08 17:10:05 +02:00
Arusekk 59ce329431 Begin working on 4.3.0 2020-05-08 14:27:09 +02:00
Arusekk 03a315ced3 Release 4.2.0beta0 2020-05-08 14:22:15 +02:00
Arusekk dd1f776c6c Release 4.1.0 2020-05-08 13:54:09 +02:00
Arusekk e03e9d7c81 Looks like stack needs to be aligned sometimes 2020-05-08 10:37:39 +02:00
Arusekk 397d8c6edd Try to fix examples 2020-05-07 19:05:56 +02:00
Arusekk ad0da0a675 Improvements in examples 2020-05-07 13:01:27 +02:00
Arusekk 25415453da Supporting python 2 is soooo annoying 2020-05-07 13:00:26 +02:00
Arusekk 3d835dfad2 Python 2 has it the other way round 2020-05-07 11:54:40 +02:00
Arusekk 5978c8c047 More ADB 2020-05-07 00:24:43 +02:00
Arusekk 599ac6f9d6 Typos in code 2020-05-07 00:22:32 +02:00
Arusekk bc9da1600c Adb changes from google 2020-05-07 00:11:28 +02:00
Arusekk f26a0256dc Finally resolve ret2dlresolve.
This is a WONTFIX, but default gcc on ubuntu compiles .bss (and other RW
segments) so far away from .text that ret2dlresolve mathematically
just has to segfault unless .text and .rodata contain crafted structures
already.

Compiling and working fine on gentoo, though.  Hope this proves useful.

Also closes #1448 by the way, it was really annoying.
Closes #1476.
2020-05-07 00:08:14 +02:00
Arusekk 3e71853f9f Enhance ret2dlresolve 2020-05-05 17:49:22 +02:00
Arusekk 54514441aa Adapt ret2dlresolve to pwntools 2020-04-29 22:52:41 +02:00
Arusekk 2a7676cd5a Merge: add ret2dlresolve (#1436) 2020-04-29 09:33:31 +02:00
Arusekk 94f71aafe5 Improve coverage 2020-04-29 00:31:05 +02:00
Arusekk 3a83b2bdb2 Do it the mktemp way 2020-04-28 20:31:54 +02:00
Arusekk 2101f8d531 Try again 2020-04-28 19:48:01 +02:00
Arusekk 8699639148 Merge branch 'dev' of https://github.com/Gallopsled/pwntools into dev 2020-04-28 19:34:16 +02:00
Arusekk aea0901ca4 Try a different location of examples 2020-04-28 19:30:30 +02:00
Arusekk b203745097 Improve test coverage (adb, iters, lists) 2020-04-28 19:17:13 +02:00
Arusekk f834ce9582 Fix cyclic command under py3 2020-04-23 14:33:39 +02:00
peace-maker d7e8b0210a Enable text colors in Windows console (#1454)
* Enable text colors in Windows console

Consoles on Windows 10 support ANSI escape sequences including color codes.
Emulate unix curses `tigetstr` terminal capabilities by hardcoding the given escape sequences for used curses capabilities.

ANSI escape sequences have to be enabled using `kernel32.SetConsoleMode(hndl, ENABLE_VIRTUAL_TERMINAL_PROCESSING)` for the current console.

* Use object identity operator
2020-04-21 19:08:56 +02:00
Karthikeyan Singaravelan 4bd1aeff75 Fix python 3 related warnings (#1488)
* Import ABC from collections.abc for Python 3.

* Fix deprecation warnings due to invalid escape sequences.

* Use raw strings instead of escaping individually.
2020-04-21 19:07:23 +02:00
Arusekk 53cf93a004 Random ADB regression 2020-04-21 18:40:40 +02:00
Adam O'Hara 3d4853f9a7 Fixed bug when rop.call() used sigreturn with string args (#1484)
Previously, the rop._srop_call function would append the args without checking whether their value would work
directly in a register. It now uses AppendedArgument to determine whether the value is pushed to the end of
the ROP chain.
2020-04-20 05:26:24 +02:00
YCMandArusekk eeb8d456f2 Update proc.py (#1450)
* Update proc.py

reversed([p.pid for p in processes])   only return a iter.
if use gdb.attach('some process name') will cause  error like :
  File "/home/tsj/.local/lib/python2.7/site-packages/pwnlib/gdb.py", line 657, in attach
    pid = pids[0]
TypeError: 'listreverseiterator' object has no attribute '__getitem__'


In this case ,it treat 'pids' as a list,so here should return a list as well

* Apply suggestions from code review

Co-authored-by: Arusekk <[email protected]>
2020-04-10 22:58:56 +02:00
Kyle Zeng 71e9c038f7 several py2-py3 issues (#1451)
* in python3 pidof returns a generator

* make cyclic commandline work again
2020-04-10 22:57:09 +02:00
Arusekk a951fbcdbe If only python was typed 2020-04-10 20:09:52 +02:00
Arusekk e42c244612 Try to debug attribute errors in process.corefile 2020-04-10 19:59:40 +02:00
Arusekk 8f86dde4f8 Fix GDB regression 2020-04-10 19:52:17 +02:00
Arusekk 16aa14968b Ensure str in ssh_channel.executable and .cwd
Closes #1468
2020-04-10 19:35:03 +02:00
Arusekk 2c97312399 Cannot reproduce this locally, but ok 2020-04-07 17:54:09 +02:00
Arusekk fecf9f62a6 Port SSH remote part to python3 2020-04-07 16:46:26 +02:00
Arusekk f0f0c364d3 Merge branch 'beta' into dev 2020-04-07 03:01:43 +02:00
Arusekk a8e594d7a3 Fix bytes in flag.py 2020-04-07 00:59:22 +02:00
Arusekk 1b6e663f93 Re-add recommends for cross-gcc 2020-04-07 00:41:17 +02:00
Arusekk 4fe423c1b4 Hope this will pass CI 2020-04-07 00:27:34 +02:00
Arusekk 8673f53aab Solve build problems 2020-04-07 00:26:55 +02:00
Arusekk 3875a8ff18 Stabilize CI flow 2020-04-07 00:26:29 +02:00
Arusekk 97f5742f5c More reliable crash on thumb 2020-04-06 22:35:37 +02:00
klecko c9dad72be4 Changed test to 32 bits, 64 bits seems broken for now 2020-04-04 19:32:47 +02:00
klecko d16370be3e Added test 2020-04-04 15:01:22 +02:00
klecko 5acabdd1a1 Changed design 2020-04-04 12:56:55 +02:00
Guil-T 91d464b298 fix for python3 compatibility (#1467)
if the value returned from the leak function is a str, it converts it to a bytearray for pytohn3 compatibility. Assuming a string is returned is flaky and likely wrong.
2020-04-01 17:00:07 +02:00
Guil-T a7678f77a3 removed the double quotes around the temp filename of the gdbscript (#1465)
removed the double quotes around the temp filename of the gdbscript as this broke the gdbscript functionality.

The doublequotes would be considered part of the filename and it would fail to read the file..

Tested this fix on Kali.
2020-04-01 10:18:27 +02:00
Arusekk 5b8acf0893 Try to make ADB work 2020-03-30 11:18:44 +02:00
Arusekk 9bb47493ba Stable tests, some bootup permission issue 2020-03-29 00:45:10 +01:00
Arusekk b952728fad Ensure ADB quite working 2020-03-29 00:22:59 +01:00
Arusekk d8b69dde24 GDB enhancements 2020-03-28 12:21:30 +01:00
Arusekk e5f17630dc Enhance debug messages if yama is on
Also disable yama on CI
2020-03-27 12:39:49 +01:00
Arusekk b7c985ad42 Make sure ADB is in root mode (unordered doctests) 2020-03-27 11:20:34 +01:00
Arusekk 34ef7dce64 Allow slower doctests 2020-03-26 10:29:16 +01:00
Arusekk c9909eea0d Fix ADB again 2020-03-26 10:10:24 +01:00
Arusekk 1d92ee3583 Prevent adb module from being introspected wrongly 2020-03-26 09:32:32 +01:00
Arusekk 8eb242df5a Actually fix the problems 2020-03-26 09:18:14 +01:00
Arusekk 4b2037028e Please please please work as expected 2020-03-25 21:49:20 +01:00
Arusekk b6bc3629e9 More debugging 2020-03-25 17:39:55 +01:00
Elon Gliksberg 415f11bba7 The SSH tube now keeps the environment variable's order. (#1464)
* The SSH tube now keeps the environment variables of processes it creates in order.
The way of achieving that is through passing the env to the script as a list of tuples,
since Python3's dictionaries are ordered by default, or you can use `OrderedDict`,
the result would be that the spawned process on the remote machine will keep the environment variables in order.

This is very important to exploits that are based on the stack's order and especially the environment variables.
For instance, a common challenge is comparing argc == 0, and afterwards accessing the argv array, as an out-of-bounds array.
The shellcode needs to be at a certain index consistently and cannot rely on the stack moving around.

* Relocated the code.
2020-03-25 17:26:45 +01:00
Arusekk 1d7d5ecd7f More debug info 2020-03-22 21:37:00 +01:00
Arusekk 0a558391d9 Try to debug what is wrong 2020-03-22 20:00:05 +01:00
Arusekk e33a3fd517 Whatever 2020-03-22 00:57:16 +01:00
Arusekk ca0b08f500 Changes in AVD handling 2020-03-22 00:11:30 +01:00
Arusekk 358581a26f Too complicated 2020-03-21 23:36:10 +01:00
Arusekk 60461af312 Enhance UI tests diagnostics 2020-03-21 23:24:35 +01:00
Arusekk 37492fd579 Try again and again 2020-03-21 22:42:25 +01:00
Arusekk e4a0703178 Fix ssh user in gdb 2020-03-21 21:50:19 +01:00
Arusekk a1e74b3d57 Merge branch 'stable' into beta 2020-03-21 21:20:37 +01:00
ArusekkandChristian Clauss 055d8b87ae GitHub actions (#1460)
* Try GitHub actions instead of Travis CI.

This is just a proof-of-concept until we can
have it the clean way it should be done.

More commits will likely follow.

* Travis CI: Use flake8 to detect syntax errors (#1385)

* Travis CI: Use flake8 to detect syntax errors

Repeat #1305 on the Python 3 branch.  Also, remove the hardcoding of default values for dist and Py2.

https://flake8.pycqa.org/en/latest/user/error-codes.html

On the flake8 test selection, this PR does _not_ focus on "_style violations_" (the majority of flake8 error codes that [__psf/black__](https://github.com/psf/black) can autocorrect).  Instead these tests are focus on runtime safety and correctness:
* E9 tests are about Python syntax errors usually raised because flake8 can not build an Abstract Syntax Tree (AST).  Often these issues are a sign of unused code or code that has not been ported to Python 3.  These would be compile-time errors in a compiled language but in a dynamic language like Python they result in the script halting/crashing on the user.
* F63 tests are usually about the confusion between identity and equality in Python.  Use ==/!= to compare str, bytes, and int literals is the classic case.  These are areas where __a == b__ is True but __a is b__ is False (or vice versa).  Python >= 3.8 will raise SyntaxWarnings on these instances.
* F7 tests logic errors and syntax errors in type hints
* F82 tests are almost always _undefined names_ which are usually a sign of a typo, missing imports, or code that has not been ported to Python 3.  These also would be compile-time errors in a compiled language but in Python a __NameError__ is raised which will halt/crash the script on the user.

* Fail fast, exclude generated source files

* --select=E9,F63,F7

* 2to3 -f print -wn examples

* No more <> in python 3.

* Use ==/!= to compare str, bytes, and int literals (#1386)

Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise _SyntaxWarnings_ so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

$ python
```python
>>> raw = 'ra'
>>> raw += 'w'
>>> raw == 'raw'
True
>>> raw is 'raw'
False
```

* Use print() function in both Python 2 and Python 3 (#1387)

$ __pip install black future isort__
$ __futurize -f libfuturize.fixes.fix_print_with_import -w android.py__
$ __isort android.py__
$ __black android.py__

* Add cache and building artifacts

* Enable caching

* Actually enable caching for all of it

* Mistake

* Try different ABI on CI

* Try different ABI + version

* Try it harder

* Update SDK version

* Try building using newer SDK

* Accept licenses

* Ugh android emulator documentation is unfriendly

* Environment variables for AVD

* Add QEMU-system for android virtual devices

* Use the correct emulator

* New android image

* Was actually too new image

* Update ssh credentials to reflect GHA setup

* Fix spelling

* Try finding endless loops

* Actually use the timeout

* Reduce possible hang surface in doctests

* Try SSH immediately when set up

* SSH strict host key checking disable for localhost

* Try stackoverflow.com research

* Try to fix failing doctests

* Add required gcc for cross-arch tests

* Ensure gcc not failing in fmtstr

* Fix issues with shellcraft

* Try different libs

* Try again, with verbosity

* Why do these conflict???

* Fix issues related to PIE binaries

* Add bash-static

* Verbose 'could not set transport: any'

* Add AT_SECURE in auxv to prevent SEGV on libc bug

* Killing ADB server actually kills it

* Android image has /data/user/0 -> /data/data

* Set coverage mode from dev

* Try new actions

* Fix coveralls complaining

* A little time.sleep would not hurt or would it

Co-authored-by: Christian Clauss <[email protected]>
2020-03-21 21:10:45 +01:00
Bet4 9cefaccc10 Fix gdb and fmtstr doctests format (#1440)
* Fix gdb doctest format

* Fix fmtstr doctest format
2020-03-21 19:13:51 +01:00
Bet4 5ddd0f4ba3 Fix encoder support for python3 (#1458) 2020-03-21 18:54:29 +01:00
peace-maker c5178460df Allow pwntools to load on Windows (#1449)
* Allow pwntools to load on Windows

Fixes loading of pwntools on Windows. `from pwn import *` works.

It allows to use some operating system agnostic features of pwntools out of the box.

This is inspired by #996.

Some features fail or even crash (local processes, gdb, assemble/disassemble)
 and console colors are still not displayed correctly, but those can be addressed separately.

* Use `os.devnull` instead of manual selection
2020-03-16 20:39:45 +01:00
tkmikan 7326452c69 fix for tube wrapperS (#1452)
* fix for tube wrapperS

* add space to wrapperS docstring
2020-03-16 11:46:49 +01:00
klesoft c4b514f215 Added ret2dlresolve 2020-02-26 23:51:08 +01:00
Karim Kanso ed3c30aed3 Python 3 fixes for string/bytes comparisons (#1426) 2020-02-08 15:35:58 +01:00
Vitaly Chipounov f3b492db75 pwnlib/term: replaced file() with open() for python3 compatibility (#1422)
Signed-off-by: Vitaly Chipounov <[email protected]>
2020-02-08 15:06:49 +01:00
peace-maker 26598f3da6 Add heuristic to find return address into __libc_start_main (#1419)
* Add heuristic to find return address into __libc_start_main

Find the return address from main into __libc_start_main in a libc shared binary. Mimic's niklasb's heuristic in libc-database.

* Add support for different `call` instructions
2020-02-03 15:20:41 +01:00
Hye Sung Jung 586781bd46 Fix spelling errors (#1416) 2020-02-01 20:02:20 +01:00
Aaron Lichtman 8f941b8d71 Respect XDG Base Directory spec for pwntools cache (#1420)
Fix #1370
2020-02-01 19:44:38 +01:00
Arusekk 42abafdd41 Merge branch 'beta' into dev 2020-01-22 22:26:22 +01:00
Arusekk d82bab2849 Merge branch 'stable' into beta 2020-01-22 22:23:57 +01:00
Arusekk 904872edc8 Release 4.0.1 2020-01-22 21:57:27 +01:00
Zach RiggleandArusekk 7b072dc7f7 Fix gadget caching for ROP objects with multiple ELFs (#1115)
* Fix test breakage caused by Sphinx deprecation

Closes #1112

* Fix gadget caching for ROP objects with multiple ELFs

Fixes Gallopsled/pwntools#1114

* Update requirements, fix travis failing

Co-authored-by: Arusekk <[email protected]>
2020-01-22 21:49:10 +01:00
Arusekk 433d92619b Add a universal way of disabling updates
Closes #1414
2020-01-22 20:45:03 +01:00
the-exodus 9094db42af Install-section pointing to the correct branch now (#1409) 2020-01-22 15:18:42 +01:00
Arusekk 51fa401752 Merge branch 'beta' into dev 2020-01-18 20:49:42 +01:00
Arusekk d8219b8826 Merge branch 'stable' into beta 2020-01-18 20:49:12 +01:00
CptGibbon eee1503252 Correct self.buffer.add() to self.buffer.unget() in recvline_pred() (#1412) 2020-01-18 20:46:22 +01:00
Arusekk d80d3e08ef Begin working on 4.2.0 2020-01-09 19:10:30 +01:00
Arusekk c3784268a1 Release 4.1.0beta0 2020-01-09 19:00:58 +01:00
Arusekk a50265eb30 Release 4.0.0 2020-01-09 18:54:49 +01:00
Félix Martel (lixtelnis)andArusekk 6d340bf2ac Remove AddressFamily. prefix from address_family (#1316)
* Remove `AddressFamily.` prefix from address_family

* Fix python 2 regression

Co-authored-by: Arusekk <[email protected]>
2020-01-07 15:31:21 +01:00
Calle Svensson 2124f3607a Use bytes instead of string in serialtube class (#1402) 2020-01-07 15:29:18 +01:00
Bet4andArusekk f727b66475 Fix issues related with debugging (#1323)
* Fix issues related with debugging

* Update pwnlib/tubes/process.py

Co-Authored-By: Arusekk <[email protected]>

* Enable doctest for find_module_addresses

* Experiment about adding doctests to gdb.py

* Add doctests for most functions in gdb.py

* Remove 'file' statement in gdb script

* Encode cyclic alphabet

* Fix travis build

Co-authored-by: Arusekk <[email protected]>
2019-12-29 13:16:11 +01:00
Arusekk c334cebade Android here we go again 2019-12-28 13:50:49 +01:00
Arusekk 010c89c3b3 Fix android builds regression with #1385 2019-12-28 01:46:46 +01:00
Arusekk 82dce28722 Introduce tests for pwnlib.ui (#1398)
* Introduce tests for pwnlib.ui

This architecture can be changed later, but I'm quite proud
of how it's done currently.

* Try to debug CI

* Ugly hack to get results back

* Let's just keep it half-broken
2019-12-27 19:27:18 +01:00
Arusekk 5fdeb21de1 Enhance unlock_bootloader with better status messages (#1001) 2019-12-27 18:45:07 +01:00
Arusekk 8a4288f895 Enhance CI caching (#1392)
Currently, python 3 installed libraries
and sphinx doctree cache are not retained across builds.
This PR addresses this issue, hopefully resulting in a major speedup.
2019-12-27 16:10:10 +01:00
Arusekk ecc160a36c Merge branch 'beta' into dev 2019-12-13 23:41:07 +01:00
Arusekk f34783b1f9 Will investigate later 2019-12-13 23:25:36 +01:00
Arusekk 76de9302ef Apply #1391 with additional doctest 2019-12-13 23:00:34 +01:00
Arusekk c578d5661d Merge branch 'stable' into beta 2019-12-13 22:56:02 +01:00
Itamar df59b10eb3 transform armv7l arch to arm (#1388) 2019-12-13 13:54:16 +01:00
mephi42 7b9bcf8d7b Fix process.libs (#1391)
Currently fails with "name maps is not defined".
2019-12-13 13:53:54 +01:00
Krzysztof Korościk 59ec1b1a1b remove tox dependency (#1389) 2019-12-12 14:36:26 +01:00
Christian Clauss 41702e89e6 Travis CI: Use flake8 to detect syntax errors (#1385)
* Travis CI: Use flake8 to detect syntax errors

Repeat #1305 on the Python 3 branch.  Also, remove the hardcoding of default values for dist and Py2.

https://flake8.pycqa.org/en/latest/user/error-codes.html

On the flake8 test selection, this PR does _not_ focus on "_style violations_" (the majority of flake8 error codes that [__psf/black__](https://github.com/psf/black) can autocorrect).  Instead these tests are focus on runtime safety and correctness:
* E9 tests are about Python syntax errors usually raised because flake8 can not build an Abstract Syntax Tree (AST).  Often these issues are a sign of unused code or code that has not been ported to Python 3.  These would be compile-time errors in a compiled language but in a dynamic language like Python they result in the script halting/crashing on the user.
* F63 tests are usually about the confusion between identity and equality in Python.  Use ==/!= to compare str, bytes, and int literals is the classic case.  These are areas where __a == b__ is True but __a is b__ is False (or vice versa).  Python >= 3.8 will raise SyntaxWarnings on these instances.
* F7 tests logic errors and syntax errors in type hints
* F82 tests are almost always _undefined names_ which are usually a sign of a typo, missing imports, or code that has not been ported to Python 3.  These also would be compile-time errors in a compiled language but in Python a __NameError__ is raised which will halt/crash the script on the user.

* Fail fast, exclude generated source files

* --select=E9,F63,F7

* 2to3 -f print -wn examples

* No more <> in python 3.
2019-12-09 21:58:15 +01:00
Gulshan Singh f6fe196780 Launch QEMU with sysroot if specified (#1241)
* Launch QEMU with sysroot if specified

* Update gdb.py

* Append args, do not replace
2019-12-09 18:04:35 +01:00
Bet4 6667a239be Use the last possible address as PLT address (#1146) 2019-12-09 17:54:25 +01:00
Vignesh S Rao (a.k.a sherl0ck) 59c78105e1 Adding support for FileStructure exploitation (#1218)
* Adding support for FileStructure exploitation

* Actually run the tests + basic py3 fixes

also rename the module to lower case to keep consistency

* Python 3 working
2019-12-09 17:48:38 +01:00
Josh FandArusekk b78fd6e3c8 Allow VMA 0 in make_elf (#1361)
* Allow VMA 0 in make_elf

* Update none check

Co-Authored-By: Arusekk <[email protected]>
2019-12-09 17:33:11 +01:00
Arusekk ab67da5d8e Merge branch 'dev3' into dev 2019-12-09 17:30:00 +01:00
Christian Clauss 0491972d1c Use print() function in both Python 2 and Python 3 (#1387)
$ __pip install black future isort__
$ __futurize -f libfuturize.fixes.fix_print_with_import -w android.py__
$ __isort android.py__
$ __black android.py__
2019-12-08 19:43:18 +01:00
Christian Clauss 98bdcfd9f0 Use ==/!= to compare str, bytes, and int literals (#1386)
Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise _SyntaxWarnings_ so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

$ python
```python
>>> raw = 'ra'
>>> raw += 'w'
>>> raw == 'raw'
True
>>> raw is 'raw'
False
```
2019-12-08 17:26:33 +01:00
Andreas Oberritter dbf0549213 Make DynELF().libc work on current Debian 10 (amd64) (#1340)
* libcdb: Add another offset for amd64

Tested with libc6_2.28-10_amd64.deb from Debian 10.

* dynelf: Improve status message when looking for build id
2019-12-08 15:27:33 +01:00
Kyle Zeng 11e9d814c9 in python3, input builtin returns str not bytes (#1383) 2019-12-08 15:24:18 +01:00
Arusekk aaa3cb48b9 Fix readline under py2 2019-12-08 11:28:51 +01:00
Riccardo Landolfo 9476e2e5b0 use bytes variable instead of arch (#1384) 2019-12-08 11:26:45 +01:00
ArusekkandAdi 99e9bcbf30 Special handling for gdb LD_* environment (#1371)
Closes #1307

Co-authored-by: Adi <[email protected]>
2019-12-06 12:24:16 +01:00
Arusekk adaba022e6 Pretty docstrings and libcdb fix 2019-12-06 11:30:55 +01:00
Arusekk 37aeb060c6 Merge branch 'beta' into dev 2019-12-06 11:28:41 +01:00
Arusekk 22d441c200 Fix python 2 regression in readline 2019-12-06 10:57:16 +01:00
Arusekk fcc9642250 Fix ugly raw_input()-related stuff
Closes #1373 #1379 #1380
2019-12-06 10:45:30 +01:00
kwendim 9c6ca14eeb fix rop gadgets caching (#1369) 2019-12-05 00:39:49 +01:00
Kyle Zeng faab6ea3dd should not use first argument if exe is specified (#1377)
* should not use first argument if exe is specified

* use absolute path for execuable
2019-12-05 00:37:30 +01:00
Arusekk f7193293cc Enhance pwnlib.ui python3 support
Closes #1379

side note: will need to redesign the
ugly input()/raw_input() override that goes on somewhere
2019-12-05 00:30:30 +01:00
Arusekk 5bba036c54 Merge branch 'dev3' into dev 2019-11-11 00:02:38 +01:00
Calle Svensson 11a70f2e9e Added cyclic_gen class (#1359)
* Added cyclic_gen class

* Fix review comments

* Add description and doctests

* Added missing quotes

* Improved tests
2019-11-10 23:54:13 +01:00
Arusekk 55dfe9b5e4 Begin working on 4.1.0 2019-11-05 19:53:20 +01:00
Arusekk 5b0c6922e7 Release 4.0.0beta0 2019-11-05 19:41:17 +01:00
Arusekk 33524d74a5 Release 3.13.0 2019-11-05 18:39:55 +01:00
Arusekk 2456186f7c Fix elf regression for python3 2019-11-05 13:31:35 +01:00
Arusekk 714ae6ab69 Merge branch 'dev' into dev3 2019-11-05 11:28:57 +01:00
Arusekk c3083d8d92 Merge branch 'beta' into dev 2019-11-05 11:18:42 +01:00
Arusekk 56869f0e47 Fix regression in context 2019-11-05 11:11:07 +01:00
Arusekk 2b843891f4 Fix regression in cyclic 2019-11-05 10:42:39 +01:00
Arusekk d8a2359100 Merge branch 'stable' into beta 2019-11-05 10:40:48 +01:00
Arusekk dd9bbd0e51 Oh that actually broke packing 2019-11-05 10:34:46 +01:00
Arusekk 5babddd95c Fix regression 2019-11-04 19:28:53 +01:00
Arusekk 3720314f4d Merge remote-tracking branch 'zachriggle/context-validation' into dev 2019-11-04 17:53:31 +01:00
Arusekk 0129fdd4af Merge remote-tracking branch 'zachriggle/ELF-populate-maps' into dev 2019-11-04 17:41:23 +01:00
xtrm0 215b2e6920 Reduce cache filename length on rop.py (fix #1180) (#1204)
* Reduce cache filename length on rop.py (fix #1180)

* ROP cache elfs sorting
2019-11-04 17:11:16 +01:00
Arusekk e0af5e864f Merge branch 'dev' into dev3 2019-10-30 15:50:47 +01:00
Arusekk 5a23b22761 Merge branch 'beta' into dev 2019-10-30 15:50:21 +01:00
Arusekk 6f510a3270 Merge branch 'stable' into beta 2019-10-30 15:49:06 +01:00
ipersons ff2f4f5bf2 Fix Nested SSH Connectors (#1175)
* Handle layered proxying in ssh_connecter

* better error handling

* Fix ssh problems
2019-10-30 15:46:22 +01:00
Arusekk f49f931ee8 Fix ROP appended arguments
Closes #1357
2019-10-30 14:50:44 +01:00
veritas501 b75b4aa2f0 fix vmlinux memory read bug (#1272)
* fix vmlinux memory read bug

* remove some comments
2019-10-30 12:59:32 +01:00
erfur 9e0d96b4b6 Add color argument of checksec to docstring (#1352) 2019-10-30 12:57:55 +01:00
Arusekk 2116bf3118 Merge branch 'dev' into dev3 2019-10-22 20:53:04 +02:00
Arusekk ec314ddf71 Merge branch 'beta' into dev 2019-10-22 20:52:12 +02:00
Arusekk c0056b71d7 Merge branch 'stable' into beta 2019-10-22 20:51:03 +02:00
Oshawk 92e01a7dca Fix 'break' syscall (#1355)
* Fix 'break' syscall

Fixed the 'break' syscall by renaming the method to break_ so as not to collide with the keyword.

* Bypass pypa/pip#6275
2019-10-22 20:48:45 +02:00
heinrich5991 fb1178418b Fix update ignore check for Python 3 (#1348)
`read` returns bytes and its result can never equal a string.
2019-10-09 22:30:42 +02:00
Arusekk 8fdfd95df6 Merge branch 'dev' into dev3 2019-09-24 11:51:32 +02:00
Arusekk 2808b5cd57 Code style and clarity 2019-09-24 10:33:38 +02:00
Benno Fünfstück d2b9e48cf0 Improve format string generator (#1216)
* feat(fmtstr): place pointers after format operations

This means that the format string can now also work in certain
cases even if the pointers contain null bytes.

That's especially important on 64 bit where most pointers contain null bytes.

* fix(fmtstr): more stuff

* feat(fmtstr): optimize

* perf(fmtstr): make sorting run in reasonable time (not perfect yet)

* perf(fmtstr): be faster

* style(fmtstr): more docs, some cleanup

* fix(fmtstr): small fixes + more docs

* style(fmtstr): cleanup small style issues

* fix(fmtstr): fix handling of szmax in merge_atoms_overlapping

* fix(fmtstr): fix Atom __getitem__ for out-of-bounds index

* refactor(fmtstr): docs and cleaner code

* fix(fmtstr): small test/doc fixes

* tests(fmtstr): add example as tests for other arches

* doc(fmtstr): more docstrings

* fix(fmtstr): fix cyclic_find warnings

* refactor(fmtstr): remove another nested function

* tests(fmtstr): fix doctest output for wrong arch

* style(fmtstr): remove unused imports

* tests(fmtstr): add binaries for tests
2019-09-24 09:34:25 +02:00
Calle Svensson 138fecf524 Perform all string formatting in log statement 2019-09-23 20:54:59 -07:00
Calle Svensson 8d78806ded Fix #1262 - Static format string for ELF description 2019-09-23 20:54:59 -07:00
colinmkinsella 1566c903ad Dev3 (#1343)
* Updates to requirements.txt.

Removed the < 1.8.0 requirement for sphinx. It appeared no longer
necessary.

Alphabetized the listing for easier searching.

Moved the requirements file under the docker folder. Docker does not
like relative paths to parent directories due to security restrictions.

* Updated Dockerfile to use Python3.

* Fixes to srop test errors.

Moving the imports to the beginning of the file resolved the issue.

The following errors were popping up during testing within Docker:

Document: rop/srop
------------------
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.recvline()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest default[18]>", line 1, in <module>
        p.recvline()
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 467, in recvline
        return self.recvuntil(self.newline, drop = not keepends, timeout = timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 310, in recvuntil
        res = self.recv(timeout=self.timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 82, in recv
        return self._recv(numb, timeout) or b''
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 160, in _recv
        if not self.buffer and not self._fillbuffer(timeout):
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 131, in _fillbuffer
        data = self.recv_raw(self.buffer.get_fill_size())
      File "/home/travis/pwntools/pwnlib/tubes/process.py", line 707, in recv_raw
        raise EOFError
    EOFError
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.poll(block=True)
Expected:
    0
Got:
    -11
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.recvline()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest default[18]>", line 1, in <module>
        p.recvline()
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 467, in recvline
        return self.recvuntil(self.newline, drop = not keepends, timeout = timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 310, in recvuntil
        res = self.recv(timeout=self.timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 82, in recv
        return self._recv(numb, timeout) or b''
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 160, in _recv
        if not self.buffer and not self._fillbuffer(timeout):
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 131, in _fillbuffer
        data = self.recv_raw(self.buffer.get_fill_size())
      File "/home/travis/pwntools/pwnlib/tubes/process.py", line 707, in recv_raw
        raise EOFError
    EOFError
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.poll(block=True)
Expected:
    0
Got:
    -11
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.recvline()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest default[18]>", line 1, in <module>
        p.recvline()
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 467, in recvline
        return self.recvuntil(self.newline, drop = not keepends, timeout = timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 310, in recvuntil
        res = self.recv(timeout=self.timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 82, in recv
        return self._recv(numb, timeout) or b''
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 160, in _recv
        if not self.buffer and not self._fillbuffer(timeout):
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 131, in _fillbuffer
        data = self.recv_raw(self.buffer.get_fill_size())
      File "/home/travis/pwntools/pwnlib/tubes/process.py", line 707, in recv_raw
        raise EOFError
    EOFError
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.poll(block=True)
Expected:
    0
Got:
    -11
**********************************************************************
1 items had failures:
   6 of 159 in default
159 tests in 1 items.
153 passed and 6 failed.
***Test Failed*** 6 failures.

* Fix for docstring warning in dynelf.py.

The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/dynelf.py:docstring of pwnlib.dynelf.DynELF._resolve_symbol_sysv:11: WARNING: Definition list ends without a blank line; unexpected unindent.

* Fix for docstring warnings in gdb.py.

The following warnings are resolved with this fix:

/home/travis/pwntools/pwnlib/gdb.py:docstring of pwnlib.gdb.debug_assembly:8: WARNING: Inline strong start-string without end-string.
/home/travis/pwntools/pwnlib/gdb.py:docstring of pwnlib.gdb.debug_assembly:21: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/travis/pwntools/pwnlib/gdb.py:docstring of pwnlib.gdb.debug_shellcode:4: WARNING: Inline strong start-string without end-string.
/home/travis/pwntools/pwnlib/gdb.py:docstring of pwnlib.gdb.debug_shellcode:17: WARNING: Block quote ends without a blank line; unexpected unindent.

* Fix for adb/__init__.py.

The following error is resolved with this fix:

Document: protocols/adb
-----------------------
**********************************************************************
File "../../pwnlib/protocols/adb/__init__.py", line ?, in default
Failed example:
    pprint(AdbClient().list('/data/user'))
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest default[0]>", line 1, in <module>
        pprint(AdbClient().list('/data/user'))
    TypeError: 'module' object is not callable
**********************************************************************
1 items had failures:
   1 of  10 in default
10 tests in 1 items.
9 passed and 1 failed.
***Test Failed*** 1 failures.

The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/protocols/adb/__init__.py:docstring of pwnlib.protocols.adb.AdbClient.stat:6: WARNING: Inline literal start-string without end-string.

* Fix for docstring warning in rop.py.

The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/rop/rop.py:docstring of pwnlib.rop.rop.DescriptiveStack.descriptions:3: WARNING: Inline literal start-string without end-string.

* Fix for docstring warning in ssh.py.

The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/tubes/ssh.py:docstring of pwnlib.tubes.ssh.ssh._init_remote_platform_info:6: WARNING: Block quote ends without a blank line; unexpected unindent.

* Doctest dictionary ordering problem in misc.py.

There was an ordering problem while running the doctest in misc.py.
Sorting the dictionary with pprint and updating the results fixed the
issue.

Document: util/misc
-------------------
**********************************************************************
File "../../pwnlib/util/misc.py", line ?, in default
Failed example:
    sizes
Expected:
    {'eax': 32, 'ax': 16, 'al': 8, 'ah': 8, 'ebx': 32, 'bx': 16, 'bl': 8, 'bh': 8, 'ecx': 32, 'cx': 16, 'cl': 8, 'ch': 8, 'edx': 32, 'dx': 16, 'dl': 8, 'dh': 8, 'edi': 32, 'di': 16, 'esi': 32, 'si': 16, 'ebp': 32, 'bp': 16, 'esp': 32, 'sp': 16}
Got:
    {'si': 16, 'cx': 16, 'cl': 8, 'dl': 8, 'dh': 8, 'eax': 32, 'bx': 16, 'sp': 16, 'bl': 8, 'bh': 8, 'di': 16, 'esi': 32, 'edx': 32, 'dx': 16, 'ebx': 32, 'ebp': 32, 'ax': 16, 'ch': 8, 'al': 8, 'ah': 8, 'edi': 32, 'esp': 32, 'bp': 16, 'ecx': 32}
**********************************************************************
File "../../pwnlib/util/misc.py", line ?, in default
Failed example:
    bigger
Expected:
    {'eax': ['eax'], 'ax': ['eax', 'ax'], 'al': ['eax', 'ax', 'al'], 'ah': ['eax', 'ax', 'ah'], 'ebx': ['ebx'], 'bx': ['ebx', 'bx'], 'bl': ['ebx', 'bx', 'bl'], 'bh': ['ebx', 'bx', 'bh'], 'ecx': ['ecx'], 'cx': ['ecx', 'cx'], 'cl': ['ecx', 'cx', 'cl'], 'ch': ['ecx', 'cx', 'ch'], 'edx': ['edx'], 'dx': ['edx', 'dx'], 'dl': ['edx', 'dx', 'dl'], 'dh': ['edx', 'dx', 'dh'], 'edi': ['edi'], 'di': ['edi', 'di'], 'esi': ['esi'], 'si': ['esi', 'si'], 'ebp': ['ebp'], 'bp': ['ebp', 'bp'], 'esp': ['esp'], 'sp': ['esp', 'sp']}
Got:
    {'si': ['esi', 'si'], 'cx': ['ecx', 'cx'], 'cl': ['ecx', 'cx', 'cl'], 'dl': ['edx', 'dx', 'dl'], 'dh': ['edx', 'dx', 'dh'], 'eax': ['eax'], 'bx': ['ebx', 'bx'], 'sp': ['esp', 'sp'], 'bl': ['ebx', 'bx', 'bl'], 'bh': ['ebx', 'bx', 'bh'], 'di': ['edi', 'di'], 'esi': ['esi'], 'edx': ['edx'], 'dx': ['edx', 'dx'], 'ebx': ['ebx'], 'ebp': ['ebp'], 'ax': ['eax', 'ax'], 'ch': ['ecx', 'cx', 'ch'], 'al': ['eax', 'ax', 'al'], 'ah': ['eax', 'ax', 'ah'], 'edi': ['edi'], 'esp': ['esp'], 'bp': ['ebp', 'bp'], 'ecx': ['ecx']}
**********************************************************************
File "../../pwnlib/util/misc.py", line ?, in default
Failed example:
    smaller
Expected:
    {'eax': ['ax', 'al', 'ah'], 'ax': ['al', 'ah'], 'al': [], 'ah': [], 'ebx': ['bx', 'bl', 'bh'], 'bx': ['bl', 'bh'], 'bl': [], 'bh': [], 'ecx': ['cx', 'cl', 'ch'], 'cx': ['cl', 'ch'], 'cl': [], 'ch': [], 'edx': ['dx', 'dl', 'dh'], 'dx': ['dl', 'dh'], 'dl': [], 'dh': [], 'edi': ['di'], 'di': [], 'esi': ['si'], 'si': [], 'ebp': ['bp'], 'bp': [], 'esp': ['sp'], 'sp': []}
Got:
    {'si': [], 'cx': ['cl', 'ch'], 'cl': [], 'dl': [], 'dh': [], 'eax': ['ax', 'al', 'ah'], 'bx': ['bl', 'bh'], 'sp': [], 'bl': [], 'bh': [], 'di': [], 'esi': ['si'], 'edx': ['dx', 'dl', 'dh'], 'dx': ['dl', 'dh'], 'ebx': ['bx', 'bl', 'bh'], 'ebp': ['bp'], 'ax': ['al', 'ah'], 'ch': [], 'al': [], 'ah': [], 'edi': ['di'], 'esp': ['sp'], 'bp': [], 'ecx': ['cx', 'cl', 'ch']}
**********************************************************************
1 items had failures:
   3 of  20 in default
20 tests in 1 items.
17 passed and 3 failed.
***Test Failed*** 3 failures.

* Fix for docstring warning in packing.py.

The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/util/packing.py:docstring of pwnlib.util.packing.flat:2: WARNING: Inline emphasis start-string without end-string.

* Removed commented out test in Dockerfile.

* Forgot to update location of requirements.txt.

Forgot to update the location of requirements.txt in .travis.yml.

* Made recommended changes from Arusekk.
2019-09-23 08:47:43 +02:00
Arusekk e6dc71c6a8 Merge branch 'dev' into dev3 2019-09-22 15:52:46 +02:00
Arusekk 53b2b0d2e7 Merge branch 'beta' into dev 2019-09-22 15:50:54 +02:00
Arusekk e3690538e7 Merge branch 'stable' into beta 2019-09-22 15:22:02 +02:00
WGH ecd6d235cd Fix TypeError: find_module() takes exactly 3 arguments (2 given) (#1342)
pwnlib.shellcraft installs its custom import finder (LazyImporter) into
sys.meta_path.

According to PEP 302, finder is expected to have prototype

    finder.find_module(fullname, path=None)

Note that the second argument is optional. pwnlib's LazyImporter has second
argument required, which leads to compatibility problems, surfacing
when trying to use pwnlib with other third-party modules:

    >>> import pwnlib
    >>> import faker
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/tmp/.venv/lib/python2.7/site-packages/faker/__init__.py", line 2, in <module>
        from faker.factory import Factory  # noqa F401
      File "/tmp/.venv/lib/python2.7/site-packages/faker/factory.py", line 12, in <module>
        from faker.config import AVAILABLE_LOCALES, DEFAULT_LOCALE, PROVIDERS
      File "/tmp/.venv/lib/python2.7/site-packages/faker/config.py", line 15, in <module>
        AVAILABLE_LOCALES = find_available_locales(PROVIDERS)
      File "/tmp/.venv/lib/python2.7/site-packages/faker/utils/loading.py", line 45, in find_available_locales
        provider_module = import_module(provider_path)
      File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
        __import__(name)
      File "/tmp/.venv/lib/python2.7/site-packages/faker/providers/internet/__init__.py", line 4, in <module>
        from text_unidecode import unidecode
      File "/tmp/.venv/lib/python2.7/site-packages/text_unidecode/__init__.py", line 6, in <module>
        _replaces = pkgutil.get_data(__name__, 'data.bin').decode('utf8').split('\x00')
      File "/usr/lib64/python2.7/pkgutil.py", line 576, in get_data
        loader = get_loader(package)
      File "/usr/lib64/python2.7/pkgutil.py", line 462, in get_loader
        return find_loader(fullname)
      File "/usr/lib64/python2.7/pkgutil.py", line 473, in find_loader
        loader = importer.find_module(fullname)
    TypeError: find_module() takes exactly 3 arguments (2 given)
2019-09-22 15:17:21 +02:00
Arusekk d2423f7117 Unified text_type in py3 2019-08-28 15:07:42 +02:00
Arusekk 9243ae7f26 No print statements in py3
bytes are bytes under py3
2019-08-28 14:44:39 +02:00
Arusekk fe700b08fb Merge branch 'dev' into dev3 2019-08-28 11:50:27 +02:00
Arusekk b784d3a683 Merge branch 'beta' into dev 2019-08-28 11:48:06 +02:00
Arusekk cebd26d85f Merge branch 'stable' into beta 2019-08-28 11:29:54 +02:00
io12 58a846c84d Add freebsd generic syscall templates (#1285)
* Add freebsd generic syscall templates

* Update pwnlib/shellcraft/templates/aarch64/freebsd/syscall.asm

Co-Authored-By: io12 <[email protected]>

* Update pwnlib/shellcraft/templates/aarch64/freebsd/syscall.asm

Co-Authored-By: io12 <[email protected]>

* Update pwnlib/shellcraft/templates/amd64/freebsd/syscall.asm

Co-Authored-By: io12 <[email protected]>

* Update pwnlib/shellcraft/templates/arm/freebsd/syscall.asm

Co-Authored-By: io12 <[email protected]>

* Update pwnlib/shellcraft/templates/i386/freebsd/syscall.asm

Co-Authored-By: io12 <[email protected]>

* Update pwnlib/shellcraft/templates/mips/freebsd/syscall.asm

Co-Authored-By: io12 <[email protected]>

* Update pwnlib/shellcraft/templates/thumb/freebsd/syscall.asm

Co-Authored-By: io12 <[email protected]>

* Update FreeBSD syscall templates to use reversed() for stack args

* Change assignment of ABIs

* Unify sigreturn ABIs with `sysv_*`

* Fix reversed() errors
2019-08-27 11:25:46 +02:00
Arusekk c6b855dd65 Merge branch 'dev' into dev3 2019-08-27 10:52:31 +02:00
lockshaw 5d2798750d Fix timeout parameter passing in sendlineafter and other similar functions (#1277)
* Fix parameter order of sendlineafter

* Fix the same bug for the other functions in tube.py

* Update the docstrings
2019-08-27 10:32:24 +02:00
Arusekk 977f3f7314 Improve doctest coverage (#1275)
* Improve util.proc doctest coverage

* Improve util.crc coverage

* Triggering doctests for getdents and buffer

* Processes behave dynamically
2019-08-27 10:21:47 +02:00
WildfootWandArusekk 47e967238c dev3 update README.md installation part (#1338)
* dev3 update README.md installation part

* Update require python version in README.md

Co-Authored-By: Arusekk <[email protected]>
2019-08-27 10:20:59 +02:00
Arusekk 460c42be90 Fixed ROP better 2019-08-09 13:03:48 +02:00
Arusekk d1a6051360 Fix term and ROP strange behaviour 2019-08-09 11:40:49 +02:00
Arusekk 544ae930c7 Fix gdb for remote processes 2019-07-08 14:43:23 +02:00
Arusekk dce8fde0b6 Fix AttributeError instead of EOFError 2019-07-08 13:44:47 +02:00
Arusekk b0e1ce334e A fix reverted 2019-06-23 00:08:12 +02:00
Arusekk 75000ba16a Various commandline/rop fixes 2019-06-22 23:42:55 +02:00
Arusekk 8ffac64fdc Merge branch 'dev' into dev3 2019-06-22 23:40:43 +02:00
Aaron 6f127e7305 [dev3] Minor changes for python3 support (#1310)
* Removed old dependency for intervaltree and sortedcontainers

Also make the pwn command show usage if no arguments supplied

* Fix errno subcommand

The errno library moved out of os and into its own library

* Change template script to use system env python instead of only py2

* Require updated intervaltree in setup.py

* Update .travis.yml

* Update .travis.yml
2019-06-22 21:50:39 +02:00
Arusekk b2130e319c Tubes with context.encoding (#1317)
* Tubes fixed

* Typo

* Typo + default value

* Fixes on and on

* Many many more

* Missing lines and tests

* Refactoring

* Missing line again

* Missing again

* Copypaste design patterns
2019-06-22 21:19:15 +02:00
Calle Svensson 64f97dfc36 Fixes #1279 (#1304)
* Fixes #1279

* Remove redundant include
2019-05-08 15:09:28 +02:00
cclauss c15afc592a Identity is not the same thing as equality in Python (#1306)
Use ==/!= to compare str, bytes, and int literals: __fmt is not 'raw'__ --> __fmt != 'raw'__

$ __python__
```python
>>> raw = 'ra'
>>> raw += 'w'
>>> raw
'raw'
>>> raw == 'raw'
True
>>> raw is 'raw'
False
```
2019-05-08 15:00:45 +02:00
Zach Riggle 1b55c988b0 Merge pull request #1288 from cclauss/patch-1
Travis CI: The 'sudo' tag is now deprecated
2019-05-07 17:35:25 -05:00
Zach Riggle b3694ab6cb Merge pull request #1292 from xairy/stable
Provide correct arch name to gdb for sparc64
2019-05-07 17:35:10 -05:00
Zach Riggle 7e4477c08b Merge pull request #1297 from ZetaTwo/dev
Quotes around file path in gdbscript - Fixes #1291
2019-05-07 17:34:52 -05:00
Zach Riggle 587f7492b8 Merge pull request #1298 from ZetaTwo/issue-1295
Replace "lsb-release" with "lsb_release" in install script - fixes #1295
2019-05-07 17:34:25 -05:00
Zach Riggle 78be10fdf5 Merge pull request #1300 from ZetaTwo/issue-1289-2
Implements "-c" in "phd" (inefficient) - fixes issue 1289
2019-05-07 17:34:02 -05:00
Zach Riggle 4ac9aa3d1d Merge pull request #1302 from ZetaTwo/issue-1278
Don't try to set non-existing fd to non-blocking - fixes #1278
2019-05-07 17:32:47 -05:00
Calle Svensson 78326b3cf7 Don't try to set non-existing fd to non-blocking, #1278 2019-05-06 23:01:02 +02:00
Calle Svensson 1869148ab8 Implements an (inefficient) solution to issue #1289 2019-05-06 22:25:12 +02:00
Calle Svensson 7f17166aef fixes #1295 2019-05-06 22:02:05 +02:00
Calle Svensson 6c14bc4f0f Fixes #1291 2019-05-06 21:59:36 +02:00
bannsec 4cb67a857e Py3 bytes issue (#1282)
This fixes the following error attempting to use gdb module:

```
~/.virtualenvs/angr/lib/python3.6/site-packages/pwnlib/gdb.py in debug(args, gdbscript, exe, ssh, env, sysroot, **kwargs)
    468
    469     # Some versions of gdbserver output an additional message
--> 470     garbage2 = gdbserver.recvline_startswith("Remote debugging from host ", timeout=1)
    471
    472     return gdbserver

~/.virtualenvs/angr/lib/python3.6/site-packages/pwnlib/tubes/tube.py in recvline_startswith(self, delims, keepends, timeout)
    545         return self.recvline_pred(lambda line: any(map(line.startswith, delims)),
    546                                   keepends=keepends,
--> 547                                   timeout=timeout)
    548
    549     def recvline_endswith(self, delims, keepends = False, timeout = default):

~/.virtualenvs/angr/lib/python3.6/site-packages/pwnlib/tubes/tube.py in recvline_pred(self, pred, keepends, timeout)
    468                     return b''
    469
--> 470                 if pred(line):
    471                     if not keepends:
    472                         line = line[:-len(self.newline)]

~/.virtualenvs/angr/lib/python3.6/site-packages/pwnlib/tubes/tube.py in <lambda>(line)
    543             delims = (delims,)
    544
--> 545         return self.recvline_pred(lambda line: any(map(line.startswith, delims)),
    546                                   keepends=keepends,
    547                                   timeout=timeout)

TypeError: startswith first arg must be bytes or a tuple of bytes, not str
```
2019-04-30 16:37:56 +02:00
Andrey Konovalov 94bb5fde0f Provide correct arch name to gdb for sparc64
"sparc64" is not correct gdb arch name, set it to "sparc:v9" instead.
2019-04-20 15:27:35 +02:00
cclauss a5f4758cbc Travis CI: The 'sudo' tag is now deprecated
[Travis are now recommending removing the __sudo__ tag](https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration).

"_If you currently specify __sudo: false__ in your __.travis.yml__, we recommend removing that configuration_"
2019-03-29 13:14:33 +01:00
Arusekk cf6be82831 Fix that regression for sure
Oh dear not again
2019-02-22 09:52:07 +01:00
Arusekk 7db624bc28 Fix merge regression 2019-02-22 09:18:00 +01:00
Arusekk 24e9501811 Merge branch 'dev' into dev3 2019-02-22 03:35:13 +01:00
Arusekk 224ddb411b Merge pull request #1181 from jonasbb/coredumpctl-support
Add support for coredumps which are stored using systemd-coredump
2019-02-22 03:18:01 +01:00
Arusekk f5062f7b2d Merge pull request #1274 from Gallopsled/stable
Merge travis-ci related changes on stable into dev
2019-02-22 03:08:43 +01:00
Jonas Bushart e625fc28f3 Add support for coredumps which are stored using systemd-coredump
coredumpctl is a tool that can be used to retrieve and process
core dumps and metadata which were saved by systemd-coredump(8).

systemd-coredump works by setting a piped core pattern. For example:

$ cat /proc/sys/kernel/core_pattern
|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e

This commit detects `systemd-coredump` in the pattern and then uses
`coredumpctl`, which is the CLI utility for reading the coredumps.
`coredumpctl` is instructed to write the coredump to a file. The
coredump is specified using the process ID and the basename of the
executable.

This commit also updates some doc strings to fix them and make them
more useful.

This fixes #1177, #1178
2019-02-21 21:42:09 +01:00
Zach Riggle 3e58f35da2 Merge pull request #1267 from Mrmaxmeier/cfg-6
fix(py3/config): six.string_types instead of (str, unicode)
2019-02-07 08:51:58 -06:00
Mrmaxmeier 915fdef9df fix(py3/config): six.string_types instead of (str, unicode) 2019-02-07 14:29:07 +01:00
Zach Riggle d01256ef2b Merge pull request #1265 from Arusekk/disasm-1263
Long instructions disassembly without empty lines
2019-02-05 14:50:11 -06:00
Arusekk e5c8b8c288 Long instructions disassembly without empty lines
Fixes #1263
2019-02-03 15:29:55 +01:00
Zach Riggle 5fa4fcd051 Merge pull request #1182 from leommxj/dev
fix:shellcraft mips dupsh wrong redirect
2019-02-02 03:25:04 -06:00
Zach Riggle 4a4b4dcc40 Merge pull request #1186 from quantumbracket/dev
ssl custom arguments
2019-02-02 03:18:26 -06:00
Zach Riggle 239e4e4752 Do not use a dict *instance* as the default arg
While this likely won't cause issues due to the way it's used, better safe than sorry
2019-02-02 03:18:10 -06:00
Zach Riggle 3a033135fb Merge pull request #1230 from Gallopsled/ssh-attach-fix-exe-path
Fix `gdb.attach()` using a local path for remote files.
2019-02-02 03:05:58 -06:00
Zach Riggle 32762bfdb0 Merge pull request #1247 from zachriggle/fix-1244
Fix infinite loop in term.py
2019-02-02 03:01:27 -06:00
Zach Riggle 547905fae4 Merge pull request #1264 from foens/stable
Fix small issues in thumb shellcode
2019-02-02 03:01:03 -06:00
Kasper Føns dec0e1d71f add doctest 2019-02-01 16:35:17 +01:00
Zach Riggle 0d56697583 Merge branch 'stable' into stable 2019-02-01 08:53:30 -06:00
Zach Riggle c03d08b1c4 Merge pull request #1260 from Arusekk/travis-xenial-1260
Switch Travis CI to 16.04 (xenial)
2019-02-01 08:53:14 -06:00
Kasper Føns aeee34f62b Fix erroneous comment 2019-02-01 15:26:49 +01:00
Kasper Føns 3f1dc93245 Fix wrong import of mov instruction 2019-02-01 15:26:28 +01:00
Arusekk 20e9fc2f53 Fix typo 2019-01-31 11:53:38 +01:00
Arusekk c54ad5647d Spawning a process to test its name 2019-01-31 11:47:59 +01:00
Arusekk 010c17dd6f Re-apply #282 changes 2019-01-31 11:14:25 +01:00
Zach Riggle 734f91efdd Remove inaccurate / outdated statement
Pwntools does not bundle any GNU tools for a long time.
2019-01-31 04:10:24 -06:00
Arusekk d5e02f27ac util.proc portability 2019-01-31 10:53:27 +01:00
Arusekk 9609374e97 Fix punctuation in disassemblies 2019-01-31 09:52:48 +01:00
Zach Riggle daa87d6438 Merge branch 'beta' into dev 2019-01-30 17:11:56 -06:00
Zach Riggle 3eac01ed89 Merge branch 'stable' into beta 2019-01-30 17:11:43 -06:00
Zach Riggle 3ecd151f2b Merge branch 'stable' into travis-xenial-1260 2019-01-28 16:47:39 -06:00
Zach Riggle bf10bd70f8 Merge pull request #1252 from Gallopsled/zachriggle-patch-1
Fixes args exception with "=="
2019-01-28 16:47:26 -06:00
Zach Riggle 00bbef79bd Merge branch 'stable' into travis-xenial-1260 2019-01-28 16:47:14 -06:00
Zach Riggle 97ef2d3a74 Merge pull request #1224 from Arusekk/full-3-compat
Python 3 compatibility [ready]
2019-01-28 15:36:19 -06:00
Shivam Beeyani 1ee1488897 Update elf.py (#1235) 2019-01-28 15:24:56 -06:00
Zach Riggle afa7753f87 Merge branch 'stable' into zachriggle-patch-1 2019-01-28 15:24:43 -06:00
Arusekk 39dd2c3fe3 Fixed race condition (#1258)
ssh_channel.close() being called from ssh_channel.recvall()
2019-01-28 15:24:30 -06:00
Zach Riggle 59fe841fe5 Specify Python version and cache directories 2019-01-28 14:43:59 -06:00
Arusekk e6cd97945b Revert "[travis] Try libc6 when ld fails"
This reverts commit f43fd912f6.
2019-01-26 17:13:59 +01:00
Arusekk bb29050756 Revert "[travis] Try libc6 harder"
This reverts commit ab512f7bae.
2019-01-26 17:11:39 +01:00
Arusekk c9fb770507 Switch Travis CI to 16.04 (xenial)
Ubuntu 16.04 finally includes `binutils-mips-linux-gnu`,
which is required.  So there is no need to download
packages manually anymore.  This can help supporting
python 3.
2019-01-26 10:17:44 +01:00
Arusekk cb5c619da9 Revert "Limit the 32-bit complaint to python 2"
This reverts commit ef8d51f518.
2019-01-26 10:10:49 +01:00
Arusekk 8a099d3c2f Fixed race condition
ssh_channel.close() being called from ssh_channel.recvall()
2019-01-24 16:56:27 +01:00
Arusekk 71d44f89ca Remove a todo, trigger rebuild 2019-01-24 11:42:45 +01:00
Arusekk f5711289ce Merge branch 'dev' into full-3-compat 2019-01-24 10:46:59 +01:00
Arusekk ef8d51f518 Limit the 32-bit complaint to python 2 2019-01-24 10:44:21 +01:00
Arusekk 96127c3eaf binutils fixes 2019-01-24 00:05:53 +01:00
Zach Riggle 431cbddcf9 Revert "Slightly improve dupio with loop opcode (#1223)"
This reverts commit 24a9f92a7b.
2019-01-23 16:29:37 -06:00
Arusekk 1ba45e7de8 [tests] expect systemd instead of init 2019-01-23 09:53:50 +01:00
Arusekk 3473400619 [travis] try dist: xenial 2019-01-23 01:14:29 +01:00
Arusekk 67002e3758 [travis] try dist: bionic 2019-01-23 01:10:44 +01:00
Arusekk b486169389 [travis] try automatic config 2019-01-23 00:51:20 +01:00
Arusekk ab512f7bae [travis] Try libc6 harder 2019-01-22 22:18:18 +01:00
Arusekk f43fd912f6 [travis] Try libc6 when ld fails 2019-01-22 21:39:27 +01:00
Arusekk 79e4a269c4 Merge branch 'dev' into full-3-compat 2019-01-22 20:46:10 +01:00
Zach Riggle 927d69986c Upgrade Travis deb files to Bionic (#1255)
Fixes #1254
2019-01-22 12:37:45 -06:00
Arusekk d0a49dbf76 Does ld have different requirements? 2019-01-21 12:49:24 +01:00
Arusekk 1bd049a7bb Fix bytes iteration difference under python 3.
Sorry for overlooking this.
2019-01-21 11:54:10 +01:00
Zach Riggle 19eed571a5 Fixes args exception with "=="
Fixes #1249
2019-01-20 22:47:35 -06:00
Arusekk 351031958d Travis installation please 2019-01-20 17:05:39 +01:00
Arusekk 7a44b2cae0 Try skipping travis-specific installation 2019-01-20 16:18:24 +01:00
Arusekk 0cb5fcb9cc Merge branch 'dev' into full-3-compat 2019-01-16 08:42:19 +01:00
Robert Larsen db8ab632ca Fixed faulty read loop (#1239)
* Fixed faulty read loop

* Added doctest

* Exercise more stager functionality in doctest

* Fix whitespace in doctest

* Fix prefix in doctest

* Fix result alignment in doctest
2019-01-15 19:31:24 -06:00
Moshe Rubin 1acebdc0ec Update elf.py (#1248)
Corrected "in-pace" to read "in-place"
2019-01-15 19:30:33 -06:00
Zach Riggle 61968df85c Fix infinite loop in term.py
If the last character is an escape sequence, and we have entered graphics_mode,
the loop will never exit.

Fixes #1244
2019-01-07 15:51:25 -06:00
Zach Riggle 323ccd08f8 Update CHANGELOG for 3.12.2 2019-01-07 15:15:06 -06:00
Zach Riggle ec00cb3f90 Merge branch 'beta' into dev 2019-01-07 15:09:54 -06:00
Zach Riggle 5befb2f01d Merge branch 'stable' into beta 2019-01-07 15:09:13 -06:00
Kyle Zeng 0dc0a9acc0 check qemu_path correctly and give out a reasonable error msg (#1243) 2019-01-07 14:42:24 -06:00
Zach Riggle 774ed3b85e Do not use intervaltree 3.xx (#1242)
In the future, we may want to update Pwntools to use the newer version.

In the meantime, pin to 2.xx
2018-12-28 23:19:54 -06:00
Francesco Cagnin 3123ffe6a7 Fix typo in the help message of pwn disasm 2018-12-21 10:19:34 +01:00
Arusekk bb7653144c Features in pwn/toplevel 2018-12-01 16:28:01 +01:00
Arusekk c117ec436a Further cleanup 2018-12-01 14:49:57 +01:00
Arusekk dd62e5527e Cleanup 2018-11-27 13:30:57 +01:00
Arusekk dc2be3ae0c sorted(..., key=repr) was yet needed 2018-11-27 10:00:15 +01:00
Arusekk af7fb665ca Fixes requested by Zach Riggle 2018-11-26 23:16:34 +01:00
Zach Riggle e827c8b9f0 Update gdb.py 2018-11-23 17:00:53 -06:00
Zach Riggle b0d3e42686 Fix typo
Closes #1221
2018-11-23 16:53:41 -06:00
Arusekk 68627b0c03 Revert to original useragents.random() and give up 2018-11-22 15:42:00 +01:00
Arusekk 0b82b7c82f Fix indeterministic behavior: dict, random.choice
It's finally working!
2018-11-22 13:44:29 +01:00
Arusekk 27d8a7d615 Doctest bytes part 4 2018-11-22 12:50:12 +01:00
Arusekk 03ff7a568d Doctest bytes part 3 2018-11-22 11:29:15 +01:00
Arusekk 6bd621d7f3 Doctest bytes part 2 2018-11-21 17:35:01 +01:00
Arusekk c6154e81bf Fix python 2 regression 2018-11-21 16:45:18 +01:00
Arusekk 674943747d Doctest bytes part 1 2018-11-21 00:16:05 +01:00
Arusekk 8a2a6adeb4 Fix python 2 doctests again 2018-11-20 23:36:01 +01:00
Arusekk c13791d403 Fix wrong merge 2018-11-20 22:34:53 +01:00
Arusekk 859f884214 Merge branch 'dev' into full-3-compat 2018-11-16 20:10:49 +01:00
Arusekk bf04f1a66d Prepare for b'some_string' doctests 2018-11-16 19:53:06 +01:00
Benno Fünfstück 6a094ec4b0 fix(tests): avoid RecursionError due to weird monkey patching (#1225)
Instead of patching the whole class which produced a RecursionError we now only
patch a single function which should be less invasive.

An example of how this bug manifests can be found at https://gist.github.com/bennofs/6252b45bd026d7e95dbacf7615159ed5.
2018-11-13 14:55:15 -06:00
Arusekk 24a9f92a7b Slightly improve dupio with loop opcode (#1223) 2018-11-12 18:52:58 -06:00
Arusekk 218eb308e8 Prettify some modules 2018-11-12 15:55:10 +01:00
Arusekk 2a7d7251ef Fix ssh download infinite loop 2018-11-12 11:01:17 +01:00
Arusekk 187258792b Fix doctests under python 3 2018-11-12 00:21:50 +01:00
Arusekk 7950e75d48 Fix safeeval with python 3.6 16-bit bytecode
Reference:
https://bugs.python.org/issue26647
2018-11-11 10:03:58 +01:00
Arusekk fec31f3382 Fix python 2 regression on hexdump 2018-11-11 07:12:33 +01:00
Arusekk 566ec386eb Enable python3 testing in .travis.yml 2018-11-10 23:05:22 +01:00
Arusekk 7c8b05539d Fixed arm alphanumeric encoder support for python3 2018-11-10 22:32:42 +01:00
Arusekk ada8a9bdd0 CLI and GDB fixes 2018-11-10 22:32:42 +01:00
Arusekk c8a21cabd3 Adb wait-for-device fix 2018-11-10 22:32:42 +01:00
Arusekk 435b646880 Some fixes in pwntools cli 2018-11-10 22:32:42 +01:00
Arusekk f3d0654f97 file keyword removed, fix doctests 2018-11-10 22:32:42 +01:00
Arusekk e94b071234 Fixed setup failing with pandoc present 2018-11-10 22:32:42 +01:00
Arusekk fd7794b3d4 Some fixes 2018-11-10 22:32:42 +01:00
Arusekk 591e4012e1 Fixed non-ascii keys in readline 2018-11-10 22:32:42 +01:00
Arusekk 1679232515 Fixed readline history 2018-11-10 22:32:42 +01:00
Arusekk 40cb4e9034 Env values can contain bad characters 2018-11-10 22:32:42 +01:00
Arusekk 007d0a9b28 Update setup.py 2018-11-10 22:32:42 +01:00
Arusekk 616d2eb61c Lonely undocumented files happen 2018-11-10 22:32:42 +01:00
Arusekk ddb83dfa38 Fix last xrange 2018-11-10 22:32:42 +01:00
Arusekk 5a15d03224 Fixes for process and ssh compatibility with python3 2018-11-10 22:32:42 +01:00
Arusekk cbb54fb74b Fixed tube.interactive() and tube.stream() strange behaviour under python3 2018-11-10 22:32:42 +01:00
Arusekk a72ff4acb0 Fixed android bootloader module for python3 2018-11-10 22:32:42 +01:00
Arusekk 495a11bbd9 Interactive prompt fix for python3 2018-11-10 22:32:42 +01:00
Arusekk 1ca5cc9467 Made adb to be more python3-compatible 2018-11-10 22:32:42 +01:00
Arusekk 08e9c029ae Further improvements 2018-11-10 22:32:37 +01:00
Arusekk 7a492c6ab3 First python 3 version of up-to-date pwntools 2018-11-10 22:27:49 +01:00
Arusekk 7b5ba5cdc2 Fixed numeric literals for python 3 2018-10-29 21:24:39 +01:00
Arusekk 30a3ed454c Generating python3-compatible constants 2018-10-29 21:24:39 +01:00
Arusekk 57f0ebd762 Python 3 by-hand improvements 2018-10-29 21:24:39 +01:00
Zach Riggle da4a5c4e30 KernelConfig: Fix some typos 2018-10-22 13:28:17 -05:00
Zach Riggle d9e1118f0b Merge branch 'beta' into dev 2018-10-17 13:15:36 -05:00
Zach Riggle b8c826e057 Merge branch 'stable' into beta 2018-10-17 13:15:07 -05:00
joesixpack666 292b81af17 close ssh_channel properly in download() (#1208) (#1209)
* close ssh_channel properly in download() (#1208)

* Update ssh.py
2018-10-17 13:14:20 -05:00
Jörg Thalheim 5359ea76ed corefile: expose address to argc/argv/envp (#1200)
This is useful to reconstruct register state of main even
when the stack is smashed.
As the value is already calculated this does not add much code.
2018-10-08 20:31:17 -05:00
kpcyrd c3c06a3486 Docker: Kill 14 layers in pwntools base images (#1202)
* Docker: Kill 14 layers in pwntools base images

* Docker: Update line wrapping
2018-10-04 13:50:35 -05:00
Zach Riggle 1c99aadaef term: Defer text initialization
Closes #1201
2018-10-03 15:09:38 -05:00
leommxj 58967ddfe0 Rename dup to dupio and Modify dupsh/dupio 2018-09-18 22:31:28 +08:00
Zach Riggle c89bed2555 Merge branch 'beta' into dev 2018-09-17 17:19:10 -05:00
Zach Riggle c627115b85 Merge tag '3.12.1' into beta 2018-09-17 17:18:24 -05:00
Zach Riggle c7e9778007 Update to 3.12.1 2018-09-17 17:17:07 -05:00
Zach Riggle 90056fbeca Version bump to 3.12.1 2018-09-17 17:11:45 -05:00
Zach Riggle 60df8107c0 corefile: Update NT_XXX type names for pyelftools==0.25 (#1198)
* corefile: Update NT_XXX type names for pyelftools==0.25

* travis: Do not use Sphinx version 1.8.0, it fails with recursive errors

* corefile: Fix stack detection and Mapping.__contains__ logic

* corefile: Better detection of AT_EXECFN when NT_AUXV does not have it

* corefile: Avoid trying to parse corrupt stacks

* Fix doctests for new warning

* log: Fix warning_once caching
2018-09-17 17:04:40 -05:00
Zach Riggle 76f366d181 Update CHANGELOG for 3.12.1 2018-09-17 14:59:27 -05:00
n00bSec 9fe9152617 Add .set noat directive to fix MIPS shellcode assembly. (#1188) 2018-09-17 14:30:10 -05:00
Ricky Zhou 7467402ecf Work around renamed ENUM_P_TYPE variables in elftools 0.25 and up. 2018-09-17 14:07:24 -05:00
quantumbracket 5fe760e70b ssl custom arguments 2018-08-23 21:20:59 -04:00
leommxj 59a75055cf adding dup() to mips 2018-08-14 19:01:29 +08:00
leommxj c336932ccf fix:shellcraft mips dupsh wrong redirect 2018-08-09 19:06:10 +08:00
Zach Riggle b666e9eee1 mips: Enable XOR encoder
The encoder was never actually enabled, since we didn't set the
architecture appropriately.
2018-07-19 14:33:01 -05:00
Jörg Thalheim 9023b383af corefile: also expose page_offset (#1169)
* corefile: also expose page_offset

This is useful to load the code from the original files.

* Undo constructor field reordering

* Fix ordering in Mapping instantiation

* Commas are important

* corefile: also put page_offset as last parameter
2018-07-02 22:27:39 -05:00
Zach Riggle 0d25ca35e1 Merge branch 'beta' into dev 2018-07-02 16:58:16 -05:00
Zach Riggle 7dc76c745f Merge branch 'stable' into beta 2018-07-02 16:57:53 -05:00
Zach Riggle 80e12c7031 Switch FTP servers to ftp.ubuntu.com
Fixes Gallopsled/pwntools#1172
2018-07-02 16:57:16 -05:00
Zach Riggle b7609ae4a3 Update changelog for 3.12.1 2018-06-19 12:16:43 -05:00
Mathias Svensson 8970156e8a Revert "Fix #1164 (#1165)" (#1167)
This reverts commit 8e704e72d3.
2018-06-12 13:51:59 -05:00
Mathias Svensson 8e704e72d3 Fix #1164 (#1165) 2018-06-11 18:20:39 +02:00
pwn f4159bdad4 check if ":" exists before index(':') (#1159)
* check if ":" exists before index(':')

* Update proc.py
2018-06-04 11:13:03 -05:00
Zach Riggle c09091055f Merge remote-tracking branch 'upstream/stable' into beta 2018-05-31 15:23:13 -05:00
Zach Riggle 26e6bce81a Fix broken versions of package dependencies (#1162)
Fixes Gallopsled/pwntools#971
Fixes Gallopsled/pwntools#1154
Fixes Gallopsled/pwntools#1160
2018-05-31 15:22:45 -05:00
Inndy 6af09645e7 Prevent crash from not existed cache file in ssh.checksec() (#1150)
* Prevent crash from not existed cache file in ssh.checksec()

* Use path.exists instead of exception handling

* Fix space

* Update ssh.py
2018-05-30 14:35:23 -05:00
Robin Leander Schröder 338fbeba7a Improve pwnup template, gdbserver detection (#1148)
* Improve pwnup template

* Don't want to break at main again if its been hit already

* Always start the program

* Handle extra newline printed by gdb

* Remove moved recvline

* Remove controversial set sysroot

* Update gdb.py

* Update pwnup.mako
2018-05-30 14:32:44 -05:00
Arusekk 8da0827c25 Replaced it.next() with next(it) as of PEP-3114 (#1136)
This will also get us closer to python3.
See https://www.python.org/dev/peps/pep-3114/
2018-05-30 13:32:56 -05:00
Bruce Chen 146348f514 fix wrong gadget selection in setRegisters() (#1118) (#1156)
* fix wrong gadget selection in setRegisters() (#1118)

* Fix detection logic

* Update rop.py

* add test cases for filtering out the bad instructions in rop.py
2018-05-30 13:31:33 -05:00
Michael Rodler fe6619b336 fixed called to qemu.ld_prefix passing env dict as target (#1152) 2018-05-25 16:21:57 -05:00
Zach Riggle 1fbff016f9 Merge branch 'beta' into dev 2018-05-25 14:39:38 -05:00
Zach Riggle eeedb2c10b Merge remote-tracking branch 'upstream/stable' into beta 2018-05-25 14:38:34 -05:00
Bruce Chen 5ae13e8c8c switch to trusty build in travis ci and fix some test cases (#1155) 2018-05-25 14:38:06 -05:00
Arusekk 20cb04984a Replaced except X,Y: with except X as Y: as of PEP-3110 (#1137)
This will also get us closer to python3.
See https://www.python.org/dev/peps/pep-3110/
2018-04-30 16:16:51 -05:00
Zach Riggle 2a4a633e23 Merge remote-tracking branch 'upstream/stable' into beta 2018-04-23 16:21:56 -05:00
Arusekk 3d03a75975 Replace division with floor division as of PEP-238 (#1135)
* Replace division with floor division as of PEP-238

This will also get us closer to python3.
See https://www.python.org/dev/peps/pep-0238/

* Add from __future__ import division to source files
2018-04-11 09:42:34 -07:00
Alexey Vishnyakov 67473560c7 Check libc- as well (#1131) 2018-04-02 14:03:38 -05:00
Zach Riggle ac67b97c4d Add doctests for shellcraft.mips.sh() 2018-04-02 14:02:00 -05:00
Arusekk fc31b51436 Fix MIPS shell shellcraft not working properly (#1129)
Closes #1122
2018-04-02 13:55:45 -05:00
Michael Scherer 93080627b9 Fix compatibility with newer version of sphinx (#1124) 2018-04-02 13:54:40 -05:00
Arusekk 6c794022d5 Remove tuple parameters unpacking due to PEP-3113 (#1119)
* Fix tests relying on broken autocontrib version (#1121)

* Removed tuple parameters unpacking due to PEP-3113

As a step towards python3 compatibility, removed tuple parameters
in :mod:`pwnlib.term.term`. They are now replaced with * unpacking.
See https://www.python.org/dev/peps/pep-3113/
2018-03-19 16:28:18 -05:00
Michael Scherer 6cb9c1fce8 Fix grammar for mips doc (#1123) 2018-03-19 16:26:27 -05:00
Tyler Lambert 1cb0502157 Replace string format char (#1125)
* replace string format char

* add parentheses
2018-03-19 16:26:03 -05:00
Zach Riggle e1b3c27867 Update bootimg.py 2018-03-02 17:40:15 -06:00
Zach Riggle 532f910f9f Update bootimg.py 2018-03-02 17:39:43 -06:00
Zach Riggle c14f1a40d0 Update bootimg.py 2018-03-02 17:39:23 -06:00
Zach Riggle 1854095ee2 Expose adb.BootImage 2018-03-02 15:43:48 -06:00
Zach Riggle 76413fc91c Add pwnlib.adb.bootimg for 'ANDROID!' format boot.img images 2018-03-02 15:41:14 -06:00
Zach Riggle 1f8f294fa3 Expose BootloaderImage.header fields through __getattr__ 2018-03-02 15:40:52 -06:00
Zach Riggle 75b422a046 Fix magic bytes check in pwnlib.adb.bootloader 2018-03-02 15:29:07 -06:00
Zach Riggle 799f9a4f21 Expose BootloaderImage in ADB 2018-03-02 13:49:28 -06:00
Zach Riggle b53ec5e3ce Merge remote-tracking branch 'upstream/stable' into beta 2018-02-28 15:22:16 -06:00
Zach Riggle 9604f7847e Fix tests relying on broken autocontrib version (#1121) 2018-02-28 15:09:35 -06:00
Zach Riggle a28ae524ce Update autoprogram version 2018-02-28 13:22:27 -06:00
Zach Riggle 6e1e96d1c1 Update packages to Artful 2018-02-28 13:18:49 -06:00
Dimos Poupos d67cb152ed Fix input encoding parsing (#1111) 2018-02-23 14:46:28 -06:00
Mathias Svensson aa1f79201b Begin working on 3.14.0 2018-02-22 23:20:05 +01:00
Mathias Svensson 1e6f207956 Release 3.13.0beta0 2018-02-22 16:50:59 +01:00
Mathias Svensson c888a8cbe0 Release 3.12.0 2018-02-22 16:42:25 +01:00
Mathias Svensson 9f9d884790 Merge branch 'beta' into stable 2018-02-22 13:54:37 +01:00
Mathias Svensson 39bc5808ea Update CHANGELOG from dev 2018-02-22 13:54:19 +01:00
Zach Riggle b507bd7ed9 Merge branch 'beta' into dev 2018-02-20 14:50:12 -06:00
Zach Riggle 31f7c61c1f Merge remote-tracking branch 'stable' into beta 2018-02-20 14:49:38 -06:00
Zach Riggle 2a73356c78 Fix test breakage caused by Sphinx deprecation (#1113)
* Fix test breakage caused by Sphinx deprecation

* Fix missing import in RST

Closes #1112
2018-02-20 14:49:09 -06:00
Zach Riggle 758a9549c7 Update CHANGELOG 2018-02-20 12:30:57 -06:00
Zach Riggle 2255b7f546 Update asm.py
Fixes #1108
2018-02-19 12:08:00 -06:00
Andriamilanto T cd8f8d3f8d Removed useragentstring.com as user agents source, fixed BeautifulSoup usages and fetched new UAs (#1107) 2018-02-13 17:33:40 -06:00
david942j 25c84daa8a Fix usage of syscall open in shellcraft templates (#1106) 2018-02-09 12:53:00 -06:00
Arusekk 8a3a577394 Add BUILD_SET to const opcodes (#1103) 2018-02-07 12:43:37 -06:00
eyalitki 90f23df80b Implemented the dump() feature in the DynELF. (#1104)
* Implemented the dump() feature in the DynELF.

* Simplified the return value and made read-only pages optional
2018-02-06 15:14:29 -06:00
Zach Riggle a208251d5f Fix typo (#1099) 2018-01-26 17:40:34 -08:00
Zach Riggle aadf40980d Enable setting context.os via context.binary (#1101)
In order to support this, we detect the interpreter used via PT_INTERP

Currently, Linux is the default and Android is detected based on the path
2018-01-25 15:32:35 -08:00
Zach Riggle 14b2f29d17 Merge branch 'beta' into dev 2018-01-25 10:12:02 -08:00
Zach Riggle 68085012f1 Merge branch 'stable' into beta 2018-01-25 10:11:33 -08:00
Zach Riggle 5fdc08451d Workaround broken "pidof" on older Android emulators 2018-01-25 10:10:56 -08:00
Zach Riggle f3b5a14fb5 Don't accidentally debug init, which causes a kernel panic 2018-01-25 10:10:56 -08:00
Zach Riggle 63dfed74c6 Do not throw an exception if the Corefile cannot be deleted after copy 2018-01-25 10:10:56 -08:00
Dimos Poupos c7c5019b01 Improved hexdump output (#1094)
* improved hexdump output & groupsize feature

* doctest fix

* Parameters rearranged

* Update fiddling.py
2018-01-25 09:41:32 -08:00
Morten Brøns-Pedersen 3ff283cbef unify flat and fit (#1096) 2018-01-25 09:38:25 -08:00
Kristoffer Søholm 9859f54a21 Remove pypandoc as a dependency (#1098)
The project is pretty much unmaintained, and it is much more sane to
assume that the packager has pandoc installed.
2018-01-25 09:36:01 -08:00
Christophe GRENIER 3ff7a9e940 Fix for very old openssl: try sha256 and sha256sum before "openssl sha256" (#1068)
Check for sha256 and sha256sum before trying openssl sha256 as "openssl sha256" doesn't return an error code in some old versions of openssl (OpenSSL 0.9.8g 19 Oct 2007 at least) that doesn't support sha256.
2018-01-23 16:58:56 -08:00
Zach Riggle 7860eecf02 Prevent Python3 installation via "pip3 install pwntools" (#1093)
Pwntools does not work on Python3, so that it installs successfully is misleading.

More information on 'python_requires' can be found here:

    https://packaging.python.org/tutorials/distributing-packages/#python-requires

Specifically, it requires pip 9.0 or better -- but this is the 'official' way to do this.

Fixes Gallopsled/pwntools#1092
2018-01-04 16:42:50 -06:00
Mathias Svensson 5c4def05b2 Start working on 3.13.0dev 2018-01-03 08:23:46 +01:00
Mathias Svensson e50b978398 Release 3.12.0beta0 2018-01-03 08:21:05 +01:00
Mathias Svensson d689805690 Release 3.11.0 2018-01-03 08:19:05 +01:00
Zach Riggle 953e73aa37 Update changelog for 3.11 and 3.12 2018-01-03 08:03:28 +01:00
Mathias Svensson ee9f9fa7de Merge branch 'stable' into beta 2018-01-03 08:02:50 +01:00
Zach Riggle 35789287d8 Update changelog for 3.11 and 3.12 2018-01-02 12:53:30 -06:00
Zach Riggle 7a1ab829eb Expose pwnlib.tubes.server.server in the toplevel 2018-01-02 12:47:43 -06:00
Benno Fünfstück 46a1c44fc9 elf.py: fix variable name typo (fixes dt_rpath undefined var) (#1008) 2018-01-02 11:36:08 -06:00
Zach Riggle 899baec704 Android bootldr extraction, gdb fixes (#1085)
* Add sysroot= argument to gdb.debug, expose via 'pwn debug'

Also sets a sane default sysroot for Android debugging

* Add missing newline for "set deatch-on-fork off"

Introduced in e89a9b66ac

* Add support for extracting Android boot.img

* Fix incorrect variable in 'pwn debug'

* Ensure "file /path/to/file" is the first command
2017-12-21 15:18:38 -06:00
Disconnect3d 932cb57bf9 Better error message when gdbserver fails on LD_PRELOAD (#1083)
When one passes a `LD_PRELOAD` which cannot be preloaded the `process_created` string might end up looking like this:
```
"ERROR: ld.so: object '/bin/bash' from LD_PRELOAD cannot be preloaded (cannot dynamically load executable): ignored.\n"
```

When we end up in such situation, pwndbg shown unintuitive error:
```
$ python -c 'from pwn import *; gdb.debug("/bin/ls", env={"LD_PRELOAD": "/bin/bash"})'
[+] Starting local process '/usr/bin/gdbserver': pid 20691
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "pwnlib/context/__init__.py", line 1349, in setter
    return function(*a, **kw)
  File "pwnlib/gdb.py", line 397, in debug
    port = _gdbserver_port(gdbserver, ssh)
  File "pwnlib/gdb.py", line 234, in _gdbserver_port
    gdbserver.pid   = int(process_created.split()[-1], 0)
ValueError: invalid literal for int() with base 0: 'ignored.'
```

After this patch it will show:
```
$ python -c 'from pwn import *; gdb.debug("/bin/ls", env={"LD_PRELOAD": "/bin/bash"})'
[+] Starting local process '/usr/bin/gdbserver': pid 20863
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "pwnlib/context/__init__.py", line 1349, in setter
    return function(*a, **kw)
  File "pwnlib/gdb.py", line 402, in debug
    port = _gdbserver_port(gdbserver, ssh)
  File "pwnlib/gdb.py", line 236, in _gdbserver_port
    'Failed to spawn process under gdbserver. gdbserver error message: %s' % process_created
ValueError: Failed to spawn process under gdbserver. gdbserver error message: ERROR: ld.so: object '/bin/bash' from LD_PRELOAD cannot be preloaded (cannot dynamically load executable): ignored.

[*] Stopped process '/bin/ls' (pid 20863)
```
2017-12-12 14:22:43 -06:00
Zach Riggle 6a61617c73 Fix emulation of fault_addr (#1066)
As @bennofs noticed, our detection logic was incorrect:

"This is not a good test if I understand the issue correctly.

From my tests, it seems that fault_addr was only null before this patch if it
would've been >= 2**47.

This is because on 64 bit, that's where kernel memory is mapped so we get
"protection fault" instead of "segfault".

A protection fault does not have the same siginfo as a normal segfault:
si_code will be SI_KERNEL = 0x80 and there won't be a fault_addr

(see http://elixir.free-electrons.com/linux/v4.14-rc8/source/kernel/signal.c#L1052)"
2017-12-11 17:48:25 -06:00
Zach Riggle 6944b664e8 Switch server to ftp.ubuntu.org (#1084)
Currently ftp.debian.org is down on port 21

(cherry picked from commit ec5185c0c4)
2017-12-11 17:47:21 -06:00
Devin Neal ab8879afa3 Add server module (#1067)
* add server module

* modify example

* fix travis errors

* add queuing and blocking, fix requests

* add server.rst, change accepter to daemon

* fix import in server.rst

* added server entry in sockets.rst

* fix import in sockets.rst
2017-12-11 17:27:51 -06:00
Zach Riggle d580c0cfd1 Fix imports 2017-12-07 16:22:53 -06:00
bannsec 515f678f2d Adding GNU Screen Support (#1076)
* Adding GNU Screen support

* Adding doc

Fixes Gallopsled/pwntools#1070
2017-12-07 15:25:52 -06:00
bannsec c3afdd681d Adding non-default gdb handling (#1074)
Fixes Gallopsled/pwntools#1071
2017-12-07 15:25:27 -06:00
Owlz 5d537a6189 Fix typo on Gadget.addr -> Gadget.address 2017-12-04 14:30:41 -06:00
Zach Riggle 9ba966ddba Switch server to ftp.ubuntu.org
Currently ftp.debian.org is down on port 21
2017-12-04 14:30:41 -06:00
Zach Riggle 6ea5722f5b Add a comment to dup shellcodes 2017-11-10 17:00:25 -06:00
Zach Riggle 4e24f665b8 Use hex() for some ROP values (#1050)
* Use hex() for some ROP values

* Call str() on everything else

* Fix one more doctest
2017-11-01 16:15:25 -05:00
Zach Riggle 34cedc96d8 Remove old / unused lines in ABI 2017-11-01 16:14:40 -05:00
Zach Riggle e8065440c2 Use badbytes for ROP.search_iter 2017-11-01 16:14:40 -05:00
Zach Riggle de34906b4c Better handling for Corefiles with unsupported architectures 2017-11-01 16:14:40 -05:00
Zach Riggle 1bcf962049 Fix refactor / rename 2017-10-30 18:03:34 -05:00
Zach Riggle e89a9b66ac Handle debugging under Android better with 'pwn debug' (#1053)
* Handle debugging under Android better with 'pwn debug'

Previously, when using --process or --pid, we would terminate the gdbserver instance
when pwntools exited.  Now we wait for the user to tell us to exit.

* Handle launching Android processes by filename

* Use the --multi option with gdbserver; disable detach-on-fork

* Intentionally break doctest to make sure its running

* Revert "Intentionally break doctest to make sure its running"

This reverts commit 00578ad177.
2017-10-30 14:17:47 -05:00
Zach Riggle fcbf37860e Add doctest import to the correct file 2017-10-30 14:14:47 -05:00
cpupower 64acece61b Copy env using .copy method to preserve order (OrderedDict) (#1061)
* Copy env in process._validate using .copy method to keep the order in case of OrderedDict

* Use supplied env object to preserve order in case of OrderedDict
2017-10-30 14:12:45 -05:00
Mathias Svensson bb9004c298 Begin working on 3.12.0 2017-10-25 12:23:09 +02:00
Mathias Svensson 712295f3c5 Release 3.11.0beta0 2017-10-25 12:06:47 +02:00
Mathias Svensson cca1083f0b Release 3.10.0 2017-10-25 12:01:59 +02:00
Mathias Svensson 9dacd1b5d9 Merge branch 'stable' into beta 2017-10-25 11:56:07 +02:00
Zach Riggle d9f5a5b009 Update CHANGELOG.md 2017-10-23 23:48:53 -05:00
Zach Riggle 74a5876c0d Fix corefile environment variables and speed up ELF.string() (#1055)
* Fix corefile environment variables and speed up ELF.string()

* Even more doctests

* Fix doctest arch

* No longer split on = since it isn't necessary

* Fix arch again

* Delete intermediate corefiles

* Do not flag for extended testing when the commit SHA is what matches
2017-10-23 23:45:11 -05:00
Zach Riggle 9d6b4881fe Fix path checking in ssh_process.corefile for edge cases (#1058)
Fixes #1047
2017-10-23 15:37:48 -05:00
Zach Riggle 91025408a4 Fix incorrect variable in log statement (#1057)
Fixes #1056
2017-10-23 14:39:12 -05:00
Zach Riggle b53e58a840 Use "file /path/to/file" when debugging processes 2017-10-18 14:52:13 -05:00
Zach Riggle 438096f97f Remove doctest prefixes, these are just examples 2017-10-18 14:41:49 -05:00
Zach Riggle 7bab49e7b9 Update GDB docs and examples 2017-10-15 15:31:39 -05:00
Zach Riggle eab9eb1890 Include sample data 2017-10-14 11:18:02 -05:00
Zach Riggle 1061684baa Not need for wait() 2017-10-14 11:16:42 -05:00
Zach Riggle 8f5fec40fc Handle exceptions and silence execution 2017-10-14 11:16:12 -05:00
Zach Riggle a962666752 Move function under ELF class 2017-10-14 11:15:10 -05:00
Zach Riggle 71a6a373a0 Try to get elf/maps.py doctests to run 2017-10-13 15:28:40 -05:00
Zach Riggle 3eb738f048 Fix global rename 2017-10-13 15:02:23 -05:00
Zach Riggle 29828c3f45 Add code for injecting proc/self/maps shellcode into an ELF
Closes #925
2017-10-13 14:20:23 -05:00
Zach Riggle 412d345964 QEMU-related enhancements (#1052)
* Add support for finding QEMU's LD_PREFIX

* Refactor pwnlib.qemu and add official documentation

* Add more documentation, support for sysroot

* More docs, binfmt info

* Fix variable name overload

* Fix missed refactor

* Check for empty/null env

* Add qemu.rst to index
2017-10-12 21:41:36 -05:00
Zach Riggle b088f46988 Update CHANGELOG 2017-10-12 11:26:10 -05:00
Zach Riggle 8f3839d69e Add cyclic default args to context (#1049)
* Add cyclic default args to context

Specifically, this adds context.cyclic_alphabet and context.cyclic_size

This helps cut down on writing "n=8" all the time for users who use 8-byte
subsequences on 64-bit architectures.

Exposing the default alphabet means that users can avoid "bad bytes" in
cyclic patterns which are generated by pwntools internally (e.g. ROP padding)

Some pwnlib.util.packing docstrings were changed to clarify that word_size is
in bits.

The doctests in pwnlib.util.cyclic were updated and extended to have more
and better doctests, as well as better exaples.

* Add an example showing an alphabet with NUL bytes

This is important because old code would use pack(..., "all") when an integer
value was provided, instead of using the correct width.
2017-10-11 19:08:31 -05:00
Zach Riggle 5a81e71368 Update README 2017-10-11 16:59:37 -05:00
Zach Riggle 1577263334 Overhaul ROP.setRegisters to support more complex cases needed by AMD64 (#1044)
* Overhaul ROP.setRegisters to support more complex cases needed by AMD64

Additionally, have a separate cache for ROPs composed of multiple ELF files

* Better presentation for stack padding slots

* Remove unnecessary stack adjustment on amd64

For amd64, it is possible that len(stackArguments) == 0.

* Add a doctest for amd64 register dependency stuff

* More i386 adjust optimizations

* Use nextGadgetAddr as the adjust value

* Always use padding for the last "ret" adjustment

* Better dump display

* Update doctests for new ROP dump() enhancements

* Add badchars support for ROP gadgets

* More doctest fixes, also ensure ROP.search does not return gadgets ending in e.g. int 0x80
2017-10-11 16:57:38 -05:00
Mathias Svensson 7ad5a4e34e Merge branch 'beta' into dev 2017-10-05 09:59:45 +02:00
Mathias Svensson 513682373e Release 3.10.0beta2 2017-10-05 09:44:33 +02:00
Mathias Svensson df7c1fef9d Release 3.9.2 2017-10-05 09:40:21 +02:00
Zach Riggle 559ffa7c9e Merge branch 'beta' into dev 2017-10-01 16:56:31 -05:00
Zach Riggle 2512026b3c Merge branch 'stable' into beta 2017-10-01 16:56:09 -05:00
Zach Riggle 518ed71488 Better error message on gdb.debug when qemu-user is missing 2017-10-01 12:27:23 -05:00
Zach Riggle 26d60cbf63 Expose icache_flush for the ARM alphanumeric encoder 2017-10-01 12:27:04 -05:00
Zach Riggle b234b319df Do not attempt to populate the libraries used by statically-linked binaries (#1043)
This causes a background instance to be spawned, which is not intended.
2017-09-29 16:34:47 -05:00
Zach Riggle 6577f24d3a Add --shared to shellcraft 2017-09-29 16:15:26 -05:00
Mathias Svensson 4a7ff431b9 Merge branch 'beta' into dev 2017-09-28 11:41:59 +02:00
Mathias Svensson 716c67d993 Release 3.10.0beta1 2017-09-28 11:37:08 +02:00
Mathias Svensson 91768424ba Release 3.9.1 2017-09-28 11:33:14 +02:00
Zach Riggle af2f8b4bf4 Fix shellcraft.arm.trap (#1041) 2017-09-27 16:21:32 -05:00
Zach Riggle 9ed8ab6d4f Reduce log spam when downloading the Android NDK 2017-09-26 12:22:16 -05:00
Zach Riggle 19f7268701 Reduce log spam when downloading the Android SDK 2017-09-26 12:21:04 -05:00
Zach Riggle e4d919d6bf Update README.md for 3.9.1 release 2017-09-26 12:16:57 -05:00
Zach Riggle 93d9a2cb5e Merge branch 'beta' into dev 2017-09-26 12:13:56 -05:00
Zach Riggle 69f8cc2c47 Merge branch 'stable' into beta 2017-09-26 12:12:20 -05:00
Zach Riggle ab0ac00c73 Disable glibc buffering in fread for processes using PTYs
See issue #1038 for extensive details
2017-09-26 11:26:45 -05:00
Zach Riggle d87ab3ac65 Try to cut down on the crazy verbosity of logging (#1036)
* Prevent Sphinx from dumping all level=INFO logging output to stdout.

See Gallopsled/pwntools#1036 for more information.

* Filter out Paramiko logs too, apply filter to all root handlers during testing

* Remove unused import

(cherry picked from commit 54c47b3daa)
2017-09-26 11:26:45 -05:00
Zach Riggle 23cd5cb819 Fix some unicode problems in readline (#1029)
Technically this introduces issues with e.g. 'unhex ffdf | python foo.py' if
foo.py uses .interactive().  However, that was already broken for other reasons.

Fixes #1004

(cherry picked from commit ebbe917713)
2017-09-26 11:26:45 -05:00
Zach Riggle 47d5cf7da1 Make some docs warnings go away and add some accessor methodds (#1035) 2017-09-22 16:23:47 -07:00
Zach Riggle a7263688db Make 'pwn template' better (#1032)
* Slightly enhance template and advertise for the feature itself in scripts

Add single-dash to the "very good" characters in shell escaping, to avoid
the need to single-quote things like --host and --port.

* Add --quiet option for pwn template, move gdbscript down a bit

* Slightly better docs for 'pwn template'

* Add checksec information directly to 'pwn template' output
2017-09-21 18:55:03 -07:00
Zach Riggle 630c4651fa Synthesize fault_addr on amd64 if it is zero. (#1031)
* Synthesize fault_addr on amd64 if it is zero.

Fixes Gallopsled/pwntool#1018

* Add a doctest for fault_addr on amd64

* Fix doctest
2017-09-21 17:53:32 -07:00
Zach Riggle 54c47b3daa Try to cut down on the crazy verbosity of logging (#1036)
* Prevent Sphinx from dumping all level=INFO logging output to stdout.

See Gallopsled/pwntools#1036 for more information.

* Filter out Paramiko logs too, apply filter to all root handlers during testing

* Remove unused import
2017-09-21 17:50:53 -07:00
Zach Riggle 11e6a2d9a7 Relocate the check to the actual LocalContext wrapper, not the context.local() context handler 2017-09-21 15:41:03 -07:00
Zach Riggle 9c29c82a69 Additional validation handling in context
- Validate default values set via ~/.pwn.conf
- Validate arch/bits and arch/endianness in LocalContext()-decorated functions
2017-09-21 15:20:01 -07:00
Kristoffer Søholm bb25140807 DynELF bug fixes (#1017)
* DynELF: trust ELF base address

* Bug fixes for DynELF:

 * Fixed lookup when not using libcdb
 * Fixed _find_linkmap returning 0 instead of None when linkmap doesn't
   exist
 * Fixed _lookup_build_id crashing if linkmap cannot be found
 * Misc cleanup

* Changes based on feedback
2017-09-21 14:10:21 -07:00
Zach Riggle ebbe917713 Fix some unicode problems in readline (#1029)
Technically this introduces issues with e.g. 'unhex ffdf | python foo.py' if
foo.py uses .interactive().  However, that was already broken for other reasons.

Fixes #1004
2017-09-16 20:11:58 -05:00
Mathias Svensson b62804eff6 Begin working on 3.11.0 2017-09-11 19:13:20 +02:00
Mathias Svensson ec98dc1246 Release 3.10.0beta0 2017-09-11 18:59:06 +02:00
Mathias Svensson 92ad1a4933 Release 3.9.0 2017-09-11 18:52:47 +02:00
Zach Riggle 7cd3c7b300 Merge branch 'beta' into dev 2017-09-08 12:41:42 -05:00
Zach Riggle 3e163e9cf2 Merge branch 'stable' into beta 2017-09-08 12:41:06 -05:00
Zach Riggle 267c6cc15a Force Ubuntu 12.04 until we can migrate to 14.04 (#1023)
* Force use of Ubuntu 12 builds on Travis CI until we can migrate to 14

* Fix Travis Dockerfile

* Add bash command logging to Travis scripts, since Travis removed its own logging

* curl should follow redirects when grabbing Ubuntu packages

* Update Travis cache directories to newer version of Python, as seen in Travis logs

* Use ::1 instead of ip6-localhost since Travis 12.04 changes broke it
2017-09-08 12:40:31 -05:00
Benno Fünfstück 5831796f6f Add configurable gdbinit (#1007)
* fix typo in comment

* new config option: context.gdbinit

This allows setting the default gdbinit for GDB, which is helpful when you want
to enable some GDB extension only when using pwntools and not by default.
2017-09-06 12:56:55 -05:00
Christophe GRENIER c438893d7e Fix for overwritten env when parsing core file (#1014)
* Fix for overwritten env when parsing core file

* warn_once message when dealing with overwritten pointer to env variable in core file
2017-09-06 12:55:37 -05:00
Mathias Svensson 3e33180655 Update CHANGELOG 2017-07-29 13:26:21 +02:00
Mathias Svensson e09543c098 Start working on 3.10 2017-07-29 13:02:55 +02:00
Mathias Svensson 1a94acab67 Release 3.9.0beta0 2017-07-29 12:23:04 +02:00
Mathias Svensson 6263a347bd Release 3.8.0 2017-07-29 10:23:27 +02:00
Mathias Svensson a344047348 Make concat_all faster while also simplifying it's logic (#1003) 2017-07-21 16:34:39 -05:00
Mathias Svensson 4aa96b48ba Merge branch 'beta' into dev 2017-07-15 00:21:49 +02:00
Mathias Svensson 6f2598aee0 Merge branch 'stable' into beta 2017-07-15 00:20:04 +02:00
Mathias Svensson 3f42ce8636 Change the author_email since the new pypi didn't accept the old one 2017-07-15 00:19:05 +02:00
Mathias Svensson 901f3eddb1 Merge branch 'beta' into dev 2017-07-14 22:57:36 +02:00
Mathias Svensson 5180230f04 Merge branch 'stable' into beta; release 3.8.0beta1 2017-07-14 09:05:40 +02:00
Mathias Svensson 1ab07de033 Release 3.7.1 2017-07-14 09:00:42 +02:00
Zach Riggle 70de143278 Enhance unlock_bootloader with better status messages
- Detect bootloaders that are already unklocked
- Detect bootloader unlock success
- Detect bootloaders that cannot be unlocked
- Detect devices which have not enabled bootloader unlocking
2017-07-10 15:54:22 -05:00
Zach Riggle 5936d0f565 Merge branch 'beta' into dev 2017-06-27 13:53:03 -05:00
Zach Riggle e3fd03458a Merge branch 'stable' into beta 2017-06-27 13:52:27 -05:00
Zach Riggle 55016fb416 Fix config types for integer values (#998)
* Fix config types for integer values

Fixes Gallopsled/pwntools#988

* Add warning for unsupported configuration types
2017-06-26 18:52:38 -05:00
Zach Riggle 08b316098b Update ISSUE_TEMPLATE.md 2017-06-22 00:26:47 -05:00
Zach Riggle a27cb1c168 Update ISSUE_TEMPLATE.md 2017-06-21 11:37:26 -05:00
Zach Riggle d923729dfb Update ISSUE_TEMPLATE
Closes Gallopsled/pwntools#994
2017-06-21 11:35:14 -05:00
Mathias Svensson db75ecb897 Start working on 3.9.0dev 2017-06-19 23:42:29 +02:00
Mathias Svensson 0dc2949790 Release 3.8.0beta0 2017-06-19 22:31:39 +02:00
Mathias Svensson 52b8f4fa29 Release 3.7.0 2017-06-19 22:19:31 +02:00
Zach Riggle 89a848b51f Update CHANGELOG 2017-06-19 13:36:51 -05:00
Zach Riggle 672b4dd090 Update CHANGELOG 2017-06-19 13:34:42 -05:00
Zach Riggle 094e44fd65 Merge branch 'beta' into dev 2017-06-12 12:45:30 -05:00
Zach Riggle 4552624883 Merge branch 'stable' into beta 2017-06-09 17:30:50 -05:00
Kenny K b171f1e2e3 pwn template start() doesn't return io object if only local. (#975) 2017-06-09 17:29:05 -05:00
pedroysb 85523e6d8a Fixing error when setuid=True (#992)
Importing stat module to fix some errors on lines 361 to 364. The errors are caused when using the parameter setuid=True.
2017-06-09 12:41:38 -05:00
Zach Riggle 8b761fc0e3 Fix test which relies on w3challs (#993) 2017-06-09 12:23:00 -05:00
Zach Riggle b83db46c34 Fix issue with newer versions of ADB 2017-06-05 15:45:21 -05:00
Zach Riggle 40c1796fc4 Correct recvrepeat docs 2017-05-28 19:39:32 -05:00
Zach Riggle 984d54d9b2 Empty commit to test whether Docker.io rebuilds are large or small 2017-05-25 20:06:16 -05:00
Zach Riggle 3cbc527deb Update Makefile and generated Makefiles 2017-05-25 14:51:09 -05:00
Zach Riggle 1482fb7545 Add base configuration 2017-05-25 14:48:09 -05:00
Zach Riggle 7ed6f5fe6b Make pwntools:stable depend on pwntools:base 2017-05-25 14:47:36 -05:00
Zach Riggle fd5a7fea68 Fix "Full RELRO" detection in ELFs (targeting dev) (#981)
* Fix Full RELRO detection in ELFs.

This add supports for the newer DF_BIND_NOW and DF_1_NOW flags.
These are used instead of DT_BIND_NOW when linking with gold.
Also fixed the order of checks, now it reports "No RELRO" when
BIND_NOW is present but GNU_RELRO is not (in which case the bindings
are done at start but they will not be marked as read-only).

* Add x86 test binaries for relro check.
2017-05-25 14:32:35 -05:00
Steven Van Acker 8953dc3d5c bandit.labs.overthewire.org SSH is now on port 2220 (#984) 2017-05-25 14:32:05 -05:00
Zach Riggle fda1821fd9 LibcDB Docs, Doctests, Negative Caching, Sane Cache (#986)
* Make libcdb optional

* Add negative caching for libc databases

* Add docs and doctests, add md5/sha1/sha256

* Add libcdb to main docs

* Slightly more useful doctests

* Expose functions in __all__

* Slightly better logging messages

* Fix __all__
2017-05-23 04:42:09 -05:00
Zach Riggle f7568b47b3 Capitalize first words of sentences 2017-05-21 13:40:30 -05:00
Zach Riggle 2ccd36ca7f Fix Ubuntu versions 2017-05-21 13:38:13 -05:00
Zach Riggle 9062360041 Fix document heading 2017-05-15 18:37:00 -05:00
Zach Riggle 3f9c192a5e Add a bit more args docs 2017-05-15 13:02:59 -05:00
Mathias Svensson b8e902b611 Merge branch 'beta' into dev 2017-05-12 10:21:37 +02:00
Mathias Svensson d586d6f660 Merge branch 'stable' into beta 2017-05-12 10:06:53 +02:00
Mathias Svensson 6709a4f747 Release 3.6.1 2017-05-12 10:01:41 +02:00
Mathias Svensson 1a4a1e11ba Follow-up to #980 making it actually work 2017-05-12 09:57:34 +02:00
Zach Riggle f82c0aa3a2 Add mako files to MANIFEST (#980) 2017-05-10 19:59:41 -05:00
Zach Riggle 646ca1eb26 Attempt at fixing #974; I don't have a keyboard with a keypad right now, so can't test. (#979) 2017-05-10 17:00:33 -05:00
Mathias Svensson 8055ec98ce Prepare work on 3.8.0 2017-05-08 20:56:08 +02:00
Mathias Svensson aa1f3f7f5a Merge branch 'beta' into dev 2017-05-08 20:22:39 +02:00
Mathias Svensson 043627a56d Release 3.6.0 2017-05-08 20:00:47 +02:00
Mathias Svensson a40a0ecab4 Merge branch 'stable' into beta 2017-05-08 19:59:31 +02:00
Zach Riggle bbe20c9748 Update CHANGELOG 2017-05-04 13:40:55 -05:00
Zach Riggle c700f9194c Update CHANGELOG 2017-05-04 13:40:08 -05:00
Zach Riggle 71a3e43be3 Update CHANGELOG 2017-05-04 13:38:44 -05:00
Zach Riggle 267b9990c2 Update CHANGELOG 2017-05-04 13:38:32 -05:00
Zach Riggle cfee8e0b24 Update CHANGELOG 2017-05-04 13:37:45 -05:00
Zach Riggle 32a767d469 Update CHANGELOG 2017-05-04 13:37:06 -05:00
Zach Riggle eaea783e2a Verify corefiles are the same via hash before using cached copy (#970) 2017-05-04 13:04:48 -05:00
Zach Riggle 9bda42e45d Merge remote-tracking branch 'upstream/beta' into dev 2017-05-01 23:50:16 -05:00
Zach Riggle f4b3469fb4 Fix incorrect ordering in template for non-ssh remotes (#968) 2017-05-01 23:49:57 -05:00
Zach Riggle 0903f9055b Fix typo: PRSP vs PRPS 2017-05-01 15:13:45 -05:00
Zach Riggle 0a23a457c5 Add ARCH_HAS_ELF_RANDOMIZE 2017-05-01 15:13:45 -05:00
David Tomaschik 7fe6dd0e8e Respect TERM_PROGRAM for run_in_new_terminal. Fixes #964. (#967)
* Respect TERM_PROGRAM for run_in_terminal.  Fixes #964.

* Set args for TERM_PROGRAM.
2017-05-01 01:22:49 -05:00
Zach Riggle 4772a22fed Only use PPA for older Ubuntu releases (#961)
Fixes Gallopsled/pwntools#953
2017-04-28 12:25:38 -05:00
Roman 42692c685e Add ability to set env vars in template (#960)
* added ability to set env vars in template

* changed env param to general *a, **kw
2017-04-21 15:11:09 -05:00
micbou aa3acc162f Fix dd documentation (#959) 2017-04-21 15:10:51 -05:00
Mathias Svensson 676e6869a0 Merge branch 'beta' into dev 2017-04-20 01:25:48 +02:00
Mathias Svensson 9b50163760 Allow setting the terminal through a tuple instead of a list (#957) 2017-04-20 01:25:25 +02:00
Zach Riggle 289109f499 Merge remote-tracking branch 'upstream/beta' into dev 2017-04-18 13:44:45 -05:00
Roman e90fb15596 Fixed processing of lists in config file (#954)
* fixed handling of lists in config file

* changed list to tuple
2017-04-18 13:44:40 -05:00
Zach Riggle 3b9c0db1a2 Better error messages for run_in_new_terminal 2017-04-18 13:44:29 -05:00
Roman dd7a67b6d7 Fixed errors in template generator (#952)
* fixed port type

* missed exploit.py template

* fixed condition availability parameters
2017-04-17 12:35:47 -05:00
Mathias Svensson ad87c17f73 Merge branch 'beta' into dev 2017-04-15 11:24:55 +02:00
Mathias Svensson 2714a30488 Release 3.6.0beta1 2017-04-15 10:52:38 +02:00
Mathias Svensson ac386877d1 Release 3.5.1 2017-04-15 10:43:55 +02:00
Zach Riggle 4f08b6d79c Allow setting context.device=None, and use context.arch to determine default ABI for adb.compile (#950) 2017-04-13 13:54:17 -05:00
Zach Riggle 348f6dfbe7 Update CHANGELOG for 3.5.1 and 3.6.1beta release 2017-04-13 13:40:43 -05:00
Zach Riggle 80219df5cc Require a path for 'pwn template' (#947)
Closes Gallopsled/pwntools#943
2017-04-13 10:37:21 -05:00
Zach Riggle 065c79d29c Speed up ssh via caching checksec results (#945)
* Speed up ssh via caching checksec results

Closes Gallopsled/pwntools#944

* Fix logging message

(cherry picked from commit 8a7bb9b9f4)
2017-04-12 21:47:41 -05:00
Zach Riggle 310f186e5f Do not attempt to populate GOT and PLT symbols for Corefiles (#948)
Closes Gallopsled/pwntools#946
2017-04-12 21:47:05 -05:00
Hlynur Óskar Guðmundsson bac44542ed Made an error message when a default terminal is not found more verbose and helpful (#941) 2017-04-11 12:10:30 -05:00
Zach Riggle a54e697b55 Add CONFIG_COP_ACCESS from CVE-2017-0583 2017-04-04 17:06:18 -05:00
Gábor Szarka 5f1294af09 Make DynELF more robust to different base addresses (#933)
The check for when certain ELF fields contain offsets instead of pointers can be
made more precise by checking for the type field in the ELF header instead of
comparing the value to some hard-coded range.
2017-04-02 17:07:08 -05:00
Grazfather 7cc4ced8d6 gdb: Use quiet (-q) option (#940) 2017-04-02 17:06:17 -05:00
Mathias Svensson 5c72d62c90 Update the CRC list 2017-03-30 13:56:44 -05:00
Zach Riggle 925cb43024 Run autopep8 on known crcsums before merging Idolf's change, so that the difference is visible 2017-03-30 13:55:08 -05:00
Zach Riggle 6f42e1c337 Fix more logging messages 2017-03-28 11:16:08 -05:00
Zach Riggle 8a7bb9b9f4 Fix logging message 2017-03-28 11:14:50 -05:00
Mathias Svensson 512c2544b5 Start working on 3.7.0 2017-03-26 22:43:05 +02:00
Mathias Svensson 8120b5c037 Merge branch 'stable' into beta 2017-03-26 22:18:01 +02:00
Mathias Svensson 55456814fc Release 3.5.0 2017-03-26 21:13:03 +02:00
Zach Riggle eb3e3797cd Update CHANGELOG for 3.6.0beta release 2017-03-23 13:15:03 -05:00
Zach Riggle 3416b7c949 Fix conditional for logging 2017-03-19 17:11:33 -05:00
Zach Riggle dc9882abe7 Use _run for objdump output 2017-03-06 14:27:13 -06:00
Zach Riggle 664622fa07 Use all symbols in inverted PLT search 2017-03-06 14:05:53 -06:00
Zach Riggle 930f2a4a32 Do not dump PLT emulation data to DEBUG logs unless explicitly set via PLT_DEBUG 2017-03-04 18:31:24 -06:00
Zach Riggle 10ef77b997 Add missing link to Changelog 2017-03-04 16:10:50 -06:00
Zach Riggle ecba8e4b38 Update changelog for 3.5.0 2017-03-04 16:09:08 -06:00
Mathias Svensson 0d3b97b378 Merge branch 'beta' into dev 2017-03-03 23:20:08 +01:00
Zach Riggle 33945f6885 Clean up socket-class and socket-type code in sock/remote/listen (#920)
* Clean up socket-class and socket-type code in sock/remote/listen

* Slight change to docs

* Add doctests for listen and attribute documentation

* Fix bug in listen.close()

* Fix regression on ipv6 sockets

* Simplify documentation

* Fix doctest
2017-03-03 14:04:58 -06:00
Zach Riggle b7ddfa995e Fix ARM PLT parsing, and big-endian ARM emulation (#910)
* Do not use UC_MODE_BIG_ENDIAN, its support is poor

* Ghetto-swap endianness for emulation of PLT instructions

* Reduce instruction alignment so that all ARM PLT entries are found

* Add tests for ELF PLT loading

* Fix canary detection on PowerPC

* Fix x32 emulation

* Fix two failing doctests

* Add AArch64 to supported big-endian architectures

* Add MIPS GOT parsing code, fix unpack macros to use ELF settings

* Why, MIPS, are you so complicated?

* Catch weird edge cases

* I don't know what's real anymore

* Fix synthetic symbol generation and add tests

* Remove canary test

* Guard against errors in MIPS GOT

* Fix doctests
2017-03-02 19:03:45 -06:00
Mathias Svensson 3b2be2b2a7 Merge branch 'stable' into beta 2017-03-02 11:47:55 +01:00
Zach Riggle 0a3ac521ad Work around appdirs error for Travis CI builds (#924)
Closes Gallopsled/pwntools#921
2017-03-01 17:58:22 -06:00
Zach Riggle 1f72e45eaf Attempt appdirs workaround 2017-02-25 01:44:55 -05:00
Zach Riggle 421a3093fc Remove spinners that will probably get us yelled at 2017-02-25 01:25:08 -05:00
Zach Riggle d08fc6d3a0 Simplify Travis Dockerfile 2017-02-24 15:50:33 -05:00
Zach Riggle dd6931907a Update user-agents 2017-02-24 14:15:29 -05:00
Zach Riggle de3a68d8b4 Update 'pwn template' template to support argv and auto-downloading the target file (#919) 2017-02-22 12:09:55 -05:00
Zach Riggle 93b828ff97 Add missing basic templates for AArch64 (#918)
* Add missing basic templates for AArch64

* Simplify aarch64 templates

* Fix broken doctests
2017-02-21 19:48:58 -05:00
Zach Riggle 326dd83321 Handle errors during ssh.checksec() (#917)
* Handle errors during ssh.checksec()

Closes Gallopsled/pwntools#916

* Add additional error handling for ulimit checks
2017-02-21 14:57:58 -05:00
Mathias Svensson f8bb49c78f Merge branch 'beta' into dev 2017-02-17 14:56:39 +01:00
Mathias Svensson 510e247034 Merge branch 'stable' into beta 2017-02-17 14:48:14 +01:00
Mathias Svensson 4d529cd543 Release 3.4.1 2017-02-17 14:29:51 +01:00
Kristoffer Søholm e021f57806 Fixed bug in generatePadding (issue #891) 2017-02-17 14:15:31 +01:00
Zach Riggle b6cfec6284 Do not fail with gdb.debug() over ssh when given an absolute path (#894)
* Do not fail with gdb.debug() over ssh when given an absolute path

Fixes Gallopsled/pwntools#885

* Prevent failing on stable since this directory doesn't exist
2017-02-17 00:02:53 -05:00
Zach Riggle 4834032b14 Doctest all members, even if they are not exported via __all__ (#914)
* Doctest all members

* Fix doctest failures in asm and remove canary in context

* Fix failing doctest

* Use automodule for pwnlib.context

* Fix failing tests in context module

* Use automodule for pwnlib.memleak
2017-02-16 23:40:50 -05:00
Zach Riggle 1273552189 Do not skip "hidden" doctests (#912)
* Check to see if hidden members are doctested

* Do not skip undocumented members

* Fix broken tests, promote missing tests
2017-02-16 21:30:35 -05:00
Zach Riggle ef1e3cfb97 Fix regression in f4b0e3a5 2017-02-16 19:43:26 -05:00
Zach Riggle e9fc0125a6 Add "pwn template" command for generating templates (#909) 2017-02-16 19:38:34 -05:00
Zach Riggle 81239be429 Fix checksec nx, execstack, relro reporting (#904)
* Fix checksec nx, execstack, relro reporting

Also add a disable_nx function

* Add disablenx command-line utility

Also fix bug where invoking command-line utilities directly by module name
(python -m pwnlib.commandline.foo) would fail
2017-02-16 17:20:28 -05:00
Zach Riggle f4b0e3a5b9 Do not allow interactive assembly, it doesn't work anyway 2017-02-16 16:48:59 -05:00
Kristoffer Søholm 1f1a6667a1 Added test for issue #891 (#903) 2017-02-15 17:00:54 -05:00
Zach Riggle 464e9e54e1 Add 'pwn debug' command-line utility (#905)
Also fixes a bug in process() which would throw the wrong exception
when qemu-user cannot be located for a non-native binary.
2017-02-15 17:00:24 -05:00
Zach Riggle a786a58db7 Emulate PLT for better symbols (#899)
* Emulate all relocation sections for PLT symbols

This adds a dependency on Unicorn

* Don't look up empty symbols
2017-02-15 16:57:24 -05:00
Zach Riggle bc471d13f9 Fix MIPS ELF bit-ness by checking masks in increasing order (#901)
Closes Gallopsled/pwntools#900
2017-02-14 11:36:28 -05:00
Zach Riggle 6af464fc0e Make SROP doctests slightly more verbose 2017-02-13 18:12:52 -05:00
Zach Riggle 29e38a7d49 Add missing --init to docker invocation 2017-02-13 18:02:11 -05:00
Zach Riggle 658589704a Add pwnlib.config module and documentation (#893)
This adds functionality for user configuration files at ~/.pwn.conf
and /etc/pwn.conf.  Previously this was only used by the pwnlib.log
module, and was entirely undocumented.

This is now documented, and offers an easy mechanism for other parts
of the code to have extension points.
2017-02-13 17:55:01 -05:00
Zach Riggle 71855ebd2f Fix Aarch64 syscalls (#897)
* Remove unavailable syscalls from AArch64

The Linux kernel has apparently stopped supporting these

* Rewrite shellcraft.aarch64.linux.cat, add open which uses openat

Fixes Gallopsled/pwntools#896

* Fix doctests to use openat
2017-02-13 17:50:45 -05:00
Zach Riggle 393751351b Add dockerfile for testing-in-a-box on Xenial (#895) 2017-02-13 17:34:26 -05:00
Mathias Svensson c8a690d617 Removed all uses of sh_command_with and sh_prepare (#892) 2017-02-13 14:59:27 -05:00
Kristoffer Søholm 8b8a50b580 Fixed bug in generatePadding (issue #891) 2017-02-13 11:39:42 +01:00
Mathias Svensson 3b07dfe7cc Begin work on 3.6.0 2017-02-13 01:52:59 +01:00
Mathias Svensson 5877f8e97e Merge branch 'stable' into beta-staging 2017-02-13 01:34:31 +01:00
Mathias Svensson 4ebcbee34b Release 3.4.0 2017-02-13 01:31:16 +01:00
Mathias Svensson d25d62c126 Merge branch 'stable' into stable-staging 2017-02-13 01:31:00 +01:00
Zach Riggle 5392611ed5 Use updated testing scripts from 3.5.0 on 3.4.0 2017-02-13 01:17:57 +01:00
Zach Riggle 7c139c7179 Shellcode syscall templates (#871)
* Add templates from generator

* Add abi.stack to all ABIs

* Enable shellcraft.arch.os.foobar.template

* Add pwnlib.registers.current()

* Add syscalls symlinks

* Add syscall generator

* Enable shellcraft.foo() shortcut for shellcraft.arch.os.syscalls.foo()

* Make templates more verbose

* Remove old templates

* Add makefile

* Delete old templates, make shellcraft --list work

This also speeds up boot time by like 0.05 seconds

* Remove unnecessary execve wrappers

* Check for common arch as well

* Don't explode on string arguments that are register names

* Catch bad argument names

* Remove accidental import

* Add aarch64 ABIs since we enabled aarch64 tests

* Fix mmap vs mmap2 syscall

* Make shellcraft command-line work for syscalls

* Remove unnecessary wrapper templates

* Set all default values to zero

* Add example of automatic determination of types

* Add missing register architectures

* Add PowerPC ABIs

* More syscall examples

* Handle mmap vs mmap2

* Add missing import, use full path

* Just use the string name

* Fix rt_sigreturn on amd64

* __NR_ --> SYS_ because of old expectations

* rstrip to remove blankline

* Fix Thumb doctests which uses unpredictable jump labels

* Import additional syscalls by updating the function source.

Support variable-argument syscalls.

Support spilling to the stack.

* Simplified constants.eval logic means no extra parens

* Simplify vararg representation; fix oepn() argument name explicitly

* Fix syscall examples

* Fix reordering of arguments, since we have to support stack spill

* Fix argument name in doctest

* Make Codacy happy

* Restore connect template accidentally removed in 9fceb12b

* Scrape all architectures for syscall names

* Enable void* and void** to be pushed

* Make Codacy happy

* Add __doc__ to sdist

* Follow shellcraft template symlinks

* Detect syscall shellcodes in shellcraft based on path

(cherry picked from commit 94462845fa)
2017-02-12 18:37:20 -05:00
Zach Riggle da9ce55dfd Fix changelog formatting 2017-02-12 18:26:11 -05:00
Zach Riggle 9d394e0df1 Add missing info to 3.4.0 changelog 2017-02-12 18:26:02 -05:00
Zach Riggle f962d2bd21 Add missing info to 3.4.0 changelog 2017-02-12 18:24:50 -05:00
Zach Riggle 667d290d9b Fix regression from 189b1fb3c 2017-02-11 15:16:14 -05:00
Zach Riggle 766c4d8a7f sh_string should return '' for empty strings (#887) 2017-02-11 15:02:46 -05:00
Zach Riggle 189b1fb3c2 Add missing registers to AArch64 sigreturn frame, and update test 2017-02-10 22:54:24 -05:00
Zach Riggle 6c1b882b40 Upgrade warnings to errors in demo 2017-02-10 22:38:04 -05:00
Zach Riggle 0c76348072 Fix AArch64 SROP register name 2017-02-10 22:37:23 -05:00
Zach Riggle 2f7d78bc64 Add sigreturn/corefile examples and sanity tests 2017-02-10 22:34:27 -05:00
Zach Riggle 646723fa8e Remove unneded arg from aarch64 sigreturn 2017-02-10 22:19:11 -05:00
Zach Riggle e77915fba6 Handle PC/SP being invalid in Corefiles 2017-02-10 22:16:13 -05:00
Zach Riggle a02e8da1ea Add AArch64 support to corefiles 2017-02-10 22:16:13 -05:00
Zach Riggle 6979cb0d2b Search for QEMU coredumps first 2017-02-10 21:57:18 -05:00
Zach Riggle bc8942006b Convert alignment error to a warning; add AArch64 2017-02-10 21:54:26 -05:00
Zach Riggle 07c7b51f25 Add ip and fp aliases to user_regs_struct on arm 2017-02-10 21:51:53 -05:00
Zach Riggle ee655cac60 Add Android and AArch64 support to SigreturnFrame 2017-02-10 21:19:48 -05:00
Zach Riggle b668815323 Fix elf.functions not containing back-references 2017-02-10 21:07:56 -05:00
Zach Riggle a26a1a1f35 Permit setting SROP arguments directly 2017-02-10 21:03:26 -05:00
Zach Riggle ab42519e26 Enable disassembling entire functions 2017-02-10 19:28:59 -05:00
Zach Riggle 59b44b4fe6 Fix typo from 0c8006ca 2017-02-10 19:28:26 -05:00
Zach Riggle f4f21f147b Squelch error messages when restarting the server 2017-02-10 12:54:01 -05:00
Zach Riggle c06822571f Do not overrite tube.flat with ADB protocol Client 2017-02-10 12:40:22 -05:00
Zach Riggle 383a4f4596 adb.push() should return the target path 2017-02-09 15:25:13 -05:00
Zach Riggle 25d63da30e Do not print connection messages when using AdbClient 2017-02-09 15:20:01 -05:00
Zach Riggle dd2ad30a51 Catch exceptions when SSHing into machines with unsupported architectures (#884)
Fixes fefd48f34
2017-02-05 17:00:09 -05:00
Zach Riggle d160f9b7c9 Make corefiles great again (#839)
Adds a large amount of functionality around Corefiles, to support smarter exploitation

Adds a ".corefile" property to both local and remote (ssh) processes.  See the
documentation for the corefile module for extensive examples and tests.

Additionally, context.delete_corefiles and context.rename_corefiles have been added,
to control the behavior of the ".corefile" property.
2017-02-05 10:49:50 -05:00
Zach Riggle 0bdbc2b8c3 Make pwnlib.rop consistent with context.bytes (#882)
Fixes Gallopsled/pwntools#879
2017-02-05 09:36:45 -05:00
Zach Riggle d0c4d8488e Disable exit-on-error at the end of bash scripts (#881) 2017-02-05 07:43:38 -05:00
Zach Riggle f3968afbbb Add aarch64 documentation, which enables doctests (#875)
* Add aarch64 documentation, which enables doctests

* Fix failing doctest

* Attempt to figure out whats going on with Travis

* Use the Xenial version of qemu-static since the Zesty version is broken for AArch64
2017-02-02 00:32:25 -05:00
Zach Riggle 2d04acb867 Enhance adb.which to support all=True 2017-01-31 15:05:26 -05:00
Zach Riggle 62842e20f0 Make command-line tools work better 2017-01-29 18:50:46 -05:00
Zach Riggle c929217947 Restore dupsh from d21af22f82
Closes Gallopsled/pwntools#873
2017-01-27 08:17:16 -05:00
Zach Riggle ff08a859f8 Docker: Install unprivileged user pwntools, use correct tags 2017-01-26 16:03:26 -05:00
Zach Riggle ba24b440c5 Convert symlink to actual file, since Docker Hub doesnt like symlinks 2017-01-26 14:40:34 -05:00
Zach Riggle b31adf27d0 Update dockerfiles and add various distros / release versions 2017-01-26 14:04:37 -05:00
Zach Riggle 20d27c651a Silence commits in the build logs 2017-01-25 18:14:06 -05:00
Zach Riggle ba7911651e Install a recent version of GDB onto Travis (#872)
These files should be cached automagically.
2017-01-25 17:21:59 -05:00
Zach Riggle cded6cda47 Make upgrades / add fields to process() (#869)
- Show the PID when a process is created
- Make process.cwd into a property, which fetches the real CWD from procs
- Record the UID/GID and SUID/SGID of the executed file
- Add a few doctests
- Make _stop_noticed a timestamp
2017-01-24 19:30:26 -05:00
Zach Riggle 25941b52bb Multiple SSH enhancements (#868)
- Break out ssh_channel into subclass ssh_process
- Make ssh.process() directly instantiate ssh_process
- Add ssh_process().ELF
- Add ssh_process().corefile
- Record the UID and GID of the executed binary
- Add the created PID to the ssh_process message
2017-01-24 19:02:57 -05:00
Zach Riggle b79a750af6 Force-install libcapstone3 since it is causing errors 2017-01-24 18:02:43 -05:00
Zach Riggle eede2e2e1d Always upgrade Pip first 2017-01-24 17:43:19 -05:00
Zach Riggle 2a59f5cf4c Fix chunked reading of ELF files (#865)
* Fix chunked reading of ELF files

This introduces a new dependency on 'intervaltree', which is used
to automatically select segments which are relevant for a given
virtual-address range.

This also introduces a new ELF.memory attribute, which is the tree
of memory ranges, which point at the segment objects that describe
the memory range.

These are recalculated when ELF.address is adjusted, and we have
tests for that.

This also optimizes some of the other routines to avoid the wrapped
file-seeking, and to just use the mmap.

* Rewrite install scripts to use more modern versions of binutils

* Load segments in file-order, chop any overlaps
2017-01-24 13:41:29 -05:00
Mathias Svensson a3e82e27bb Fix a few edge cases in weird ELF files (#867)
* Fix a few edge cases in weird ELF files

* Add a check for PT_LOAD
2017-01-24 19:14:29 +01:00
Zach Riggle 368a708663 Upgrade documentation requirements on Travis 2017-01-24 12:00:34 -05:00
Zach Riggle 4a7de306f0 Convert impossible doctest into a code-block 2017-01-23 15:47:43 -05:00
Zach Riggle 69bbd0839a Clean up pwnlib.asm documentation and doctests 2017-01-23 15:39:36 -05:00
Zach Riggle 475ffa632e Always run Android tests on staging branches and new tags (#866) 2017-01-23 14:43:32 -05:00
Zach Riggle 06db497901 Add a bit more documentation to context.rst 2017-01-23 12:16:30 -05:00
Zach Riggle 5106c4eb75 Fix test in dpkg_search_for_binutils 2017-01-23 12:11:02 -05:00
Zach Riggle 08b7b190a7 A few documentation touch-ups 2017-01-23 12:08:36 -05:00
Zach Riggle 8259d07207 Remove useless doctest lines 2017-01-23 12:01:27 -05:00
Zach Riggle ad2eb77cfa Explicitly run a few asm tests 2017-01-23 12:00:08 -05:00
Zach Riggle ec04c860c0 Remove unnecessary doctests:: blocks 2017-01-23 11:59:48 -05:00
Zach Riggle ffe4cf6807 Add doctest for print_binutils_instructions 2017-01-23 11:19:36 -05:00
Zach Riggle 673073f08d Add a test for pwnlib.asm.dpkg_search_for_binutils 2017-01-23 11:15:57 -05:00
Zach Riggle 0e45f23af8 Add pwnlib.protocols module (#860)
* Add pwnlib.protocols module

Migrate pwnlib.adb.protocol into that directory, and add compatibility shims

* Add documentation links, and run doctests

* Make doctests run

* pwnlib.protocols.adb.Client.transport should work with no device
2017-01-20 18:59:23 -05:00
Zach Riggle 31cd98affe Do not truncate the ELF file when saving to the same path 2017-01-20 15:27:46 -05:00
Zach Riggle 3e4a1bcc72 Fix errant version number printing 2017-01-20 15:22:59 -05:00
Zach Riggle 85c3074574 Allow calling ELF.save() with no arguments 2017-01-20 15:22:59 -05:00
Zach Riggle 178e64a4f7 Add symlink option for ssh.set_working_directory to simplify exploits (#862)
* Add symlink option for ssh.set_working_directory to simplify exploit code

* Add additional options and tests to symlink=xxx
2017-01-20 14:58:08 -05:00
Zach Riggle 179476604e Fix error message format string
Closes Gallopsled/pwntools#863
2017-01-20 14:38:37 -05:00
Zach Riggle fc6e00d9f0 Update changelog for 3.5.0 2017-01-19 15:18:17 -05:00
Zach Riggle 8b1f1dce84 Update changelog for 3.5.0 2017-01-19 15:11:44 -05:00
Zach Riggle 8345bc3824 Add parse_kconfig and kernel information to pwnlib.elf.ELF (#861) 2017-01-19 11:01:31 -05:00
Zach Riggle 300f8e0c1a Speed up processing of symbols slightly, by not checking for each entry 2017-01-17 16:38:01 -05:00
Zach Riggle 9ace73a977 Replace broken function-decorator context.quiet with working context.quietfunc
Fixes: ae6a0745f
2017-01-17 15:10:25 -05:00
Zach Riggle fb16e158ec Use tubes.buffer for net.wget, add more tests 2017-01-17 13:58:49 -05:00
Jakub Wilk e519874947 Fix typos (#859) 2017-01-16 11:42:38 -05:00
Zach Riggle 2e90d05156 Actually implement ssh.sftp setter, so it can be set to None 2017-01-14 15:05:15 -05:00
Zach Riggle b6e3d5d8c5 Fix register usage in execve shellcode (#857)
The previous code worked, but we emitted a register swap that hid the fact we were using the wrong registers

Fixes Gallopsled/pwntools#856
2017-01-13 14:00:28 -05:00
Zach Riggle 0726d8d339 Fix hexdump alignment for weird widths
Closes Gallopsled/pwntools#849
2017-01-12 17:57:54 -05:00
Mathias Svensson bd5a368754 Merge branch 'beta' into dev 2017-01-12 23:48:54 +01:00
Mathias Svensson 602efd2790 Release 3.4.0beta4 2017-01-12 23:42:25 +01:00
Mathias Svensson 2f7f0de984 Release 3.3.4 2017-01-12 23:40:13 +01:00
Zach Riggle 45d2c11535 Update changelog for 3.3.4 2017-01-12 17:30:30 -05:00
Zach Riggle 16b507e197 Change hexdump_iter to not rely on the length of its input file (#850)
We cannot determine the length of the file if passed e.g. a tube or a pipe or PTY or character device (e.g. stdin or /dev/null).

Supercedes: 9c2f0f4e
(cherry picked from commit 14f717b7b4)
2017-01-12 17:20:15 -05:00
Zach Riggle 53f041a4d2 Fix shellcraft.amd64.popad registers (#853)
Fixes Gallopsled/pwntools#848
2017-01-12 16:47:44 -05:00
Zach Riggle b2a5b76cf7 Do not perform temporary register selection if we don't need to (#852)
Fixes Gallopsled/pwntools#847
2017-01-12 16:36:49 -05:00
Zach Riggle 9cb438842c Use class- and init-level documentation for Sphinx autodocs 2017-01-12 16:09:23 -05:00
Zach Riggle 14f717b7b4 Change hexdump_iter to not rely on the length of its input file
We cannot determine the length of the file if passed e.g. a tube or a pipe or
or PTY or character device (e.g. stdin or /dev/null).
2017-01-12 15:01:42 -05:00
Zach Riggle f792407c19 Remove hanging comment 2017-01-11 19:22:48 -05:00
Zach Riggle 9c2f0f4e89 Fix hexdump_iter for actual file objects, like those used by phd (#846) 2017-01-11 15:06:11 -05:00
Zach Riggle eb0bb6ea8d Add doctest for hexdump_iter 2017-01-11 00:51:28 -05:00
Zach Riggle f46112e873 Fix hexdump_iter for actual file objects, like those used by phd 2017-01-11 00:45:39 -05:00
Zach Riggle 975844d83d Add SigreturnFrame.__flat__ 2017-01-10 21:29:36 -05:00
Zach Riggle 466c0e4179 Add elf.process, elf.fit, process.fit
Also fix the implementation of elf.flag
2017-01-10 21:27:50 -05:00
Zach Riggle 17e4f01976 Enhance output of amd64.mov shellcraft for very large values 2017-01-10 18:18:34 -05:00
Mathias Svensson fecd6f8222 Merge branch 'beta' into dev 2017-01-11 00:03:09 +01:00
Mathias Svensson 7ba3a1b32f Release 3.4.0beta3 2017-01-10 23:53:59 +01:00
Mathias Svensson d1edd275d9 Release 3.3.3 2017-01-10 23:52:50 +01:00
Zach Riggle 8f012947e9 Add build-essential and pip upgrade to installation steps (#845)
Fixes Gallopsled/pwntools#844
2017-01-10 17:35:50 -05:00
Zach Riggle 36b05bac2b Add doctests for the hexdump utility (#842)
Related: Gallopsled/pwntools#837
Related: Gallopsled/pwntools#840
2017-01-10 17:21:54 -05:00
Zach Riggle cb4991c41d Fix regression in amd64.mov with 32-bit values >= 0x80000000 (#843)
Fixes Gallopsled/pwntools#841
Caused by: Gallopsled/pwntools#504 (9ca377c)
2017-01-10 15:56:50 -05:00
Mathias Svensson 65f18b6091 Merge branch 'beta' into dev 2017-01-10 18:43:46 +01:00
Mathias Svensson 48616c633d Release 3.4.0beta2 2017-01-10 18:30:16 +01:00
Mathias Svensson 323975f343 Release 3.3.2 2017-01-10 18:28:24 +01:00
Zach Riggle f65c258956 Fix hexdump regression in 3.3.1 (#840) 2017-01-10 12:15:34 -05:00
Mathias Svensson c928a0425e Merge branch 'beta' into dev 2017-01-10 17:00:15 +01:00
Mathias Svensson f5e16d3db6 Release 3.4.0beta1 2017-01-10 16:59:22 +01:00
Mathias Svensson d55874a6d3 Release 3.3.1 2017-01-10 16:53:24 +01:00
Zach Riggle 0426d498d9 Resolve feature regression in hexdump(..., cyclic=True)
This code wasnt updated when the code was changed to operate on file descriptors.

Additionally, there was a functional regression, that the first line would be skipped.

Fixes: Gallopsled/pwntools#836
Caused by: Gallopsled/pwntools#695 (d65991d)
2017-01-09 21:59:19 -05:00
Zach Riggle fefd48f341 Add ssh.checksec functionality (#835)
Looks like this:

[x] Connecting to example.pwnme on port 22
[+] Connecting to example.pwnme on port 22: Done
[*] [email protected]:
    Distro    Ubuntu 14.04
    OS:       linux
    Arch:     amd64
    Version:  3.11.0
    ASLR:     Enabled
    Note:     Susceptible to ASLR ulimit trick (CVE-2016-3672)

Fixes Gallopsled/pwntools#753
2017-01-09 13:55:38 -05:00
Zach Riggle 132f48e6ee Fix failing doctest. Not sure what changed, but it was clearly not guaranteed to be right, given global state. 2017-01-07 19:16:04 -05:00
Zach Riggle e205e17b6d Fix doctests in ELF module 2017-01-07 18:32:37 -05:00
Zach Riggle d0267f3ee7 packing.fit() should handle extremely large offsets as if they are cyclic patterns 2017-01-07 18:21:14 -05:00
Zach Riggle 0c8006ca4e Enable passing an elf.Function to flat() 2017-01-07 18:14:57 -05:00
Zach Riggle bd88c92991 Greatly enhance and update the pwnlib.elf module documentation. 2017-01-07 18:10:59 -05:00
Zach Riggle 12f1bb9126 Add signal names to negative exit codes for process.poll() 2017-01-07 16:37:57 -05:00
Zach Riggle 3fa2c659fd Merge branch 'beta' into dev 2017-01-05 12:41:28 -05:00
Zach Riggle a2c67e5075 Merge branch 'stable' into beta 2017-01-05 12:39:25 -05:00
Zach Riggle 54e722819b Defer attempts to start ADB server until we actually fail to connect (#833)
* Defer attempts to start ADB server until we actually fail to connect

* Upgrade to a warning message; fix .version() multiple calls with _autoclose

* Add doctest which tests the kill/restart behavior
2017-01-05 12:38:51 -05:00
Zach Riggle 179a0656f5 Add better example of NOPTRACE 2017-01-04 23:16:22 -05:00
Zach Riggle 58b2e36a1b Fix empty code-block 2017-01-04 23:13:50 -05:00
Zach Riggle 24ae51dae4 Greatly enhance documentation for the GDB module, and expose its members in toplevel 2017-01-04 23:06:34 -05:00
Zach Riggle 14e68ec226 Remove _raw variants from public documentation 2017-01-04 14:57:22 -05:00
Zach Riggle 485dcede2c Fix heading style for ADB docs 2017-01-04 14:45:54 -05:00
Zach Riggle 50acdbbe41 Add hyperlinks to tube class 2017-01-04 14:44:30 -05:00
Zach Riggle 4e0e9d2acb Add hyperlinks to process class 2017-01-04 14:43:51 -05:00
Zach Riggle bc7c8cd423 Add missing :const: to docstrings 2017-01-04 14:37:43 -05:00
Zach Riggle a8446bef47 Fix sh_string RST formatting 2017-01-04 14:36:21 -05:00
Zach Riggle afdcdec577 Fix sh_string docs 2017-01-04 14:23:06 -05:00
Zach Riggle c13ff2cb08 Clarify documentation and remove leading process.XXX in docs 2017-01-04 14:18:02 -05:00
Zach Riggle a12d0b6a4c Move PTY, PIPE, STDOUT to toplevel 2017-01-04 14:15:38 -05:00
Zach Riggle 3dd6045488 Fix regression caused by 0cead77 2017-01-04 14:14:23 -05:00
Zach Riggle cca9782424 Add PR_SET_PTRACER to process and ssh.process (#828)
* Add PR_SET_PTRACER to initialization, and add doctests for process.leak/corefile

* Add PR_SET_PTRACER to SSH processes

* Do not warn about YAMA if we dont need to

* Fix doctest to use raw strings

* Fix typo in doctest

* Apparently GDB is not installed on Travis by default

* Add warning message to process("foo") vs process("./foo")

* Add gdb.corefile; make run_in_new_terminal return a PID

* Intentionally break doctest because I dont believe that it worked

* Fix codacy issues

* Fix gdb.attach return value

* Add missing import

* Fix typo, use waitpid

* Refactor some code into gdb.version / gdb.binary

* Permit GDB with multipart versions

* Fix repr() on Corefile

* Silence run-in-new-terminal message for gdb.corefile

* Fix version number

* Remove Yama warning message entirely, it should no longer be necessary

* Version detection is hard.  Regular expressions to the rescue!

* Remove process.kill/stop/resume, those will be a different PR

* Fix doctests

* The GDB used by Travis must be so old!

* Apparently Travis is entirely borked.  Use a less robust test.
2017-01-04 12:59:22 -05:00
Zach Riggle 5ce5339ab5 Silence warning during doctests 2017-01-04 12:58:04 -05:00
Zach Riggle 0cead77039 Move STDOUT/PIPE to process class, so they can be referenced directly 2017-01-04 12:52:19 -05:00
Zach Riggle 1d59a90fa8 Change all imports to absolute per PEP-328, and sort imports (#832) 2017-01-03 18:04:45 -05:00
Zach Riggle ac017d97dc Enable leaking memory relatively with MemLeak (#822)
* Enable leaking memory relatively with MemLeak

Fixes Gallopsled/pwntools#758

* Add RelativeMemLeak alias for MemLeak(..., relative=True)

* Make codacy happy
2016-12-29 13:21:02 -05:00
WGH b584ca349a fixed RuntimeError in setup.py caused by pandoc on non-amd64 arches (#820)
If pandoc is not installed locally, pwntools' setup.py
tells pypandoc to download one.

Unfortunately, it fails on non-amd64 arches because
pypandocs provides precompiled binaries only for amd64.

Since pypandoc is not hard dependency for pwntools,
this error can be skipped without major harm.

In fact, pwntools' setup.py already handles ImportError
gracefully. The problem is, arch mismatch causes
a completely different exception.
2016-12-28 19:12:47 -05:00
Mathias Svensson 8b30700f92 Bump to 3.5.0dev 2016-12-24 12:14:05 +01:00
Mathias Svensson 7ed118763b Merge branch 'dev' into beta 2016-12-24 11:54:21 +01:00
Mathias Svensson 5a370162e5 Release 3.3.0 2016-12-24 11:26:18 +01:00
Mathias Svensson 253ab78e4c Merge branch 'stable' into beta 2016-12-24 11:25:12 +01:00
Mathias Svensson e997c17397 Merge branch 'beta' into dev 2016-12-24 11:10:10 +01:00
Mathias Svensson 0acc8ee499 Merge branch 'stable' into beta 2016-12-24 11:00:32 +01:00
Mathias Svensson d39f9a145e Release 3.2.1 2016-12-24 10:53:02 +01:00
Zach Riggle f14e0e5652 Reorder get_buffer_size so that the value is validated
This prevents silly things like tube.recv("abcdef") which will hang
2016-12-22 16:41:51 -05:00
Zach Riggle aaa83983ad Merge branch 'beta' into dev 2016-12-22 16:27:46 -05:00
Zach Riggle 1b76a27bd5 Merge remote-tracking branch 'upstream/stable' into beta-staging 2016-12-22 16:26:31 -05:00
Zach Riggle 87491bf6dc Fix install script for new branches, where TRAVIS_COMMIT_RANGE is empty 2016-12-22 14:40:43 -05:00
Zach Riggle b30835ec5b Fix regression introduced in 386e68691f 2016-12-22 14:03:09 -05:00
Zach Riggle 1241073391 Remove support for installation without psutil (#821)
* Remove support for installation without psutil.

OpenBSD was the edge case we cared about, it is supported for over a year (giampaolo/psutil#615)

* Bump psutil version to when they introduced OpenBSD support
2016-12-20 14:06:06 -05:00
Zach Riggle cfcd79e169 Update install strings to include libffi-dev and be consistent 2016-12-16 11:37:13 -06:00
Zach Riggle 706a784904 Directly invoke sock.close() when we hit POLLHUP 2016-12-15 20:20:07 -06:00
Zach Riggle 70c96330de Make sock.connected much more robust by using socket.poll (#817)
* Make sock.connected much more robust by using socket.poll

* Fix use of socket.socket.recv vs. ssh transport recv
2016-12-15 20:15:19 -06:00
Zach Riggle cae3cddc07 Fix incorrect error message in serialtube 2016-12-15 20:04:12 -06:00
Zach Riggle 5373dcdeed Fix dev-only regression in serialtube constructor, and use Timeout object properties 2016-12-15 20:04:12 -06:00
Zach Riggle 5d4bf3db6c Add MemLeak.u64/u32/... aliases 2016-12-15 17:15:10 -06:00
Zach Riggle fbfa54ad61 Fix failing doctestse on dev 2016-12-15 16:45:08 -06:00
Zach Riggle b323264032 Merge branch 'beta' into dev 2016-12-15 15:05:16 -06:00
Zach Riggle 332c9d2031 Merge remote-tracking branch 'upstream/stable' into beta-staging 2016-12-15 14:52:39 -06:00
Zach Riggle 036397c861 Fix adb.uninstall() typo (#816)
Closes Gallopsled/pwntools#783
2016-12-15 14:52:25 -06:00
Zach Riggle dcf03fd44d Bugfix for None data from field (#815) 2016-12-15 14:13:36 -06:00
Zach Riggle df54bf2bb3 Dont barf if home directory is not writable (#814)
* Handle the home directory being read-only / cache directory being unavailable

Fixes Gallopsled/pwntools#799

* Add doctest for context.cache_dir
2016-12-15 14:04:45 -06:00
Zach Riggle 386e68691f Multiple ADB performance and functionality fixes (#811)
* Fix ADB wait_for_device with ANDROID_SERIAL set, and fix performance

* Fix QEMU usage for native binaries

* Fix adb.write and adb.listdir operating on the wrong type of object

* Fix failing unit test with new behavior in adb.protocol.Client.list

* Fix adb server startup issue

* Rework deferred initialization to work around class-scope superclass attributes, and add test for AdbDevice
2016-12-14 17:34:18 -06:00
Zach Riggle 2c841eaa21 Add adb.{unlink,mkdir,makedirs,isdir,exists} (#809)
* Add adb.{unlink,mkdir,makedirs,isdir,exists}

* Change unlink() to throw an exception rather than return a string

* Fix doctest and code for isdir

* Remove unused variable
2016-12-14 16:49:41 -06:00
Zach Riggle 22f170abc7 Check the name before attempting to call startswith() (#805) 2016-12-14 16:47:38 -06:00
Zach Riggle 350610fbee Fix error message with StrictHostKeyChecking (#813) 2016-12-14 16:37:05 -06:00
Zach Riggle c7b3852eae Fix exception thrown under 32-bit Python interpreters. (#804)
Fixes Gallopsled/pwntools#518
2016-12-14 16:26:29 -06:00
Zach Riggle eaf6402198 Fix adb.partitions listing (#802)
* Fix adb.partitions listing

* Add adb.walk and adb.find functions to ensure adb.partitions works on devices without a find binary

* Add adb.readlink to simplify logic for reading symlinks
2016-12-14 15:37:47 -06:00
Zach Riggle d2c6184a00 Add missing changelog entry 2016-12-14 14:58:00 -06:00
Zach Riggle e5645e7b53 Update CHANGELOG missing links 2016-12-14 14:49:54 -06:00
Zach Riggle 09dbe0a54d Update CHANGELOG links 2016-12-14 14:49:27 -06:00
Zach Riggle 0bd0de78f9 Update CHANGELOG 2016-12-14 14:48:19 -06:00
Zach Riggle 546061e577 Modify coredump_filter of spawned processes so that library contents are included 2016-12-12 18:26:46 -06:00
Zach Riggle 5ebc8b5bb7 Check the name before attempting to call startswith() 2016-12-12 18:26:46 -06:00
Zach Riggle b83a6c7db8 Fix process.leak by providing a sane default leak size 2016-12-05 15:44:04 -05:00
Owlz 5d9792fb4c Variable Size Buffer Fill (#806)
Support custom buffer-read sizes for `tube` objects via their internal `Buffer` object.  Default buffer size is 4096.  Buffer size can be set per-object at instantiation-time (`tube(buffer_fill_size=...)`), by attribute (`tube.buffer_fill_size=...`), or in a context (`context.buffer_size=...`).
2016-12-05 15:21:08 -05:00
Zach Riggle 1c54e347f2 Add 'shell' option for ssh.process to pass to "sh -c" (#800)
Add 'shell' option for ssh.process to pass to "sh -c"
2016-11-29 11:52:44 -07:00
Ricky Zhou 2f597f41d4 Properly handle exceptions in remote._connect. (#793)
Previously, if getaddrinfo or socket.socket threw an exception,
_connect would return without ever calling h.success or h.failure. As a
result, progress indicators would continue to update indefinitely.

Fix this by using a with statement instead.

(Also remove an unused variable and fix a typo.)
2016-11-28 14:45:20 -07:00
Zach Riggle 7545dafffb Wrap context.log_console when using terminal I/O (#797)
Fixes Gallopsled/pwntools#792
2016-11-23 11:11:17 -07:00
Zach Riggle 3acec5421f Set shell=False 2016-11-12 23:16:32 -08:00
Mathias Svensson 620364dd1d Fixed a link in CHANGELOG.md 2016-11-12 21:10:05 +01:00
Mathias Svensson b441cf967a Start work on 3.4.0 2016-11-12 20:39:25 +01:00
Mathias Svensson 76c21548db Release 3.3.0beta0 2016-11-12 19:33:58 +01:00
Mathias Svensson ad71d9235b Release 3.2.0 2016-11-12 13:43:56 +01:00
Mathias Svensson 2e5f8061b2 Merge branch 'stable' into beta 2016-11-12 12:59:46 +01:00
Zach Riggle 099404277e Enhance documentation and error logging for ssh.process preexec_fn usage (#787)
Also fix other incorrect log usage

Fixes Gallopsled/pwntools#786
2016-11-12 12:58:24 +01:00
Zach Riggle 30c34b785a Fix ROP.call(Function(...)) breaking dump()
Fixes #770
2016-11-10 14:23:28 -08:00
Zach Riggle 6c304d3511 Add a bit more docs to the ADB module 2016-11-10 13:50:15 -08:00
Zach Riggle dc297e17ae Fix docstring commit [skip ci] 2016-11-07 18:52:12 -08:00
Zach Riggle fa402ceb57 Add adb.uptime and adb.boot_time 2016-11-07 17:53:52 -08:00
Zach Riggle 483adb8e2d Update ISSUE_TEMPLATE.md 2016-11-07 12:05:00 -08:00
Zach Riggle 76fe04e356 Fix log message error in adb.uninstall 2016-11-01 16:14:55 -07:00
Justin Steven 82312baba0 Add cyclic_metasploit() and cyclic_metasploit_find() (#785)
* Add cyclic_metasploit and cyclic_metasploit_find

* Stop using mutable default arguments
2016-10-26 17:19:19 -07:00
Zach Riggle d101a775aa Fix adb.uninstall() typo
Closes Gallopsled/pwntools#783
2016-10-26 10:25:34 -07:00
Mathias Svensson 5fda6580e8 Expose the BitPolynom (#755) 2016-10-23 22:38:50 +02:00
Mathias Svensson 9185437626 Merge branch 'beta' into dev 2016-10-23 11:35:03 +02:00
Mathias Svensson bde40c36ae Merge branch 'stable' into beta 2016-10-23 11:12:35 +02:00
Mathias Svensson 894b17e74a Release 3.1.1 2016-10-23 11:11:39 +02:00
Mathias Svensson 33b734cbc6 Added a doctest for MemLeak.struct 2016-10-23 11:11:32 +02:00
Morten Brøns-Pedersen 3e8454412e Bugfix in MemLeak.struct. (#768)
The function didn't work due to `sizeof` not being defined.  This PR imports
`ctypes` and uses `ctypes.sizeof`.
2016-10-23 10:53:04 +02:00
Zach Riggle 420f99c5d0 Automatic update checking should not log to stdout. (#774)
This breaks piping into files for all of the command-line utilities.
2016-10-20 15:41:00 -07:00
Zach Riggle 98052e4166 Add an error to cyclic() if the requested length is too long (#782)
$ cyclic 999999999
[ERROR] Can't create a pattern length=999999999 with len(alphabet)==26 and n==4

Fixes Gallopsled/pwntools#781
2016-10-19 09:18:41 -07:00
Mathias Svensson e971856c74 Merge branch 'beta' into dev 2016-10-18 23:09:45 +02:00
Mathias Svensson 09ee73c31d Merge branch 'stable' into beta 2016-10-18 22:58:20 +02:00
Zach Riggle 0c4d1365e9 Fix documentation generation since autoprogram broke Python2 2016-10-18 22:57:32 +02:00
Mathias Svensson b3f941c3f5 Merge branch 'beta' into dev 2016-10-18 22:42:29 +02:00
Justin Steven 67e11a9aeb Fix typos in cyclic.py's docstrings (#775) 2016-10-18 13:26:42 -07:00
Mathias Svensson 7d5f8ca4b4 Release 3.2.0beta4 2016-10-18 22:22:19 +02:00
Zach Riggle 7695acc798 Fix bash completion regression (#772)
Fixes Gallopsled/pwntools#767
2016-10-18 22:17:31 +02:00
Zach Riggle 3f48a0b803 Remove all Github update checks (#761)
These were nice-to-have, but as long as PyPi is updated and functioning
properly, we don't need to check Github.

Fixes Gallopsled/pwntools#756
2016-10-18 21:58:03 +02:00
Zach Riggle fd731154ff Make process.argv optional, using context.binary 2016-10-15 14:29:13 -07:00
Isaac 906bc94a5f fix typo in TESTING.md (#769) 2016-10-15 13:31:42 +02:00
bstub db03e7de10 Adding escaped hex output format to shellcraft -f option (#765)
* adding output format for python hex-notation

* cleaned up implementation

* changed format identifier to {a} --escaped

* {a] was taken by asm, changed format identifier to {d} --escaped

* adding {e}lf to help
2016-10-14 13:13:02 -07:00
Morten Brøns-Pedersen 97e03fd29f Bugfix in MemLeak.struct. (#768)
The function didn't work due to `sizeof` not being defined.  This PR imports
`ctypes` and uses `ctypes.sizeof`.
2016-10-14 13:11:18 -07:00
Zach Riggle 09b8bb93a7 Fix regressions introduced by f9133b1680 2016-10-14 13:10:13 -07:00
Zach Riggle f9133b1680 Add STDERR argument, and write docs for args module (#760)
Add STDERR argument, and write docs for args module

Fixes Gallopsled/pwntools#759
2016-10-10 19:13:45 -07:00
Mathias Svensson 8aa21bd99a Merge branch 'beta' into dev 2016-10-11 03:06:21 +02:00
Mathias Svensson e5b6aedd3d Release 3.2.0beta3 2016-10-11 03:00:18 +02:00
Zach Riggle 4b405c69b6 Fix incorrect usage of argv in unhex 2016-10-11 02:59:52 +02:00
Zach Riggle 9af20c778f Fix incorrect usage of argv in unhex 2016-10-10 17:55:13 -07:00
Mathias Svensson d1621dca87 Merge branch 'beta' into dev 2016-10-10 15:50:53 +02:00
Mathias Svensson 31b047d29b Release 3.2.0beta2 because pypi is being retarded 2016-10-10 15:48:52 +02:00
Mathias Svensson 39970c3847 Merge branch 'beta' into dev 2016-10-10 14:59:41 +02:00
Mathias Svensson e0c65c9d6d Release 3.2.0beta1 2016-10-10 14:58:51 +02:00
Zach Riggle 59d0cd2eeb Fix wait-for-device with kick=True re-using the same client (#757) 2016-10-10 14:58:00 +02:00
Zach Riggle 8d11fb8594 Fix wait-for-device with kick=True re-using the same client (#757) 2016-10-09 20:00:00 -07:00
Zach Riggle aec3fa6879 Remove all Github update checks (#761)
These were nice-to-have, but as long as PyPi is updated and functioning
properly, we don't need to check Github.

Fixes Gallopsled/pwntools#756
2016-10-07 15:30:38 -07:00
Zach Riggle ab6602407e Move issue/pr templates to .github 2016-10-07 15:18:58 -07:00
Zach Riggle 42ab0c985d Sort inputs with isort 2016-10-05 15:51:05 -07:00
Zach Riggle b215828133 Make tube.stream() more robust 2016-10-05 15:49:41 -07:00
Zach Riggle e3af4ce6a7 Update changelog 2016-10-05 15:44:13 -07:00
Zach Riggle 96c6edcc37 Update changelog 2016-10-05 15:44:03 -07:00
Zach Riggle b198ec8633 Add tube.stream() 2016-10-05 15:43:04 -07:00
Mathias Svensson c8a87381e8 Merge branch 'beta' into dev 2016-10-02 20:38:08 +02:00
Mathias Svensson 548e033e7e Release 3.2.0beta0 by merging branch 'stable' into beta 2016-10-02 20:32:09 +02:00
Mathias Svensson fc097f3446 Fixed a link in the CHANGELOG 2016-10-02 20:27:51 +02:00
Mathias Svensson eb92a95134 Release 3.1.0 2016-10-02 20:12:51 +02:00
Zach Riggle c706461f10 Add branch table 2016-10-02 20:07:12 +02:00
Zach Riggle b0ad5eb915 Add branch table 2016-09-28 13:31:56 -07:00
Zach Riggle 94f88cc8ba Update changelog 2016-09-28 13:13:53 -07:00
Zach Riggle 1e414afbeb Add connect() alias for remote(), add docs for tcp() and udp() aliases 2016-09-28 13:05:54 -07:00
Zach Riggle 869ec42082 Add ssh.read and ssh.write aliases 2016-09-28 13:04:28 -07:00
Zach Riggle 4893819b4c Add adb.install, adb.uninstall, and adb.packages 2016-09-28 12:42:22 -07:00
Zach Riggle fb1b952769 Do not wrap non-functions 2016-09-27 19:31:50 -07:00
Zach Riggle 859380285f Handle missing properties for AdbDevice 2016-09-27 19:08:41 -07:00
Zach Riggle 2af55c9bc3 Allow device-scoped access to ADB facilities off of AdbDevice 2016-09-27 19:04:24 -07:00
Zach Riggle 4725b1be96 adb.adb(["shell", ...]) should go through adb.process() 2016-09-27 13:55:35 -07:00
Zach Riggle 5af5f0c55d Fix adb.push statement ordering 2016-09-26 18:10:18 -07:00
Zach Riggle e84f395c97 Wait for the currently-selected device in wait_for_device 2016-09-26 18:03:27 -07:00
Zach Riggle fbf51ad96e Fix target adb.push() 2016-09-26 17:56:28 -07:00
Zach Riggle 52433339ec adb.protocol.Connection should always pack as 32-bit 2016-09-26 17:43:26 -07:00
Zach Riggle f277d5502f Allow adb.push to specify a full target filename in an existing directory 2016-09-26 16:53:31 -07:00
Zach Riggle 794122ec13 Add kwargs to handle weird "adb devices" output 2016-09-26 16:49:34 -07:00
Zach Riggle 65b266e9b3 Revert part of 8793dec, fix commands, remove shippable.yml 2016-09-26 16:49:34 -07:00
Zach Riggle ca6eddc235 shellcraft.xxx.linux.sh now passes argv0 (#734)
shellcraft.xxx.linux.sh now passes argv0

If you need shorter shellcode, use "execve" directly.

Fixes Gallopsled/pwntools#626
2016-09-25 18:31:29 -07:00
Zach Riggle 8793decd1c Remove additional references to "--pre" and use "python setup.py develop" instead of "-e" magic
Related to Gallopsled/pwntools#735
2016-09-19 17:18:57 -07:00
Mathias Svensson 628aaabd04 Bump the version number in the pip badge 2016-09-19 23:24:01 +02:00
Mathias Svensson 3544167f26 Merge branch 'beta' into dev 2016-09-19 23:16:04 +02:00
Mathias Svensson 9cca9c989b Merge branch 'stable' into beta 2016-09-19 23:07:53 +02:00
Mathias Svensson f42c291fef Release 3.0.4 2016-09-19 22:57:54 +02:00
Zach Riggle dacdd397ab Merge remote-tracking branch 'upstream/stable' into beta 2016-09-19 13:10:34 -07:00
Zach Riggle c0f02d453a Merge pull request #752 from zachriggle/fix-setup
Add all MD and TXT files to binary distribution; include correct file…
2016-09-19 21:52:55 +02:00
Felix Yan 627ed5cbd5 Fix a typo: termianl -> terminal (#750) 2016-09-19 10:28:18 -07:00
Mathias Svensson 3fb64f9fe0 Merge branch 'beta' into dev 2016-09-19 00:31:31 +02:00
Mathias Svensson 254958bae9 Merge branch 'stable' into beta 2016-09-19 00:28:50 +02:00
Mathias Svensson 1cb47220f1 Fixed this binutils-multiarch path 2016-09-19 00:27:56 +02:00
Mathias Svensson d9be4f9ce0 Made the wget timeout longer 2016-09-19 00:18:37 +02:00
Mathias Svensson 2cd5aadf9d Merge branch 'beta' into dev 2016-09-18 22:58:32 +02:00
Mathias Svensson 6ebcc6f3a2 Merge branch 'stable' into beta 2016-09-18 22:31:34 +02:00
Mathias Svensson 21ce572dd6 Make CHANGELOG.md closer follow dev for easier forwardporting in the future 2016-09-18 22:30:23 +02:00
Mathias Svensson 1c47a30446 Bump the version number in README.md 2016-09-18 22:26:44 +02:00
Mathias Svensson 5b8ccb60a6 Merge branch 'beta' into dev 2016-09-18 22:14:53 +02:00
Mathias Svensson 89fc74facf Merge branch 'stable' into beta 2016-09-18 21:35:21 +02:00
Mathias Svensson 5a79a5e609 Release 3.0.3 2016-09-18 21:21:42 +02:00
Mathias Svensson c92f9bed42 I was being stupid when I did #744, since @zachriggle was not done. This is (hopefully) a more proper fix. 2016-09-18 21:09:29 +02:00
Mathias Svensson bfb534378b Removed verbosity from travis files 2016-09-18 19:35:28 +02:00
Mathias Svensson 0ddcf8b129 Add a test that we will *not* update when we have a never local version 2016-09-18 19:35:06 +02:00
Mathias Svensson a66376b8a0 Merge branch 'faster-update-import' of https://github.com/zachriggle/pwntools into merge-738 2016-09-18 15:23:25 +02:00
Mathias Svensson 9cb53d90fe Merge branch 'corefile-pyelftools' of https://github.com/binjitsu/binjitsu into release-3.0.3 2016-09-18 15:00:37 +02:00
Mathias Svensson a31cec5e81 Removed aarch64 install as it is broken and not currently needed and stopped bailing out even if .ssh exists 2016-09-18 14:50:52 +02:00
Zach Riggle 5367a3528d Promote binutils installation 2016-09-18 14:49:59 +02:00
Zach Riggle 669e7295c6 Auto-detect the current URL for QEMU rather than relying on a hard-coded URL 2016-09-18 14:49:03 +02:00
Zach Riggle a7f32d1b0f Bail on any error 2016-09-18 14:48:05 +02:00
Mathias Svensson efc531a2a9 Merge pull request #744 from Idolf/fix-tests
Fix Travis CI (building upon #743)
2016-09-18 14:45:53 +02:00
Mathias Svensson 8b959c9ede Removed aarch64 install as it is broken and not currently needed and stopped bailing out even if .ssh exists 2016-09-18 14:39:43 +02:00
Zach Riggle 68051f9987 Promote binutils installation 2016-09-17 20:50:20 -07:00
Zach Riggle 3636657ca0 Auto-detect the current URL for QEMU rather than relying on a hard-coded URL 2016-09-17 20:40:26 -07:00
Zach Riggle f282ef8bbc Bail on any error 2016-09-17 20:09:17 -07:00
Zach Riggle d5fbb21f72 Switch from pkg_resources to packaging, for performance reasons
Also backports the PyPi documentation changes to stable.

Fixes #736
2016-09-17 18:13:57 -07:00
Zach Riggle 57e9bf58a5 Update changelog 2016-09-17 18:06:30 -07:00
Zach Riggle 0ce21d9b45 Add pandoc requirement for Travis 2016-09-14 19:00:36 -07:00
Zach Riggle 89649fbeb0 Use HTTPS for link 2016-09-14 15:28:14 -07:00
Zach Riggle 5924c0f340 Use new domain for update_demo 2016-09-14 14:57:05 -07:00
Zach Riggle 2f9f10c182 Remove SSH info 2016-09-14 14:27:34 -07:00
Zach Riggle d7c98c4819 Remove reference to --pre until Gallopsled/pwntools#735 has a solution 2016-09-14 14:10:22 -07:00
Zach Riggle cd0ba369b8 Fix bug introduced by internal changes to pyelftools v0.2.4 2016-09-14 12:23:47 -07:00
Zach Riggle bebc84522d Make update mechanism more robust, add tests (#729)
* Make update mechanism more robust, add tests
* Add pwnlib.update to documentation, enable doctests

Fixes Gallopsled/pwntools#723
Fixes Gallopsled/pwntools#724
2016-09-12 21:09:52 -07:00
Zach Riggle e7875c78bc Add pwnlib.flag and submit_flag (#732)
* Add pwnlib.flag and submit_flag
2016-09-12 21:03:16 -07:00
Zach Riggle 0a37694436 Sort imports with isort 2016-09-12 20:35:36 -07:00
Zach Riggle 742a11bfdc Add links to CONTRIBUTING and TESTING in templates 2016-09-10 17:33:22 -07:00
Zach Riggle 1e7262ce31 Add templates for Pull Requests and Issues (#733)
Fixes #651
2016-09-10 17:27:02 -07:00
Zach Riggle d733cf6560 Fix failing doctest because of httpbin slowness (#731) 2016-09-09 17:46:34 -07:00
Zach Riggle 3818dda9d9 Extract copy-pasted callback routine, add better errors and doctests … (#728)
* Extract copy-pasted callback routine, add better errors and doctests for adb.{push,pull}
* Add protocol submodule to documentation and doctests
* Add and fix doctests in adb.protocol
* Use pprint to sort dicts
2016-09-09 15:29:38 -07:00
Zach Riggle 18c4a49aa3 Add pprint to toplevel 2016-09-08 14:34:47 -07:00
Zach Riggle 77f7a362d0 Version bump 2016-09-08 10:56:38 -07:00
Zach Riggle 738fadc016 Add .os to Device and set it automatically (#727)
The use case here is setting context.os via:

>>> context.device = adb.wait_for_device()
2016-09-07 16:34:10 -07:00
Zach Riggle b97f30f36f Add better description to PyPI, more classifiers (#721) 2016-09-07 16:34:00 -07:00
Mathias Svensson de05e7a4b8 Merge branch 'beta' into dev 2016-09-06 11:46:45 -10:00
Mathias Svensson 5fe024838b Release 3.1.0beta1 2016-09-06 11:36:27 -10:00
Mathias Svensson 8b07fe12e6 Release 3.0.2 2016-09-06 11:33:46 -10:00
Mathias Svensson cd828d6bca Merge branch 'beta' into dev 2016-09-06 11:31:21 -10:00
Mathias Svensson b60103b839 Merge branch 'stable' into beta 2016-09-06 11:30:58 -10:00
Mathias Svensson 684e9f6791 Changed util.fiddling.hexdump_iter to take a file object instead of a string. This massively speeds up phd <file> | less for huge files. (#695) (#725) 2016-09-06 11:30:51 -10:00
Mathias Svensson 5acc4c8ec3 Merge branch 'beta' into dev 2016-09-06 10:07:53 -10:00
Mathias Svensson a5c2b9276a Merge branch 'stable' into beta 2016-09-06 10:07:33 -10:00
Mathias Svensson 8d15fceb92 Backported #720. (#722)
The backport only includes the changes in pwnlib/update.py, not the
stuff in pwnlib/commandline/
2016-09-06 10:06:45 -10:00
Zach Riggle 913a3eba9e Pwn update (#720)
* Fix help printing e.g. "shellcraft shellcraft" instead of "pwn shellcraft" when invoking legacy entry points [skip ci]

* Add "pwn update" command; prevent automatic updates from showing pre-release
2016-09-02 16:58:47 -07:00
Zach Riggle 041e62bf0b Update changelog [skip ci] 2016-09-02 15:20:14 -07:00
Zach Riggle e61f571f7c Add adb.protocol module, and use it for most things (#709) 2016-09-02 15:16:26 -07:00
Zach Riggle 36d00b615d Update changelog [skip ci] 2016-09-02 15:10:10 -07:00
Zach Riggle 25d340b5c5 Re-implement sh_string to use embedded literals, add lots of tests (#717)
* Re-implement sh_string to use embedded literals, add lots of tests
* Add docs for sh_string so that unit tests get picked up
* Mark the docstrings as raw
* Rewrite doctests to not "print" since this breaks with invisible characters (issue with doctest itself)
* Add test which uses 16KB of random non-NUL data
2016-09-02 14:56:05 -07:00
Zach Riggle 8f06c1f90f Add docs for Xenial binutils, and attempt to auto-detect Debian packages (#718)
An error message will be printed like this when a package is found:

>>> context.arch='powerpc'
>>> pwnlib.asm.print_binutils_instructions('objdump', context)
[ERROR] Could not find 'objdump' installed for ContextType(arch = 'powerpc', bits = 32, endian = 'big')
    Try installing binutils for this architecture:
    $ sudo apt-get install binutils-powerpc-linux-gnu
2016-09-02 14:21:40 -07:00
Zach Riggle ae6a0745ff Fix function-decorator use-case for context.quiet (#714) 2016-09-01 16:23:32 -07:00
Zach Riggle 1d924af9d2 Update changelog [skip ci] 2016-09-01 15:36:47 -07:00
Zach Riggle fed432877c Merge pull request #711 from binjitsu/brk
Add heap leak from the linker. Fixes Gallopsled/pwntools#435
2016-09-01 15:35:19 -07:00
Zach Riggle 46261091dd Update date formatting 2016-09-01 15:17:59 -07:00
Zach Riggle c356b69a13 Add notices 2016-09-01 15:16:24 -07:00
Zach Riggle 6cff484b8c Update changelog [skip ci] 2016-09-01 15:15:30 -07:00
Zach Riggle 8314dff386 Update changelog [skip ci] 2016-09-01 15:14:24 -07:00
Zach Riggle dc40ac1117 Add heap leak from the linker. Fixes Gallopsled/pwntools#435
(cherry picked from commit 5808882cfe)
2016-09-01 14:57:00 -07:00
Zach Riggle 288b9668b7 Add Android emulator to Travis (#705)
* Add Android emulator to Travis

* More robust handling of ADB device status, and lack of devices

* Add platform-tools to PATH for adb, fastboot, etc.

* Add basic tests for some ADB code

* Add with_device annotation to auto-detect a device

* Skip Android emulator installation if we dont need it

* Do not install emulator in all cases (e.g. OSX)
2016-08-30 17:44:14 -07:00
Zach Riggle 3c0697b81e Refactor command-line tools to use a single "pwn" entry point. (#701)
Adds an install-time option to disable legacy commands, and only use 'pwn':

  $ pip install --install-option='--only-use-pwn-command'

Documentation is updated to show 'pwn' entry point and sub-commands.

Fixes #404
Fixes #660
2016-08-30 17:37:28 -07:00
Zach Riggle 6e4e46386f Do not install emulator in all cases (e.g. OSX) 2016-08-30 17:30:29 -07:00
Zach Riggle 9b179567da Remove un-cacheable Android SDK and NDK directories from Travis cache 2016-08-30 17:28:30 -07:00
Zach Riggle b20e17dd13 Skip Android emulator installation if we dont need it 2016-08-30 17:27:33 -07:00
Zach Riggle 3dcfafc0de Fix unit test quote style and ELLIPSE formatting 2016-08-30 16:32:05 -07:00
Zach Riggle 348bcac0ff Fix unit test failures in ADB module 2016-08-30 14:40:32 -07:00
Zach Riggle a43c3b4967 Add with_device annotation to auto-detect a device 2016-08-29 14:43:04 -07:00
Zach Riggle 40bf991153 Add basic tests for some ADB code 2016-08-29 14:43:04 -07:00
Zach Riggle 8f98c01b77 More robust handling of ADB device status, and lack of devices 2016-08-29 14:43:04 -07:00
Zach Riggle 18a8cfb88d Disable verbose logging 2016-08-29 14:43:04 -07:00
Zach Riggle 2acdeef320 Add missing bracket 2016-08-29 14:43:04 -07:00
Zach Riggle 23c09b4b1b Add platform-tools to PATH for adb, fastboot, etc. 2016-08-29 14:43:04 -07:00
Zach Riggle 84c71d6b07 Squelch travis 4MB log error 2016-08-29 14:43:04 -07:00
Zach Riggle c6aa6bccb8 Add Android emulator to Travis 2016-08-29 14:43:04 -07:00
Zach Riggle 041c665185 Reorganize Travis stuff; add hook to re-generate demo.pwntools.com on pushes to stable (#708) 2016-08-29 14:24:51 -07:00
Zach Riggle 70f9c0305d Add alarm option for process() (#704)
* Add `alarm` option for process()

* Add signal to toplevel import
2016-08-29 14:20:37 -07:00
Zach Riggle 66e41bd862 Refactor command-line tools to use a single "pwn" entry point.
Adds an install-time option to disable legacy commands, and only use 'pwn':

  $ pip install --install-option='--only-use-pwn-command'

Documentation is updated to show 'pwn' entry point and sub-commands.

Fixes #404
Fixes #660
2016-08-28 11:46:09 -07:00
Zach Riggle 5140d03b4d Add MIPS documentation, which should also trigger doctests (#700)
* Add MIPS documentation, which should also trigger doctests
* Fix broken and missing doctests for MIPS pushstr / syscall
* Add optimization for mips.mov to fix doctest
* Exit cleanly so QEMU doesn't complain
2016-08-28 11:40:42 -07:00
Mathias Svensson b016179ccc Merge branch 'beta' into dev 2016-08-24 20:04:59 -07:00
Mathias Svensson efaea581a1 Merge branch 'stable' into beta 2016-08-24 20:04:06 -07:00
Evan Grim 24dfaa0ff7 Fix typos (#702) 2016-08-24 20:03:37 -07:00
Zach Riggle f4a72da40e Update MIPS execve to use pushstr_array 2016-08-24 14:59:50 -07:00
Zach Riggle 6376d07266 Add MIPS pushstr_array
Example resulting state:

$ shellcraft mips.pushstr_array '$t1' '["hello", "world", "boss!"]' -d --after
...
pwndbg> telescope $t1 4
00:0000| t1 sp  0x76ffec7c --> 0x76ffec8c <-- 'hello'
01:0004|        0x76ffec80 --> 0x76ffec92 <-- 'world'
02:0008|        0x76ffec84 --> 0x76ffec98 <-- 'boss!'
03:000c|        0x76ffec88 <-- 0x0
2016-08-24 17:57:24 -04:00
Zach Riggle ea94ee4ca5 Disallow usage of semicolons in run_in_new_terminal.
Fixes Gallopsled/pwntools#690
Fixes Gallopsled/pwntools#635
2016-08-24 14:36:43 -07:00
Zach Riggle 452605e854 Fix pwnlib.gdb temporary file removal.
In two instances, the file was not removed because of an incorrect lambda.

In two further instances, use of shell concatenation via run_in_new_terminal
were changed into GDB 'shell' commands.

This fixes Gallopsled/pwntools#629
2016-08-24 14:36:43 -07:00
Mathias Svensson dea8f00c01 Merge pull request #698 from Idolf/dev
Merged beta into dev and fixed the version number and changelog
2016-08-24 14:35:11 -07:00
Mathias Svensson b9d6b27b4e Merge branch 'beta' into dev 2016-08-24 14:24:21 -07:00
Mathias Svensson 300ef0b462 Merge branch 'Idolf-beta-changelog' into beta 2016-08-24 14:20:02 -07:00
Mathias Svensson 6e79272e8d Updated the changelog 2016-08-24 14:17:46 -07:00
Morten Brøns-Pedersen d65991d402 Changed util.fiddling.hexdump_iter to take a file object instead of a string. This massively speeds up phd <file> | less for huge files. (#695) 2016-08-24 14:15:29 -07:00
Zach Riggle de94449a87 Remove unreleased version from Changelog 2016-08-22 17:34:44 -07:00
Zach Riggle faeb57b35c Use manual 3.0.1 shield until we figure out how to make this automagic 2016-08-22 16:42:45 -07:00
Mathias Svensson e1332d277c Merge branch 'beta' into dev (#678) 2016-08-22 15:26:40 -07:00
Mathias Svensson e4c2a48696 Merge pull request #679 from Gallopsled/stable
Even more documentation (#678)
2016-08-22 15:22:39 -07:00
Mathias Svensson 6415367f15 Even more documentation (#678) 2016-08-22 15:16:02 -07:00
Mathias Svensson fcf2842d87 I am an idiot 2016-08-22 14:58:42 -07:00
Mathias Svensson 422dccd8da Merge branch 'beta' into dev 2016-08-22 14:54:33 -07:00
Mathias Svensson abd08a94ea Fixed the logo path to be closer to stable 2016-08-22 14:48:26 -07:00
Mathias Svensson e877f7455a Merge branch 'stable' into beta 2016-08-22 14:37:33 -07:00
Mathias Svensson 70c224f429 Merged in some documentation fixes.
Since this commit only changes documentation and not code, it does not
trigger a new release.
2016-08-22 14:33:47 -07:00
Mathias Svensson 5f7c525023 Fix some more documentation 2016-08-22 14:30:11 -07:00
Mathias Svensson 16de5ec22c Fix a lot of documentation (#675) 2016-08-22 13:11:50 -07:00
Mathias Svensson e635bcfea7 Merging #674 into dev 2016-08-20 18:40:54 -07:00
Mathias Svensson 12b60447da Merging #674 into beta 2016-08-20 18:39:00 -07:00
Mathias Svensson 5c804d49d0 Release 3.0.1 after merging #673 2016-08-20 18:26:35 -07:00
Mathias Svensson cde19135eb Fixed some documentation 2016-08-20 18:19:07 -07:00
Mathias Svensson 77da84c5a8 Prepare the dev branch 2016-08-20 17:51:55 -07:00
Mathias Svensson 2663762a9a Prepare the beta branch 2016-08-20 17:48:37 -07:00
Mathias Svensson 7aa9605629 3.0.0 release 2016-08-20 17:24:46 -07:00
Morten Brøns-Pedersen 757d7fe2c6 Merge pull request #667 from Idolf/issue-455
sh_string was broken in some cases, adds functionality to fix it. Fixes #455
2016-08-20 10:52:28 +02:00
Morten Brøns-Pedersen 9e724203b9 Merge pull request #650 from binjitsu/issue-591
Remove old inode-walking code in gdb module
2016-08-20 10:38:58 +02:00
Mathias Svensson 72207cf914 Fixed #455 2016-08-19 20:08:47 -07:00
Zach Riggle 824852bf33 Fix README links so they are valid, and work on pwntools.com (#653) 2016-08-18 13:14:42 -07:00
Zach Riggle b382849671 Add auto-update detection for new releases (#659) 2016-08-18 12:48:43 -07:00
Zach Riggle 0e814c91cc Merge pull request #669 from Idolf/issue-661
Adds some forgotten imports, fixes #661
2016-08-18 12:09:13 -07:00
Mathias Svensson d55a47a8fc Fixed a link in README.md (#670) 2016-08-18 11:58:17 -07:00
Zach Riggle 3b65f8775a Add coveralls.io build steps to .travis.yml (#655)
* Add coveralls.io build steps to .travis.yml

Fixes Gallopsled/pwntools#205

* Fix unit tests which fail under Coveralls

* Remove non-coverage "make doctest"

* Only report coverage for our code

* Add .coveragerc, ignore .coverage, shorten Travis script line

* Add Coveralls shield

* Fix spacing with badges and logo

* Add undocumented command-line tools to increase coverage
2016-08-18 11:22:41 -07:00
Zach Riggle fce5081c30 Make constgrep errors more verbose (#654) 2016-08-18 11:19:41 -07:00
Zach Riggle 39afc7998a Missed case where p_type needs to be converted to a string (#647) 2016-08-18 11:18:30 -07:00
Zach Riggle 1bfc56daa0 Actually enable the Thumb encoder (#646)
* Actually enable the Thumb encoder

* Fix thumb nop encoding NUL bytes
2016-08-18 11:14:47 -07:00
Zach Riggle 2d08e7cd99 Fix encoders.null typo (#645) 2016-08-18 11:14:10 -07:00
Mathias Svensson f7696f0388 Fixes #661 2016-08-18 11:07:47 -07:00
avarx 2947fb16dd Fix typo (#666) 2016-08-18 09:30:43 -07:00
Zach Riggle 9e57328d1b Add warning described in Gallopsled/pwntools#518 (#652) 2016-08-17 19:57:24 -07:00
Kristoffer Søholm 2198df5ea5 Merge pull request #664 from Gallopsled/fix-link
Fix install.html link.
2016-08-17 14:43:30 -07:00
Zach Riggle 40cc12ba95 Fix install.html link.
Fixes Gallopsled/pwntools#641
2016-08-17 13:31:27 -07:00
Zach Riggle 13f1815b7d Merge branch 'master' into issue-591 2016-08-17 12:04:43 -07:00
Zach Riggle 16846a80c6 Merge pull request #663 from Gallopsled/fix-link
Fix URL.  Fixes #662
2016-08-17 11:09:40 -07:00
Zach Riggle b29467dab6 Fix URL. Fixes Gallopsled/pwntools#662 2016-08-17 10:53:08 -07:00
Zach Riggle 969a9fe754 Remove old inode-walking code in gdb module
Fixes Gallopsled/pwntools#591
2016-07-26 15:03:04 +01:00
Mathias Svensson 23b0a019da Fixed a keyfile bug 2016-07-23 12:03:07 +02:00
Zach Riggle 99f9c80f15 Merge pull request #643 from PtxDK/patch-1
Update README.md
2016-07-18 17:53:46 +01:00
Kristoffer Søholm 3d5f859dd0 Merge pull request #638 from Idolf/remove-stale-files
Various stuff not merged correctly in #636.
2016-07-03 23:19:02 +02:00
Kristoffer Søholm 5c5e797cbf Merge pull request #637 from Idolf/remove-self-import
Builder imported itself
2016-07-03 23:04:43 +02:00
Patrick Krøll Brandt b2698f5513 Update README.md 2016-07-03 21:51:12 +02:00
Mathias Svensson 2baebf9e51 Use the pwntools twitter handle 2016-07-03 21:29:47 +02:00
Mathias Svensson 640051d41c Updated README.md based on the binjitsu-arm-syscall branch 2016-07-03 21:11:03 +02:00
Mathias Svensson 2f8de42cd8 Fixed IRC reference 2016-07-03 20:54:06 +02:00
Mathias Svensson ac8e053ca0 Removed binjitsu files not identified as stale in #636. 2016-07-02 23:09:57 +02:00
Mathias Svensson 741dffb47d Builder imported itself 2016-07-02 22:36:53 +02:00
Mathias Svensson ee77289111 Merge pull request #636 from binjitsu/pwntools-merge
Pwntools merge with Binjitsu
2016-07-02 21:10:42 +02:00
Zach Riggle 01cda51e3e Add date 2016-06-30 14:52:24 +02:00
Zach Riggle 2d72ccc30c Add commit count to changelog 2016-06-30 14:51:59 +02:00
Zach Riggle eee6ce3521 Add test for QEMU installation 2016-06-30 14:39:00 +02:00
Zach Riggle 7f933d3ffc Update QEMU static version 2016-06-30 14:38:16 +02:00
Zach Riggle 8680f2eeb6 Update Changelog for 3.0.0 release 2016-06-30 14:17:35 +02:00
Zach Riggle 06b81a3279 Remove Binjitsu fork info 2016-06-30 13:36:11 +02:00
Zach Riggle 33cdabf0ab Replace project name references 2016-06-30 02:28:42 +02:00
Zach Riggle c32ae58811 Replace domain names 2016-06-30 02:26:46 +02:00
Zach Riggle d4e42f86d0 Replace binjitsu/binjitsu with Gallopsled/pwntools 2016-06-30 02:26:22 +02:00
Zach Riggle bd6ef3f45e Merge remote-tracking branch 'gallopsled/master' into pwntools-merge 2016-06-30 02:24:01 +02:00
Zach Riggle a613d75abb Move logger functions to toplevel (add success) 2016-06-28 12:57:13 +02:00
Zach Riggle 2d8c8593de Modify ADB commands to specify host and port if they are provided via environment 2016-06-28 12:56:47 +02:00
Zach Riggle 054e3d50d5 Move logger functions to toplevel 2016-06-28 12:56:23 +02:00
Kristoffer Søholm bc93beb576 Merge pull request #625 from cebrusfs/patch-1
Fix wrong format string parameters in memleak.py
2016-06-23 01:32:17 +02:00
Kristoffer Søholm 2490ea207c Merge pull request #630 from justinsteven/bugfix/typo_attaching_you
Fix typo
2016-06-23 01:31:12 +02:00
Zach Riggle b06b544323 Clean up ADB partition code, enable enumeration and tab-completion 2016-06-21 06:29:17 +02:00
Zach Riggle 18d9646498 Do not return "." in listdir() 2016-06-21 06:22:01 +02:00
Justin Steven fc5b7b9425 Fix typo 2016-06-17 00:34:42 +10:00
Zach Riggle e8d8f4c4cc Do not record one-time warnings if they are not actually emitted 2016-06-14 16:04:02 -07:00
Zach Riggle e18eef7fae Add --file option to checksec for checksec.sh compatibility 2016-06-09 19:12:08 -06:00
Zach Riggle 396efcf71a Extend process() display changes to "stopped" message 2016-06-07 15:54:44 -06:00
Zach Riggle ee485a68d5 Strip adb shell from the display 2016-06-07 15:52:28 -06:00
Zach Riggle c0bc668450 Add a few twiddly bits for better process logs 2016-06-07 15:51:10 -06:00
Zach Riggle 7c8806950b Wrap all property accessors with str() 2016-06-07 12:42:12 -06:00
Zach Riggle ba5815bba5 Convert absolute paths to relative paths 2016-06-07 11:36:08 -06:00
Zach Riggle 25016264e7 Fix listdir implementation for some phones lacking a -1 option for LS 2016-06-07 11:31:38 -06:00
Zach Riggle 4d83a0d017 Silence GDB license on attach 2016-05-29 19:08:37 -04:00
Zach Riggle 67fd986360 Support unauthorized devices; old devices dont support -t 2016-05-29 19:00:43 -04:00
Zach Riggle fc1a7e2d11 Add warning message to cyclic_find; fix two-space indentation 2016-05-29 13:19:58 -05:00
Zach Riggle 112a246881 Minor fix for OS X serialtube naming for certain adapters 2016-05-28 20:07:19 -05:00
Zach Riggle c0c91841a7 Fix install info 2016-05-25 14:00:21 -05:00
Zach Riggle 70df2fa5f3 Fix double-warning for GDB without ASLR 2016-05-24 17:51:45 -07:00
Zach Riggle aedbafd9d6 Add ASLR-disabled warning to GDB 2016-05-24 17:50:16 -07:00
Zach Riggle 51f62206f6 Add ASLR-disabled warning to SSH 2016-05-24 17:49:30 -07:00
Zach Riggle a9ac751b89 Add ASLR disabled warning message 2016-05-24 17:47:57 -07:00
Zach Riggle ab31b3091c Add context.verbose 2016-05-24 17:47:43 -07:00
Zach Riggle 322942f2d3 Fix elfpatch so it doesnt spew logging info 2016-05-21 22:15:25 -07:00
Zach Riggle 9967347d70 Rename Property.name to support ro.product.name 2016-05-17 22:36:22 -07:00
Zach Riggle 01ec1328f9 Refactor adb.partitions to provide an iterator 2016-05-17 21:48:15 -07:00
Zach Riggle 020469788a Add adb.address, fix adb.symbols, add adb.partitions 2016-05-17 21:41:43 -07:00
Zach Riggle 348456e290 Merge pull request #78 from Manouchehri/patch-2
libffi-dev is required.
2016-05-17 18:12:07 -07:00
David Manouchehri 01e5057b05 libffi-dev is required. 2016-05-18 01:04:43 +00:00
Zach Riggle c97da1524c Merge pull request #77 from Manouchehri/patch-1
Use Trusty for Dockerfile?
2016-05-17 17:50:00 -07:00
Zach Riggle ec506414ee Catch reconnect exception, fix listdir() 2016-05-17 20:22:11 -04:00
Zach Riggle 10eb718058 Allow pwnlib.adb.Property objects to be compared to strings 2016-05-17 19:56:02 -04:00
Zach Riggle c575c66895 Stringify device in argv 2016-05-17 19:46:54 -04:00
Zach Riggle a30ab0ca80 Add pwnlib.device.Device class 2016-05-17 19:46:02 -04:00
Zach Riggle a598103ca9 Add auto-transform support for Android ABIs 2016-05-17 19:30:05 -04:00
Zach Riggle d2a377cfbc Add "kick" option to adb.wait_for_device 2016-05-17 19:18:09 -04:00
Zach Riggle 3ab9063d43 Force TTY allocation for ADB shell 2016-05-17 19:18:09 -04:00
David Manouchehri 8958123e3e Use Trusty. 2016-05-17 22:31:06 +00:00
Zach Riggle c57aa1a507 Fix failing tests 2016-05-17 14:47:35 -07:00
Zach Riggle ffe2e7cf1f Pwndbg and its depenencies should not be in the Binjitsu dockerfile 2016-05-16 22:41:50 -07:00
Zach Riggle fdbd19fdd2 Add decorators for common MemLeak scenarios, make the class more robust / transparent. 2016-05-16 22:41:50 -07:00
Zach Riggle 30bfc92037 Add vsyscall to Corefile 2016-05-11 21:02:41 -07:00
Zach Riggle d84a1073d7 Add unit test for generating shared libraries 2016-05-11 20:46:01 -07:00
Zach Riggle 8d934d65e1 Make vdso detection better; add Mapping.data so you can do core.vdso.data 2016-05-11 20:44:36 -07:00
MengHuan Yu 89d1c67696 Fix wrong format string parameters in memleak.py
Fix wrong format string parameters of a debug message in `memleak.py`.
2016-05-11 16:56:53 +08:00
Zach Riggle a77aa1be73 Add adb.unlock_bootloader 2016-05-10 16:34:36 -07:00
Zach Riggle 176b0af30b Add support for older devices with last_kmsg 2016-05-10 11:43:44 -07:00
Zach Riggle 03e9546127 Remove double-serial-number 2016-05-09 22:48:57 -07:00
Zach Riggle 05672c3e14 Add adb.compile to build single source files or NDK projects 2016-05-09 22:26:00 -07:00
Zach Riggle 7a5760cd39 More robust "adb.push" 2016-05-09 16:58:20 -07:00
Zach Riggle 78584929d7 adb pull shows weird content for newer versions, rely on exit code 2016-05-09 16:53:10 -07:00
Zach Riggle 56ad2276f4 Add kallsyms 2016-05-09 13:51:56 -07:00
Zach Riggle d76b6c5560 Use specific commands for each device 2016-05-06 21:08:34 -07:00
Zach Riggle e59a44d8b3 Auto-detect default serial port on OSX 2016-05-06 21:08:25 -07:00
Zach Riggle 2f11018a1e Add adb.kernel.lastmsg 2016-05-06 18:54:32 -07:00
Zach Riggle 21fc7759e0 Actually use serialtube arguments 2016-05-06 18:53:46 -07:00
Zach Riggle d2933acba2 Make uart_enable() work for Shamu 2016-05-06 14:17:02 -07:00
Zach Riggle efa9c26842 Bulk removal of get_serialno() 2016-05-06 11:22:19 -07:00
Zach Riggle b61941835a Add documentation for ADB module 2016-05-05 14:53:59 -07:00
Zach Riggle c75bf4ad75 Clean up code, silence adb.kernel.cmdline 2016-05-05 14:31:59 -07:00
Zach Riggle 8138315fa6 Minor fixups 2016-05-05 14:27:12 -07:00
Zach Riggle f1e7715e6f Finish implementation of adb.kernel.symbols 2016-05-05 14:25:49 -07:00
Zach Riggle 544342b9fe Use log.debug instead of print 2016-05-05 14:21:48 -07:00
Zach Riggle 430bee44b7 Use fancy new context decorator 2016-05-05 14:20:43 -07:00
Zach Riggle 31c1070ac8 I have an instance of a class “Context” called “context” with a property that returns an object which is actually a Context Manager which can be used as a function decorator to modify the state of the object “context” while in the context of the decorated function. 2016-05-05 14:19:52 -07:00
Zach Riggle 59102739f5 Move enable_uart() into the Kernel object 2016-05-05 14:19:52 -07:00
Zach Riggle a02d3277ce Lots of changes for adb module to support direct access to properties, kernel data, and the ability to enable UART debugging 2016-05-05 14:19:52 -07:00
Zach Riggle 2f75eb6c3a Add context.device so that we can scope serial numbers 2016-05-05 14:19:52 -07:00
Zach Riggle 22c97ee762 Fix package URL for qemu-user-static on Travis 2016-05-04 13:03:39 -07:00
Zach Riggle 500a2720a5 Fix regression with vma=None 2016-05-04 01:08:02 -07:00
Zach Riggle 2fc9a83a50 Fix serial tubes 2016-05-04 00:11:27 -07:00
Zach Riggle b572a9da4a Simplify context.adb for the basic case 2016-05-04 00:11:27 -07:00
Zach Riggle 3db45f46e4 Add "shared" option for ELF-building functions to generate DSOs. 2016-05-03 13:24:24 -07:00
Zach Riggle 41383b3330 ArgumentParser object must be at global scope for documentation generation to work 2016-04-25 15:30:42 -05:00
Zach Riggle 1a3d81f8f1 Do not manually close the log file.
It should get cleaned up by gc anyway.
2016-04-25 15:24:24 -05:00
Zach Riggle 4e04c8bfb3 Add repr() for timeout maximum 2016-04-25 15:12:37 -05:00
Zach Riggle 94abecce80 A bit more documentation for context.proxy 2016-04-25 14:56:02 -05:00
Zach Riggle 7f733aa63b Modify elfdiff to copy the files to a single location so that the first two lines of objdump dont get compared. 2016-04-25 14:39:19 -05:00
Zach Riggle b26a2f21fc Default argument for fit() 2016-04-25 14:04:59 -05:00
Zach Riggle d91b05b43a Switch from error to a single warning. 2016-04-25 14:04:53 -05:00
Zach Riggle 9aff300cee Fix wget() keyword 2016-04-22 14:52:30 -07:00
Zach Riggle 806d506510 Enhancements to Corefile to expose vdso/vvar/exe 2016-04-22 12:56:46 -07:00
Zach Riggle f0010e4413 Switch _lookup_build_id to use compare; remove breakpoint 2016-04-22 11:25:42 -07:00
Zach Riggle 58c61897ba Take failure case with error message 2016-04-22 10:52:32 -07:00
Zach Riggle dc083ae7b9 Fix regression on searching for DT_NULL 2016-04-22 10:51:16 -07:00
Zach Riggle 7029b38cce Refactor and optimize the fast-path DynELF search 2016-04-22 10:36:41 -07:00
Zach Riggle cf19d35d14 Add helpful warning for DynELF without elf= 2016-04-22 10:08:50 -07:00
Zach Riggle c498ddcb6d Switch to exceptions 2016-04-22 10:04:36 -07:00
Zach Riggle 7253234fba Add handling for negative values, extend use of compare 2016-04-22 10:03:35 -07:00
Zach Riggle 7925b44582 Speed up DynELF leaking with field_compare
Also modify log.progress / log.waitfor update frequency.
2016-04-22 10:01:07 -07:00
Zach Riggle 494a078be9 Fix ADB port getenv() as integer 2016-04-21 14:37:48 -07:00
Zach Riggle 8ef546bc34 Only print the banner once per log file per execution 2016-04-21 14:23:06 -07:00
Zach Riggle 64416909bb Sort imports 2016-04-21 14:39:08 -05:00
Zach Riggle 1c6689eca4 Lower log verbosity and fix whitespace 2016-04-21 14:36:16 -05:00
Zach Riggle 4dfc571702 Add fast-path for fit() 2016-04-21 03:51:58 -07:00
Zach Riggle cb40e4b883 Update fit() doctests 2016-04-21 03:45:33 -07:00
Zach Riggle 12564a7e0d It appears that fit() has always been completely broken from my understanding of it. 2016-04-21 03:44:22 -07:00
Zach Riggle d51ad7f989 Various enhancements to DynELF and MemLeak for speed 2016-04-21 02:12:56 -07:00
Zach Riggle bbc91d6211 Add DynELF.stack and a few other improvements 2016-04-21 00:14:40 -07:00
Zach Riggle 21c10be67e Add MemLeak.p for pointer-width sizes 2016-04-21 00:14:40 -07:00
Zach Riggle ca43832880 Pass kwargs to gdb.debug 2016-04-21 00:14:40 -07:00
Zach Riggle c9dabb8606 Must re-root after restarting 2016-04-21 00:14:40 -07:00
Zach Riggle eb8f905449 Fix searching for gadget subsets, and add SYS_rt_sigreturn fallback
Fixes binjitsu/binjitsu#73
2016-04-20 17:11:44 -07:00
Peter Shih 1b9a4ca123 fix inconsistent logging level in tube.
(cherry picked from commit fe4086e710)
2016-04-20 18:24:59 -05:00
Zach Riggle 02e0c3804c Update QEMU url so testing works 2016-04-19 17:39:23 -05:00
Zach Riggle 50624322c4 Remove MIPS documentation, since Travis is on 12.04 and you cant build AArch64 binutils for it. 2016-04-19 17:07:54 -05:00
Zach Riggle 63d564810b Remove AArch64 documentation, since Travis is on 12.04 and you cant build AArch64 binutils for it. 2016-04-19 16:11:42 -05:00
Zach Riggle 03d8efaba2 Fix ELF.process() for non-Android 2016-04-19 14:01:14 -07:00
Zach Riggle c47538da1f Add dateutil to requirements 2016-04-19 13:52:51 -07:00
Zach Riggle 3192839ff8 Restore context clear, but move it inside the local scope.
The clear is necessary because vars(context) will only retrieve the set keys.  Any other context bits set later will not be correctly set to default values.
2016-04-19 14:59:43 -05:00
Zach Riggle abc646511a Simplify a few lines with getattr 2016-04-19 14:51:47 -05:00
Zach Riggle d3ab88364c Remove context clear which breaks things in interactive mode when there is no exception handler. 2016-04-19 14:49:23 -05:00
Zach Riggle 3d61ba339a Add docs for mips shellcode 2016-04-17 18:42:14 -07:00
Zach Riggle 84a1a540b0 Add docs for aarch64 shellcode 2016-04-17 18:41:34 -07:00
Zach Riggle efa8c77d3c adb: Multiple enhancements. Add push and pull. 2016-04-17 18:41:11 -07:00
Zach Riggle 734d3a17e6 gdb: Silence unlink errors, push binaries to Android devices. 2016-04-17 18:40:46 -07:00
Zach Riggle 378a32b390 Fix exception on extract=True for make_elf_from_assembly 2016-04-17 18:40:22 -07:00
Zach Riggle 6bf0989e2f ELF supports ADB 2016-04-17 18:39:45 -07:00
Zach Riggle 158f6d7758 run_in_new_terminal supports argv in addition to strings 2016-04-17 18:39:35 -07:00
Zach Riggle 38047c15c6 Android constants are the same as Linux constants 2016-04-17 17:21:57 -07:00
Zach Riggle 56fbd583e6 Change log levels of ADB commands, better Android support in GDB 2016-04-15 14:40:12 -07:00
Zach Riggle 2d8e5f0050 Fix pid_by_name so that the results are actually sorted, and do not return any zombie processes. 2016-04-15 11:44:37 -07:00
Zach Riggle 1b865681fc Add Android examples, cut down verbosity of adb calls. 2016-04-14 12:19:32 -07:00
Zach Riggle bcc57b3138 Add adb module, lots of refactoring GDB module to be more clean and support Android gdb.attach(). 2016-04-14 11:56:04 -07:00
Zach Riggle 87a612282d Add aarch64 sh for Android 2016-04-14 11:52:05 -07:00
Zach Riggle 215ddafc65 Add aarch64 sh 2016-04-14 11:51:38 -07:00
Zach Riggle 474d96eb52 Use shorthand 2016-04-13 15:40:01 -05:00
Zach Riggle b868c12d63 Update PLT parsing for Thumb mode entries 2016-04-13 15:38:23 -05:00
Zach Riggle d9f120e617 Add host / port support to Binjitsu 2016-04-13 15:22:21 -05:00
Zach Riggle 2c788f4f55 Fix ptrace vararg 2016-04-13 15:22:12 -05:00
Zach Riggle 2d3eb7204d Fixes for Android AArch64 debugging 2016-04-13 12:51:50 -05:00
Zach Riggle 4e2d5f096a Fix typo 2016-04-12 18:37:39 -05:00
Zach Riggle b60218a4d7 First pass support for debugging Android binaries natively. 2016-04-12 16:44:41 -05:00
Zach Riggle 51dd430ad0 Always have context.native return False for Android and CGC 2016-04-12 16:44:27 -05:00
Zach Riggle 60e5a80790 Make run_in_new_terminal work on OSX under tmux 2016-04-12 16:44:03 -05:00
Zach Riggle d4f10b0d6e Don't look for QEMU if running natively. 2016-04-12 16:43:47 -05:00
Zach Riggle 95d4b8e09d Add missing log object 2016-04-12 16:43:32 -05:00
Morten Brøns-Pedersen 29bf5fc5fc Merge pull request #615 from peter50216/patch-3
fix inconsistent logging level in tube.
2016-04-12 12:08:02 +02:00
Peter Shih fe4086e710 fix inconsistent logging level in tube. 2016-04-12 10:18:06 +08:00
Zach Riggle 0af33f3a6f Simplify process.core since I just learned about the gcore command line tool. 2016-04-04 20:11:54 -07:00
Zach Riggle 68207adbe4 Write the GDB script to the terminal when debugging is enabled 2016-04-04 16:20:52 -07:00
Morten Brøns-Pedersen 8a57fe4143 Merge pull request #612 from Gallopsled/martian-dash-docset
Added support for generating a Dash docset.
2016-03-31 10:15:05 +02:00
Kristoffer Søholm 2da5414609 Merge pull request #601 from Gallopsled/bugfix-memleak
Bugfix: `pwnlib.memleak.MemLeak`
2016-03-31 09:15:06 +02:00
Morten Brøns-Pedersen 9ff2d5b9bd removed tabs and trailing whitespace and tidied up a little 2016-03-31 08:30:41 +02:00
Morten Brøns-Pedersen 5d9b68d1c8 Merge branch 'dash-docset' of https://github.com/martian/pwntools into martian-dash-docset 2016-03-31 08:23:12 +02:00
Morten Brøns-Pedersen bc77ad6c47 Merge pull request #604 from peter50216/patch-1
Remove unused statement in context.arch
2016-03-31 08:09:25 +02:00
Morten Brøns-Pedersen cfb38c4ef4 Merge pull request #606 from peter50216/patch-2
Fix inconsistency between error message and code.
2016-03-31 08:08:38 +02:00
Morten Brøns-Pedersen b2e5ff427b Merge pull request #608 from peter50216/master
Fix pack when sign=True and word_size='all'
2016-03-31 08:08:09 +02:00
Morten Brøns-Pedersen dec4a74efc Merge pull request #610 from binjitsu/issue_609
Fix Gallopsled/pwntools#609
2016-03-31 08:06:13 +02:00
Pi-Hsun Shih 999ad63200 Fix pack when sign=True and word_size='all'
(cherry picked from commit 17caf96582)
2016-03-28 12:10:59 -04:00
Zach Riggle b45ef8dfbd Dont always try to prefix binutils with 'g'.
Fixes Gallopsled/pwntools#607
2016-03-28 12:00:51 -04:00
Zach Riggle f64d0b0749 Fix Gallopsled/pwntools#609
(cherry picked from commit 320e0dd80b)
2016-03-28 11:57:16 -04:00
Zach Riggle 320e0dd80b Fix Gallopsled/pwntools#609 2016-03-28 11:56:58 -04:00
Pi-Hsun Shih 17caf96582 Fix pack when sign=True and word_size='all' 2016-03-28 03:35:29 +00:00
Zach Riggle c1e3d26d29 Add Unicorn, dependencies, tabs->spaces 2016-03-25 18:21:31 -04:00
Zach Riggle 73ddedebb4 Fix doctests for SFTP 2016-03-25 14:24:23 -07:00
martian 7f236f5064 Added support for generating a Dash docset.
Dash docsets can be read by various applications:

Dash         OS X, iOS         https://kapeli.com
Zeal         Linux, Windows    https://zealdocs.org
Velocity     Windows           http://velocity.silverlakesoftware.com
LovelyDocs   Android           http://lovelydocs.io
dasht        POSIX             https://github.com/sunaku/dasht
Helm Dash    emacs             https://github.com/areina/helm-dash

(cherry picked from commit dc37b0b5b2)
2016-03-25 15:57:20 -04:00
Zach Riggle 80ebf7109a Fix binjitsu/binjitsu#69 2016-03-25 13:29:12 -04:00
Morten Brøns-Pedersen 36ccc2bc81 bugfix: ui.yesno() now correctly handles <enter>
This bug happened because we no longer disable input processing in the terminal.
In particular `\r` is now translated to `\n`.  The fix is to interpret both `\r`
and `\n` as <enter> in `term/key.py`.

(cherry picked from commit 383f245082)
2016-03-25 13:21:04 -04:00
Morten Brøns-Pedersen 72416c4705 bugfix: don't call shutdown(2) when calling tubes.sock.close()
This can be a problem since sockets inherited by children will see the
`shutdown(2)` call as well.

(cherry picked from commit 77bfc16341)
2016-03-25 13:20:19 -04:00
Sam Brown 8f2878d0ab corrected util.twiddling.bits implementation to handle 0 validly
(cherry picked from commit 6449e14e9e)
2016-03-25 13:14:39 -04:00
Morten Brøns-Pedersen 10487c23ac added fiddling.bits(0) as a doctest
(cherry picked from commit 10c3f079c5)
2016-03-25 13:13:49 -04:00
Mathias Svensson a18c23cf2d Fix annoying setup.py behaviour.
When installing pwntools, setup.py required a very new version of
requests -- even though we never used any new features.

This is a problem, since the required version is much never than what is
in e.g. ubuntu's package repo. While this by itself is not much of a
problem, it is a problem if one installs python-pip from the distro's
repo as well, since python-pip will try to use the newest version of the
requests library, which caused pip to break.

The solution: Do not force such a new version of python, instead live
with a much older version.

(cherry picked from commit f91299986e)
2016-03-25 13:10:31 -04:00
Sam Brown 714f27fee9 added mailing list link to README.md
(cherry picked from commit 126e2857ad)
2016-03-25 13:08:35 -04:00
peter50216 9942ae157f Don't depend on python dict.item() order.
(cherry picked from commit 3564b9e014)
2016-03-25 13:07:12 -04:00
peter50216 36ead5ac57 Fix inconsistency between error message and code.
Code says context.bits should be > 0, but error message says >= 0.
Since 0 bit architecture doesn't make sense at all, make them all be > 0.
(cherry picked from commit def9400d48)
2016-03-25 13:03:20 -04:00
peter50216 def9400d48 Fix inconsistency between error message and code.
Code says context.bits should be > 0, but error message says >= 0.
Since 0 bit architecture doesn't make sense at all, make them all be > 0.
2016-03-25 15:52:10 +08:00
Morten Brøns-Pedersen 18049ddddb example of gdb.attach
(cherry picked from commit 883ddb30b5)
2016-03-23 13:29:02 -04:00
peter50216 6f74c7f13e Don't depend on python dict.item() order.
(cherry picked from commit 3564b9e014)
2016-03-23 13:27:58 -04:00
Kristoffer Søholm e6380f75a9 Merge pull request #605 from peter50216/patch-2
Don't depend on python dict.item() order.
2016-03-23 09:55:04 +01:00
peter50216 3564b9e014 Don't depend on python dict.item() order. 2016-03-23 16:36:13 +08:00
peter50216 e16ac422b5 Remove unused statement in context.arch 2016-03-23 16:25:13 +08:00
Zach Riggle 17b48f7186 Catch corner case in process.leak 2016-03-22 10:27:38 -07:00
Zach Riggle a518a60388 Open in binary mode 2016-03-21 18:05:07 -07:00
Zach Riggle 78e394bd6d Add documentation to process.leak and another option 2016-03-21 18:04:51 -07:00
Zach Riggle 282b853c2a Add process.leak() function for testing leaks 2016-03-21 18:01:06 -07:00
Zach Riggle aa64f71075 Add aliases for connect_remote and listen_remote 2016-03-17 16:42:08 -04:00
Zach Riggle 354213c475 Learn full path to the executable for ssh.process 2016-03-17 16:14:19 -04:00
Zach Riggle d22f6c457f Remove argparse requirement. Fixes Gallopsled/pwntools#598. 2016-03-16 12:58:42 -04:00
Zach Riggle 03baaa3807 Update Docs badge 2016-03-16 12:55:29 -04:00
Zach Riggle a5df5ee6a0 More trying to fix ReadTheDocs build 2016-03-16 07:00:43 -07:00
Zach Riggle c5b3d343ad Fix build for readthedocs.org which dies on terminal stuff. 2016-03-16 06:59:36 -07:00
Zach Riggle 1413caf401 Merge pull request #71 from kbeckmann/master
Import pwnlib.util.safeeval in constgrep
2016-03-16 09:45:37 -04:00
Zach Riggle 09a637eabe Fix more docs links 2016-03-16 06:45:16 -07:00
Zach Riggle bb95c6fbbd Fix docs link 2016-03-16 06:44:26 -07:00
Zach Riggle b0cb09ae67 Complete fix in 0ce1ebb for Gallopsled/pwntools#601 2016-03-16 06:42:39 -07:00
Zach Riggle 669c963290 Fix typo in Dockerfile 2016-03-16 06:15:59 -07:00
Konrad Beckmann 0e0cb7c0e3 Import pwnlib.util.safeeval in constgrep 2016-03-16 10:59:58 +01:00
Zach Riggle bc20216579 Add ASAN/MSAN/UBSAN to checksec 2016-03-15 16:11:21 -07:00
Morten Brøns-Pedersen fcd62d4cf1 Merge pull request #597 from binjitsu/issue_596
Extract list of data elements from Buffer when unget()'ing a Buffer
2016-03-15 14:49:21 +01:00
Zach Riggle 0ce1ebbd81 Fixes Gallopsled/pwntools#601 2016-03-14 18:36:33 -04:00
Morten Brøns-Pedersen 894ffbc1b7 fixed doctests 2016-03-14 13:50:57 +01:00
Morten Brøns-Pedersen b00a328d8a added __getitem__ for pwnlib.memleak.MemLeak 2016-03-14 13:44:11 +01:00
Morten Brøns-Pedersen ceadb59c93 bugfix: pwnlib.memleak.MemLeak would return wrong addresses when searching backwards if a leak failed; several new doctests has been added as well 2016-03-14 13:43:47 +01:00
Morten Brøns-Pedersen 22038eaf2d Merge pull request #600 from Gallopsled/example-attach
example of `gdb.attach`
2016-03-14 11:35:52 +01:00
Morten Brøns-Pedersen 044a2a630d Merge pull request #546 from Gallopsled/packing-dd
added `pwnlib.util.packing.dd` inspired by the command line util of t…
2016-03-14 11:25:32 +01:00
Morten Brøns-Pedersen f4ae5da477 some slight improvements to pwnlib.util.packing.dd 2016-03-14 11:12:41 +01:00
Morten Brøns-Pedersen 883ddb30b5 example of gdb.attach 2016-03-14 10:41:09 +01:00
Zach Riggle d3074011d6 Update Dockerfile 2016-03-10 15:59:55 -05:00
Zach Riggle 03b8eb8694 Update Dockerfile 2016-03-10 15:58:25 -05:00
martian dc37b0b5b2 Added support for generating a Dash docset.
Dash docsets can be read by various applications:

Dash         OS X, iOS         https://kapeli.com
Zeal         Linux, Windows    https://zealdocs.org
Velocity     Windows           http://velocity.silverlakesoftware.com
LovelyDocs   Android           http://lovelydocs.io
dasht        POSIX             https://github.com/sunaku/dasht
Helm Dash    emacs             https://github.com/areina/helm-dash
2016-03-08 18:15:54 -08:00
Zach Riggle 3b383ece1c Extract list of data elements from Buffer when unget()'ing a Buffer. Fixes #596
(cherry picked from commit fde04c737b)
2016-03-03 15:51:18 -05:00
Zach Riggle fde04c737b Extract list of data elements from Buffer when unget()'ing a Buffer. Fixes #596 2016-03-03 15:50:05 -05:00
Zach Riggle 524a76b925 Skip $PATH resolution for which() when a path component is detected. Also remove carriage returns from ssh.interactive() output. 2016-02-19 23:22:58 -05:00
Jonas Rudloff d498a34e70 Merge pull request #594 from YASME-Tim/receiving
💊 Recieved -> Received #593
2016-02-08 12:50:27 +01:00
YASME-Tim 79d4248666 💊 #593 Last occurrence of recieved fixed 2016-02-07 13:23:15 +01:00
YASME-Tim fa25a733bd 💊 Recieved -> Received 2016-02-07 13:17:19 +01:00
Zach Riggle 541734a097 Simplify coredump_filter code in case the process dies between the two statements 2016-01-28 13:49:06 -05:00
Zach Riggle cf203cc91e Enable compression for SSH 2016-01-28 00:27:38 -05:00
Zach Riggle b52b970a28 Update ssh.process to match process for usage of setuid 2016-01-28 00:27:25 -05:00
Zach Riggle b36c78805f Add process.corefile; improve process.libs; update process.setuid 2016-01-28 00:26:54 -05:00
Zach Riggle 54584e09c0 Merge pull request #66 from PankajKataria/master
Fix typo
2016-01-24 17:29:39 -05:00
Zach Riggle 2314322369 Add tcp and udb helper classes for remote 2016-01-22 23:29:02 -05:00
Zach Riggle 0ef6a9a383 Add context.device 2016-01-22 23:15:53 -05:00
Zach Riggle 131eefaf05 Add context.noptrace option 2016-01-22 23:14:00 -05:00
Zach Riggle 63ca4f51b1 Ensure coredumps contain *everything* 2016-01-04 18:08:00 -05:00
Zach Riggle e806bf73f6 Fix Corefile parsing verbosity, and make elf.string() bail when reads fail. 2015-12-29 15:09:35 -05:00
Zach Riggle 2cf84db4ca Handle Corefiles with no environment variables 2015-12-29 13:09:59 -05:00
Zach Riggle cb5f04de6b Fix presentation of env on log line when env={} 2015-12-29 12:49:52 -05:00
Zach Riggle c8228729f1 Allow empty environments via SSH 2015-12-29 12:31:40 -05:00
Pankaj Kataria 098888da2f Fix typo
Fix typo
2015-12-27 08:28:06 +05:30
Zach Riggle c250f00abe Fix XOR shellcode and tests for arm and aarch64 2015-12-26 13:13:59 -08:00
Zach Riggle 02ffc4034e Simplify aarch64 by one instruction 2015-12-26 15:10:43 -05:00
Pankaj Kataria 00047af206 Corrected description of download_dir function 2015-12-26 23:22:35 +05:30
Zach Riggle 5a60b591be Fix IRC link 2015-12-21 17:19:22 -05:00
Zach Riggle e54cd0ddf7 Merge branch 'ssh-agent' 2015-12-21 17:02:44 -05:00
Zach Riggle 8eec3e2d12 Disable use of ssh-agent by default 2015-12-21 16:59:44 -05:00
Zach Riggle 1738218f81 Don't be too aggressive with ssh.process() status messages 2015-12-12 02:38:14 -05:00
Zach Riggle e3c1aad702 Fix bug for NT_FILE and environment variable addresses 2015-12-12 02:37:35 -05:00
Zach Riggle df7f08a5ed Fix corefile support for mappings without NT_FILE 2015-12-11 19:19:15 -05:00
Zach Riggle 44548b0a72 Better error handling for ssh.process(), and less verbose log messages 2015-12-11 17:55:24 -05:00
Zach Riggle 5512ecf450 Add warning message for when the corefile isn't loaded 2015-12-11 16:00:26 -05:00
Zach Riggle 8b969da149 Fix regression when parsing some functions like __libc_start_main@@GLIBC_2.0 2015-12-11 15:58:19 -05:00
Zach Riggle 176e45d9f6 Assume that core files are desired 2015-12-11 15:48:09 -05:00
Zach Riggle 594f35e4f7 Enhance corefile parsing to extract environment variable addresses 2015-12-11 15:48:09 -05:00
Zach Riggle ea2493bd56 Do not dump GDB traffic when debugging is verbose 2015-12-11 04:10:37 -05:00
Zach Riggle 3ef1e1a7d5 Further enhancements to Core 2015-12-11 04:10:37 -05:00
Zach Riggle e978986a84 Add support for extracting register state from core files 2015-12-11 04:10:37 -05:00
Zach Riggle faf3e42861 Merge branch 'socks5' 2015-12-11 04:07:30 -05:00
Zach Riggle 32cff88c56 Update .executable to be the original binary, so that .libs and .libc works for process() and ssh_channel() 2015-12-10 22:00:02 -05:00
Zach Riggle f32069589d Convert ssh_channel.exe ==> ssh_channel.executable to be the same as process.executable 2015-12-10 21:46:13 -05:00
Zach Riggle 926231b4ed Fix test 2015-12-08 12:39:45 -05:00
Zach Riggle f08e2c8731 Move output to stdout 2015-12-08 10:24:54 -05:00
Zach Riggle ee1ca61d37 Silence log output in unit test 2015-12-08 10:24:46 -05:00
Zach Riggle 42d08b43fc logging 2015-12-07 17:28:45 -05:00
Zach Riggle ab692c1569 Add logging and socks to the toplevel 2015-12-07 17:23:34 -05:00
Zach Riggle 7640c3fa9f Simplify context setup 2015-12-07 17:23:18 -05:00
Zach Riggle 3db5c4d0ce Add support for SOCKS proxies 2015-12-07 17:15:25 -05:00
Zach Riggle 3bcf57bcd3 Add unit test for aslr==0 to set unlimited stack size 2015-12-07 17:06:23 -05:00
Zach Riggle 714bc320c4 Fix argument for tube.p64 2015-12-03 13:26:57 -05:00
Zach Riggle 24c32f541d Fix log message for ssh.interactive() 2015-12-03 13:26:45 -05:00
Zach Riggle f8753f2f5b Add **kw to run_shellcode 2015-12-03 13:26:20 -05:00
Zach Riggle 507deae10f Add KB,MB,GB globals 2015-12-03 13:25:37 -05:00
Zach Riggle d4dbdb58df Fix "execute" argument to gdb.debug variants 2015-12-03 13:25:12 -05:00
Zach Riggle 59ae1a999a Add ssh.which and other minor bugfixes in ssh 2015-11-30 09:50:42 -05:00
Zach Riggle 1582064bed Add .libc to process and ssh.process; also convert DynELF.libc to a property 2015-11-23 13:10:29 -08:00
Zach Riggle 506be041b7 Add nosetuid to ssh.process 2015-11-20 20:08:44 -08:00
Zach Riggle 8699c98a6f Add signed and unsigned 2015-11-20 20:05:36 -08:00
Zach Riggle 1bcc4626e3 Add option to disable setuid 2015-11-20 23:04:57 -05:00
Jonas Rudloff 8f355195db Merge pull request #586 from Gallopsled/fiddling-naf
added `pwnlib.util.fiddling.naf` to compute the non-adjacent form of …
2015-11-20 17:07:05 +01:00
Morten Brøns-Pedersen 32b9b90175 Merge pull request #583 from binjitsu/wait
Add `wait` as an alias for `wait_for_close`
2015-11-20 16:49:56 +01:00
Morten Brøns-Pedersen 82500a1bc0 added pwnlib.util.fiddling.naf to compute the non-adjacent form of a number 2015-11-20 15:32:53 +01:00
Zach Riggle d6e4c7d76d Add log.hexdump 2015-11-15 00:16:14 -05:00
Zach Riggle ee8a96c39d Re-add cyclic hexdump to hexdump() 2015-11-15 00:15:57 -05:00
Zach Riggle 49dd666026 Fix dealarm_shell issue where "which" doesnt sent a new line if the binary is missing 2015-11-15 00:15:41 -05:00
Zach Riggle 675155abc8 Convert len => length 2015-11-12 14:58:05 -05:00
Zach Riggle 8d4b1f84f8 Add context.aslr and options to disable ASLR via process() and ssh.process() 2015-11-10 16:26:25 -05:00
Kristoffer Søholm 9949d7d979 Merge pull request #584 from Gallopsled/setup-py-requests-issue
Fix annoying setup.py behaviour.
2015-11-09 21:09:35 +01:00
Mathias Svensson f91299986e Fix annoying setup.py behaviour.
When installing pwntools, setup.py required a very new version of
requests -- even though we never used any new features.

This is a problem, since the required version is much never than what is
in e.g. ubuntu's package repo. While this by itself is not much of a
problem, it is a problem if one installs python-pip from the distro's
repo as well, since python-pip will try to use the newest version of the
requests library, which caused pip to break.

The solution: Do not force such a new version of python, instead live
with a much older version.
2015-11-09 21:00:43 +01:00
Zach Riggle 8ffb0dfacf Enhance error messages 2015-11-09 14:36:48 -05:00
Zach Riggle aff7b8e3a3 Simplify a few lines of code 2015-11-09 14:36:11 -05:00
Zach Riggle 438c9a303b Add tube.sendlines method 2015-11-09 13:10:50 -05:00
Zach Riggle f0f4180fd4 Fix test failure introduced by bc6cc93 2015-11-07 23:15:59 -05:00
Zach Riggle aad6e9ae9b Add support for setting log colors from ~/.pwn.conf 2015-11-07 23:12:37 -05:00
Zach Riggle bc6cc93537 Add option to skip setting TTY raw mode. Use os.environ for process() so that preexec_fn can use it. 2015-11-07 20:06:00 -05:00
Zach Riggle 89a60e71b8 Remove termcap did_init, since it breaks terminals 2015-11-07 16:20:25 -05:00
Zach Riggle 6c6b16bb16 Simplify PTY slave logic 2015-11-07 16:08:21 -05:00
Zach Riggle b1575e6a0f Fix infinite recursion on accessing self.proc in close() 2015-11-07 16:04:00 -05:00
Zach Riggle 4c38d29ac3 Gate termcap.get with an initialization flag 2015-11-07 15:48:14 -05:00
Zach Riggle 232ebd5e6d Update docs/requirements.txt to install all requirements. 2015-11-07 15:43:36 -05:00
Zach Riggle f79b447378 Remove CLA 2015-11-07 15:31:14 -05:00
Zach Riggle 45ea91fa8e Fix syscall stubs using "from" as a variable name. 2015-11-07 15:31:14 -05:00
Zach Riggle 55a47c95b9 Fix documentation errors. 2015-11-07 15:31:14 -05:00
Zach Riggle dbd334673d Fix behavior with getpass() by making stdin also be a raw TTY 2015-11-07 15:31:14 -05:00
Zach Riggle 73d8e06a4b Detect gdbserver in the working directory 2015-11-03 19:16:36 -05:00
Zach Riggle 6f248e8a5e Add context.mask 2015-11-03 17:05:18 -05:00
Zach Riggle e6d64d8ade Add wait alias for wait_for_close 2015-11-03 16:43:07 -05:00
Zach Riggle d90566d30a Add wait alias for wait_for_close 2015-11-03 16:42:51 -05:00
Zach Riggle 6db7b8cfbf Fix term mode. Broken since 11fa0d8d6d 2015-11-03 16:38:58 -05:00
Zach Riggle aa323a40df Ensure self.cwd is always set; simplifies some logic 2015-11-03 16:29:04 -05:00
Zach Riggle 8fc7e64ff5 Default working directory is "." 2015-11-03 16:27:36 -05:00
Zach Riggle 2264290a6f Don't print e.g. '\x04' * 0x1 2015-10-30 16:27:55 -04:00
Zach Riggle 170d4999eb Update Android sh scripts to properly set arg0 since it is expected. 2015-10-29 19:39:27 -04:00
Zach Riggle 3520393b62 Add Android includes 2015-10-29 19:37:53 -04:00
Zach Riggle 88ff1f3533 Update Thumb execve to properly support string arrays 2015-10-29 19:37:14 -04:00
Zach Riggle e5223e4bd1 Update ARM execve to properly support string arrays 2015-10-29 19:31:53 -04:00
Ryan afdb7a4449 Update about.rst 2015-10-27 15:04:31 -04:00
Zach Riggle d3814a3d39 Add Android OS 2015-10-27 15:02:30 -04:00
Zach Riggle 515af41f85 Update Android sh path 2015-10-27 15:02:25 -04:00
Jonas Rudloff 458c6971ea Merge pull request #507 from binjitsu/faster-travis
Use container-based Travis CI so that it builds faster
2015-10-26 13:02:25 +01:00
Jonas Rudloff 24401a34ce Merge pull request #580 from Gallopsled/alt-fix-pr-563
alternative to PR #563; this works by simply never emitting CR
2015-10-26 10:44:33 +01:00
Zach Riggle c66b809006 Add Android templates and headers as symlinks 2015-10-25 23:48:26 -04:00
Zach Riggle c2339b62f1 Fix asm regression 2015-10-25 19:35:57 -04:00
Zach Riggle e7a72e086b Add default arguments for mmap 2015-10-25 19:31:00 -04:00
Zach Riggle 1bed4850b0 Dont send cd command if there's no change 2015-10-25 19:29:58 -04:00
Zach Riggle 4993b4ada7 Simplify header layout 2015-10-25 19:29:41 -04:00
Zach Riggle 2c8652bf91 Detect whether gdbserver is installed 2015-10-25 19:18:05 -04:00
Zach Riggle 2219f183c2 Fix ARM push. There is no push-immediate. 2015-10-25 18:36:02 -04:00
Zach Riggle 278ebee345 Add sublime-settings [skip ci] 2015-10-25 16:51:38 -04:00
Zach Riggle 81de47c025 Add errno command-line helper 2015-10-25 16:40:24 -04:00
Kristoffer Søholm 46cc634e8b Merge pull request #581 from scoops/patch-1
Update about.rst
2015-10-24 00:31:07 +02:00
Ryan f71ae3b06f Update about.rst 2015-10-23 11:48:06 -04:00
Ryan 9cdfa82bc3 Update about.rst
Smoothed out some phrasing that bugged me.
2015-10-23 11:45:26 -04:00
Morten Brøns-Pedersen 08c8c2e8e4 alternative to PR #563; this works by simply never emitting CR 2015-10-23 09:11:25 +02:00
Zach Riggle e1b93c77f5 Merge pull request #61 from jaybosamiya/patch-1
Fix typos
2015-10-15 17:34:02 -04:00
Jay Bosamiya 77383048fb Fix typo
"Data" is, by itself plural. "Datas" is not a word.
2015-10-16 01:59:24 +05:30
Jay Bosamiya fb3c55af06 Fix typos
I'm pretty sure it shouldn't be "he" there.
2015-10-16 01:58:00 +05:30
Morten Brøns-Pedersen a09d87c579 Merge pull request #579 from Gallopsled/fiddling-bits-0-doctest
added `fiddling.bits(0)` as a doctest
2015-10-15 09:49:59 +02:00
Morten Brøns-Pedersen 10c3f079c5 added fiddling.bits(0) as a doctest 2015-10-15 09:42:37 +02:00
Morten Brøns-Pedersen 55e830b214 Merge pull request #578 from sam-b/master
corrected util.fiddling.bits implementation to handle 0 validly
2015-10-15 09:27:16 +02:00
Sam Brown 6449e14e9e corrected util.twiddling.bits implementation to handle 0 validly 2015-10-14 23:10:17 +01:00
Zach Riggle d7a0bafc5f Permit dot access to symbol names, add elf.sym alias for elf.symbols 2015-10-14 13:22:31 -04:00
Zach Riggle 11fa0d8d6d This contains a large merge from the Samurai internal repo.
Changes:

- `pwn/init` initialization code simplified, and some was moved to `pwnlib/args`
- `scramble` script added to `pwnlib.commandline`; support for encoders added to relevant scripts
- Added shellcode encoders for several architectures
- Added CGC architecture shellcode and constants
- Added Shellcraft templates for every syscall
- Added `xor_key` helper for generating a 4-byte XOR key for a data stream
- Added `getdents` for use with the relevant shellcraft scripts
- Add ELF loaders for all architectures
- Lots of MIPS and AArch64 shellcode
2015-10-12 02:13:13 -04:00
Morten Brøns-Pedersen 768b24e192 added __neq__ method to pwnlib.term.key
(cherry picked from commit 31d06cb807)
2015-10-06 18:09:25 -04:00
Morten Brøns-Pedersen 42d8f59e11 import completer with pwnlib.term and update no-available-completions-text 2015-10-06 18:09:09 -04:00
Morten Brøns-Pedersen c734802900 fix before and after keywords for term.output() 2015-10-06 18:08:58 -04:00
Zach Riggle b4945667c7 Clean up code from 442873e 2015-10-06 18:08:09 -04:00
antoniob 442873e5be close file descriptors in process.close() and avoid leaving zombie processes around
(cherry picked from commit fa2e11391e)
2015-10-06 18:06:10 -04:00
Zach Riggle 29eefaac2b Revert disable-randomization change from 3b9614a535 2015-10-06 18:05:57 -04:00
Morten Brøns-Pedersen daf117e270 Merge pull request #576 from antoniobianchi333/master
close file descriptors in process.close() and avoid leaving zombie processes around
2015-10-05 12:33:40 +02:00
antoniob fa2e11391e close file descriptors in process.close() and avoid leaving zombie processes around 2015-10-05 01:05:24 -07:00
Zach Riggle c5a92cdfb6 Simplify use if int() 2015-09-21 14:14:40 -04:00
Jonas Rudloff 6c9761d83d Merge pull request #574 from en0/master
Fixed lookup feature where the packing util was being called with wrong argument
2015-09-21 19:04:24 +02:00
Ian Laird 80f744cc6d Fixed issue on lookup function where the packing util was being called with inproper argument type 2015-09-19 23:29:57 -06:00
Zach Riggle 4c61ed3b0b Fix #59 2015-09-15 15:11:26 -04:00
Zach Riggle 88d1643804 Fix ssh.run() environment variables 2015-09-01 14:50:44 -04:00
Morten Brøns-Pedersen a454d54975 Merge pull request #571 from Gallopsled/term-before-after-fix
fix `before` and `after` keywords for `term.output()`
2015-08-31 10:13:17 +02:00
Morten Brøns-Pedersen 5a92096231 Merge pull request #570 from Gallopsled/term-completer
import `completer` with `pwnlib.term` and update no-available-complet…
2015-08-31 10:13:04 +02:00
Morten Brøns-Pedersen cfa9b00789 Merge pull request #569 from Gallopsled/term-key-neq
added `__neq__` method to `pwnlib.term.key`
2015-08-31 10:12:38 +02:00
Zach Riggle f12253e34d Add dockerfile 2015-08-31 03:53:31 -04:00
Zach Riggle 783cc096a6 Fix which() precedence 2015-08-30 23:29:46 -04:00
Zach Riggle 549541b6ea Handle EINTR on select 2015-08-30 23:21:30 -04:00
Zach Riggle a2916b7d01 Add live demo 2015-08-30 22:55:00 -04:00
Zach Riggle a6a5cfeb9c Add i686 alias 2015-08-30 15:01:05 -04:00
Zach Riggle c18f8a202d Sockets should be set to non-blocking for spawned processes 2015-08-25 16:54:30 -04:00
Zach Riggle 59a309d6ac Fix UDP socket buffering 2015-08-25 16:47:16 -04:00
Zach Riggle a676adbc52 Update ELF 2015-08-23 16:51:12 -04:00
Zach Riggle e08aebe9fd Remove shippable, since its crap 2015-08-22 15:41:17 -04:00
Zach Riggle f968120997 Only request ptrace_scope when required 2015-08-22 15:40:05 -04:00
Robert Larsen 60307ed1c7 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2015-08-18 12:22:13 +02:00
Robert Larsen 71d1535f33 Removed test file. 2015-08-18 12:21:30 +02:00
Zach Riggle b03d83dfe7 Add elf.functions 2015-08-14 18:20:01 -04:00
Zach Riggle f9c7ea87fa process() now handles empty environments 2015-08-14 17:58:08 -04:00
Jonas Rudloff e0e150f87b Merge pull request #568 from RobertLarsen/master
Shellcodes for MIPS/i386/amd64
2015-08-14 16:55:40 +02:00
Robert Larsen a6fd7f8411 Fixed more documentation. 2015-08-13 09:56:38 +02:00
Robert Larsen 400b5f4995 Fixed documentation. 2015-08-13 09:48:16 +02:00
Morten Brøns-Pedersen 5394d9d91c import completer with pwnlib.term and update no-available-completions-text 2015-08-11 22:07:40 +02:00
Morten Brøns-Pedersen 000d2b2fc7 fix before and after keywords for term.output() 2015-08-11 22:02:45 +02:00
Morten Brøns-Pedersen 31d06cb807 added __neq__ method to pwnlib.term.key 2015-08-11 21:04:37 +02:00
Robert Larsen 55067001c3 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2015-08-10 11:09:14 +02:00
Morten Brøns-Pedersen 06f0f8c8af Merge pull request #566 from Gallopsled/bugfix-term-enter
bugfix: `ui.yesno()` now correctly handles <enter>
2015-08-06 04:37:04 +02:00
Zach Riggle 1a389ca2b8 Update binutils.rst 2015-07-30 13:34:27 -04:00
Zach Riggle ecbe0e9fa9 Update binutils.rst 2015-07-30 13:34:16 -04:00
Robert Larsen 175f26c605 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2015-07-30 13:36:16 +02:00
Zach Riggle 76d78a0e7e Install QEMU 2.3 instead of 2.1 2015-07-29 08:03:01 -04:00
Zach Riggle 3f8d4cc37c Add aarch64 binutils 2015-07-29 07:52:19 -04:00
Robert Larsen 9beb63dc9d Added readfile shellcode for i386. 2015-07-22 16:00:32 +02:00
Robert Larsen d6a358d1dc Added readfile shellcode for amd64. 2015-07-22 15:35:12 +02:00
Morten Brøns-Pedersen 83d44b500d Merge pull request #567 from Gallopsled/bugfix-no-shutdown-on-close
bugfix: don't call `shutdown(2)` when calling `tubes.sock.close()`
2015-07-17 09:37:11 +02:00
Morten Brøns-Pedersen 1eb35819ac Merge pull request #560 from binjitsu/register-ordering
Add setregs shellcode helper for i386 to demonstrate regsort
2015-07-17 09:34:46 +02:00
Morten Brøns-Pedersen 8a2e54232b Merge pull request #561 from binjitsu/gdb-unlink
Unlink GDB temporary files.  Fixes #519
2015-07-17 09:31:09 +02:00
Morten Brøns-Pedersen 77bfc16341 bugfix: don't call shutdown(2) when calling tubes.sock.close()
This can be a problem since sockets inherited by children will see the
`shutdown(2)` call as well.
2015-07-16 23:35:30 +02:00
Morten Brøns-Pedersen 383f245082 bugfix: ui.yesno() now correctly handles <enter>
This bug happened because we no longer disable input processing in the terminal.
In particular `\r` is now translated to `\n`.  The fix is to interpret both `\r`
and `\n` as <enter> in `term/key.py`.
2015-07-16 23:30:45 +02:00
Zach Riggle e7ef1c1029 Merge pull request #55 from eQu1NoX/MAIN-arm
Integration test for ARM
2015-07-15 12:11:09 -04:00
eQuiNoX__ e6752fbd30 Correct tests that depend on 0x900000 vs 0x0 2015-07-15 13:14:59 +02:00
eQuiNoX__ de393e4afa Integration test for ARM 2015-07-15 12:40:44 +02:00
Zach Riggle f92ea95299 Rebuild the ARM constants with __ARM_EABI__ and __KERNEL__ 2015-07-14 16:33:20 -04:00
Zach Riggle ee4028c10a Merge pull request #54 from eQu1NoX/MAIN2
MIPS integration tests for SROP
2015-07-14 08:17:17 -04:00
eQuiNoX__ 69ee58343e Trivial correction 2015-07-14 14:06:43 +02:00
eQuiNoX__ dca6232d97 Mips integration tests 2015-07-14 13:54:55 +02:00
Zach Riggle 8c1565ae3e Update README.md 2015-07-13 20:12:02 -04:00
Zach Riggle d1a70dc0fb Add screenshot 2015-07-13 20:10:35 -04:00
Zach Riggle 48a1cc72b0 Create README.md 2015-07-13 20:07:09 -04:00
Zach Riggle c29aebdb77 Add docstrings to QEMU functions 2015-07-13 16:28:48 -04:00
Zach Riggle ae888803b6 Add qemu-XXX-static binaries to Travis 2015-07-13 15:24:01 -04:00
Zach Riggle 4386b8d82a Merge pull request #49 from eQu1NoX/MAIN2
Adding in Aarch64 support.
2015-07-10 23:23:59 -07:00
eQuiNoX__ a44ba4fa16 Adding in doctests 2015-07-09 16:25:58 +02:00
Zubin Mithra 9ac4e8d9cb Adding in Aarch64 support.
This commit adds in Aarch64 SROP support. PoC that calls mprotect
can be viewed at

https://bitbucket.org/eQu1NoX/pwntest-arm64/src/a7936795d47c\?at\=master
2015-07-09 15:42:18 +02:00
Robert Larsen 853cdb4a25 Prevent nul byte. 2015-07-08 15:32:18 +02:00
Robert Larsen bd547f3fdc Added thumb/Linux shellcode for reading a file. 2015-07-08 14:13:45 +02:00
Robert Larsen a69dc3ebc6 Removed unneeded import. 2015-07-08 13:05:25 +02:00
Robert Larsen 3da395f11a An offset was slightly off. Fixed. 2015-07-08 12:38:28 +02:00
Robert Larsen b6c81925a9 Added MIPS/Linux shellcode for reading a file. 2015-07-08 12:35:08 +02:00
Zach Riggle 9559a99854 Fix doctests in ELF 2015-07-06 22:50:57 -07:00
Zach Riggle 1897045707 Merge remote-tracking branch 'nemopwn/master' 2015-07-06 21:54:57 -07:00
Zach Riggle 973efff68b Merge pull request #48 from binjitsu/asm-large-pages
Fix large page sizes on AMD64
2015-07-06 18:15:27 -07:00
Zach Riggle dd58f40991 Fix large page sizes on AMD64 2015-07-06 21:10:18 -04:00
Zach Riggle 0f710677d3 Touch README to force Travis rebuild 2015-07-06 14:50:20 -07:00
Zach Riggle 6d2ccdcf93 Merge remote-tracking branch 'gallopsled/master' 2015-07-06 14:47:22 -07:00
Robert Larsen 18cdcfd409 Added wrappers for ensuring the right operating system. 2015-07-06 15:41:12 +02:00
Robert Larsen c591d69a3a Added bindsh shellcode for MIPS. 2015-07-06 15:11:04 +02:00
Jonas Rudloff 073257dcac Merge pull request #565 from RobertLarsen/fix-sockaddr-usage
Fixed regression due to changed return value.
2015-07-06 14:59:23 +02:00
Robert Larsen 02c67d547d Removed comment. 2015-07-06 14:22:50 +02:00
Robert Larsen 61edc646e1 Use big endian (network byte order) for port. 2015-07-06 13:55:21 +02:00
Robert Larsen f424a9caf7 Merge branch 'fix-sockaddr-usage' of https://github.com/RobertLarsen/pwntools 2015-07-06 13:42:45 +02:00
Robert Larsen a95bb8e353 Revert "Revert "Fix sockaddr, optimize off some zero bytes""
This reverts commit 400013e680.
2015-07-06 13:25:15 +02:00
nemo 5d1e3500f0 Two changes:
- Add .ropeproject to .gitignore
- Make documentation of class ELF display normally
2015-07-06 16:15:47 +08:00
Jonas Rudloff d66676a862 findpeer- and connectstager shellcodes 2015-07-05 15:54:50 +02:00
Jonas Rudloff 6bdcb41252 fixed mov and syscall for thumb 2015-07-05 15:54:27 +02:00
Jonas Rudloff aa4a0a889c connectback stager for amd64 2015-07-05 13:04:36 +02:00
Jonas Rudloff 401d9f567e connectback stager for i386 2015-07-05 12:55:46 +02:00
Jonas Rudloff 400013e680 Revert "Fix sockaddr, optimize off some zero bytes"
This reverts commit bb5ea7677c.
2015-07-05 12:29:48 +02:00
Jonas Rudloff 5a637a534e amd64 findpeerstager recvives size 2015-07-05 12:14:41 +02:00
Jonas Rudloff f36470e628 findpeerstager now recvives the size 2015-07-05 10:31:56 +02:00
Robert Larsen bfcc9ac326 Works! 2015-07-04 23:34:36 +02:00
Robert Larsen 8ede459860 Fixed regression due to changed return value. 2015-07-04 01:47:55 +02:00
Robert Larsen 7855e433d0 Added connect shellcode which almost work. 2015-07-04 01:34:34 +02:00
Robert Larsen 5ab2f403bd Works...kind of. 2015-07-03 13:50:35 +02:00
Robert Larsen 2ed7e83dad Use the nop generator. 2015-07-03 13:50:08 +02:00
Robert Larsen 64c37569a3 Added stager and a nop generator. 2015-07-03 13:49:49 +02:00
Robert Larsen 8db93e8c04 Support three more arguments for syscalls. 2015-07-03 11:18:18 +02:00
Robert Larsen 7779ebff3c Fixed documentation. 2015-07-03 08:42:08 +02:00
Robert Larsen 2d67781ba4 Shaved off some instructions and made the port matching work. 2015-07-02 23:39:51 +02:00
Zach Riggle 37c55233ed Merge pull request #45 from eQu1NoX/MAIN2
Test for amd64
2015-07-02 14:02:44 -07:00
eQuiNoX__ 1f289e3dbd The following changes were made :-
- test for amd64 added in
- sigreturn template for amd64 added in. sigreturn template for i386 modified
- read.asm added for amd64
2015-07-02 19:01:57 +02:00
Robert Larsen 7dfd489e89 Nul free. 2015-07-02 15:55:19 +02:00
Robert Larsen 579d7bf58f Added findpeersh shellcode for MIPS/Linux. Port matching not working yet. Also contains a nul byte. 2015-07-02 15:49:08 +02:00
Robert Larsen eba2352dbc Don't overwrite socket register before using it 2015-07-02 15:48:00 +02:00
Robert Larsen ef451105c2 Added MIPS/Linux dupsh shellcode. 2015-07-02 15:05:27 +02:00
Robert Larsen 9a26be0881 Added MIPS/Linux sh shellcode. 2015-07-02 15:01:05 +02:00
Robert Larsen d21af22f82 Added MIPS/Linux dup shellcode. 2015-07-02 14:46:29 +02:00
Robert Larsen 71ef26281c Added Linux MIPS syscall shellcode. 2015-07-02 13:39:39 +02:00
Robert Larsen fa8d00dcfb Prettier. 2015-07-02 12:54:57 +02:00
Robert Larsen 28911442c4 Added test 2015-07-02 10:48:48 +02:00
Robert Larsen 0c0f609752 Added pushstr for MIPS. 2015-07-01 23:38:52 +02:00
Robert Larsen 5ad8ec2c3f Removed comments I no longer need. 2015-07-01 23:38:12 +02:00
Robert Larsen 504518596d More avoid newline. 2015-07-01 23:06:24 +02:00
Robert Larsen 5a6327537b Avoid newlines. 2015-07-01 22:53:16 +02:00
Robert Larsen 6ede0d2d64 Upper and lower halfword were swapped if they contained nul bytes. 2015-07-01 15:05:38 +02:00
Robert Larsen 966f66b19d Don't use pseudo instructions. 2015-07-01 14:19:24 +02:00
Robert Larsen 52dec55e2d Fixed list of registers. Use this in mips/mov.asm 2015-07-01 09:19:26 +02:00
Robert Larsen b3e4cb12b8 Prettier 2015-07-01 00:38:38 +02:00
Robert Larsen 536416dd83 Added more cases. May be done now. 2015-07-01 00:30:07 +02:00
Robert Larsen 2f88aadf0b More correct comments. 2015-06-30 23:48:02 +02:00
Robert Larsen d67384b283 More stuff tested. 2015-06-30 23:26:33 +02:00
Robert Larsen 5cb35801e9 More stuff tested. 2015-06-30 23:24:35 +02:00
Robert Larsen 88b6ea3b1a Be able to mov src=1 2015-06-30 22:51:32 +02:00
Robert Larsen 6be7b53519 Verified another piece. 2015-06-30 22:42:51 +02:00
Robert Larsen 2f1d4f6ebe Added comments about what works. 2015-06-30 15:34:29 +02:00
Zach Riggle d66c273e60 Merge pull request #44 from eQu1NoX/MAIN2
Add in support for mips, mipsel + doctests
2015-06-29 12:27:26 -07:00
Robert Larsen 24dfbc850f Trying to build a mov() shellcode generator for MIPS. 2015-06-29 16:16:47 +02:00
eQuiNoX__ ed7b459be9 Following changes were made :-
- Add support for MIPS and MIPSel
- Change format to offset:register in srop.py
- Correct doctests in srop.py
- Change usage in rop.py
2015-06-29 16:11:19 +02:00
Zach Riggle e544cd43b8 Fix test 2015-06-25 12:54:56 -04:00
Zach Riggle cfdfaff37e Fix SigReturnFrame.get_frame docstring [skip ci] 2015-06-25 12:37:55 -04:00
Zach Riggle 38e9f4274d Fix code-blocks [skip ci] 2015-06-25 12:36:29 -04:00
Zach Riggle 88d79af9c9 Update FormatStr doctest formatting 2015-06-25 00:01:38 -04:00
thetlk e675c2068e Enhance FormatString support, and add doctests 2015-06-24 23:42:03 -04:00
Zach Riggle 4cecbac380 Re-enable teset with workaround for Shippable 2015-06-24 16:24:06 -04:00
Zach Riggle b4f8877660 Skip test which fails on Shippable 2015-06-24 16:03:44 -04:00
Zach Riggle 1f5fde3302 Fix listen(fam=socket.AF_INET6) 2015-06-22 23:50:14 -04:00
Zach Riggle 9e17e76054 Simplify test 2015-06-22 23:21:51 -04:00
Zach Riggle 4f5be7144b Fix process(..., stdout=PIPE) and add tests 2015-06-22 23:19:24 -04:00
Zach Riggle 51d8a89d4b Shippable needs apt-get update to find gcc-multilib 2015-06-22 11:58:28 -04:00
Zach Riggle 523344b64e Add gcc-multilib to Travis and Shippable requirements 2015-06-22 11:53:57 -04:00
Zach Riggle 7486c79a67 Update .travis_install.sh 2015-06-22 09:27:47 -04:00
Zach Riggle 3a565a8171 Fix docstring [skip ci] 2015-06-21 15:40:43 -04:00
Zach Riggle 6b82b6b7dc Fix docstring [skip ci] 2015-06-21 15:39:27 -04:00
Zach Riggle c4dd91c5de Fix docstring [skip ci] 2015-06-21 15:38:14 -04:00
Zach Riggle 4b33859132 Add XOR encoder module for docs 2015-06-21 15:37:44 -04:00
Zach Riggle 6aff977171 Fix assembly for arches which want __start 2015-06-21 15:28:21 -04:00
Zach Riggle 6141e7d465 Add shellcode encoders and API 2015-06-21 15:26:55 -04:00
Zach Riggle 71845f6198 Remove unnecessary gadgets in the example 2015-06-21 15:22:49 -04:00
Zach Riggle d00cae41a6 Make stack and code rwx for generated ELFs 2015-06-21 15:22:33 -04:00
Zach Riggle 1327f2b33b :) 2015-06-19 23:43:04 -04:00
Zach Riggle b6ea53696b Fix setregs 2015-06-18 17:23:55 -04:00
Zach Riggle be1e13389a Make disassembly colors better for operators 2015-06-18 17:18:25 -04:00
Zach Riggle 6e562b2bdb Make shifting easier to read 2015-06-18 17:13:32 -04:00
Zach Riggle dd7c0acae1 Make xor easier to read 2015-06-18 16:50:57 -04:00
Zach Riggle b10f109967 Make not easier to read 2015-06-18 16:46:11 -04:00
Zach Riggle 63da39ea18 Make neg easier to read 2015-06-18 16:42:21 -04:00
Zach Riggle 8b459a066e Update doctests 2015-06-18 16:33:03 -04:00
Zach Riggle 1187e544de Optimize i386 mov for a few special cases 2015-06-18 16:19:08 -04:00
Zach Riggle 49e2c52b0b Fix doctests 2015-06-17 13:04:22 -07:00
Zach Riggle fc0c7a0f69 Revert changes to make_elf. Fixes #33 2015-06-17 12:28:28 -07:00
Zach Riggle d7b957c9c1 Merge pull request #32 from thetlk/master
import pwnlib after sys.path's change
2015-06-17 15:03:53 -04:00
thetlk dad217f9ed import pwnlib after sys.path's change 2015-06-17 16:47:11 +02:00
Zach Riggle ba6eba4b13 Fix doctest 2015-06-17 07:32:09 -04:00
Zach Riggle 4f1745fbdf Restore compact size to generated ELFs 2015-06-17 07:32:09 -04:00
Zach Riggle b218776573 Switch syscall over to getregs 2015-06-17 06:20:01 -04:00
Zach Riggle e867643192 Collapse constant values in regsort, since "mov reg,reg" is at most only as expensive as "mov reg,value" and usually cheaper 2015-06-17 05:58:44 -04:00
Zach Riggle 275a3a09d4 Restore compact size to generated ELFs 2015-06-17 05:45:09 -04:00
Zach Riggle 6f0a62e751 Honor -o option in asm; mark output as executable if output format is ELF 2015-06-17 05:32:35 -04:00
Zach Riggle 70645b432b Make pushstr work for things not-a-string but which can go through packing.flat(). This makes push more simple. 2015-06-17 05:31:55 -04:00
Zach Riggle 4ea3a4932e Slightly better cdq 2015-06-17 04:59:00 -04:00
Zach Riggle 8d1f57a345 Add cdq optimization to setregs 2015-06-17 04:59:00 -04:00
Zach Riggle c00e2b1863 Add correct ipv6 address, allow accept to time out 2015-06-17 04:59:00 -04:00
Zach Riggle 2aac79c9ad Honor -o option in shellcraft; mark output as executable if output format is ELF 2015-06-17 04:59:00 -04:00
Zach Riggle 8121a95bc5 Better colorizing, which can be disabled 2015-06-17 03:45:27 -04:00
Zach Riggle 797d416a47 Add support for conditional instruction printing 2015-06-17 03:18:38 -04:00
Zach Riggle 4ad2cb87a9 Remove debug print 2015-06-17 03:17:50 -04:00
Zach Riggle 400f208ca2 Fix output of the GasLexer to parse templates better 2015-06-17 03:16:45 -04:00
Zach Riggle 800f85fe7a Add Pygments to requirements 2015-06-17 03:09:37 -04:00
Zach Riggle 30dcc6af05 Use Pygments to colorize assembly if possible 2015-06-17 03:08:50 -04:00
Zach Riggle 2078c1dca6 Add TextMate / Sublime Text language bundles 2015-06-17 02:43:10 -04:00
Zach Riggle 966cc482fd Add cat doctest 2015-06-16 23:26:33 -04:00
Zach Riggle 98f27f80d8 Fix ROP doctests 2015-06-16 20:07:55 -04:00
Zach Riggle 3c2b2b22c9 Add ROP doctest 2015-06-16 19:15:32 -04:00
Zach Riggle c03c90c204 Add i386 SROP integration test 2015-06-16 17:56:56 -04:00
Zach Riggle 4265424956 Pass kwargs down to ELF.from_bytes 2015-06-16 16:19:28 -04:00
Zach Riggle 085efbc6b4 Defer deletion of temporary files 2015-06-16 16:19:20 -04:00
Zach Riggle 1d5fe92e04 Fix VMA for make_elf 2015-06-16 16:07:10 -04:00
Zach Riggle 8ba3d52955 Add ROP.from_blob for kokjo :D 2015-06-16 15:41:25 -04:00
Zach Riggle 24c1f2d04a Add documentation for checksec 2015-06-15 23:59:25 -04:00
Zach Riggle 1e59b54c4e Add shellcraft --run 2015-06-15 23:57:58 -04:00
Zach Riggle e21f8a0a24 Don't execute binaries which are not dynamically linked 2015-06-15 23:57:45 -04:00
Zach Riggle 58b6ce5ec4 Add asm --run and --infile 2015-06-15 23:56:17 -04:00
Zach Riggle e54c16c5e9 Dont emit CRLF since it shows empty lines 2015-06-15 23:11:26 -04:00
Zach Riggle ac4524607a Dont emit CRLF since it shows empty lines 2015-06-15 23:09:31 -04:00
Zach Riggle 757f60acb0 Unlink GDB temporary files. Fixes #519 2015-06-15 17:29:27 -04:00
Zach Riggle b57beda046 Fix missing imports, simplify runner module 2015-06-15 17:22:05 -04:00
Zach Riggle 1ac87052c2 Add powerpc and powerpc64 register names so you can "li r0,0" 2015-06-15 14:23:54 -04:00
Zach Riggle 502de0c92f Add missing constants 2015-06-15 14:17:18 -04:00
Zach Riggle 2093ca4632 Dont bail on various architectures 2015-06-15 14:16:51 -04:00
Zach Riggle c0f321fbf2 Unlink GDB temporary files. Fixes #519 2015-06-15 14:06:44 -04:00
Zach Riggle 39beae9c3f Add setregs shellcode helper for i386 to demonstrate regsort
```py
>>> print shellcraft.setregs({'eax':'ebx','ebx':3,'edx':'eax','esi':'edi','edi':'esi','ebp':'ebx'})
    mov edx, eax
    mov eax, ebx
    mov ebp, ebx
    push 0x3
    pop ebx
    xchg edi, esi
```
2015-06-15 13:53:14 -04:00
Zach Riggle 86e422de0c Update TESTING.md 2015-06-15 09:32:11 -04:00
Zach Riggle af5ba55325 Merge remote-tracking branch 'gallopsled/master' into integration 2015-06-15 09:07:34 -04:00
Zach Riggle 405d9cc2af Import iters 2015-06-15 09:01:32 -04:00
Zach Riggle 1631d2265e Fix tests 2015-06-15 08:57:41 -04:00
Zach Riggle 77cc76769c Merge with gallopsled/master 2015-06-15 08:54:50 -04:00
Zach Riggle 31f05f4c7f Emit nicer assembly comments 2015-06-15 08:38:35 -04:00
Zach Riggle 24f49a46cf Add echo example 2015-06-15 08:37:52 -04:00
Zach Riggle 28307ec699 Update TESTING.md 2015-06-15 08:17:46 -04:00
Zach Riggle c50f224b6b Update TESTING.md 2015-06-15 08:14:39 -04:00
Zach Riggle 3a63c0804d Feed results of unpack() through int() so it doesnt return long() 2015-06-15 08:12:45 -04:00
Zach Riggle 1d5825c844 Fix whitespace, 2015-06-15 08:10:55 -04:00
Zach Riggle 709d834945 Fix whitespace, add amd64 version 2015-06-15 08:08:57 -04:00
Zach Riggle f3b0645568 Fix simple case of regsort. Add i386.setregs 2015-06-15 08:05:53 -04:00
Zach Riggle 640d0261fd Add register sorting and dependency resolution module 2015-06-15 07:59:55 -04:00
Zach Riggle 89dd56a2a3 Use LocalContext for ABI 2015-06-15 02:35:55 -04:00
Zach Riggle e45ee3053e Automatically set arch for shellcraft; update i386 exit; add amd64 exit 2015-06-15 02:32:24 -04:00
Zach Riggle 65a60a6170 Automatically set arch for shellcraft; update i386 exit; add amd64 exit 2015-06-15 02:32:07 -04:00
Zach Riggle 63c5d4fb60 Add doctest for i386.linux.exit 2015-06-15 02:21:01 -04:00
Zach Riggle 6c27af5e16 Update __init__.py 2015-06-14 20:49:37 -04:00
Zach Riggle 931d18f836 Update license from pwntools 2015-06-14 20:47:35 -04:00
Zach Riggle 41350f51cf TESTING 2015-06-14 20:46:37 -04:00
Zach Riggle 75b230c052 Enable @LocalContext for ELF.from_XXXX 2015-06-14 20:38:20 -04:00
Zach Riggle 24a70eb8ff Add better tests and ELF.from_bytes 2015-06-14 18:59:26 -04:00
Zach Riggle 918115302c Add make_elf_from_assembly and ELF.from_assembly 2015-06-14 18:53:03 -04:00
Zach Riggle af92658f42 Add context.clear(...) arguments 2015-06-14 17:18:33 -04:00
Zach Riggle ee35d10303 Add TESTING.md 2015-06-14 17:11:51 -04:00
Zach Riggle 3b0cf3cbaf Nope time is bad, not installed on Travis 2015-06-14 16:44:41 -04:00
Zach Riggle 7292806e08 Explicitly time the run 2015-06-14 16:43:12 -04:00
Zach Riggle f263f9e10d Update docstring 2015-06-14 16:38:47 -04:00
Zach Riggle cfa0d50339 Silence Sphinx warning 2015-06-14 16:38:28 -04:00
Zach Riggle 7cf6360dbb Add runner.rst to index.rst 2015-06-14 16:36:06 -04:00
Zach Riggle 32fef0cf05 Add missing link 2015-06-14 16:32:23 -04:00
Zach Riggle 95b1adebbf Fix Sphinx warnings 2015-06-14 16:30:01 -04:00
Zach Riggle df3a746768 Fix docs 2015-06-14 16:29:39 -04:00
Zach Riggle 11bfb24506 Add testexample link 2015-06-14 16:26:14 -04:00
Zach Riggle ddaa95d6dd Fix testexample 2015-06-14 16:24:02 -04:00
Zach Riggle 77e8ab1d84 No shippable caching 2015-06-14 16:23:23 -04:00
Zach Riggle e9497169f1 Remove set -ex 2015-06-14 16:21:16 -04:00
Zach Riggle 9f552c94cb Fix testexample 2015-06-14 16:20:30 -04:00
Zach Riggle 0cdb715e7c Fix runner banner 2015-06-14 16:14:01 -04:00
Zach Riggle 9a5b4e09af Fix SROP banner 2015-06-14 16:13:52 -04:00
Zach Riggle bac6a9f543 Fix testexample module 2015-06-14 16:13:39 -04:00
Zach Riggle b901ff3b1e Add shippable configuration 2015-06-14 16:12:04 -04:00
Zach Riggle de47ac9cf5 Add Shippable badge 2015-06-14 16:07:10 -04:00
Zach Riggle 72e9b3135e Fix Shippable build since it really doesnt have terminfo 2015-06-14 15:55:52 -04:00
Zach Riggle 7413dffac7 Add test example modules 2015-06-14 15:54:56 -04:00
Zach Riggle 7b4a415a90 Skip failing SROP tests 2015-06-14 15:45:18 -04:00
Zach Riggle 465f5875b7 Fix SROP tests 2015-06-14 15:28:47 -04:00
Zach Riggle a50cd85791 Fix Shippable builds 2015-06-14 15:28:08 -04:00
Zach Riggle 1541b20c19 Run install before SSH setup 2015-06-14 15:26:00 -04:00
Zach Riggle 54551eb072 Fix doctest 2015-06-14 15:25:18 -04:00
Zach Riggle a45da211db Move srop module 2015-06-14 15:25:08 -04:00
Zach Riggle 5bfde777bf Fix naming 2015-06-14 15:14:13 -04:00
Zach Riggle 6e0ee86cb9 Import ALL THE THINGS 2015-06-14 15:12:50 -04:00
Zach Riggle b78b91180f Add runner module, for shellcode unit tests 2015-06-14 15:08:04 -04:00
Zach Riggle 77326199e4 Fast path for LocalContext 2015-06-14 14:59:57 -04:00
Morten Brøns-Pedersen 143239bd7f Merge pull request #465 from binjitsu/sorted-imports-upstream
Sort all imports, force import sort checking on doctest
2015-06-11 20:01:52 +02:00
Morten Brøns-Pedersen 61540eb90f Merge pull request #457 from binjitsu/clean-and-log
Don't log twice for clean_and_log.
2015-06-11 20:00:21 +02:00
Morten Brøns-Pedersen 4fbaba7888 Merge pull request #557 from binjitsu/read-n
Enable maximum number of bytes to read
2015-06-11 19:59:07 +02:00
Zach Riggle 13ad3e80f7 Fix doctest 2015-06-11 08:59:58 -04:00
Zach Riggle d2e6db8904 Add config 2015-06-11 08:59:35 -04:00
Zach Riggle a0b6e99e72 Fix failing test due to wrong username 2015-06-11 08:58:07 -04:00
Zach Riggle f5ebcf6dc4 Add mode option to write 2015-06-11 08:55:49 -04:00
Zach Riggle f7eca3e13a Add skip, rename n to count 2015-06-11 08:34:52 -04:00
Zach Riggle 787c015e07 Don't log twice for clean_and_log. 2015-06-11 08:30:12 -04:00
Zach Riggle c69ed7ea15 Sort all imports 2015-06-11 08:25:50 -04:00
Zach Riggle f399a7029d More enhancements to the Travis caching functionality. 2015-06-11 08:13:17 -04:00
Zach Riggle 061ca4ab12 Use container-based Travis CI so that it builds faster 2015-06-11 08:13:17 -04:00
Zach Riggle 287bcae4c4 Merge pull request #25 from eQu1NoX/master
ARM srop support
2015-06-11 06:58:30 -04:00
Zach Riggle 6148801e95 Fix feature regression in cyclic_find which permits integer lookups 2015-06-11 06:58:01 -04:00
Zubin Mithra f23c297d7b moving integ to different branch
Add information about various ARM coprocessors that might be present.

Correct typo

Add in comments

Change how magic numbers and offsets are stored

Use namedtuple

Renaming variables

srop.py doc modified

ARM sp check added in

Cleanup
2015-06-11 12:38:51 +02:00
Morten Brøns-Pedersen 74e55a2ef6 Merge pull request #501 from binjitsu/cmdline-enhance
Enhance asm and shellcraft with auto-debugging; add checksec command-line
2015-06-11 10:42:24 +02:00
Morten Brøns-Pedersen 2e8228490f Merge pull request #499 from binjitsu/process-enhancements
Enhance functionality in process
2015-06-11 10:41:14 +02:00
Morten Brøns-Pedersen 8766c3f7ad Merge pull request #498 from binjitsu/ssh-enhancements
Multiple enhancements to SSH
2015-06-11 10:39:14 +02:00
Morten Brøns-Pedersen eb59165810 Merge pull request #542 from binjitsu/net-shorter
Fix sockaddr ipv6, optimize off some zero bytes
2015-06-11 10:26:00 +02:00
Morten Brøns-Pedersen d48d0624d1 Merge pull request #543 from binjitsu/compress-debug-sendrecv
Compress debug send/recv output if it's the same byte
2015-06-11 10:25:07 +02:00
Morten Brøns-Pedersen 3fab235f30 Merge pull request #551 from binjitsu/disasm-strip
Enable disassembly with stripping the offsets and columns
2015-06-11 10:18:55 +02:00
Morten Brøns-Pedersen c83387b2f3 Merge pull request #555 from Gallopsled/issue553
Fixes #553
2015-06-11 10:16:56 +02:00
Morten Brøns-Pedersen cc4102f7d2 Merge pull request #556 from binjitsu/aarch64
Add support for aarch64-linux
2015-06-11 10:15:22 +02:00
Zach Riggle a4c5492772 Enable maximum number of bytes to read 2015-06-11 03:45:15 -04:00
Zach Riggle 01365128dc Fix feature regression in cyclic_find which permits integer lookups 2015-06-11 03:45:09 -04:00
Zach Riggle 8849b78ed5 Enable maximum number of bytes to read 2015-06-11 03:27:52 -04:00
Zach Riggle fc2032e830 Add support for aarch64-linux 2015-06-10 23:11:48 -04:00
Zach Riggle cbcf23c70d Fail disassembly gracefully 2015-06-10 17:32:53 -04:00
Zach Riggle 1bc94ccc58 Fix doctests 2015-06-10 16:18:40 -04:00
Zach Riggle 347ab75af5 Add parens so ARM doesnt shit itself 2015-06-10 15:36:04 -04:00
Zach Riggle 72768d8b4a Fix doctest 2015-06-10 15:28:07 -04:00
Zach Riggle d3a3359c77 Save pretty name of things passed through constants.eval 2015-06-10 15:27:29 -04:00
Jonas Rudloff b0c3abb23c fix doctest to make travis happy 2015-06-10 20:27:22 +02:00
Jonas Rudloff a3d37d6287 fixed #553 2015-06-10 20:09:16 +02:00
Jonas Rudloff 62fedb388b fixed #552 2015-06-10 19:55:04 +02:00
Zach Riggle 20ea1e0a06 Add docs 2015-06-09 12:53:57 -04:00
Zach Riggle c3b006ef50 Add docs 2015-06-09 12:53:18 -04:00
Zach Riggle e082d441d2 Fix doctest 2015-06-09 12:51:46 -04:00
Zach Riggle 14093c2d54 Fix doctest 2015-06-09 12:51:37 -04:00
Zach Riggle c21426e3a0 Don't modify original representation 2015-06-09 12:49:21 -04:00
Zach Riggle af466424ee Don't modify original representation 2015-06-09 12:49:04 -04:00
Zach Riggle 3c188bc27e Enable disassembly with stripping the offsets and columns 2015-06-09 12:47:08 -04:00
Zach Riggle 6034b2b312 Enable disassembly with stripping the offsets and columns 2015-06-09 12:45:06 -04:00
Zach Riggle ff5f634a76 Add sockaddr changes from upstream 2015-06-09 12:04:08 -04:00
Zach Riggle af9fe4c0d2 Merge pull request #26 from binjitsu/constants
Use complex constants
2015-06-08 14:17:28 -04:00
Zach Riggle 9b9ae29a71 Fix arm shellcode 2015-06-08 14:01:03 -04:00
Zach Riggle 62b3964225 Fix thumb shellcode 2015-06-08 13:56:42 -04:00
Zach Riggle cec172ee9b Use complex constants 2015-06-07 02:35:28 -04:00
Zubin Mithra b349eaff6f Add in ARM support for SROP 2015-06-06 12:24:41 +02:00
Zubin Mithra dfa96abb09 Merge branch 'master' of http://github.com/binjitsu/binjitsu 2015-06-06 03:40:16 +02:00
Zach Riggle 8922d369e9 Allow lookups of libraries running under qemu-user by walking /etc/qemu-binfmt 2015-06-01 12:59:36 -07:00
Zach Riggle 043232336f Added docs for ELF.libc 2015-06-01 12:40:08 -07:00
Zach Riggle ffa321103b Add automatic extraction of libc.so 2015-06-01 12:39:01 -07:00
Zach Riggle 4ac5bce80e Enable .libs detection for alternate-architecture libraries when run via qemu-user. 2015-06-01 12:35:44 -07:00
Morten Brøns-Pedersen dfe4d2c280 Merge pull request #548 from Gallopsled/ua-license
(hopefully) fixes #547
2015-05-30 09:55:59 +02:00
Morten Brøns-Pedersen d5dae58737 Update LICENSE.txt
Removed irrelevant information.
2015-05-30 09:55:34 +02:00
Zach Riggle 9cf7e8f7e7 More more more verbose 2015-05-29 14:38:47 -04:00
Zach Riggle b7731b32e5 Verbose logging for Shippable troubleshooting 2015-05-29 14:37:14 -04:00
Zach Riggle eec0b68b52 Update docs [skip ci] 2015-05-29 14:34:45 -04:00
Zach Riggle e1331055ae Detect if current user is travis, for Shippable 2015-05-29 14:33:28 -04:00
Morten Brøns-Pedersen b9bf5982f6 (hopefully) fixes #547 2015-05-29 09:35:42 +02:00
Zach Riggle 2b909824b8 Compress debug send/recv output if it's the same byte 2015-05-28 17:56:06 -04:00
Morten Brøns-Pedersen f97045be7c added pwnlib.util.packing.dd inspired by the command line util of the same name 2015-05-28 10:49:17 +02:00
eQuiNoX__ f9d080141f Commit code that sets the esp to the next gadget 2015-05-27 12:38:31 +02:00
Jonas Rudloff ee0ace9aeb Merge pull request #544 from binjitsu/dealarm
Add dealarm_shell
2015-05-27 10:54:11 +02:00
Jonas Rudloff 31e93128d1 Merge pull request #528 from binjitsu/libcdb
Add code for libcdb lookups
2015-05-26 17:21:59 +02:00
Morten Brøns-Pedersen 27daa1291a Merge pull request #545 from Gallopsled/fit-docs
updated docstring for `pwnlib.util.packing.fit` and added a check tha…
2015-05-26 14:39:27 +02:00
Morten Brøns-Pedersen 2b4ba2e31c updated docstring for pwnlib.util.packing.fit and added a check that the data actually fits 2015-05-26 09:33:50 +02:00
Zach Riggle 00d9460422 Show a better error message when connecting to an unknown host 2015-05-25 16:15:27 -04:00
Zach Riggle 734591dd84 Add dealarm_shell 2015-05-22 20:50:13 -04:00
Zach Riggle 525f35c143 Fix/optimize dealarm 2015-05-22 20:50:01 -04:00
Zach Riggle b36bd7ace5 Add dealarm_shell 2015-05-22 20:46:19 -04:00
Zach Riggle 6d2ac263df Compress debug send/recv output if it's the same byte 2015-05-22 20:32:46 -04:00
Zach Riggle bb5ea7677c Fix sockaddr, optimize off some zero bytes 2015-05-22 19:54:46 -04:00
Zach Riggle 866f4762ef Remove lookup in .resolve(), add .libc() 2015-05-21 13:30:03 -04:00
Jonas Rudloff 1d251adec5 Merge pull request #523 from binjitsu/push-fix
Fix push() templates
2015-05-21 11:39:58 +02:00
Jonas Rudloff 0fd0677af0 fix travis 2015-05-21 10:51:33 +02:00
Jonas Rudloff a3d7215162 Merge pull request #500 from binjitsu/gdb-enhancements
Add gdb.debug_shellcode and fix cross-arch debugging with qemu-user
2015-05-21 10:08:08 +02:00
Jonas Rudloff 6f23067894 Merge pull request #534 from Gallopsled/terminal-detection
Changed `util.misc.run_in_terminal` to first look for tmux, and then X11
2015-05-21 10:06:46 +02:00
Jonas Rudloff 77a59681b9 Merge pull request #517 from binjitsu/complex-constants
Implement complex constants
2015-05-21 10:05:40 +02:00
Jonas Rudloff 222f0b9474 Merge pull request #535 from Gallopsled/hexdump-highlight
Hexdump highlight
2015-05-21 10:03:27 +02:00
Jonas Rudloff 64f95f5b19 Merge pull request #537 from Gallopsled/iters-exp
added ``iters.exp(s, n)`` as an alias for ``iters.product(*[s]*n)``.
2015-05-21 10:02:47 +02:00
Jonas Rudloff da0bbefb84 Merge pull request #538 from Gallopsled/packing-fit
added `util.packing.fit`
2015-05-21 10:01:49 +02:00
Jonas Rudloff 4ef299a888 Merge pull request #539 from Gallopsled/ui-yesno
added `ui.yesno`
2015-05-21 10:00:47 +02:00
Jonas Rudloff 4aeea41362 Merge pull request #540 from Gallopsled/minor-term-fix
fixes some minor CRLF/LF-issues in `term.term`
2015-05-21 09:59:23 +02:00
Zach Riggle ce458c7fc0 Update docstring [skip ci] 2015-05-20 23:31:16 -04:00
Zach Riggle 329ef332b4 Fix docstring 2015-05-20 23:28:26 -04:00
Zach Riggle 5c0d5132e2 Add DynELF.libc() function 2015-05-20 23:23:55 -04:00
Zach Riggle 06fc1eecd5 Make Call() pretty printing... prettier 2015-05-20 23:21:09 -04:00
Zach Riggle 79c718aa43 Update docstring 2015-05-20 22:59:53 -04:00
Zach Riggle d99f7160bf Integrate new ROP building tools 2015-05-20 22:41:13 -04:00
Zach Riggle de4f14c5d2 Fix up call(0x1234,..) and .migrate 2015-05-20 21:52:19 -04:00
Zach Riggle b064c45d5e Add "cat" shellcode 2015-05-20 21:48:00 -04:00
Morten Brøns-Pedersen fa8df31c4f removed a print-statement left from debugging 2015-05-21 01:08:57 +02:00
Morten Brøns-Pedersen 9effbad62e updated doctests for pwnlib.util.packing.fit 2015-05-20 23:50:23 +02:00
Morten Brøns-Pedersen 4bf8b71707 Happy now, Travis? 2015-05-20 23:48:02 +02:00
Morten Brøns-Pedersen 1b3e9984f4 fixed typo in docstring for pwnlib.util.iters.exp 2015-05-20 13:55:00 +02:00
Morten Brøns-Pedersen ceca7b5384 fixed doctest in pwnlib.util.iters.exp 2015-05-20 13:39:12 +02:00
Morten Brøns-Pedersen 156db1aea9 fixes some minor CRLF/LF-issues in term.term 2015-05-20 12:22:05 +02:00
Morten Brøns-Pedersen 26c99083bd added ui.yesno 2015-05-20 12:18:11 +02:00
Morten Brøns-Pedersen 3ae7d9ec9a added util.packing.fit 2015-05-20 12:14:58 +02:00
Morten Brøns-Pedersen 011c7d96a2 added `iters.exp(s, n) as an alias for iters.product(*[s]*n)`. 2015-05-20 12:08:59 +02:00
Morten Brøns-Pedersen 1447c361b0 Better default terminal in util.misc.run_in_terminal
Changed to detect X11 by the presence of the ``DISPLAY`` environment variable.  Also added the field `terminal` to `context`, which allows the user to specify a default terminal.
2015-05-20 11:50:49 +02:00
Zach Riggle 5064a75f1f Fix str() and dump() 2015-05-18 13:25:13 -04:00
Zach Riggle 2e4692ff22 Add log.info since it wont show up otherwise 2015-05-17 10:05:39 -04:00
Zach Riggle 3b9614a535 WIPWIPWIP 2015-05-16 07:55:49 -04:00
Zach Riggle 4acd9bc928 WIPWIPWIP 2015-05-16 00:21:54 -04:00
Zach Riggle da475754fe Enable flat(-1) 2015-05-15 18:35:54 -04:00
Zach Riggle e2ddcf2471 Dont lose any more work 2015-05-15 15:13:22 -04:00
Zach Riggle 40dae903cc Example for context and cleanliness 2015-05-13 18:13:48 -04:00
Zach Riggle eecafc6ed6 Add @LocalContext decorator 2015-05-13 18:02:43 -04:00
eQuiNoX__ 32e85f5791 We dont store the registers inside srop; we just call get_registers when we need them 2015-05-13 22:33:40 +02:00
eQuiNoX__ e58a661375 The following changes were made :-
- changed usage of "self.arch to with context.local..."
2015-05-13 22:29:26 +02:00
eQuiNoX__ 9eadd74bed get_regpos_mapping removed 2015-05-13 22:07:53 +02:00
eQuiNoX__ 525650bc5b The following changes were made :-
- rop.py does not import _registers_* anymore; instead imports get_registers from srop.py
- rop.py now has a self.arch that is set to context.arch inside __init__
- (_registers_32, _registers_64) => (_registers_i386, _registers_amd64)
- get_registers and get_regpos_mapping added in
- _initialize_values now handles all archs
- get_stackpointer_index changed to get_spindex; made cleaner
- get_frame made cleaner
2015-05-13 22:06:57 +02:00
Morten Brøns-Pedersen c9e5a01605 Updated pdh to support highlighting of byte sequences 2015-05-13 15:21:41 +02:00
Morten Brøns-Pedersen cd4a193404 pwnlib.util.fiddling.hexdump can now highlight byte sequences (with wildcards) 2015-05-13 15:20:31 +02:00
Morten Brøns-Pedersen 94e0064c19 Changed util.fiddling.hexdump_iter to take a file object instead of a string. This massively speeds up phd <file> | less for huge files. 2015-05-13 11:06:38 +02:00
Zach Riggle d3e73d231b Merge pull request #16 from eQu1NoX/master
Initial set of commits integrating SROP with ROP
2015-05-13 00:19:22 -04:00
eQuiNoX__ d7933badf2 Add in the skeleton of integrating SROP with ROP
So now we can populate the accumulator register with the sigreturn syscall number

rop.py now finds "int 0x80" instructions.

Adding in more to srop skeleton; integrating with finding int 0x80 instruction

The following changes were made :-
- s/find/index correction for list
- required imports added in
- None as argument removed

Now generates srop frames whenever function cannot be resolved

Add in code that pivots only if the gadget is not a "pop"

dump is now modified to print out the register information from srop

Uses constants.linux.i386 for syscall numbers now

Added in some exception handling code

Rely on constants to get us the right syscall number based on context.arch

The following changes were made :-
- getattr when getting syscall_number now returns None by default
- ropgadget now looks for syscall and sysenter
- added in getattr("syscall") and getattr("sysenter")

rop.search now returns a namedtuple

The following changes were made :-
1. self.int80, self.syscall and self.sysenter now return namedtuples.
2. We have functions self.raw_address and self.raw_data to specify
   how the raw values that are added in, need to be interpreted so that
   the chain can be built accordingly.

Added in a function _get_syscall_inst that returns the address of a syscall instruction

Checking if travis builds it properly/

The following changes were made :-
- Change the body of _get_syscall_inst, make it cleaner
- Add in a self._syscall_instruction that caches the address of
  a syscall instruction that was found

Removed raw_address and raw_data; modified srop implementation to use raw()

Cleanup getattr

Now the stack pointer is modified so that we can continue constructing the ROP chain if rop.base is specified

No need of enumerate; removed

doctest for rop-srop integration added in
2015-05-13 03:53:03 +02:00
Zach Riggle e4d44c54d8 Detect fortify-source 2015-05-12 02:08:35 -04:00
Zach Riggle c5ec095b7f Fix debugging of thumb shellcode 2015-05-09 15:42:06 -07:00
Zach Riggle 476e8991ca Fix debugging of thumb shellcode 2015-05-09 15:37:58 -07:00
Zach Riggle 6e4f616c44 Allow debugging of thumb shellcode 2015-05-09 15:34:33 -07:00
Zach Riggle ffc44ece88 Fix write-ups link
Closes #15
2015-04-28 17:20:35 -04:00
Jonas Rudloff 0dafc5d02d Merge pull request #524 from binjitsu/packing-autodetect-sign
Enhancements to packing to allow auto-detection of sign, as well as unpack bytearray objects
2015-04-28 13:50:51 +02:00
Jonas Rudloff 3807889f33 Merge pull request #530 from teroz/master
Added clarity to the pwnlib.cyclic example
2015-04-28 09:37:18 +02:00
Zach Riggle 40db24653c Merge pull request #13 from eQu1NoX/master
Adding in doctests + renaming x86/x64 to i386/amd64
2015-04-27 11:24:49 -04:00
Jonas Rudloff 421ca7f82e Merge pull request #532 from Gallopsled/br0ns-fix-531
Quickfix for bpython
2015-04-27 11:09:53 +02:00
Zubin Mithra 9908afd495 Adding in docs for sphinx
Dropping the doctest ifmain statements

Correct underline in rst

Add testsetup to srop.rst

Now uses packing.pack instead of struct.pack

Added in context.arch information to srop.rst and srop.py doctest

Added "context.clear()" to the doctest

Cleaned up _reg_pos_mapping up a bit

Corrected reference link

Replace "print repr()" with "unpack_many"

Added in import to srop.rst
2015-04-27 10:24:26 +02:00
Morten Brøns-Pedersen 4e00935630 Quickfix for bpython
Fixes #531
2015-04-26 21:17:34 +02:00
eQuiNoX__ f81993c303 The following changes were made :-
1. Added in doctests for i386 and amd64.
2. Renamed x86/x64 to i386/amd64.
2015-04-26 13:56:41 +02:00
Zach Riggle 3b9e9bf3a0 Merge pull request #9 from eQu1NoX/master
Initial commit adding in SROP support for x86 and x64
2015-04-25 13:32:17 -04:00
Zach Riggle ebef41df05 Fix the architecture for mips646 ELFs 2015-04-25 10:26:33 -07:00
teroz 764da5af10 Added clarity in the pwnlib.cyclic example
modified:   docs/source/intro.rst
2015-04-25 13:06:21 +02:00
eQuiNoX__ 9f5c2e77b8 Renamed the registers a bit, made the example a bit more complete 2015-04-25 08:15:16 +02:00
eQuiNoX__ 116491c54c Rename registers, add references 2015-04-25 08:09:04 +02:00
eQuiNoX__ 285a370378 Add comments for the SigreturnFrame class 2015-04-25 07:41:53 +02:00
Zubin Mithra 9da1c64513 Removed unused imports 2015-04-24 20:54:56 +02:00
Zubin Mithra 8845115b1f Initial commit for adding in SROP support for x86 and x64 2015-04-24 20:50:26 +02:00
Zach Riggle 6f22a11559 Make ELF work with mips64 binaries 2015-04-24 06:00:09 -07:00
Zach Riggle b7ce1b4ccd Fix mips64 2015-04-24 05:27:23 -07:00
Zach Riggle 19f4009b6e Switch from single-arg "arch" to local context 2015-04-24 04:05:29 -07:00
Zach Riggle 17b0d4efe6 Remove redundant info from checksec, realign fields 2015-04-23 21:49:04 -07:00
Zach Riggle 2077846087 Fix newlines at EOF 2015-04-21 02:43:08 -07:00
Zach Riggle b43be94aaa Add undocumented flag to prevent ASLR from being disabled 2015-04-18 19:58:35 -04:00
Zach Riggle 8a671ac1a7 Switch to GitLab since they have a 10GB quota. Add error handling :) 2015-04-17 01:22:44 -04:00
Zach Riggle 8e799d0516 Switch to GitLab since they have a 10GB quota. Add error handling :) 2015-04-17 01:22:30 -04:00
Zach Riggle c503c9c7d5 Respect timeout for wget 2015-04-16 14:27:47 -04:00
Zach Riggle 59537cac6d Add missing architectures 2015-04-16 01:22:03 -04:00
Zach Riggle 34bfd261ca Fix unknown architectures throwing exceptions on GOT/PLT failure. Hide RWX comment if NX is disabled. 2015-04-16 01:22:03 -04:00
Zach Riggle f752a5d474 Miscellaneous bug fixes and enhancements from Binjitsu which are required for this feature to work. 2015-04-16 01:22:03 -04:00
Zach Riggle ad05fda608 Add missing architectures 2015-04-16 01:18:07 -04:00
Zach Riggle 402e324725 Fix unknown architectures throwing exceptions on GOT/PLT failure. Hide RWX comment if NX is disabled. 2015-04-16 01:08:01 -04:00
Zach Riggle d81e63f03d Remove unneeded fields 2015-04-16 00:25:55 -04:00
Zach Riggle 7d3147958f Add code for libcdb lookups 2015-04-16 00:25:39 -04:00
Zach Riggle fcd04a5c91 Add code for libcdb lookups 2015-04-16 00:14:49 -04:00
Zach Riggle 9d9b880954 i386 vs x86 fixup 2015-04-15 23:52:32 -04:00
Zach Riggle 38097d724f Add .buildid property to ELF 2015-04-15 20:58:13 -04:00
Zach Riggle 230cdafe31 ASM => ELF 2015-04-11 15:38:13 -07:00
Zach Riggle 27b7f15c9c Fix VMA for ASM 2015-04-11 15:38:13 -07:00
Zach Riggle 33ca18f931 Tell user if there are RWX segments 2015-04-09 21:05:14 -04:00
Zach Riggle 5f8ae0ef2d Allow passing in an ELF object or just a path 2015-04-09 20:52:38 -04:00
Zach Riggle 821b08240a Enable passing arguments to the marshalled function; use the same naming scheme as subprocess and pwnlib.tubes.process 2015-04-06 04:34:22 -04:00
Zach Riggle 40ea374001 Enable marshalling simple functions to the remote Python instance 2015-04-05 23:41:53 -04:00
Zach Riggle 7399918a54 By default, recv an ~= infinite number of lines 2015-04-05 23:41:42 -04:00
Zach Riggle 367af48420 Evidently whatever android-ndk uses to build binaries zeroes out sh_info for rel.plt 2015-04-02 17:56:55 -04:00
Zach Riggle 3745f6fd03 Round up mmap size; optionally skip loop after recv 2015-03-31 08:23:35 -04:00
Zach Riggle f643bf8722 Remove ~5 bytes from stager 2015-03-31 07:51:48 -04:00
Zach Riggle 580b16230e Add connect doctest 2015-03-31 07:51:39 -04:00
Zach Riggle ee9ffb7491 Revert "Enable is_register for all architectures"
This reverts commit 475c1d407f.
2015-03-31 06:08:52 -04:00
Zach Riggle 2aa6c1f015 Try to remove "Remote debugging from host" line 2015-03-31 06:07:02 -04:00
Zach Riggle 90b8e50d07 Fix argument order for gdb.debug to mimick gdb.attach 2015-03-31 05:23:13 -04:00
Zach Riggle 6802a2c17b Fix bug in gdb.debug which breaks "execute" argument 2015-03-31 05:18:52 -04:00
Zach Riggle 2faeefeaf0 Fix bug in gdb.debug which breaks "execute" argument 2015-03-31 05:17:19 -04:00
Zach Riggle 24e70378ca Enable using gdbserver for debug_shellcode; add run_elf helper 2015-03-30 14:39:03 -04:00
Zach Riggle b7364fe8ac Add context.native helper to determine if the target can be run without QEMU 2015-03-30 14:32:15 -04:00
Zach Riggle 475c1d407f Enable is_register for all architectures 2015-03-30 14:26:43 -04:00
Zach Riggle c9f0ec84d1 Output to ELF for shellcraft 2015-03-30 14:08:31 -04:00
Zach Riggle 8b1a3e73a1 Merge pull request #6 from cebrusfs/master
Use MOV and SYSCALL templates in acceptloop_ipv4 and mprotect_all
2015-03-29 18:13:13 -04:00
Zach Riggle c472d573f7 Update CONTRIBUTING.md 2015-03-29 17:59:56 -04:00
Zach Riggle 10ed1a2a68 Update CONTRIBUTING.md 2015-03-29 17:59:48 -04:00
Zach Riggle 8ec7faf879 Update CONTRIBUTING.md 2015-03-29 17:59:41 -04:00
Jonas Rudloff 94a07cc48c Merge pull request #525 from RobertLarsen/master
Added sockaddr structure generating function
2015-03-27 12:28:40 +01:00
Robert Larsen a7c902ec37 Added docstring. 2015-03-27 00:28:22 +01:00
Robert Larsen 17c9439536 Moved sockaddr function from packing to net. 2015-03-27 00:03:17 +01:00
Robert Larsen ccd225f257 Removed unneeded import. 2015-03-26 23:46:53 +01:00
Robert Larsen 974b0e7543 Added sockaddr code to i386 connect so that it also supports both ipv4
and ipv6.
2015-03-26 23:46:17 +01:00
Robert Larsen 61e3d3bf18 Moved sockaddr code to packing. Probably not the right place for it. 2015-03-26 23:09:57 +01:00
Zach Riggle 6278f9a94e Linux setup should install openssh server 2015-03-26 17:23:47 -04:00
Zach Riggle 25900adf72 Fix push() templates 2015-03-26 17:22:36 -04:00
Zach Riggle fa62f18378 Enhancements to packing to allow auto-detection of sign, as well as unpack bytearray objects
(cherry picked from commit 6a3e2591c29d5a176136b1e1e16b63de5b64160c)
2015-03-26 15:48:49 -04:00
Jonas Rudloff dd00e4cfef Merge pull request #520 from Gallopsled/memleak-struct
Memleak can now leak whole structures
2015-03-26 18:26:17 +01:00
Zach Riggle b8cc1cc831 Multiple enhancements to SSH
- Request a TTY by default, and disable echoing
	- This turns off stdout buffering
	- Only negative effect is that you lose Ctrl+C
- Further improvements to ssh.process to allow e.g. file handle dup'ing
- Greatly improved documentation of members/attributes
- Added .pid attribute to ssh_channel
- Uses SCP by default, falls back to old method of cat'ing files
- Switched to use exclusively SHA256 instead of multiple hashes.
	- We lose no flexibility or support
- Sorted imports
2015-03-26 02:16:00 -04:00
Zach Riggle de7d161a87 Fix push() templates 2015-03-26 02:12:47 -04:00
Zach Riggle 09d053be0f Update CONTRIBUTING.md 2015-03-25 15:44:10 -04:00
MengHuan Yu 9536b17e5a Fix the coding style in 2 shellcraft examples
Use 4 space indent in 'i386/linux/acceptloop_ipv4.asm' and
'i386/linux/mprotect_all.asm'

BUG=None
TEST=None
2015-03-26 01:41:50 +08:00
MengHuan Yu 2aeda2c993 Use PUSH template in acceptloop_ipv4
BUG=None
TEST=confirmed the behavior by strace.
2015-03-26 01:36:21 +08:00
MengHuan Yu 17c3a27861 Use MOV and SYSCALL templates in some shellcode
In this commit, I only fix 'i386/linux/acceptloop_ipv4.asm' and
'i386/linux/mprotect_all.asm'.

BUG=None
TEST=confirmed the behavior is still the same under
gdb and strace.
2015-03-25 23:48:20 +08:00
Robert Larsen 5214be49f0 Added function for generating a sockaddr structure for shellcodes. 2015-03-24 23:57:00 +01:00
Jonas Rudloff f5d3b4aac0 Merge pull request #512 from RobertLarsen/thumb-connect
Added connect shellcode for thumb/linux.
2015-03-24 21:02:32 +01:00
Jonas Rudloff eafdc0a13e Merge pull request #496 from binjitsu/asm-enhancements
General enhancements to ASM, add make_elf
2015-03-24 20:05:18 +01:00
Jonas Rudloff 007f362dc1 Merge pull request #497 from binjitsu/context-binary
Add context.binary helper
2015-03-24 20:03:46 +01:00
Jonas Rudloff b7a98c9971 Merge pull request #516 from binjitsu/arm-syscall
Arm syscall
2015-03-24 20:02:38 +01:00
Jonas Rudloff 71c6f3339a Merge pull request #515 from RobertLarsen/thumb-stager
Thumb stager
2015-03-24 20:02:29 +01:00
Jonas Rudloff c7890f79c9 Merge pull request #513 from binjitsu/this-file-is-outdated
Remove install_local.sh since it's outdated
2015-03-24 20:02:15 +01:00
Zach Riggle 36f1fc32e0 Ensure textual levels e.g. "debug" are translated to logging.DEBUG 2015-03-24 14:29:03 -04:00
Jonas Rudloff a2bab1ff6f Merge pull request #494 from binjitsu/tube-packing-shortcuts
Tube packing shortcuts
2015-03-24 18:54:23 +01:00
Jonas Rudloff b092b171f8 fixed documentation and whitespace 2015-03-24 18:40:41 +01:00
Jonas Rudloff 20f4b92fd0 Merge pull request #504 from binjitsu/shellcraft-enhancements-mov
Multiple enhancements to shellcraft
2015-03-24 14:29:51 +01:00
Jonas Rudloff 8c73bdc17d Merge pull request #491 from binjitsu/asm-vma-fix
Fix VMA for ASM
2015-03-24 14:19:57 +01:00
Jonas Rudloff a74aea025b Merge pull request #514 from binjitsu/shellcraft-completion-requires-sudo
Don't install shellcraft completion by default.  It requires sudo.
2015-03-24 14:19:42 +01:00
Jonas Rudloff 4c78c1674f Memleak can now leak whole structures 2015-03-24 12:22:42 +01:00
Robert Larsen 74fc4d0e22 Removed comment. 2015-03-23 21:50:37 +01:00
Robert Larsen 1b5145792b Use arm.syscall 2015-03-23 21:49:27 +01:00
Zach Riggle 9ca377c61c Multiple enhancements to shellcraft
- Refactor i386/amd64 mov code to use new register info
	- Mostly this is to clean up the code and remove things like bigger[0][-1]
- A small enhancement to the ARM shellcode
- Resolve hosts for i386.linux.connect
- Add arm.trap
- Add gethostbyname to i386.connect
2015-03-23 02:56:52 -07:00
Zach Riggle 0a6f1e540e Update README.md 2015-03-23 02:39:22 -04:00
Zach Riggle 2caafc879f Update README.md 2015-03-23 02:39:01 -04:00
Zach Riggle 425385e135 Mark .text area as RWX so that self-modifying code can be tested 2015-03-22 23:28:32 -07:00
Zach Riggle f30f2093b0 Less than, not shift 2015-03-22 23:22:47 -07:00
Zach Riggle fadfa11214 *Actually* Add mapping for i686 / 32-bit Linux 2015-03-22 23:18:35 -07:00
Zach Riggle 030407d8e7 Don't close e.g. stdin if dup'ing to it 2015-03-22 23:18:12 -07:00
Zach Riggle 0c513cb06b Mark .text area as RWX so that self-modifying code can be tested 2015-03-22 22:22:36 -07:00
Zach Riggle 2e0d7b8671 Fix output redirection based on filenames 2015-03-22 17:03:02 -07:00
Zach Riggle 14130f3b40 Implement complex constants
- Keep their name so that we have relevant info in shellcode
- Can be manipulated as integers as you'd expect
- Update generation scripts to emit new-style constants
2015-03-22 16:27:05 -07:00
fhare d761e78d91 Add syscall shellcode for arm.
(cherry picked from commit eb8a166659)
2015-03-22 15:54:25 -07:00
fhare cc9fc0b6b1 Add register validation and constant substitution in mov shellcode for arm.
(cherry picked from commit 16c7954e0a)
2015-03-22 15:54:19 -07:00
Zach Riggle 5004787cb9 Add mapping for i686 / 32-bit Linux 2015-03-22 14:58:58 -07:00
Robert Larsen 8021d2bc3c Branch to r8 instead of moving it. 2015-03-22 22:13:28 +01:00
Zach Riggle 1a55837bff Update .travis_install.sh 2015-03-22 06:07:39 -04:00
Zach Riggle c8c9e5d1ea Update .travis_install.sh 2015-03-22 06:07:19 -04:00
Zach Riggle 7387ed55a5 Don't install shellcraft completion by default. It requires sudo. 2015-03-22 05:26:09 -04:00
Zach Riggle 5e601ebd70 Remove install_local.sh since it's outdated 2015-03-22 05:23:59 -04:00
Robert Larsen f51feb0c85 Set condition flags. 2015-03-22 00:33:24 +01:00
Robert Larsen 7c1567bbce No error label. 2015-03-22 00:04:54 +01:00
Robert Larsen 8b823c813d Added stager for thumb/linux. 2015-03-22 00:03:02 +01:00
Zach Riggle 989e7694d8 Fix push and pushstr for ARM 2015-03-21 17:12:45 -04:00
Robert Larsen ce5052b415 Added connect shellcode for thumb/linux. 2015-03-21 21:47:44 +01:00
Zach Riggle f753382a4d Merge remote-tracking branch 'remotes/fhare/master' 2015-03-21 16:44:10 -04:00
Zach Riggle e5b3baae84 Keep link to binary in the cache 2015-03-21 16:32:32 -04:00
Jonas Rudloff 691fe6f1bc Merge pull request #511 from RobertLarsen/amd64-connect
Amd64 connect
2015-03-21 11:27:11 +01:00
Robert Larsen 0429c8c5c8 Added connect shellcode for amd64/linux. 2015-03-21 00:04:14 +01:00
Zach Riggle 1e8bf3e0e9 Remove share directory 2015-03-20 17:17:46 -04:00
Zach Riggle 3fe3502b30 Superficial changes to test CI build time 2015-03-20 17:09:57 -04:00
Zach Riggle 9905ba6605 Try absolute path 2015-03-20 17:09:08 -04:00
Zach Riggle 827d4e5f09 Superficial changes to test CI build time 2015-03-20 17:06:02 -04:00
Zach Riggle f8a64a69c1 Superficial changes to test CI build time 2015-03-20 17:03:15 -04:00
Zach Riggle 50451ceda6 Attempt caching site-packages so we dont rebuild capstone 2015-03-20 17:00:34 -04:00
Zach Riggle 1aff50166a Enable caching of binutils 2015-03-20 16:55:49 -04:00
Zach Riggle a8d02b5108 Enable caching of pip dependencies 2015-03-20 16:07:40 -04:00
Zach Riggle a46e7fdc06 Use container-based Travis CI so that it builds faster 2015-03-20 16:00:25 -04:00
Kristoffer Søholm e87f998c57 Merge pull request #509 from RobertLarsen/fix-doc
Fixed doc.
2015-03-20 17:14:15 +01:00
Robert Larsen 32162a734e Merge branch 'master' of https://github.com/RobertLarsen/pwntools 2015-03-20 15:03:15 +01:00
Robert Larsen 69fe228fd6 Merge branch 'master' of https://github.com/RobertLarsen/pwntools into fix-doc 2015-03-20 15:03:00 +01:00
Robert Larsen 28721dc876 Fixed doc. 2015-03-20 14:59:33 +01:00
Robert Larsen 881590dd3b Added stager for amd64/linux. 2015-03-20 14:56:38 +01:00
Robert Larsen 4905647807 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2015-03-20 14:35:07 +01:00
Robert Larsen 470df7fa1e Added stager for amd64/linux. 2015-03-20 14:33:02 +01:00
Kristoffer Søholm 1bb9482c91 Merge pull request #508 from RobertLarsen/amd64-bindsh
Added bindshell shellcode for amd64/linux.
2015-03-20 13:39:24 +01:00
Kristoffer Søholm 25cff5f92b Merge pull request #492 from binjitsu/arm-mov-reg-reg
Enable mov reg, reg for ARM
2015-03-20 13:20:03 +01:00
Kristoffer Søholm 116df98a5e Merge pull request #493 from binjitsu/bugfix-pause
Fix bug in pause()
2015-03-20 13:17:10 +01:00
Robert Larsen 08fe08cd55 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2015-03-20 13:08:09 +01:00
Kristoffer Søholm ed5229da8b Merge pull request #505 from RobertLarsen/amd64-findpeersh
Amd64 findpeersh
2015-03-20 12:57:54 +01:00
Robert Larsen aad286fbb4 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2015-03-20 12:06:58 +01:00
Robert Larsen ef46969bce Merge branch 'amd64-bindsh' 2015-03-20 11:46:56 +01:00
Robert Larsen f1bd02e571 Merge branch 'amd64-findpeersh' 2015-03-20 11:46:34 +01:00
Robert Larsen 0da1aca8bb Fixed doc. 2015-03-20 11:46:12 +01:00
Robert Larsen 4b869e408b Added bindshell shellcode for amd64/linux. 2015-03-20 11:26:52 +01:00
Zach Riggle 9cdd76cde2 General enhancements to ASM, add make_elf
- Sorted imports
- We can now build whole, compact ELF files.
    - This is useful for e.g. ioarm level 1
- Various fixes for endianness support, bit sizes when assembling
- Don't catch KeyboardInterrupt
2015-03-20 05:07:15 -04:00
Zach Riggle 15426e410f Add context.binary helper 2015-03-20 05:06:35 -04:00
Robert Larsen ed1eaf2a37 Merge pull request #486 from zachriggle/patch-3
Change IRC channel to #pwntools
2015-03-20 09:50:29 +01:00
Robert Larsen 5c8f64e5f6 Merge pull request #429 from zachriggle/patch-1
Update LICENSE-pwntools.txt
2015-03-20 09:49:53 +01:00
Robert Larsen 6c44b36750 Merge pull request #495 from binjitsu/elf-arch-fixes
Various enhancements to ELF
2015-03-20 09:43:29 +01:00
Robert Larsen 83da6ef918 Document constant. 2015-03-20 09:22:44 +01:00
Robert Larsen a0e18aa58a Set the length of the address structure. 2015-03-20 09:16:05 +01:00
Zach Riggle dfcf26f37a Use setsid instead of setpgrp to capture output to /dev/tty 2015-03-19 17:16:35 -04:00
Zach Riggle 50ac72d8eb Use setsid instead of setpgrp to capture output to /dev/tty 2015-03-19 17:15:37 -04:00
Robert Larsen ce9f47a009 Closer to working solution. 2015-03-19 16:00:32 +01:00
Robert Larsen e16d1e2883 Added file for implementing findpeer shellcode. 2015-03-19 00:07:30 +01:00
Robert Larsen 6e8940f051 Added template for implementing the shellcode. 2015-03-19 00:05:58 +01:00
fhare eb8a166659 Add syscall shellcode for arm. 2015-03-18 20:11:23 +01:00
fhare 16c7954e0a Add register validation and constant substitution in mov shellcode for arm. 2015-03-18 20:11:23 +01:00
Zach Riggle f0c4d5814a No isort 2015-03-18 14:33:07 -04:00
Zach Riggle d2f0cec56d Maybe now travis will be happy? 2015-03-17 23:19:16 -04:00
Zach Riggle 2b163fb7fb Sort imports 2015-03-17 19:01:34 -04:00
Zach Riggle b9c581b78c Revert i386 mov changes temporarily 2015-03-17 12:12:06 -07:00
Zach Riggle 290f17a408 Add optimization for values which are negatable 2015-03-18 14:49:49 -04:00
Zach Riggle f22537027f Fix bug in __repr__ and make mov recursive 2015-03-18 14:49:44 -04:00
Zach Riggle 342cf97099 Enhance asm and shellcraft with auto-debugging; add checksec command-line 2015-03-16 22:32:46 -07:00
Zach Riggle 5ddb4f4bda Add gdb.debug_shellcode and fix cross-arch debugging with qemu-user 2015-03-16 21:40:26 -07:00
Zach Riggle 9e2901e70f Merge remote-tracking branch 'gallopsled/master'
Conflicts:
	README.md
	pwn/toplevel.py
	pwnlib/__init__.py
	pwnlib/commandline/shellcraft.py
	pwnlib/shellcraft/__init__.py
	pwnlib/tubes/ssh.py
	pwnlib/util/iters.py
2015-03-16 21:38:57 -07:00
Zach Riggle 98c5b18e58 Enhance functionality in process
- Make stdout a PTY
	- This disables buffering on stdout
- Add options to specify how stdin/stdout/stderr are created
- Expose preexec_fn
- Protect the user from common Python-specific pitfalls
	- e.g. argv elements cannot contain or even end with '\x00'
2015-03-16 20:39:26 -07:00
Zach Riggle d38deb5ae7 Fix imports 2015-03-16 20:13:07 -07:00
Zach Riggle 8e14c3d488 Add context.binary helper 2015-03-16 20:09:49 -07:00
Zach Riggle 820c455b1a Various enhancements to ELF
- Better documentation
- Remove generally unused fields of checksec
- Better support for uncommon architectures
2015-03-16 19:09:49 -07:00
Zach Riggle 19fb739d24 Fix architectures, add more architectures, add better detection for GOT and PLT 2015-03-16 19:09:07 -07:00
Zach Riggle 2784ea58c9 Add mov reg,reg noop 2015-03-16 18:37:14 -04:00
Zach Riggle 7c9638b6df Enable mov reg, reg for ARM 2015-03-16 18:34:33 -04:00
Kristoffer Søholm 34767b08ef Merge pull request #488 from binjitsu/arch
Add missing architecture constants
2015-03-16 23:24:57 +01:00
Zach Riggle 2c5125a74c Add tube.flat
Conflicts:
	pwnlib/tubes/tube.py
2015-03-16 15:22:32 -07:00
Zach Riggle 143fca406a Add packing shortcuts
Conflicts:
	pwnlib/tubes/tube.py
2015-03-16 15:22:12 -07:00
Zach Riggle 0174b33714 Fix bug in pause() 2015-03-16 15:20:25 -07:00
Zach Riggle 7a1d62f2fb Fix bug in pause() 2015-03-16 15:19:58 -07:00
Zach Riggle 6d806cede3 Add tube.flat 2015-03-16 15:19:45 -07:00
Zach Riggle 41c7aeda31 Fix VMA for ASM 2015-03-16 16:47:01 -04:00
Zach Riggle 1fc1406895 Fix leak.raw 2015-03-15 05:32:15 -07:00
Zach Riggle 008b013542 Add packing shortcuts 2015-03-14 19:35:49 -07:00
Zach Riggle e485e5bc93 Add missing architecture constants 2015-03-13 10:44:55 -07:00
Zach Riggle beb07285d6 Add missing architecture constants 2015-03-13 10:41:16 -07:00
Zach Riggle 9a87c2032d Change IRC channel to #pwntools 2015-03-13 12:19:56 -04:00
Mathias Svensson 32b05024d3 Merge pull request #482 from Gallopsled/bruteforce_bugfix
Fixed bug in total_iterations calculation
2015-03-13 01:28:39 +01:00
Kristoffer Søholm 69023995d0 Fixed bug in total_iterations calculation 2015-03-12 20:16:42 +01:00
Kristoffer Søholm 31242554eb Merge pull request #461 from StevenVanAcker/master
multithreaded bruteforcing + bugfixes
2015-03-12 20:08:29 +01:00
Kristoffer Søholm eefe307724 Merge pull request #481 from RobertLarsen/cyclic_length
Made cyclic respect the '--length' argument when looking up.
2015-03-12 19:30:43 +01:00
Robert Larsen f80acf8437 Made cyclic respect the '--length' argument when looking up. 2015-03-12 14:47:37 +01:00
Zach Riggle 4fa6cc0649 Remove link info, put arch on one line 2015-03-12 00:52:06 -07:00
Zach Riggle c825e43ff2 Add linked/static, remove RUNPATH and RPATH if they're OK since it has never been useful 2015-03-12 00:49:44 -07:00
Zach Riggle 506815533a Streamline checksec 2015-03-12 00:24:28 -07:00
Zach Riggle b9951de394 Add documentation to ELF fields 2015-03-12 00:23:14 -07:00
Zach Riggle ca8f0b2f80 Add more info to checksec, and add bits as a property 2015-03-12 00:22:07 -07:00
Zach Riggle a39b9ef25b Add endianness info to checksec script 2015-03-12 00:17:22 -07:00
Zach Riggle 3cfbf0793d Add endianess to ELF 2015-03-12 00:16:41 -07:00
Zach Riggle fced987465 Add checksec command-line script 2015-03-12 00:12:42 -07:00
Zach Riggle 2530b1c586 Make isort happy 2015-03-12 00:02:17 -07:00
Zach Riggle 477d0f54bf Fix arguments 2015-03-12 00:02:17 -07:00
Zach Riggle acc4f64a4b Add asm debugging 2015-03-12 00:02:17 -07:00
Zach Riggle f7c3dae4e1 Add shellcraft debugging 2015-03-12 00:02:17 -07:00
Zach Riggle 38e4ada7ce Rework a bunch of the shellcode for readability. 2015-03-12 00:02:12 -07:00
Zach Riggle 8afb2b6d89 .sendline() should be call-able by itself 2015-03-11 20:30:18 -07:00
Zach Riggle 81c9565e4c Don't wait forever for the PID to show up, handle if there's an issue 2015-03-11 20:29:18 -07:00
Zach Riggle 15f1aeaafe Logging hack for tube sub-classes defined outside of pwnlib 2015-03-09 23:40:35 -07:00
Jonas Rudloff 1ddd80c53d Merge pull request #476 from Gallopsled/autofmtstr
Automated format string explotation
2015-02-27 11:05:29 +01:00
Jonas Rudloff d1ae931728 Better heuristic for leaking elf headers on page boundaries 2015-02-27 10:55:58 +01:00
Zach Riggle 820936ccbd Update README.md 2015-02-26 19:08:07 -05:00
Mathias Svensson 5c0fafc4c9 Merge pull request #480 from binjitsu/issue-442
Fix mis-reporting of NX when there is no GNU_STACK segment
2015-02-26 22:13:36 +01:00
Zach Riggle cefac557d3 Fix mis-reporting of NX when there is no GNU_STACK segment
(cherry picked from commit a96ffc80a2)
2015-02-26 15:42:00 -05:00
Jonas Rudloff 58cc527687 Merge pull request #479 from binjitsu/pwntools-logo
Add logo
2015-02-26 21:37:36 +01:00
Jonas Rudloff ba395ab357 Merge pull request #451 from binjitsu/shellcraft-speedup
Speed up shellcraft loading and clean up code a bit
2015-02-26 21:28:46 +01:00
Jonas Rudloff dc7f4dcff5 fixed logging 2015-02-26 13:22:58 +01:00
Jonas Rudloff bb96f4982c Merge pull request #478 from binjitsu/pwntools-ssh-cwd-executable
Set +x on the directory created via ssh.set_working_directory
2015-02-26 12:56:25 +01:00
Zach Riggle 6e0852baf5 Add logo 2015-02-26 06:31:33 -05:00
Zach Riggle 6499a63bfb Add logo with text 2015-02-26 05:01:58 -05:00
Zach Riggle c2c3aec1c8 Update LICENSE-binjitsu.txt 2015-02-26 04:46:01 -05:00
Zach Riggle 70c34aab2a Update LICENSE-binjitsu.txt 2015-02-26 04:44:51 -05:00
Zach Riggle 3be0ee96a7 Add logo CC BY 2015-02-26 04:43:54 -05:00
Jonas Rudloff 7c0f23476d use pack instead of p32 2015-02-26 10:02:15 +01:00
Zach Riggle 6f8823829f Sort templates 2015-02-25 14:57:47 -05:00
Zach Riggle 71ecf70de6 Speed up shellcraft loading and clean up code a bit 2015-02-25 14:57:47 -05:00
Zach Riggle 1e062ac52b Merge branch 'pwntools' 2015-02-25 14:47:18 -05:00
Zach Riggle fb6b046d8d Merge commit '850efb5' 2015-02-25 14:42:32 -05:00
Zach Riggle b7dc9c934f Set +x on the directory created 2015-02-25 14:26:44 -05:00
Jonas Rudloff cb64e2d4aa Merge branch 'master' of github.com:Gallopsled/pwntools
Conflicts:
	pwnlib/tubes/ssh.py
2015-02-25 19:22:55 +01:00
Jonas Rudloff 8ac88d141c Merge branch 'binjitsu-ssh-run-system-rename' 2015-02-25 19:17:54 +01:00
Jonas Rudloff 8f92f07e62 Merge branch 'ssh-run-system-rename' of git://github.com/binjitsu/binjitsu into binjitsu-ssh-run-system-rename 2015-02-25 19:17:07 +01:00
Jonas Rudloff 0874e1908f fixed nbuckets -> nbucket in dynelf.py for sysv hash lookups
(cherry picked from commit c50d32d700)
2015-02-25 12:05:45 -05:00
Jonas Rudloff cbe13129db fixes bug in memleak.py
(cherry picked from commit 4a7d4fcff7)
2015-02-25 12:05:39 -05:00
Kenny 980d391b1f Fix #469 - verify search_results has items before using
(cherry picked from commit 8bd50f958c)
2015-02-25 12:05:35 -05:00
Jonas Rudloff 133d629bd3 Merge pull request #475 from Gallopsled/dynelf-fix
fix dynelf for sysv lookups
2015-02-25 13:42:39 +01:00
Jonas Rudloff 29889a00df Merge pull request #474 from Gallopsled/memleak-bug
fixes bug in memleak.py
2015-02-25 13:42:25 +01:00
Jonas Rudloff abc6360833 Update ssh.py
Use example.pwnme as hostname instead of localhost
2015-02-25 12:45:53 +01:00
Jonas Rudloff 75f48e74dd Merge pull request #444 from binjitsu/ssh-process-execve
SSH Process-style interface with full control over argv
2015-02-25 12:26:57 +01:00
Jonas Rudloff 017f5861ce Automated format string explotation 2015-02-25 12:11:40 +01:00
Jonas Rudloff c50d32d700 fixed nbuckets -> nbucket in dynelf.py for sysv hash lookups 2015-02-25 11:54:03 +01:00
Jonas Rudloff 28bd8fc3a7 Merge pull request #447 from zachriggle/patch-1
Update 'latest version' documentation since pip can install from git
2015-02-24 23:08:08 +01:00
Jonas Rudloff 31b84d7ba9 Merge pull request #471 from zachriggle/patch-2
Fix gdb.attach for foreign architectures
2015-02-24 22:59:34 +01:00
Zach Riggle 9d1756e99b More useful message on Administratively Prohibited 2015-02-24 16:34:06 -05:00
Jonas Rudloff de50da1849 Merge pull request #463 from binjitsu/capstone3
Update dependency versions
2015-02-24 22:28:03 +01:00
Jonas Rudloff 5a36d7fdc6 Merge pull request #464 from binjitsu/proc-pty-stdout
Set stdout to be a PTY on spawned processes so that stdout is not buffered
2015-02-24 22:25:49 +01:00
Jonas Rudloff 23eed9752c Merge pull request #460 from binjitsu/threading-event-wait
Enable a configurable timeout for recvall
2015-02-24 21:33:18 +01:00
Jonas Rudloff ef71b4c1ef Merge pull request #466 from binjitsu/mit-license-badge
Add MIT license badge
2015-02-24 21:32:12 +01:00
Jonas Rudloff ca9f918ac1 Merge pull request #470 from r3dey3/master
Fix #469 - verify search_results has items before using
2015-02-24 21:32:01 +01:00
Jonas Rudloff 12b2b127af Merge pull request #446 from binjitsu/sphinx-warnings
Squash most of the Sphinx warnings
2015-02-24 21:30:02 +01:00
Jonas Rudloff ea1cb8ad7a Merge pull request #439 from binjitsu/ssh-revamp-localhost-only
Restrict demouser for Travis to localhost only.
2015-02-24 21:27:27 +01:00
Jonas Rudloff 4a7d4fcff7 fixes bug in memleak.py 2015-02-23 20:28:19 +01:00
Zach Riggle cb163e7662 Add install message [skipci] 2015-02-21 12:27:22 -08:00
Zach Riggle fdae85c991 Check for Python development headers 2015-02-21 12:25:46 -08:00
Zach Riggle f171539d83 Include error number 2015-02-21 11:42:47 -08:00
Zach Riggle 44f881b742 Handle when there's no known_hosts or config for SSH 2015-02-21 11:28:18 -08:00
Zach Riggle cc6ca79a45 Add tox 2015-02-21 11:24:31 -08:00
Zach Riggle 9332812af1 tox.ini 2015-02-21 10:27:15 -08:00
Zach Riggle 3f23a8a63a Add missing linker flag 2015-02-21 10:12:27 -08:00
Zach Riggle 35ef86b189 Update ssh.process to use sh_string instead of creating a temporary file 2015-02-21 08:36:46 -08:00
Zach Riggle 5962bca201 Require tox 2015-02-21 08:13:53 -08:00
Zach Riggle 0c8935fc8c make clean should rmeove all temporary files 2015-02-20 16:32:01 -08:00
Zach Riggle 5e1447f8b4 When an exception is thrown on teardown, _run_handlers doesn't exist anymore 2015-02-20 16:27:35 -08:00
Zach Riggle 9ec1ea0852 Add useragents to packaged files; require recent pip 2015-02-20 16:26:40 -08:00
Zach Riggle b54d2dfa47 Pretty please? 2015-02-20 13:50:51 -08:00
Zach Riggle 547e8df98a Fix doctests 2015-02-20 13:39:12 -08:00
Zach Riggle ef74b64e86 Update test suite instructions 2015-02-20 13:30:51 -08:00
Zach Riggle 886e49bd1c Fix architectures between GDB and QEMU; auto-set endianness 2015-02-20 10:06:33 -08:00
Zach Riggle 42486c7a76 Add missing newlines to script 2015-02-19 17:51:32 -08:00
Zach Riggle 57eaede85b Add format argument 2015-02-19 17:50:52 -08:00
Zach Riggle 0ad8649599 Make default arguments a bit more explicit 2015-02-13 11:01:57 -08:00
Zach Riggle 8c183ac0e3 Fix regression which would cause ././binary to be invoked 2015-02-13 11:00:17 -08:00
Zach Riggle c0002895c8 Add an example for dup2ing 0 to 2 because subprocess tries to protect you from this 2015-02-13 10:57:55 -08:00
Zach Riggle a92260d9e5 Add preexec_fn 2015-02-13 10:46:40 -08:00
Zach Riggle b7743546b6 Fix log statements 2015-02-12 21:26:50 -08:00
Zach Riggle 75d260cd77 Add better documentation 2015-02-12 19:40:18 -08:00
Zach Riggle fc4abbf395 Add documentation for process and add shell=True doctest 2015-02-12 19:29:16 -08:00
Zach Riggle a5c8aa31a5 Default arg update 2015-02-12 19:13:16 -08:00
Zach Riggle 9e90e0485c Add file descriptors and documentation to ssh.process 2015-02-12 19:09:28 -08:00
Zach Riggle 1a1afabb23 Better fix for interactive() on raw TTYs 2015-02-12 10:24:35 -08:00
Zach Riggle 37ea0e8882 Remove extra print [skip ci] 2015-02-12 10:24:35 -08:00
Zach Riggle f3237586a5 Add warning message for no gdb-multiarch 2015-02-12 11:18:46 -05:00
Zach Riggle 324ef12b29 Revert PPA link; 2015-02-12 10:50:51 -05:00
Zach Riggle 3b659cc8ec Version fail 2015-02-12 10:48:22 -05:00
Zach Riggle 99aa19f332 Slightly better error message 2015-02-12 10:47:46 -05:00
Zach Riggle c623661f06 --upgrade 2015-02-12 10:47:00 -05:00
Zach Riggle 1d165fbde4 Evidently old versions of Git dont like Cloudflare 2015-02-12 10:37:41 -05:00
Zach Riggle a7816bde40 Change URLs to binjit.su, version to "master" 2015-02-12 10:06:55 -05:00
Zach Riggle de8de2d187 Add unit test for make_elf 2015-02-12 04:39:51 -08:00
Zach Riggle 3df64b6c80 Fix parsing ~/.ssh/config. Removes need for ssh_agent for tests. 2015-02-12 04:36:07 -08:00
Zach Riggle 84fc6a37e3 Use .string since it's easier to compare to Python 2015-02-12 03:52:51 -08:00
Zach Riggle a2fb187c2a Import everything from asm in __all__ 2015-02-12 03:25:15 -08:00
Zach Riggle 8a915a59e7 Fix gdb.attach(arch=...) and add gdb.debug_shellcode 2015-02-12 03:19:51 -08:00
Zach Riggle ea88f746a1 Fix pidof for sockets 2015-02-12 03:17:22 -08:00
Zach Riggle 33c47c159c Enable xor on integers, use default packing 2015-02-12 03:16:56 -08:00
Zach Riggle 0d544d96c8 Add message to ssh setup. Required because ssh-agent env vars must persist in parent shell. 2015-02-12 02:44:43 -08:00
Zach Riggle b9ac583e8a Fix CRLF in ssh.ssh_channel.interactive() when tty=True 2015-02-12 02:38:22 -08:00
Zach Riggle b9cb550856 Fix gdb.attach for foreign architectures 2015-02-10 08:24:45 -05:00
Zach Riggle 7e46c36965 Only show build state for Master branch 2015-02-09 05:07:45 -05:00
Kenny 8bd50f958c Fix #469 - verify search_results has items before using 2015-02-08 15:58:22 -05:00
Zach Riggle 0c9d345c37 Don't change anything at all if shell=True 2015-02-06 05:32:36 -08:00
Zach Riggle b28299a96e Style 2015-02-06 05:32:19 -08:00
Zach Riggle f6dab8cb94 Documentation on pty and tty.setraw 2015-02-06 05:30:33 -08:00
Zach Riggle ab3e58be59 Style, typos 2015-02-06 05:27:17 -08:00
Zach Riggle 068a5915b8 Clean up process tube and add member documentation 2015-02-06 05:02:48 -08:00
Zach Riggle 48ccd3dbe6 Make set_working_directory a bit faster 2015-02-05 20:24:09 -08:00
Zach Riggle 4f1bae8748 Less verbose 2015-02-05 20:18:24 -08:00
Zach Riggle 5ed9d4e2a9 Make the interfaces to process() and ssh.process() a bit more robust and fault-tolerant 2015-02-05 19:53:15 -08:00
Zach Riggle 87d12970f6 Update docs about Capstone.
It builds itself for 3.0.1+ and no longer has dependencies outside of the pip-intallable stuff
2015-02-05 09:07:07 -08:00
Zach Riggle 131e669246 Remove outdated script 2015-02-05 08:53:18 -08:00
Zach Riggle 41f003464b Merge pull request #1 from binjitsu/web-doctests
Make doctests cleaner
2015-02-05 11:52:28 -05:00
Zach Riggle b436d4a99a isort requirement 2015-02-05 04:49:50 -08:00
Zach Riggle b689dc6141 Add MIT license badge [noci] 2015-02-05 04:48:28 -08:00
Zach Riggle 9047360dd6 Add align_up alias 2015-02-05 04:48:28 -08:00
Zach Riggle 339c71abbd sorted imports with isort 2015-02-05 04:48:25 -08:00
Zach Riggle 38a080022d Add MIT license badge 2015-02-05 04:31:25 -08:00
Zach Riggle c1308f454f Enhancements to packing to allow auto-detection of sign, as well as unpack bytearray objects
(cherry picked from commit 6a3e2591c29d5a176136b1e1e16b63de5b64160c)

Conflicts:
	pwnlib/util/packing.py
2015-02-05 02:47:57 -08:00
Zach Riggle bfd1c74ef6 Wait for close on unit test 2015-02-05 01:56:14 -08:00
Zach Riggle 2ec8647d10 Wait for close on unit test 2015-02-05 01:56:03 -08:00
Zach Riggle 96f07f950c Actually save the keys 2015-02-05 01:29:57 -08:00
Zach Riggle acaaf2bf98 Enforce SSH keys for IP 2015-02-05 01:15:22 -08:00
Zach Riggle f1b5df6d99 Enhance test for process tube 2015-02-05 00:19:51 -08:00
Zach Riggle 5e4fa7c03d Enhance test for process tube 2015-02-05 00:15:25 -08:00
Zach Riggle 1a69412209 Handle IOError, and ensure Ctrl+C sent to parent process does not propagate to child
(cherry picked from commit 99cae63745)

Conflicts:
	pwnlib/tubes/process.py
2015-02-05 00:10:54 -08:00
Zach Riggle 99cae63745 Handle IOError, and ensure Ctrl+C sent to parent process does not propagate to child 2015-02-05 00:10:00 -08:00
Zach Riggle d194dfd8ce Set stdout to be a PTY on spawned processes so that stdout is not buffered.
(cherry picked from commit 1273bfa1fb)

Conflicts:
	pwnlib/tubes/process.py
2015-02-04 23:58:28 -08:00
Zach Riggle 2c5ea17ddb Merge remote-tracking branch 'origin/capstone3'
Conflicts:
	docs/source/install.rst
2015-02-04 23:52:51 -08:00
Zach Riggle 1273bfa1fb Set stdout to be a PTY on spawned processes so that stdout is not buffered. 2015-02-04 23:51:23 -08:00
Zach Riggle 226e4b73a6 Have capstone install itself
Specify versions of all requirements.  Had some complaints about old psutils, and this will cause new installs to upgrade.

Update Capstone installation docs.  The 3.0.1 target is self-installing.

Avoid Travis CI build time penalty by using older, pre-built Capstone 2.1
2015-02-05 02:10:46 -05:00
Zach Riggle 9d25c526e9 Add --address to disasm 2015-02-02 21:46:25 -08:00
Zach Riggle 34c4843bbf Make gadget loading faster by saving the original addresses and fixing up at runtime 2015-02-02 21:46:11 -08:00
Zach Riggle 4616f9f107 Fix indentation of docstrings 2015-02-02 04:22:55 -08:00
Zach Riggle 12fe3d310a Fix download_file regression and fix spinners 2015-02-02 04:22:37 -08:00
Zach Riggle 24661aa6e7 Fix isEnabledFor 2015-02-02 03:22:32 -08:00
Steven Van Acker 51e5ee5bf2 support for multithreaded bruteforcing 2015-02-02 12:12:18 +01:00
Zach Riggle 1b5c6162d1 Merge branch 'ssh-upgrades' 2015-02-02 03:01:02 -08:00
Zach Riggle e17e9c8b43 Fix issue where "tar -C /tmp" will fail if /tmp is not +r (enumeratable) 2015-02-02 02:56:37 -08:00
Zach Riggle a9e535eef6 Revamp download_dir (did it ever work?) and add "download" alias 2015-02-02 02:56:37 -08:00
Zach Riggle dfe78552c3 Add upload and put aliases/helpers 2015-02-02 02:56:37 -08:00
Zach Riggle 16dadb3376 Rewrite the upload functionality 2015-02-02 02:56:33 -08:00
Zach Riggle 054b7a5b17 Allow ~/foo in ssh.upload_dir 2015-02-02 00:47:41 -08:00
Zach Riggle 3eccae29d8 Only print checksec info once per ELF 2015-02-01 21:10:45 -08:00
Zach Riggle 37e29db87a Clean up SSH cache to only use SHA256. Additionally ssh.libs() now returns the original binary as well. Currently, the address is set to zero. 2015-02-01 21:09:21 -08:00
Steven Van Acker 112b65f8e9 fixing documentation of bruteforce() 2015-02-01 23:50:28 +01:00
Steven Van Acker 890db20b27 fixing order of arguments for consume(), so that bruteforce() works when start is specified 2015-02-01 11:54:27 +01:00
Zach Riggle dc84e7150a More reverting 2015-02-01 00:21:13 -08:00
Zach Riggle f6e90df62a Revert "Rename "pwn" to "binjitsu""
This reverts commit 8bbaa14afe.
2015-01-31 23:58:16 -08:00
Zach Riggle a96ffc80a2 Fix mis-reporting of NX when there is no GNU_STACK segment 2015-01-31 23:31:49 -08:00
Zach Riggle dae43bb581 Make doctests not spew stuff 2015-01-31 22:47:23 -08:00
Zach Riggle b399f2a439 Merge branch 'threading-event-wait' 2015-01-31 22:45:26 -08:00
Zach Riggle a875adb533 Work around #459 2015-01-31 22:45:13 -08:00
Zach Riggle 6730a63432 Add --upgrade 2015-01-31 20:49:43 -08:00
Zach Riggle 8bbaa14afe Rename "pwn" to "binjitsu" 2015-01-31 20:37:58 -08:00
Zach Riggle 7bc5a9cc31 args => argv 2015-01-29 21:15:24 -08:00
Zach Riggle 1844b85ae6 Enable debugging ssh channels. Enrich information with pid and args. Add documentation 2015-01-29 19:51:32 -08:00
Zach Riggle ff19108e02 Revert default log level back to 1; handle isEnabledFor in accordance with context 2015-01-29 19:51:32 -08:00
Zach Riggle 5e58b94d7a Update install docs 2015-01-29 19:51:32 -08:00
Zach Riggle 9a5bccd837 Remove versioned stuff 2015-01-29 19:42:35 -05:00
Zach Riggle 7865ec93b0 Wake up Travis 2015-01-29 19:42:01 -05:00
Zach Riggle de68ff6734 Update installation instructions 2015-01-29 18:43:36 -05:00
Zach Riggle d26a5a7012 Fix quoting style from repr 2015-01-29 18:41:15 -05:00
Zach Riggle 5f167c657f Fix indentation 2015-01-29 05:08:31 -08:00
Zach Riggle 67faf896f1 Make unhex() a bit more forgiving 2015-01-29 05:06:29 -08:00
Zach Riggle 073a179d29 Don't log twice for clean_and_log. 2015-01-28 22:52:12 -08:00
Zach Riggle 65847258fd Always print security info 2015-01-28 20:54:08 -08:00
Zach Riggle b6a98274c0 Update docs 2015-01-28 20:54:00 -08:00
Zach Riggle da9ee7bd9d Fix hostname 2015-01-28 19:33:14 -08:00
Zach Riggle 47160d7398 Expressly disable tty for upload_data 2015-01-28 17:39:01 -08:00
Zach Riggle 5974be5c01 Fix SSH doctests 2015-01-28 17:38:59 -08:00
Zach Riggle edf68d3ffb Dont spawn a tty for this "sh" example 2015-01-28 16:33:36 -08:00
Zach Riggle dddc0ee163 Restore pep237 2015-01-28 16:32:10 -08:00
Zach Riggle 27e96868b8 Unbreak the build while sphinx fixes their issues.
https://bitbucket.org/birkenfeld/sphinx-contrib/issue/93/
2015-01-28 16:26:19 -08:00
Zach Riggle efce85666d Print the actual command used if debugging 2015-01-28 16:26:15 -08:00
Zach Riggle cdbba52548 Disable echoing of control characters 2015-01-27 22:58:17 -08:00
Zach Riggle 2cc92df291 Use tty by default, and run "stty raw" by default except for when doing a shell (process==None).
Add a doctest for sftp vs non-sftp uploads.
Remove extra output from script generated by ssh.process if not run directly.
2015-01-27 22:46:16 -08:00
Zach Riggle f3a0a4f781 Change magic log number to -1 2015-01-27 22:44:53 -08:00
Zach Riggle b5d33ff064 Don't eat Ctrl+C with all the exceptions 2015-01-27 15:00:30 -08:00
Zach Riggle 7e829db170 Fix path names for sftpclient and make script executable 2015-01-27 14:58:54 -08:00
Zach Riggle 504c502c22 Merge branch 'sftpclient' 2015-01-27 12:17:27 -08:00
Zach Riggle 3324062013 Update ssh object to use sftp first; expose _wd as cwd; optional caching 2015-01-27 12:17:11 -08:00
Zach Riggle 3a767b45dd Unfuck progress 2015-01-26 23:19:55 -08:00
Zach Riggle ebb349c700 Merge branch 'commandline-context-pwntools'
Conflicts:
	pwnlib/commandline/disasm.py
	pwnlib/commandline/shellcraft.py
2015-01-26 22:54:00 -08:00
Zach Riggle 9991348963 Use "from pwn import *" in command-line utilities, and shovel all the context information through a single handler 2015-01-26 22:53:10 -08:00
Zach Riggle b010daa438 Set permissions on temporary working directory 2015-01-26 22:24:14 -08:00
Zach Riggle 73a494cfd0 Clean up import name duplication, add pwnlib.version 2015-01-25 22:02:33 -08:00
Zach Riggle 3c2074cdeb Rename ssh.run to ssh.system 2015-01-25 21:53:27 -08:00
Zach Riggle 16f7021065 Merge branch 'ssh-process-execve-binjitsu' 2015-01-25 21:51:26 -08:00
Zach Riggle bd137c7a4c Add a more robust interface to SSH commands which doesn't require hacky shell escaping if Python is available on the remote host. This interface follows the same style as pwnlib.tubes.process.process 2015-01-25 21:51:08 -08:00
Zach Riggle faf66a3981 Add a more robust interface to SSH commands which doesn't require hacky shell escaping if Python is available on the remote host. This interface follows the same style as pwnlib.tubes.process.process 2015-01-25 21:50:28 -08:00
Zach Riggle 4137fac99b Merge branch 'commandline-context-pwntools'
Conflicts:
	pwnlib/commandline/shellcraft.py
2015-01-25 21:40:09 -08:00
Zach Riggle 57de045db5 Use "from pwn import *" in command-line utilities, and shovel all the context information through a single handler 2015-01-25 21:38:23 -08:00
Zach Riggle 5046f18b90 Merge branch 'shellcraft-speedup' 2015-01-25 21:29:05 -08:00
Zach Riggle dcd3df3f10 Sort templates 2015-01-25 21:24:49 -08:00
Zach Riggle ceec814588 Speed up shellcraft loading and clean up code a bit 2015-01-25 21:21:16 -08:00
Zach Riggle a4860f3167 Watch all branches 2015-01-25 18:15:37 -08:00
Zach Riggle c762eec46c Make doctests cleaner 2015-01-25 18:14:44 -08:00
Zach Riggle 380eda7234 Update log statement 2015-01-25 18:08:22 -08:00
Zach Riggle f02cc65624 Merge branch 'elf-data-property' 2015-01-24 17:20:21 -08:00
Zach Riggle 32ecc909a3 Add .data property 2015-01-24 17:19:56 -08:00
Zach Riggle 8710709ca3 Update 'latest version' documentation since pip can install from git 2015-01-24 16:11:51 -08:00
Zach Riggle ec64ebe3c7 Merge branch 'ssh-revamp-localhost-only' 2015-01-24 01:21:04 -08:00
Zach Riggle fb7d604927 Update self.host to the resolved host 2015-01-24 01:20:05 -08:00
Zach Riggle 93a95d16f1 Restrict demouser for Travis to localhost only. Change host name from localhost to example.pwnme. Add support for getting the hostname and identityfile from ssh_config.
Conflicts:
	pwnlib/tubes/ssh.py
2015-01-24 01:19:55 -08:00
Zach Riggle 9de8211e58 Fix logging in tests 2015-01-23 23:35:45 -08:00
Zach Riggle 0726fb45d8 Squash most of the Sphinx warnings 2015-01-23 23:34:39 -08:00
Zach Riggle 7d08ba6893 Rename ssh.run to ssh.system since that's closer to what it really is 2015-01-23 04:51:07 -08:00
Jonas Rudloff 1be8797cee Merge pull request #440 from binjitsu/issue-438
mips -> tradmips
2015-01-22 14:16:21 +01:00
Zach Riggle 6fc936c708 mips -> tradmips 2015-01-22 04:50:40 -08:00
Zach Riggle 33d7e4ea30 mips -> tradmips 2015-01-22 04:48:30 -08:00
Zach Riggle 5134d4f6a4 Update self.host to the resolved host 2015-01-22 04:24:57 -08:00
Zach Riggle 51bda21142 Restrict demouser for Travis to localhost only. Change host name from localhost to example.pwnme. Add support for getting the hostname and identityfile from ssh_config. 2015-01-22 04:13:01 -08:00
Mathias Svensson 8d5cf044e7 Merge pull request #434 from binjitsu/close-handles-proc
Close extra handles on child processes
2015-01-18 16:35:07 +01:00
Zach Riggle 02a6145c1d Close extra handles on child processes 2015-01-16 14:55:16 -08:00
Jonas Rudloff 46bd8e93b2 Merge pull request #418 from Gallopsled/performance-logger
Added a performance logger
2015-01-16 16:19:28 +01:00
Jonas Rudloff c0fec5ee5a Merge pull request #416 from Gallopsled/log-pwnhandler
Added support for increasing logging for a specific point in the tree
2015-01-16 16:17:51 +01:00
Jonas Rudloff 5b33186a51 Merge pull request #433 from Gallopsled/update-gitignore
Added swp to gitignore
2015-01-16 16:16:42 +01:00
Mathias Svensson 5b5b7a2544 Added swp to gitignore 2015-01-16 16:14:16 +01:00
Zach Riggle 99acaf7471 Make nosetests work 2015-01-15 02:54:57 -05:00
Zach Riggle e48c08baa4 Change default fd back to stdout 2015-01-15 02:23:56 -05:00
Zach Riggle b4e89ab373 Fix dependency for travis 2015-01-15 02:20:22 -05:00
Zach Riggle 806f2a3e7d Merge remote-tracking branch 'upstream/fix-stager' 2015-01-15 02:13:49 -05:00
Zach Riggle c709e7e753 Merge branch 'StevenVanAcker/patch-1' 2015-01-15 02:13:31 -05:00
Zach Riggle 88a83cad71 The great rebranding 2015-01-15 02:03:57 -05:00
Kristoffer Søholm 850efb557f Merge pull request #431 from Gallopsled/fix-stager
Off by one line in stager shellcode
2015-01-13 15:37:47 +01:00
Jonas Rudloff e515d234c7 if construct was of by one line 2015-01-13 14:46:48 +01:00
Mathias Svensson 8a97980bc0 Merge pull request #430 from StevenVanAcker/patch-1
fixing capstone installation under debian/ubuntu
2015-01-13 11:48:51 +01:00
Zach Riggle b41a4057c3 Merge branch 'tubes-are-loggers' 2015-01-12 16:23:23 -05:00
Zach Riggle 49244fe1dc Merge branch 'log-level-one' 2015-01-12 16:23:03 -05:00
Zach Riggle 1c06dca971 Merge branch 'connect-gethostbyname' 2015-01-12 16:22:11 -05:00
Zach Riggle 85379b292d Merge branch 'context-logfile' 2015-01-12 16:22:07 -05:00
Zach Riggle 88195d8c56 Merge branch 'issue-338' 2015-01-12 16:22:03 -05:00
StevenVanAcker e432a6584d fixing capstone installation under debian/ubuntu 2015-01-12 22:04:20 +01:00
Zach Riggle 835a94b356 Update LICENSE-pwntools.txt 2015-01-12 14:42:52 -05:00
Zach Riggle 1c52cd0390 Implement "wrap" word_size 2015-01-12 12:50:04 -05:00
Zach Riggle bc270113b6 Enable use of hostnames for connect shellcode. 2015-01-12 12:26:12 -05:00
Zach Riggle 139937114b Stupid doctests 2015-01-12 12:17:19 -05:00
Zach Riggle 2f22025cea Set level to 1 instead 2015-01-12 12:17:19 -05:00
Zach Riggle 8f13445b73 Fix doctest formatting 2015-01-12 12:17:03 -05:00
Zach Riggle f297cf60ba Defer adding a handler and setting the root logger level 2015-01-12 12:17:03 -05:00
Zach Riggle 19866979bc Get rid of reliance on /dev/null; flush logfile when changing log files 2015-01-12 12:16:19 -05:00
Zach Riggle 372490b4e9 Add doctest 2015-01-12 12:16:19 -05:00
Zach Riggle 9f244268ca Re-add handler, should work after #419 is resolved. 2015-01-12 12:16:19 -05:00
Zach Riggle d3929505c4 Remove handler to check Travis result 2015-01-12 12:16:19 -05:00
Zach Riggle a4f21971d1 Skip emitting and formatting records sent to the LogFile if it's /dev/null, which is also the default value 2015-01-12 12:16:19 -05:00
Zach Riggle 4d31a89a67 Enable per-thread logfiles via context, and retargetting the logfile at runtime 2015-01-12 12:16:19 -05:00
Zach Riggle ca47f5ce27 Tubes are Loggers 2015-01-12 12:15:53 -05:00
Zach Riggle 7e02110bc5 Invert the lookup on logging verbosity, using 1 as a sentinel value for "not set" 2015-01-12 12:15:53 -05:00
Zach Riggle 69073530fd Invert the lookup on logging verbosity, using 1 as a sentinel value for "not set" 2015-01-12 12:15:20 -05:00
Zach Riggle 8943102479 Set logLevel to 1 2015-01-12 12:14:48 -05:00
Mathias Svensson 91ae3968ed Merge pull request #426 from Gallopsled/connect-shellcode
Added a connect shellcode ported from the old pwntools
2015-01-12 18:14:20 +01:00
Mathias Svensson bfb5d09b5f Added a performance logger and updated tube.py to use it 2015-01-12 17:59:15 +01:00
Mathias Svensson 9a830b7185 Missed a docstring 2015-01-12 17:54:18 +01:00
Mathias Svensson 4edb4b8894 Added support for increasing logging for a specific point in the tree 2015-01-12 17:54:18 +01:00
Mathias Svensson 2fb768f8a4 Merge pull request #423 from Gallopsled/doctest-stdout
Order matters
2015-01-12 17:52:38 +01:00
Zach Riggle 0fab4731e7 Merge pull request #427 from Gallopsled/travis-apt-update-once
Only call apt-get update once, shaves off a few seconds
2015-01-12 11:49:55 -05:00
Zach Riggle 492d81b9f8 Only call apt-get update once, shaves off a few seconds 2015-01-12 11:36:15 -05:00
Zach Riggle 9139dc64d9 Fix stderr changing on term.init breaking the logging 2015-01-12 11:31:36 -05:00
Jonas Rudloff 771a56e207 Added a connect shellcode ported from the old pwntools 2015-01-12 16:56:32 +01:00
Zach Riggle cde5ec8343 Merge pull request #425 from Gallopsled/capstones-servers-sucks
Stop relying on Capstone's servers to be up
2015-01-12 10:25:08 -05:00
Zach Riggle 872e13da20 Stop relying on Capstone's servers to be up 2015-01-12 10:11:59 -05:00
Zach Riggle 1a4664f248 Merge pull request #419 from Gallopsled/doctest-stdout
Set logging to stdout when running doctests
2015-01-12 06:12:32 -05:00
Zach Riggle 6e33077081 Set logging to stdout when running doctests, since otherwise output is not captured. Also fix assumption that the console handler is the first handler. Also ensure that the console handler is applied for doctests, since some of them require it. 2015-01-12 06:06:23 -05:00
Zach Riggle 37a46e052a Enable direct calls to pack() without endianness specified to pack negative numbers as positive numbers. Fixes #338. 2015-01-12 02:09:39 -05:00
Jonas Rudloff bd3a68c9ce Merge pull request #408 from Gallopsled/mov-microoptimizations
More micro-optimizations to mov shellcodes
2015-01-11 19:15:32 +01:00
Mathias Svensson 3c9e95bd6a More micro-optimizations to mov shellcodes 2015-01-11 18:49:10 +01:00
Robert Larsen 27f9e65939 Merge pull request #405 from Gallopsled/asm-update
Updated a lot of shellcode
2015-01-11 13:55:20 +01:00
Mathias Svensson 0da236aefa Merge pull request #407 from Gallopsled/shellcraft-strip-doctest
improved doctest stripping in shellcraft
2015-01-11 12:46:15 +01:00
Morten Brøns-Pedersen 2a86bf2440 improved doctest stripping in shellcraft 2015-01-11 12:30:22 +01:00
Mathias Svensson 73ae97f197 Enable caching of env stores for constants.eval 2015-01-11 12:28:40 +01:00
Mathias Svensson 3071cf65a7 Updated a lot of shellcodes to use the new eval feature 2015-01-11 12:09:54 +01:00
Mathias Svensson 93d2f5746a Added an eval method to the constants module, to evaluate constants in the current context 2015-01-11 12:04:23 +01:00
Mathias Svensson 4a8e8220e3 Added context manager for shellcraft/internal.py to make it exception-safe 2015-01-11 12:03:55 +01:00
Mathias Svensson 895373e053 Merge pull request #403 from Gallopsled/commandline-logging
bugfix: command line tools now installs a log handler
2015-01-11 11:59:44 +01:00
Morten Brøns-Pedersen d0793c4fac bugfix: command line tools now installs a log handler 2015-01-11 11:51:45 +01:00
Jonas Rudloff f7d39688dc Merge pull request #401 from Gallopsled/log-no-handler-in-lib
now only install a log handler when not in lib-mode
2015-01-10 22:47:29 +01:00
Morten Brøns-Pedersen 4bb4f4ca35 update doctest-hack to test logging output 2015-01-10 22:41:23 +01:00
Morten Brøns-Pedersen 7fd4dd9348 forgot to import logging 2015-01-10 22:41:23 +01:00
Morten Brøns-Pedersen 9df1b2d093 now only install a log handler when not in lib-mode 2015-01-10 22:41:23 +01:00
Jonas Rudloff b2bb517655 Merge pull request #400 from Gallopsled/pwn-noterm-text
command line flag NOTERM no longer turns text decoration off
2015-01-10 22:39:06 +01:00
Jonas Rudloff 346c9b00cf Merge pull request #399 from Gallopsled/log-no-prefix-caching
bugfix: log message prefixes are no longer cached
2015-01-10 22:37:40 +01:00
Jonas Rudloff 724f292773 Merge pull request #398 from Gallopsled/shellcraft-bash-completion
added bash completion for shellcraft
2015-01-10 22:36:00 +01:00
Kristoffer Søholm d4184db93c Merge pull request #402 from Gallopsled/issue-395
no longer creates an "a.out" when using `pwnlib.asm`
2015-01-10 22:02:03 +01:00
Morten Brøns-Pedersen 3e87bfb307 no longer creates an "a.out" when using pwnlib.asm 2015-01-10 21:18:41 +01:00
Morten Brøns-Pedersen 5823d848e8 command line flag NOTERM no longer turns text decoration off 2015-01-10 20:43:18 +01:00
Morten Brøns-Pedersen bed5f37084 bugfix: log message prefixes are no longer cached
this means that changes to `pwnlib.term.text.when` will now take effect as they should
2015-01-10 20:40:58 +01:00
Morten Brøns-Pedersen 47fd9b1132 added bash completion for shellcraft 2015-01-10 20:23:59 +01:00
Kristoffer Søholm 5905444ff4 Merge pull request #397 from Gallopsled/shellcraft-strip-doctests
"shellcraft -?" now removes any doctests from the docstring
2015-01-10 18:55:14 +01:00
Morten Brøns-Pedersen 61d7aa91bd strip trailing blank lines 2015-01-10 18:46:12 +01:00
Morten Brøns-Pedersen 6b008d3ac0 "shellcraft -?" now removes any doctests from the docstring 2015-01-10 18:43:04 +01:00
br0ns 2c127ddb8d Merge pull request #391 from Gallopsled/less-hacky-performance-fix
Made logging less hacky and removed legacy code
2015-01-10 18:14:20 +01:00
br0ns e90474dadc Merge pull request #357 from Gallopsled/stager
use i386.linux.syscall in stager shellcode
2015-01-10 16:34:41 +01:00
Jonas Rudloff cf5a4c582d use i386.linux.syscall in stager shellcode 2015-01-10 16:22:28 +01:00
br0ns b8088b8bb4 Merge pull request #353 from Gallopsled/syscall-7arg
fixes #351 syscall can now accept 7 arguments
2015-01-10 16:15:30 +01:00
Morten Brøns-Pedersen 0c9c8b449a added doctest for pwnlib.shellcraft.i386.linux.syscall 2015-01-10 16:12:32 +01:00
br0ns ffaab6cd08 Merge pull request #390 from Gallopsled/extra-toplevel
Added math, pickle and StringIO to toplevel.py
2015-01-10 15:13:39 +01:00
br0ns 15335dfc30 Merge pull request #394 from Gallopsled/fix-example
Fixed bug in examples/asm.py. There is no context variable "net".
2015-01-10 14:46:53 +01:00
Mathias Svensson 8d61322857 Merge pull request #393 from Gallopsled/rop-docstring-cleanup
fixed formatting issue in docstring for `pwnlib.rop.ROP.__getattr__`
2015-01-10 14:25:05 +01:00
Mathias Svensson 6ad5b206da Fixed bug in examples/asm.py. There is no context variable "net". 2015-01-10 14:22:30 +01:00
Morten Brøns-Pedersen 96511e8c29 fixed formatting issue in docstring for pwnlib.rop.ROP.__getattr__ 2015-01-10 14:16:32 +01:00
Mathias Svensson 37811b04f4 Cleaned up a lot of legacy code 2015-01-10 13:38:40 +01:00
Mathias Svensson d51eda5f43 Updated documentation 2015-01-10 13:38:39 +01:00
Mathias Svensson da886c4b79 Replaced ugly performance hack with less ugly performance hack 2015-01-10 12:25:18 +01:00
Mathias Svensson 24542f422a Added math, pickle and StringIO to toplevel.py 2015-01-10 12:13:26 +01:00
br0ns ba477dabbc Merge pull request #388 from Gallopsled/issue-387
Ensure arguments go through context transform
2015-01-10 12:12:59 +01:00
Zach Riggle fe034dc67a Ensure arguments go through context transform 2015-01-09 20:12:07 -08:00
Zach Riggle 7d964f86b6 Merge pull request #385 from Gallopsled/typo
fixed typo: "updatez" -> "update"
2015-01-08 12:12:50 -08:00
Jonas Rudloff f011b1789f fixed typo: "updatez" -> "update" 2015-01-08 20:41:06 +01:00
Jonas Rudloff 90da45d8d5 Merge pull request #383 from Gallopsled/log-rootlogger-level
pwnlib root logger now reports parents level if more verbose
2015-01-08 19:36:10 +01:00
Jonas Rudloff baaabd12ca Merge pull request #375 from Gallopsled/stderr-debug-process
Enable logging process stderr directly to log.debug.  This is useful for...
2015-01-08 19:34:00 +01:00
Jonas Rudloff ff2e8f0e8a Merge pull request #384 from Gallopsled/log-docstrings
updated docs for `pwnlib.log`
2015-01-08 19:33:03 +01:00
Jonas Rudloff c6c853dd3c Merge pull request #382 from Gallopsled/pwn-logfile
added command line option "LOG_FILE"
2015-01-08 19:32:18 +01:00
Morten Brøns-Pedersen 661d820b5f updated docs for pwnlib.log 2015-01-08 17:17:26 +01:00
Morten Brøns-Pedersen 0d4ff3b0b9 pwnlib root logger now reports parents level if more verbose 2015-01-08 14:56:30 +01:00
Morten Brøns-Pedersen 55b879c6d4 have command line option "LOG_LEVEL" install a handler for *all* loggers 2015-01-08 14:53:35 +01:00
Morten Brøns-Pedersen 497d766ff0 added command line option "LOG_FILE" 2015-01-08 13:07:43 +01:00
Mathias Svensson 4d9da37586 Merge pull request #381 from Gallopsled/hexdump-remove-dead-code
removed `pwnlib.util.fiddling.sequential_lines` as it is no longer used
2015-01-08 12:01:57 +01:00
Morten Brøns-Pedersen a01dc91ec1 removed pwnlib.util.fiddling.sequential_lines as it is no longer used 2015-01-08 11:44:27 +01:00
Zach Riggle f16ad780a3 Merge pull request #376 from Gallopsled/assembler-list-str
Fix assembler returned when not in special-case architectures (e.g. cris)
2015-01-07 23:15:54 -08:00
Zach Riggle 45ba7865d4 Merge pull request #377 from Gallopsled/hexdump-faster
Hexdump faster
2015-01-07 23:15:38 -08:00
Zach Riggle 8a25962917 Merge pull request #378 from Gallopsled/flat-hexdump-bytearray
Enable flat() for bytearray().  Pass argument given to hexdump() to flat() first.
2015-01-07 23:15:20 -08:00
Zach Riggle 9b4531a15e Enable flat() for bytearray(). Pass argument given to hexdump() to flat() first. 2015-01-07 21:55:51 -08:00
Zach Riggle ee4e8104a2 Disable detection of sequential de bruijn lines in hexdump until a faster alternative is found 2015-01-07 19:56:49 -08:00
Zach Riggle ecb6717d6d Fix assembler returned when not in special-case architectures (e.g. cris) 2015-01-07 19:53:45 -08:00
Zach Riggle fec0fdc9e1 Enable logging process stderr directly to log.debug. This is useful for e.g. strace or ltrace.
At some point in the future for the pwntools-write-ups, this should be very useful to assist debugging exploits.
2015-01-07 17:50:02 -08:00
br0ns 5cf13cba4e Merge pull request #374 from Gallopsled/binutils-old-version
Check the installed binutils version so that users are aware of old versions
2015-01-08 00:20:19 +01:00
Zach Riggle 2a5e19e71b Check the installed binutils version so that users are aware of old versions 2015-01-07 13:30:53 -08:00
Zach Riggle c0b714f965 Add Twitter link, fix style to be consistent
Fixes #373
2015-01-07 13:20:09 -08:00
Zach Riggle 0ffcee5667 Merge pull request #365 from Gallopsled/logging-cleanup
Attempt at improving logging
2015-01-07 11:22:27 -08:00
Zach Riggle ec262b2d70 Merge pull request #339 from Gallopsled/travis-editable-install
Have travis do an editable installation.  This is how we actually use it...
2015-01-06 17:23:55 -08:00
Zach Riggle 2b44d375f7 Merge pull request #372 from Gallopsled/readline-float-default
readline now lets the prompt+input float by default.  replacements for `raw_input` and `input` are installed.
2015-01-06 17:23:07 -08:00
Morten Brøns-Pedersen a072a4be40 readline now lets the prompt+input float by default. replacements for raw_input and input are installed. 2015-01-07 01:06:22 +01:00
Zach Riggle f3ab8b4edd Merge pull request #371 from Gallopsled/readline-eof
`term.readline` now correctly handles EOF on `sys.stdin`, and ^j is interpreted as <enter> (^m)
2015-01-06 15:47:23 -08:00
Morten Brøns-Pedersen a58815df42 letting term.term take over sys.stderr apparently breaks the doctests, so have Travis set env var PWNLIB_NOTERM 2015-01-06 21:00:36 +01:00
Morten Brøns-Pedersen 3e20b93378 term.readline now correctly handles EOF on sys.stdin, and ^j is interpreted as <enter> (^m)
This is useful if a file is redirected to stdin.
2015-01-06 19:55:07 +01:00
Morten Brøns-Pedersen ef5cfeb6c4 changed sys.stdout to sys.stderr a number of places 2015-01-06 19:40:59 +01:00
br0ns 2411161ed5 Merge pull request #367 from Gallopsled/tube-aliases
Add aliases for all tube methods for read*=recv* and write*=send*
2015-01-06 18:38:34 +01:00
Morten Brøns-Pedersen 97f04e4eb7 removed read_thread (alias for recv_thread) as it is not part of the API 2015-01-06 18:30:17 +01:00
Morten Brøns-Pedersen d72a83355e redirect logging output to sys.stdout so we can catch it in doctests 2015-01-06 12:45:57 +01:00
Morten Brøns-Pedersen c73b731c32 delegated a few more calls to the underlying logger 2015-01-06 12:45:57 +01:00
Morten Brøns-Pedersen 3705db475e fixed issue with multiple values for "level" keyword 2015-01-06 12:45:57 +01:00
Morten Brøns-Pedersen 3dee2bbe41 mega commit -- attempt at improving logging 2015-01-06 12:45:57 +01:00
br0ns d573f70576 Merge pull request #368 from Gallopsled/tubes-docs
Update documentation for tubes, and improve the layout.
2015-01-06 11:06:09 +01:00
Jonas Rudloff c4b28836b5 Merge pull request #364 from Gallopsled/issue-363
Change Args to Arguments
2015-01-06 11:00:25 +01:00
Zach Riggle d00a51ad47 Move sock above remote/listen 2015-01-05 23:43:10 -08:00
Zach Riggle d75910c817 Update documentation for tubes, and improve the layout.
Also, add the serial tube to documentation.
2015-01-05 23:36:16 -08:00
Zach Riggle 0ee0cd7ac0 Add aliases for all tube methods for read*=recv* and write*=send* 2015-01-05 23:34:13 -08:00
Zach Riggle 404f0958d0 Change Args to Arguments 2015-01-05 15:36:47 -08:00
Zach Riggle b2d2c64da3 Add expected build time
Tested on a Macbook Pro by building *all* of the architectures.  I presume desktops would be faster.
2015-01-05 15:30:41 -08:00
Zach Riggle a334bdf343 Merge pull request #358 from Gallopsled/update-stuff-for-2.2.0
Update stuff after the 2.2.0 release
2015-01-05 11:41:45 -05:00
Mathias Svensson 899a3b4410 and version.py 2015-01-05 17:34:42 +01:00
Mathias Svensson 30df1e638a Update stuff for 2.2.0 release 2015-01-05 17:32:38 +01:00
Kristoffer Søholm 3888052ba5 Merge pull request #354 from Gallopsled/log-remove-ansilen
remove `pwnlib.log.ansilen` as it is no longer used
2015-01-05 16:10:00 +01:00
Kristoffer Søholm dde3a2e415 Merge pull request #355 from Gallopsled/setup.py-openbsd
Ugly hack to be able to install on OpenBSD
2015-01-05 16:02:07 +01:00
Mathias Svensson 273ee96fc8 Ugly hack to be able to install on OpenBSD 2015-01-05 15:33:10 +01:00
Morten Brøns-Pedersen 5f28e1461d remove pwnlib.log.ansilen as it is no longer used 2015-01-05 13:58:54 +01:00
Kristoffer Søholm 8a4ff79e4d Merge pull request #345 from Gallopsled/https-links
Use https instead of http wherever possible.
2015-01-05 12:42:26 +01:00
Jonas Rudloff 3062c456f8 Merge remote-tracking branch 'origin/master' into syscall-7arg
Conflicts:
	pwnlib/shellcraft/templates/i386/linux/syscall.asm
2015-01-05 12:41:02 +01:00
Mathias Svensson 8662141d45 Merge pull request #349 from Gallopsled/binutils-osx-remove
Remove all special handling for OSX binutils, since it is broken
2015-01-05 12:31:37 +01:00
Mathias Svensson d8cf68f563 Merge pull request #352 from Gallopsled/update-gitignore
Added robots.txt to gitignore
2015-01-05 12:31:10 +01:00
Jonas Rudloff 6be81d0b7e fixes #351 syscall can now accept 7 arguments 2015-01-05 12:25:44 +01:00
Kristoffer Søholm 6f0c3ccbb7 Added robots.txt to gitignore 2015-01-05 12:25:01 +01:00
Zach Riggle 24f25361c7 Remove all special handling for OSX binutils, since it is broken. Fixes #347
Conflicts:
	pwnlib/asm.py
2015-01-04 21:32:38 -05:00
Mathias Svensson faab1eb299 Use https instead of http wherever possible.
Note that this means that I changed a few of the links from
http://docs.pwntools.org to https://pwntools.readthedocs.org as we do
not currently have https on pwntools.com
2015-01-05 01:11:02 +01:00
Zach Riggle 6225901ba8 Merge pull request #343 from Gallopsled/iss-342
Throw an AttributeError on pwnlib.term.text when an unknown attribute is requested
2015-01-04 18:38:31 -05:00
Mathias Svensson 546fcf8ca7 Merge pull request #341 from Gallopsled/no-exe
Remove the executable bit from things that aren't scripts
2015-01-05 00:22:16 +01:00
Mathias Svensson 91288759c4 Fixed #342 2015-01-05 00:21:18 +01:00
Zach Riggle ff2b4463af Merge pull request #333 from Gallopsled/mega-commit-fixup
Replace instances of mov and int 0x80 with the ${mov} and ${syscall} templates
2015-01-04 18:18:49 -05:00
Zach Riggle ca4b7263f8 Remove the executable bit from things that aren't scripts 2015-01-04 15:05:56 -08:00
Robert Larsen c6ff8417e5 Merge pull request #331 from Gallopsled/amd64-update
Optimized mov, pushstr and syscall for amd64 and updated sh to use them
2015-01-05 00:02:54 +01:00
IdolfHatler facb9ca3a0 Merge pull request #313 from Gallopsled/shellcraft-push
Add ${push} for i386 and amd64 that just uses the pushstr code
2015-01-04 23:40:39 +01:00
Mathias Svensson 3fafbab48f And a doctest 2015-01-04 23:32:10 +01:00
Mathias Svensson 685aaa0458 I forgot a few things in the mega commit. Here they are 2015-01-04 23:29:58 +01:00
IdolfHatler 870e8c1878 Merge pull request #340 from RobertLarsen/thumb-echo
Added pushstr shellcode for thumb.
2015-01-04 23:28:12 +01:00
Mathias Svensson 30d85f07f4 I swear it worked in my machine before, but then somebody went ahead and merged my other PR without me noticing 2015-01-04 23:25:03 +01:00
Mathias Svensson b5a68b6f0b A bazillion doctests 2015-01-04 23:18:41 +01:00
Mathias Svensson a69b2229cb Optimized mov, pushstr and syscall for amd64 and updated sh to use them 2015-01-04 23:18:41 +01:00
Robert Larsen ef0c2173fa Added pushstr shellcode for thumb. 2015-01-04 22:49:58 +01:00
Jonas Rudloff f4d2be9c88 Merge pull request #337 from Gallopsled/shellcraft-newline-outside
Shellcraft functions will now have a single trailing newline
2015-01-04 19:58:46 +01:00
Zach Riggle ad513db436 Have travis do an editable installation. This is how we actually use it, so this is what should work. 2015-01-04 13:16:42 -05:00
Mathias Svensson 8bb6595d38 Made the shellcode formatting a little nicer 2015-01-04 19:16:22 +01:00
Zach Riggle e796338d63 Merge pull request #334 from Gallopsled/use-specialized-first
Try the local assembler *last* instead of *first*.  Force custom-built assemblers to contain the substring 'linux'
2015-01-04 13:05:29 -05:00
Mathias Svensson c9ad57e159 Fixed a doctest 2015-01-04 19:05:06 +01:00
IdolfHatler 22a1f9760f Merge pull request #335 from Gallopsled/issue-263
Fix stackhunter and pushstr
2015-01-04 19:02:32 +01:00
Mathias Svensson 521e675ea9 Removed an unused argument, made the sign/endianness explicit for the pack 2015-01-04 18:59:28 +01:00
Zach Riggle 5da416a179 Merge pull request #329 from Gallopsled/log-geteffectivelevel
Fixed the behavior of `log.Logger.getEffectiveLevel`
2015-01-04 12:58:27 -05:00
Zach Riggle 79129c1d52 Add doctests 2015-01-04 12:44:03 -05:00
Zach Riggle 6752558254 Fix stackhunter and pushstr 2015-01-04 12:44:03 -05:00
IdolfHatler 2ba70b9433 Merge pull request #322 from Gallopsled/shellcraft-tests
Shellcraft tests
2015-01-04 18:40:59 +01:00
Mathias Svensson ccf26c19e2 Only try linux assemblers 2015-01-04 18:40:08 +01:00
Mathias Svensson 86b930bfb8 Shellcraft functions will now have a single trailing newline to their bodies, but only when called from outside shellcraft 2015-01-04 18:38:22 +01:00
Zach Riggle d15ef3e7a7 Merge pull request #332 from Gallopsled/remove-workaround
Removed the no-longer-needed workaround for #317
2015-01-04 12:26:24 -05:00
Zach Riggle 8b1d59bf0f Example 2015-01-04 12:23:43 -05:00
Mathias Svensson 5c89d6d116 We should try to use the non-local assembler before attempting to use the local assembler 2015-01-04 17:26:17 +01:00
Jonas Rudloff 15a5472b0e Merge pull request #327 from Gallopsled/correct-syscall-shellcode
Stopped using amd64.syscall and i386.syscall, as they will not work without a set context
2015-01-04 17:21:12 +01:00
Zach Riggle c71978e4c1 Restrict size of values pushed 2015-01-04 11:17:14 -05:00
Zach Riggle 71e2582949 Enable fall back to the literal entered by the user to support pushing registers 2015-01-04 11:16:28 -05:00
Zach Riggle f45dd08413 Add ${push} for i386 and amd64 that just uses the pushstr code 2015-01-04 11:16:28 -05:00
IdolfHatler 9d988bbda3 Merge pull request #312 from Gallopsled/shellcode
Made stager shellcode more readable + 21 /bin/sh shellcode(down from 25 bytes)
2015-01-04 17:11:49 +01:00
Jonas Rudloff 9d41fff8f2 make stager shellcode more readable 2015-01-04 17:00:28 +01:00
Mathias Svensson b8df835ef5 Removed the no-longer-needed workaround for #317 2015-01-04 16:14:46 +01:00
Jonas Rudloff 770e9dcc5d Merge pull request #326 from Gallopsled/sh-21-bytes
Made i386.linux.sh be 22 bytes again while keeping readability up
2015-01-04 14:28:16 +01:00
Mathias Svensson f25586d858 Fixed the docs 2015-01-04 14:22:20 +01:00
Mathias Svensson 2f22fc47af Compromise between readability and size of shellcode 2015-01-04 14:13:21 +01:00
Morten Brøns-Pedersen feb2dd3985 Changed the behavior of log.Logger.getEffectiveLevel
Before `log.Logger.getEffectiveLevel` would return the log level of the current context or the parent logger depending on which was more verbose.  This lead to some surprising behavior.  Example:
```
from pwn import *
context(log_level = 'DEBUG')

log.setLevel(logging.WARNING)
log.debug('debug')
log.info('info')
log.warning('warning')
```

We would expect to see only a warning, but since `context.log_level` is a more verbose level we will see all three messages.

This commit changes `log.Logger.getEffectiveLevel` to work exactly as `logging.Logger.getEffectiveLevel` except if the current logger is named 'pwnlib', in which case the log level of the current context is returned.
2015-01-04 13:28:03 +01:00
Kristoffer Søholm 8a8c7454ad Merge pull request #328 from Gallopsled/tubes-listen-close-bugfix
Check that a connection was actually established before calling `close` in `pwnlib.tubes.listen`.
2015-01-04 13:01:24 +01:00
Morten Brøns-Pedersen 13fa7855d6 check that a connection was actually established before calling close 2015-01-04 12:45:15 +01:00
Mathias Svensson 1fe4217e2a Updated a docstring 2015-01-04 11:41:59 +01:00
Mathias Svensson 3b872e9b33 Optimized the mov, pushstr and syscall shellcodes for less whitespace in the output 2015-01-04 11:41:49 +01:00
Mathias Svensson 66232941b0 Stopped using amd64.syscall and i386.syscall, as they will not work without a set context 2015-01-04 11:28:22 +01:00
Mathias Svensson 8d07ba6dc6 Made i386.linux.sh be 21 bytes again while keeping readability up 2015-01-04 11:26:41 +01:00
Zach Riggle b4ceaaeea4 Merge pull request #325 from Gallopsled/ui-bugfix
bugfix: changed `log.output` to `term.output` in `ui.options` and `ui.more` as `log.output` no longer exists
2015-01-03 23:22:57 -05:00
Morten Brøns-Pedersen 8b758cd43d bugfix: changed log.output to term.output in ui.options and ui.more as log.output no longer exists 2015-01-04 00:12:15 +01:00
Zach Riggle f465f11072 Merge pull request #318 from Gallopsled/shellcraft-docs
Include documentation for alternate architectures
2015-01-03 18:09:35 -05:00
br0ns 9297b23f41 Merge pull request #324 from Gallopsled/iss-307
Fixed #307
2015-01-04 00:05:57 +01:00
br0ns 9523cbccb9 Merge pull request #310 from Gallopsled/ssh-context-manager
Add a context manager, and put all of the doctests inside of them.  This...
2015-01-03 23:57:11 +01:00
Mathias Svensson 1ce101eb7c Fixed #307 2015-01-03 23:40:32 +01:00
Zach Riggle 90732d681f Merge pull request #302 from Gallopsled/asm-mega-rewrite
Enhance shellcraft by adding sys all templates and using {mov} to handle user input
2015-01-03 16:14:00 -05:00
Zach Riggle 19ddc24a0f Merge pull request #323 from Gallopsled/iss-317
Enable direct importation of shell craft modules.  Fixed #317
2015-01-03 16:11:31 -05:00
Mathias Svensson 395ff15c4c Fixed #317 2015-01-03 11:35:12 +01:00
Kristoffer Søholm 74583f9ad9 Merge pull request #282 from Gallopsled/psutil-getpid-debian-systemd
Remove references to "init" as PID 1
2015-01-03 02:36:39 +01:00
Zach Riggle 783deba7f4 Merge pull request #321 from Gallopsled/asm-binutils-link
Update binutils documentation link
2015-01-02 20:02:21 -05:00
Zach Riggle 3b9fac6115 Update binutils documentation link 2015-01-02 20:00:18 -05:00
Zach Riggle 02a7fb27fc Include documentation for alternate architectures 2015-01-02 19:34:27 -05:00
IdolfHatler 72539f7f64 Merge pull request #308 from Gallopsled/hex-trailing-L
Replace builtin hex with one that doesn't do stupid things
2015-01-03 00:53:03 +01:00
Zach Riggle 54a2c7ddaf Merge pull request #315 from Gallopsled/ftp-220-failure
Ignore what comes after 220 so we dont fail
2015-01-02 18:18:36 -05:00
Zach Riggle 0bdbc3ff0b Ignore what comes after 220 so we dont fail 2015-01-02 18:02:33 -05:00
IdolfHatler 0119dd2b64 Merge pull request #309 from Gallopsled/shellcraft-ret-value
Add return values for all RET shellcrafts
2015-01-02 22:26:46 +01:00
Zach Riggle d949c8e8a0 Add a context manager, and put all of the doctests inside of them. This should make the failures less verbose. 2015-01-02 15:51:01 -05:00
Zach Riggle 6a0262dd9f Replace builtin hex with one that doesn't do stupid things 2015-01-02 14:57:52 -05:00
Zach Riggle 29590a38db Add return values for all RET shellcrafts 2015-01-02 14:41:19 -05:00
Zach Riggle 362b16ba8e Merge pull request #306 from Gallopsled/import-cleanup
Another import cleanup
2015-01-02 14:12:49 -05:00
Mathias Svensson 7d97c1c82a Another import cleanup 2015-01-02 19:52:02 +01:00
Zach Riggle 8a2cd3bb0c Merge pull request #305 from Gallopsled/tube-recvn-recvrepeat-timeout
Fix timeout behavior for recvn and recvrepeat.  Fixes #303.
2015-01-02 13:35:56 -05:00
Zach Riggle 24942e01e7 Fix timeout behavior for recvn and recvrepeat 2015-01-02 13:32:12 -05:00
Zach Riggle d274105601 Merge branch 'countdown-active' 2015-01-02 13:04:59 -05:00
Zach Riggle c23d42e939 Fix countdown_active 2015-01-02 13:04:20 -05:00
Zach Riggle 32ac3e6e83 Merge pull request #268 from Gallopsled/tube-recvrepeat-timeout
The default timeout for `pwnlib.tubes.tube.recvrepeat()` should be short.  Set to 0.05s in this PR.
2015-01-02 12:45:02 -05:00
Mathias Svensson 5267f4cfe9 Yes, Travis did know. But only because doctests. 2015-01-02 17:07:50 +01:00
Mathias Svensson 538b688c05 Mega commit. I have no idea if this works and neither does Travis. 2015-01-02 14:53:24 +01:00
Robert Larsen bdb1201d1c Merge pull request #298 from Gallopsled/i386-echo
Added echo shellcode for i386
2015-01-02 14:10:38 +01:00
Robert Larsen 238364894e Merge pull request #297 from Gallopsled/pushstr-fix
There is no instruction called pushb
2015-01-02 14:08:30 +01:00
Robert Larsen 003b9e931c Merge pull request #296 from Gallopsled/update-links
Update module links in globals.rst
2015-01-02 14:02:05 +01:00
Robert Larsen 6f753740c7 Merge pull request #295 from Gallopsled/update-contributing
Updated CONTRIBUTING.md a bit
2015-01-02 14:01:20 +01:00
Robert Larsen eaed986668 Merge pull request #301 from Gallopsled/amd64-echo
Added amd64.linux.echo shellcode
2015-01-02 13:56:42 +01:00
Robert Larsen 9a59906b52 Merge pull request #299 from Gallopsled/amd64-pushstr
amd64.pushstr shellcode
2015-01-02 13:46:49 +01:00
Robert Larsen 4ff61fb9b9 Merge pull request #300 from Gallopsled/mov-fix
Fixed a bug in amd64.mov.
2015-01-02 13:32:53 +01:00
Mathias Svensson 742ae3dcd6 Added amd64.linux.echo shellcode 2015-01-02 13:12:22 +01:00
Mathias Svensson b89e932053 Fixed a bug in amd64.mov. 2015-01-02 13:08:30 +01:00
Mathias Svensson 869050bfd9 Added echo shellcode for i386 2015-01-02 13:07:06 +01:00
Mathias Svensson e43bf9ed74 amd64.pushstr shellcode 2015-01-02 13:04:44 +01:00
Mathias Svensson f54621db55 Updated the pushstr a bit more 2015-01-02 12:36:20 +01:00
Mathias Svensson 53654f66d4 There is no instruction called pushb 2015-01-02 11:50:55 +01:00
Mathias Svensson f6eff226c3 Update module links in globals.rst 2015-01-02 11:46:13 +01:00
Mathias Svensson e8e4ce0476 Updated CONTRIBUTING.md a bit 2015-01-02 11:35:47 +01:00
Robert Larsen d4a430596e Merge pull request #294 from Gallopsled/remove-binutils
Removed pre-compiled binutils as they are not used anymore
2015-01-02 11:20:31 +01:00
Mathias Svensson 1dfeb59acd Removed pre-compiled binutils as they are not used anymore 2015-01-02 11:17:50 +01:00
IdolfHatler e3b269ee5c Merge pull request #290 from Gallopsled/new-readme
Update README to point to new installation and contribution instructions
2015-01-02 11:11:42 +01:00
IdolfHatler 4d686214b8 Merge pull request #289 from Gallopsled/contributing
Add contributing.md
2015-01-02 11:11:33 +01:00
IdolfHatler 21bd92fa06 Merge pull request #288 from Gallopsled/installation-documentation
Add better documentation for installation.
2015-01-02 11:11:21 +01:00
IdolfHatler bd73e5032a Merge pull request #287 from Gallopsled/i386_to_amd64
Fix i386_to_amd64 and pushstr against GNU GAS syntax
2015-01-02 10:59:07 +01:00
Zach Riggle e5ee13c7ce Merge pull request #293 from Gallopsled/keepends
Change keep to keepends
2015-01-02 03:12:29 -05:00
Zach Riggle 235412903a Merge pull request #292 from Gallopsled/timeout-object-name
Give default timeout a name so that it looks better in the HTML documentation vs <object 0xFooBar>
2015-01-02 02:50:32 -05:00
Zach Riggle cfc8c04f5d Change keep to keepends 2015-01-02 02:49:08 -05:00
Zach Riggle b58d3f0f89 Give default timeout a name so that it looks better in the HTML documentation (vs. <object 0xf00bar>) 2015-01-02 02:36:48 -05:00
Zach Riggle ed308c5842 Merge pull request #291 from Gallopsled/tube-newline
Use user-provided newline
2015-01-02 02:01:35 -05:00
Zach Riggle 7c4f13e504 Use user-provided newline 2015-01-02 01:59:04 -05:00
Zach Riggle dbf5145bbf Remove references to "init" as PID 1 which is not accurate for Debian after switching to systemd.
Fixes #250
2015-01-01 23:55:53 -05:00
Zach Riggle 40e09baa71 Update README to point to new installation and contribution instructions 2015-01-01 23:39:19 -05:00
Zach Riggle 6eaed4082f Add contributing.md 2015-01-01 23:20:29 -05:00
Zach Riggle 8c29c2d41e Update doctests 2015-01-01 23:06:16 -05:00
Zach Riggle 84aae27d22 Add better documentation for installation.
Specifically, use "pip install -e" isntead of environment paths.
Give instructions for installing binutils.
2015-01-01 23:04:48 -05:00
Zach Riggle 33b70138db Fix i386_to_amd64 and pushstr against GNU GAS syntax 2015-01-01 22:13:42 -05:00
IdolfHatler 0e00dfa5f9 Merge pull request #283 from Gallopsled/issue-171
Fix weird interaction between tube, sock, and ssh_channel caused by a ra...
2015-01-02 00:20:06 +01:00
Zach Riggle 3c528bce11 Fix weird interaction between tube, sock, and ssh_channel caused by a race condition on whether the return value would propagate quickly when calling .recvall().
Fixes #171
2015-01-01 17:58:47 -05:00
Zach Riggle 38ab3d59e3 Change behavior of .clean to return the data received 2015-01-01 16:20:01 -05:00
Zach Riggle 67d27c33fc Merge pull request #281 from Gallopsled/safeeval-in-toplevel-documentation
Added documentation for #278
2015-01-01 16:09:20 -05:00
Zach Riggle 4209d90daa Merge pull request #261 from Gallopsled/import-cleanup
Big import cleanup. Also removes context.context.thread
2015-01-01 15:57:29 -05:00
IdolfHatler 90afaa5817 Merge pull request #249 from zachriggle/ssh-travis
SSH Tests on Travis
2015-01-01 21:33:52 +01:00
Mathias Svensson 82db1ad0ab Updated some documentation for pwnlib.context.Thread and removed the lower-case alias for it 2015-01-01 21:27:29 +01:00
Zach Riggle 25ece1dcfe Move Thread underneath the ContextType class so that pwnlib.context.Thread == pwnlib.context.context.Thread 2015-01-01 21:24:18 +01:00
Mathias Svensson a69fb15fd7 Removed a cycle, that was unnecessary anyways 2015-01-01 21:23:54 +01:00
Mathias Svensson 00d919966b Re-added a removed re-export, because I thought it was a normal import 2015-01-01 21:23:54 +01:00
Mathias Svensson da40529b7e Added the right Thread top toplevel 2015-01-01 21:23:54 +01:00
Mathias Svensson ea058d20ae Make it pass tests (maybe?) 2015-01-01 21:23:54 +01:00
Mathias Svensson 0f1a445a89 Big import cleanup. Also removes context.context.thread 2015-01-01 21:23:54 +01:00
Mathias Svensson e8b92c6bed Added documentation for #278 2015-01-01 21:14:24 +01:00
Zach Riggle 566448e34c Split SSH setup into its own file 2015-01-01 15:13:51 -05:00
Zach Riggle bb3d98f95b Enable testing SSH on Travis CI 2015-01-01 15:10:12 -05:00
IdolfHatler fbd7bb69d9 Merge pull request #280 from Gallopsled/timeout-None-forever
Make ssh object inherit from Timeout so that it can use Timeout.default ...
2015-01-01 21:00:34 +01:00
IdolfHatler 93396dd3da Merge pull request #275 from Gallopsled/asm-osx-sane
Make pwnlib.asm.asm more robust
2015-01-01 20:57:16 +01:00
IdolfHatler 8b8cae8b5c Merge pull request #276 from Gallopsled/travis-install-script
Split Travis installation steps into its own script
2015-01-01 20:55:09 +01:00
Zach Riggle 66aeaec73c Make ssh object inherit from Timeout so that it can use Timeout.default and the related semantics 2015-01-01 14:55:01 -05:00
Zach Riggle e79dac429d Merge pull request #279 from Gallopsled/timeout-None-forever
Update Timeout semantics in a few more places
2015-01-01 14:39:54 -05:00
Zach Riggle 9b66afbb41 Update semantics in a few more places 2015-01-01 14:36:55 -05:00
Zach Riggle 27813a86e8 Merge pull request #255 from zachriggle/timeout-None-forever
Update Timeout semantics
2015-01-01 14:24:33 -05:00
Zach Riggle cce361da90 Merge pull request #278 from Gallopsled/safeeval-in-toplevel
Added safeeval toplevel
2015-01-01 14:19:02 -05:00
Zach Riggle feea70aba3 Clean up a bit more 2015-01-01 14:17:03 -05:00
Zach Riggle 02ffff6f76 Fix regression from 023b7ba 2015-01-01 14:15:38 -05:00
Morten Brøns-Pedersen 023b7baf47 cleaned code up a bit 2015-01-01 14:01:47 -05:00
Morten Brøns-Pedersen 1a8090d29e more slight performance improvements in pwnlib.tubes.tube 2015-01-01 14:01:47 -05:00
Morten Brøns-Pedersen 3aac624b56 slight performance improvement in pwnlib.tubes.tube.recvuntil() 2015-01-01 14:01:47 -05:00
Zach Riggle 5b45bd957b Fix regressions and get performance back up 2015-01-01 14:01:47 -05:00
Zach Riggle cf9c5d6ee9 Change Timeout module path 2015-01-01 14:01:47 -05:00
Zach Riggle 199c7869ac Update Timeout semantics to use None to imply "never", and to use a sentinel object for default timeouts 2015-01-01 14:01:47 -05:00
Zach Riggle 84e4444923 Merge pull request #271 from Gallopsled/readline-utf8
Make `pwnlib.term.readline()` return a utf8 encoded `str` instead of a `unicode`.  This is the behavoir of the built-in readline, so we should mimic that.
2015-01-01 13:24:16 -05:00
Mathias Svensson 208ef471c6 Added safeeval toplevel 2015-01-01 17:07:21 +01:00
Zach Riggle 063a1a465e Binutils for alternate architectures doesn't add the LC_SEGMENT crap. The -j flag takes wildcards, so use it. Verified with stock binutils and binutils-sparc built via homebrew 2014-12-30 15:39:36 -05:00
Zach Riggle 214862e4f7 Split Travis installation steps into its own script so we can check the OS 2014-12-30 15:32:16 -05:00
Zach Riggle a10dc9d920 Merge pull request #254 from zachriggle/autoprogram
Enable autogeneration of command-line tool documentation
2014-12-30 13:09:58 -05:00
Zach Riggle 35ef5589b6 Remove tabs 2014-12-30 11:10:01 -05:00
Zach Riggle b596f0d6b6 Merge pull request #264 from Gallopsled/tube-log-debug
bugfix: use correct log level in `pwnlib.tubes.tube`
2014-12-30 10:48:30 -05:00
Zach Riggle 1fd84d5389 Merge pull request #267 from Gallopsled/tube-bugfix-recvline-contains
bugfix: `pwnlib.tubes.tube.recvline_contains` now works when a single item is given
2014-12-30 10:47:21 -05:00
Zach Riggle 34e6bab46a Merge pull request #269 from Gallopsled/tube-recvall-logging
Logging in `pwnlib.tubes.tube.recvall()` reported a wrong size upon completion. Fixed that.
2014-12-30 10:29:15 -05:00
Zach Riggle d33499f660 Merge pull request #270 from Gallopsled/log-waitfor-bugfix
Removed duplicate status throttling used by `pwnlib.log.waitfor`.
2014-12-30 10:28:27 -05:00
Morten Brøns-Pedersen b348c1821d make pwnlib.term.readline() return a utf8 encoded str instead of a unicode 2014-12-30 14:49:27 +01:00
Morten Brøns-Pedersen 9caf00b8e3 removed duplicate status throttling used by pwnlib.log.waitfor 2014-12-30 13:25:41 +01:00
Morten Brøns-Pedersen 9ccd0f4c12 bugfix: fixed logging in pwnlib.tubes.tube.recvall() 2014-12-30 13:20:39 +01:00
Morten Brøns-Pedersen 275ba56338 added doctests to pwnlib.tubes.tube.recvline_contains() 2014-12-30 12:58:49 +01:00
Morten Brøns-Pedersen b3cd49de98 bugfix: pwnlib.tubes.tube.recvline_contains now works when a single item is given 2014-12-27 22:06:19 +01:00
Zach Riggle 95b7aed1e2 Merge pull request #266 from Gallopsled/log-show-spinner-immediately
bugfix: show spinners immediately
2014-12-27 15:08:26 -05:00
Zach Riggle a4751a617c Merge pull request #265 from Gallopsled/tube-clean-and-log
better logging output in `pwnlib.tubes.tube.clean_and_log`
2014-12-27 15:07:35 -05:00
Morten Brøns-Pedersen 3bf3145b4c updated doctest 2014-12-27 20:57:10 +01:00
Morten Brøns-Pedersen 213936fead bugfix: show spinners immediately 2014-12-27 19:38:01 +01:00
Morten Brøns-Pedersen b235e4f42a better logging output in pwnlib.tubes.tube.clean_and_log 2014-12-27 19:13:53 +01:00
Kristoffer Søholm 2c92f24eb9 Merge pull request #262 from Gallopsled/stagershellcode
stager shellcode and findpeerstager shellcode
2014-12-27 19:10:42 +01:00
Jonas Rudloff 97097743b8 get stager shellcode to use i386.mov 2014-12-27 19:08:35 +01:00
Morten Brøns-Pedersen 8335f611be bugfix: use correct log level in pwnlib.tubes.tube 2014-12-27 19:06:32 +01:00
IdolfHatler a1d7152855 Merge pull request #259 from Gallopsled/log-waitfor-default-success
If not explicitly set, spinners are marked as succeeded unless an exception was raised in which case they are marked as failed.
2014-12-27 13:37:28 +01:00
IdolfHatler ababe3d3f2 Merge pull request #257 from Gallopsled/log-remove-done-functions
Gets rid of `pwnlib.log.done_*`, since we no longer have a spinner stack.  "Fixes" #229.
2014-12-27 13:36:45 +01:00
Morten Brøns-Pedersen 3c1b61eb4d if not explicitly set, spinners are marked as succeeded unless an exception was raised in which case they are marked as failed 2014-12-27 13:28:27 +01:00
Morten Brøns-Pedersen 56a8f1438b updated pwnlib.util.proc.wait_for_debugger() to not use pwnlib.log.done_success() 2014-12-27 13:02:56 +01:00
Morten Brøns-Pedersen a5062ed77f updated pwnlib.ui.pause() to not use pwnlib.log.done_success() 2014-12-27 13:00:44 +01:00
Morten Brøns-Pedersen fcbda7276e updated pwnlib/data/useragents/download-useragents.py to not use pwnlib.log.done_success() 2014-12-27 12:58:16 +01:00
Morten Brøns-Pedersen e00f417d19 removed pwnlib.log.done_* 2014-12-27 12:33:54 +01:00
Jonas Rudloff 59804af704 stager shellcode and findpeerstager shellcode 2014-12-27 12:17:36 +01:00
br0ns 30f2f9ef14 Merge pull request #256 from Gallopsled/text-when
removed `pwnlib.term.text.enabled` in favor of `pwnlib.term.text.when`
2014-12-27 12:12:21 +01:00
Morten Brøns-Pedersen 22b49e2f6a removed pwnlib.term.text.enabled in favor of pwnlib.term.text.when 2014-12-27 12:05:59 +01:00
Zach Riggle 637635e9f6 Restrict the scope of the modified context defaults so we don't break everything else 2014-12-26 17:39:40 -05:00
Zach Riggle a79663e59c Get rid of test text 2014-12-26 17:33:25 -05:00
Zach Riggle 8be05dd3eb Update requirements.txt 2014-12-26 17:29:58 -05:00
Zach Riggle b06998a740 Break commit into two parts for proper rename tracking 2014-12-26 17:29:58 -05:00
Zach Riggle 46db5ee48a Enable autogeneration of command-line tool documentation from the help output. In order to achieve this, we move from having a "bin" directory to using the "entry_points" mechanism. 2014-12-26 17:29:54 -05:00
Zach Riggle 25bef46da9 Merge pull request #243 from zachriggle/recvline-contains
Add a recvline_contains routine. Fixes #239.
2014-12-26 12:22:50 -05:00
Zach Riggle 8a72aba912 Merge pull request #248 from zachriggle/tube-recvuntil-str-find-bufsize-fastpath2
Improve tube performance. Fixes #238
2014-12-26 12:22:03 -05:00
Zach Riggle 943aad7a66 Merge pull request #253 from kristoff3r/amd64-mov-shellcode
Add mov shellcode for amd64
2014-12-26 12:20:28 -05:00
Zach Riggle 38af8aceb9 Finish docstring and add test 2014-12-25 15:30:22 -05:00
Kristoffer Søholm 9d94de9565 Merge pull request #247 from zachriggle/dynelf-nodecorator
Add DynELF example and documentation.  Remove requirement for MemLeak decorator.
2014-12-25 21:26:06 +01:00
Kristoffer Søholm a86a00ae9d Add mov shellcode for amd64 2014-12-25 21:11:28 +01:00
Zach Riggle de9dc3267a Merge pull request #252 from Gallopsled/feature-i386-mov-shellcode
Ported old mov shellcode for i386
2014-12-25 13:29:25 -05:00
Kristoffer Søholm 5ba1dcc0f1 Fixed details 2014-12-25 19:17:11 +01:00
Kristoffer Søholm f16966ab0b Ported old mov shellcode for i386 2014-12-25 19:04:47 +01:00
Morten Brøns-Pedersen 1c0d37597d tighter code in pwnlib.tubes.tube.recvuntil() 2014-12-25 16:06:10 +01:00
Zach Riggle aa1f3c1ad4 Fix regression which causes infinite loop 2014-12-24 23:27:47 -05:00
Zach Riggle e885635114 Fix doctest so it can be copy-pasted 2014-12-24 19:45:49 -05:00
Zach Riggle 358b5e1ff0 Fix syntax error and some of the tests 2014-12-24 19:07:28 -05:00
Zach Riggle 1255aa9c3a Remove double call to settimeout_raw. This is set via property update. See timeout_change. 2014-12-24 18:35:13 -05:00
Zach Riggle 2c1f357d39 Fastpath2. Minor optimizations 2014-12-24 18:30:51 -05:00
Zach Riggle cb9a39959c Add recvline_contains routine 2014-12-24 18:00:31 -05:00
Zach Riggle 56fd66f73b Fast paths for timeout 2014-12-24 11:53:18 -05:00
Zach Riggle 2a993650b2 Reduce buffer size to 4096 2014-12-24 11:46:39 -05:00
Zach Riggle 11f2671e33 Add DynELF example and documentation. Remove requirement for MemLeak decorator. 2014-12-24 09:24:44 -05:00
IdolfHatler e0563cbb70 Merge pull request #244 from zachriggle/recvall-recvrepeat-break-on-eoferror
Break on EOFError for recvrepeat and recvall
2014-12-23 17:23:22 +01:00
Zach Riggle acdc6bce86 Break on EOFError for recvrepeat 2014-12-23 11:06:35 -05:00
Zach Riggle 6747db60a1 Replace re.search with string.find 2014-12-23 11:03:55 -05:00
Zach Riggle 7e01b03090 Merge pull request #236 from RobertLarsen/master
Added two characters to the list of regex special chars.
2014-12-23 07:45:57 -05:00
Robert Larsen cfe29e7948 Added two characters to the list of regex special chars. 2014-12-23 13:23:29 +01:00
br0ns ea46132af6 Merge pull request #235 from Gallopsled/hexdump-nonprintable-chars
hexdump now shows non-printable chars as dots, and regards space as printable
2014-12-23 13:21:18 +01:00
Morten Brøns-Pedersen 54736623de hexdump now shows non-printable chars as dots, and regards space as printable 2014-12-23 14:06:37 +01:00
IdolfHatler 65037a6d00 Merge pull request #234 from Gallopsled/missing-docs-issue-215
Fixed #215
2014-12-23 12:39:34 +01:00
Morten Brøns-Pedersen 92b311d655 fixed broken doctest in pwnlib.util.web.wget 2014-12-23 13:01:02 +01:00
Morten Brøns-Pedersen abdf0100e4 added docstring to pwnlib.util.hashes 2014-12-23 13:00:22 +01:00
Morten Brøns-Pedersen 3cfca21ace updated docstring and fixed broken doctest 2014-12-23 12:59:47 +01:00
Morten Brøns-Pedersen d997a6922a added util/web.rst 2014-12-23 12:59:04 +01:00
Morten Brøns-Pedersen 6855077ebd added util/hashes.rst 2014-12-23 12:58:52 +01:00
Morten Brøns-Pedersen 7d590c974c added useragents.rst 2014-12-23 12:58:39 +01:00
br0ns 1f61ea8600 Merge pull request #208 from Gallopsled/log_error_exception
Implements the changes suggested in #207.
2014-12-23 11:25:26 +01:00
IdolfHatler 11f33fba1b Merge pull request #228 from Gallopsled/atexception
updated `atexception` to act like the the new `atexit`
2014-12-23 11:08:10 +01:00
IdolfHatler ab746c786d Merge pull request #227 from Gallopsled/atexit-issue-120-and-121
fixes #120 and #121
2014-12-23 10:48:41 +01:00
IdolfHatler 0c870a4e34 Merge pull request #232 from Gallopsled/readline
fixes #231
2014-12-23 10:46:10 +01:00
Morten Brøns-Pedersen 5b70db89b8 bugfix: declare suggest_handle as global 2014-12-23 03:24:05 +01:00
Morten Brøns-Pedersen f685b1af2d updated atexception to mimic the new atexit 2014-12-23 02:28:44 +01:00
Morten Brøns-Pedersen 6d58217ac9 removed unused import 2014-12-23 02:25:42 +01:00
IdolfHatler 0fa91a66fc Merge pull request #230 from Gallopsled/download-useragents
Updated the list of useragents
2014-12-23 02:17:15 +01:00
Morten Brøns-Pedersen 3d90e3012d updated the list of useragents 2014-12-23 02:56:36 +01:00
Morten Brøns-Pedersen bfb59a6e98 download-useragents.py now never removes a user agent from the list 2014-12-23 02:55:57 +01:00
Morten Brøns-Pedersen db4c824603 fixed docstring for atexit.register 2014-12-23 01:44:54 +01:00
Morten Brøns-Pedersen 08715e4eb3 fixes #120 and #121 2014-12-23 00:17:53 +01:00
br0ns 6c7136cd8d Merge pull request #219 from zachriggle/hexdump-colors
Remove check for sys.stdout.isatty()
2014-12-22 23:59:54 +01:00
IdolfHatler 882355383b Merge pull request #216 from zachriggle/issue-210
Default timeout, timeout magic string 'inf', OSX timeout max
2014-12-22 16:51:59 +01:00
Zach Riggle e70536e180 Merge pull request #218 from Gallopsled/iss217
Resolve SyntaxWarnings in pwnutil.util.web.  Fixes #217.
2014-12-22 10:39:34 -05:00
Zach Riggle 35d2a985c8 Remove check for sys.stdout.isatty() 2014-12-22 07:32:21 -08:00
Mathias Svensson b621a725e3 Fixed #217. 2014-12-22 14:52:52 +01:00
Mathias Svensson 2df67f9439 Fixed doctest mistake found in Travis 2014-12-22 11:31:52 +01:00
Mathias Svensson 276ebb27a7 Implements the changes discussed in #207 2014-12-22 11:22:16 +01:00
Zach Riggle dd530df04e Merge pull request #214 from Gallopsled/faster_import
Faster imports as per #198
2014-12-22 00:20:12 -05:00
Zach Riggle 993a3a5b5a Merge pull request #209 from Gallopsled/randoms-alphabet-fix
Implements the changes suggested in #202. Do not accept until a consensus is reached.
2014-12-22 00:15:11 -05:00
Zach Riggle 3fdc6bd146 Fix issue on OSX within the socket itself 2014-12-21 19:19:01 -08:00
Zach Riggle c1e31f7ab3 Set default timeout to infinite. Ensure that pwnlib.tubes.tube.timeout.Timeout.__init__ properly handles any magic values by passing them through context.timeout. 2014-12-21 19:13:01 -08:00
Mathias Svensson 3af8c6b81f Fixed bug found by Travis 2014-12-21 23:28:24 +01:00
Mathias Svensson 57ac2235a5 Faster imports as port #198 2014-12-21 23:24:25 +01:00
Robert Larsen 1fec4b9df7 Merge pull request #212 from Gallopsled/infloop_in_listen
Fixed the infinite loop from #137. The code still does not work, but now it does not work in a more reasonable way
2014-12-21 22:46:19 +01:00
Mathias Svensson 5d2cbdf5ea I really should learn to test my commits 2014-12-21 22:23:12 +01:00
Mathias Svensson 2270425d49 Fixed the infinite loop from #137. The code still does not work, but now it does not work in a more reasonable way 2014-12-21 22:19:30 +01:00
Robert Larsen 3b896435e0 Merge pull request #206 from Gallopsled/landscape-bugfixes
A few bugfixes found with landscape.io
2014-12-21 21:40:56 +01:00
Mathias Svensson ff926ca49f Implements the changes suggested in #202. 2014-12-21 21:33:27 +01:00
Robert Larsen 3025212421 Merge pull request #204 from Gallopsled/bug-iter-documentation
Fixed documentation. Should be safe to merge
2014-12-21 21:27:32 +01:00
Robert Larsen 77f231b91f Merge pull request #203 from Gallopsled/bug-randoms
random.sample does not use replacement. With a small alphabet this could throw an exception
2014-12-21 21:26:08 +01:00
Mathias Svensson 42215bea8c A few bugfixes found with landscape.io 2014-12-21 20:55:06 +01:00
Mathias Svensson 983a07c91d Fixed some documentation bugs in iters.py 2014-12-21 20:23:50 +01:00
Mathias Svensson ee187596bc random.sample does not use replacement. With a small alphabet this could throw an exception 2014-12-21 20:17:56 +01:00
Zach Riggle 4c1ab865f1 Merge pull request #201 from zachriggle/deferred-load-requests
Defer loading of requests module.  Fixes #198
2014-12-21 12:43:20 -06:00
Zach Riggle 9276c1fb1d Merge pull request #200 from zachriggle/hexdump-colors
Fixes #199
2014-12-21 12:41:26 -06:00
Zach Riggle 8f1583d588 Defer loading of requests module. Fixes #198 2014-12-21 12:40:09 -06:00
Zach Riggle 8ed28e6239 Fixes #199 2014-12-21 12:35:17 -06:00
Zach Riggle f1284bfc4d Update README.md 2014-12-18 15:27:47 -05:00
Zach Riggle ab7147c871 Update version.py 2014-12-18 15:22:51 -05:00
Mathias Svensson b13a4b9518 Merge branch 'mathiasbynens-add-socket-example' 2014-12-18 16:59:59 +01:00
Mathias Svensson 3c72aff21a Updated README.md 2014-12-18 16:59:48 +01:00
Mathias Bynens 69538c3f09 Add minimal example showing how to use remote 2014-12-18 15:28:14 +01:00
Mathias Svensson 7e5c9ce485 Hopefully make git language statistics more accurate 2014-12-18 12:30:47 +01:00
Mathias Svensson 4b286d1d44 Closes #195. Closes #190. Fixes a small bug with regards to the return value in ssh.upload_file. 2014-12-18 12:01:35 +01:00
Mathias Svensson dbac29eb73 Changed which in asm.py to which_binutils as per #190. Also made the tests work even if the binaries are not in /usr/bin 2014-12-18 10:55:57 +01:00
Morten Brøns-Pedersen 9c4cfc2d34 fixed #126 2014-12-17 13:07:12 +01:00
Mathias Svensson c2034afc3c Fixed a few small bugs found through landscape.io 2014-12-17 12:27:55 +01:00
Morten Brøns-Pedersen f7695695b2 fixed #193 2014-12-17 12:26:23 +01:00
Mathias Svensson b344f8f316 I should learn to spell 2014-12-17 11:59:15 +01:00
Mathias Svensson 0c48de7726 Fixed #185 and will hopefully get Travis to build again 2014-12-17 11:51:35 +01:00
Mathias Svensson cbd0323223 Implements the changes to proc.py mentioned in #181 2014-12-17 11:35:18 +01:00
Mathias Svensson 0ee3ce8eb1 Uses which instead of hardcoded paths in doctests. Fixes #182, #183, #184 2014-12-17 10:43:43 +01:00
Zach Riggle 57e5e81846 Merge pull request #188 from zachriggle/logging-errors-and-exceptions
Add log.exception to be able to print out an error message *with* an exception.
2014-12-16 20:42:48 -05:00
Zach Riggle ddbfe89d2f Add log.exception to be able to print out an error message *with* an exception.
Update log.error (and log.exception) to stop the active progress item.
2014-12-16 17:25:30 -08:00
Zach Riggle b84f563549 Merge pull request #187 from Gallopsled/asm-delete-tempdir
Actually call rmtree. Fixes #186
2014-12-16 20:18:39 -05:00
Zach Riggle 033f26c922 Do not delete files on exception 2014-12-16 17:10:14 -08:00
Zach Riggle c8874e080a Ignore docs output dir 2014-12-16 16:38:00 -08:00
Zach Riggle 27535ade83 Actually call rmtree. Fixes #186 2014-12-16 16:31:17 -08:00
Zach Riggle d3c863ca07 Set logger to pwnlib.exploit that is imported into the global namespace 2014-12-16 15:15:40 -08:00
Zach Riggle 6e6fe50b8f Default to /dev/null if stdin does not have a fileno (for example, a memory-only file buffer) 2014-12-16 15:08:21 -08:00
Zach Riggle 6d5ac6710f Make PWNLIB_NOTERM in the environment not ever even initialize curses 2014-12-16 15:06:01 -08:00
Zach Riggle c1d4312235 powerpc-linux-gnu 2014-12-16 12:39:30 -08:00
Zach Riggle 5bff52d9e2 Powerpc! 2014-12-16 12:08:38 -08:00
Zach Riggle 9f3ae14770 Move pwnlib.asm documentation to source docstring; rename _find to which; expose it via __all__ so that it gets picked up for doctests. Expressly import asm,disasm,cpp in toplevel so we don't import pwnlib.asm.which 2014-12-16 11:57:59 -08:00
Zach Riggle 7074b9a4da Update asm.py 2014-12-16 14:43:27 -05:00
Zach Riggle 556996e0ea Prefer exactly-named assembler first 2014-12-16 11:30:28 -08:00
Zach Riggle 481a699f10 Enable amd64-*-objdump so that it'll use the local copy when platform.machine() returns 'amd64' on not-Debian 2014-12-16 11:23:40 -08:00
Zach Riggle 36a9b4c93a Actually do the check 2014-12-16 11:13:58 -08:00
Zach Riggle 912baa28f5 Add warning message 2014-12-16 11:12:00 -08:00
Zach Riggle ad30c7dc7d Send platform.machine() through the context.arch setting for OpenBSD 2014-12-16 11:07:44 -08:00
Zach Riggle 15072ff66b Do it a few times so it gets cached 2014-12-16 10:05:04 -08:00
Zach Riggle df54013df3 I dont think Travis likes TERM_MODE 2014-12-15 21:01:38 -08:00
Zach Riggle 03d5d579f5 Merge pull request #166 from zachriggle/cyclic-hexdump-skip
Enable collapsing contiguous cyclic patterns
2014-12-16 09:45:51 -08:00
Zach Riggle d0e0291462 These tests are really for OSX, not for Linux 2014-12-15 20:56:32 -08:00
Zach Riggle 91a861773e Add "from pwn import *" install step to test load time 2014-12-15 20:40:39 -08:00
Zach Riggle 24c9207c3a Handle case where width is very low 2014-12-15 20:38:13 -08:00
Zach Riggle b54c64290d Enable collapsing contiguous cyclic patterns 2014-12-15 20:38:13 -08:00
Zach Riggle fe73751ec0 Better docs for pwnlib.log 2014-12-15 20:08:27 -08:00
Zach Riggle 7b919ea013 Move python-dev requirement up to prereqs 2014-12-15 19:04:23 -08:00
Zach Riggle bcd822763e Add installation docs; add global docs; enhance intro docs 2014-12-15 18:49:38 -08:00
Zach Riggle 185334c50d Add documentation for globals, context, pwnlib.context.Thread. Fix pwnlib.asm docs 2014-12-15 18:49:38 -08:00
Zach Riggle e1a161fb95 context.term_mode was not implemented due to cyclic dependencies 2014-12-15 18:49:38 -08:00
Zach Riggle d67dccf4ac typo [ci skip] 2014-12-15 16:09:12 -08:00
Zach Riggle 58b08d9544 Update README.md 2014-12-15 17:45:55 -05:00
Zach Riggle 7f2bd5556d Update README.md 2014-12-15 17:00:01 -05:00
Zach Riggle 6296670cbf Update README.md 2014-12-15 16:59:46 -05:00
Zach Riggle 2796a65d42 Fixes #180 2014-12-15 16:56:41 -05:00
Zach Riggle 8e9b8ef9b2 Update README.md 2014-12-15 16:49:57 -05:00
Zach Riggle 83ff0838d1 Fixes #179 2014-12-15 05:06:09 -05:00
Zach Riggle 767db7e242 linux-gnu 2014-12-15 03:42:12 -05:00
Zach Riggle 4ef2f90670 Yes. 2014-12-15 03:36:06 -05:00
Zach Riggle 2b30d51022 Helps to have the repo 2014-12-15 03:33:44 -05:00
Zach Riggle ffa349e07d Update travis config to install binutils now that we build for Precise 2014-12-15 03:32:58 -05:00
Zach Riggle 5674fc451a IRC link 2014-12-15 03:28:14 -05:00
Zach Riggle e054881bdf Add note about Python headers being required. 2014-12-14 20:52:36 -05:00
Zach Riggle da393452cf Fixes #173 2014-12-14 20:36:54 -05:00
Zach Riggle 206c3a8630 OSX workaround for binutils prefixed with "g" a la "gobjdump" 2014-12-14 16:57:51 -08:00
Zach Riggle ee267269d9 Use Python bindings for Capstone 2.1 until Capstone 3.0 deb is published 2014-12-14 16:45:16 -08:00
Zach Riggle 5f5fda530f Typo fix 2014-12-14 16:41:05 -08:00
Zach Riggle a119c6c393 Install libcapstone 2014-12-14 14:26:21 -08:00
Zach Riggle a6474c75e7 Travis doesn't have tag names available 2014-12-14 13:28:19 -08:00
Zach Riggle 071dc455d2 Reorder icons for consistency 2014-12-14 12:38:19 -08:00
Zach Riggle 414f72d8c3 Add docs/doctest requirements 2014-12-14 12:37:49 -08:00
Zach Riggle 157375b6cf Add travis badge 2014-12-14 12:34:12 -08:00
Zach Riggle 7ca3bdc67d Add travis configuration 2014-12-14 12:21:19 -08:00
Zach Riggle bcc92a7fff Fixes #177 2014-12-14 12:08:28 -08:00
Zach Riggle 9772093178 Add doctest for remote 2014-12-13 21:54:24 -08:00
Zach Riggle 6439ffdb32 Fixes #175 2014-12-13 21:00:56 -08:00
Zach Riggle fef068e812 Docstring for pwnlib.socket.remote.remote.fromsocket 2014-12-13 20:59:19 -08:00
Zach Riggle e81071b6f9 Merge branch 'pwnlib-2.2' 2014-12-13 20:57:45 -08:00
Zach Riggle 6529970b9a log.error should throw an exception 2014-12-13 20:57:18 -08:00
Zach Riggle c103989ddc Update remote to implement remote.fromsocket 2014-12-13 20:55:30 -08:00
Zach Riggle a78a0dbbf5 Fix typo 2014-12-02 20:20:38 -08:00
Zach Riggle 4ab70b880c pop REG should not include pop ss 2014-12-02 20:20:30 -08:00
Zach Riggle 16fd822ad1 Add SSL support to remote 2014-11-29 10:56:29 -08:00
Zach Riggle 8b24bbd574 Fix typo from 192065b 2014-11-17 11:12:45 -08:00
Zach Riggle c9a581229b Merge branch 'ssh-interactive-repl'
Conflicts:
	pwnlib/tubes/ssh.py
2014-11-12 17:02:19 -05:00
Zach Riggle 2485ab9795 Actually pass the event object to the Thread, and defer list(ord()) 2014-11-12 17:01:55 -05:00
Zach Riggle 37d31724e0 Need threading 2014-11-12 17:00:48 -05:00
Zach Riggle af5d9fe816 Merge branch 'ssh-interactive-repl' 2014-11-10 23:03:25 -05:00
Zach Riggle fbf6e58231 Use a proper threading.Event for synchronization rather than a list 2014-11-10 22:45:05 -05:00
Zach Riggle caee95628f Make ssh_channel.interactive() work when term_mode is not active 2014-11-10 22:35:35 -05:00
Zach Riggle 1db8f1d890 Merge branch 'proc-not-executable' 2014-11-09 07:32:06 -05:00
Zach Riggle 321db0fa81 Better detection 2014-11-09 07:31:52 -05:00
Zach Riggle 599b61468f Merge branch 'proc-not-executable'
Conflicts:
	pwnlib/tubes/process.py
2014-11-09 07:30:55 -05:00
Zach Riggle 807afc8266 Add message when given a non-executable 2014-11-09 07:29:34 -05:00
Zach Riggle 406dce863e Merge branch 'proc-psutil'
Conflicts:
	pwnlib/util/proc.py
	setup.py
2014-11-09 06:15:18 -05:00
Zach Riggle c55273c52a Convert some of proc's functionality to use psutil 2014-11-09 06:11:11 -05:00
Zach Riggle 09f69d804d Merge branch 'pwnlib-2.2' 2014-11-08 20:33:00 -05:00
Zach Riggle 9ba495366c Should timeout 2014-11-08 20:32:54 -05:00
Zach Riggle 5d21dddb50 Merge branch 'checksec' 2014-11-08 20:15:57 -05:00
Zach Riggle 46e1ac95ea alsr alias 2014-11-08 20:11:09 -05:00
Zach Riggle 34101f2710 Merge branch 'checksec' 2014-11-08 19:11:41 -05:00
Zach Riggle 4aa3dd5e34 execstack = not nx 2014-11-08 19:11:35 -05:00
Zach Riggle 8aa952935d Merge branch 'checksec'
Conflicts:
	pwnlib/elf/__init__.py
2014-11-08 08:41:56 -05:00
Zach Riggle 3814003d4f Add checksec 2014-11-08 06:48:08 -05:00
Zach Riggle 4af89b4ddc Merge branch 'rop-no-leave-gadgets' 2014-11-07 01:49:08 -05:00
Zach Riggle 98c0542f20 Check that there are leave gadgets before indexing 2014-11-07 01:48:49 -05:00
Zach Riggle 192065bb36 Merge branch 'wget-requests'
Conflicts:
	pwnlib/util/web.py
2014-11-07 00:05:53 -05:00
Zach Riggle 3ab20f22a9 Merge branch 'pwnlib-2.2' 2014-11-07 00:04:16 -05:00
Zach Riggle 8acd69a82c Reduce maximum update speed of waitfor when not using term-mode 2014-11-07 00:04:09 -05:00
Zach Riggle fe1b5df57e Merge branch 'pwnlib-2.2' 2014-11-06 22:12:40 -05:00
Zach Riggle c92bd308b4 Reduce maximum update speed of waitfor 2014-11-06 22:12:23 -05:00
Zach Riggle a7e7bcfd4f Merge branch 'elf-entry-point' 2014-11-06 22:05:28 -05:00
Zach Riggle b2cd8fde32 Switch to using pwnlib.util.misc.size for calculating sizes 2014-11-06 18:11:22 -05:00
Zach Riggle 6f3fe07e29 Change "wget" to use the requests library. Also adds the entire requests library to the top level. E.g. from pwn import * => "get" is now a global object 2014-11-06 17:29:38 -05:00
Zach Riggle 67ecd7ab0d Add pwnlib.elf.ELF.entry and a few aliases for the entry point 2014-11-06 15:23:45 -05:00
IdolfHatler ff07362012 Merge pull request #155 from zachriggle/tmux
run_in_new_terminal now behaves as per documentation; also can launch new tmux panes
2014-11-06 10:14:52 +01:00
IdolfHatler dddba723d5 Merge pull request #161 from zachriggle/gdb-attach-warning
Add warning message.  Closes #160
2014-11-06 10:14:06 +01:00
Zach Riggle 8a069f192a Merge branch 'gdb.debug' 2014-11-05 01:44:10 -05:00
Zach Riggle 1a7c1f5085 Merge branch 'dynelf-consolidate' 2014-11-05 01:14:02 -05:00
Zach Riggle b88ada7e80 Remove unused code 2014-11-05 01:05:02 -05:00
Zach Riggle f1efc6ae49 Re-add legacy @classmethod methods 2014-11-05 01:03:11 -05:00
Zach Riggle c443c38457 Fix inference of address from ELF, and ELF-only instantiation 2014-11-05 01:01:35 -05:00
Zach Riggle 3fda0c0dbd Fix thumb assembly "-thumb" vs "-mthumb". Also add RET shellcodes for each architecture. 2014-11-05 00:54:13 -05:00
Zach Riggle a5e7202194 Merge branch 'gdb-attach-warning'
Conflicts:
	pwnlib/dynelf.py
	pwnlib/memleak.py
	pwnlib/util/packing.py
2014-11-04 23:41:56 -05:00
Zach Riggle 2d5de974e7 Add warning message. Closes #160 2014-11-04 23:28:35 -05:00
Zach Riggle 666583f1ca Merge branch 'tmux' 2014-11-04 23:20:06 -05:00
Zach Riggle 1ee9bb8d56 Address @IdolfHatler's issue from IRC 2014-11-04 23:19:22 -05:00
Zach Riggle 7d3e5af6de Merge branch 'dynelf-consolidate'
Conflicts:
	pwnlib/dynelf.py
	pwnlib/elf/__init__.py
	pwnlib/elf/datatypes.py
	pwnlib/memleak.py
2014-11-04 22:09:17 -05:00
Zach Riggle 4783df2d5a Fix regression on getting the base address from an ELF 2014-11-04 16:15:17 -05:00
Zach Riggle 293d4773c0 Merge branch 'pwnlib-2.2'
Conflicts:
	pwnlib/asm.py
2014-11-03 21:33:01 -05:00
Zach Riggle f66c6b7936 Permit auto-detection of the current OS to use the maintainer-installed version of binutils. For example, on an i386 system, there should be no reason for an extra version of binutils to be installed. 2014-11-03 21:32:16 -05:00
Zach Riggle 38db1e7e2e Fixes for asm/disasm command-line tools; better handling of includes/section header flags 2014-11-02 05:16:35 -05:00
Zach Riggle 7aae87bd69 Only suppress stdout immediately surrounding ropgadget call; use info_once for messages (see #102) 2014-11-02 05:15:45 -05:00
Zach Riggle 8dd31cb10f Add log.info_once and related messages to only print an error/warning/info message one time 2014-11-02 05:15:44 -05:00
Zach Riggle a39891cc5f Fixes for asm/disasm command-line tools; better handling of includes/section header flags 2014-11-02 05:15:17 -05:00
Zach Riggle e4d95e94d2 Only suppress stdout immediately surrounding ropgadget call; use info_once for messages (see #102) 2014-11-02 05:14:43 -05:00
Zach Riggle 4e0ad45f9e Add log.info_once and related messages to only print an error/warning/info message one time 2014-11-02 04:52:16 -05:00
Zach Riggle 823d909498 Add doctests for previous commit 2014-11-01 12:20:32 -04:00
Zach Riggle b41dc036ae Add doctests for previous commit 2014-11-01 12:20:09 -04:00
Zach Riggle e744813cf0 Fix regression on process.connected_raw 2014-11-01 12:03:53 -04:00
Zach Riggle 3b09781efa Fix regression on process.connected_raw 2014-11-01 11:56:42 -04:00
IdolfHatler 4a88c3e1af Merge pull request #143 from zachriggle/patch-4
log.die is deprecated
2014-10-29 01:34:43 +01:00
IdolfHatler 0febd45d06 Merge pull request #152 from RobertLarsen/master
Thumb bindshell shellcode for Linux
2014-10-29 01:34:26 +01:00
IdolfHatler 0aafd7cba9 Merge pull request #153 from zachriggle/memleak-documentation-endianness
Memleak documentation endianness
2014-10-29 01:34:14 +01:00
IdolfHatler 4b7715e295 Merge pull request #157 from zachriggle/static-elf-symrelplt
Fixes NullSection for Static ELF
2014-10-29 01:33:10 +01:00
Zach Riggle 26d713bf0d Update constgrep 2014-10-28 16:34:48 -07:00
Zach Riggle 8ae04bcd01 Return the tube instead 2014-10-28 16:24:25 -07:00
Zach Riggle 5a63681849 Fix which "which" is used 2014-10-28 16:20:56 -07:00
Zach Riggle f2729530bf Fix previous commit 2014-10-28 01:48:55 -07:00
Zach Riggle 586e62538c Further enhancements thanks to Ilfak. DynELF now works for all RELRO permutations. 2014-10-28 01:41:39 -07:00
Zach Riggle 2ef7fc17d3 Merge remote-tracking branch 'origin/tmux' 2014-10-27 12:53:32 -07:00
Zach Riggle 32699836cb Merge branch 'static-elf-symrelplt' 2014-10-27 12:53:23 -07:00
Zach Riggle e347a5a81b Merge branch 'memleak-documentation-endianness-2.2'
Conflicts:
	pwnlib/memleak.py
2014-10-27 12:51:01 -07:00
Zach Riggle ae4507ef98 Merge branch 'dynelf-consolidate-2.2' 2014-10-27 12:50:16 -07:00
Zach Riggle c4f3e26019 Fix success spinner 2014-10-27 12:49:38 -07:00
Zach Riggle e1b143104d Rework DynELF to use consolidated routines for resolution 2014-10-27 12:49:38 -07:00
Zach Riggle d89c3ff04d wipwip 2014-10-27 12:46:31 -07:00
Zach Riggle 2d79765b5b Make memleak doctest work 2014-10-27 12:45:23 -07:00
Zach Riggle fa4fc41248 Change sizes to be sure to excercise search functionality 2014-10-27 12:45:23 -07:00
Zach Riggle 48c3ba343b Added documentation and doctests 2014-10-27 12:45:23 -07:00
Zach Riggle 5b7905813e asasdf 2014-10-27 12:45:08 -07:00
Zach Riggle c2fd526b7e Migrate back-fill operation to _leak 2014-10-27 12:44:10 -07:00
Zach Riggle 2a0467e105 Merge branch 'pwnlib-2.2'
Conflicts:
	pwnlib/gdb.py
	pwnlib/tubes/ssh.py
2014-10-27 12:43:08 -07:00
Zach Riggle 69e84b790d pwnlib 2.2 rewrite of context, logging, tubes, various bugfixes 2014-10-26 16:02:22 -07:00
Zach Riggle 20d39df46b Fixes #156 2014-10-26 15:19:15 -07:00
Zach Riggle 71250900b2 Make memleak doctest work 2014-10-25 17:16:01 -07:00
Zach Riggle 34db05ca0f run_in_new_terminal now behaves as per documentation; also can launch new tmux panes 2014-10-25 11:30:10 -07:00
Zach Riggle 94f31d3813 Fix success spinner 2014-10-23 13:57:13 -07:00
Zach Riggle c494f6c31d Rework DynELF to use consolidated routines for resolution 2014-10-23 03:07:28 -07:00
Zach Riggle 0b66263696 Change sizes to be sure to excercise search functionality 2014-10-20 19:17:11 -07:00
Zach Riggle bb7f86c3a5 Added documentation and doctests 2014-10-20 19:08:07 -07:00
Zach Riggle f3024c24da asasdf 2014-10-18 19:08:38 -07:00
Zach Riggle 9a7bfd6205 Migrate back-fill operation to _leak 2014-10-18 17:52:31 -07:00
Zach Riggle 45117ec75d Remove unnecessary list() 2014-10-18 17:22:53 -07:00
Robert Larsen 6c57393c57 Describe arguments. 2014-10-14 20:31:12 +02:00
Robert Larsen 2d7fde4b97 Describe arguments. 2014-10-14 20:30:07 +02:00
Robert Larsen 9a17e04ac3 Better doc. 2014-10-14 20:29:01 +02:00
Robert Larsen 2682d31f6a Address family is AF_INET6 for IPv6. 2014-10-14 20:25:23 +02:00
Robert Larsen 63fb952973 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2014-10-12 23:08:52 +02:00
Robert Larsen 89c6ed1520 Added bindshell shellcode for thumb mode. 2014-10-12 23:07:52 +02:00
Zach Riggle 014d8f24ec Merge remote-tracking branch 'upstream/master' 2014-09-30 13:24:04 -04:00
IdolfHatler 8e3b05e016 Merge pull request #139 from zachriggle/patch-3
Enhance error messages
2014-09-30 13:40:47 +02:00
Zach Riggle 256decad52 log.fatal is deprecated 2014-09-29 23:03:53 -04:00
Zach Riggle a810c0204b Enhance error messages 2014-09-29 21:09:55 -04:00
IdolfHatler 74094d562d Merge pull request #138 from zachriggle/patch-2
Rewrite front-page docs a bit
2014-09-26 21:26:04 +02:00
Zach Riggle eb752e720d Rewrite front-page docs a bit
The `install.sh` just runs `pip2 -r requirements.txt` and echoes this same info to the screen.  It's short enough, may as well have it in the README.
2014-09-26 14:56:16 -04:00
IdolfHatler e6f33624d0 Merge pull request #136 from zachriggle/patch-1
Link to write-ups in README
2014-09-25 20:05:33 +02:00
Zach Riggle aad6276a83 Update README.md 2014-09-25 14:01:19 -04:00
IdolfHatler 8ea1d0e011 Merge pull request #132 from zachriggle/timeout-default
Add default timeout
2014-09-23 09:18:48 +02:00
IdolfHatler c198d4aede Merge pull request #134 from zachriggle/bug-stacktrace
Bugs should always emit a stack trace
2014-09-23 09:09:44 +02:00
Zach Riggle 3d8a1950a4 Bugs should always emit a stack trace 2014-09-23 01:25:08 -04:00
Zach Riggle b4bb6f41f3 Add default timeout 2014-09-23 00:56:44 -04:00
Mathias Svensson 60428c462b Fixed #125 2014-09-20 17:19:42 +02:00
Mathias Svensson 7604ea5319 A shebang does nothing if it is not the first line 2014-09-20 17:16:44 +02:00
Mathias Svensson a0bcd69abf Fixed #127 (bad copy paste) 2014-09-20 17:15:35 +02:00
Mathias Svensson 4cf6f7b4f6 Fixed bug in tube 2014-09-20 15:35:29 +02:00
IdolfHatler 5c44735842 Merge pull request #124 from zachriggle/context-threaded
Implement context-preserving threads
2014-09-18 23:07:19 +02:00
Zach Riggle 5121df4c4d Copy context to avoid secondary effects of scoping affecting the thread 2014-09-18 16:24:40 -04:00
Mathias Svensson d40c88e368 recvall will now close the connection 2014-09-18 08:09:42 +02:00
Mathias Svensson cb9d5357c4 Fixed uroboros (#123) 2014-09-18 08:09:42 +02:00
Zach Riggle 1d5ee71597 Merge branch 'context-threaded' 2014-09-17 20:11:51 -04:00
Zach Riggle 873afe189b Fixed regression in local copy 2014-09-17 20:09:17 -04:00
Zach Riggle e59aceecc2 Timeout message is too verbose after fixing thread context, when using .interactive() 2014-09-17 19:52:18 -04:00
Zach Riggle 24d247cc1b Implement context-preserving thread
Add threading back to toplevel
2014-09-17 19:52:06 -04:00
IdolfHatler e37b606cdc Merge pull request #119 from zachriggle/cyclic-newline-fix
Cyclic should only emit a newline when writing to a TTY
2014-09-17 21:08:15 +02:00
Zach Riggle d9079f4baa Merge branch 'cyclic-newline-fix' 2014-09-17 14:57:41 -04:00
Zach Riggle 6ff0fe8b2a Cyclic should only emit a newline when writing to a TTY 2014-09-17 14:49:31 -04:00
Zach Riggle 487fa32692 Merge remote-tracking branch 'upstream/master' 2014-09-17 14:48:58 -04:00
Mathias Svensson 1183fe4f66 Fixed a bug where readthedocs did not have rop documentation 2014-09-16 11:14:01 +02:00
IdolfHatler 43c0e7abce Merge pull request #117 from zachriggle/setxid
Update setXid
2014-09-15 20:52:53 +02:00
Zach Riggle 8796ba3477 Merge branch 'setxid' 2014-09-15 14:13:51 -04:00
Zach Riggle 22eb78d425 Update setXid 2014-09-15 14:13:43 -04:00
Mathias Svensson 5475de3f73 Tweaked the atexit-for-tubes commit a bit. We now use our local version of atexit, and we will not have a flag for choosing it. 2014-09-15 17:50:06 +02:00
Mathias Svensson 81ad2c32ac Merge branch 'tube-cleanup' of https://github.com/zachriggle/pwntools 2014-09-15 17:41:44 +02:00
Mathias Svensson 8d11a1596c Fixed debug message 2014-09-15 17:41:36 +02:00
IdolfHatler a830893c1f Merge pull request #112 from RobertLarsen/master
Made having two eggs in a row optional.
2014-09-15 14:54:50 +02:00
IdolfHatler c5305c6613 Merge pull request #110 from zachriggle/i386-dup-fix
Fix dupsh NUL bytes and make it shorter
2014-09-15 14:54:27 +02:00
IdolfHatler 3b010f92b6 Merge pull request #116 from zachriggle/shellcraft-amd64
amd64 shellcodes
2014-09-15 14:54:13 +02:00
Zach Riggle 32e767fb38 Merge branch 'shellcraft-amd64' 2014-09-15 04:35:03 -04:00
Zach Riggle 5d109f114c Merge branch 'tube-cleanup' 2014-09-15 04:34:46 -04:00
Zach Riggle 46957f01b3 Merge branch 'gdb.debug' 2014-09-15 04:34:36 -04:00
Zach Riggle e350668ba1 Merge remote-tracking branch 'upstream/master' 2014-09-15 04:34:30 -04:00
Zach Riggle e3846d3d83 amd64 shellcodes 2014-09-15 04:31:37 -04:00
IdolfHatler 63c1245931 Merge pull request #115 from zachriggle/shellcraft-chain
Permit chaining of `shellcraft`
2014-09-15 09:39:12 +02:00
Zach Riggle d6ba19d148 Ensure gdbserver is installed. Important since it is not installed for any overthewire or smashthestack challenges 2014-09-15 03:21:22 -04:00
Zach Riggle 2b111c84cd Autodetect output format 2014-09-15 03:07:34 -04:00
Zach Riggle 47f31d8741 Permit chaining of shellcraft 2014-09-15 03:04:12 -04:00
Zach Riggle 2a472e2c39 Make it optional, but default 2014-09-15 02:49:39 -04:00
Zach Riggle 9dce9c50fd Clean up tubes on process exit 2014-09-15 02:42:51 -04:00
Robert Larsen becaebc17d Fixed documentation. 2014-09-14 12:47:47 +02:00
Robert Larsen 8259572280 Made having two eggs in a row optional. 2014-09-14 12:44:27 +02:00
Mathias Svensson 3b793cdb57 Fixed #111 2014-09-12 13:59:01 +02:00
Mathias Svensson 786390ffa0 Fixed logging bug in dynelf 2014-09-12 13:57:48 +02:00
Zach Riggle 31a27eda3f Get rid of skinny-space 2014-09-11 19:37:13 -04:00
Zach Riggle 1e3257cddd Merge branch 'i386-dup-fix' 2014-09-11 19:09:47 -04:00
Zach Riggle bd29de04a3 Fix dupsh NUL bytes and make it shorter 2014-09-11 19:07:19 -04:00
IdolfHatler a923b9a155 Merge pull request #109 from zachriggle/rop-cache-quiet
Make message a bit quieter
2014-09-11 05:46:45 +02:00
Zach Riggle b80c08af3c Merge remote-tracking branch 'upstream/master' 2014-09-10 20:41:37 -04:00
Zach Riggle 7e58a25a92 Merge branch 'rop-cache-quiet' 2014-09-10 20:39:18 -04:00
Zach Riggle 87a85e92fe Merge branch 'gdb.debug' 2014-09-10 20:39:15 -04:00
Zach Riggle b0661a42c3 Make message a bit quieter 2014-09-10 20:18:24 -04:00
Zach Riggle 77baaed1d6 Autodetect binary for gdb based on provided arguments if running locally 2014-09-10 20:08:03 -04:00
Zach Riggle b30b34b3af Add gdb.debug for launching gdbserver locally or over ssh 2014-09-10 20:04:58 -04:00
Zach Riggle 45cc9e172a Merge branch 'ssh-directories' 2014-09-10 15:56:13 -04:00
Zach Riggle 1eb85ac20e Fix issue which makes top-level "process" be the module instead of the class when importing * from pwn 2014-09-10 15:56:03 -04:00
Zach Riggle 60d4921125 Merge branch 'ssh-directories' 2014-09-10 15:50:43 -04:00
Zach Riggle e17f33d741 Enable recursive upload/download of folders 2014-09-10 15:50:30 -04:00
IdolfHatler 5e8590c090 Merge pull request #106 from RobertLarsen/master
Shaved off one instruction.
2014-09-10 17:28:52 +02:00
Robert Larsen 0ec9bd93ff Shaved off one instruction. 2014-09-10 13:51:09 +02:00
IdolfHatler a814a2d90f Merge pull request #103 from RobertLarsen/master
Added egghunter for ARM
2014-09-10 13:32:24 +02:00
Robert Larsen 256b340354 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2014-09-10 13:27:00 +02:00
Robert Larsen 637ff82f5a Be able to specify the address to start the search. 2014-09-10 13:04:50 +02:00
IdolfHatler aaaabb7295 Merge pull request #92 from RobertLarsen/master
Added findpeersh shellcode for thumb
2014-09-10 10:33:35 +02:00
IdolfHatler b5d2ed19c3 Merge pull request #94 from zachriggle/pwnlib-util-web-wget
Pwnlib util web wget
2014-09-10 10:33:05 +02:00
Zach Riggle 62a039501e Merge remote-tracking branch 'upstream/master' 2014-09-10 03:23:11 -04:00
IdolfHatler d6a977122d Merge pull request #99 from zachriggle/elf-vaddr-fixup
Fix calculations based on header.p_vaddr
2014-09-10 09:22:32 +02:00
IdolfHatler fe702fc6e3 Merge pull request #98 from zachriggle/elf-bss-default
Default elf.bss argument
2014-09-10 09:21:57 +02:00
IdolfHatler 1aa06f3781 Merge pull request #97 from zachriggle/listen-wait-port-zero-status
Add status message for "listening" to expressly print out port
2014-09-10 09:21:39 +02:00
IdolfHatler 1e947a72c2 Merge pull request #95 from zachriggle/elf-plt-stopgap-fix
ELF PLT Symbol Fix
2014-09-10 09:21:06 +02:00
IdolfHatler 04cabea872 Merge pull request #96 from zachriggle/elf-symbols-got-plt-prefixes
Add plt.XXXX and got.XXXX symbols so that rop.dump() output is better
2014-09-10 09:19:27 +02:00
Zach Riggle c29919560a Merge branch 'elf-vaddr-fixup' 2014-09-10 03:14:03 -04:00
Zach Riggle 19c59a44e7 Fix calculations based on header.p_vaddr 2014-09-10 03:10:49 -04:00
Zach Riggle 5b79e53126 Merge branch 'elf-bss-default' 2014-09-10 02:37:53 -04:00
Zach Riggle 93ad3e7e42 Default elf.bss argument 2014-09-10 02:35:30 -04:00
Zach Riggle 073f925974 Merge branch 'listen-wait-port-zero-status' 2014-09-10 02:26:41 -04:00
Zach Riggle 0ee84aec1e Add status message for "listening" to expressly print out port, which is useful if port was zero 2014-09-10 02:26:18 -04:00
Zach Riggle 68db0532a4 Merge branch 'elf-symbols-got-plt-prefixes' 2014-09-10 02:20:12 -04:00
Zach Riggle 5d150fd930 Add plt.XXXX and got.XXXX symbols so that rop.dump() output is better 2014-09-10 02:18:20 -04:00
Zach Riggle 5742eceab4 Merge branch 'elf-plt-stopgap-fix' 2014-09-10 01:38:15 -04:00
Zach Riggle a9145ad8f7 Rename variables to match BFD 2014-09-10 01:38:04 -04:00
Zach Riggle 17ff609e39 Apply intermediary fix 2014-09-10 00:37:07 -04:00
Robert Larsen ae3bb1fe20 Start from page 0. 2014-09-09 13:33:25 +02:00
Robert Larsen f7a047af68 Made the egghunter work. 2014-09-09 13:07:05 +02:00
Robert Larsen ba053eed81 Improved mov() helper. 2014-09-09 12:53:57 +02:00
Robert Larsen 860668621b Added egghunter for ARM. 2014-09-09 10:40:19 +02:00
Robert Larsen b08f81a788 Added mov() shellcode helper for ARM. 2014-09-09 10:38:11 +02:00
Robert Larsen 5b8375a027 Merge branch 'master' of https://github.com/Gallopsled/pwntools 2014-09-09 10:23:32 +02:00
Zach Riggle aafe85092a Merge branch 'pwnlib-util-web-wget' 2014-09-03 21:46:07 -07:00
Zach Riggle 85d7229691 Add timeout 2014-09-03 21:41:48 -07:00
Zach Riggle e514328d02 add pwnlib.util.web.wget 2014-09-03 21:36:44 -07:00
Zach Riggle f70665546b Merge branch 'master' of https://github.com/pwnies/pwntools 2014-09-03 14:57:43 -07:00
IdolfHatler 09b5b74bd2 Merge pull request #93 from zachriggle/setreXid
Add i386 shellcode for 'setreuid' and 'setregid'
2014-09-01 14:26:40 +02:00
Zach Riggle 723d053a8b Merge branch 'setreXid' 2014-08-31 23:03:19 -07:00
Zach Riggle 06970b082d add shellcodes 2014-08-31 23:02:38 -07:00
Zach Riggle ccbc7b93ec Merge branch 'master' of https://github.com/pwnies/pwntools 2014-08-31 21:53:20 -07:00
Robert Larsen 75917a9a41 Fixed doc. 2014-08-29 10:46:57 +02:00
Robert Larsen e8e8f70f60 Put port into the right register prior to comparison. 2014-08-29 10:41:36 +02:00
Robert Larsen 60d0e82dd3 Fixed dup() shellcode. 2014-08-29 10:16:13 +02:00
Robert Larsen d4fa4f3057 First attempt at findpeer() and findpeersh() shellcode. 2014-08-29 01:02:01 +02:00
IdolfHatler 06a95ddb70 Merge pull request #91 from RobertLarsen/master
Indent correctly for more cases
2014-08-29 00:37:41 +02:00
Robert Larsen 90f92185bc More elegant check for ':'. 2014-08-29 00:19:54 +02:00
Robert Larsen 0350724eb2 '.' and '_' should be considered legal label characters too. 2014-08-29 00:06:49 +02:00
Robert Larsen 63a2fd2bc4 First non whitespace characters in a label is alphanumeric. 2014-08-28 23:48:24 +02:00
Mathias Svensson d1a83f5c92 process.kill() will now actually kill the process 2014-08-28 23:35:42 +02:00
Mathias Svensson 52fe5d6ef7 A few more bugfixes to rop.py 2014-08-28 23:27:18 +02:00
Robert Larsen 54d5e7bdac Handle case with colon inside comment 2014-08-28 23:11:47 +02:00
Robert Larsen 60ed4a3b01 Indent so that shellcrafts prettyfier will work. 2014-08-28 22:31:21 +02:00
Mathias Svensson 54d027ae77 Made rop.search more useful 2014-08-28 22:27:17 +02:00
Mathias Svensson e5037c251d Bugfix: Last-call optimization was broken 2014-08-28 22:26:56 +02:00
Robert Larsen e395284dea Prevent indention for lines starting with a label.
Indent remaining lines by four spaces if they are indented at any level.
2014-08-28 22:22:16 +02:00
Morten Brøns-Pedersen 579ea543df fixed docstring syntax in pwnlib.rop.ROP.__getattr__(). 2014-08-28 21:28:40 +02:00
Morten Brøns-Pedersen 5ffcd945cc fix doctests for pwnlib.rop. 2014-08-28 21:28:40 +02:00
Morten Brøns-Pedersen a059b49a58 suppress output from ropgadget in pwnlib.rop. 2014-08-28 21:28:40 +02:00
Mathias Svensson 0a5d9956ea There should not be any log_level=info in interactive 2014-08-28 21:26:17 +02:00
Mathias Svensson 3d9af2f8f3 Bugfix: recvn was broken 2014-08-28 21:15:06 +02:00
Mathias Svensson b2e15b19b1 Added preliminary changelog 2014-08-28 21:00:07 +02:00
Morten Brøns-Pedersen ab628a3231 addde pwnlib.rop to docs. 2014-08-28 20:54:52 +02:00
Morten Brøns-Pedersen 033526e044 added docstrings for pwnlib.rop. 2014-08-28 20:54:52 +02:00
Morten Brøns-Pedersen 50e1b723f2 added docs for pwnlib.replacements. 2014-08-28 20:54:52 +02:00
Morten Brøns-Pedersen 894fe13d0c updated docstrings in pwnlib.replacements. 2014-08-28 20:54:52 +02:00
Morten Brøns-Pedersen 4ea339230c added pwnlib.replacements.* to pwn.toplevel 2014-08-28 20:54:52 +02:00
Morten Brøns-Pedersen d0907f8677 added replacements to __init__.py 2014-08-28 20:54:52 +02:00
Morten Brøns-Pedersen 17135990e5 moved pwnlib.replacements.time.sleep() to pwnlib.replacements.sleep() 2014-08-28 20:54:52 +02:00
Mathias Svensson 2e586d05c6 Removed trailing whitespace 2014-08-28 20:04:51 +02:00
Mathias Svensson a1a0877b8f Removed trailing whitespace 2014-08-28 20:01:00 +02:00
Jonas Rudloff f62ea2d3e6 Merge pull request #88 from RobertLarsen/master
Ported ARM/THUMB shellcode from old pwntools
2014-08-28 19:30:25 +02:00
Morten Brøns-Pedersen 61cdbfcbf1 fixed #90 2014-08-28 19:21:10 +02:00
Morten Brøns-Pedersen 082aab697b updated the README.md 2014-08-28 19:21:10 +02:00
Zach Riggle bafee07292 Merge remote-tracking branch 'origin/elfpatch' 2014-08-28 09:45:24 -07:00
Zach Riggle 10df479581 Merge remote-tracking branch 'origin/elfdiff' 2014-08-28 09:45:20 -07:00
mortenbp d32af7f0c4 Merge pull request #84 from zachriggle/cyclic-find-not-in-alphabeta
Catch invalid characters early in cyclic_find()
2014-08-28 10:37:56 +02:00
Zach Riggle d4ad15cfc9 Merge remote-tracking branch 'upstream/master' 2014-08-27 22:59:27 -07:00
Mathias Svensson f09bf54ab4 Fixed a few bugs in rop.py 2014-08-28 07:51:03 +02:00
Robert Larsen 59968de491 Added dupsh thumb shellcode. 2014-08-28 00:35:38 +02:00
Robert Larsen 05f31950c5 Added dup shellcode for thumb. 2014-08-28 00:33:18 +02:00
Robert Larsen e3907f5dd6 Added thumb shellcode for spawning a shell. 2014-08-27 23:52:55 +02:00
Robert Larsen 70d313cbcc Added thumb shellcode helper for initializing a register. 2014-08-27 23:42:49 +02:00
Robert Larsen ec1452c781 Added shell spawning shellcode for arm. 2014-08-27 22:44:09 +02:00
Robert Larsen 737809b563 Added arm->thumb shellcode. 2014-08-27 22:28:14 +02:00
Robert Larsen 56af2d7cdd Fixed typo in comment 2014-08-27 22:09:10 +02:00
IdolfHatler 99695f3873 Merge pull request #87 from RobertLarsen/master
Made DynELF much more modular and able to solve more tasks
2014-08-27 15:51:10 +02:00
Robert Larsen 80e312144c No test 2014-08-27 12:42:54 +02:00
Robert Larsen 79833088bf Added docstring. 2014-08-27 12:39:29 +02:00
Robert Larsen 8e16f22172 Made dynelf work with new elf implementation. 2014-08-27 11:54:08 +02:00
Morten Brøns-Pedersen 318d01ce51 logging functions now write to sys.stderr if not in term mode 2014-08-27 11:15:28 +02:00
Morten Brøns-Pedersen 2369700409 replace sys.stderr in pwnlib.term.term.init() so exceptions etc. shows right 2014-08-27 11:14:30 +02:00
Morten Brøns-Pedersen 38c560d526 let the terminal wrap lines that are too long. fixes copy'n'pasting of such lines 2014-08-26 16:03:28 +02:00
Zach Riggle 67a544bf5f kill assemblers 2014-08-25 21:06:01 -07:00
Zach Riggle 82cb3f5dfd Add .lhost and .lport for ssh_connector() 2014-08-25 19:34:53 -07:00
mortenbp fc27c74f14 Merge pull request #86 from zachriggle/ssh-listener-broken-typo
acceptor => accepter
2014-08-25 22:36:19 +02:00
Zach Riggle 02e6b3a768 acceptor => accepter 2014-08-25 11:44:13 -07:00
Robert Larsen dfee5a50e5 Made dynelf implementation much cleaner.
Added factory methods for easier instantiation.
2014-08-25 15:31:54 +02:00
Robert Larsen cb81b9dfbf Merge branch 'master' of https://github.com/Gallopsled/pwntools
Conflicts:
	pwn/test/leaky/Makefile
	pwn/test/leaky/resolve.py
	pwnlib/dynelf.py
2014-08-25 15:21:36 +02:00
IdolfHatler 6a05dbd606 Merge pull request #85 from zachriggle/blocking-poll-ssh
Add a blocking variant of poll() and a helper, wait(), to invoke it
2014-08-24 20:02:07 +02:00
Zach Riggle a182d739ee Merge branch 'blocking-poll-ssh' 2014-08-24 09:43:24 -07:00
Zach Riggle d3b5f79362 Add a blocking variant of poll() and a helper, wait(), to invoke it. Replace poll() with wait() where we need the exit status. Without this, the exit code may not be available and file uploads/downloads will "fail" when they really succeeded (but the return value just didn't propagate yet) 2014-08-24 09:41:09 -07:00
Zach Riggle 6dd29547ac Merge branch 'cyclic-find-not-in-alphabeta' 2014-08-23 07:46:25 -07:00
Zach Riggle 25fda64e03 More readable 2014-08-23 06:36:41 -07:00
Zach Riggle b2ad179845 Merge branch 'cyclic-find-not-in-alphabeta' 2014-08-22 20:41:53 -07:00
Zach Riggle dc2dc0b87f Catch invalid characters early in cyclic_find(). Sometimes I forget to u32() the data, and it searches forever for eight bytes of irrelevant data. 2014-08-22 20:10:53 -07:00
Zach Riggle ed77b3b397 Merge remote-tracking branch 'upstream/master' 2014-08-22 14:32:08 -07:00
Morten Brøns-Pedersen 4e8c9a6913 better ascii-art in pwnlib.util.splash.splash(). 2014-08-22 17:46:34 +02:00
Mathias Svensson 5463cdcb31 Made the serialtube a bit better 2014-08-17 20:27:50 +02:00
Mathias Svensson a358bf0b4b Added infloop and nop for ARM 2014-08-17 16:43:05 +02:00
Mathias Svensson e05cd05155 Removed octal constants from header files 2014-08-17 15:58:02 +02:00
Mathias Svensson 495a60c102 Ignore e.g. vim files in the templates directory 2014-08-17 15:54:52 +02:00
Mathias Svensson a35a5a318a Better constant handling for shellcraft 2014-08-17 15:53:36 +02:00
Mathias Svensson cd25505009 Added open_file for ARM 2014-08-17 15:52:45 +02:00
Mathias Svensson c20033e7b4 Added thumb nop and infloop 2014-08-17 15:42:04 +02:00
Mathias Svensson a791f3122a Updated shellcraft to remove all newlines following just after two other newlines 2014-08-17 15:39:18 +02:00
Mathias Svensson c7898a4e48 Added a replacement for time.sleep which does not return on signals 2014-08-17 15:12:36 +02:00
Mathias Svensson b31c527212 Fixed bug in case there was no plt 2014-08-17 15:12:36 +02:00
IdolfHatler c1ebb79ef7 Merge pull request #80 from brifordwylie/small_setup_changes
Small setup changes
2014-08-16 11:36:13 +02:00
Morten Brøns-Pedersen aa67eded8a improved performance of pwnlib.util.fiddling.hexdump_iter(). 2014-08-14 20:47:09 +02:00
Morten Brøns-Pedersen 3678934c86 added argument "--color" to bin/phd. 2014-08-14 20:34:52 +02:00
Morten Brøns-Pedersen 0e9f855133 added property pwnlib.term.text.when which controls when to output control characters. 2014-08-14 20:26:48 +02:00
Morten Brøns-Pedersen a23a608854 bin/phd now handles top-level exceptions KeyboardInterrupt and IOError (which happens when e.g. phd | less). 2014-08-14 19:11:40 +02:00
Morten Brøns-Pedersen 61f6842483 added pwnlib.util.fiddling.hexdump_iter() and made pwnlib.util.fiddling.hexdump() a thin wrapper. bin/phd now uses the iterator variant for better performance. 2014-08-14 18:53:22 +02:00
Morten Brøns-Pedersen b07d337b96 bugfix: bin/phd now offsets addresses by skip. 2014-08-14 18:40:34 +02:00
Morten Brøns-Pedersen 8a5141a52a bugfix: pwnlib.util.fiddling.hexdump() now reports the correct address on the last line. 2014-08-14 18:39:24 +02:00
Morten Brøns-Pedersen bb777b923e added CLI frontend to pwnlib.util.fiddling.hexdump: phd (Pwnlib HexDump). 2014-08-14 04:24:37 +02:00
Morten Brøns-Pedersen 60ddfb3f03 added highlights to pwnlib.util.fiddling.hexdump. 2014-08-14 03:57:13 +02:00
Morten Brøns-Pedersen 196499095b added colors to pwnlib.util.fiddling.hexdump(). 2014-08-14 03:53:06 +02:00
Brian Wylie fa61307a73 add pyserial as a required dependency (at least on MacOSX you need it :) 2014-08-13 13:43:24 -06:00
Brian Wylie 05838c1d2a have requirements.txt just 'call' setup.py install_requires so that you don't have two copies of the python dependencies 2014-08-13 13:42:29 -06:00
Morten Brøns-Pedersen aab7122870 pwn now also looks for environment variables starting with "PWNLIB_"; "PWNLIB_LOG_LEVEL" sets context.log_level. added a new flag "NOTERM". 2014-08-13 17:26:55 +02:00
Morten Brøns-Pedersen 20933e1ac1 removed per tube log levels from pwnlib.tubes.tube as the feature was hardly ever used and not very intuitive. might reintroduce later. 2014-08-13 17:26:55 +02:00
Morten Brøns-Pedersen d53a59b604 bugfix: pwnlib.tubes.tube.recvline() now uses the timeout argument when called with no delims. 2014-08-13 17:26:46 +02:00
Morten Brøns-Pedersen 251eccbc70 added argument keepend(s) to functions in pwnlib.tubes.tube recieving lines. 2014-08-13 17:22:55 +02:00
Morten Brøns-Pedersen c07637d05b rewrote major parts of pwnlib.tubes.tube for hugely increased performance. introduced slight API changes in the process. 2014-08-13 15:05:51 +02:00
Morten Brøns-Pedersen 8996cdf363 fixed a bug where pwnlib.term.term would simetimes throw an exception if there was free space at the bottom of the terminal and the window was resized. 2014-08-13 01:33:40 +02:00
Mathias Svensson 4cf1e55129 Added initial support for serial tubes 2014-08-09 01:31:58 -07:00
IdolfHatler 083b5c854e Merge pull request #79 from zachriggle/elfpatch-correct
elf.asm now uses "org" directive for correct relative jumps
2014-08-08 22:56:24 -07:00
Zach Riggle b95246fc5a elf.asm now uses "org" directive for correct relative jumps 2014-08-08 15:38:05 -07:00
Morten Brøns-Pedersen edc43b0de4 bugfix: pwnlib.gdb.attach() now waits for the debugger 2014-08-08 21:24:51 +02:00
Zach Riggle a346d64d98 elfdiff 2014-08-08 11:09:45 -07:00
Zach Riggle 3956b76144 fix 2014-08-08 10:48:05 -07:00
Zach Riggle 5a5ac38e06 elfpatch 2014-08-08 10:43:00 -07:00
Morten Brøns-Pedersen b74a3ad991 added example showing pwnlib.term.text and updated examples/README.md 2014-08-07 21:15:23 +02:00
Morten Brøns-Pedersen 58c4abae82 bugfix: pwnlib.term.term now handles xterm color definition escapes 2014-08-07 20:45:48 +02:00
Morten Brøns-Pedersen 136694509d bugfix: pwnlib.term.termcap.get() now also works for integer and boolean values 2014-08-07 20:08:33 +02:00
Morten Brøns-Pedersen 743bf4cb38 pwnlib.ui.options(): options too long to fit on a single line are now indented properly 2014-08-07 00:37:57 +02:00
IdolfHatler dcb4435e62 Merge pull request #71 from zachriggle/interactive-working-dir
cd on .interactive() if .set_working_dir() has been called
2014-08-06 13:21:41 -07:00
IdolfHatler 3a0f41493a Merge pull request #75 from zachriggle/patch-2
Bugfix: ssh.run(tuple) => error
2014-08-06 13:21:26 -07:00
IdolfHatler 1b4d1a2cb9 Merge pull request #74 from zachriggle/patch-1
`cyclic` currently broken due to aliased command
2014-08-06 13:21:10 -07:00
Morten Brøns-Pedersen 6a1b1f3bab fixed #76 2014-08-06 19:27:18 +02:00
Morten Brøns-Pedersen b9649ea4dc fixed #73 2014-08-06 11:01:14 +02:00
Morten Brøns-Pedersen d45bfe134a added documentation badges to README.md 2014-08-06 10:57:14 +02:00
Morten Brøns-Pedersen 79dc4d46e6 added badges to README.md and changed the header 2014-08-06 10:41:14 +02:00
Zach Riggle 62686836fd Bugfix: ssh.run(tuple) => error
Otherwise throws this

```py
  File "/home/user/pwntools/pwnlib/tubes/ssh.py", line 17, in __init__
    h = log.waitfor('Opening new channel: %r' % (process or 'shell'), log_level = self.log_level)
TypeError: not all arguments converted during string formatting
```
2014-08-06 04:29:10 -04:00
Zach Riggle 1c9ee40592 cyclic currently broken due to aliased command 2014-08-06 03:07:35 -04:00
Zach Riggle 1875ceea5b Merge remote-tracking branch 'upstream/master' 2014-08-05 20:16:25 -07:00
Mathias Svensson 76d58479fa Merge branch 'master' of github.com:Gallopsled/pwntools 2014-08-05 18:53:55 -07:00
Mathias Svensson 3f2298d2d8 Merge branch 'zachriggle-absolute-rop' 2014-08-05 18:53:22 -07:00
Mathias Svensson 3c6d54affd Merge branch 'absolute-rop' of https://github.com/zachriggle/pwntools into zachriggle-absolute-rop
Conflicts:
	pwnlib/util/packing.py

But also changed the rop.py a lot. I am bad at git, I know. :/
2014-08-05 18:52:21 -07:00
Zach Riggle c74ac96ef6 cd on .interactive() if .set_working_dir() has been called 2014-08-05 17:19:19 -07:00
Zach Riggle 1afd42a32a Merge remote-tracking branch 'upstream/master' 2014-08-05 16:51:59 -07:00
Morten Brøns-Pedersen 90e2b69ac5 example showing pwnlib.ui.options(). 2014-08-06 01:46:57 +02:00
Morten Brøns-Pedersen 7785615055 added bells and whistles to pwnlib.ui.options when in term_mode. 2014-08-06 01:46:10 +02:00
Morten Brøns-Pedersen 856e75d2cc pwnlib.ui.more now just prints the text if not in term_mode. 2014-08-06 01:06:11 +02:00
Morten Brøns-Pedersen 7d98a0a6dd added pwnlib.ui.more. 2014-08-06 01:04:09 +02:00
Morten Brøns-Pedersen d601ccfc64 added links to itertools aliases in pwnlib.util.iters documentation. 2014-08-06 00:04:11 +02:00
Morten Brøns-Pedersen 465b53ee61 fixed doctest setup for pwnlib.util.iters. 2014-08-05 23:44:12 +02:00
Morten Brøns-Pedersen c828fd05ae added module pwnlib.useragents. 2014-08-05 23:31:33 +02:00
Morten Brøns-Pedersen ba68548e02 added __all__ to pwnlib.util.iters. 2014-08-05 19:14:55 +02:00
Morten Brøns-Pedersen 6e06b0e808 added "iters" to pwnlib.util.__all__. 2014-08-05 18:28:58 +02:00
Morten Brøns-Pedersen c6b2015158 added support for status updates to pwnlib.log.waitfor() when not in term_mode 2014-08-05 09:33:49 +02:00
Morten Brøns-Pedersen 9548fa6b69 added pwnlib.util.iters to pwn toplevel 2014-08-05 09:33:49 +02:00
Morten Brøns-Pedersen 9d79323df9 ported iterutil from old pwnlib to pwnlib.util.iters. 2014-08-05 09:33:49 +02:00
Mathias Svensson d3fc464eaf Added the method spawn_process for tubes, which will spawn a process communicating on that tube 2014-08-04 23:54:15 -07:00
Mathias Svensson c45edb3419 I cannot see any reason not to use ebp in pivots 2014-08-04 23:23:25 -07:00
Mathias Svensson 41d6b8542d Added the possibility for preprocessing to flat 2014-08-04 22:52:40 -07:00
Mathias Svensson 9351ed93c7 Missed one 2014-08-04 22:51:58 -07:00
Mathias Svensson 1f71e690e5 Removed slow tests 2014-08-04 22:48:41 -07:00
Mathias Svensson 1b3d426377 Does the same transformation for connected as was done for shutdown 2014-08-04 22:18:06 -07:00
Mathias Svensson fd72c895af Make pack support unicode 2014-08-04 22:06:53 -07:00
Mathias Svensson 124a473432 Make run_in_new_terminal less noisy 2014-08-04 22:06:19 -07:00
Mathias Svensson b615ba58d0 ECONNRESET should be translated into EOFError 2014-08-04 22:05:46 -07:00
Mathias Svensson b5d12f680f Added cwd argument to process 2014-08-04 19:35:35 -07:00
Morten Brøns-Pedersen 86773a5a4a pwnlib.tubes.tube.shutdown() now accepts "in", "out", "recv", "send", "read" and "write"; subclasses should now implement shutdown_raw(). 2014-08-05 04:24:33 +02:00
Morten Brøns-Pedersen 3ed230d410 changed pwnlib.util.safeeval.expr_eval/const_eval to pwnlib.util.safeeval.exrp/const. 2014-08-05 04:24:33 +02:00
Morten Brøns-Pedersen a5d62b8e2e added modules collections and operator to pwn.toplevel. 2014-08-05 04:24:33 +02:00
Zach Riggle 5a95e8e9d2 Implement absolute ROP loading given a static base address 2014-08-04 19:23:05 -07:00
IdolfHatler b90e6cdc3d Merge pull request #67 from zachriggle/elf-bss
Add pwnlib.elf.ELF.bss()
2014-08-04 19:08:51 -07:00
Mathias Svensson d970304bd2 We now support interactive outside term mode 2014-08-04 19:01:43 -07:00
Zach Riggle d534a3a929 Add pwnlib.elf.ELF.bss() 2014-08-04 19:01:26 -07:00
Mathias Svensson 3e01b5ab97 Fixed bug in run_in_new_terminal and removed tabs 2014-08-04 18:27:06 -07:00
Mathias Svensson 485005cab8 Support using a string as an argument to ROP 2014-08-04 18:14:44 -07:00
Morten Brøns-Pedersen 25060ef502 set context.log_level to "silent" when running doctests 2014-08-05 02:08:25 +02:00
IdolfHatler 11e2b3a677 Merge pull request #62 from zachriggle/gdb-resolve-library-addresses
GDB resolution for modules
2014-08-04 16:46:22 -07:00
Zach Riggle 6898eae383 Merge branch 'elf-fix-offsets-after-addr-change' 2014-08-04 16:23:29 -07:00
Zach Riggle 3097a60433 Merge branch 'gdb-resolve-library-addresses' 2014-08-04 16:21:47 -07:00
Zach Riggle e61812d7aa Clarify docs 2014-08-04 16:21:04 -07:00
Zach Riggle 215c42b2c5 Example, doctest works 2014-08-04 16:18:35 -07:00
Mathias Svensson d51e71f738 Merge branch 'zachriggle-elf-fix-offsets-after-addr-change' 2014-08-04 16:05:32 -07:00
Mathias Svensson 4a28bd824f Removed some debugging code 2014-08-04 16:05:23 -07:00
Mathias Svensson cb52da39b8 Merge branch 'elf-fix-offsets-after-addr-change' of https://github.com/zachriggle/pwntools into zachriggle-elf-fix-offsets-after-addr-change 2014-08-04 16:04:51 -07:00
Zach Riggle 81500b5a6e Merge remote-tracking branch 'upstream/master' 2014-08-04 16:00:00 -07:00
Zach Riggle a492a5a5c9 Fix docs 2014-08-04 15:57:50 -07:00
Mathias Svensson 8ffef8af9f Merge branch 'zachriggle-rop-easy' 2014-08-04 15:52:41 -07:00
Mathias Svensson 20b1b90987 Added docstring 2014-08-04 15:52:21 -07:00
Mathias Svensson 937ab31947 Merge branch 'rop-easy' of https://github.com/zachriggle/pwntools into zachriggle-rop-easy 2014-08-04 15:50:29 -07:00
Zach Riggle 488e4b8d11 flush = chain(); clear(); 2014-08-04 15:49:55 -07:00
Zach Riggle baf5b68cf4 Implement shorthand for rop.call(); add .flush(); remove arg to .chain() 2014-08-04 15:47:11 -07:00
Zach Riggle 4ae64db213 Fix vaddr_to_offset and offset_to_vaddr after the base address changes 2014-08-04 15:36:03 -07:00
Mathias Svensson 3b69b293cd Moved re import 2014-08-04 13:37:55 -07:00
Zach Riggle d168eaed40 Merge branch 'rop-easy' 2014-08-04 12:36:38 -07:00
Zach Riggle d0c71bd6e9 Slight syntax enhancement 2014-08-04 12:36:23 -07:00
Zach Riggle 43971132b1 Merge remote-tracking branch 'upstream/master'
Conflicts:
	pwnlib/elf.py
2014-08-04 12:34:36 -07:00
Zach Riggle 4751e8e473 easy rop gadget notation 2014-08-04 12:24:49 -07:00
Morten Brøns-Pedersen 4b7c13e873 updated example docstrings and README.md 2014-08-04 20:01:22 +02:00
Morten Brøns-Pedersen e53af0657f added script to generate examples/README.md and the new README.md 2014-08-04 19:56:01 +02:00
Mathias Svensson ab33cbe4c0 Merge branch 'zachriggle-elf-dont-load-dyn-dependencies' 2014-08-04 09:22:22 -07:00
Mathias Svensson 76817799fd Replaced a generic "except:" in elf.py with a catching a specific exception 2014-08-04 09:22:15 -07:00
Mathias Svensson 9d7858ad7d Merge branch 'elf-dont-load-dyn-dependencies' of https://github.com/zachriggle/pwntools into zachriggle-elf-dont-load-dyn-dependencies 2014-08-04 09:18:16 -07:00
Morten Brøns-Pedersen 90e7da6d31 fixed #60 -- this would not (could not) have happened in a statically typed language 2014-08-04 18:03:00 +02:00
Mathias Svensson f1d38959ca Merge branch 'master' of github.com:Gallopsled/pwntools
Conflicts:
	pwnlib/elf.py
2014-08-04 08:49:04 -07:00
Mathias Svensson e255e92dcf Merge branch 'zachriggle-v2-rop' 2014-08-04 08:47:16 -07:00
Mathias Svensson 149fc79f41 Fixed up the rop commit a bit 2014-08-04 08:47:05 -07:00
Mathias Svensson 846822b424 Merge branch 'v2-rop' of https://github.com/zachriggle/pwntools into zachriggle-v2-rop 2014-08-04 07:45:55 -07:00
IdolfHatler b0debef19d Merge pull request #61 from zachriggle/elf-dso-address-fix
Bugfix: ELF load address for DSO is 0, libc addresses now correct
2014-08-04 07:19:54 -07:00
Zach Riggle f18bca5112 Merge branch 'gdb-resolve-library-addresses' 2014-08-04 07:17:38 -07:00
IdolfHatler 107806f13a Merge pull request #58 from zachriggle/ssh-easy-bad-attrs
Filter a few things which should not spawn SSH commands
2014-08-04 07:17:19 -07:00
Zach Riggle 31330a653b Permit local running of gdb(), better support for ulimit, no reliance on "start" command in GDB or symbols 2014-08-04 07:17:11 -07:00
Mathias Svensson 0a2e37e3c6 Merge branch 'zachriggle-ssh-channel-with-statement' 2014-08-04 07:16:20 -07:00
Mathias Svensson e3fd4ceea7 Fixed the placement of the __enter__ and __exit__ functions in pwnlib/tubes/tube.py 2014-08-04 07:16:11 -07:00
Mathias Svensson a67b47a49e Merge branch 'ssh-channel-with-statement' of https://github.com/zachriggle/pwntools into zachriggle-ssh-channel-with-statement 2014-08-04 07:15:08 -07:00
Zach Riggle d92ce7ff2c Merge branch 'elf-dont-load-dyn-dependencies' 2014-08-04 07:14:09 -07:00
Mathias Svensson cc2540d72f Merge branch 'zachriggle-less-silent-ssh' 2014-08-04 07:13:54 -07:00
Mathias Svensson 5af54ddb9f The log_level argument was not needed here 2014-08-04 07:13:45 -07:00
Zach Riggle ca8b62414d Better fallback 2014-08-04 07:13:08 -07:00
Mathias Svensson 7dbdcd538d Merge branch 'less-silent-ssh' of https://github.com/zachriggle/pwntools into zachriggle-less-silent-ssh 2014-08-04 07:12:44 -07:00
IdolfHatler 1974282888 Merge pull request #56 from zachriggle/elf-disasm-vma
Add --vma-offset to asm.disasm() and ELF.disasm() helper to automate
2014-08-04 07:10:41 -07:00
IdolfHatler 33c48e54eb Merge pull request #63 from zachriggle/freebsd-ssh-cache
FreeBSD hash utility is called shasum
2014-08-04 07:08:17 -07:00
Zach Riggle c110726e43 Merge branch 'ssh-easy-bad-attrs' 2014-08-04 07:03:28 -07:00
Zach Riggle e46c9db477 Blacklist anything that starts with a _ 2014-08-04 07:01:59 -07:00
Zach Riggle c71a7436d2 Merge branch 'elf-repr'
Conflicts:
	pwnlib/elf.py
2014-08-04 06:49:27 -07:00
Zach Riggle be283273b0 Merge branch 'v2-rop' 2014-08-04 06:47:54 -07:00
Zach Riggle b3b9117cdb ROP repr 2014-08-04 06:45:59 -07:00
Zach Riggle ed85b85692 Make ELF repr meaningful for working in REPL 2014-08-04 06:42:38 -07:00
Zach Riggle 34d4a71235 Merge branch 'freebsd-ssh-cache' 2014-08-04 06:36:36 -07:00
Zach Riggle f952e9dd0f FreeBSD .so are not recognized as shared objects, so ldd throws an error. Since there's not really a need to check the dependencies of an .so (use-case is we loaded all the deps from an exe via ldd), don't do it. 2014-08-04 06:32:45 -07:00
Zach Riggle 03d42522a6 FreeBSD hash utility is called shasum. Others exist, but they dont put the hash first. 2014-08-04 06:29:54 -07:00
Zach Riggle accfe828c7 Merge branch 'gdb-resolve-library-addresses' 2014-08-04 05:49:00 -07:00
Zach Riggle b63794599f Merge branch 'ssh-channel-with-statement' 2014-08-04 05:48:54 -07:00
Zach Riggle 8565d0ff71 Move __enter__ and __exit__ to tubes.tube so it's available globally 2014-08-04 05:46:55 -07:00
Zach Riggle 666ef2ed62 GDB resolution for modules 2014-08-04 05:40:47 -07:00
Zach Riggle 1551706362 Merge branch 'elf-dso-address-fix'
Conflicts:
	pwnlib/elf.py
2014-08-04 04:30:23 -07:00
Zach Riggle 0e2f28892c Merge branch 'v2-rop' 2014-08-04 04:29:47 -07:00
Zach Riggle efb4be6c56 Bugfix: ELF load address for DSO is 0, libc addresses now correct 2014-08-04 04:28:29 -07:00
Zach Riggle 455e15d648 Bugfix: Permit both int and long 2014-08-04 04:26:12 -07:00
Zach Riggle 6f888bfe8a Merge branch 'v2-rop' 2014-08-04 03:24:22 -07:00
Zach Riggle b6272a809b Cache ROP gadgets for speed. Parsing libc is really slow. 2014-08-04 03:06:51 -07:00
Zach Riggle 705ca87d47 Merge branch 'v2-rop' 2014-08-04 02:49:06 -07:00
Zach Riggle 06a14cfdef Merge branch 'elf-disasm-vma' 2014-08-04 02:49:01 -07:00
Zach Riggle 3217ff98c9 Merge branch 'less-silent-ssh' 2014-08-04 02:48:54 -07:00
Zach Riggle 0b26375619 Merge branch 'ssh-easy-bad-attrs' 2014-08-04 02:48:48 -07:00
Zach Riggle 4a13eb03fc Merge branch 'ssh-channel-with-statement' 2014-08-04 02:48:39 -07:00
Zach Riggle 5220490f8d Allow "with" on ssh_channel/ssh.run 2014-08-04 02:10:46 -07:00
Zach Riggle 3a139cff75 Filter a few things which should not spawn SSH commands 2014-08-04 01:14:36 -07:00
Zach Riggle 019c3b33db ssh.foo and ssh['foo'] were accidentally silcening output from commands (e.g. 'opening new channel', 'receiving all data') 2014-08-04 00:12:13 -07:00
Morten Brøns-Pedersen 338014f77b bugfix: default value for argument sock in pwnlib.shellcraft.i386.linux.dupsh() changed from None to 'ebp'. 2014-08-04 09:07:28 +02:00
Zach Riggle f9c3f64319 Fix typo 2014-08-03 23:56:43 -07:00
Zach Riggle 4690339b48 Add --vma-offset to asm.disasm() and ELF.disasm() helper to automate 2014-08-03 23:50:28 -07:00
Zach Riggle c558b53ffa Docs and small fixes 2014-08-03 23:13:25 -07:00
Zach Riggle 9324ef2af4 ROP rewritten to use new ELF stuff, and ropgadget/capstone 2014-08-03 23:13:25 -07:00
Morten Brøns-Pedersen b3ec35797c removed circular import in pwnlib.term.key/keymap 2014-08-04 02:11:12 +02:00
Morten Brøns-Pedersen 62dc5d0a39 removed accidental self-import 2014-08-04 02:11:12 +02:00
Mathias Svensson 97fe8e6491 Added ulimit -s unlimited to the places where we called ldd 2014-08-03 16:25:53 -07:00
Mathias Svensson 1ed9199a41 Fixed doctests 2014-08-03 16:25:02 -07:00
Mathias Svensson d61d1453fa Fixed mistake in the merge 2014-08-03 15:58:18 -07:00
Mathias Svensson 76485c6456 Merge branch 'zachriggle-ldd-universal' 2014-08-03 15:53:00 -07:00
Mathias Svensson b05017ee19 Merge branch 'ldd-universal' of https://github.com/zachriggle/pwntools into zachriggle-ldd-universal
Conflicts:
	pwnlib/tubes/ssh.py
2014-08-03 15:52:51 -07:00
Mathias Svensson eb06d4120c Merge branch 'zachriggle-ssh-easy-pwn2' 2014-08-03 15:13:40 -07:00
Mathias Svensson fcd7a013a6 Fixed up the ssh getattr/getitem a bit 2014-08-03 15:13:22 -07:00
Mathias Svensson ccd541fbe6 Merge branch 'ssh-easy-pwn2' of https://github.com/zachriggle/pwntools into zachriggle-ssh-easy-pwn2 2014-08-03 14:17:01 -07:00
Zach Riggle 8592c0b0de Implement #38 for pwn v2 2014-08-03 14:01:13 -07:00
Mathias Svensson 7b35fada6a Updated ssh_gdb to user port 0, so any free port is chosen. Also updated the example 2014-08-03 13:33:30 -07:00
Mathias Svensson 6f10e75c9b Updated remote_gdb_debugging.py example 2014-08-03 12:15:14 -07:00
Morten Brøns-Pedersen eaf1551a7f changed keyword argument non_writable to writable in pwnlib.elf.search(). also changed the default behaviour and updated the docstring 2014-08-03 20:55:02 +02:00
Mathias Svensson c7ef29b4c1 Another bug 2014-08-03 11:16:59 -07:00
Morten Brøns-Pedersen 13d5a4a090 introduced a lock in pwnlib.log to ensure that different logging messages don't get interleaved 2014-08-03 20:07:27 +02:00
Mathias Svensson 25bfae5e05 Fixed bug with the getattr of the listeners 2014-08-03 11:06:39 -07:00
Mathias Svensson 91f88daf8c Added gdb.ssh_gdb and fixed a few bugs, primarily with ctrl-c being ignored 2014-08-03 10:15:35 -07:00
Mathias Svensson d138174890 Made call to the constructors of the listeners non-blocking 2014-08-03 10:15:35 -07:00
Morten Brøns-Pedersen 85a5ceefb5 pwnlib.tubes.tube.clean_and_log() is now a no-op if the tube is not connected 2014-08-03 18:23:24 +02:00
Morten Brøns-Pedersen 7db0b6709f bugfix: when not in term_mode pwnlib.log.indented() mixed writing to sys.stdout and sys.stderr 2014-08-03 08:30:41 +02:00
Morten Brøns-Pedersen 88c957b3a4 updated/removed many examples 2014-08-03 08:29:47 +02:00
Morten Brøns-Pedersen 877388811d example: simple port forwarder 2014-08-03 07:12:29 +02:00
Morten Brøns-Pedersen 0bf988eb39 fixed typo in docstring for pwnlib.tubes.tube.connect_both() 2014-08-03 06:59:17 +02:00
Morten Brøns-Pedersen eb4199fdea updated docstrings for pwnlib.atexit.register() and pwnlib.atexception.register() 2014-08-03 06:54:25 +02:00
Morten Brøns-Pedersen 4573742522 pwnlib.atexception.register() and pwnlib.atexit.register() can now be used as decorators 2014-08-03 06:42:16 +02:00
Morten Brøns-Pedersen 43a46d34e9 added an example showing a use case for pwnlib.tubes.tube.clean_and_log 2014-08-03 05:46:24 +02:00
Morten Brøns-Pedersen 8a05319f58 added pwnlib.tubes.tube.clean_and_log() 2014-08-03 05:46:24 +02:00
Morten Brøns-Pedersen 1b5bfe89d9 added modules pwnlib.atexit and pwnlib.atexception 2014-08-03 05:46:24 +02:00
Mathias Svensson 1a9687a917 Added documentation for ssh forwards 2014-08-02 20:39:28 -07:00
Mathias Svensson 1bffb5a986 Fixed sh_string and its documentation a bit 2014-08-02 20:36:50 -07:00
Mathias Svensson 8b975b2fb7 Added support for ssh port forwards in both directions 2014-08-02 20:30:51 -07:00
Mathias Svensson 652e7b4e36 Merge branch 'zachriggle-ssh-working-dir' 2014-08-02 18:00:11 -07:00
Mathias Svensson 8afebd1c9e Fixed up the pull request a bit 2014-08-02 17:58:40 -07:00
Zach Riggle b126f02851 Newline at OEF 2014-08-02 17:58:40 -07:00
Zach Riggle 36c56143e1 Fix incorrect doc 2014-08-02 17:58:40 -07:00
Zach Riggle de67736650 Squelch output from bad working directories; set_working_directory shows a warning 2014-08-02 17:58:40 -07:00
Zach Riggle c66d1ffcf2 No need for old_wd now that we "cd foo;" vs "cd foo &&" 2014-08-02 17:58:40 -07:00
Zach Riggle 413ee34750 Permit wd= arguments for run and run_to_end 2014-08-02 17:58:40 -07:00
Zach Riggle f2b2cfcbfc Move prepending 'cd %r' into the ssh_channel after the command has been printed, to prevent cluttering the screen 2014-08-02 17:58:40 -07:00
Zach Riggle f95c7bf9c9 Introduce ssh.set_working_directory 2014-08-02 17:58:40 -07:00
Mathias Svensson fa0f221533 Fixed up the pull request a bit 2014-08-02 17:57:34 -07:00
Mathias Svensson 7086ab2c77 Merge branch 'ssh-working-dir' of https://github.com/zachriggle/pwntools into zachriggle-ssh-working-dir 2014-08-02 17:35:45 -07:00
IdolfHatler f94aed066f Merge pull request #54 from zachriggle/mindfuck
Add <> for tubes, fix typo
2014-08-02 17:22:53 -07:00
Mathias Svensson 60910fb161 Minor optimizations to the tubes module 2014-08-02 17:22:01 -07:00
Morten Brøns-Pedersen c287b098a9 changed command line option from NOINFO to SILENT 2014-08-03 01:19:22 +02:00
Zach Riggle 576c2fe739 Add <> for tubes, fix type 2014-08-02 16:04:25 -07:00
Mathias Svensson 7a5ba94447 Fixed listen and added connect_* methods to tubes 2014-08-02 14:58:03 -07:00
Zach Riggle 1466c2e470 Newline at OEF 2014-08-02 14:37:52 -07:00
Zach Riggle 8d6188d1c2 Fix incorrect doc 2014-08-02 14:36:39 -07:00
Zach Riggle ae851c53c0 Squelch output from bad working directories; set_working_directory shows a warning 2014-08-02 14:36:02 -07:00
Zach Riggle 347d5ff08f No need for old_wd now that we "cd foo;" vs "cd foo &&" 2014-08-02 14:33:30 -07:00
Zach Riggle da60af4729 Permit wd= arguments for run and run_to_end 2014-08-02 14:28:05 -07:00
Zach Riggle 377e43689b Move prepending 'cd %r' into the ssh_channel after the command has been printed, to prevent cluttering the screen 2014-08-02 14:23:47 -07:00
Zach Riggle 12a2954770 Introduce ssh.set_working_directory 2014-08-02 14:19:28 -07:00
IdolfHatler 713eee3085 Merge pull request #52 from zachriggle/patch-5
Typo
2014-08-02 14:10:42 -07:00
Mathias Svensson df6192bc15 Made _raw_sh_string from tubes.ssh public and put it into util.misc 2014-08-02 14:09:47 -07:00
Zach Riggle b0cb561b94 Typo 2014-08-02 17:02:25 -04:00
Zach Riggle 45dee58e23 Single point for ldd, male ELF.libs and SSH.libs return consistent output of {full local path: ldd address} 2014-08-02 12:51:35 -07:00
Mathias Svensson 5e4b0d7cc6 Fixed typo 2014-08-02 11:36:08 -07:00
Mathias Svensson a4b6e886ca Fixed #48 2014-08-02 11:21:25 -07:00
Mathias Svensson e7b2552b1e Better links on readthedocs 2014-08-02 10:30:58 -07:00
Mathias Svensson 9c950d66cd Some more readthedocs 2014-08-02 10:21:23 -07:00
Mathias Svensson 82b22629cd Fixed #46 2014-08-02 08:17:59 -07:00
Mathias Svensson 37a2ad91cd version bump to 2.1.3 -- I really should have included this in 2.1.2 2014-08-02 00:13:42 -07:00
Mathias Svensson e2540c9f80 More readthedocs testing 2014-08-02 00:10:33 -07:00
Mathias Svensson 914b94131e Added the file docs/requirements.txt as a test for readthedocs 2014-08-02 00:08:32 -07:00
Robert Larsen 934b1d9112 Fixed arm targets. 2014-06-17 10:42:09 +02:00
Robert Larsen ce17e10f7e Added processor specific targets. Also targets for arm. 2014-06-17 10:39:59 +02:00
Robert Larsen 122530b874 Begin by making tarkets 2014-06-17 10:25:55 +02:00
Robert Larsen f9e7437e26 Added script that tests all targets.
Build non PIE binaries.
2014-06-17 10:21:06 +02:00
Robert Larsen 13c2aae045 Fixed regression. 2014-06-16 22:51:38 +02:00
Robert Larsen 5300a350c4 link_map can be found in both .got and .got.plt so if one is missing try
the other.
2014-05-27 15:43:46 +02:00
1413 changed files with 196434 additions and 17066 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
pwnlib/data/* linguist-vendored
+14
View File
@@ -0,0 +1,14 @@
# Pwntools Issue Template
Thanks for contributing to Pwntools!
When reporting an issue, be sure that you are running the latest released version of pwntools (`pip install --upgrade pwntools`).
Please verify that your issue occurs on 64-bit Ubuntu 14.04. You can use the Dockerfile on `docker.io` for quick testing.
```
$ docker pull pwntools/pwntools:stable
$ docker run -it pwntools/pwntools:stable
```
If possible, provide a proof-of-concept which demonstrates the problem. Include any binaries or scripts necessary to reproduce the issue, and please include the full debug output via setting the environment variable `PWNLIB_DEBUG=1`.
+54
View File
@@ -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 22.04. We provide a Dockerfile based on Ubuntu 22.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
View File
@@ -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 exist
* 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
View File
@@ -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.
+32
View File
@@ -0,0 +1,32 @@
# Pwntools Pull Request
Thanks for contributing to Pwntools! Take a moment to look at [`CONTRIBUTING.md`][contributing] to make sure you're familiar with Pwntools development.
Please provide a high-level explanation of what this pull request is for.
## Testing
Pull Requests that introduce new code should try to add doctests for that code. See [`TESTING.md`][testing] for more information.
## Target Branch
Depending on what the PR is for, it needs to target a different branch.
You can always [change the branch][change] after you create the PR if it's against the wrong branch.
| Branch | Type of PR |
| -------- | ---------------------------------------------------------------- |
| `dev` | New features, and enhancements
| `dev` | Documentation fixes and new tests
| `stable` | Bug fixes that affect the current `stable` branch
| `beta` | Bug fixes that affect the current `beta` branch, but not `stable`
| `dev` | Bug fixes for code that has never been released
[contributing]: https://github.com/Gallopsled/pwntools/blob/dev/CONTRIBUTING.md
[testing]: https://github.com/Gallopsled/pwntools/blob/dev/TESTING.md
[change]: https://github.com/blog/2224-change-the-base-branch-of-a-pull-request
## Changelog
After creating your Pull Request, please add and push a commit that updates the changelog for the appropriate branch.
You can look at the existing changelog for examples of how to do this.
+8
View File
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
+70
View File
@@ -0,0 +1,70 @@
name: Android Tests
on: [push, pull_request]
jobs:
android-test:
strategy:
matrix:
python-version: ['3.10']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
**/pyproject.toml
**/requirements*.txt
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \
gdb gdbserver socat \
qemu-user-static \
binutils-aarch64-linux-gnu \
binutils-arm-linux-gnueabihf \
libc6-dbg
- name: Cache for avd
uses: actions/cache@v4
id: cache-avd
with:
path: |
~/.android
/usr/local/lib/android/sdk/emulator
/usr/local/lib/android/sdk/platform-tools
/usr/local/lib/android/sdk/system-images
key: ${{ matrix.os }}-cache-avd-${{ hashFiles('travis/setup_avd*.sh') }}
restore-keys: |
${{ matrix.os }}-cache-avd-
- name: Install Android AVD
run: |
sudo usermod -aG kvm $USER
source travis/setup_avd_fast.sh
sed -i 's/skip_android = True/skip_android = False/' docs/source/conf.py
set | grep ^PATH >.android.env
- name: Install dependencies
run: |
pip install --upgrade pip
python setup.py egg_info
pip install --upgrade --editable .
- name: Sanity checks
run: PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
- name: Install documentation dependencies
run: pip install -r docs/requirements.txt
- name: Coverage Doctests (Android Only)
run: |
source .android.env
PWNLIB_NOTERM=1 coverage run -m sphinx -b doctest docs/source docs/build/doctest docs/source/adb.rst
+33
View File
@@ -0,0 +1,33 @@
name: Changelog
on:
pull_request:
paths:
- pwnlib/**
- pwn/**
env:
GITHUB_BASE: origin/${{ github.event.pull_request.base.ref }}
jobs:
check:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check changelog for updates
run: |
if git log --stat ${GITHUB_BASE}..HEAD | grep CHANGELOG.md; then
echo 'Changelog updated :D'
else
if git log --stat ${GITHUB_BASE}..HEAD pwnlib pwn | grep '++\|--'; then
echo 'Major changes detected, changelog required!'
false
else
echo 'Minor changes detected, no changelog required!'
fi
fi
+355
View File
@@ -0,0 +1,355 @@
name: Continuous Integration
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
python_version: ['3.10', '3.12', '3.13', '3.14', '3.15']
os: [ubuntu-latest]
include:
- python_version: '2.7'
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
timeout-minutes: 30
services:
libcdb-cache:
image: nginx
volumes:
- /home/runner/libcdb-cache:/var/cache/nginx
ports:
- 3000:3000 # https://debuginfod.elfutils.org proxy cache
- 3001:3001 # https://libc.rip/ proxy cache
- 3002:3002 # http://archive.ubuntu.com/ proxy cache
- 3003:3003 # https://gitlab.com/ proxy cache
- 3004:3004 # https://debuginfod.ubuntu.com/ proxy cache
env:
DEBUGINFOD_URLS: "http://localhost:3000/ http://localhost:3004/"
PWN_LIBCRIP_URL: http://localhost:3001/
PWN_UBUNTU_ARCHIVE_URL: http://localhost:3002/
PWN_GITLAB_LIBCDB_URL: http://localhost:3003/
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 20
- name: Git History
run: |
git fetch origin
git log --oneline --graph -10
- name: Fix libcdb-cache permissions
id: fix-perms
run: |
sudo chown -R runner:runner /home/runner/libcdb-cache
echo "date=$(/bin/date -u "+%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT
- name: Cache for libcdb requests
uses: actions/cache@v4
with:
path: ~/libcdb-cache
key: libcdb-python${{ matrix.python_version }}-${{ steps.fix-perms.outputs.date }}
restore-keys: |
libcdb-python${{ matrix.python_version }}-
libcdb-
- name: Install libcdb-cache service config
run: |
sudo chown -R 101:101 /home/runner/libcdb-cache
container_id=$(docker ps --all --filter volume=/home/runner/libcdb-cache --no-trunc --format "{{.ID}}")
docker cp ./travis/libcdb_nginx_cache.conf $container_id:/etc/nginx/nginx.conf
docker restart $container_id
- name: Install RPyC for gdb
run: |
# The version packaged in python3-rpyc is too old on Ubuntu 24.04
# We use ^6.0 from pip.
sudo apt-get update && sudo apt-get install -y python3-pip gdb gdbserver
/usr/bin/python -m pip install --break-system-packages rpyc || /usr/bin/python -m pip install rpyc
gdb --batch --quiet --nx --nh --ex 'py import rpyc; print(rpyc.version.version)'
- name: Cache for pip
uses: actions/cache@v4
if: matrix.python_version == '2.7'
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-${{ matrix.python_version }}-cache-pip-${{ hashFiles('**/pyproject.toml', '**/requirements*.txt') }}
restore-keys: ${{ matrix.os }}-${{ matrix.python_version }}-cache-pip-
- name: Set up Python ${{ matrix.python_version }}
if: matrix.python_version != '2.7'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
cache: 'pip'
cache-dependency-path: |
**/pyproject.toml
**/requirements*.txt
- name: Set up Python 2.7
if: matrix.python_version == '2.7'
run: |
sudo apt-get update
sudo apt-get install -y \
python2.7 python2.7-dev python2-pip-whl
sudo ln -sf python2.7 /usr/bin/python
export PYTHONPATH=`echo /usr/share/python-wheels/pip-*py2*.whl`
sudo --preserve-env=PYTHONPATH python -m pip install --upgrade pip setuptools wheel
sudo chown -R $USER /usr/local/lib/python2.7
- name: Verify tag against version
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
env:
GITHUB_REF: ${{ github.event.ref }}
run: |
set -x
GITHUB_TAG=${GITHUB_REF#refs/tags/}
echo "$GITHUB_TAG" | grep -E '^[0-9.]*(beta[0-9])?$'
vsetup=$(grep -o "version\\s*=\\s*[\"'].*[\"'],$" setup.py | grep -o "[0-9][^\"']*")
vpwnlib=$(grep -o "__version__\\s*=\\s*[\"'].*[\"']$" pwnlib/version.py | grep -o "[0-9][^\"']*")
[ "$vsetup" = "$vpwnlib" ]
[ "$GITHUB_TAG" = "$vsetup" ]
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \
ash bash-static dash ksh mksh zsh \
gdb gdbserver socat \
binutils-multiarch qemu-user-static \
binutils-aarch64-linux-gnu \
binutils-arm-linux-gnueabihf \
binutils-mips-linux-gnu \
binutils-mipsel-linux-gnu \
binutils-msp430 \
binutils-powerpc-linux-gnu \
binutils-s390x-linux-gnu \
binutils-sparc64-linux-gnu \
binutils-riscv64-linux-gnu \
gcc-multilib \
libc6-dbg \
elfutils \
patchelf
- name: Testing Corefiles
run: |
ulimit -a
ulimit -c unlimited
cat /proc/sys/kernel/core_pattern
cat /proc/sys/kernel/core_uses_pid
( cd $(mktemp -d); sh -c 'kill -11 $$' || true; ls -la ./*core* /var/crash/*.crash /var/lib/apport/coredump/core*) || true
- name: Set up SSH
run: |
travis/ssh_setup.sh
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade wheel build
pip install --upgrade flake8 appdirs
pip install --upgrade --editable .
# Pin to known working version until 2.1.5 is out. https://github.com/unicorn-engine/unicorn/issues/2134
pip install 'unicorn==2.1.2'
- name: Sanity checks
run: PWNLIB_NOTERM=1 python -bb -c 'from pwn import *; print(pwnlib.term.term_mode)'
- name: Install documentation dependencies
run: pip install -r docs/requirements.txt
- name: Manually install non-broken Unicorn
if: matrix.python_version == '2.7'
run: pip install unicorn==2.0.0rc7
- name: Disable yama ptrace_scope
run: |
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope # required by some gdb doctests
- name: Coverage doctests
run: |
# Python version installed using setup-python interferes with gdb's python
# by setting LD_LIBRARY_PATH and gdb's python becoming unable to load built-in modules
# like _socket. This is a workaround.
unset LD_LIBRARY_PATH
PWNLIB_NOTERM=1 python -bb -m coverage run -m sphinx -b doctest docs/source docs/build/doctest
- name: Coverage running examples
run: |
export TERM=linux
set -x
python -bb travis/coverage_chdir.py examples/fmtstr examples/fmtstr/exploit.py
python -bb travis/coverage_chdir.py examples/fmtstr examples/fmtstr/exploit2.py || : # can fail randomly?
python -bb -m coverage run examples/asm.py
python -bb -m coverage run examples/asm.py
python -bb -m coverage run examples/text.py
# for f in examples/sigreturn_corefile_*.py; do coverage run "$f"; done # XXX something is wrong
- name: Coverage running commandline tools
run: |
export TERM=linux
pwn() { ( set +x; cmd=$1; shift; PYTHONUNBUFFERED=1 exec python -bb -m coverage run -m pwnlib.commandline."$cmd" "$@" ) }
set -x
pwn cyclic 32
pwn cyclic -l 0x62616161
pwn cyclic -a ab
echo
pwn shellcraft --list |tail
pwn shellcraft -l --syscalls |tail
pwn shellcraft -l execve
pwn shellcraft -l execve + exit
pwn shellcraft --show i386.linux.loader_append
pwn shellcraft --show i386.linux.loader_append + i386.linux.sh
pwn shellcraft -f asm --color amd64.linux.sh
pwn shellcraft -f asm --color amd64.linux.setreuid + amd64.linux.cat /etc/passwd
pwn shellcraft -f asm --color amd64.linux.setreuid = amd64.linux.cat /key+secret --delim =
pwn shellcraft -f elf amd64.linux.syscalls.exit 0 </dev/null |pwn hex
pwn shellcraft -f elf amd64.linux.cat /etc/passwd + amd64.linux.syscalls.exit 0 </dev/null |pwn hex
pwn shellcraft -f i --color amd64.linux.cat /etc/passwd </dev/null
pwn shellcraft -f i --color amd64.linux.cat /etc/passwd + amd64.linux.sh </dev/null
pwn shellcraft -f c amd64.linux.syscalls.exit 0 </dev/null
pwn shellcraft -f c amd64.linux.cat /etc/passwd + amd64.linux.syscalls.exit 0 </dev/null
pwn shellcraft -f str aarch64.linux.sh </dev/null
pwn shellcraft -abr -f elf -o /dev/null amd64.linux.cat /etc/passwd </dev/null
pwn shellcraft -nzr thumb.linux.syscalls.execve /bin/cat '["/bin/cat", "/etc/os-release"]' </dev/null
pwn shellcraft -fp aarch64.trap
pwn disasm --color ff3424c3ebfe
pwn asm -f hex nop
pwn hex ABCD
pwn hex ABCD --separator ' '
pwn hex ABCD --prefix '\x'
pwn hex ABCD -p '0x' -s ' '
pwn hex abcd
pwn unhex 4141 4141
cat /dev/urandom | pwn phd --color -c 256 -s 2
pwn phd -l 0x3d --color=always /etc/os-release
pwn checksec /bin/bash
(ulimit -v 500000 && pwn checksec /bin/bash)
pwn errno 2
pwn errno -1
pwn errno EADDRINUSE
pwn constgrep -c freebsd -m ^PROT_ '3 + 4'
pwn constgrep ^MAP_ 0
pwn constgrep -e O_RDWR
pwn constgrep C
pwn libcdb file /lib/x86_64-linux-gnu/libc.so.6
pwn libcdb lookup puts 5f0 __libc_start_main_ret d0a
pwn libcdb hash b229d1da1e161f95e839cf90cded5f719e5de308
- name: Build source and wheel distributions
if: matrix.python_version != '2.7'
run: |
python -m build
- uses: actions/upload-artifact@v4
if: matrix.python_version == '3.10'
with:
name: packages
path: dist/
include-hidden-files: true
- uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python_version }}
path: .coverage*
include-hidden-files: true
- name: Fix libcdb-cache permissions
run: |
container_id=$(docker ps --filter volume=/home/runner/libcdb-cache --no-trunc --format "{{.ID}}")
docker stop $container_id
sudo chown -R runner:runner /home/runner/libcdb-cache
windows-test:
runs-on: windows-latest
timeout-minutes: 30
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade --editable .
- name: Sanity checks
run: |
python -bb -c 'from pwn import *'
python -bb examples/text.py
upload-coverage:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 20
- uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true
- name: Install coveralls
run: |
pip install --break-system-packages tomli coveralls || pip install tomli coveralls
- name: Upload coverage to coveralls.io
run: |
coverage combine
COVERALLS_REPO_TOKEN=PP20MEgztXIQJJTguQwe2jeCh6Bm4lkbv coveralls
staging-merge:
runs-on: ubuntu-latest
if: github.repository_owner == 'Gallopsled' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/heads/') && endsWith(github.event.ref, '-staging')
needs: test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 20
- name: Push changes to protected branch
env:
GITHUB_REF: ${{ github.event.ref }}
run: |
BRANCH=${GITHUB_REF#refs/heads/}
TARGET=${BRANCH%-staging}
git branch -f "$TARGET"
git push origin "$TARGET"
git push origin --delete "$BRANCH"
pypi:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
permissions:
id-token: write
needs: test
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: packages
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- if: failure()
run: ls -R
+64
View File
@@ -0,0 +1,64 @@
name: Publish Docker images
on:
push:
branches:
- dev
- beta
- stable
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository_owner == 'Gallopsled'
steps:
# Required for subdirectories in Git context
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push base image
uses: docker/build-push-action@v6
if: github.event_name == 'workflow_dispatch'
with:
context: "{{defaultContext}}:extra/docker/base"
push: true
tags: pwntools/pwntools:base
- name: Build and push stable image
uses: docker/build-push-action@v6
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/stable')
with:
context: "{{defaultContext}}:extra/docker/stable"
push: true
tags: pwntools/pwntools:stable
- name: Build and push beta image
uses: docker/build-push-action@v6
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/beta')
with:
context: "{{defaultContext}}:extra/docker/beta"
push: true
tags: pwntools/pwntools:beta
- name: Build and push dev image
uses: docker/build-push-action@v6
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/dev')
with:
context: "{{defaultContext}}:extra/docker/dev"
push: true
tags: |
pwntools/pwntools:dev
pwntools/pwntools:latest
- name: Build and push ci image
uses: docker/build-push-action@v6
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/dev')
with:
context: "{{defaultContext}}:travis/docker"
push: true
tags: pwntools/pwntools:ci
+33
View File
@@ -0,0 +1,33 @@
name: Lint
on: [push, pull_request]
jobs:
lint:
strategy:
matrix:
python-version: ['3.10']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
**/pyproject.toml
**/requirements*.txt
- name: Critical lint
run: |
pip install flake8
flake8 . --count --select=E9,F63,F7,E71 --show-source --statistics --exclude=android-?dk # TODO: Add F82
- name: Style lint
run: |
flake8 pwnlib setup.py docs travis --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 examples --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore='F403,F405'
flake8 pwn --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore='F401,F403,F405'
+30
View File
@@ -0,0 +1,30 @@
name: Check for merge markers
on:
pull_request:
types: [synchronize]
env:
GITHUB_BASE: origin/${{ github.event.pull_request.base.ref }}
jobs:
mergecheck:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for merge conflict markers commited
run: |
if git show ${GITHUB_BASE}..HEAD | grep -EB15 --color=always '^\+\+(>>>>>|=====|<<<<<)'; then
echo 'WARNING: Merge marker commits found in history.'
if git diff ${GITHUB_BASE}..HEAD | grep -EB15 --color=always '^\+(>>>>>|=====|<<<<<)'; then
echo 'ERROR: Merge markers still present! Do something!'
exit 1
fi
else
echo 'Congrats! All the merges you did were clean or resolved correctly :)'
fi
+36
View File
@@ -0,0 +1,36 @@
name: PyLint
on: [pull_request]
jobs:
build:
strategy:
matrix:
python-version: ['3.10']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
**/pyproject.toml
**/requirements*.txt
- name: PyLint
run: |
set -x
pip install 'pylint<4'
pip install --upgrade -e .
run_pylint() { pylint --exit-zero --errors-only pwnlib -f parseable | cut -d ' ' -f2- | sed 's/line [0-9]\+/line XXXX/g'; }
run_pylint > current.txt
git fetch origin
git checkout origin/"$GITHUB_BASE_REF"
run_pylint > base.txt
if diff base.txt current.txt | grep '>'; then
false
fi
+14 -1
View File
@@ -2,10 +2,23 @@
*.hi
*.pyc
*~
*.swp
.ropeproject
*.pdf
*/auto/*
*/bin/*
docs/build
build
MANIFEST
dist
pwntools.egg-info
venv
.vscode
.idea
*.egg-info
*.core
.coverage
.coverage.*
.idea
__pycache__
!.github
.DS_Store
+4
View File
@@ -0,0 +1,4 @@
[settings]
indent=' '
not_skip = __init__.py
force_single_line = 1
+15
View File
@@ -0,0 +1,15 @@
# https://docs.readthedocs.io/en/stable/config-file/v2.html
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.12"
sphinx:
configuration: docs/source/conf.py
python:
install:
- requirements: docs/requirements.txt
+7
View File
@@ -0,0 +1,7 @@
{
"default_encoding": "UTF-8",
"ensure_newline_at_eof_on_save": true,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true
}
+1381
View File
File diff suppressed because it is too large. Load diff
+35
View File
@@ -0,0 +1,35 @@
# Contributing
Github has a great guide for contributing to open source projects:
- [Contributing to a project](https://guides.github.com/activities/forking/)
- [Fork the repository](https://guides.github.com/activities/forking/#fork)
- [Clone your fork](https://guides.github.com/activities/forking/#clone)
- [Making and pushing changes](https://guides.github.com/activities/forking/#making-changes)
- [Making a Pull Request](https://guides.github.com/activities/forking/#making-a-pull-request)
- [Huzzah!](https://guides.github.com/activities/forking/#huzzah)
## pwntools Specifics
In general, we like to keep things documented. You should add documentation to any new functionality, and update it for any changed functionality. Our docstrings use the [Google Style Python Docstrings](https://sphinxcontrib-napoleon.readthedocs.org/en/latest/example_google.html#example-google).
After you have documentation, you should add a [doctest](https://docs.python.org/2/library/doctest.html).
Finally, it is probably a good idea to run the test suite locally before doing
the pull-request to make sure everything works, however this is not a
requirement.
Once you are ready to do a pull-request, you should figure out if your changes
constitutes a new feature or a bugfix in stable or beta. If it is a bugfix in
stable or beta, you should do the pull-request against the branch in question,
and otherwise your pull-request should be against the dev branch.
Once you do the pull-request Travis CI will run the test-suite on it. Once it
passes one of the core developers will look at your pull request, possibly
comment on it and then hopefully merge it into the branch in question.
## Automated Testing
Pull requests against Pwntools require at a minimum that no tests have been broken, and ideally each pull request will include new tests to ensure that all of the functionality works as intended.
You can find more information on testing in [TESTING.md](TESTING.md).
+76
View File
@@ -0,0 +1,76 @@
# Using Pwntools with Docker
Sometimes it's annoying to set up Pwntools on your workstation, and you want something that Just Works (TM).
[Docker](https://www.docker.com/) is here to the rescue! Using Docker means that you get a nice, standardized Linux environment and don't need to worry about pip or installing dependencies.
## Quick Start
First, install Docker for your OS, which you can find on their [Getting Started](https://www.docker.com/get-started) page.
Next, download and run the Pwntools stable docker image.
```sh
$ docker run -it pwntools/pwntools:stable
```
## Recommended Settings
In order to get the most from your docker image, we need to enable debugging of processes (`--privileged`) and expose the network ports from the guest to the host (`--net=host`).
```sh
$ docker run -it \
--privileged \
--net=host \
--hostname localhost \
--ulimit core=-1:-1 \
pwntools/pwntools:stable
```
## Sharing a Folder
It's really nice to be able to use your preferred native editor, and have the changes show up live inside your Docker image. This is easy to add, thanks to Docker's bind mounts (`--mount type=bind`).
With the command below, your `~/exploits` directory will magically show up inside the Docker image at `/home/pwntools/exploits` so that you can easily run them (from Docker) and edit them (from outside Docker).
```sh
$ mkdir $HOME/exploits
$ vim $HOME/exploits/my_exploit.py
$ docker run -it \
--privileged \
--net=host \
--hostname localhost \
--ulimit core=-1:-1 \
--mount type=bind,source="$HOME/exploits",target=/home/pwntools/exploits \
pwntools/pwntools:stable
$ python3 exploits/my_exploit.py
```
### Windows User Bind Mounts
If you're a Windows user `$HOME` doesn't exist in the same way as on Linux, instead it is `%UserProfile%`. The command from above would look like this, assuming your editor is Visual Studio Code and you have code.exe in your `%PATH%`.
```sh
C:\Users\user> mkdir Desktop\exploits
C:\Users\user> code Desktop\exploits\my_exploit.py
C:\Users\user> docker run -it \
--privileged \
--net=host \
--hostname localhost \
--ulimit core=-1:-1 \
--mount type=bind,source="%UserProfile%\Desktop\exploits",target=/home/pwntools/exploits \
pwntools/pwntools:stable
$ python3 exploits/my_exploit.py
```
+1 -1
View File
@@ -13,7 +13,7 @@ directories:
- pwnlib/data/
Copyright (c) 2013 Gallopsled
Copyright (c) 2015 Gallopsled et al.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+9 -1
View File
@@ -1 +1,9 @@
include *.txt
graft build
graft examples
graft extra
graft travis
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__ *.mako
recursive-include pwn *.py *.asm *.rst *.md *.txt *.sh
global-exclude *.pyc
+41 -24
View File
@@ -1,38 +1,55 @@
# Introduction
# pwntools - CTF toolkit
![pwntools logo](https://github.com/Gallopsled/pwntools/blob/stable/docs/source/logo.png?raw=true)
This is the CTF framework used by Gallopsled in every CTF.
[![PyPI](https://img.shields.io/pypi/v/pwntools?style=flat)](https://pypi.python.org/pypi/pwntools/)
[![Docs](https://readthedocs.org/projects/pwntools/badge/?version=stable)](https://docs.pwntools.com/)
[![GitHub Workflow Status (dev)](https://img.shields.io/github/actions/workflow/status/Gallopsled/pwntools/ci.yml?branch=dev&logo=GitHub)](https://github.com/Gallopsled/pwntools/actions/workflows/ci.yml?query=branch%3Adev)
[![Coveralls](https://img.shields.io/coveralls/github/Gallopsled/pwntools/dev?logo=coveralls)](https://coveralls.io/github/Gallopsled/pwntools?branch=dev)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/)
[![Packaging status](https://img.shields.io/repology/repositories/python:pwntools)](https://repology.org/project/python:pwntools/versions)
[![Discord](https://img.shields.io/discord/809590285687980052?label=Discord&style=plastic)](https://discord.gg/96VA2zvjCB)
[![Twitter](https://img.shields.io/twitter/follow/Pwntools)](https://twitter.com/pwntools)
Most code is inside the pwnlib folder with some functionality inside pwn or
bin. It is typically used as:
Pwntools is a CTF framework and exploit development library. Written in Python, it is designed for rapid prototyping and development, and intended to make exploit writing as simple as possible.
```python
from pwn import *
context(arch = 'i386', os = 'linux')
# EXPLOIT HERE
r = remote('exploitme.example.com', 31337)
# EXPLOIT CODE GOES HERE
r.send(asm(shellcraft.sh()))
r.interactive()
```
However we have made command-line frontends for some of the functionality
inside the pwnlib. These are:
* `asm`/`disasm`: Small wrapper for various assemblers
* `constgrep`: Tool for finding constants defined in header files
* `cyclic`: De Bruijn sequence generator and lookup tool
* `hex`/`unhex`: Command line tools for doing common hexing/unhexing operations
* `shellcraft`: Frontend to our shellcode
# Documentation
Our documentation is available on http://pwntools.readthedocs.org/
Our documentation is available at [docs.pwntools.com](https://docs.pwntools.com/)
A series of tutorials is also [available online](https://github.com/Gallopsled/pwntools-tutorial#readme)
To get you started, we've provided some example solutions for past CTF challenges in our [write-ups repository](https://github.com/Gallopsled/pwntools-write-ups).
# Installation
Pwntools is available as a pip package. You can install it by running
`pip install pwntools`.
Alternatively if you prefer to have the latest version in git, you can
simply clone this repository, run `pip install -r requirements.txt`
and add entries in your `PATH` and `PYTHONPATH` variables. The script
`install_local.sh` will help you do so, in case you are using bash.
Pwntools is best supported on 64-bit Ubuntu LTS releases (18.04, 20.04, 22.04, and 24.04). Most functionality should work on any Posix-like distribution (Debian, Arch, FreeBSD, OSX, etc.).
# Contact
If you have any questions not worthy of a bug report, feel free to join us
at `#gallopsled` on Freenode and ask away.
Python3 is suggested, but Pwntools still works with Python 2.7. Most of the functionality of pwntools is self-contained and Python-only. You should be able to get running quickly with
```sh
sudo apt-get update
sudo apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pwntools
```
However, some of the features (assembling/disassembling foreign architectures) require non-Python dependencies. For more information, see the [complete installation instructions here](https://docs.pwntools.com/en/stable/install.html).
# Contribution
See [CONTRIBUTING.md](CONTRIBUTING.md)
# Contact and Community
If you have any questions not worthy of a [bug report](https://github.com/Gallopsled/pwntools/issues), join the Discord server at https://discord.gg/96VA2zvjCB
+32
View File
@@ -0,0 +1,32 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------------- | ------------------ |
| latest dev | :white_check_mark: |
| latest beta | :white_check_mark: |
| latest stable | :white_check_mark: |
| anything else | :x: |
## Reporting a Vulnerability
The aim of pwntools is exploiting software vulnerabilities, which is an unusual position, but it nevertheless can have its own security issues.
Especially that an attacker (=re-victim) is usually not prepared to be attacked back (by the re-attacker).
The first question to ask yourself is: is this an actual vulnerability?
- can it be triggered by a re-attacker (malicious honeypot pretending to be a vulnerable service)?
- does it impact the attacker (=re-victim)?
- is it serious?
* *availability: medium* means *at least* exhausting RAM or disk space of the attacker (=re-victim)
* *confidentiality: medium* means *at least* reading the filesystem of the attacker (=re-victim)
* *integrity: medium* means *at least* performing uncontrolled actions or data corruption on behalf of the attacker (=re-victim)
* if crucial for some sophisticated exploit chain, it is always serious
* `safe_eval` bypasses **are** serious.
* an example of what was **kind of** serious: [#1732](https://github.com/Gallopsled/pwntools/pull/1732)
- can it be fixed without compromising on Pwntools' usability?
If at least one of the answers is no, then this is NOT a vulnerability, so just file a bug report or feature request, without the weird confidential disclosure dance.
Just e-mail the maintainers. Arusekk is the one that is currently the most excited to fix vulnerabilities.
Or create a CTF task! Prove a point the good old hacker way!
+44
View File
@@ -0,0 +1,44 @@
# Testing
Pwntools makes extensive use of unit tests and integration tests to ensure everything is in working order, and no regressions occur.
## Test Suite
To run the test suite, it is best to use Ubuntu 12.04 or 14.04, and run the following commands. **Be aware** that this will add a user to the machine, and create a public key for SSH login!
```sh
bash travis/install.sh
bash travis/ssh_setup.sh
pip install --upgrade --editable .
PWNLIB_NOTERM=1 make -C docs doctest
```
## Testing in Docker
A `Dockerfile` has been provided which has a clean testing environment with Ubuntu Xenial. It is very similar to the online Travis CI testing environment, but uses a more modern version of Ubuntu.
See `travis/docker/README.md` for more information.
## New Tests
To add a new test to an existing module, just add an inline doctest. If the test needs access to an external module, add the import statement to the `testsetup` block in the corresponding file in `docs/source/<module>.rst`.
To add an entirely new module, create a new `module.rst` and add it to the list in `index.rst`. The best way to see if your tests are actually being run is to add an intentionally-failing test like:
```py
>>> assert False
```
## Example Test Module
The module `pwnlib.testexample` exists to demonstrate how everything is tied together. The only files which were modified to add this example module and run its tests automatically are:
- `pwnlib/testexample.py`
- `docs/source/testexample.rst`
- `docs/source/index.rst`
## Shellcode and ROP
These are both less easy to test, as they require actually executing code, or loading real binaries. In order to make the process simpler, the `runner` library was created to wrap common tasks. For an example of testing shellcode with these helpers, see [exit.asm](pwnlib/shellcraft/templates/i386/linux/exit.asm).
Additionally, for loading ELF files on-the-fly, the helpers `ELF.from_bytes` and `ELF.from_assembly` are available.
-59
View File
@@ -1,59 +0,0 @@
#!/usr/bin/env python2
import argparse, sys
from pwnlib.asm import asm
from pwnlib.context import __possible__ as contexts
from pwnlib.util.fiddling import enhex
parser = argparse.ArgumentParser(
description = 'Assemble shellcode into bytes'
)
parser.add_argument(
'lines',
metavar='line',
nargs='*',
help='Lines to assemble. If none are supplied, use stdin'
)
parser.add_argument(
"-f", "--format",
help="Output format (defaults to hex for ttys, otherwise raw)",
choices=['raw', 'hex', 'string']
)
parser.add_argument(
"-o","--output",
metavar='file',
help="Output file (defaults to stdout)",
type=argparse.FileType('w'),
default=sys.stdout
)
parser.add_argument(
'-c', '--context',
metavar = '<opt>',
choices = contexts['os'] + contexts['arch'],
default = ['i386','linux'],
action = 'append',
help = 'The os/architecture the shellcode will run in (default: linux/i386), choose from: %s' % \
', '.join(contexts['os'] + contexts['arch'])
)
args = parser.parse_args()
tty = args.output.isatty()
for arch in args.context[::-1]:
if arch in contexts['arch']: break
for os in args.context[::-1]:
if os in contexts['os']: break
data = '\n'.join(args.lines) or sys.stdin.read()
output = asm(data.replace(';', '\n'), arch = arch, os = os)
fmt = args.format or ('hex' if tty else 'raw')
formatters = {'r':str, 'h':enhex, 's':repr}
args.output.write(formatters[fmt[0]](output))
if tty and fmt is not 'raw':
args.output.write('\n')
-136
View File
@@ -1,136 +0,0 @@
#!/usr/bin/env python2
import argparse, sys, os, types, re
from pwnlib import asm, util, constants
from pwnlib.util import safeeval
from pwnlib.context import __possible__ as contexts
p = argparse.ArgumentParser(
description = "Looking up constants from header files.\n\nExample: constgrep -c freebsd -m ^PROT_ '3 + 4'",
formatter_class = argparse.RawDescriptionHelpFormatter,
)
group = p.add_mutually_exclusive_group()
group.add_argument(
'-e', '--exact',
metavar = '<constant name>',
# nargs = 1,
default = None,
help = 'Do an exact match for a constant instead of searching for a regex',
)
group.add_argument(
'regex',
nargs = '?',
default = '',
help = 'The regex matching constant you want to find',
)
p.add_argument(
'constant',
nargs = '?',
default = None,
help = 'The constant to find',
)
p.add_argument(
'-i', '--case-insensitive',
action = 'store_true',
help = 'Search case insensitive',
)
p.add_argument(
'-m', '--mask-mode',
action = 'store_true',
help = 'Instead of searching for a specific constant value, search for values not containing strictly less bits that the given value.',
)
p.add_argument(
'-c', '--context',
metavar = '<opt>',
choices = contexts['os'] + contexts['arch'],
default = ['i386','linux'],
action = 'append',
help = 'The os/architecture to find constants for (default: linux/i386), choose from: %s' % \
', '.join(dir(constants) + dir(constants.linux))
)
args = p.parse_args()
# Find the architecture and os from the list of contexts
for arch in args.context[::-1]:
if arch in contexts['arch']: break
for os in args.context[::-1]:
if os in contexts['os']: break
if args.exact:
# This is the simple case
print asm.cpp(args.exact, os = os, arch = arch).strip()
else:
# New we search in the right module.
# But first: We find the right module
if os == 'freebsd':
mod = constants.freebsd
else:
mod = getattr(getattr(constants, os), arch)
# Compile the given regex, for optimized lookup
if args.case_insensitive:
matcher = re.compile(args.regex, re.IGNORECASE)
else:
matcher = re.compile(args.regex)
# Evaluate the given constant
if args.constant:
constant = safeeval.expr_eval(args.constant)
else:
constant = None
# The found matching constants and the length of the longest string
out = []
maxlen = 0
for k in dir(mod):
# No python stuff
if k.endswith('__') and k.startswith('__'):
continue
# Run the regex
if not matcher.search(k):
continue
# Check the constant
if constant != None:
val = getattr(mod, k)
if args.mask_mode:
if constant & val != val:
continue
else:
if constant != val:
continue
# Append it
out.append((getattr(mod, k), k))
maxlen = max(len(k), maxlen)
# Output all matching constants
for _, k in sorted(out):
print '#define %s %s' % (k.ljust(maxlen), asm.cpp(k, os = os, arch = arch).strip())
# If we are in match_mode, then try to find a combination of
# constants that yield the exact given value
# We do not want to find combinations using the value 0.
if not (constant == None or constant == 0) and args.mask_mode:
mask = constant
good = []
out = [(v, k) for v, k in out if v != 0]
while mask and out:
cur = out.pop()
mask &= ~cur[0]
good.append(cur)
out = [(v, k) for v, k in out if mask & v == v]
if reduce(lambda x, cur: x | cur[0], good, 0) == constant:
print
print '(%s) == %s' % (' | '.join(k for v, k in good), args.constant)
-69
View File
@@ -1,69 +0,0 @@
#!/usr/bin/env python2
import argparse, string
from pwnlib.util import cyclic, packing
from pwnlib import log
parser = argparse.ArgumentParser(
description = "Cyclic pattern creator/finder"
)
parser.add_argument(
'-a', '--alphabet',
metavar = 'alphabet',
default = string.ascii_lowercase,
help = 'The alphabet to use in the cyclic pattern (defaults to all lower case letters)',
)
parser.add_argument(
'-n', '--length',
metavar = 'length',
default = 4,
type = int,
help = 'Size of the unique subsequences (defaults to 4).'
)
group = parser.add_mutually_exclusive_group(required = True)
group.add_argument(
'-l', '-o', '--offset', '--lookup',
metavar = '<lookup value>',
help = 'Do a lookup instead printing the alphabet',
)
group.add_argument(
'count',
type = int,
nargs = '?',
help = 'Number of characters to print'
)
args = parser.parse_args()
alphabet = args.alphabet
subsize = args.length
if args.lookup:
pat = args.lookup
if pat.startswith('0x'):
pat = packing.pack(int(pat[2:], 16), subsize*8, 'little', 'unsigned')
elif pat.isdigit():
pat = packing.pack(int(pat, 10), subsize*8, 'little', 'unsigned')
if len(pat) != 4:
log.fatal('Subpattern must be 4 bytes', 1)
if not all(c in alphabet for c in pat):
log.fatal('Pattern contains characters not present in the alphabet', 1)
offset = cyclic.cyclic_find(pat, alphabet, subsize)
if offset == -1:
log.fatal('Given pattern does not exist in cyclic pattern', 1)
else:
print offset
else:
want = args.count
result = cyclic.cyclic(want, alphabet, subsize)
got = len(result)
if got < want:
log.failure("Alphabet too small (max length = %i)" % got)
print result
-38
View File
@@ -1,38 +0,0 @@
#!/usr/bin/env python2
import argparse, sys
from pwnlib import asm, context
from string import whitespace, hexdigits
parser = argparse.ArgumentParser(
description = 'Disassemble bytes into text format'
)
parser.add_argument(
'hex',
metavar = 'hex',
nargs = '*',
help = 'Hex-string to disasemble. If none are supplied, then it uses stdin in non-hex mode.'
)
parser.add_argument(
'-c', '--context',
metavar = '<opt>',
choices = context.__possible__['arch'],
default = 'i386',
help = 'The architecture of the shellcode (default: i386), choose from:\n%s' % ', '.join(context.__possible__['arch'])
)
args = parser.parse_args()
if len(args.hex) > 0:
dat = ''.join(args.hex)
dat = dat.translate(None, whitespace)
if not set(hexdigits) >= set(dat):
print "This is not a hex string"
exit(-1)
dat = dat.decode('hex')
else:
dat = sys.stdin.read()
print asm.disasm(dat, arch = args.context)
-7
View File
@@ -1,7 +0,0 @@
#!/usr/bin/env python2
import sys
if len(sys.argv) == 1:
print sys.stdin.read().encode('hex')
else:
print ' '.join(sys.argv[1:]).encode('hex')
-173
View File
@@ -1,173 +0,0 @@
#!/usr/bin/env python2
import argparse, sys, os, types
import pwnlib
from pwnlib import asm, log, util
from pwnlib.context import __possible__ as contexts
import pwnlib.term.text as text
r = text.red
g = text.green
b = text.blue
banner = '\n'.join([' ' + r('____') + ' ' + g('_') + ' ' + r('_') + ' ' + g('_') + ' ' + b('__') + ' ' + r('_'),
' ' + r('/ ___|') + g('| |__') + ' ' + b('___') + r('| |') + ' ' + g('|') + ' ' + b('___') + ' ' + r('_ __') + ' ' + g('__ _') + ' ' + b('/ _|') + ' ' + r('|_'),
' ' + r('\___ \\') + g('| \'_ \\') + ' ' + b('/ _ \\') + ' ' + r('|') + ' ' + g('|') + b('/ __|') + ' ' + r('\'__/') + ' ' + g('_` |') + ' ' + b('|_') + r('| __|'),
' ' + r('___) |') + ' ' + g('| | |') + ' ' + b('__/') + ' ' + r('|') + ' ' + g('|') + ' ' + b('(__') + r('| |') + ' ' + g('| (_| |') + ' ' + b('_|') + ' ' + r('|_'),
' ' + r('|____/') + g('|_| |_|') + b('\\___|') + r('_|') + g('_|') + b('\\___|') + r('_|') + ' ' + g('\\__,_|') + b('_|') + ' ' + r('\\__|'),
''
])
# ____ _ _ _ __ _
# / ___|| |__ ___| | | ___ _ __ __ _ / _| |_
# \___ \| '_ \ / _ \ | |/ __| '__/ _` | |_| __|
# ___) | | | | __/ | | (__| | | (_| | _| |_
# |____/|_| |_|\___|_|_|\___|_| \__,_|_| \__|
def _string(s):
out = []
for c in s:
co = ord(c)
if co >= 0x20 and co <= 0x7e and c not in '/$\'"`':
out.append(c)
else:
out.append('\\x%02x' % co)
return '"' + ''.join(out) + '"\n'
def _carray(s):
out = []
for c in s:
out.append('0x' + util.fiddling.enhex(c))
return '{' + ', '.join(out) + '};\n'
def _hex(s):
return pwnlib.util.fiddling.enhex(s) + '\n'
p = argparse.ArgumentParser(
description = banner + '\nMicrowave shellcode -- Easy, fast and delicious',
formatter_class = argparse.RawDescriptionHelpFormatter,
)
p.add_argument(
'shellcode',
nargs = '?',
default = '',
metavar = '<shellcode>',
help = 'The shellcode you want',
)
p.add_argument(
'args',
nargs = '*',
metavar = '<arg>',
default = (),
help = 'Argument to the chosen shellcode',
)
p.add_argument(
'-?', '--show',
action = 'store_true',
help = 'Show shellcode documentation',
)
p.add_argument(
'-o', '--out',
metavar = '<file>',
type = argparse.FileType('w'),
default = sys.stdout,
help = 'Output file (default: stdout)',
)
p.add_argument(
'-f', '--format',
metavar = '<format>',
choices = ['r', 'raw',
's', 'str', 'string',
'c',
'h', 'hex',
'a', 'asm', 'assembly',
'p',
'i', 'hexii'],
default = 'hex',
help = 'Output format (default: hex), choose from {r}aw, {s}tring, {c}-style array, {h}ex string, hex{i}i, {a}ssembly code, {p}reprocssed code',
)
args = p.parse_args()
def get_tree(path, val, result):
if path:
path += '.'
if path.startswith('common.'):
return
mods = []
for k in sorted(dir(val)):
if k and k[0] != '_':
cur = getattr(val, k)
if isinstance(cur, types.ModuleType):
mods.append((path + k, cur))
else:
result.append((path + k, cur))
for path, val in mods:
get_tree(path, val, result)
return result
vals = get_tree('', pwnlib.shellcraft, [])
if args.shellcode:
vals = [(k, val) for k, val in vals if k.startswith(args.shellcode + '.') or k == args.shellcode]
if len(vals) == 0:
log.fatal("Cannot find subtree by the name of %r" % args.shellcode)
elif len(vals) > 1:
for k, _ in vals:
print k
exit()
else:
func = vals[0][1]
if args.show:
print func.__doc__
exit()
defargs = len(func.func_defaults or ())
reqargs = func.func_code.co_argcount - defargs
if len(args.args) < reqargs:
if defargs > 0:
log.fatal('%s takes at least %d arguments' % (args.shellcode, reqargs))
else:
log.fatal('%s takes exactly %d arguments' % (args.shellcode, reqargs))
# Captain uglyness saves the day!
for i in range(len(args.args)):
if args.args[i] in ['False', 'false']:
args.args[i] = False
# And he strikes again!
os = arch = None
for k in args.shellcode.split('.')[:-1]:
if k in contexts['arch']:
arch = k
elif k in contexts['os']:
os = k
code = func(*args.args)
if args.format in ['a', 'asm', 'assembly']:
print code
exit()
if args.format == 'p':
print pwnlib.asm.cpp(code, arch = arch, os = os)
exit()
code = pwnlib.asm.asm(code, arch = arch, os = os)
if args.format in ['s', 'str', 'string']:
code = _string(code)
elif args.format == 'c':
code = _carray(code)
elif args.format in ['h', 'hex']:
code = _hex(code)
elif args.format in ['i', 'hexii']:
code = pwnlib.util.fiddling.hexii(code) + '\n'
sys.stdout.write(code)
-11
View File
@@ -1,11 +0,0 @@
#!/usr/bin/env python2
import sys
from string import whitespace
try:
if len(sys.argv) == 1:
s = sys.stdin.read().translate(None, whitespace)
sys.stdout.write(s.decode('hex'))
else:
sys.stdout.write(''.join(sys.argv[1:]).decode('hex'))
except TypeError, e:
sys.stderr.write(str(e) + '\n')
+1
View File
@@ -1 +1,2 @@
build
robots.txt
Regular → Executable
+13 -1
View File
@@ -6,6 +6,7 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
TAR = tar
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -14,7 +15,8 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sou
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext dash
help:
@echo "Please use \`make <target>' where <target> is one of"
@@ -34,12 +36,17 @@ help:
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " dash to make a Dash docset"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
-rm -rf /tmp/user/pwn*
-rm -rf $(HOME)/.cache/.pwntools-cache
-rm -rf /tmp/pwn* 2>/dev/null || true
-rm -rf build
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@@ -136,6 +143,11 @@ gettext:
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
dash:
$(SPHINXBUILD) -b html -d $(BUILDDIR)/doctrees -t dash source $(BUILDDIR)/html
doc2dash $(BUILDDIR)/html -d $(BUILDDIR)/dash -n pwntools -f -I index.html
@echo "Build finished. The Dash docset is in $(BUILDDIR)/dash."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
+23
View File
@@ -0,0 +1,23 @@
capstone
coverage[toml]
python-dateutil
doc2dash
docutils<0.18; python_version<'3'
docutils>=0.18; python_version>='3'
intervaltree
isort
mako>=1.0.0
paramiko>=1.15.2
pyelftools>=0.29, <0.30; python_version<'3'
pyelftools>=0.29; python_version>='3'
pygments>=2.0
pypandoc
pyserial>=2.7
pysocks
psutil
requests>=2.5.1
ropgadget>=5.3
sphinx==1.8.6; python_version<'3'
sphinx>=8.1.3, <9; python_version>='3'
sphinx_rtd_theme
sphinxcontrib-autoprogram<=0.1.5
+56
View File
@@ -0,0 +1,56 @@
About pwntools
========================
Whether you're using it to write exploits, or as part
of another software project will dictate how you use it.
Historically pwntools was used as a sort of exploit-writing DSL. Simply doing
``from pwn import *`` in a previous version of pwntools would bring all sorts of
nice side-effects.
When redesigning pwntools for 2.0, we noticed two contrary goals:
* We would like to have a "normal" python module structure, to allow other
people to familiarize themselves with pwntools quickly.
* We would like to have even more side-effects, especially by putting the
terminal in raw-mode.
To make this possible, we decided to have two different modules. :mod:`pwnlib`
would be our nice, clean Python module, while :mod:`pwn` would be used during
CTFs.
:mod:`pwn` --- Toolbox optimized for CTFs
-----------------------------------------
.. module:: pwn
As stated, we would also like to have the ability to get a lot of these
side-effects by default. That is the purpose of this module. It does
the following:
* Imports everything from the toplevel :mod:`pwnlib` along with
functions from a lot of submodules. This means that if you do
``import pwn`` or ``from pwn import *``, you will have access to
everything you need to write an exploit.
* Calls :func:`pwnlib.term.init` to put your terminal in raw mode
and implements functionality to make it appear like it isn't.
* Setting the :data:`pwnlib.context.log_level` to `"info"`.
* Tries to parse some of the values in :data:`sys.argv` and every
value it succeeds in parsing it removes.
:mod:`pwnlib` --- Normal python library
---------------------------------------
.. module:: pwnlib
This module is our "clean" python-code. As a rule, we do not think that
importing :mod:`pwnlib` or any of the submodules should have any significant
side-effects (besides e.g. caching).
For the most part, you will also only get the bits you import. You for instance would
not get access to :mod:`pwnlib.util.packing` simply by doing ``import
pwnlib.util``.
Though there are a few exceptions (such as :mod:`pwnlib.shellcraft`), that does
not quite fit the goals of being simple and clean, but they can still be
imported without implicit side-effects.
+14
View File
@@ -0,0 +1,14 @@
.. testsetup:: *
from pprint import pprint
from pwn import *
adb = pwnlib.adb
:mod:`pwnlib.adb` --- Android Debug Bridge
=====================================================
.. automodule:: pwnlib.adb.adb
:members:
.. automodule:: pwnlib.adb.protocol
:members:
+9
View File
@@ -0,0 +1,9 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.args` --- Magic Command-Line Arguments
=====================================================
.. automodule:: pwnlib.args
:members:
+13 -1
View File
@@ -1,9 +1,21 @@
.. testsetup:: *
from pwnlib.asm import *
import tempfile
import subprocess
from pwn import *
:mod:`pwnlib.asm` --- Assembler functions
=========================================
.. automodule:: pwnlib.asm
:members:
Internal Functions
-----------------------------------------
These are only included so that their tests are run.
You should never need these.
.. autofunction:: pwnlib.asm.dpkg_search_for_binutils
.. autofunction:: pwnlib.asm.print_binutils_instructions
+5
View File
@@ -0,0 +1,5 @@
:mod:`pwnlib.atexception` --- Callbacks on unhandled exception
==============================================================
.. automodule:: pwnlib.atexception
:members:
+5
View File
@@ -0,0 +1,5 @@
:mod:`pwnlib.atexit` --- Replacement for atexit
===============================================
.. automodule:: pwnlib.atexit
:members:
+20
View File
@@ -0,0 +1,20 @@
.. testsetup:: *
from pwn import *
old = context.defaults.copy()
.. testcleanup:: *
context.defaults.copy = old
Command Line Tools
========================
pwntools comes with a handful of useful command-line utilities which serve as wrappers for some of the internal functionality.
If these tools do not appear to be installed, make sure that you have added ``~/.local/bin`` to your ``$PATH`` environment variable.
.. toctree::
.. autoprogram:: pwnlib.commandline.main:parser
:prog: pwn
Regular → Executable
+177 -36
View File
@@ -11,14 +11,22 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
import os
import doctest
import signal
import six
import subprocess
import sys
build_dash = tags.has('dash')
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration -----------------------------------------------------
import pwnlib.update
pwnlib.update.disabled = True
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
@@ -31,47 +39,95 @@ extensions = [
'sphinx.ext.doctest',
'sphinx.ext.linkcode',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.todo',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'sphinxcontrib.autoprogram',
]
try:
import sphinxcontrib.napoleon
extensions.append('sphinxcontrib.napoleon')
except ImportError:
pass
# Disable "info" logging directly to stdout by Sphinx
import logging
class SphinxPwnlibFilter(logging.Filter):
def filter(self, record):
if record.name.startswith('pwn'):
return False
if record.name.startswith('paramiko'):
return False
return True
log_filter = SphinxPwnlibFilter()
for i, handler in enumerate(logging.root.handlers):
print("Filtering Sphinx handler", handler)
handler.addFilter(log_filter)
# Napoleon settings
napoleon_use_ivar = True
napoleon_use_rtype = False
doctest_global_setup = '''
import pwnlib
pwnlib.context.reset_local()
import sys, os
os.environ['PWNLIB_NOTERM'] = '1'
os.environ['PWNLIB_RANDOMIZE'] = '0'
import six
import pwnlib.update
import pwnlib.util.fiddling
import logging
pwnlib.update.disabled = True
pwnlib.context.context.reset_local()
pwnlib.context.ContextType.defaults['log_level'] = logging.ERROR
pwnlib.context.ContextType.defaults['randomize'] = False
# pwnlib.context.ContextType.defaults['terminal'] = ['sh', '-c']
pwnlib.util.fiddling.default_style = {}
pwnlib.term.text.when = 'never'
pwnlib.log.install_default_handler()
pwnlib.log.rootlogger.setLevel(1)
# Sphinx modifies sys.stdout, and context.log_terminal has
# a reference to the original instance. We need to update
# it for logging to be captured.
class stdout(object):
def __getattr__(self, name):
return getattr(sys.stdout, name)
def __setattr__(self, name, value):
return setattr(sys.stdout, name, value)
pwnlib.context.ContextType.defaults['log_console'] = stdout()
github_actions = os.environ.get('USER') == 'runner'
travis_ci = os.environ.get('USER') == 'travis'
local_doctest = os.environ.get('USER') == 'pwntools'
skip_android = True
is_python2 = six.PY2
'''
autodoc_member_order = 'bysource'
autoclass_content = 'both'
autodoc_member_order = 'groupwise' # 'alphabetical'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
doctest_test_doctest_blocks = True
doctest_test_doctest_blocks = 'true'
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'pwntools'
copyright = u'2014, Gallopsled et al'
copyright = u'2016, Gallopsled et al.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
import pwnlib
release = pwnlib.__version__
version = release.rsplit('.', 1)[0]
@@ -114,7 +170,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -161,10 +217,10 @@ html_static_path = []
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
html_domain_indices = not build_dash
# If false, no index is generated.
#html_use_index = True
html_use_index = not build_dash
# If true, the index is split into individual pages for each letter.
#html_split_index = False
@@ -207,10 +263,11 @@ latex_elements = {
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'pwntools.tex', u'pwntools Documentation',
u'Gallopsled et al', 'manual'),
u'2016, Gallopsled et al.', 'manual'),
]
intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None)}
intersphinx_mapping = {'python': ('https://docs.python.org/3/', None),
'paramiko': ('https://docs.paramiko.org/en/2.1/', None)}
# The name of an image file (relative to this directory) to place at the top of
# the title page.
@@ -239,7 +296,7 @@ intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None)}
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pwntools', u'pwntools Documentation',
[u'Gallopsled et al'], 1)
[u'2016, Gallopsled et al.'], 1)
]
# If true, show URL addresses after external links.
@@ -253,7 +310,7 @@ man_pages = [
# dir menu entry, description, category)
texinfo_documents = [
('index', 'pwntools', u'pwntools Documentation',
u'Gallopsled et al', 'pwntools', 'One line description of project.',
u'', 'pwntools', 'CTF exploit writing toolkit.',
'Miscellaneous'),
]
@@ -266,6 +323,19 @@ texinfo_documents = [
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
branch = release
try:
git_branch = subprocess.check_output('git describe --tags', shell = True, universal_newlines = True)
except subprocess.CalledProcessError:
git_branch = '-'
try:
if '-' in git_branch:
branch = subprocess.check_output('git rev-parse HEAD', shell = True, universal_newlines = True).strip()[:10]
except subprocess.CalledProcessError:
pass
def linkcode_resolve(domain, info):
if domain != 'py':
return None
@@ -279,7 +349,7 @@ def linkcode_resolve(domain, info):
val = mod
for k in info['fullname'].split('.'):
val = getattr(val, k, None)
if val == None:
if val is None:
break
# Special case for shellcraft
@@ -290,21 +360,92 @@ def linkcode_resolve(domain, info):
else:
filename = info['module'].replace('.', '/') + '.py'
# Fixup for context properties
if info['module'].startswith('pwnlib.context'):
filename = 'pwnlib/context.py'
if isinstance(val, property):
val = val.fget
if not isinstance(val, (types.FunctionType, types.MethodType)):
import pwnlib.context.defaults
val = getattr(pwnlib.context.defaults.__class__, info['fullname'], None)
if isinstance(val, property):
val = val.fget
val = getattr(val, '_inner', val)
if isinstance(val, (types.ModuleType, types.ClassType, types.MethodType, types.FunctionType, types.TracebackType, types.FrameType, types.CodeType)):
if isinstance(val, (types.ModuleType, types.MethodType, types.FunctionType, types.TracebackType, types.FrameType, types.CodeType) + six.class_types):
try:
lines, first = inspect.getsourcelines(val)
filename += '#L%d-%d' % (first, first + len(lines) - 1)
except IOError:
filename += '#L%d-L%d' % (first, first + len(lines) - 1)
except (IOError, TypeError):
pass
return "https://github.com/Gallopsled/pwntools/blob/%s/%s" % (release, filename)
return "https://github.com/Gallopsled/pwntools/blob/%s/%s" % (branch, filename)
# The readthedocs theme is used by the Dash generator. (Can be used for HTML too.)
if build_dash:
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import alabaster
html_theme = 'alabaster'
html_theme_path = [alabaster.get_path()]
html_theme_options = { 'nosidebar' : True }
# -- Customization to Sphinx autodoc generation --------------------------------------------
import sphinx.ext.autodoc
# Test hidden members (e.g. def _foo(...))
def dont_skip_any_doctests(app, what, name, obj, skip, options):
return None
autodoc_default_options = {'special-members': None, 'private-members': None}
class _DummyClass(object): pass
class Py2OutputChecker(_DummyClass, doctest.OutputChecker):
def check_output(self, want, got, optionflags):
sup = super(Py2OutputChecker, self).check_output
if sup(want, got, optionflags):
return True
try:
rly_want = pwnlib.util.safeeval.const(want)
if sup(repr(rly_want), got, optionflags):
return True
rly_got = pwnlib.util.safeeval.const(got)
if rly_want == rly_got:
return True
except ValueError:
pass
rly_want = ' '.join(x[:2].replace('b"','"').replace("b'","'")+x[2:] for x in want.replace('\n','\n ').split(' ')).replace('\n ','\n')
if sup(rly_want, got, optionflags):
return True
rly_want = ' '.join(x[:2].replace('b"',' "').replace("b'"," '")+x[2:] for x in want.replace('\n','\n ').split(' ')).replace('\n ','\n')
if sup(rly_want, got, optionflags):
return True
for wantl, gotl in six.moves.zip_longest(want.splitlines(), got.splitlines(), fillvalue=''):
rly_want1 = '['.join(x[:2].replace('b"','"').replace("b'","'")+x[2:] for x in wantl.split('['))
rly_want2 = ' '.join(x[:2].replace('b"',' "').replace("b'"," '")+x[2:] for x in wantl.split(' '))
if not sup(rly_want1, gotl, optionflags) and not sup(rly_want2, gotl, optionflags):
return False
return True
def py2_doctest_init(self, checker=None, verbose=None, optionflags=0):
if checker is None:
checker = Py2OutputChecker()
doctest.DocTestRunner.__init__(self, checker, verbose, optionflags)
if 'doctest' in sys.argv:
def setup(app):
pass # app.connect('autodoc-skip-member', dont_skip_any_doctests)
if sys.version_info[:1] < (3,):
import sphinx.ext.doctest
sphinx.ext.doctest.SphinxDocTestRunner.__init__ = py2_doctest_init
else:
# monkey patching paramiko due to https://github.com/paramiko/paramiko/pull/1661
import paramiko.client
import binascii
paramiko.client.hexlify = lambda x: binascii.hexlify(x).decode()
paramiko.util.safe_string = lambda x: '' # function result never *actually used*
class EndlessLoop(Exception): pass
def alrm_handler(sig, frame):
signal.alarm(180) # three minutes
raise EndlessLoop()
signal.signal(signal.SIGALRM, alrm_handler)
signal.alarm(600) # ten minutes
+4
View File
@@ -0,0 +1,4 @@
:mod:`pwnlib.config` --- Pwntools Configuration File
====================================================
.. automodule:: pwnlib.config
+2 -1
View File
@@ -1,6 +1,7 @@
.. testsetup:: *
from pwnlib import context, constants
from pwnlib import constants
from pwnlib.context import context
:mod:`pwnlib.constants` --- Easy access to header file constants
================================================================
+24 -40
View File
@@ -1,49 +1,33 @@
.. testsetup:: *
from pwnlib import context
from pwn import *
import logging
log = pwnlib.log.getLogger('pwnlib.context')
context.clear()
:mod:`pwnlib.context` --- Setting runtime variables
=====================================================
Many settings in ``pwntools`` are controlled via the global variable :data:`.context`, such as the selected target operating system, architecture, and bit-width.
:mod:`pwnlib.context`
---------------------
In general, exploits will start with something like:
.. code-block:: python
from pwn import *
context.arch = 'amd64'
Which sets up everything in the exploit for exploiting a 64-bit Intel binary.
The recommended method is to use ``context.binary`` to automagically set all of the appropriate values.
.. code-block:: python
from pwn import *
context.binary = './challenge-binary'
Module Members
----------------------------------------------------
.. automodule:: pwnlib.context
.. exec::
import pwnlib
from inspect import cleandoc
mod = pwnlib.context.defaults.__class__
for key in sorted(dir(mod)):
val = getattr(mod, key)
if isinstance(val, property):
print ".. data:: " + key
print ""
print cleandoc(val.__doc__)
print ""
.. autofunction:: pwnlib.context.__call__(**kwargs)
.. autofunction:: pwnlib.context.local(**kwargs)
.. autofunction:: pwnlib.context.reset_local()
:mod:`pwnlib.context.defaults`
------------------------------
.. automodule:: pwnlib.context.defaults
.. exec::
import pwnlib
mod = pwnlib.context.defaults.__class__
for key in sorted(dir(mod)):
val = getattr(mod, key)
if isinstance(val, property):
print ".. data:: " + key
print ""
print "This is the global version of :data:`pwnlib.context.%s`." % key
print
.. autofunction:: pwnlib.context.defaults.__call__(**kwargs)
:members:
+12 -3
View File
@@ -1,9 +1,18 @@
.. testsetup:: *
from pwnlib.elf import *
from pwnlib.util.misc import which
:mod:`pwnlib.elf` --- Working with ELF binaries
===============================================
:mod:`pwnlib.elf` --- ELF Executables and Libraries
===================================================
.. automodule:: pwnlib.elf
:members:
ELF Modules
-------------------
.. toctree::
elf/elf
elf/config
elf/corefile
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwn import *
from pwnlib.elf.config import parse_kconfig
:mod:`pwnlib.elf.config` --- Kernel Config Parsing
===========================================================
.. automodule:: pwnlib.elf.config
:members:
+32
View File
@@ -0,0 +1,32 @@
.. testsetup:: *
from glob import glob
from pwn import *
# The Linux kernel won't overwrite an existing corefile, so in case
# some other part of the doctests caused a segfault and core dump,
# we need to get rid of it before our tests run.
#
# We DONT need to worry about e.g. ./core existing when using Corefile()
# because we always move and rename the corefile to prevent this situation.
if os.path.exists('core'):
os.unlink('core')
# bash-static is a statically linked version of bash, but if $SHELL is not
# set to anything, it decides to up and load ld.so and libc.so which breaks
# our example of showing `corefile.libc == None` for a statically linked bin.
# Set the environment here so it's not in the middle of our tests.
os.environ.setdefault('SHELL', '/bin/sh')
:mod:`pwnlib.elf.corefile` --- Core Files
===========================================================
.. automodule:: pwnlib.elf.corefile
.. autoclass:: pwnlib.elf.corefile.Corefile
:members:
:show-inheritance:
.. autoclass:: pwnlib.elf.corefile.Mapping
:members:
+30
View File
@@ -0,0 +1,30 @@
.. testsetup:: *
from pwn import *
from glob import glob
from pwnlib.elf.maps import CAT_PROC_MAPS_EXIT
import shutil
:mod:`pwnlib.elf.elf` --- ELF Files
===========================================================
.. automodule:: pwnlib.elf.elf
.. autoclass:: pwnlib.elf.elf.ELF
:members:
:show-inheritance:
:inherited-members:
:exclude-members: address_offsets,
get_data,
get_dwarf_info,
get_section,
get_segment,
has_dwarf_info,
iter_sections,
iter_segments
.. autoclass:: pwnlib.elf.elf.Function
:members:
.. autoclass:: pwnlib.elf.elf.dotdict
:members:
+29
View File
@@ -0,0 +1,29 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.encoders` --- Encoding Shellcode
===============================================
.. automodule:: pwnlib.encoders.encoder
:members:
.. automodule:: pwnlib.encoders.i386.ascii_shellcode
:members:
:special-members:
:exclude-members: __init__
.. automodule:: pwnlib.encoders.i386.xor
:members:
.. automodule:: pwnlib.encoders.i386.delta
:members:
.. automodule:: pwnlib.encoders.amd64.delta
:members:
.. automodule:: pwnlib.encoders.arm.xor
:members:
.. automodule:: pwnlib.encoders.mips.xor
:members:
+9
View File
@@ -0,0 +1,9 @@
.. testsetup:: *
from pwnlib.filepointer import *
:mod:`pwnlib.filepointer` --- `FILE*` structure exploitation
============================================================
.. automodule:: pwnlib.filepointer
:members:
+17
View File
@@ -0,0 +1,17 @@
.. testsetup:: *
import time
import six
from pwnlib.context import context
from pwnlib.tubes.ssh import ssh
from pwnlib.filesystem import *
:mod:`pwnlib.filesystem` --- Manipulating Files Locally and Over SSH
====================================================================
Provides a Python2-compatible :py:mod:`pathlib` interface for paths
on the local filesystem (`.Path`) as well as on remote filesystems,
via SSH (`.SSHPath`).
.. automodule:: pwnlib.filesystem
:members:
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.flag` --- CTF Flag Management
==========================================
.. automodule:: pwnlib.flag
:members:
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwn import *
import tempfile
:mod:`pwnlib.fmtstr` --- Format string bug exploitation tools
=============================================================
.. automodule:: pwnlib.fmtstr
:members:
+6
View File
@@ -1,3 +1,9 @@
.. testsetup:: *
from pwn import *
context.arch = 'amd64'
context.terminal = [os.path.join(os.path.dirname(pwnlib.__file__), 'gdb_faketerminal.py')]
:mod:`pwnlib.gdb` --- Working with GDB
======================================
+102
View File
@@ -0,0 +1,102 @@
.. testsetup:: *
from pwn import *
``from pwn import *``
========================
The most common way that you'll see pwntools used is
>>> from pwn import *
Which imports a bazillion things into the global namespace to make your life easier.
This is a quick list of most of the objects and routines imported, in rough order of importance and frequency of use.
- :mod:`pwnlib.context`
- :data:`pwnlib.context.context`
- Responsible for most of the pwntools convenience settings
- Set `context.log_level = 'debug'` when troubleshooting your exploit
- Scope-aware, so you can disable logging for a subsection of code via :meth:`.ContextType.local`
- ``remote``, ``listen``, ``ssh``, ``process``
- :mod:`pwnlib.tubes`
- Super convenient wrappers around all of the common functionality for CTF challenges
- Connect to anything, anywhere, and it works the way you want it to
- Helpers for common tasks like ``recvline``, ``recvuntil``, ``clean``, etc.
- Interact directly with the application via ``.interactive()``
- ``p32`` and ``u32``
- :mod:`pwnlib.util.packing`
- Useful functions to make sure you never have to remember if ``'>'`` means signed or unsigned for ``struct.pack``, and no more ugly ``[0]`` index at the end.
- Set ``signed`` and ``endian`` in sane manners (also these can be set once on ``context`` and not bothered with again)
- Most common sizes are pre-defined (``u8``, ``u64``, etc), and :func:`pwnlib.util.packing.pack` lets you define your own.
- ``log``
- :mod:`pwnlib.log`
- Make your output pretty!
- ``cyclic`` and ``cyclic_func``
- :mod:`pwnlib.util.cyclic`
- Utilities for generating strings such that you can find the offset of any given substring given only N (usually 4) bytes. This is super useful for straight buffer overflows. Instead of looking at 0x41414141, you could know that 0x61616171 means you control EIP at offset 64 in your buffer.
- ``asm`` and ``disasm``
- :mod:`pwnlib.asm`
- Quickly turn assembly into some bytes, or vice-versa, without mucking about
- Supports any architecture for which you have a binutils installed
- Over 20 different architectures have pre-built binaries at `ppa:pwntools/binutils <https://launchpad.net/~pwntools/+archive/ubuntu/binutils>`_.
- ``shellcraft``
- :mod:`pwnlib.shellcraft`
- Library of shellcode ready to go
- ``asm(shellcraft.sh())`` gives you a shell
- Templating library for reusability of shellcode fragments
- ``ELF``
- :mod:`pwnlib.elf`
- ELF binary manipulation tools, including symbol lookup, virtual memory to file offset helpers, and the ability to modify and save binaries back to disk
- ``DynELF``
- :mod:`pwnlib.dynelf`
- Dynamically resolve functions given only a pointer to any loaded module, and a function which can leak data at any address
- ``ROP``
- :mod:`pwnlib.rop`
- Automatically generate ROP chains using a DSL to describe what you want to do, rather than raw addresses
- ``gdb.debug`` and ``gdb.attach``
- :mod:`pwnlib.gdb`
- Launch a binary under GDB and pop up a new terminal to interact with it. Automates setting breakpoints and makes iteration on exploits MUCH faster.
- Alternately, attach to a running process given a PID, :mod:`pwnlib.tubes` object, or even just a socket that's connected to it
- ``args``
- Dictionary containing all-caps command-line arguments for quick access
- Run via ``python foo.py REMOTE=1`` and ``args['REMOTE'] == '1'``.
- Can also control logging verbosity and terminal fanciness
- `NOTERM`
- `SILENT`
- `DEBUG`
- ``randoms``, ``rol``, ``ror``, ``xor``, ``bits``
- :mod:`pwnlib.util.fiddling`
- Useful utilities for generating random data from a given alphabet, or simplifying math operations that usually require masking off with `0xffffffff` or calling `ord` and `chr` an ugly number of times
- ``net``
- :mod:`pwnlib.util.net`
- Routines for querying about network interfaces
- ``proc``
- :mod:`pwnlib.util.proc`
- Routines for querying about processes
- ``pause``
- It's the new ``getch``
- ``safeeval``
- :mod:`pwnlib.util.safeeval`
- Functions for safely evaluating python code without nasty side-effects.
These are all pretty self explanatory, but are useful to have in the global namespace.
- ``hexdump``
- ``read`` and ``write``
- ``enhex`` and ``unhex``
- ``more``
- ``group``
- ``align`` and ``align_down``
- ``urlencode`` and ``urldecode``
- ``which``
- ``wget``
Additionally, all of the following modules are auto-imported for you. You were going to do it anyway.
- ``os``
- ``sys``
- ``time``
- ``requests``
- ``re``
- ``random``
Regular → Executable
+81 -9
View File
@@ -1,31 +1,103 @@
Welcome to pwntools's documentation!
pwntools
====================================
Contents:
``pwntools`` is a CTF framework and exploit development library.
Written in Python, it is designed for rapid prototyping and development,
and intended to make exploit writing as simple as possible.
The primary location for this documentation is at docs.pwntools.com_, which uses
readthedocs_. It comes in three primary flavors:
- Stable_
- Beta_
- Dev_
.. _readthedocs: https://readthedocs.org
.. _docs.pwntools.com: https://docs.pwntools.com/en/latest
.. _Stable: https://docs.pwntools.com/en/stable
.. _Beta: https://docs.pwntools.com/en/beta
.. _Dev: https://docs.pwntools.com/en/dev
Getting Started
---------------
.. toctree::
:maxdepth: 3
:glob:
about
install
intro
globals
commandline
Module Index
------------
Each of the ``pwntools`` modules is documented here.
.. toctree::
:maxdepth: 1
:glob:
adb
args
asm
atexception
atexit
constants
config
context
dynelf
elf
encoders
elf/*
exception
filepointer
filesystem
flag
fmtstr
gdb
libcdb
log
memleak
tubes
protocols
qemu
replacements
rop/*
runner
shellcraft
shellcraft/*
term
timeout
tubes
tubes/*
ui
update
useragents
util/*
windbg
Indices and tables
==================
.. toctree::
:hidden:
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
testexample
.. only:: not dash
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Bytes
-----
The bytes vs text distinction is so important that it even made it to this main page.
See the pwntools-tutorial_ repo for the latest tutorial finally
explaining the difference once and for all (hopefully).
.. _pwntools-tutorial: https://github.com/Gallopsled/pwntools-tutorial/blob/master/bytes.md
+75
View File
@@ -0,0 +1,75 @@
Installation
============
Pwntools is best supported on 64-bit Ubuntu LTS releases (14.04, 16.04, 18.04, and 20.04). Most functionality should work on any Posix-like distribution (Debian, Arch, FreeBSD, OSX, etc.).
Prerequisites
-------------
In order to get the most out of ``pwntools``, you should have the
following system libraries installed.
.. toctree::
:maxdepth: 3
:glob:
install/*
Note: For Mac OS X you will need to have cmake ``brew install cmake`` and pkg-config ``brew install pkg-config`` installed.
Released Version
-----------------
pwntools is available as a ``pip`` package for both Python2 and Python3.
Python3
^^^^^^^
.. code-block:: bash
$ sudo apt-get update
$ sudo apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential
$ python3 -m pip install --upgrade pip
$ python3 -m pip install --upgrade pwntools
Python2 (Deprecated)
^^^^^^^^^^^^^^^^^^^^
NOTE: Pwntools maintainers STRONGLY recommend using Python3 for all future Pwntools-based scripts and projects.
Additionally, due to `pip` dropping support for Python2, a specfic version of `pip` must be installed.
.. code-block:: bash
$ sudo apt-get update
$ sudo apt-get install python python-pip python-dev git libssl-dev libffi-dev build-essential
$ python2 -m pip install --upgrade pip==20.3.4
$ python2 -m pip install --upgrade pwntools
Command-Line Tools
------------------
When installed with ``sudo`` the above commands will install Pwntools' command-line tools to somewhere like ``/usr/bin``.
However, if you run as an unprivileged user, you may see a warning message that looks like this::
WARNING: The scripts asm, checksec, common, constgrep, cyclic, debug, disablenx, disasm,
elfdiff, elfpatch, errno, hex, main, phd, pwn, pwnstrip, scramble, shellcraft, template,
unhex, update and version are installed in '/home/user/.local/bin' which is not on PATH.
Follow the instructions listed and add ``~/.local/bin`` to your ``$PATH`` environment variable.
Development
--------------
If you are hacking on Pwntools locally, you'll want to do something like this:
.. code-block:: bash
$ git clone https://github.com/Gallopsled/pwntools
$ pip install --upgrade --editable ./pwntools
.. _Ubuntu: https://launchpad.net/~pwntools/+archive/ubuntu/binutils
+92
View File
@@ -0,0 +1,92 @@
Binutils
-------------
Assembly of foreign architectures (e.g. assembling Sparc shellcode on
Mac OS X) requires cross-compiled versions of ``binutils`` to be
installed. We've made this process as smooth as we can.
In these examples, replace ``$ARCH`` with your target architecture (e.g., arm, aarch64, mips64, vax, etc.).
Building `binutils` from source takes about 60 seconds on a modern 8-core machine.
Ubuntu
^^^^^^^^^^^^^^^^
For Ubuntu 12.04 through 15.10, you must first add the pwntools `Personal Package Archive repository <https://launchpad.net/~pwntools/+archive/ubuntu/binutils>`__.
Ubuntu Xenial (16.04) has official packages for most architectures, and does not require this step.
.. code-block:: bash
$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:pwntools/binutils
$ sudo apt-get update
Then, install the binutils for your architecture.
.. code-block:: bash
$ sudo apt-get install binutils-$ARCH-linux-gnu
Mac OS X
^^^^^^^^^^^^^^^^
Mac OS X is just as easy, but requires building binutils from source.
However, we've made ``homebrew`` recipes to make this just two commands.
After installing `brew <https://brew.sh>`__, grab the appropriate
recipe from our `binutils
repo <https://github.com/Gallopsled/pwntools-binutils/>`__.
.. code-block:: bash
$ wget https://raw.githubusercontent.com/Gallopsled/pwntools-binutils/master/macos/binutils-$ARCH.rb
$ brew install ./binutils-$ARCH.rb
Windows
^^^^^^^^^^^^^^^^
Windows support is experimental. You can try installing a prebuilt version of binutils
for your desired architecture from the `GNU Toolchains <https://gnutoolchains.com/>`__ project.
Alternate OSes
^^^^^^^^^^^^^^^^
If you want to build everything by hand, or don't use any of the above
OSes, ``binutils`` is simple to build by hand.
.. code-block:: bash
#!/usr/bin/env bash
V=2.38 # Binutils Version
ARCH=arm # Target architecture
cd ${TMPDIR:-/tmp}
wget -nc https://ftp.gnu.org/gnu/binutils/binutils-$V.tar.gz
wget -nc https://ftp.gnu.org/gnu/binutils/binutils-$V.tar.gz.sig
gpg --keyserver keys.gnupg.net --recv-keys 4AE55E93
gpg --verify binutils-$V.tar.gz.sig
tar xf binutils-$V.tar.gz
mkdir binutils-build
cd binutils-build
export AR=ar
export AS=as
../binutils-$V/configure \
--prefix=${PREFIX:-/usr/local} \
--target=$ARCH-unknown-linux-gnu \
--disable-static \
--disable-multilib \
--disable-werror \
--disable-nls
MAKE=gmake
hash gmake || MAKE=make
$MAKE -j clean all
sudo $MAKE install
+18
View File
@@ -0,0 +1,18 @@
Python Development Headers
-----------------------------
Some of pwntools' Python dependencies require native extensions (for example, Paramiko requires PyCrypto).
In order to build these native extensions, the development headers for Python must be installed.
Ubuntu
^^^^^^^^^^^^^^^^
.. code-block:: bash
$ sudo apt-get install python-dev
Mac OS X
^^^^^^^^^^^^^^^^
No action needed.
+216 -39
View File
@@ -1,53 +1,230 @@
Introduction to pwntools
.. testsetup:: *
from pwn import *
Getting Started
========================
Historically pwntools was used as a sort of exploit-writing DSL. Simply doing
``from pwn import *`` in a previous version of pwntools would bring all sorts of
nice side-effects.
To get your feet wet with pwntools, let's first go through a few examples.
When redesigning pwntools for 2.0, we noticed two contrary goals:
When writing exploits, pwntools generally follows the "kitchen sink" approach.
* We would like to have a "normal" python module structure, to allow other
people to faster get familiar with how pwntools works.
* We would like to have even more side-effects, especially by putting the
terminal in raw-mode.
>>> from pwn import *
To make this possible, we decided to have two different modules. :mod:`pwnlib`
would be our nice, clean python module, while :mod:`pwn` would be used during
CTFs.
This imports a lot of functionality into the global namespace. You can now
assemble, disassemble, pack, unpack, and many other things with a single function.
:mod:`pwnlib` --- Normal python library
---------------------------------------
A full list of everything that is imported is available on :doc:`globals`.
.. module:: pwnlib
This module is our "clean" python-code. As a rule, we do not think that
importing :mod:`pwnlib` or any of the submodules should have any significant
side-effects (besides e.g. caching).
Tutorials
---------
For the most part, you will also only get the bits you import. You for instance
not get access to :mod:`pwnlib.util.packing` simply by doing ``import
pwnlib.util``.
A series of tutorials for Pwntools exists online, at
https://github.com/Gallopsled/pwntools-tutorial#readme
Though there are a few exceptions (such as :mod:`pwnlib.shellcraft`), that does
not quite fit the goals of being simple and clean, but they can still be
imported without implicit side-effects.
:mod:`pwn` --- Toolbox optimized for CTFs
-----------------------------------------
Making Connections
------------------
.. module:: pwn
You need to talk to the challenge binary in order to pwn it, right?
pwntools makes this stupid simple with its :mod:`pwnlib.tubes` module.
As stated, we would also like to have the ability to get a lot of these
side-effects by default. That is the purpose of this module. It does
the following:
This exposes a standard interface to talk to processes, sockets, serial ports,
and all manner of things, along with some nifty helpers for common tasks.
For example, remote connections via :mod:`pwnlib.tubes.remote`.
::
>>> conn = remote('ftp.ubuntu.com',21)
>>> conn.recvline() # doctest: +ELLIPSIS
b'220 ...'
>>> conn.send(b'USER anonymous\r\n')
>>> conn.recvuntil(b' ', drop=True)
b'331'
>>> conn.recvline()
b'Please specify the password.\r\n'
>>> conn.close()
It's also easy to spin up a listener
>>> l = listen()
>>> r = remote('localhost', l.lport)
>>> c = l.wait_for_connection()
>>> r.send(b'hello')
>>> c.recv()
b'hello'
Interacting with processes is easy thanks to :mod:`pwnlib.tubes.process`.
::
>>> sh = process('/bin/sh')
>>> sh.sendline(b'sleep 3; echo hello world;')
>>> sh.recvline(timeout=1)
b''
>>> sh.recvline(timeout=5)
b'hello world\n'
>>> sh.close()
Not only can you interact with processes programmatically, but you can
actually **interact** with processes.
>>> sh.interactive() # doctest: +SKIP
$ whoami
user
There's even an SSH module for when you've got to SSH into a box to perform
a local/setuid exploit with :mod:`pwnlib.tubes.ssh`. You can quickly spawn
processes and grab the output, or spawn a process and interact with it like
a ``process`` tube.
::
>>> shell = ssh('bandit0', 'bandit.labs.overthewire.org', password='bandit0', port=2220)
>>> shell['whoami']
b'bandit0'
>>> shell.download_file('/etc/motd')
>>> sh = shell.run('sh')
>>> sh.sendline(b'sleep 3; echo hello world;') # doctest: +SKIP
>>> sh.recvline(timeout=1)
b''
>>> sh.recvline(timeout=5)
b'hello world\n'
>>> shell.close()
Packing Integers
------------------
A common task for exploit-writing is converting between integers as Python
sees them, and their representation as a sequence of bytes.
Usually folks resort to the built-in ``struct`` module.
pwntools makes this easier with :mod:`pwnlib.util.packing`. No more remembering
unpacking codes, and littering your code with helper routines.
>>> import struct
>>> p32(0xdeadbeef) == struct.pack('I', 0xdeadbeef)
True
>>> leet = unhex('37130000')
>>> u32(b'abcd') == struct.unpack('I', b'abcd')[0]
True
The packing/unpacking operations are defined for many common bit-widths.
>>> u8(b'A') == 0x41
True
Setting the Target Architecture and OS
--------------------------------------
The target architecture can generally be specified as an argument to the routine that requires it.
>>> asm('nop')
b'\x90'
>>> asm('nop', arch='arm')
b'\x00\xf0 \xe3'
However, it can also be set once in the global ``context``. The operating system, word size, and endianness can also be set here.
>>> context.arch = 'i386'
>>> context.os = 'linux'
>>> context.endian = 'little'
>>> context.word_size = 32
Additionally, you can use a shorthand to set all of the values at once.
>>> asm('nop')
b'\x90'
>>> context(arch='arm', os='linux', endian='big', word_size=32)
>>> asm('nop')
b'\xe3 \xf0\x00'
.. doctest::
:hide:
>>> context.clear()
Setting Logging Verbosity
-------------------------
You can control the verbosity of the standard pwntools logging via ``context``.
For example, setting
>>> context.log_level = 'debug'
Will cause all of the data sent and received by a ``tube`` to be printed to the screen.
.. doctest::
:hide:
>>> context.clear()
Assembly and Disassembly
------------------------
Never again will you need to run some already-assembled pile of shellcode
from the internet! The :mod:`pwnlib.asm` module is full of awesome.
>>> enhex(asm('mov eax, 0'))
'b800000000'
But if you do, it's easy to suss out!
>>> print(disasm(unhex('6a0258cd80ebf9')))
0: 6a 02 push 0x2
2: 58 pop eax
3: cd 80 int 0x80
5: eb f9 jmp 0x0
However, you shouldn't even need to write your own shellcode most of the
time! pwntools comes with the :mod:`pwnlib.shellcraft` module, which is
loaded with useful time-saving shellcodes.
Let's say that we want to `setreuid(getuid(), getuid())` followed by `dup`ing
file descriptor 4 to `stdin`, `stdout`, and `stderr`, and then pop a shell!
>>> enhex(asm(shellcraft.setreuid() + shellcraft.dupsh(4))) # doctest: +ELLIPSIS
'6a3158cd80...'
Misc Tools
----------------------
Never write another hexdump, thanks to :mod:`pwnlib.util.fiddling`.
Find offsets in your buffer that cause a crash, thanks to :mod:`pwnlib.cyclic`.
>>> cyclic(20)
b'aaaabaaacaaadaaaeaaa'
>>> # Assume EIP = 0x62616166 (b'faab' which is pack(0x62616166)) at crash time
>>> cyclic_find(b'faab')
120
ELF Manipulation
----------------
Stop hard-coding things! Look them up at runtime with :mod:`pwnlib.elf`.
>>> e = ELF('/bin/cat')
>>> print(hex(e.address)) #doctest: +SKIP
0x400000
>>> print(hex(e.symbols['write'])) #doctest: +SKIP
0x401680
>>> print(hex(e.got['write'])) #doctest: +SKIP
0x60b070
>>> print(hex(e.plt['write'])) #doctest: +SKIP
0x401680
You can even patch and save the files.
>>> e = ELF('/bin/cat')
>>> e.read(e.address, 4)
b'\x7fELF'
>>> e.asm(e.address, 'ret')
>>> e.save('/tmp/quiet-cat')
>>> disasm(open('/tmp/quiet-cat','rb').read(1))
' 0: c3 ret'
* Imports everything from the toplevel :mod:`pwnlib` along with
functions from a lot of submodules. This means that if you do
``import pwn`` or ``from pwn import *``, you will access to
everything you need to write an exploit.
* Calls :func:`pwnlib.term.init` to put your terminal in raw mode
and implementing functionality to make it look like it is not.
* Setting the :data:`pwnlib.context.log_level` to `"info"`.
* Tries to parse some of the values in :data:`sys.argv` and every
value it succeeds in parsing it removes.
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwn import *
from pwnlib.libcdb import *
:mod:`pwnlib.libcdb` --- Libc Database
===========================================
.. automodule:: pwnlib.libcdb
:members:
+17 -7
View File
@@ -1,11 +1,21 @@
:mod:`pwnlib.log` and --- Logging stuff
=================================================================
:mod:`pwnlib.log` --- Logging stuff
===================================
.. automodule:: pwnlib.log
:members:
:members: getLogger, install_default_handler, rootlogger
:mod:`pwnlib.log_levels` --- Possible log levels
------------------------------------------------
.. automodule:: pwnlib.log_levels
.. autoclass:: pwnlib.log.Progress
:members:
:member-order: bysource
.. autoclass:: pwnlib.log.Logger
:members:
:member-order: bysource
.. autoclass:: pwnlib.log.Handler
:members:
:member-order: bysource
.. autoclass:: pwnlib.log.Formatter
:members:
:member-order: bysource
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

+6 -4
View File
@@ -1,7 +1,9 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.memleak` --- Helper class for leaking memory
=========================================================
.. module:: pwnlib.memleak
.. autoclass:: MemLeak
:members:
.. automodule:: pwnlib.memleak
:members:
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.protocols.adb` --- Protocol implementations
========================================================
.. automodule:: pwnlib.protocols.adb
:members:
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.qemu` --- QEMU Utilities
==========================================
.. automodule:: pwnlib.qemu
:members:
+9
View File
@@ -0,0 +1,9 @@
.. testsetup:: *
from pwnlib.regsort import *
:mod:`pwnlib.regsort` --- Register sorting
===========================================================
.. automodule:: pwnlib.regsort
:members:
+5
View File
@@ -0,0 +1,5 @@
:mod:`pwnlib.replacements` --- Replacements for various functions
=================================================================
.. automodule:: pwnlib.replacements
:members:
+10
View File
@@ -0,0 +1,10 @@
:mod:`pwnlib.rop` --- Return Oriented Programming
=================================================
Submodules
----------
.. toctree::
:glob:
rop/*
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwn import *
import tempfile
:mod:`pwnlib.rop.ret2dlresolve` --- Return to dl_resolve
========================================================
.. automodule:: pwnlib.rop.ret2dlresolve
:members:
+27
View File
@@ -0,0 +1,27 @@
.. testsetup:: *
import time
from glob import glob
from pwnlib.asm import asm
from pwnlib import constants
from pwnlib.context import context
from pwnlib.elf import ELF
from pwnlib.rop import ROP
from pwnlib.rop.call import Call, AppendedArgument
from pwnlib.elf.maps import CAT_PROC_MAPS_EXIT
from pwnlib.util.packing import *
from pwnlib.util.fiddling import *
from pwnlib.tubes.process import process
from pwnlib import shellcraft
from pwnlib.util.misc import which
import pwnlib.data
context.clear()
:mod:`pwnlib.rop.rop` --- Return Oriented Programming
==========================================================
.. automodule:: pwnlib.rop.rop
:members:
+14
View File
@@ -0,0 +1,14 @@
.. testsetup:: *
from pwnlib.rop.srop import *
from pwnlib import constants
from pwnlib import shellcraft
from pwnlib.elf import ELF
from pwnlib.tubes.process import process
:mod:`pwnlib.rop.srop` --- Sigreturn Oriented Programming
==========================================================
.. automodule:: pwnlib.rop.srop
:members:
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwnlib.runner import *
from pwnlib.asm import asm
:mod:`pwnlib.runner` --- Running Shellcode
===========================================
.. automodule:: pwnlib.runner
:members:
+19
View File
@@ -0,0 +1,19 @@
.. testsetup:: *
from pwn import *
context.clear(arch='aarch64')
:mod:`pwnlib.shellcraft.aarch64` --- Shellcode for AArch64
===========================================================
:mod:`pwnlib.shellcraft.aarch64`
--------------------------------
.. automodule:: pwnlib.shellcraft.aarch64
:members:
:mod:`pwnlib.shellcraft.aarch64.linux`
--------------------------------------
.. automodule:: pwnlib.shellcraft.aarch64.linux
:members:
+25
View File
@@ -0,0 +1,25 @@
.. testsetup:: *
from pwn import *
context.clear(arch='amd64')
:mod:`pwnlib.shellcraft.amd64` --- Shellcode for AMD64
===========================================================
:mod:`pwnlib.shellcraft.amd64`
---------------------------------------
.. automodule:: pwnlib.shellcraft.amd64
:members:
:mod:`pwnlib.shellcraft.amd64.linux`
---------------------------------------
.. automodule:: pwnlib.shellcraft.amd64.linux
:members:
:mod:`pwnlib.shellcraft.amd64.windows`
---------------------------------------
.. automodule:: pwnlib.shellcraft.amd64.windows
:members:
+19
View File
@@ -0,0 +1,19 @@
.. testsetup:: *
from pwn import *
context.clear(arch='arm')
:mod:`pwnlib.shellcraft.arm` --- Shellcode for ARM
===========================================================
:mod:`pwnlib.shellcraft.arm`
-----------------------------
.. automodule:: pwnlib.shellcraft.arm
:members:
:mod:`pwnlib.shellcraft.arm.linux`
-----------------------------------
.. automodule:: pwnlib.shellcraft.arm.linux
:members:
+5
View File
@@ -1,3 +1,8 @@
.. testsetup:: *
from pwn import *
context.clear(arch='i386')
:mod:`pwnlib.shellcraft.i386` --- Shellcode for Intel 80386
===========================================================
+28
View File
@@ -0,0 +1,28 @@
.. testsetup:: *
import tempfile
from pwnlib import shellcraft
from pwnlib.asm import asm
from pwnlib.context import context
from pwnlib.runner import run_assembly
from pwnlib.util.fiddling import enhex
from pwnlib.util.misc import write
context.clear(arch='mips')
:mod:`pwnlib.shellcraft.mips` --- Shellcode for MIPS
===========================================================
:mod:`pwnlib.shellcraft.mips`
-----------------------------
.. automodule:: pwnlib.shellcraft.mips
:members:
:mod:`pwnlib.shellcraft.mips.linux`
-----------------------------------
.. automodule:: pwnlib.shellcraft.mips.linux
:members:
+19
View File
@@ -0,0 +1,19 @@
.. testsetup:: *
from pwn import *
context.clear(arch='riscv64')
:mod:`pwnlib.shellcraft.riscv64` --- Shellcode for RISCV64
==========================================================
:mod:`pwnlib.shellcraft.riscv64`
--------------------------------
.. automodule:: pwnlib.shellcraft.riscv64
:members:
:mod:`pwnlib.shellcraft.riscv64.linux`
--------------------------------------
.. automodule:: pwnlib.shellcraft.riscv64.linux
:members:
+19
View File
@@ -0,0 +1,19 @@
.. testsetup:: *
from pwn import *
context.clear(arch='thumb')
:mod:`pwnlib.shellcraft.thumb` --- Shellcode for Thumb Mode
===========================================================
:mod:`pwnlib.shellcraft.thumb`
-------------------------------
.. automodule:: pwnlib.shellcraft.thumb
:members:
:mod:`pwnlib.shellcraft.thumb.linux`
---------------------------------------
.. automodule:: pwnlib.shellcraft.thumb.linux
:members:
+6
View File
@@ -3,3 +3,9 @@
.. automodule:: pwnlib.term
:members:
Term Modules
-------------------
.. toctree::
term/readline
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwnlib.term.readline import *
import io
:mod:`pwnlib.term.readline` --- Terminal nice readline
======================================================
.. automodule:: pwnlib.term.readline
:members:
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
import os
from pwnlib.testexample import add
:mod:`pwnlib.testexample` --- Example Test Module
==================================================
.. automodule:: pwnlib.testexample
:members:
+11
View File
@@ -0,0 +1,11 @@
.. testsetup:: *
from pwnlib.context import context
from pwnlib.timeout import Timeout
import time
:mod:`pwnlib.timeout` --- Timeout handling
============================================
.. automodule:: pwnlib.timeout
:members:
+18 -44
View File
@@ -1,56 +1,30 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.tubes` --- Talking to the World!
=============================================
.. automodule:: pwnlib.tubes
Sockets
-------
.. automodule:: pwnlib.tubes.remote
Types of Tubes
-------------------
.. autoclass:: pwnlib.tubes.remote.remote(host, port, fam = None, typ = None, proto = 0, timeout = 'default', log_level = INFO)
:members:
:show-inheritance:
.. toctree::
:maxdepth: 3
:glob:
.. automodule:: pwnlib.tubes.listen
.. autoclass:: pwnlib.tubes.listen.listen(port, bindaddr = "0.0.0.0", fam = "any", typ = "tcp", timeout = 'default', log_level = INFO)
:members:
:show-inheritance:
.. automodule:: pwnlib.tubes.sock
.. autoclass:: pwnlib.tubes.sock.sock()
:show-inheritance:
Processes
---------
.. automodule:: pwnlib.tubes.process
.. autoclass:: pwnlib.tubes.process.process(args, shell = False, executable = None, env = None, timeout = 'default', log_level = INFO)
:members: kill, poll, communicate
:show-inheritance:
SSH
---
.. automodule:: pwnlib.tubes.ssh
.. autoclass:: pwnlib.tubes.ssh.ssh(user, host, port = 22, password = None, key = None, keyfile = None, proxy_command = None, proxy_sock = None, timeout = 'default', log_level = INFO)
:members:
.. autoclass:: pwnlib.tubes.ssh.ssh_channel()
:members: kill, poll, interactive
:show-inheritance:
tubes/*
Common functionality
--------------------
:mod:`pwnlib.tubes.tube` --- Common Functionality
-------------------------------------------------
.. automodule:: pwnlib.tubes.tube
.. autoclass:: pwnlib.tubes.tube.tube()
:members:
:exclude-members: recv_raw, send_raw, settimeout_raw,
can_recv_raw
.. automodule:: pwnlib.tubes.tube
.. autoclass:: pwnlib.tubes.tube.tube()
:members:
:exclude-members: recv_raw, send_raw, settimeout_raw,
can_recv_raw, shutdown_raw, connected_raw,
+9
View File
@@ -0,0 +1,9 @@
.. testsetup:: *
from pwnlib.tubes.buffer import *
:mod:`pwnlib.tubes.buffer` --- buffer implementation for tubes
==============================================================
.. automodule:: pwnlib.tubes.buffer
:members:
+12
View File
@@ -0,0 +1,12 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.tubes.process` --- Processes
===========================================================
.. automodule:: pwnlib.tubes.process
.. autoclass:: pwnlib.tubes.process.process
:members:
:show-inheritance:
+11
View File
@@ -0,0 +1,11 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.tubes.serialtube` --- Serial Ports
===========================================================
.. automodule:: pwnlib.tubes.serialtube
.. autoclass:: pwnlib.tubes.serialtube.serialtube
:members:
+32
View File
@@ -0,0 +1,32 @@
.. testsetup:: *
from pwn import *
from pwnlib.tubes.server import server
:mod:`pwnlib.tubes.sock` --- Sockets
===========================================================
.. automodule:: pwnlib.tubes.sock
.. autoclass:: pwnlib.tubes.sock.sock()
:show-inheritance:
.. automodule:: pwnlib.tubes.remote
.. autoclass:: pwnlib.tubes.remote.remote
:members:
:show-inheritance:
.. automodule:: pwnlib.tubes.listen
.. autoclass:: pwnlib.tubes.listen.listen
:members:
:show-inheritance:
.. automodule:: pwnlib.tubes.server
.. autoclass:: pwnlib.tubes.server.server
:members:
:show-inheritance:
+25
View File
@@ -0,0 +1,25 @@
.. testsetup:: *
from pwn import *
:mod:`pwnlib.tubes.ssh` --- SSH
===========================================================
.. automodule:: pwnlib.tubes.ssh
.. autoclass:: pwnlib.tubes.ssh.ssh
:members:
.. autoclass:: pwnlib.tubes.ssh.ssh_channel()
:members: kill, poll, interactive
:show-inheritance:
.. autoclass:: pwnlib.tubes.ssh.ssh_process
:members:
:show-inheritance:
.. autoclass:: pwnlib.tubes.ssh.ssh_connecter()
:show-inheritance:
.. autoclass:: pwnlib.tubes.ssh.ssh_listener()
:show-inheritance:
+5
View File
@@ -1,3 +1,8 @@
.. testsetup:: *
from pwn import *
import io
:mod:`pwnlib.ui` --- Functions for user interaction
===================================================
+10
View File
@@ -0,0 +1,10 @@
.. testsetup:: *
from pwn import *
from pwnlib.update import *
:mod:`pwnlib.update` --- Updating Pwntools
===================================================
.. automodule:: pwnlib.update
:members:
+9
View File
@@ -0,0 +1,9 @@
.. testsetup:: *
from pwnlib.useragents import *
:mod:`pwnlib.useragents` --- A database of useragent strings
============================================================
.. automodule:: pwnlib.useragents
:members:
+1
View File
@@ -1,5 +1,6 @@
.. testsetup:: *
from pwn import *
from pwnlib.util.cyclic import *
+2 -1
View File
@@ -1,6 +1,7 @@
.. testsetup:: *
from pwnlib.util.fiddling import *
from pwn import *
from pwnlib.util.fiddling import *
:mod:`pwnlib.util.fiddling` --- Utilities bit fiddling
+11
View File
@@ -0,0 +1,11 @@
.. testsetup:: *
from pwnlib.util.getdents import *
from pwnlib.util.fiddling import unhex
:mod:`pwnlib.util.getdents` --- Linux binary directory listing
==============================================================
.. automodule:: pwnlib.util.getdents
:members:
+5
View File
@@ -0,0 +1,5 @@
:mod:`pwnlib.util.hashes` --- Hashing functions
===============================================
.. automodule:: pwnlib.util.hashes
:members:
Loaded 100 of 1413 files, more files were not shown because too many files have changed in this diff. Show more