Compare commits

...
3 Commits
Author SHA1 Message Date
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 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
7 changed files with 43 additions and 9 deletions

No files matched your search

+10 -1
View File
@@ -11,7 +11,8 @@ The table below shows which release corresponds to each branch, and what date th
| ---------------- | -------- | ---------------------- |
| [3.7.0](#350) | `dev` | Jun 17, 2017 (planned)
| [3.6.0](#350) | `beta` | May 6, 2017 (planned)
| [3.5.0](#350) | `stable` | Mar 26, 2017
| [3.5.1](#351) | `stable` | Apr 15, 2017
| [3.5.0](#350) | | Mar 26, 2017
| [3.4.1](#341) | | Feb 17, 2017
| [3.4.0](#340) | | Feb 13, 2017
| [3.3.4](#334) | | Jan 12, 2016
@@ -59,6 +60,14 @@ To be released on May 6, 2017.
[905]: https://github.com/Gallopsled/pwntools/pull/905
[919]: https://github.com/Gallopsled/pwntools/pull/919
## 3.5.1
- [#945][945] Speed up ssh via caching checksec results (fixes [#944][944])
- [#950][950] Fixes a bug where setting `context.arch` does not have an effect on `adb.compile()` output architecture
[944]: https://github.com/Gallopsled/pwntools/issues/944
[945]: https://github.com/Gallopsled/pwntools/pull/945
[950]: https://github.com/Gallopsled/pwntools/pull/950
## 3.5.0
+1 -1
View File
@@ -2,7 +2,7 @@
![pwntools logo](https://github.com/Gallopsled/pwntools/blob/stable/docs/source/logo.png?raw=true)
[![Docs](https://readthedocs.org/projects/pwntools/badge/?version=stable)](https://docs.pwntools.com/)
[![PyPI](https://img.shields.io/badge/pypi-v3.5.0-green.svg?style=flat)](https://pypi.python.org/pypi/pwntools/)
[![PyPI](https://img.shields.io/badge/pypi-v3.5.1-green.svg?style=flat)](https://pypi.python.org/pypi/pwntools/)
[![Travis](https://travis-ci.org/Gallopsled/pwntools.svg)](https://travis-ci.org/Gallopsled/pwntools)
[![Coveralls](https://img.shields.io/coveralls/Gallopsled/pwntools/dev.svg)](https://coveralls.io/github/Gallopsled/pwntools?branch=dev)
[![Twitter](https://img.shields.io/badge/twitter-pwntools-4099FF.svg?style=flat)](https://twitter.com/pwntools)
+11 -1
View File
@@ -1197,14 +1197,24 @@ def compile(source):
if not project:
# Realistically this should inherit from context.arch, but
# this works for now.
abi = 'armeabi-v7a'
sdk = '21'
abi = {
'aarch64': 'arm64-v8a',
'amd64': 'x86_64',
'arm': 'armeabi-v7a',
'i386': 'x86',
'mips': 'mips',
'mips64': 'mips64',
}.get(context.arch, None)
# If we have an attached device, use its settings.
if context.device:
abi = str(properties.ro.product.cpu.abi)
sdk = str(properties.ro.build.version.sdk)
if abi is None:
log.error("Unknown CPU ABI")
project = _generate_ndk_project(source, abi, sdk)
# Remove any output files
+1 -1
View File
@@ -1127,7 +1127,7 @@ class ContextType(object):
self.os = device.os or self.os
elif isinstance(device, str):
device = Device(device)
else:
elif device is not None:
raise AttributeError("device must be either a Device object or a serial number as a string")
return device
+18 -3
View File
@@ -624,7 +624,7 @@ class ssh(Timeout, Logger):
try:
self.info_once(self.checksec())
except Exception:
log.warn_once("Couldn't check security settings on %r" % self.host)
self.warn_once("Couldn't check security settings on %r" % self.host)
@property
def sftp(self):
@@ -1973,6 +1973,16 @@ from ctypes import *; libc = CDLL('libc.so.6'); print(libc.getenv(%r))
return self._aslr_ulimit
def _checksec_cache(self, value=None):
path = self._get_cachefile('%s-%s' % (self.host, self.port))
if value is not None:
with open(path, 'w+') as f:
f.write(value)
else:
with open(path, 'r+') as f:
return f.read()
def checksec(self, banner=True):
"""checksec()
@@ -1981,6 +1991,10 @@ from ctypes import *; libc = CDLL('libc.so.6'); print(libc.getenv(%r))
Arguments:
banner(bool): Whether to print the path to the ELF binary.
"""
cached = self._checksec_cache()
if cached:
return cached
red = text.red
green = text.green
yellow = text.yellow
@@ -2001,5 +2015,6 @@ from ctypes import *; libc = CDLL('libc.so.6'); print(libc.getenv(%r))
if self.aslr_ulimit:
res += [ "Note:".ljust(10) + red("Susceptible to ASLR ulimit trick (CVE-2016-3672)")]
return '\n'.join(res)
cached = '\n'.join(res)
self._checksec_cache(cached)
return cached
+1 -1
View File
@@ -1 +1 @@
__version__ = '3.5.0'
__version__ = '3.5.1'
+1 -1
View File
@@ -85,7 +85,7 @@ except Exception as e:
setup(
name = 'pwntools',
packages = find_packages(),
version = '3.5.0',
version = '3.5.1',
data_files = [('',
glob.glob('*.md') + glob.glob('*.txt')),
],