Skip to content

Instantly share code, notes, and snippets.

@minhtt159
Created November 19, 2017 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minhtt159/e359b688da91402db019d5da3b1ffd94 to your computer and use it in GitHub Desktop.
Save minhtt159/e359b688da91402db019d5da3b1ffd94 to your computer and use it in GitHub Desktop.
SvATTT2017 - Shellcap
f = open('raw','rb').read()
dic = {}
maxx = 0
for i in range(0,len(f),3):
offset, data = int(f[i:i+2].encode('hex'),16),f[i+2].encode('hex')
# print offset, data
if offset > maxx:
maxx = offset
dic[offset] = data
shell = ''
for i in range(maxx):
try:
shell += dic[i]
except:
shell += '00'
f = open('shell','wb')
f.write(shell.decode('hex'))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment