Skip to content

Commit

Permalink
Merge branch 'stable' into mips_mov_typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Arusekk committed May 21, 2023
2 parents e1bf94b + 8f122c3 commit ddb5379
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -198,6 +198,8 @@ jobs:
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
Expand All @@ -207,10 +209,7 @@ jobs:
path: dist

- name: Publish package
uses: pypa/gh-action-pypi-publish@v1.1.0
with:
user: __token__
password: ${{ secrets.pypi_password }}
uses: pypa/gh-action-pypi-publish@release/v1

- if: failure()
run: ls -R
4 changes: 2 additions & 2 deletions pwnlib/commandline/disasm.py
Expand Up @@ -82,9 +82,9 @@ def main(args):
instrs = disasm(dat, vma=safeeval.const(args.address), byte=False, offset=False)
# instrs = highlight(instrs, PwntoolsLexer(), TerminalFormatter())

highlight_bytes = lambda t: ''.join(map(lambda x: x.replace('00', text.red('00')).replace('0a', text.red('0a')), group(2, t)))
for o,b,i in zip(*map(str.splitlines, (offsets, bytes, instrs))):
b = b.replace('00', text.red('00'))
b = b.replace('0a', text.red('0a'))
b = ' '.join(highlight_bytes(bb) for bb in b.split(' '))
i = highlight(i.strip(), PwntoolsLexer(), TerminalFormatter()).strip()
i = i.replace(',',', ')

Expand Down
2 changes: 1 addition & 1 deletion pwnlib/elf/elf.py
Expand Up @@ -225,7 +225,7 @@ def __init__(self, path, checksec=True):
super(ELF,self).__init__(self.mmap)

#: :class:`str`: Path to the file
self.path = os.path.abspath(path)
self.path = packing._need_text(os.path.abspath(path))

#: :class:`str`: Architecture of the file (e.g. ``'i386'``, ``'arm'``).
#:
Expand Down
13 changes: 7 additions & 6 deletions pwnlib/libcdb.py
Expand Up @@ -25,7 +25,10 @@
log = getLogger(__name__)

HASHES = ['build_id', 'sha1', 'sha256', 'md5']
DEBUGINFOD_SERVERS = ['https://debuginfod.systemtap.org/']
DEBUGINFOD_SERVERS = [
'https://debuginfod.systemtap.org',
'https://debuginfod.ubuntu.com',
] + os.environ.get('DEBUGINFOD_SERVERS', '').split()

# https://gitlab.com/libcdb/libcdb wasn't updated after 2019,
# but still is a massive database of older libc binaries.
Expand Down Expand Up @@ -202,20 +205,18 @@ def unstrip_libc(filename):
:const:`True` if binary was unstripped, :const:`False` otherwise.
Examples:
>>> filename = search_by_build_id('2d1c5e0b85cb06ff47fa6fa088ec22cb6e06074e', unstrip=False)
>>> filename = search_by_build_id('69389d485a9793dbe873f0ea2c93e02efaa9aa3d', unstrip=False)
>>> libc = ELF(filename)
>>> hex(libc.symbols.read)
'0xe56c0'
>>> 'main_arena' in libc.symbols
False
>>> unstrip_libc(filename)
True
>>> libc = ELF(filename)
>>> hex(libc.symbols.main_arena)
'0x1d57a0'
'0x219c80'
>>> unstrip_libc(which('python'))
False
>>> filename = search_by_build_id('06a8004be6e10c4aeabbe0db74423ace392a2d6b', unstrip=True)
>>> filename = search_by_build_id('d1704d25fbbb72fa95d517b883131828c0883fe9', unstrip=True)
>>> 'main_arena' in ELF(filename).symbols
True
"""
Expand Down
4 changes: 2 additions & 2 deletions pwnlib/tubes/ssh.py
Expand Up @@ -1633,7 +1633,7 @@ def upload_dir(self, local, remote=None):
remote: Remote directory
"""

remote = remote or self.cwd
remote = packing._encode(remote or self.cwd)

local = os.path.expanduser(local)
dirname = os.path.dirname(local)
Expand All @@ -1654,7 +1654,7 @@ def upload_dir(self, local, remote=None):
remote_tar = self.mktemp('--suffix=.tar.gz')
self.upload_file(local_tar, remote_tar)

untar = self.run('cd %s && tar -xzf %s' % (remote, remote_tar))
untar = self.run(b'cd %s && tar -xzf %s' % (sh_string(remote), sh_string(remote_tar)))
message = untar.recvrepeat(2)

if untar.wait() != 0:
Expand Down
2 changes: 1 addition & 1 deletion pwnlib/util/web.py
Expand Up @@ -25,7 +25,7 @@ def wget(url, save=None, timeout=5, **kwargs):
Example:
>>> url = 'https://httpbin.org/robots.txt'
>>> url = 'https://httpbingo.org/robots.txt'
>>> result = wget(url, timeout=60)
>>> result
b'User-agent: *\nDisallow: /deny\n'
Expand Down

0 comments on commit ddb5379

Please sign in to comment.