-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathOmron-Fins.py
More file actions
42 lines (25 loc) · 788 Bytes
/
Omron-Fins.py
File metadata and controls
42 lines (25 loc) · 788 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):
addr=(ip,port) #UDP发包
s = socket(AF_INET,SOCK_DGRAM) #UDP发包
s.connect(addr)
cmd="800002000000006300ef050100" #发送payload
s.sendto(cmd.decode('hex'),addr) #UDP发包
res_list = []
cur_data, _ = s.recvfrom(1024)
for cur_chr in cur_data:
res_list.append(cur_chr)
info = ''.join(res_list[14:34]) #取特定字节范围 Controller model信息
#print info
s.close()
print "IP: " , ip
print "Port: ", port
print "Controller model: " , info
print "Protocol: " , 'omron-fins'
if __name__=="__main__":
try:
OneScan('83.48.14.162',9600)
except KeyboardInterrupt:
pass