Skip to main content

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

```python
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:

```python
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)

```python
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



```python
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.

### 0x04 get main_arean



use obj dump get main_arean offest



### TODO

quick find magic function add, like main_arean,malloc_hook...

- [x] malloc_hook

- [ ] Free_hook

- [x] main_arean

- [ ] system

- [ ] onegadget

.....

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swpwn-1.0.3.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file swpwn-1.0.3.tar.gz.

File metadata

  • Download URL: swpwn-1.0.3.tar.gz
  • Upload date:
  • Size: 5.5 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

Hashes for swpwn-1.0.3.tar.gz
Algorithm Hash digest
SHA256 00f15f245b6cee1b3b2c56def00e0d5373c64bb24006eae0d91d3f5f3ed66227
MD5 b95c23c73b69f1b5ea9c056b8a684d72
BLAKE2b-256 794d7a365a39f271b0eba7e176595435197059d5d57b10be55d8a136489f2c8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page