My short description for my project.
Project description
Outline
about swpwn
wrapper for pwtools, Debug and exploit for CTF .
A pwn framework(based on pwntools) aiming at eliminating dull work while scripting and debugging.
Install
python setup.py install
or copy the swpwn.py to your directory
usage
0x01 init pwn
from swpwn import *
io,elf,libc = init_pwn(BIN_FILE = 'bin',LIBC_FILE='libc.so.6',remote_detail=('127.0.0.1',23333),is_env = False)
fecture:
def init_pwn(BIN_FILE = '',LIBC_FILE='',remote_detail=('127.0.0.1',23333),is_env = False):
"""
init pwn infomation
usage: binary ,libc.so ,remote ip and port and if use libc to debug
return io,elf,libc
"""
global io
elf = ELF(BIN_FILE)
# if LIBC_FILE:
# libc = ELF(LIBC_FILE)
# else:
# libc = elf.libc
# io = process(binary,env = {'LD_PRELOAD': './libc.so.6'})
env = {'LD_PRELOAD':os.getcwd() + '/' + LIBC_FILE}
if opt.local:
if is_env:
io = process(BIN_FILE,env=env)
libc = ELF(LIBC_FILE)
else:
io = process(BIN_FILE)
libc = elf.libc
else:
io = remote(remote_detail[0],remote_detail[1],timeout=5)
libc = ELF(LIBC_FILE)
return io,elf,libc
0x02 init debug
call init_debug(io,breakpoint=['0x1234','0xdeadbeef'],pie = False)
def init_debug(io,breakpint=[],pie = False):
"""
init debug
usage: io, breakpoint ,pie if open
return breakpoint and get gdb attach PID
"""
if pie:
base_addr = get_base_addr(proc.pidof(io)[0])
bp = ''.join(['b *0x%x\n'%(b+base_addr) for b in breakpint])
else:
bp = ''.join(['b *0x%x\n'% b for b in breakpint])
gdb.attach(proc.pidof(io)[0],bp)
return bp
if your binary open pie, you can set pie is true ,than the program will auto find the code base by get_base_addrt function.
0x03 quick script
ru = lambda x : io.recvuntil(x)
sn = lambda x : io.send(x)
rl = lambda : io.recvline()
sl = lambda x : io.sendline(x)
rv = lambda x : io.recv(x)
sa = lambda a,b : io.sendafter(a,b)
sla = lambda a,b : io.sendlineafter(a,b)
we can use the simple word to call IO Function.
TODO
quick find magic function add, like main_arean,malloc_hook...
-
malloc_hook
-
Free_hook
-
main_arean
-
system
-
onegadget
.....
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swpwn-1.0.2.tar.gz.
File metadata
- Download URL: swpwn-1.0.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.2.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c0f2d8f1d2dfd56844b41b9847eb76fedda034745f4a0abdfd9b1fd55c2344f
|
|
| MD5 |
8f839a1d486ffad642bb0da8a5c6604d
|
|
| BLAKE2b-256 |
5ac873a7bca111ac76298ece74335590371a50f219bcb7b6c1da0fd24cb407ff
|
File details
Details for the file swpwn-1.0.2-py2.py3-none-any.whl.
File metadata
- Download URL: swpwn-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.2.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b46e780cafbbcc12b3b5e497df17880d23d659252df6ecea67e6481efe529768
|
|
| MD5 |
b49c4bc02396869f64b5b20529ee25ee
|
|
| BLAKE2b-256 |
e9aeaf15d45ffb2e768be206b2e01891f3d6eebd7d63c4dec872be5ca693f486
|
File details
Details for the file swpwn-1.0.2-py2.7.egg.
File metadata
- Download URL: swpwn-1.0.2-py2.7.egg
- Upload date:
- Size: 10.3 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.2.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b305bdd26f2ac1bb8e20094f2445f78ff73f098aa105b5db4c8a6bee10ecc5fe
|
|
| MD5 |
52554a4ad03209b42b45f942759d85f2
|
|
| BLAKE2b-256 |
e4b5d77e913bccb3402f60bd8428d53e5f8525d4fe083c054e38818368692467
|