Skip to content

0xddaa/pwntools

Repository files navigation

pwntools - CTF toolkit.

pwntools logo

Docs PyPI Travis Coveralls Twitter MIT License

Pwntools is a CTF framework and exploit development library. Written in Python, it is designed for rapid prototyping and development, and intended to make exploit writing as simple as possible.


There are some features that added by ddaa as below:

pwnlib.tube

1. The length limit for send and sendline.

The length limit is an efficient way to prevent from sending excess data by accident when we do not check the termination condition of input function carefully.

def send(self, data, n=-1):
    """send(data, n)

    Sends data. If the second argument `n` is given, only send the n bytes of data.

    Examples:

        >>> def p(x): print repr(x)
        >>> t = tube()
        >>> t.send_raw = p
        >>> t.send('a'*0x100, 0x10)
        ''aaaaaaaaaaaaaaaa''
    """

2. pwnlib.tube.leak function

The purpose of the leaking function is automatically receving the prefix and pack the address to an integer. For example, there is a off-by-one vulnerabiliy and we can fill the buffer up to leak the content on the stack. In the past, we may need to call recvuntil at first to filter redundant data. Then, we received the data which included memory address, such as stack frame pointer, and add paddings to unpack into an integer. Now, we can call leak to finish in a line.

def leak(self, delim_start='', delim_end='\n', timeout=default):
    """leak() -> int
    Leak and pack the address into an integer.

    Examples:

        >>> t = tube()
        >>> t.unrecv('a'*10 + p32(0x1234) + '\n')
        >>> hex(t.leak(delim_start='a'*10))
        '0x1234'
    """

pwnlib.elf

1. pwnlib.elf.binsh

We always need '/bin/sh' string when get the shell.

    Examples:

        >>> libc = ELF('libc.so.6')
        >>> hex(libc.binsh)
        >>> '0x18c177'

About

Some customization for pwntools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages