Skip to content

Commit

Permalink
Merge pull request #1274 from Gallopsled/stable
Browse files Browse the repository at this point in the history
Merge travis-ci related changes on stable into dev
  • Loading branch information
Arusekk committed Feb 22, 2019
2 parents 5fa4fcd + 547905f commit f5062f7
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 18 deletions.
15 changes: 11 additions & 4 deletions .travis.yml
@@ -1,4 +1,4 @@
dist: trusty
dist: xenial
language: python
addons:
apt:
Expand All @@ -13,15 +13,22 @@ addons:
- zsh
- pandoc
- gdb
- binutils
- qemu-user-static
- binutils-multiarch
- binutils-aarch64-linux-gnu
- binutils-arm-linux-gnueabihf
- binutils-mips-linux-gnu
- binutils-powerpc-linux-gnu
cache:
- pip
- directories:
- usr
- /home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/
- /home/travis/virtualenv/python2.7.13/bin/
- /home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/
- /home/travis/virtualenv/python2.7.15/bin/
sudo: required
python:
- "2.7"
- "2.7.15"
before_install:
- echo $-
- source travis/install.sh
Expand Down
1 change: 1 addition & 0 deletions docs/source/util/proc.rst
@@ -1,6 +1,7 @@
.. testsetup:: *

from pwnlib.util.proc import *
from pwnlib.tubes.process import process
import os, sys


Expand Down
14 changes: 7 additions & 7 deletions pwnlib/asm.py
Expand Up @@ -36,7 +36,7 @@
To disassemble code, simply invoke :func:`disasm` on the bytes to disassemble.
>>> disasm('\xb8\x0b\x00\x00\x00')
' 0: b8 0b 00 00 00 mov eax,0xb'
' 0: b8 0b 00 00 00 mov eax, 0xb'
"""
from __future__ import absolute_import
Expand Down Expand Up @@ -735,15 +735,15 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
Examples:
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386')
0: b8 5d 00 00 00 mov eax,0x5d
0: b8 5d 00 00 00 mov eax, 0x5d
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386', byte = 0)
0: mov eax,0x5d
0: mov eax, 0x5d
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386', byte = 0, offset = 0)
mov eax,0x5d
mov eax, 0x5d
>>> print disasm('b817000000'.decode('hex'), arch = 'amd64')
0: b8 17 00 00 00 mov eax,0x17
0: b8 17 00 00 00 mov eax, 0x17
>>> print disasm('48c7c017000000'.decode('hex'), arch = 'amd64')
0: 48 c7 c0 17 00 00 00 mov rax,0x17
0: 48 c7 c0 17 00 00 00 mov rax, 0x17
>>> print disasm('04001fe552009000'.decode('hex'), arch = 'arm')
0: e51f0004 ldr r0, [pc, #-4] ; 0x4
4: 00900052 addseq r0, r0, r2, asr r0
Expand Down Expand Up @@ -814,4 +814,4 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
line += i
lines.append(line)

return '\n'.join(lines)
return re.sub(',([^ ])', r', \1', '\n'.join(lines))
8 changes: 6 additions & 2 deletions pwnlib/shellcraft/templates/thumb/linux/findpeer.asm
@@ -1,11 +1,15 @@
<% from pwnlib.shellcraft.thumb.linux import mov %>
<% from pwnlib.shellcraft.thumb import mov %>
<% from socket import htons %>
<%page args="port = None"/>
<%docstring>
findpeer(port)

Finds a connected socket. If port is specified it is checked
against the peer port. Resulting socket is left in r6.

Example:
>>> enhex(asm(shellcraft.findpeer(1337)))
'6ff00006ee4606f101064ff001074fea072707f11f07f54630461fb401a96a4601df0130efdd01994fea11414ff039024fea022202f105029142e4d1'
</%docstring>
findpeer:
/* File descriptor in r6 */
Expand Down Expand Up @@ -52,7 +56,7 @@ compare_port:
ldr r1, [sp, #4]
lsr r1, #16

/* Put the port (${port}) to search for into r1 */
/* Put the port (${port}) to search for into r2 */
${mov('r2', htons(int(port)))}

/* Is it the one we have been searching for? */
Expand Down
6 changes: 5 additions & 1 deletion pwnlib/shellcraft/templates/thumb/linux/listen.asm
@@ -1,11 +1,15 @@
<% from pwnlib.shellcraft.thumb.linux import mov %>
<% from pwnlib.shellcraft.thumb import mov %>
<% from socket import htons %>
<%page args="port, network='ipv4'"/>
<%docstring>
listen(port,network)

Listens on a TCP port, accept a client and leave his socket in r6.
Port is the TCP port to listen on, network is either 'ipv4' or 'ipv6'.

Example:
>>> enhex(asm(shellcraft.listen(1337, 'ipv4')))
'4ff001074fea072707f119074ff002004ff0010182ea020201df0646004901e00200053906b469464ff0100207f1010701df30464ff0010107f1020701df304681ea010182ea020207f1010701df0646'
</%docstring>
/* First create listening socket */
${mov('r7', 'SYS_socket')}
Expand Down
6 changes: 3 additions & 3 deletions pwnlib/util/proc.py
Expand Up @@ -100,9 +100,9 @@ def name(pid):
Name of process as listed in ``/proc/<pid>/status``.
Example:
>>> pid = pidof('init')[0]
>>> name(pid) == 'init'
True
>>> p = process('cat')
>>> name(p.pid)
'cat'
"""
return psutil.Process(pid).name()

Expand Down
2 changes: 1 addition & 1 deletion travis/install.sh
Expand Up @@ -184,7 +184,7 @@ setup_osx()
}

if [[ "$USER" == "travis" ]]; then
setup_travis
# setup_travis
setup_android_emulator
elif [[ "$USER" == "shippable" ]]; then
sudo apt-get update
Expand Down

0 comments on commit f5062f7

Please sign in to comment.