Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import datetime
- import socket
- # Initialization
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- host = '192.168.56.1'
- port = 80
- address = (host, int(port))
- print("[+] Starting Server")
- sock.bind(address)
- sock.listen(1)
- # Options for interacting with malware
- options = ["", "", "", "", "", ""]
- while(1):
- # Local Variables
- i = 0
- print("[+] Waiting on a Connection")
- connection, client = sock.accept()
- data = connection.recv(8196)
- # Interacting with the Malware
- print("Recieved:", data.decode())
- # Reponse construction
- date = datetime.datetime.now().time()
- server = "\nServer: Apache/2.24\r\n"
- connect = "Connection: close\r\n\r\n"
- result = "HTTP/1.1 200 OK\r\n"
- length = "Content-Length: 16\r\n"
- content = "Content-Type: text/html\r\n"
- # Prints options
- for x in options:
- i += 1
- print("[%s] %s" % (i, x))
- # No Error Checking
- choice = input("\n\n[+] Selection an option.\nex. 1, 2, 3 .. \n")
- # Building HTTP Response
- header = result + str(date) + server + content + \
- length + connect + options[int(choice) - 1]
- print("[+] Sending\n" + header)
- connection.send(header.encode())
- connection.close()
- print("[+] Package sent, closing connection")
- # time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement