diff --git a/rev_shell.py b/rev_shell.py index 16b47f4..93f1899 100755 --- a/rev_shell.py +++ b/rev_shell.py @@ -98,6 +98,7 @@ class ShellListener: print("[-] Disconnected") self.connection = None + self.running = False def close(self): self.running = False @@ -432,7 +433,7 @@ def wait_for_connection(listener, timeout=None, prompt=True): else: print(prompt) - while listener.connection is None: + while listener.connection is None and listener.running: time.sleep(0.5) if timeout is not None: diff = time.time() - start diff --git a/util.py b/util.py index 78d1619..696c013 100755 --- a/util.py +++ b/util.py @@ -321,7 +321,7 @@ def pad(x, n, b=b"\x00", s="r"): x = (n-(len(x)%n))*b + x return x -def xor(a, b): +def xor(a, b, *args): if isinstance(a, int): a = a.to_bytes(math.ceil(math.log(a)/math.log(2)/8.0)) if isinstance(b, int): @@ -345,9 +345,12 @@ def xor(a, b): if type(b) not in (bytes, bytearray): b = b.encode() - + result = b"".join([bytes([c1 ^ c2]) for (c1,c2) in zip(a, b) ]) - return b"".join([bytes([c1 ^ c2]) for (c1,c2) in zip(a, b) ]) + if len(args) > 0: + result = xor(result, *args) + + return result def base64urldecode(data): if isinstance(data, str):