-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclientpy3.py
More file actions
68 lines (61 loc) · 2.34 KB
/
Copy pathclientpy3.py
File metadata and controls
68 lines (61 loc) · 2.34 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
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
import socket
import sys
def run(user, password, * commands):
HOST, PORT = "codebb.cloudapp.net", 17429
data = user + " " + password + "\n" + "\n".join(commands) + "\nCLOSE_CONNECTION\n"
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.connect((HOST, PORT))
sock.sendall(bytes(data, "utf-8"))
sfile = sock.makefile()
rline = sfile.readline()
while rline:
rline = sfile.readline()
def get_status(user, password):
HOST, PORT = "codebb.cloudapp.net", 17429
data = user + " " + password + "\n" + 'STATUS' + "\nCLOSE_CONNECTION\n"
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
output = []
sock.connect((HOST, PORT))
sock.sendall(bytes(data, "utf-8"))
sfile = sock.makefile()
rline = sfile.readline()
while rline:
output += [rline.strip()]
rline = sfile.readline()
return output
def get_config(user, password):
HOST, PORT = "codebb.cloudapp.net", 17429
data = user + " " + password + "\n" + 'CONFIGURATIONS' + "\nCLOSE_CONNECTION\n"
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
output = []
sock.connect((HOST, PORT))
sock.sendall(bytes(data, "utf-8"))
sfile = sock.makefile()
rline = sfile.readline()
while rline:
output += [rline.strip()]
rline = sfile.readline()
return output
def get_scan(user, password, x, y):
HOST, PORT = "codebb.cloudapp.net", 17429
data = user + " " + password + "\n" + 'SCAN' + " " + x + " " + y + "\nCLOSE_CONNECTION\n"
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
output = []
sock.connect((HOST, PORT))
sock.sendall(bytes(data, "utf-8"))
sfile = sock.makefile()
rline = sfile.readline()
while rline:
output += [rline.strip()]
rline = sfile.readline()
return output
def subscribe(user, password):
HOST, PORT = "codebb.cloudapp.net", 17429
data = user + " " + password + "\nSUBSCRIBE\n"
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.connect((HOST, PORT))
sock.sendall(bytes(data, "utf-8"))
sfile = sock.makefile()
rline = sfile.readline()
while rline:
rline = sfile.readline()