November 29, 2017

How to run other programs in Python


How to run other programs in Python

This program encrypts(md5) input values after captcha authentication.

The program download is available here(Link).




How to run other programs with pwntools

And this is md5.py that reads the captcha, inputs it, and inputs the string "test".

The source code is below.




<md5.py>
from pwn import *

pHash = process("/root/test/hash")

pHash.recvline()
pHash.recvuntil(": ")
theCaptcha = pHash.recvline()
pHash.send(theCaptcha)

pHash.recvline()
pHash.recvline()

pHash.send("test\n")

rst = pHash.recvall()
print rst


❑ recvline() : Read until "\n" is encountered.
❑ recvuntil("str") : Read until "str" is encountered.
❑ recvall() : Read until the end.

❑ send("str") : Send the string "str"