-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathProConOs.py
More file actions
42 lines (24 loc) · 726 Bytes
/
ProConOs.py
File metadata and controls
42 lines (24 loc) · 726 Bytes
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
# -*- coding: utf-8 -*-
#
__author__='KEYONE'
from socket import *
def OneScan(ip, port):
cmd="cc01000b4002000047ee" #获取设备信息的payload
s = socket(AF_INET,SOCK_STREAM) #TCP发包
s.connect((ip,port))
s.send(cmd.decode('hex')) #TCP发包
res_list = []
cur_data, _ = s.recvfrom(1024)
for cur_chr in cur_data:
res_list.append(cur_chr)
info = ''.join(res_list[12:44]) #取特定字节范围
s.close()
print "IP: " , ip
print "Port: ", port
print "Ladder Logic Runtime: " , info
print "Protocol: " , 'proconos'
if __name__=="__main__":
try:
OneScan('104.167.101.164',20547)
except KeyboardInterrupt:
pass