Commit cc69e6c4 authored by yogesh.m's avatar yogesh.m

update after dnp3

parent df94fd71
*.pyc
*.cypython-311.pyc
assets.json
migrations
.idea
\ No newline at end of file
import threading
import yaml
yamlfile=open("config.yaml")
data = yaml.load(yamlfile, Loader=yaml.FullLoader)
import time
from scapy.all import *
import requests
import json_operations
import json
from datetime import datetime
import scan_port
from contextlib import closing
from helpers.Packet_Analyzer import Packet_Analyzer
class Active_Scan():
def __init__(self):
self.found_hosts=[]
self.url=data["configuration"]["unifytwin_server_ip_address"]
self.OT_PORT_LIST = [44818,102,9600,502,47808]
self.pa = Packet_Analyzer()
def is_valid_ipv4(self, address):
pattern = r"^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
return re.match(pattern, address) is not None
def check_if_ip_exist_and_insert(self,ip,mac_addr,p):
try:
with open("assets.json") as json_file:
json_decoded = json.load(json_file)
except:
json_decoded = {}
if(ip not in json_decoded):
json_operations.insert_asset(ip,datetime.now().strftime("%d-%m-%y %H:%M:%S"),"Unknown","ICMP",mac_addr,self.pa.get_vendor(mac_addr),"Unknown","Unknown",self.pa.get_os(bytes(p).hex()),"Unknown")
def send_icmp(self,ip):
p = sr1(IP(dst=ip) / ICMP() / "XXXXXXXXXXX", timeout=2, verbose=False)
if (p):
pkt = Ether(dst='ff:ff:ff:ff:ff:ff') / ARP(pdst=ip)
mac_addr = pkt.src
self.found_hosts.append(ip)
requests.post(url=self.url, json=data)
self.check_if_ip_exist_and_insert(ip,mac_addr,p)
def scan_single_host(self,host):
host_sent_to_scan="No"
while(host_sent_to_scan=="No"):
if(threading.active_count()<int(data["configuration"]["threads"])+5):
self.send_icmp(host)
host_sent_to_scan="Yes"
else:
time.sleep(1)
def scan_host_range(self,start, end):
global found_hosts
sclass = start.split(".")
eclass = end.split(".")
if (sclass[0] == eclass[0]):
if (sclass[0] == "192"):
host = "192.168." + sclass[2] + "-" + eclass[2] + "." + sclass[3] + "-" + eclass[3] + ""
for i in range(int(sclass[2]), int(eclass[2]) + 1):
if (int(sclass[2]) != int(eclass[2])):
if (i == int(sclass[2])):
for ip in range(int(sclass[3]), 256):
ti = threading.Thread(target=self.scan_single_host, args=('192.168.' + str(i) + '.' + str(ip),))
ti.start()
elif (i == int(eclass[2])):
for ip in range(0, int(eclass[3]) + 1):
ti = threading.Thread(target=self.scan_single_host, args=('192.168.' + str(i) + '.' + str(ip),))
ti.start()
else:
for ip in range(0, 256):
ti = threading.Thread(target=self.scan_single_host, args=('192.168.' + str(i) + '.' + str(ip),))
ti.start()
else:
for ip in range(int(sclass[3]), int(eclass[3]) + 1):
ti = threading.Thread(target=self.scan_single_host, args=('192.168.' + str(i) + '.' + str(ip),))
ti.start()
elif (sclass[0] == "10"):
if (0 <= int(sclass[1]) <= 255 and 0 <= int(sclass[2]) <= 255 and 0 <= int(sclass[3]) <= 255 and 0 <= int(
eclass[1]) <= 255 and 0 <= int(eclass[2]) <= 255 and 0 <= int(eclass[3]) <= 255):
if (int(sclass[1]) == int(eclass[1]) and int(sclass[2]) == int(eclass[2])):
for i in range(int(sclass[3]), int(eclass[3]) + 1):
ti = threading.Thread(target=self.scan_single_host,
args=(sclass[0] + '.' + sclass[1] + '.' + sclass[2] + '.' + str(i),))
ti.start()
elif (int(sclass[1]) == int(eclass[1]) and int(sclass[2]) != int(eclass[2])):
for i in range(int(sclass[2]), int(eclass[2]) + 1):
if (i == int(sclass[2])):
for j in range(int(sclass[3]), 256):
ti = threading.Thread(target=self.scan_single_host,
args=(sclass[0] + '.' + sclass[1] + '.' + str(i) + '.' + str(j),))
ti.start()
elif (i == int(eclass[2])):
for j in range(0, int(eclass[3]) + 1):
ti = threading.Thread(target=self.scan_single_host,
args=(sclass[0] + '.' + sclass[1] + '.' + str(i) + '.' + str(j),))
ti.start()
else:
for j in range(0, 256):
ti = threading.Thread(target=self.scan_single_host,
args=(sclass[0] + '.' + sclass[1] + '.' + str(i) + '.' + str(j),))
ti.start()
else:
for i in range(int(sclass[1]), int(eclass[1]) + 1):
if (i == int(sclass[1])):
for j in range(int(sclass[2]), 256):
if (j == int(sclass[2])):
for k in range(int(sclass[3]), 256):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
else:
for k in range(0, 256):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
elif (i == int(eclass[1])):
for j in range(0, int(eclass[2]) + 1):
if (j != int(eclass[2])):
for k in range(0, 256):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
else:
for k in range(0, int(eclass[3]) + 1):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
else:
for j in range(0, 256):
for k in range(0, 256):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
else:
print("invalid address format")
elif (sclass[0] == "172"):
if (16 <= int(sclass[1]) <= 31 and 0 <= int(sclass[2]) <= 255 and 0 <= int(sclass[3]) <= 255 and 16 <= int(
eclass[1]) <= 31 and 0 <= int(eclass[2]) <= 255 and 0 <= int(eclass[3]) <= 255):
if (int(sclass[1]) == int(eclass[1]) and int(sclass[2]) == int(eclass[2])):
for i in range(int(sclass[3]), int(eclass[3]) + 1):
ti = threading.Thread(target=self.scan_single_host,
args=(sclass[0] + '.' + sclass[1] + '.' + sclass[2] + '.' + str(i),))
ti.start()
elif (int(sclass[1]) == int(eclass[1]) and int(sclass[2]) != int(eclass[2])):
for i in range(int(sclass[2]), int(eclass[2]) + 1):
if (i == int(sclass[2])):
for j in range(int(sclass[3]), 256):
ti = threading.Thread(target=self.scan_single_host,
args=(sclass[0] + '.' + sclass[1] + '.' + str(i) + '.' + str(j),))
ti.start()
elif (i == int(eclass[2])):
for j in range(0, int(eclass[3]) + 1):
ti = threading.Thread(target=self.scan_single_host,
args=(sclass[0] + '.' + sclass[1] + '.' + str(i) + '.' + str(j),))
ti.start()
else:
for j in range(0, 256):
ti = threading.Thread(target=self.scan_single_host,
args=(sclass[0] + '.' + sclass[1] + '.' + str(i) + '.' + str(j),))
ti.start()
else:
for i in range(int(sclass[1]), int(eclass[1]) + 1):
if (i == int(sclass[1])):
for j in range(int(sclass[2]), 256):
if (j == int(sclass[2])):
for k in range(int(sclass[3]), 256):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
else:
for k in range(0, 256):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
elif (i == int(eclass[1])):
for j in range(0, int(eclass[2]) + 1):
if (j != int(eclass[2])):
for k in range(0, 256):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
else:
for k in range(0, int(eclass[3]) + 1):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
else:
for j in range(0, 256):
for k in range(0, 256):
ti = threading.Thread(target=self.scan_single_host, args=(
sclass[0] + '.' + str(i) + '.' + str(j) + '.' + str(k),))
ti.start()
else:
print("invalid address format")
else:
if not self.is_valid_ipv4(start) or not self.is_valid_ipv4(end):
print("Invalid start or end address.")
return
start_octets = list(map(int, start.split('.')))
end_octets = list(map(int, end.split('.')))
current_octets = start_octets.copy()
while current_octets <= end_octets:
current_address = '.'.join(map(str, current_octets))
ti = threading.Thread(target=self.scan_single_host, args=(current_address,))
ti.start()
current_octets[3] += 1
for i in range(3, 0, -1):
if current_octets[i] > 255:
current_octets[i] = 0
current_octets[i - 1] += 1
while threading.active_count()>1:
time.sleep(1)
return(self.found_hosts)
def find_open_port(self,ip):
for dst_port in self.OT_PORT_LIST:
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
sock.settimeout(3)
if sock.connect_ex((ip, dst_port)) == 0:
scan_port.map_ports(ip, dst_port)
def scan_for_assets(self):
start=data["configuration"]["active_scan_start"]
end = data["configuration"]["active_scan_end"]
if(data["configuration"]["active_scan"]):
hosts = self.scan_host_range(start,end)
for i in hosts:
self.find_open_port(i)
\ No newline at end of file
configuration:
threads: 20 #number of threads to scan at once
transfer frequency: 1 #how frequent the scan needs to be
unifytwin_server_ip_address: https://webhook.site/43393e36-6b04-4481-8485-fad2c7cd549f #Data will be sent back here
edge_device_location : Dalmia Cement
null_loopback: False
interfaces: eth0
blacklist_ip: ['46.4.105.116','172.67.214.157','3.6.115.64','104.21.53.154']
blacklist_dns: ['webhook.site.']
ui_host: 0.0.0.0
ui_port: 8081
active_scan: False
active_scan_start: 2.2.2.20
active_scan_end: 2.2.2.30
transmit_assets: False
import binascii
import json
from protocol_discover_helpers import modbus_discover,enip_discover,s7_discover,omron_discover,bacnet_discover,codesys_discover,dnp3_discover
class Packet_Analyzer():
def __init__(self):
self.data=None
self.protocol_list={502: modbus_discover,44818:enip_discover,102:s7_discover,9600:omron_discover,47808:bacnet_discover,2455:codesys_discover,20000:dnp3_discover}
def identify_protocol(self,hex_pkt):
protocols=""
if(hex_pkt[46:48] == b"06"):
protocols=protocols+"tcp"
port=self.get_tcp_port(hex_pkt)
if(port in self.protocol_list):
port_protocol = self.protocol_list[port].protocol_identify(hex_pkt)
if (port_protocol):
protocols = protocols + port_protocol
if (hex_pkt[46:48] == b"11"):
protocols = protocols + "udp"
port = self.get_udp_port(hex_pkt)
if (port in self.protocol_list):
port_protocol = self.protocol_list[port].protocol_identify(hex_pkt)
if(port_protocol):
protocols = protocols + port_protocol
return protocols
def get_ip(self,hex_pkt):
if(hex_pkt[24:28]==b"0800"):
ip_inhex= hex_pkt[28+24:28+24+8]
ip = str(int.from_bytes(binascii.unhexlify(ip_inhex[0:2]), byteorder="little"))+"."+str(int.from_bytes(binascii.unhexlify(ip_inhex[2:4]), byteorder="little"))+"."+str(int.from_bytes(binascii.unhexlify(ip_inhex[4:6]), byteorder="little"))+"."+str(int.from_bytes(binascii.unhexlify(ip_inhex[6:8]), byteorder="little"))
return ip
def get_mac(self,hex_pkt):
souce_mac = hex_pkt[12:24].decode()
modified_src_mac = ":".join(souce_mac[i:i + 2] for i in range(0, len(souce_mac), 2))
return modified_src_mac
def get_tcp_port(self,inhex):
if(inhex[46:48]==b"06"):
port = int(inhex[68:72], 16)
return port
def get_udp_port(self,inhex):
if (inhex[46:48] == b"11"):
port = int(inhex[68:72], 16)
return port
def find_mac(self,mac, trim_count=-1):
try:
if len(mac[:trim_count]) == 0:
return "No Mac"
else:
res = self.data[mac[:trim_count]]
return res
except:
r = self.find_mac(mac, trim_count - 1)
return r
def get_vendor(self,mac):
f = open("utilities/mac_vendors.json")
self.data = json.loads(f.read())
vendor = self.find_mac(mac.upper())
return vendor
def get_os(self,inhex):
try:
ttl = int(inhex[44:46].decode())
except:
ttl = 255
if ttl <=64:
return "Unix/Linux Based"
elif ttl <= 128:
return "Windows"
elif ttl <= 254:
return "Solaris"
else:
return "Indeterminate Operating System"
This source diff could not be displayed because it is too large. You can view the blob instead.
sudo cp ../security-management /usr/share -r
test -f /usr/share/security-management/config.yaml && ifaces=$(cat /usr/share/security-management/config.yaml | grep interfaces| sed 's/interfaces: //g') ||ifaces=$(ip link show | grep ': '|sed 's/\: <.*//g'| sed 's/[0-9]: //g')
inface=$(echo $ifaces|sed 's/ .*//g')
echo '[Unit]
Description=asset_discovery service
After=syslog.target network-online.target
[Service]
Type=simple
Restart=on-failure
WorkingDirectory=/usr/share/security-management/
User=root
ExecStart=/bin/bash /usr/share/security-management/start.sh --start -i '$inface'
ExecStop=/bin/bash /usr/share/security-management/stop.sh
[Install]
WantedBy=multi-user.target' |sudo tee /etc/systemd/system/security-management.service >/dev/null
sudo systemctl daemon-reload
sudo ln -s /usr/share/security-management/start.sh /bin/security-management
(sudo crontab -l ; echo "@reboot /bin/security-management --start -i $inface >> /var/log/assets_management_logs.txt 2&1")| sudo crontab -
sudo service security-management start
echo 'Install Complete!!!'
echo '###################################################################
#Start Asset Discovery : sudo service security-management start
#Interface currently used : '$inface'
###################################################################'
import json
import yaml
import requests
try:
yamlfile=open("config.yaml")
data = yaml.load(yamlfile, Loader=yaml.FullLoader)
transmit_assets=data["configuration"]["transmit_assets"]
url = data["configuration"]["unifytwin_server_ip_address"]
except Exception as e:
transmit_assets=False
try:
with open("assets.json") as json_file:
json_decoded = json.load(json_file)
except:
json_decoded={}
def write_into_json_file(json_decoded):
with open("assets.json", 'w') as json_file:
json.dump(json_decoded, json_file)
def insert_asset(ip,last_activity,dev_type,protocols,mac,vendor,firmware,model,os,plant):
json_decoded[ip]={}
json_transmit_data={}
json_transmit_data[ip]={}
json_transmit_data[ip]["last_activity"]=json_decoded[ip]["last_activity"]=last_activity
json_transmit_data[ip]["dev_type"]=json_decoded[ip]["dev_type"] =dev_type
json_transmit_data[ip]["protocols"]=json_decoded[ip]["protocols"] = protocols
json_transmit_data[ip]["mac"]=json_decoded[ip]["mac"] = mac
json_transmit_data[ip]["vendor"]=json_decoded[ip]["vendor"] = vendor
json_transmit_data[ip]["firmware"]=json_decoded[ip]["firmware"] = firmware
json_transmit_data[ip]["model"]=json_decoded[ip]["model"] = model
json_transmit_data[ip]["os"]=json_decoded[ip]["os"] = os
json_transmit_data[ip]["plant"]=json_decoded[ip]["plant"] = plant
write_into_json_file(json_decoded)
if transmit_assets:
requests.post(url=url,json=json_transmit_data)
def update_asset(ip,prev_protocols,last_activity,dev_type,vendor,firmware,model):
json_transmit_data = {}
json_transmit_data[ip] = {}
json_transmit_data[ip]["protocols"]=json_decoded[ip]["protocols"] = prev_protocols
json_transmit_data[ip]["last_activity"]=json_decoded[ip]["last_activity"] = last_activity
json_transmit_data[ip]["dev_type"]=json_decoded[ip]["dev_type"] = dev_type
json_transmit_data[ip]["vendor"]=json_decoded[ip]["vendor"] = vendor
json_transmit_data[ip]["firmware"]=json_decoded[ip]["firmware"] = firmware
json_transmit_data[ip]["model"]=json_decoded[ip]["model"] = model
write_into_json_file(json_decoded)
if transmit_assets:
requests.post(url=url, json=json_transmit_data)
def update_last_activity_and_protocols(ip,prev_protocols,last_activity):
json_transmit_data = {}
json_transmit_data[ip] = {}
json_transmit_data[ip]["protocols"]=json_decoded[ip]["protocols"] = prev_protocols
json_transmit_data[ip]["last_activity"]=json_decoded[ip]["last_activity"] = last_activity
write_into_json_file(json_decoded)
if transmit_assets:
requests.post(url=url, json=json_transmit_data)
def update_last_activity(ip,last_activity):
json_transmit_data = {}
json_transmit_data[ip] = {}
if(json_decoded[ip]["last_activity"]!=last_activity):
json_transmit_data[ip]["last_activity"]=json_decoded[ip]["last_activity"] = last_activity
write_into_json_file(json_decoded)
if transmit_assets:
requests.post(url=url, json=json_transmit_data)
def delete_asset():
print()
def get_existing_protocols(ip):
try:
return json_decoded[ip]["protocols"]
except KeyError:
return "No key"
def check_asset_exists(ip):
if(ip in json_decoded):
return True
else:
return False
\ No newline at end of file
from protocol_enumerators import ethernetip_enum as eip
from protocol_enumerators import s7_enum as s7
from protocol_enumerators import bacnet as bac
from protocol_enumerators import modbus
from protocol_enumerators import dnp3_enum
from protocol_enumerators import codesys
from helpers.port_service_helper import psdata
from protocol_enumerators import omron
import binascii
import os
from helpers.Packet_Analyzer import Packet_Analyzer
import sys
def analyse_protocol(protocols, pkt):
try:
dev_type = "Unknown"
vendor = "Unknown"
firmware = "Unknown"
model = "Unknown"
inhex = binascii.hexlify(bytes(pkt))
pa = Packet_Analyzer()
if ("enip" in protocols):
print(protocols)
res = eip.get_info(pa.get_ip(inhex),int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if (res):
dev_type = res['Type']
vendor = res['Vendor']
firmware = res['ProductName']
model = res['SerialNumber']
elif ("s7comm" in protocols):
res = s7.get_info(pa.get_ip(inhex), int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if (res):
dev_type = res['Module Type'] + " " + res['System Name']
vendor = res['Copyright']
firmware = res['Module'] + " " + res['Version']
model = res['Serial Number']
elif ("bacnet" in protocols):
res = bac.get_info(pa.get_ip(inhex), int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if (res):
dev_type = res['desc'] if not res['desc'] == '' else res['object']
vendor = res['vendorid']
firmware = res['firmware']
model = res['model']
elif ("codesys" in protocols):
res = codesys.get_info(pa.get_ip(inhex), int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(
pa.get_udp_port(inhex)))
if (res):
dev_type = res['OS Name']
vendor = res['Product Type']
elif ("modbus" in protocols):
res = modbus.get_info(pa.get_ip(inhex), int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(
pa.get_udp_port(inhex)), False)
if (res):
dev_type = res['Device identification']
vendor = res['Slave ID data']
model = res['sid']
elif ("omron" in protocols):
res = omron.get_info(pa.get_ip(inhex), int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(
pa.get_udp_port(inhex)), False)
if (res):
dev_type = 'Omron Device'
vendor = 'Omron Devices'
firmware = res['Controller Version']
model = res['Controller Model']
elif("dnp3" in protocols):
res=dnp3_enum.get_info(pa.get_ip(inhex) ,int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if(res):
dev_type=res['Device Type']
else:
port_no = str(pa.get_tcp_port(inhex)) if "tcp" in protocols else str(
pa.get_udp_port(inhex)) if "udp" in protocols else "Unknown"
dev_type = psdata[port_no] if port_no in psdata else "Unknown"
vendor = pa.get_vendor(pa.get_mac(inhex))
return dev_type, vendor, firmware, model
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(exc_type, fname, exc_tb.tb_lineno, e)
def update_protocol(protocols,pkt):
try:
dev_type="Unknown"
vendor="Unknown"
firmware="Unknown"
model="Unknown"
inhex = binascii.hexlify(bytes(pkt))
pa=Packet_Analyzer()
if("enip" in protocols):
res=eip.get_info(pa.get_ip(inhex) ,int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if(res):
dev_type=res['Type']
vendor=res['Vendor']
firmware=res['ProductName']
model=res['SerialNumber']
elif("s7comm" in protocols):
res=s7.get_info(pa.get_ip(inhex) ,int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if(res):
dev_type=res['Module Type']+" "+res['System Name']
vendor=res['Copyright']
firmware=res['Module']+" "+res['Version']
model=res['Serial Number']
elif("bacnet" in protocols):
res=bac.get_info(pa.get_ip(inhex) ,int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if(res):
dev_type=res['desc']
vendor=res['vendorid']
firmware=res['firmware']
model=res['model']
elif("codesys" in protocols):
res=codesys.get_info(pa.get_ip(inhex) ,int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if(res):
dev_type=res['OS Name']
vendor=res['Product Type']
elif("modbus" in protocols):
res=modbus.get_info(pa.get_ip(inhex) ,int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)),False)
if(res):
dev_type=res['Device identification']
vendor=res['Slave ID data']
model=res['sid']
elif("omron" in protocols):
res=omron.get_info(pa.get_ip(inhex) ,int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)),False)
if(res):
dev_type='Omron Device'
vendor='Omron Devices'
firmware=res['Controller Version']
model=res['Controller Model']
elif("dnp3" in protocols):
res=dnp3_enum.get_info(pa.get_ip(inhex) ,int(pa.get_tcp_port(inhex)) if "tcp" in protocols else int(pa.get_udp_port(inhex)))
if(res):
dev_type=res['Device Type']
return dev_type,vendor,firmware,model
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(exc_type, fname, exc_tb.tb_lineno, e)
def protocol_identify(hex_pkt):
if (b'810a' in hex_pkt and hex_pkt[84:88] == b'810a'):
return ":bacnet"
def protocol_identify(hex_pkt):
if (b'bbbb' in hex_pkt and hex_pkt[108:112] == b'bbbb'):
return ":codesys"
\ No newline at end of file
def protocol_identify(hex_pkt):
if (b'6300' in hex_pkt and hex_pkt[108:112] == b'6300'):
return ":enip"
def protocol_identify(hex_pkt):
if(hex_pkt[108:112] == b'0000'):
return ":modbus"
def protocol_identify(hex_pkt):
if ((b'8000' in hex_pkt or b'c000' in hex_pkt) and (hex_pkt[84:88] == b'8000' or hex_pkt[84:88] == b'c000')):
print("omron found")
return ":omron"
\ No newline at end of file
def protocol_identify(hex_pkt):
if (b'0300' in hex_pkt and hex_pkt[108:112] == b'0300'):
return ":s7comm"
\ No newline at end of file
import struct
import binascii
from scapy.all import *
import socket
vendor_id = {
0 : "ASHRAE",
1 : "NIST",
2 : "The Trane Company",
3 : "McQuay International",
4 : "PolarSoft",
5 : "Johnson Controls Inc.",
6 : "American Auto-Matrix",
7 : "Siemens Schweiz AG (Formerly: Landis & Staefa Division Europe)",
8 : "Delta Controls",
9 : "Siemens Schweiz AG",
10 : "Schneider Electric",
11 : "TAC",
12 : "Orion Analysis Corporation",
13 : "Teletrol Systems Inc.",
14 : "Cimetrics Technology",
15 : "Cornell University",
16 : "United Technologies Carrier",
17 : "Honeywell Inc.",
18 : "Alerton / Honeywell",
19 : "TAC AB",
20 : "Hewlett-Packard Company",
21 : "Dorsette.s Inc.",
22 : "Siemens Schweiz AG (Formerly: Cerberus AG)",
23 : "York Controls Group",
24 : "Automated Logic Corporation",
25 : "CSI Control Systems International",
26 : "Phoenix Controls Corporation",
27 : "Innovex Technologies Inc.",
28 : "KMC Controls Inc.",
29 : "Xn Technologies Inc.",
30 : "Hyundai Information Technology Co. Ltd.",
31 : "Tokimec Inc.",
32 : "Simplex",
33 : "North Building Technologies Limited",
34 : "Notifier",
35 : "Reliable Controls Corporation",
36 : "Tridium Inc.",
37 : "Sierra Monitor Corporation/FieldServer Technologies",
38 : "Silicon Energy",
39 : "Kieback & Peter GmbH & Co KG",
40 : "Anacon Systems Inc.",
41 : "Systems Controls & Instruments LLC",
42 : "Lithonia Lighting",
43 : "Micropower Manufacturing",
44 : "Matrix Controls",
45 : "METALAIRE",
46 : "ESS Engineering",
47 : "Sphere Systems Pty Ltd.",
48 : "Walker Technologies Corporation",
49 : "H I Solutions Inc.",
50 : "MBS GmbH",
51 : "SAMSON AG",
52 : "Badger Meter Inc.",
53 : "DAIKIN Industries Ltd.",
54 : "NARA Controls Inc.",
55 : "Mammoth Inc.",
56 : "Liebert Corporation",
57 : "SEMCO Incorporated",
58 : "Air Monitor Corporation",
59 : "TRIATEK LLC",
60 : "NexLight",
61 : "Multistack",
62 : "TSI Incorporated",
63 : "Weather-Rite Inc.",
64 : "Dunham-Bush",
65 : "Reliance Electric",
66 : "LCS Inc.",
67 : "Regulator Australia PTY Ltd.",
68 : "Touch-Plate Lighting Controls",
69 : "Amann GmbH",
70 : "RLE Technologies",
71 : "Cardkey Systems",
72 : "SECOM Co. Ltd.",
73 : "ABB Gebäetechnik AG Bereich NetServ",
74 : "KNX Association cvba",
75 : "Institute of Electrical Installation Engineers of Japan (IEIEJ)",
76 : "Nohmi Bosai Ltd.",
77 : "Carel S.p.A.",
78 : "AirSense Technology Inc.",
79 : "Hochiki Corporation",
80 : "Fr. Sauter AG",
81 : "Matsushita Electric Works Ltd.",
82 : "Mitsubishi Electric Corporation Inazawa Works",
83 : "Mitsubishi Heavy Industries Ltd.",
84 : "ITT Bell & Gossett",
85 : "Yamatake Building Systems Co. Ltd.",
86 : "The Watt Stopper Inc.",
87 : "Aichi Tokei Denki Co. Ltd.",
88 : "Activation Technologies LLC",
89 : "Saia-Burgess Controls Ltd.",
90 : "Hitachi Ltd.",
91 : "Novar Corp./Trend Control Systems Ltd.",
92 : "Mitsubishi Electric Lighting Corporation",
93 : "Argus Control Systems Ltd.",
94 : "Kyuki Corporation",
95 : "Richards-Zeta Building Intelligence Inc.",
96 : "Scientech R&D Inc.",
97 : "VCI Controls Inc.",
98 : "Toshiba Corporation",
99 : "Mitsubishi Electric Corporation Air Conditioning & Refrigeration Systems Works",
100 : "Custom Mechanical Equipment LLC",
101 : "ClimateMaster",
102 : "ICP Panel-Tec Inc.",
103 : "D-Tek Controls",
104 : "NEC Engineering Ltd.",
105 : "PRIVA BV",
106 : "Meidensha Corporation",
107 : "JCI Systems Integration Services",
108 : "Freedom Corporation",
109 : "Neuberger Gebäeautomation GmbH",
110 : "Sitronix",
111 : "Leviton Manufacturing",
112 : "Fujitsu Limited",
113 : "Emerson Network Power",
114 : "S. A. Armstrong Ltd.",
115 : "Visonet AG",
116 : "M&M Systems Inc.",
117 : "Custom Software Engineering",
118 : "Nittan Company Limited",
119 : "Elutions Inc. (Wizcon Systems SAS)",
120 : "Pacom Systems Pty. Ltd.",
121 : "Unico Inc.",
122 : "Ebtron Inc.",
123 : "Scada Engine",
124 : "AC Technology Corporation",
125 : "Eagle Technology",
126 : "Data Aire Inc.",
127 : "ABB Inc.",
128 : "Transbit Sp. z o. o.",
129 : "Toshiba Carrier Corporation",
130 : "Shenzhen Junzhi Hi-Tech Co. Ltd.",
131 : "Tokai Soft",
132 : "Blue Ridge Technologies",
133 : "Veris Industries",
134 : "Centaurus Prime",
135 : "Sand Network Systems",
136 : "Regulvar Inc.",
137 : "AFDtek Division of Fastek International Inc.",
138 : "PowerCold Comfort Air Solutions Inc.",
139 : "I Controls",
140 : "Viconics Electronics Inc.",
141 : "Yaskawa America Inc.",
142 : "DEOS control systems GmbH",
143 : "Digitale Mess- und Steuersysteme AG",
144 : "Fujitsu General Limited",
145 : "Project Engineering S.r.l.",
146 : "Sanyo Electric Co. Ltd.",
147 : "Integrated Information Systems Inc.",
148 : "Temco Controls Ltd.",
149 : "Airtek International Inc.",
150 : "Advantech Corporation",
151 : "Titan Products Ltd.",
152 : "Regel Partners",
153 : "National Environmental Product",
154 : "Unitec Corporation",
155 : "Kanden Engineering Company",
156 : "Messner Gebäetechnik GmbH",
157 : "Integrated.CH",
158 : "Price Industries",
159 : "SE-Elektronic GmbH",
160 : "Rockwell Automation",
161 : "Enflex Corp.",
162 : "ASI Controls",
163 : "SysMik GmbH Dresden",
164 : "HSC Regelungstechnik GmbH",
165 : "Smart Temp Australia Pty. Ltd.",
166 : "Cooper Controls",
167 : "Duksan Mecasys Co. Ltd.",
168 : "Fuji IT Co. Ltd.",
169 : "Vacon Plc",
170 : "Leader Controls",
171 : "Cylon Controls Ltd.",
172 : "Compas",
173 : "Mitsubishi Electric Building Techno-Service Co. Ltd.",
174 : "Building Control Integrators",
175 : "ITG Worldwide (M) Sdn Bhd",
176 : "Lutron Electronics Co. Inc.",
178 : "LOYTEC Electronics GmbH",
179 : "ProLon",
180 : "Mega Controls Limited",
181 : "Micro Control Systems Inc.",
182 : "Kiyon Inc.",
183 : "Dust Networks",
184 : "Advanced Building Automation Systems",
185 : "Hermos AG",
186 : "CEZIM",
187 : "Softing",
188 : "Lynxspring",
189 : "Schneider Toshiba Inverter Europe",
190 : "Danfoss Drives A/S",
191 : "Eaton Corporation",
192 : "Matyca S.A.",
193 : "Botech AB",
194 : "Noveo Inc.",
195 : "AMEV",
196 : "Yokogawa Electric Corporation",
197 : "GFR Gesellschaft füelungstechnik",
198 : "Exact Logic",
199 : "Mass Electronics Pty Ltd dba Innotech Control Systems Australia",
200 : "Kandenko Co. Ltd.",
201 : "DTF Daten-Technik Fries",
202 : "Klimasoft Ltd.",
203 : "Toshiba Schneider Inverter Corporation",
204 : "Control Applications Ltd.",
205 : "KDT Systems Co. Ltd.",
206 : "Onicon Incorporated",
207 : "Automation Displays Inc.",
208 : "Control Solutions Inc.",
209 : "Remsdaq Limited",
210 : "NTT Facilities Inc.",
211 : "VIPA GmbH",
212 : "TSC21 Association of Japan",
213 : "Strato Automation",
214 : "HRW Limited",
215 : "Lighting Control & Design Inc.",
216 : "Mercy Electronic and Electrical Industries",
217 : "Samsung SDS Co.Ltd",
218 : "Impact Facility Solutions Inc.",
219 : "Aircuity",
220 : "Control Techniques Ltd.",
221 : "OpenGeneral Pty. Ltd.",
222 : "WAGO Kontakttechnik GmbH & Co. KG",
223 : "Cerus Industrial",
224 : "Chloride Power Protection Company",
225 : "Computrols Inc.",
226 : "Phoenix Contact GmbH & Co. KG",
227 : "Grundfos Management A/S",
228 : "Ridder Drive Systems",
229 : "Soft Device SDN BHD",
230 : "Integrated Control Technology Limited",
231 : "AIRxpert Systems Inc.",
232 : "Microtrol Limited",
233 : "Red Lion Controls",
234 : "Digital Electronics Corporation",
235 : "Ennovatis GmbH",
236 : "Serotonin Software Technologies Inc.",
237 : "LS Industrial Systems Co. Ltd.",
238 : "Square D Company",
239 : "S Squared Innovations Inc.",
240 : "Aricent Ltd.",
241 : "EtherMetrics LLC",
242 : "Industrial Control Communications Inc.",
243 : "Paragon Controls Inc.",
244 : "A. O. Smith Corporation",
245 : "Contemporary Control Systems Inc.",
246 : "Intesis Software SL",
247 : "Ingenieurgesellschaft N. Hartleb mbH",
248 : "Heat-Timer Corporation",
249 : "Ingrasys Technology Inc.",
250 : "Costerm Building Automation",
251 : "WILO SE",
252 : "Embedia Technologies Corp.",
253 : "Technilog",
254 : "HR Controls Ltd. & Co. KG",
255 : "Lennox International Inc.",
256 : "RK-Tec Rauchklappen-Steuerungssysteme GmbH & Co. KG",
257 : "Thermomax Ltd.",
258 : "ELCON Electronic Control Ltd.",
259 : "Larmia Control AB",
260 : "BACnet Stack at SourceForge",
261 : "G4S Security Services A/S",
262 : "Exor International S.p.A.",
263 : "Cristal Controles",
264 : "Regin AB",
265 : "Dimension Software Inc.",
266 : "SynapSense Corporation",
267 : "Beijing Nantree Electronic Co. Ltd.",
268 : "Camus Hydronics Ltd.",
269 : "Kawasaki Heavy Industries Ltd.",
270 : "Critical Environment Technologies",
271 : "ILSHIN IBS Co. Ltd.",
272 : "ELESTA Energy Control AG",
273 : "KROPMAN Installatietechniek",
274 : "Baldor Electric Company",
275 : "INGA mbH",
276 : "GE Consumer & Industrial",
277 : "Functional Devices Inc.",
278 : "ESAC",
279 : "M-System Co. Ltd.",
280 : "Yokota Co. Ltd.",
281 : "Hitranse Technology Co.LTD",
282 : "Federspiel Controls",
283 : "Kele Inc.",
284 : "Opera Electronics Inc.",
285 : "Gentec",
286 : "Embedded Science Labs LLC",
287 : "Parker Hannifin Corporation",
288 : "MaCaPS International Limited",
289 : "Link4 Corporation",
290 : "Romutec Steuer-u. Regelsysteme GmbH",
291 : "Pribusin Inc.",
292 : "Advantage Controls",
293 : "Critical Room Control",
294 : "LEGRAND",
295 : "Tongdy Control Technology Co. Ltd.",
296 : "ISSARO Integrierte Systemtechnik",
297 : "Pro-Dev Industries",
298 : "DRI-STEEM",
299 : "Creative Electronic GmbH",
300 : "Swegon AB",
301 : "Jan Brachacek",
302 : "Hitachi Appliances Inc.",
303 : "Real Time Automation Inc.",
304 : "ITEC Hankyu-Hanshin Co.",
305 : "Cyrus E&M Engineering Co. Ltd.",
306 : "Racine Federated Inc.",
307 : "Cirrascale Corporation",
308 : "Elesta GmbH Building Automation",
309 : "Securiton",
310 : "OSlsoft Inc.",
311 : "Hanazeder Electronic GmbH",
312 : "Honeywell Security DeutschlandNovar GmbH",
313 : "Siemens Energy & Automation Inc.",
314 : "ETM Professional Control GmbH",
315 : "Meitav-tec Ltd.",
316 : "Janitza Electronics GmbH",
317 : "MKS Nordhausen",
318 : "De Gier Drive Systems B.V.",
319 : "Cypress Envirosystems",
320 : "SMARTron s.r.o.",
321 : "Verari Systems Inc.",
322 : "K-W Electronic Service Inc.",
323 : "ALFA-SMART Energy Management",
324 : "Telkonet Inc.",
325 : "Securiton GmbH",
326 : "Cemtrex Inc.",
327 : "Performance Technologies Inc.",
328 : "Xtralis (Aust) Pty Ltd",
329 : "TROX GmbH",
330 : "Beijing Hysine Technology Co.Ltd",
331 : "RCK Controls Inc.",
332 : "Distech Controls SAS",
333 : "Novar/Honeywell",
334 : "The S4 Group Inc.",
335 : "Schneider Electric",
336 : "LHA Systems",
337 : "GHM engineering Group Inc.",
338 : "Cllimalux S.A.",
339 : "VAISALA Oyj",
340 : "COMPLEX (Beijing) TechnologyCo. Ltd.",
341 : "SCADAmetrics",
342 : "POWERPEG NSI Limited",
343 : "BACnet Interoperability Testing Services Inc.",
344 : "Teco a.s.",
345 : "Plexus Technology Inc.",
346 : "Energy Focus Inc.",
347 : "Powersmiths International Corp.",
348 : "Nichibei Co. Ltd.",
349 : "HKC Technology Ltd.",
350 : "Ovation Networks Inc.",
351 : "Setra Systems",
352 : "AVG Automation",
353 : "ZXC Ltd.",
354 : "Byte Sphere",
355 : "Generiton Co. Ltd.",
356 : "Holter Regelarmaturen GmbH & Co. KG",
357 : "Bedford Instruments LLC",
358 : "Standair Inc.",
359 : "WEG Automation - R&D",
360 : "Prolon Control Systems ApS",
361 : "Inneasoft",
362 : "ConneXSoft GmbH",
363 : "CEAG Notlichtsysteme GmbH",
364 : "Distech Controls Inc.",
365 : "Industrial Technology Research Institute",
366 : "ICONICS Inc.",
367 : "IQ Controls s.c.",
368 : "OJ Electronics A/S",
369 : "Rolbit Ltd.",
370 : "Synapsys Solutions Ltd.",
371 : "ACME Engineering Prod. Ltd.",
372 : "Zener Electric Pty Ltd.",
373 : "Selectronix Inc.",
374 : "Gorbet & Banerjee LLC.",
375 : "IME",
376 : "Stephen H. Dawson Computer Service",
377 : "Accutrol LLC",
378 : "Schneider Elektronik GmbH",
379 : "Alpha-Inno Tec GmbH",
380 : "ADMMicro Inc.",
381 : "Greystone Energy Systems Inc.",
382 : "CAP Technologie",
383 : "KeRo Systems",
384 : "Domat Control System s.r.o.",
385 : "Efektronics Pty. Ltd.",
386 : "Hekatron Vertriebs GmbH",
387 : "Securiton AG",
388 : "Carlo Gavazzi Controls SpA",
389 : "Chipkin Automation Systems",
390 : "Savant Systems LLC",
391 : "Simmtronic Lighting Controls",
392 : "Abelko Innovation AB",
393 : "Seresco Technologies Inc.",
394 : "IT Watchdogs",
395 : "Automation Assist Japan Corp.",
396 : "Thermokon Sensortechnik GmbH",
397 : "EGauge Systems LLC",
398 : "Quantum Automation (ASIA) PTE Ltd.",
399 : "Toshiba Lighting & Technology Corp.",
400 : "SPIN Engenharia de Automaç Ltda.",
401 : "Logistics Systems & Software Services India PVT. Ltd.",
402 : "Delta Controls Integration Products",
403 : "Focus Media",
404 : "LUMEnergi Inc.",
405 : "Kara Systems",
406 : "RF Code Inc.",
407 : "Fatek Automation Corp.",
408 : "JANDA Software Company LLC",
409 : "Open System Solutions Limited",
410 : "Intelec Systems PTY Ltd.",
411 : "Ecolodgix LLC",
412 : "Douglas Lighting Controls",
413 : "iSAtech GmbH",
414 : "AREAL",
415 : "Beckhoff Automation GmbH",
416 : "IPAS GmbH",
417 : "KE2 Therm Solutions",
418 : "Base2Products",
419 : "DTL Controls LLC",
420 : "INNCOM International Inc.",
421 : "BTR Netcom GmbH",
422 : "Greentrol AutomationInc",
423 : "BELIMO Automation AG",
424 : "Samsung Heavy Industries CoLtd",
425 : "Triacta Power Technologies Inc.",
426 : "Globestar Systems",
427 : "MLB Advanced MediaLP",
428 : "SWG Stuckmann Wirtschaftliche Gebäesysteme GmbH",
429 : "SensorSwitch",
430 : "Multitek Power Limited",
431 : "Aquametro AG",
432 : "LG Electronics Inc.",
433 : "Electronic Theatre Controls Inc.",
434 : "Mitsubishi Electric Corporation Nagoya Works",
435 : "Delta Electronics Inc.",
436 : "Elma Kurtalj Ltd.",
437 : "ADT Fire and Security Sp. A.o.o.",
438 : "Nedap Security Management",
439 : "ESC Automation Inc.",
440 : "DSP4YOU Ltd.",
441 : "GE Sensing and Inspection Technologies",
442 : "Embedded Systems SIA",
443 : "BEFEGA GmbH",
444 : "Baseline Inc.",
445 : "M2M Systems Integrators",
446 : "OEMCtrl",
447 : "Clarkson Controls Limited",
448 : "Rogerwell Control System Limited",
449 : "SCL Elements",
450 : "Hitachi Ltd.",
451 : "Newron System SA",
452 : "BEVECO Gebouwautomatisering BV",
453 : "Streamside Solutions",
454 : "Yellowstone Soft",
455 : "Oztech Intelligent Systems Pty Ltd.",
456 : "Novelan GmbH",
457 : "Flexim Americas Corporation",
458 : "ICP DAS Co. Ltd.",
459 : "CARMA Industries Inc.",
460 : "Log-One Ltd.",
461 : "TECO Electric & Machinery Co. Ltd.",
462 : "ConnectEx Inc.",
463 : "Turbo DDC Sü",
464 : "Quatrosense Environmental Ltd.",
465 : "Fifth Light Technology Ltd.",
466 : "Scientific Solutions Ltd.",
467 : "Controller Area Network Solutions (M) Sdn Bhd",
468 : "RESOL - Elektronische Regelungen GmbH",
469 : "RPBUS LLC",
470 : "BRS Sistemas Eletronicos",
471 : "WindowMaster A/S",
472 : "Sunlux Technologies Ltd.",
473 : "Measurlogic",
474 : "Frimat GmbH",
475 : "Spirax Sarco",
476 : "Luxtron",
477 : "Raypak Inc",
478 : "Air Monitor Corporation",
479 : "Regler Och Webbteknik Sverige (ROWS)",
480 : "Intelligent Lighting Controls Inc.",
481 : "Sanyo Electric Industry Co.Ltd",
482 : "E-Mon Energy Monitoring Products",
483 : "Digital Control Systems",
484 : "ATI Airtest Technologies Inc.",
485 : "SCS SA",
486 : "HMS Industrial Networks AB",
487 : "Shenzhen Universal Intellisys Co Ltd",
488 : "EK Intellisys Sdn Bhd",
489 : "SysCom",
490 : "Firecom Inc.",
491 : "ESA Elektroschaltanlagen Grimma GmbH",
492 : "Kumahira Co Ltd",
493 : "Hotraco",
494 : "SABO Elektronik GmbH",
495 : "Equip'Trans",
496 : "TCS Basys Controls",
497 : "FlowCon International A/S",
498 : "ThyssenKrupp Elevator Americas",
499 : "Abatement Technologies",
500 : "Continental Control Systems LLC",
501 : "WISAG Automatisierungstechnik GmbH & Co KG",
502 : "EasyIO",
503 : "EAP-Electric GmbH",
504 : "Hardmeier",
505 : "Mircom Group of Companies",
506 : "Quest Controls",
507 : "MestekInc",
508 : "Pulse Energy",
509 : "Tachikawa Corporation",
510 : "University of Nebraska-Lincoln",
511 : "Redwood Systems",
512 : "PASStec Industrie-Elektronik GmbH",
513 : "NgEK Inc.",
514 : "FAW Electronics Ltd",
515 : "Jireh Energy Tech Co. Ltd.",
516 : "Enlighted Inc.",
517 : "El-Piast Sp. Z o.o",
518 : "NetxAutomation Software GmbH",
519 : "Invertek Drives",
520 : "Deutschmann Automation GmbH & Co. KG",
521 : "EMU Electronic AG",
522 : "Phaedrus Limited",
523 : "Sigmatek GmbH & Co KG",
524 : "Marlin Controls",
525 : "CircutorSA",
526 : "UTC Fire & Security",
527 : "DENT Instruments Inc.",
528 : "FHP Manufacturing Company - Bosch Group",
529 : "GE Intelligent Platforms",
530 : "Inner Range Pty Ltd",
531 : "GLAS Energy Technology",
532 : "MSR-Electronic-GmbH",
533 : "Energy Control Systems Inc.",
534 : "EMT Controls",
535 : "Daintree Networks Inc.",
536 : "EURO ICC d.o.o",
537 : "TE Connectivity Energy",
538 : "GEZE GmbH",
539 : "NEC Corporation",
540 : "Ho Cheung International Company Limited",
541 : "Sharp Manufacturing Systems Corporation",
542 : "DOT CONTROLS a.s.",
543 : "BeaconMedæ0220",
544 : "Midea Commercial Aircon",
545 : "WattMaster Controls",
546 : "Kamstrup A/S",
547 : "CA Computer Automation GmbH",
548 : "Laars Heating Systems Company",
549 : "Hitachi Systems Ltd.",
550 : "Fushan AKE Electronic Engineering Co. Ltd.",
551 : "Toshiba International Corporation",
552 : "Starman Systems LLC",
553 : "Samsung Techwin Co. Ltd.",
554 : "ISAS-Integrated Switchgear and Systems P/L",
556 : "Obvius",
557 : "Marek Guzik",
558 : "Vortek Instruments LLC",
559 : "Universal Lighting Technologies",
560 : "Myers Power Products Inc.",
561 : "Vector Controls GmbH",
562 : "Crestron Electronics Inc.",
563 : "A&E Controls Limited",
564 : "Projektomontaza A.D.",
565 : "Freeaire Refrigeration",
566 : "Aqua Cooler Pty Limited",
567 : "Basic Controls",
568 : "GE Measurement and Control Solutions Advanced Sensors",
569 : "EQUAL Networks",
570 : "Millennial Net",
571 : "APLI Ltd",
572 : "Electro Industries/GaugeTech",
573 : "SangMyung University",
574 : "Coppertree Analytics Inc.",
575 : "CoreNetiX GmbH",
576 : "Acutherm",
577 : "Dr. Riedel Automatisierungstechnik GmbH",
578 : "Shina System Co.Ltd",
579 : "Iqapertus",
580 : "PSE Technology",
581 : "BA Systems",
582 : "BTICINO",
583 : "Monico Inc.",
584 : "iCue",
585 : "tekmar Control Systems Ltd.",
586 : "Control Technology Corporation",
587 : "GFAE GmbH",
588 : "BeKa Software GmbH",
589 : "Isoil Industria SpA",
590 : "Home Systems Consulting SpA",
591 : "Socomec",
592 : "Everex Communications Inc.",
593 : "Ceiec Electric Technology",
594 : "Atrila GmbH",
595 : "WingTechs",
596 : "Shenzhen Mek Intellisys Pte Ltd.",
597 : "Nestfield Co. Ltd.",
598 : "Swissphone Telecom AG",
599 : "PNTECH JSC",
600 : "Horner APG LLC",
601 : "PVI Industries LLC",
602 : "Ela-compil",
603 : "Pegasus Automation International LLC",
604 : "Wight Electronic Services Ltd.",
605 : "Marcom",
606 : "Exhausto A/S",
607 : "Dwyer Instruments Inc.",
608 : "Link GmbH",
609 : "Oppermann Regelgerate GmbH",
610 : "NuAire Inc.",
611 : "Nortec Humidity Inc.",
612 : "Bigwood Systems Inc.",
613 : "Enbala Power Networks",
614 : "Inter Energy Co. Ltd.",
615 : "ETC",
616 : "COMELEC S.A.R.L",
617 : "Pythia Technologies",
618 : "TrendPoint Systems Inc.",
619 : "AWEX",
620 : "Eurevia",
621 : "Kongsberg E-lon AS",
622 : "FlaktWoods",
623 : "E + E Elektronik GES M.B.H.",
624 : "ARC Informatique",
625 : "SKIDATA AG",
626 : "WSW Solutions",
627 : "Trefon Electronic GmbH",
628 : "Dongseo System",
629 : "Kanontec Intelligence Technology Co. Ltd.",
630 : "EVCO S.p.A.",
631 : "Accuenergy (CANADA) Inc.",
632 : "SoftDEL",
633 : "Orion Energy Systems Inc.",
634 : "Roboticsware",
635 : "DOMIQ Sp. z o.o.",
636 : "Solidyne",
637 : "Elecsys Corporation",
638 : "Conditionaire International Pty. Limited",
639 : "Quebec Inc.",
640 : "Homerun Holdings",
641 : "RFM Inc.",
642 : "Comptek",
643 : "Westco Systems Inc.",
644 : "Advancis Software & Services GmbH",
645 : "Intergrid LLC",
646 : "Markerr Controls Inc.",
647 : "Toshiba Elevator and Building Systems Corporation",
648 : "Spectrum Controls Inc.",
649 : "Mkservice",
650 : "Fox Thermal Instruments",
651 : "SyxthSense Ltd",
652 : "DUHA System S R.O.",
653 : "NIBE",
654 : "Melink Corporation",
655 : "Fritz-Haber-Institut",
656 : "MTU Onsite Energy GmbHGas Power Systems",
657 : "Omega Engineering Inc.",
658 : "Avelon",
659 : "Ywire Technologies Inc.",
660 : "M.R. Engineering Co. Ltd.",
661 : "Lochinvar LLC",
662 : "Sontay Limited",
663 : "GRUPA Slawomir Chelminski",
664 : "Arch Meter Corporation",
665 : "Senva Inc.",
667 : "FM-Tec",
668 : "Systems Specialists Inc.",
669 : "SenseAir",
670 : "AB IndustrieTechnik Srl",
671 : "Cortland Research LLC",
672 : "MediaView",
673 : "VDA Elettronica",
674 : "CSS Inc.",
675 : "Tek-Air Systems Inc.",
676 : "ICDT",
677 : "The Armstrong Monitoring Corporation",
678 : "DIXELL S.r.l",
679 : "Lead System Inc.",
680 : "ISM EuroCenter S.A.",
681 : "TDIS",
682 : "Trade FIDES",
683 : "KnübH (Emerson Network Power)",
684 : "Resource Data Management",
685 : "Abies Technology Inc.",
686 : "Amalva",
687 : "MIRAE Electrical Mfg. Co. Ltd.",
688 : "HunterDouglas Architectural Projects Scandinavia ApS",
689 : "RUNPAQ Group Co.Ltd",
690 : "Unicard SA",
691 : "IE Technologies",
692 : "Ruskin Manufacturing",
693 : "Calon Associates Limited",
694 : "Contec Co. Ltd.",
695 : "iT GmbH",
696 : "Autani Corporation",
697 : "Christian Fortin",
698 : "HDL",
699 : "IPID Sp. Z.O.O Limited",
700 : "Fuji Electric Co.Ltd",
701 : "View Inc.",
702 : "Samsung S1 Corporation",
703 : "New Lift",
704 : "VRT Systems",
705 : "Motion Control Engineering Inc.",
706 : "Weiss Klimatechnik GmbH",
707 : "Elkon",
708 : "Eliwell Controls S.r.l.",
709 : "Japan Computer Technos Corp",
710 : "Rational Network ehf",
711 : "Magnum Energy Solutions LLC",
712 : "MelRok",
713 : "VAE Group",
714 : "LGCNS",
715 : "Berghof Automationstechnik GmbH",
716 : "Quark Communications Inc.",
717 : "Sontex",
718 : "mivune AG",
719 : "Panduit",
720 : "Smart Controls LLC",
721 : "Compu-Aire Inc.",
722 : "Sierra",
723 : "ProtoSense Technologies",
724 : "Eltrac Technologies Pvt Ltd",
725 : "Bektas Invisible Controls GmbH",
726 : "Entelec",
727 : "Innexiv",
728 : "Covenant"
}
output={'vendorid': 'Unknown','vendor':'Unknown','Object-identifier':'Unknown','firmware':'Unknown','appsoft':'Unknown','object':'Unknown','model': 'Unknown','desc':'Unknown','location':'Unknown'}
def field_size(response):
value=response[17]
if(value % 0x10 < 5):
value = value % 0x10 - 1
offset = 19
else:
value = response[18] - 1
offset = 20
offset, charset, info = struct.unpack("BB"+str(value)+"s",response[offset-2:-1])
if(charset == 0):
return info.decode()
elif(charset == 4):
return info.decode()
else:
return info.decode()
def standard_query(s,host,port,type):
BUFFER_SIZE = 1024
query_dic={}
query_dic["vendor"] = binascii.unhexlify("810a001101040005010c0c023FFFFF1979")
query_dic["firmware"] = binascii.unhexlify("810a001101040005010c0c023FFFFF192c")
query_dic["appsoft"] = binascii.unhexlify("810a001101040005010c0c023FFFFF190c")
query_dic["object"] = binascii.unhexlify("810a001101040005010c0c023FFFFF194d")
query_dic["model"] = binascii.unhexlify("810a001101040005010c0c023FFFFF1946")
query_dic["desc"] = binascii.unhexlify("810a001101040005010c0c023FFFFF191c")
query_dic["location"] = binascii.unhexlify("810a001101040005010c0c023FFFFF193A")
query=query_dic[type]
try:
s.settimeout(3)
s.sendto(query,(host,port))
resp =s.recv(BUFFER_SIZE)
except:
output["desc"]="BACnet"
if(resp):
if(resp[0]==129):
if(hex(resp[6])!="0x50"):
output[type]=field_size(resp)
else:
output["desc"]="BACnet"
else:
output["desc"]="BACnet"
else:
output["desc"]="BACnet"
def vendornum_query(s,host,port):
BUFFER_SIZE = 1024
vendor_query = binascii.unhexlify("810a001101040005010c0c023FFFFF1978")
try:
s.settimeout(3)
s.sendto(vendor_query,(host,port))
ven_resp =s.recv(BUFFER_SIZE)
except:
output["desc"]="BACnet"
if(ven_resp):
if(ven_resp[0]==129):
if(hex(ven_resp[6])!="0x50"):
value = ven_resp[17]
else:
output["desc"]="BACnet"
if(value ==33):
vendornum = ven_resp[18]
output["vendorid"]=vendor_id[vendornum]
if(value ==34):
vendornum = ven_resp[18]
output["vendorid"]=vendor_id[vendornum]
else:
output["desc"]="BACnet"
def action(host,port):
BUFFER_SIZE = 1024
orig_query = binascii.unhexlify("810a001101040005010c0c023FFFFF194b" )
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
try:
s.settimeout(3)
s.sendto(orig_query,(host,port))
response = s.recv(BUFFER_SIZE)
except:
return False
if(not response):
return False
if(response[0]==129):
if(hex(response[6])=="0x50"):
output["desc"]="BACnet"
else:
vendornum_query(s,host,port)
standard_query(s,host,port,"vendor")
pos, instance_upper, instance = struct.unpack("BBB",response[19:19+3])
output["Object-identifier"] = instance_upper * 0x10000 + instance
standard_query(s,host,port,"firmware")
standard_query(s,host,port,"appsoft")
standard_query(s,host,port,"object")
standard_query(s,host,port,"model")
standard_query(s,host,port,"desc")
standard_query(s,host,port,"location")
s.close()
return output
def get_info(ip,port):
return(action(ip,port))
\ No newline at end of file
import socket
import binascii
def action(host, port):
# CoDeSyS little endian query
lile_query = binascii.unhexlify("bbbb0100000001")
# CoDeSyS big endian query
bige_query = binascii.unhexlify("bbbb0100000101")
# Create a socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
# Connect to the remote host
sock.connect((host, port))
# Send the little endian query
sock.send(lile_query)
# Receive the response
response = sock.recv(1024)
# If there was no response, try the big endian query
if not response:
sock.send(bige_query)
response = sock.recv(1024)
# Check if the response starts with 0xbb
if response and response[0] == 0xbb:
# Extract the null-terminated strings (OS Name, OS Type, Product Type)
os_name_end = response.find(b'\x00', 64)
os_name = response[64:os_name_end].decode()
os_type_end = response.find(b'\x00', 96)
os_type = response[96:os_type_end].decode()
product_type_end = response.find(b'\x00', 128)
product_type = response[128:product_type_end].decode()
# Close the socket
sock.close()
output = {
"OS Name": os_name,
"Product Type": product_type,
"Device IP":host,
"Port":port
}
return output
except Exception as e:
print(f"Error: {e}")
return None
def get_info(ip,port):
return(action(ip,port))
\ No newline at end of file
import binascii
from scapy.all import *
import socket
enip_info={}
device_type = {
0 : "Generic Device (deprecated)",
2 : "AC Drive",
3 : "Motor Overload",
4 : "Limit Switch",
5 : "Inductive Proximity Switch" ,
6 : "Photoelectric Sensor",
7 : "General Purpose Discrete I/O",
9 : "Resolver",
12 : "Communications Adapter",
14 : "Programmable Logic Controller",
16 : "Position Controller",
19 : "DC Drive",
21 : "Contactor",
22 : "Motor Starter",
23 : "Soft Start",
24 : "Human-Machine Interface",
26 : "Mass Flow Controller",
27 : "Pneumatic Valve",
28 : "Vacuum Pressure Gauge",
29 : "Process Control Value",
30 : "Residual Gas Analyzer",
31 : "DC Power Generator",
32 : "RF Power Generator",
33 : "Turbomolecular Vacuum Pump",
34 : "Encoder" ,
35 : "Safety Discrete I/O Device",
36 : "Fluid Flow Controller",
37 : "CIP Motion Drive",
38 : "CompoNet Repeater",
39 : "Mass Flow Controller Enhanced",
40 : "CIP Modbus Device",
41 : "CIP Modbus Translator",
42 : "Safety Analog I/O Device",
43 : "Generic Device (keyable)",
44 : "Managed Switch",
59 : "ControlNet Physical Layer Component"
}
vendor_id = {
0 : "Reserved",
1 : "Rockwell Automation/Allen-Bradley",
2 : "Namco Controls Corp.",
3 : "Honeywell Inc.",
4 : "Parker Hannifin Corp. (Veriflo Division)",
5 : "Rockwell Automation/Reliance Elec.",
6 : "Reserved",
7 : "SMC Corporation",
8 : "Molex Incorporated",
9 : "Western Reserve Controls Corp.",
10 : "Advanced Micro Controls Inc. (AMCI)",
11 : "ASCO Pneumatic Controls",
12 : "Banner Engineering Corp.",
13 : "Belden Wire & Cable Company",
14 : "Cooper Interconnect",
15 : "Reserved",
16 : "Daniel Woodhead Co. (Woodhead Connectivity)",
17 : "Dearborn Group Inc.",
18 : "Reserved",
19 : "Helm Instrument Company",
20 : "Huron Net Works",
21 : "Lumberg Inc.",
22 : "Online Development Inc.(Automation Value)",
23 : "Vorne Industries Inc.",
24 : "ODVA Special Reserve",
25 : "Reserved",
26 : "Festo Corporation",
27 : "Reserved",
28 : "Reserved",
29 : "Reserved",
30 : "Unico Inc.",
31 : "Ross Controls",
32 : "Reserved",
33 : "Reserved",
34 : "Hohner Corp.",
35 : "Micro Mo Electronics Inc.",
36 : "MKS Instruments Inc.",
37 : "Yaskawa Electric America formerly Magnetek Drives",
38 : "Reserved",
39 : "AVG Automation (Uticor)",
40 : "Wago Corporation",
41 : "Kinetics (Unit Instruments)",
42 : "IMI Norgren Limited",
43 : "BALLUFF Inc.",
44 : "Yaskawa Electric America Inc.",
45 : "Eurotherm Controls Inc",
46 : "ABB Industrial Systems",
47 : "Omron Corporation",
48 : "TURCk Inc.",
49 : "Grayhill Inc.",
50 : "Real Time Automation (C&ID)",
51 : "Reserved",
52 : "Numatics Inc.",
53 : "Lutze Inc.",
54 : "Reserved",
55 : "Reserved",
56 : "Softing GmbH",
57 : "Pepperl + Fuchs",
58 : "Spectrum Controls Inc.",
59 : "D.I.P. Inc. MKS Inst.",
60 : "Applied Motion Products Inc.",
61 : "Sencon Inc.",
62 : "High Country Tek",
63 : "SWAC Automation Consult GmbH",
64 : "Clippard Instrument Laboratory",
65 : "Reserved",
66 : "Reserved",
67 : "Reserved",
68 : "Eaton Electrical",
69 : "Reserved",
70 : "Reserved",
71 : "Toshiba International Corp.",
72 : "Control Technology Incorporated",
73 : "TCS (NZ) Ltd.",
74 : "HitachiLtd.",
75 : "ABB Robotics Products AB",
76 : "NKE Corporation",
77 : "Rockwell Software Inc.",
78 : "Escort Memory Systems (A Datalogic Group Co.)",
79 : "Reserved",
80 : "Industrial Devices Corporation",
81 : "IXXAT Automation GmbH",
82 : "Mitsubishi Electric Automation Inc.",
83 : "OPTO-22",
84 : "Reserved",
85 : "Reserved",
86 : "Horner Electric",
87 : "Burkert Werke GmbH & Co. KG",
88 : "Reserved",
89 : "Industrial Indexing Systems Inc.",
90 : "HMS Industrial Networks AB",
91 : "Robicon",
92 : "Helix Technology (Granville-Phillips)",
93 : "Arlington Laboratory",
94 : "Advantech Co. Ltd.",
95 : "Square D Company",
96 : "Digital Electronics Corp.",
97 : "Danfoss",
98 : "Reserved",
99 : "Reserved",
100 : "Bosch Rexroth Corporation : Pneumatics",
101 : "Applied Materials Inc.",
102 : "Showa Electric Wire & Cable Co.",
103 : "Pacific Scientific (API Controls Inc.)",
104 : "Sharp Manufacturing Systems Corp.",
105 : "Olflex Wire & Cable Inc.",
106 : "Reserved",
107 : "Unitrode",
108 : "Beckhoff Automation GmbH",
109 : "National Instruments",
110 : "Mykrolis Corporations (Millipore)",
111 : "International Motion Controls Corp.",
112 : "Reserved",
113 : "SEG Kempen GmbH",
114 : "Reserved",
115 : "Reserved",
116 : "MTS Systems Corp.",
117 : "Krones Inc",
118 : "Reserved",
119 : "EXOR Electronic R & D",
120 : "SIEI S.p.A.",
121 : "KUKA Roboter GmbH",
122 : "Reserved",
123 : "SEC (Samsung Electronics Co.Ltd)",
124 : "Binary Electronics Ltd",
125 : "Flexible Machine Controls",
126 : "Reserved",
127 : "ABB Inc. (Entrelec)",
128 : "MAC Valves Inc.",
129 : "Auma Actuators Inc",
130 : "Toyoda Machine WorksLtd",
131 : "Reserved",
132 : "Reserved",
133 : "Balogh T.A.G. : Corporation",
134 : "TR Systemtechnik GmbH",
135 : "UNIPULSE Corporation",
136 : "Reserved",
137 : "Reserved",
138 : "Conxall Corporation Inc.",
139 : "Reserved",
140 : "Reserved",
141 : "Kuramo Electric Co.Ltd.",
142 : "Creative Micro Designs",
143 : "GE Industrial Systems",
144 : "Leybold Vacuum GmbH",
145 : "Siemens Energy & Automation/Drives",
146 : "Kodensha Ltd",
147 : "Motion Engineering Inc.",
148 : "Honda Engineering Co.Ltd",
149 : "EIM Valve Controls",
150 : "Melec Inc.",
151 : "Sony Manufacturing Systems Corporation",
152 : "North American Mfg.",
153 : "WATLOW",
154 : "Japan Radio Co.Ltd",
155 : "NADEX Co.Ltd",
156 : "Ametek Automation & Process Technologies",
157 : "Reserved",
158 : "KVASER AB",
159 : "IDEC IZUMI Corporation",
160 : "Mitsubishi Heavy Industries Ltd",
161 : "Mitsubishi Electric Corporation",
162 : "Horiba-STEC Inc.",
163 : "esd electronic system design gmbh",
164 : "DAIHEN Corporation",
165 : "Tyco Valves & Controls/Keystone",
166 : "EBARA Corporation",
167 : "Reserved",
168 : "Reserved",
169 : "Hokuyo Electric Co. Ltd",
170 : "Pyramid Solutions Inc.",
171 : "Denso Wave Incorporated",
172 : "HLS Hard-Line Solutions Inc",
173 : "Caterpillar Inc.",
174 : "PDL Electronics Ltd.",
175 : "Reserved",
176 : "Red Lion Controls",
177 : "ANELVA Corporation",
178 : "Toyo Denki Seizo KK",
179 : "Sanyo Denki Co.Ltd",
180 : "Advanced Energy Japan K.K. (Aera Japan)",
181 : "Pilz GmbH & Co",
182 : "Marsh Bellofram-Bellofram PCD Division",
183 : "Reserved",
184 : "M-SYSTEM Co. Ltd",
185 : "Nissin Electric Co.Ltd",
186 : "Hitachi Metals Ltd.",
187 : "Oriental Motor Company",
188 : "A&D Co.Ltd",
189 : "Phasetronics Inc.",
190 : "Cummins Engine Company",
191 : "Deltron Inc.",
192 : "Geneer Corporation",
193 : "Anatol Automation Inc.",
194 : "Reserved",
195 : "Reserved",
196 : "Medar Inc.",
197 : "Comdel Inc.",
198 : "Advanced Energy Industries Inc",
199 : "Reserved",
200 : "DAIDEN Co.Ltd",
201 : "CKD Corporation",
202 : "Toyo Electric Corporation",
203 : "Reserved",
204 : "AuCom Electronics Ltd",
205 : "Shinko Electric Co.Ltd",
206 : "Vector Informatik GmbH",
207 : "Reserved",
208 : "Moog Inc.",
209 : "Contemporary Controls",
210 : "Tokyo Sokki Kenkyujo Co.Ltd",
211 : "Schenck-AccuRate Inc.",
212 : "The Oilgear Company",
213 : "Reserved",
214 : "ASM Japan K.K.",
215 : "HIRATA Corp.",
216 : "SUNX Limited",
217 : "Meidensha Corp.",
218 : "NIDEC SANKYO CORPORATION (Sankyo Seiki Mfg. Co.Ltd)",
219 : "KAMRO Corp.",
220 : "Nippon System Development Co.Ltd",
221 : "EBARA Technologies Inc.",
222 : "Reserved",
223 : "Reserved",
224 : "SG Co.Ltd",
225 : "Vaasa Institute of Technology",
226 : "MKS Instruments (ENI Technology)",
227 : "Tateyama System Laboratory Co.Ltd.",
228 : "QLOG Corporation",
229 : "Matric Limited Inc.",
230 : "NSD Corporation",
231 : "Reserved",
232 : "Sumitomo Wiring SystemsLtd",
233 : "Group 3 Technology Ltd",
234 : "CTI Cryogenics",
235 : "POLSYS CORP",
236 : "Ampere Inc.",
237 : "Reserved",
238 : "Simplatroll Ltd",
239 : "Reserved",
240 : "Reserved",
241 : "Leading Edge Design",
242 : "Humphrey Products",
243 : "Schneider Automation Inc.",
244 : "Westlock Controls Corp.",
245 : "Nihon Weidmuller Co.Ltd",
246 : "Brooks Instrument (Div. of Emerson)",
247 : "Reserved",
248 : " Moeller GmbH",
249 : "Varian Vacuum Products",
250 : "Yokogawa Electric Corporation",
251 : "Electrical Design Daiyu Co.Ltd",
252 : "Omron Software Co.Ltd",
253 : "BOC Edwards",
254 : "Control Technology Corporation",
255 : "Bosch Rexroth",
256 : "Turck",
257 : "Control Techniques PLC",
258 : "Hardy Instruments Inc.",
259 : "LS Industrial Systems",
260 : "E.O.A. Systems Inc.",
261 : "Reserved",
262 : "New Cosmos Electric Co.Ltd.",
263 : "Sense Eletronica LTDA",
264 : "Xycom Inc.",
265 : "Baldor Electric",
266 : "Reserved",
267 : "Patlite Corporation",
268 : "Reserved",
269 : "Mogami Wire & Cable Corporation",
270 : "Welding Technology Corporation (WTC)",
271 : "Reserved",
272 : "Deutschmann Automation GmbH",
273 : "ICP Panel-Tec Inc.",
274 : "Bray Controls USA",
275 : "Reserved",
276 : "Status Technologies",
277 : "Trio Motion Technology Ltd",
278 : "Sherrex Systems Ltd",
279 : "Adept Technology Inc.",
280 : "Spang Power Electronics",
281 : "Reserved",
282 : "Acrosser Technology Co.Ltd",
283 : "Hilscher GmbH",
284 : "IMAX Corporation",
285 : "Electronic Innovation Inc. (Falter Engineering)",
286 : "Netlogic Inc.",
287 : "Bosch Rexroth Corporation : Indramat",
288 : "Reserved",
289 : "Reserved",
290 : "Murata Machinery Ltd.",
291 : "MTT Company Ltd.",
292 : "Kanematsu Semiconductor Corp.",
293 : "Takebishi Electric Sales Co.",
294 : "Tokyo Electron Device Ltd",
295 : "PFU Limited",
296 : "Hakko Automation Co.Ltd.",
297 : "Advanet Inc.",
298 : "Tokyo Electron Software Technologies Ltd.",
299 : "Reserved",
300 : "Shinagawa Electric Wire Co.Ltd.",
301 : "Yokogawa M&C Corporation",
302 : "KONAN Electric Co.Ltd.",
303 : "Binar Elektronik AB",
304 : "Furukawa Electric Co.",
305 : "Cooper Energy Services",
306 : "Schleicher GmbH & Co.",
307 : "Hirose Electric Co.Ltd",
308 : "Western Servo Design Inc.",
309 : "Prosoft Technology",
310 : "Reserved",
311 : "Towa Shoko Co.Ltd",
312 : "Kyopal Co.Ltd",
313 : "Extron Co.",
314 : "Wieland Electric GmbH",
315 : "SEW Eurodrive GmbH",
316 : "Aera Corporation",
317 : "STA Reutlingen",
318 : "Reserved",
319 : "Fuji Electric Co.Ltd.",
320 : "Reserved",
321 : "Reserved",
322 : "ifm efector : inc.",
323 : "Reserved",
324 : "IDEACOD-Hohner Automation S.A.",
325 : "CommScope Inc.",
326 : "GE Fanuc Automation North America Inc.",
327 : "Matsushita Electric Industrial Co.Ltd",
328 : "Okaya Electronics Corporation",
329 : "KASHIYAMA IndustriesLtd",
330 : "JVC",
331 : "Interface Corporation",
332 : "Grape Systems Inc.",
333 : "Reserved",
334 : "Reserved",
335 : "Toshiba IT & Control Systems Corporation",
336 : "Sanyo Machine WorksLtd.",
337 : "Vansco Electronics Ltd.",
338 : "Dart Container Corp.",
339 : "Livingston & Co. Inc.",
340 : "Alfa Laval LKM as",
341 : "BF ENTRON Ltd. (British Federal)",
342 : "Bekaert Engineering NV",
343 : "Ferran Scientific Inc.",
344 : "KEBA AG",
345 : "Endress + Hauser",
346 : "Reserved",
347 : "ABB ALSTOM Power UK Ltd. (EGT)",
348 : "Berger Lahr GmbH",
349 : "Reserved",
350 : "Federal Signal Corp.",
351 : "Kawasaki Robotics (USA) Inc.",
352 : "Bently Nevada Corporation",
353 : "Reserved",
354 : "FRABA Posital GmbH",
355 : "Elsag Bailey Inc.",
356 : "Fanuc Robotics America",
357 : "Reserved",
358 : "Surface Combustion Inc.",
359 : "Reserved",
360 : "AILES Electronics Ind. Co.Ltd.",
361 : "Wonderware Corporation",
362 : "Particle Measuring Systems Inc.",
363 : "Reserved",
364 : "Reserved",
365 : "BITS Co.Ltd",
366 : "Japan Aviation Electronics Industry Ltd",
367 : "Keyence Corporation",
368 : "Kuroda Precision Industries Ltd.",
369 : "Mitsubishi Electric Semiconductor Application",
370 : "Nippon Seisen CableLtd.",
371 : "Omron ASO Co.Ltd",
372 : "Seiko Seiki Co.Ltd.",
373 : "Sumitomo Heavy IndustriesLtd.",
374 : "Tango Computer Service Corporation",
375 : "Technology Service Inc.",
376 : "Toshiba Information Systems (Japan) Corporation",
377 : "TOSHIBA Schneider Inverter Corporation",
378 : "Toyooki Kogyo Co.Ltd.",
379 : "XEBEC",
380 : "Madison Cable Corporation",
381 : "Hitati Engineering & Services Co.Ltd",
382 : "TEM-TECH Lab Co.Ltd",
383 : "International Laboratory Corporation",
384 : "Dyadic Systems Co.Ltd.",
385 : "SETO Electronics Industry Co.Ltd",
386 : "Tokyo Electron Kyushu Limited",
387 : "KEI System Co.Ltd",
388 : "Reserved",
389 : "Asahi Engineering Co.Ltd",
390 : "Contrex Inc.",
391 : "Paradigm Controls Ltd.",
392 : "Reserved",
393 : "Ohm Electric Co.Ltd.",
394 : "RKC Instrument Inc.",
395 : "Suzuki Motor Corporation",
396 : "Custom Servo Motors Inc.",
397 : "PACE Control Systems",
398 : "Reserved",
399 : "Reserved",
400 : "LINTEC Co.Ltd.",
401 : "Hitachi Cable Ltd.",
402 : "BUSWARE Direct",
403 : "Eaton Electric B.V. (former Holec Holland N.V.)",
404 : "VAT Vakuumventile AG",
405 : "Scientific Technologies Incorporated",
406 : "Alfa Instrumentos Eletronicos Ltda",
407 : "TWK Elektronik GmbH",
408 : "ABB Welding Systems AB",
409 : "BYSTRONIC Maschinen AG",
410 : "Kimura Electric Co.Ltd",
411 : "Nissei Plastic Industrial Co.Ltd",
412 : "Reserved",
413 : "Kistler-Morse Corporation",
414 : "Proteous Industries Inc.",
415 : "IDC Corporation",
416 : "Nordson Corporation",
417 : "Rapistan Systems",
418 : "LP-Elektronik GmbH",
419 : "GERBI & FASE S.p.A.(Fase Saldatura)",
420 : "Phoenix Digital Corporation",
421 : "Z-World Engineering",
422 : "Honda R&D Co.Ltd.",
423 : "Bionics Instrument Co.Ltd.",
424 : "Teknic Inc.",
425 : "R.Stahl Inc.",
426 : "Reserved",
427 : "Ryco Graphic Manufacturing Inc.",
428 : "Giddings & Lewis Inc.",
429 : "Koganei Corporation",
430 : "Reserved",
431 : "Nichigoh Communication Electric Wire Co.Ltd.",
432 : "Reserved",
433 : "Fujikura Ltd.",
434 : "AD Link Technology Inc.",
435 : "StoneL Corporation",
436 : "Computer Optical Products Inc.",
437 : "CONOS Inc.",
438 : "Erhardt + Leimer GmbH",
439 : "UNIQUE Co. Ltd",
440 : "Roboticsware Inc.",
441 : "Nachi Fujikoshi Corporation",
442 : "Hengstler GmbH",
443 : "Reserved",
444 : "SUNNY GIKEN Inc.",
445 : "Lenze Drive Systems GmbH",
446 : "CD Systems B.V.",
447 : "FMT/Aircraft Gate Support Systems AB",
448 : "Axiomatic Technologies Corp",
449 : "Embedded System Products Inc.",
450 : "Reserved",
451 : "Mencom Corporation",
452 : "Reserved",
453 : "Matsushita Welding Systems Co.Ltd.",
454 : "Dengensha Mfg. Co. Ltd.",
455 : "Quinn Systems Ltd.",
456 : "Tellima Technology Ltd",
457 : "MDT : Software",
458 : "Taiwan Keiso Co.Ltd",
459 : "Pinnacle Systems",
460 : "Ascom Hasler Mailing Sys",
461 : "INSTRUMAR Limited",
462 : "Reserved",
463 : "Navistar International Transportation Corp",
464 : "Huettinger Elektronik GmbH + Co. KG",
465 : "OCM Technology Inc.",
466 : "Professional Supply Inc.",
467 : "Control Solutions",
468 : "Baumer IVO GmbH & Co. KG",
469 : "Worcester Controls Corporation",
470 : "Pyramid Technical Consultants Inc.",
471 : "Reserved",
472 : "Apollo Fire Detectors Limited",
473 : "Avtron Manufacturing Inc.",
474 : "Reserved",
475 : "Tokyo Keiso Co.Ltd.",
476 : "Daishowa Swiki Co.Ltd.",
477 : "Kojima Instruments Inc.",
478 : "Shimadzu Corporation",
479 : "Tatsuta Electric Wire & Cable Co.Ltd.",
480 : "MECS Corporation",
481 : "Tahara Electric",
482 : "Koyo Electronics",
483 : "Clever Devices",
484 : "GCD Hardware & Software GmbH",
485 : "Reserved",
486 : "Miller Electric Mfg Co.",
487 : "GEA Tuchenhagen GmbH",
488 : "Riken Keiki Co. : LTD",
489 : "Keisokugiken Corporation",
490 : "Fuji Machine Mfg. Co.Ltd",
491 : "Reserved",
492 : "Nidec-Shimpo Corp.",
493 : "UTEC Corporation",
494 : "Sanyo Electric Co. Ltd.",
495 : "Reserved",
496 : "Reserved",
497 : "Okano Electric Wire Co. Ltd",
498 : "Shimaden Co. Ltd.",
499 : "Teddington Controls Ltd",
500 : "Reserved",
501 : "VIPA GmbH",
502 : "Warwick Manufacturing Group",
503 : "Danaher Controls",
504 : "Reserved",
505 : "Reserved",
506 : "American Science & Engineering",
507 : "Accutron Controls International Inc.",
508 : "Norcott Technologies Ltd",
509 : "TB Woods Inc",
510 : "Proportion-Air Inc.",
511 : "SICK Stegmann GmbH",
512 : "Reserved",
513 : "Edwards Signaling",
514 : "Sumitomo Metal IndustriesLtd",
515 : "Cosmo Instruments Co.Ltd.",
516 : "Denshosha Co.Ltd.",
517 : "Kaijo Corp.",
518 : "Michiproducts Co.Ltd.",
519 : "Miura Corporation",
520 : "TG Information Network Co.Ltd.",
521 : "Fujikin Inc.",
522 : "Estic Corp.",
523 : "GS Hydraulic Sales",
524 : "Reserved",
525 : "MTE Limited",
526 : "Hyde Park Electronics Inc.",
527 : "Pfeiffer Vacuum GmbH",
528 : "Cyberlogic Technologies",
529 : "OKUMA Corporation FA Systems Division",
530 : "Reserved",
531 : "Hitachi Kokusai Electric Co.Ltd.",
532 : "SHINKO TECHNOS Co.Ltd.",
533 : "Itoh Electric Co.Ltd.",
534 : "Colorado Flow Tech Inc.",
535 : "Love Controls Division/Dwyer Inst.",
536 : "Alstom Drives and Controls",
537 : "The Foxboro Company",
538 : "Tescom Corporation",
539 : "Reserved",
540 : "Atlas Copco Controls UK",
541 : "Reserved",
542 : "Autojet Technologies",
543 : "Prima Electronics S.p.A.",
544 : "PMA GmbH",
545 : "Shimafuji Electric Co.Ltd",
546 : "Oki Electric Industry Co.Ltd",
547 : "Kyushu Matsushita Electric Co.Ltd",
548 : "Nihon Electric Wire & Cable Co.Ltd",
549 : "Tsuken Electric Ind Co.Ltd",
550 : "Tamadic Co.",
551 : "MAATEL SA",
552 : "OKUMA America",
553 : "Control Techniques PLC-NA",
554 : "TPC Wire & Cable",
555 : "ATI Industrial Automation",
556 : "Microcontrol (Australia) Pty Ltd",
557 : "Serra Soldadura : S.A.",
558 : "Southwest Research Institute",
559 : "Cabinplant International",
560 : "Sartorius Mechatronics T&H GmbH",
561 : "Comau S.p.A. Robotics & Final Assembly Division",
562 : "Phoenix Contact",
563 : "Yokogawa MAT Corporation",
564 : "asahi sangyo co. : ltd.",
565 : "Reserved",
566 : "Akita Myotoku Ltd.",
567 : "OBARA Corp.",
568 : "Suetron Electronic GmbH",
569 : "Reserved",
570 : "Serck Controls Limited",
571 : "Fairchild Industrial Products Company",
572 : "ARO S.A.",
573 : "M2C GmbH",
574 : "Shin Caterpillar Mitsubishi Ltd.",
575 : "Santest Co.Ltd.",
576 : "Cosmotechs Co.Ltd.",
577 : "Hitachi Electric Systems",
578 : "Smartscan Ltd",
579 : "Woodhead Software & Electronics France",
580 : "Athena Controls Inc.",
581 : "Syron Engineering & Manufacturing Inc.",
582 : "Asahi Optical Co.Ltd.",
583 : "Sansha Electric Mfg. Co.Ltd.",
584 : "Nikki Denso Co.Ltd.",
585 : "Star Micronics : Co.Ltd.",
586 : "Ecotecnia Socirtat Corp.",
587 : "AC Technology Corp.",
588 : "West Instruments Limited",
589 : "NTI Limited",
590 : "Delta Computer Systems Inc.",
591 : "FANUC Ltd.",
592 : "Hearn-Gu Lee",
593 : "ABB Automation Products",
594 : "Orion Machinery Co.Ltd.",
595 : "Reserved",
596 : "Wire-Pro Inc.",
597 : "Beijing Huakong Technology Co. Ltd.",
598 : "Yokoyama Shokai Co.Ltd.",
599 : "Toyogiken Co.Ltd.",
600 : "Coester Equipamentos Eletronicos Ltda.",
601 : "Reserved",
602 : "Electroplating Engineers of Japan Ltd.",
603 : "ROBOX S.p.A.",
604 : "Spraying Systems Company",
605 : "Benshaw Inc.",
606 : "ZPA-DP A.S.",
607 : "Wired Rite Systems",
608 : "Tandis Research Inc.",
609 : "SSD Drives GmbH",
610 : "ULVAC Japan Ltd.",
611 : "DYNAX Corporation",
612 : "Nor-Cal Products Inc.",
613 : "Aros Electronics AB",
614 : "Jun-Tech Co.Ltd.",
615 : "HAN-MI Co. Ltd.",
616 : "uniNtech (formerly SungGi Internet)",
617 : "Hae Pyung Electronics Reserch Institute",
618 : "Milwaukee Electronics",
619 : "OBERG Industries",
620 : "Parker Hannifin/Compumotor Division",
621 : "TECHNO DIGITAL CORPORATION",
622 : "Network Supply Co.Ltd.",
623 : "Union Electronics Co.Ltd.",
624 : "Tritronics Services PM Ltd.",
625 : "Rockwell Automation-Sprecher+Schuh",
626 : "Matsushita Electric Industrial Co.Ltd/Motor Co.",
627 : "Rolls-Royce Energy Systems Inc.",
628 : "JEONGIL INTERCOM CO. : LTD",
629 : "Interroll Corp.",
630 : "Hubbell Wiring Device-Kellems (Delaware)",
631 : "Intelligent Motion Systems",
632 : "Reserved",
633 : "INFICON AG",
634 : "Hirschmann Inc.",
635 : "The Siemon Company",
636 : "YAMAHA Motor Co. Ltd.",
637 : "aska corporation",
638 : "Woodhead Connectivity",
639 : "Trimble AB",
640 : "Murrelektronik GmbH",
641 : "Creatrix Labs Inc.",
642 : "TopWorx",
643 : "Kumho Industrial Co.Ltd.",
644 : "Wind River Systems Inc.",
645 : "Bihl & Wiedemann GmbH",
646 : "Harmonic Drive Systems Inc.",
647 : "Rikei Corporation",
648 : "BL AutotecLtd.",
649 : "Hana Information & Technology Co.Ltd.",
650 : "Seoil Electric Co.Ltd.",
651 : "Fife Corporation",
652 : "Shanghai Electrical Apparatus Research Institute",
653 : "Reserved",
654 : "Parasense Development Centre",
655 : "Reserved",
656 : "Reserved",
657 : "Six Tau S.p.A.",
658 : "Aucos GmbH",
659 : "Rotork Controls",
660 : "Automationdirect.com",
661 : "Thermo BLH",
662 : "System ControlsLtd.",
663 : "Univer S.p.A.",
664 : "MKS-Tenta Technology",
665 : "Lika Electronic SNC",
666 : "Mettler-Toledo Inc.",
667 : "DXL USA Inc.",
668 : "Rockwell Automation/Entek IRD Intl.",
669 : "Nippon Otis Elevator Company",
670 : "Sinano Electric : Co.Ltd.",
671 : "Sony Manufacturing Systems",
672 : "Reserved",
673 : "Contec Co.Ltd.",
674 : "Automated Solutions",
675 : "Controlweigh",
676 : "Reserved",
677 : "Fincor Electronics",
678 : "Cognex Corporation",
679 : "Qualiflow",
680 : "Weidmuller Inc.",
681 : "Morinaga Milk Industry Co.Ltd.",
682 : "Takagi Industrial Co.Ltd.",
683 : "Wittenstein AG",
684 : "Sena Technologies Inc.",
685 : "Reserved",
686 : "APV Products Unna",
687 : "Creator Teknisk Utvedkling AB",
688 : "Reserved",
689 : "Mibu Denki Industrial Co.Ltd.",
690 : "Takamastsu Machineer Section",
691 : "Startco Engineering Ltd.",
692 : "Reserved",
693 : "Holjeron",
694 : "ALCATEL High Vacuum Technology",
695 : "Taesan LCD Co.Ltd.",
696 : "POSCON",
697 : "VMIC",
698 : "Matsushita Electric WorksLtd.",
699 : "IAI Corporation",
700 : "Horst GmbH",
701 : "MicroControl GmbH & Co.",
702 : "Leine & Linde AB",
703 : "Reserved",
704 : "EC Elettronica Srl",
705 : "VIT Software HB",
706 : "Bronkhorst High-Tech B.V.",
707 : "Optex Co.Ltd.",
708 : "Yosio Electronic Co.",
709 : "Terasaki Electric Co.Ltd.",
710 : "Sodick Co.Ltd.",
711 : "MTS Systems Corporation-Automation Division",
712 : "Mesa Systemtechnik",
713 : "SHIN HO SYSTEM Co.Ltd.",
714 : "Goyo Electronics CoLtd.",
715 : "Loreme",
716 : "SAB Brockskes GmbH & Co. KG",
717 : "Trumpf Laser GmbH + Co. KG",
718 : "Niigata Electronic Instruments Co.Ltd.",
719 : "Yokogawa Digital Computer Corporation",
720 : "O.N. Electronic Co.Ltd.",
721 : "Industrial Control Communication Inc.",
722 : "ABB Inc.",
723 : "ElectroWave USA Inc.",
724 : "Industrial Network Controls : LLC",
725 : "KDT Systems Co.Ltd.",
726 : "SEFA Technology Inc.",
727 : "Nippon POP Rivets and Fasteners Ltd.",
728 : "Yamato Scale Co.Ltd.",
729 : "Zener Electric",
730 : "GSE Scale Systems",
731 : "ISAS (Integrated Switchgear & Sys. Pty Ltd)",
732 : "Beta LaserMike Limited",
733 : "TOEI Electric Co.Ltd.",
734 : "Hakko Electronics Co.Ltd",
735 : "Reserved",
736 : "RFID Inc.",
737 : "Adwin Corporation",
738 : "Osaka VacuumLtd.",
739 : "A-Kyung Motion Inc.",
740 : "Camozzi S.P. A.",
741 : "Crevis Co. : LTD",
742 : "Rice Lake Weighing Systems",
743 : "Linux Network Services",
744 : "KEB Antriebstechnik GmbH",
745 : "Hagiwara Electric Co.Ltd.",
746 : "Glass Inc. International",
747 : "Reserved",
748 : "DVT Corporation",
749 : "Woodward Governor",
750 : "Mosaic Systems Inc.",
751 : "Laserline GmbH",
752 : "COM-TEC Inc.",
753 : "Weed Instrument",
754 : "Prof-face European Technology Center",
755 : "Fuji Automation Co.Ltd.",
756 : "Matsutame Co.Ltd.",
757 : "Hitachi Via MechanicsLtd.",
758 : "Dainippon Screen Mfg. Co. Ltd.",
759 : "FLS Automation A/S",
760 : "ABB Stotz Kontakt GmbH",
761 : "Technical Marine Service",
762 : "Advanced Automation Associates Inc.",
763 : "Baumer Ident GmbH",
764 : "Tsubakimoto Chain Co.",
765 : "Reserved",
766 : "Furukawa Co.Ltd.",
767 : "Active Power",
768 : "CSIRO Mining Automation",
769 : "Matrix Integrated Systems",
770 : "Digitronic Automationsanlagen GmbH",
771 : "SICK STEGMANN Inc.",
772 : "TAE-Antriebstechnik GmbH",
773 : "Electronic Solutions",
774 : "Rocon L.L.C.",
775 : "Dijitized Communications Inc.",
776 : "Asahi Organic Chemicals Industry Co.Ltd.",
777 : "Hodensha",
778 : "Harting Inc. NA",
779 : "Kubler GmbH",
780 : "Yamatake Corporation",
781 : "JEOL",
782 : "Yamatake Industrial Systems Co.Ltd.",
783 : "HAEHNE Elektronische Messgerate GmbH",
784 : "Ci Technologies Pty Ltd (for Pelamos Industries)",
785 : "N. SCHLUMBERGER & CIE",
786 : "Teijin Seiki Co.Ltd.",
787 : "DAIKIN IndustriesLtd",
788 : "RyuSyo Industrial Co.Ltd.",
789 : "SAGINOMIYA SEISAKUSHO : INC.",
790 : "Seishin Engineering Co.Ltd.",
791 : "Japan Support System Ltd.",
792 : "Decsys",
793 : "Metronix Messgerate u. Elektronik GmbH",
794 : "Reserved",
795 : "Vaccon Company Inc.",
796 : "Siemens Energy & Automation Inc.",
797 : "Ten X Technology Inc.",
798 : "Tyco Electronics",
799 : "Delta Power Electronics Center",
800 : "Denker",
801 : "Autonics Corporation",
802 : "JFE Electronic Engineering Pty. Ltd.",
803 : "Reserved",
804 : "Electro-Sensors Inc.",
805 : "Digi International Inc.",
806 : "Texas Instruments",
807 : "ADTEC Plasma Technology Co.Ltd",
808 : "SICK AG",
809 : "Ethernet Peripherals Inc.",
810 : "Animatics Corporation",
811 : "Reserved",
812 : "Process Control Corporation",
813 : "SystemV. Inc.",
814 : "Danaher Motion SRL",
815 : "SHINKAWA Sensor Technology Inc.",
816 : "Tesch GmbH & Co. KG",
817 : "Reserved",
818 : "Trend Controls Systems Ltd.",
819 : "Guangzhou ZHIYUAN Electronic Co.Ltd.",
820 : "Mykrolis Corporation",
821 : "Bethlehem Steel Corporation",
822 : "KK ICP",
823 : "Takemoto Denki Corporation",
824 : "The Montalvo Corporation",
825 : "Reserved",
826 : "LEONI Special Cables GmbH",
827 : "Reserved",
828 : "ONO SOKKI CO.,LTD.",
829 : "Rockwell Samsung Automation",
830 : "SHINDENGEN ELECTRIC MFG. CO. LTD",
831 : "Origin Electric Co. Ltd.",
832 : "Quest Technical Solutions Inc.",
833 : "LS CableLtd.",
834 : "Enercon-Nord Electronic GmbH",
835 : "Northwire Inc.",
836 : "Engel Elektroantriebe GmbH",
837 : "The Stanley Works",
838 : "Celesco Transducer Products Inc.",
839 : "Chugoku Electric Wire and Cable Co.",
840 : "Kongsberg Simrad AS",
841 : "Panduit Corporation",
842 : "Spellman High Voltage Electronics Corp.",
843 : "Kokusai Electric Alpha Co.Ltd.",
844 : "Brooks Automation Inc.",
845 : "ANYWIRE CORPORATION",
846 : "Honda Electronics Co. Ltd",
847 : "REO Elektronik AG",
848 : "Fusion UV Systems Inc.",
849 : "ASI Advanced Semiconductor Instruments GmbH",
850 : "Datalogic Inc.",
851 : "SoftPLC Corporation",
852 : "Dynisco Instruments LLC",
853 : "WEG Industrias SA",
854 : "Frontline Test Equipment Inc.",
855 : "Tamagawa Seiki Co.Ltd.",
856 : "Multi Computing Co.Ltd.",
857 : "RVSI",
858 : "Commercial Timesharing Inc.",
859 : "Tennessee Rand Automation LLC",
860 : "Wacogiken Co.Ltd",
861 : "Reflex Integration Inc.",
862 : "Siemens AG : A&D PI Flow Instruments",
863 : "G. Bachmann Electronic GmbH",
864 : "NT International",
865 : "Schweitzer Engineering Laboratories",
866 : "ATR Industrie-Elektronik GmbH Co.",
867 : "PLASMATECH Co.Ltd",
868 : "Reserved",
869 : "GEMU GmbH & Co. KG",
870 : "Alcorn McBride Inc.",
871 : "MORI SEIKI CO. : LTD",
872 : "NodeTech Systems Ltd",
873 : "Emhart Teknologies",
874 : "Cervis Inc.",
875 : "FieldServer Technologies (Div Sierra Monitor Corp)",
876 : "NEDAP Power Supplies",
877 : "Nippon Sanso Corporation",
878 : "Mitomi Giken Co.Ltd.",
879 : "PULS GmbH",
880 : "Reserved",
881 : "Japan Control Engineering Ltd",
882 : "Embedded Systems Korea (Former Zues Emtek Co Ltd.)",
883 : "Automa SRL",
884 : "Harms+Wende GmbH & Co KG",
885 : "SAE-STAHL GmbH",
886 : "Microwave Data Systems",
887 : "Bernecker + Rainer Industrie-Elektronik GmbH",
888 : "Hiprom Technologies",
889 : "Reserved",
890 : "Nitta Corporation",
891 : "Kontron Modular Computers GmbH",
892 : "Marlin Controls",
893 : "ELCIS s.r.l.",
894 : "Acromag Inc.",
895 : "Avery Weigh-Tronix",
896 : "Reserved",
897 : "Reserved",
898 : "Reserved",
899 : "Practicon Ltd",
900 : "Schunk GmbH & Co. KG",
901 : "MYNAH Technologies",
902 : "Defontaine Groupe",
903 : "Emerson Process Management Power & Water Solutions",
904 : "F.A. Elec",
905 : "Hottinger Baldwin Messtechnik GmbH",
906 : "Coreco Imaging Inc.",
907 : "London Electronics Ltd.",
908 : "HSD SpA",
909 : "Comtrol Corporation",
910 : "TEAM : S.A. (Tecnica Electronica de Automatismo Y Medida)",
911 : "MAN B&W Diesel Ltd. Regulateurs Europa",
912 : "Reserved",
913 : "Reserved",
914 : "Micro Motion Inc.",
915 : "Eckelmann AG",
916 : "Hanyoung Nux",
917 : "Ransburg Industrial Finishing KK",
918 : "Kun Hung Electric Co. Ltd.",
919 : "Brimos wegbebakening b.v.",
920 : "Nitto Seiki Co.Ltd",
921 : "PPT Vision Inc.",
922 : "Yamazaki Machinery Works",
923 : "SCHMIDT Technology GmbH",
924 : "Parker Hannifin SpA (SBC Division)",
925 : "HIMA Paul Hildebrandt GmbH",
926 : "RivaTek Inc.",
927 : "Misumi Corporation",
928 : "GE Multilin",
929 : "Measurement Computing Corporation",
930 : "Jetter AG",
931 : "Tokyo Electronics Systems Corporation",
932 : "Togami Electric Mfg. Co.Ltd.",
933 : "HK Systems",
934 : "CDA Systems Ltd.",
935 : "Aerotech Inc.",
936 : "JVL Industrie Elektronik A/S",
937 : "NovaTech Process Solutions LLC",
938 : "Reserved",
939 : "Cisco Systems",
940 : "Grid Connect",
941 : "ITW Automotive Finishing",
942 : "HanYang System",
943 : "ABB K.K. Technical Center",
944 : "Taiyo Electric Wire & Cable Co.Ltd.",
945 : "Reserved",
946 : "SEREN IPS INC",
947 : "Belden CDT Electronics Division",
948 : "ControlNet International",
949 : "Gefran S.P.A.",
950 : "Jokab Safety AB",
951 : "SUMITA OPTICAL GLASS : INC.",
952 : "Biffi Italia srl",
953 : "Beck IPC GmbH",
954 : "Copley Controls Corporation",
955 : "Fagor Automation S. Coop.",
956 : "DARCOM",
957 : "Frick Controls (div. of York International)",
958 : "SymCom Inc.",
959 : "Infranor",
960 : "Kyosan CableLtd.",
961 : "Varian Vacuum Technologies",
962 : "Messung Systems",
963 : "Xantrex Technology Inc.",
964 : "StarThis Inc.",
965 : "Chiyoda Co.Ltd.",
966 : "Flowserve Corporation",
967 : "Spyder Controls Corp.",
968 : "IBA AG",
969 : "SHIMOHIRA ELECTRIC MFG.CO.,LTD",
970 : "Reserved",
971 : "Siemens L&A",
972 : "Micro Innovations AG",
973 : "Switchgear & Instrumentation",
974 : "PRE-TECH CO. : LTD.",
975 : "National Semiconductor",
976 : "Invensys Process Systems",
977 : "Ametek HDR Power Systems",
978 : "Reserved",
979 : "TETRA-K Corporation",
980 : "C & M Corporation",
981 : "Siempelkamp Maschinen",
982 : "Reserved",
983 : "Daifuku America Corporation",
984 : "Electro-Matic Products Inc.",
985 : "BUSSAN MICROELECTRONICS CORP.",
986 : "ELAU AG",
987 : "Hetronic USA",
988 : "NIIGATA POWER SYSTEMS Co.Ltd.",
989 : "Software Horizons Inc.",
990 : "B3 Systems Inc.",
991 : "Moxa Networking Co.Ltd.",
992 : "Reserved",
993 : "S4 Integration",
994 : "Elettro Stemi S.R.L.",
995 : "AquaSensors",
996 : "Ifak System GmbH",
997 : "SANKEI MANUFACTURING Co.,LTD.",
998 : "Emerson Network Power Co.Ltd.",
999 : "Fairmount Automation Inc.",
1000 : "Bird Electronic Corporation",
1001 : "Nabtesco Corporation",
1002 : "AGM Electronics Inc.",
1003 : "ARCX Inc.",
1004 : "DELTA I/O Co.",
1005 : "Chun IL Electric Ind. Co.",
1006 : "N-Tron",
1007 : "Nippon Pneumatics/Fludics System CO.,LTD.",
1008 : "DDK Ltd.",
1009 : "Seiko Epson Corporation",
1010 : "Halstrup-Walcher GmbH",
1011 : "ITT",
1012 : "Ground Fault Systems bv",
1013 : "Scolari Engineering S.p.A.",
1014 : "Vialis Traffic bv",
1015 : "Weidmueller Interface GmbH & Co. KG",
1016 : "Shanghai Sibotech Automation Co. Ltd",
1017 : "AEG Power Supply Systems GmbH",
1018 : "Komatsu Electronics Inc.",
1019 : "Souriau",
1020 : "Baumuller Chicago Corp.",
1021 : "J. Schmalz GmbH",
1022 : "SEN Corporation",
1023 : "Korenix Technology Co. Ltd",
1024 : "Cooper Power Tools",
1025 : "INNOBIS",
1026 : "Shinho System",
1027 : "Xm Services Ltd.",
1028 : "KVC Co.Ltd.",
1029 : "Sanyu Seiki Co.Ltd.",
1030 : "TuxPLC",
1031 : "Northern Network Solutions",
1032 : "Converteam GmbH",
1033 : "Symbol Technologies",
1034 : "S-TEAM Lab",
1035 : "Maguire Products Inc.",
1036 : "AC&T",
1037 : "MITSUBISHI HEAVY INDUSTRIES : LTD. KOBE SHIPYARD & MACHINERY WORKS",
1038 : "Hurletron Inc.",
1039 : "Chunichi Denshi Co.Ltd",
1040 : "Cardinal Scale Mfg. Co.",
1041 : "BTR NETCOM via RIA Connect Inc.",
1042 : "Base2",
1043 : "ASRC Aerospace",
1044 : "Beijing Stone Automation",
1045 : "Changshu Switchgear Manufacture Ltd.",
1046 : "METRONIX Corp.",
1047 : "WIT",
1048 : "ORMEC Systems Corp.",
1049 : "ASATech (China) Inc.",
1050 : "Controlled Systems Limited",
1051 : "Mitsubishi Heavy Ind. Digital System Co.Ltd. (M.H.I.)",
1052 : "Electrogrip",
1053 : "TDS Automation",
1054 : "T&C Power Conversion Inc.",
1055 : "Robostar Co.Ltd",
1056 : "Scancon A/S",
1057 : "Haas Automation Inc.",
1058 : "Eshed Technology",
1059 : "Delta Electronic Inc.",
1060 : "Innovasic Semiconductor",
1061 : "SoftDEL Systems Limited",
1062 : "FiberFin Inc.",
1063 : "Nicollet Technologies Corp.",
1064 : "B.F. Systems",
1065 : "Empire Wire and Supply LLC",
1066 : "Reserved",
1067 : "Elmo Motion Control LTD",
1068 : "Reserved",
1069 : "Asahi Keiki Co.Ltd.",
1070 : "Joy Mining Machinery",
1071 : "MPM Engineering Ltd",
1072 : "Wolke Inks & Printers GmbH",
1073 : "Mitsubishi Electric Engineering Co.Ltd.",
1074 : "COMET AG",
1075 : "Real Time Objects & Systems : LLC",
1076 : "MISCO Refractometer",
1077 : "JT Engineering Inc.",
1078 : "Automated Packing Systems",
1079 : "Niobrara R&D Corp.",
1080 : "Garmin Ltd.",
1081 : "Japan Mobile Platform Co.Ltd",
1082 : "Advosol Inc.",
1083 : "ABB Global Services Limited",
1084 : "Sciemetric Instruments Inc.",
1085 : "Tata Elxsi Ltd.",
1086 : "TPC Mechatronics : Co.Ltd.",
1087 : "Cooper Bussmann",
1088 : "Trinite Automatisering B.V.",
1089 : "Peek Traffic B.V.",
1090 : "Acrison Inc",
1091 : "Applied Robotics Inc.",
1092 : "FireBus Systems Inc.",
1093 : "Beijing Sevenstar Huachuang Electronics",
1094 : "Magnetek",
1095 : "Microscan",
1096 : "Air Water Inc.",
1097 : "Sensopart Industriesensorik GmbH",
1098 : "Tiefenbach Control Systems GmbH",
1099 : "INOXPA S.A",
1100 : "Zurich University of Applied Sciences",
1101 : "Ethernet Direct",
1102 : "GSI-Micro-E Systems",
1103 : "S-Net Automation Co.Ltd.",
1104 : "Power Electronics S.L.",
1105 : "Renesas Technology Corp.",
1106 : "NSWCCD-SSES",
1107 : "Porter Engineering Ltd.",
1108 : "Meggitt Airdynamics Inc.",
1109 : "Inductive Automation",
1110 : "Neural ID",
1111 : "EEPod LLC",
1112 : "Hitachi Industrial Equipment Systems Co.Ltd.",
1113 : "Salem Automation",
1114 : "port GmbH",
1115 : "B & PLUS",
1116 : "Graco Inc.",
1117 : "Altera Corporation",
1118 : "Technology Brewing Corporation",
1121 : "CSE Servelec",
1124 : "Fluke Networks",
1125 : "Tetra Pak Packaging Solutions SPA",
1126 : "Racine Federated Inc.",
1127 : "Pureron Japan Co.Ltd.",
1130 : "Brother IndustriesLtd.",
1132 : "Leroy Automation",
1134 : "THK CO. : LTD.",
1137 : "TR-Electronic GmbH",
1138 : "ASCON S.p.A.",
1139 : "Toledo do Brasil Industria de Balancas Ltda.",
1140 : "Bucyrus DBT Europe GmbH",
1141 : "Emerson Process Management Valve Automation",
1142 : "Alstom Transport",
1144 : "Matrox Electronic Systems",
1145 : "Littelfuse",
1146 : "PLASMART Inc.",
1147 : "Miyachi Corporation",
1150 : "Promess Incorporated",
1151 : "COPA-DATA GmbH",
1152 : "Precision Engine Controls Corporation",
1153 : "Alga Automacao e controle LTDA",
1154 : "U.I. Lapp GmbH",
1155 : "ICES",
1156 : "Philips Lighting bv",
1157 : "Aseptomag AG",
1158 : "ARC Informatique",
1159 : "Hesmor GmbH",
1160 : "Kobe SteelLtd.",
1161 : "FLIR Systems",
1162 : "Simcon A/S",
1163 : "COPALP",
1164 : "Zypcom Inc.",
1165 : "Swagelok",
1166 : "Elspec",
1167 : "ITT Water & Wastewater AB",
1168 : "Kunbus GmbH Industrial Communication",
1170 : "Performance Controls Inc.",
1171 : "ACS Motion ControlLtd.",
1173 : "IStar Technology Limited",
1174 : "Alicat Scientific Inc.",
1176 : "ADFweb.com SRL",
1177 : "Tata Consultancy Services Limited",
1178 : "CXR Ltd.",
1179 : "Vishay Nobel AB",
1181 : "SolaHD",
1182 : "Endress+Hauser",
1183 : "Bartec GmbH",
1185 : "AccuSentry Inc.",
1186 : "Exlar Corporation",
1187 : "ILS Technology",
1188 : "Control Concepts Inc.",
1190 : "Procon Engineering Limited",
1191 : "Hermary Opto Electronics Inc.",
1192 : "Q-Lambda",
1194 : "VAMP Ltd",
1195 : "FlexLink",
1196 : "Office FA.com Co.Ltd.",
1197 : "SPMC (Changzhou) Co. Ltd.",
1198 : "Anton Paar GmbH",
1199 : "Zhuzhou CSR Times Electric Co.Ltd.",
1200 : "DeStaCo",
1201 : "Synrad Inc",
1202 : "Bonfiglioli Vectron GmbH",
1203 : "Pivotal Systems",
1204 : "TKSCT",
1205 : "Randy Nuernberger",
1206 : "CENTRALP",
1207 : "Tengen Group",
1208 : "OES Inc.",
1209 : "Actel Corporation",
1210 : "Monaghan Engineering Inc.",
1211 : "wenglor sensoric gmbh",
1212 : "HSA Systems",
1213 : "MK Precision Co.Ltd.",
1214 : "Tappan Wire and Cable",
1215 : "Heinzmann GmbH & Co. KG",
1216 : "Process Automation International Ltd.",
1217 : "Secure Crossing",
1218 : "SMA Railway Technology GmbH",
1219 : "FMS Force Measuring Systems AG",
1220 : "ABT Endustri Enerji Sistemleri Sanayi Tic. Ltd. Sti.",
1221 : "MagneMotion Inc.",
1222 : "STS Co.Ltd.",
1223 : "MERAK SIC : SA",
1224 : "ABOUNDI Inc.",
1225 : "Rosemount Inc.",
1226 : "GEA FES Inc.",
1227 : "TMG Technologie und Engineering GmbH",
1228 : "embeX GmbH",
1229 : "GH Electrotermia : S.A.",
1230 : "Tolomatic",
1231 : "Dukane",
1232 : "Elco (Tian Jin) Electronics Co.Ltd.",
1233 : "Jacobs Automation",
1234 : "Noda Radio Frequency Technologies Co.Ltd.",
1235 : "MSC Tuttlingen GmbH",
1236 : "Hitachi Cable Manchester",
1237 : "ACOREL SAS",
1238 : "Global Engineering Solutions Co.Ltd.",
1239 : "ALTE Transportation : S.L.",
1240 : "Penko Engineering B.V."
}
def getserial_number(value):
hex_string=value.hex()
little_endian_hex = bytearray.fromhex(hex_string)[::-1]
return little_endian_hex.hex()
def action(host,port):
p=binascii.unhexlify('63000000000000000000000000000000c1debed100000000')
BUFFER_SIZE = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.settimeout(3)
s.connect((host, port))
s.send(p)
data = s.recv(BUFFER_SIZE)
s.close()
enip_info["Type"]=device_type[data[50]]
enip_info["Vendor"]=vendor_id[data[48]]
enip_info["ProductName"]=data[63:63+data[62]].decode()
enip_info["SerialNumber"]=getserial_number(data[58:62])
enip_info["ProductCode"]=data[52]
enip_info["Revision"]=str(data[54])+"."+str(data[55])
enip_info["Status"]=data[56]
enip_info["State"]=data[data[62]+1]
enip_info["DeviceIP"]=host
enip_info["Port"]=port
except:
return False
return enip_info
def get_info(ip,port):
return(action(ip,port))
\ No newline at end of file
import struct
from scapy.all import *
import socket
import json
output={}
modbus_exception_codes = {
1 : 'ILLEGAL FUNCTION',
2 : 'ILLEGAL DATA ADDRESS',
3 : 'ILLEGAL DATA VALUE',
4 : 'SLAVE DEVICE FAILURE',
5 : 'ACKNOWLEDGE',
6 : 'SLAVE DEVICE BUSY',
8 : 'MEMORY PARITY ERROR',
10 : 'GATEWAY PATH UNAVAILABLE',
11 : 'GATEWAY TARGET DEVICE FAILED TO RESPOND'
}
def form_rsid(sid, functionId, data):
payload_len = 2
if(len(data)>0):
payload_len = payload_len+len(data)
return b"\0\0\0\0\0"+struct.pack('BBB', payload_len, sid, functionId)+data
def discover_device_id_recursive(host, port, sid, start_id, objects_table):
rsid = form_rsid(sid, 0x2B, b"\x0E\x01"+struct.pack('B',start_id))
result = comm(host, port, rsid)
object_value=None
if (result!=False and len(result) >= 8):
ret_code = result[7]
if ( ret_code == 43 and len(result) >= 15 ):
more_follows = result[11]
next_object_id =result[12]
number_of_objects =result[13]
offset = 15
for i in range(start_id,(number_of_objects-2)):
object_len = result[offset+1]
if object_len == None:
break
object_value = result[offset + 1:offset + object_len]
offset = offset + 2 + object_len
if ( more_follows == 255 and next_object_id != 0 ):
return discover_device_id_recursive(host, port, sid, next_object_id, objects_table)
return object_value
def discover_device_id(host, port, sid):
return discover_device_id_recursive(host, port, sid, 0x0, {})
def extract_slave_id(response):
try:
byte_count = response[8]
if( byte_count == None or byte_count == 0):
return None
return struct.unpack(str(byte_count)+"s",response[9:-1])[0].decode()
except:
return None
def comm(host, port, rsid):
BUFFER_SIZE = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.settimeout(3)
s.connect((host,port))
s.send(rsid)
data = s.recv(BUFFER_SIZE)
return data
except ConnectionError:
return False
except:
return 'terr'
def action(host,port,aggressive):
count=0
try:
for sid in range(1,247):
rsid=form_rsid(sid, 0x11, b"")
result=comm(host, port, rsid)
if(result!=False and len(result)>8):
output[sid]={'Slave ID data':'Unknown','Device identification':'Unknown'}
if(result[7]==17 or result[7]==145):
if(result[7]==17):
slave_id = extract_slave_id(result)
output[sid]["Slave ID data"] = slave_id if slave_id else "Unknown"
elif(result[7]==145):
exception_code = result[8]
exception_string = modbus_exception_codes[exception_code] if exception_code<12 and exception_code>0 else None
if(exception_string==None):
exception_string = "Unknown exception, Code="+str(exception_code)
output[sid]["Error"]=exception_string
else:
return False
device_table = discover_device_id(host, port, sid)
if (device_table!=None and len(device_table) > 0 ):
device_table = re.sub('[\x00-\x1f]',' ',device_table.decode(errors='ignore'))
output[sid]["Device identification"] = device_table.replace(" "," ")
count=0
if not aggressive:
output[sid]["sid"]="sid"+str(sid)
return output[sid]
elif(result=='terr' and count>2):
return False
elif(result==False):
return False
else:
count=count+1
return json.dumps(output)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(exc_type, fname, exc_tb.tb_lineno, e)
def get_info(ip,port,aggressive=False):
return(action(ip,port,aggressive))
\ No newline at end of file
import modbus
import json
import sqlite3
def discover_modbus_slaves(host,port):
mydb=sqlite3.connect("../assets.db",check_same_thread=False)
query=mydb.cursor()
modbus_data=modbus.get_info(host,port,True)
slave_data=json.loads(modbus_data) if modbus_data!=False else False
if(slave_data):
for slave_key in slave_data:
insinventory='INSERT INTO modbus_devices\
(sid,sid_data,device_info,ip_address)\
VALUES\
("'+slave_key+'","'+slave_data[slave_key]["Slave ID data"]+'","'+slave_data[slave_key]["Device identification"]+'","'+host+'")'
query.execute(insinventory)
query.close()
mydb.commit()
\ No newline at end of file
import binascii
from scapy.all import *
import socket
memcard = {
0 : "No Memory Card",
1 : "SPRAM",
2 : "EPROM",
3 : "EEPROM"
}
def memory_card(value):
mem_card = memcard[value] if value in memcard else "Unknown Memory Card Type"
return mem_card
def send_tcp(s):
req_addr = binascii.unhexlify("46494e530000000c000000000000000000000000")
controller_data_read = binascii.unhexlify("46494e5300000015000000020000000080000200")
controller_data_read2 = binascii.unhexlify("000000ef050501")
BUFFER_SIZE = 1024
try:
s.send(req_addr)
response = s.recv(BUFFER_SIZE)
except:
return False
header = response[0]
if(header == 70):
address = response[:23]
controller_data = controller_data_read+address+controller_data_read2+binascii.unhexlify('00')
try:
s.send(controller_data)
res = s.recv(BUFFER_SIZE)
except:
return False
return res
return "ERROR"
def send_udp(host,port):
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
BUFFER_SIZE = 1024
controller_data_read = binascii.unhexlify("800002000000006300ef050100")
try:
s.sendto(controller_data_read,(host,port))
response = s.recv(BUFFER_SIZE)
except:
return False
return response
def action(host,port,protocol):
output={}
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.settimeout(3)
s.connect((host,port))
except:
return False
response = ""
offset = 0
if (protocol == "tcp"):
offset = 16
response = send_tcp(s)
else:
response = send_udp(host,port)
header = response[0]
if(header==192 or header==193 or header==70):
response_code = response[12+offset]
if(response_code == 2081):
output["Response Code"] = "Data cannot be changed (0x2108)"
elif(response_code == 290):
output["Response Code"] = "The mode is wrong (executing) (0x2201)"
elif(response_code == 0):
output["Response Code"] = "Normal completion (0x0000)"
output["Controller Model"] = ((response[14+offset:].split(b"\x00",1))[0]).decode()
output["Controller Version"] = ((response[34+offset:].split(b"\x00",1))[0]).decode()
output["For System Use"] = ((response[54+offset:].split(b"\x00",1))[0]).decode()
output["Program Area Size"] = str(response[95])
output["IOM size"] = str(response[96])
output["No. DM Words"] = str(int(binascii.hexlify(response[97:99]),base=16))
output["Timer/Counter"] = str(response[99])
output["Expansion DM Size"] = str(response[100])
output["No. of steps/transitions"] = str(int(binascii.hexlify(response[101:102]),base=16))
mem_card_type = response[102]
output["Kind of Memory Card"] = memory_card(mem_card_type)
output["Memory Card Size"] = str(int(binascii.hexlify(response[103:104]),base=16))
return (output)
def get_info(ip,port,protocol='udp'):
return(action(ip,port,protocol))
\ No newline at end of file
import binascii
from scapy.all import *
import socket
def send_receive(s,pack):
BUFFER_SIZE = 1024
try:
s.send(pack)
data = s.recv(BUFFER_SIZE)
except:
return False
return data
def first_parse_response(response,output):
value=hex(response[7])
if (value == "0x32"):
output["Module"]=response[43:43+19].decode()
output["Basic_Hardware"]=response[71:71+19].decode()
output["Version"]="%s.%s.%s"%(response[122],response[122+1],response[122+2])
return output
else:
return False
def second_parse_response(response,output):
value=hex(response[7])
offset = 0
szl_id = hex(response[30])
if (value == "0x32"):
if( szl_id != "0x1c" ):
offset = 4
output["System Name"]=((response[39+offset:].split(b"\x00",1))[0]).decode()
output["Module Type"] =((response[73+offset:].split(b"\x00",1))[0]).decode()
output["Serial Number"]=((response[175+offset:].split(b"\x00",1))[0]).decode()
output["Copyright"]=((response[141+offset:].split(b"\x00",1))[0]).decode()
return output
def action(host,port):
output={}
cotp=binascii.unhexlify('0300001611e00000001400c1020100c2020102c0010a')
alt_COTP = binascii.unhexlify("0300001611e00000000500c1020100c2020200c0010a")
ROSCTR_Setup = binascii.unhexlify("0300001902f08032010000000000080000f0000001000101e0")
Read_SZL = binascii.unhexlify("0300002102f080320700000000000800080001120411440100ff09000400110001")
first_SZL_Request = binascii.unhexlify("0300002102f080320700000000000800080001120411440100ff09000400110001")
second_SZL_Request = binascii.unhexlify("0300002102f080320700000000000800080001120411440100ff090004001c0001")
response=None
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.settimeout(3)
s.connect((host,port))
except:
return False
response=send_receive(s,cotp)
if(response):
if(hex(response[5])!="0xd0"):
s.close()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host,port))
response=send_receive(s,alt_COTP)
if(response):
if(hex(response[5])!="0xd0"):
return False
response = send_receive(s,ROSCTR_Setup)
if(response):
if(hex(response[7])!="0x32"):
return False
response = send_receive(s,Read_SZL)
if(response):
if(hex(response[7])!="0x32"):
return False
response = send_receive(s, first_SZL_Request)
try:
output = first_parse_response(response,output)
except:
return False
response = send_receive(s, second_SZL_Request)
output=second_parse_response(response,output)
output["DeviceIP"]=host
output["Port"]=port
return output
def get_info(ip,port):
return(action(ip,port))
\ No newline at end of file
scapy==2.4.5
PyYAML==5.4.1
flask==1.1.4
requests==2.27.1
markupsafe==2.0.1
asgiref==3.4.1
certifi==2023.7.22
charset-normalizer==2.0.0
Django==3.2.20
idna==3.4
sqlparse==0.4.4
tzdata==2023.3
urllib3==1.26.7
from protocol_enumerators import ethernetip_enum
from protocol_enumerators import s7_enum
from protocol_enumerators import bacnet
from protocol_enumerators import modbus
from protocol_enumerators import omron
import sqlite3
from datetime import datetime
import json_operations
probes=[s7_enum,ethernetip_enum,bacnet,modbus,omron]
def map_ports(ip,port):
query=mydb.cursor()
dev_type="Unknown"
vendor="Unknown"
firmware="Unknown"
model="Unknown"
for i in probes:
res=i.get_info(ip,port)
if(res):
if(i.__name__=="protocol_enumerators.s7_enum"):
dev_type=res['Module Type']+" "+res['System Name']
vendor=res['Copyright']
firmware=res['Module']+" "+res['Version']
model=res['Serial Number']
json_operations.update_asset(ip,"s7comm",datetime.now().strftime("%d-%m-%y %H:%M:%S"),dev_type,vendor,firmware,model)
#updateproto='UPDATE inventory SET protocols=(select protocols from inventory where ip_address="'+ip+'")||":"||"s7comm",last_activity="'+datetime.now().strftime("%d-%m-%y %H:%M:%S")+'",type="'+dev_type+'",vendor="'+vendor+'",firmware_version="'+firmware+'",model="'+model+'" WHERE ip_address="'+ip+'"'
elif(i.__name__=="protocol_enumerators.ethernetip_enum"):
dev_type=res['Type']
vendor=res['Vendor']
firmware=res['ProductName']
model=res['SerialNumber']
json_operations.update_asset(ip, "enip", datetime.now().strftime("%d-%m-%y %H:%M:%S"), dev_type,vendor, firmware, model)
#updateproto='UPDATE inventory SET protocols=(select protocols from inventory where ip_address="'+ip+'")||":"||"enip",last_activity="'+datetime.now().strftime("%d-%m-%y %H:%M:%S")+'",type="'+dev_type+'",vendor="'+vendor+'",firmware_version="'+firmware+'",model="'+model+'" WHERE ip_address="'+ip+'"'
elif(i.__name__=="protocol_enumerators.bacnet"):
dev_type=res['desc']
vendor=res['vendorid']
firmware=res['firmware']
model=res['model']
json_operations.update_asset(ip, "bacnet", datetime.now().strftime("%d-%m-%y %H:%M:%S"), dev_type, vendor,firmware, model)
#updateproto='UPDATE inventory SET protocols=(select protocols from inventory where ip_address="'+ip+'")||":"||"bacnet",last_activity="'+datetime.now().strftime("%d-%m-%y %H:%M:%S")+'",type="'+dev_type+'",vendor="'+vendor+'",firmware_version="'+firmware+'",model="'+model+'" WHERE ip_address="'+ip+'"'
elif(i.__name__=="protocol_enumerators.modbus"):
dev_type=res['Device identification']
vendor=res['Slave ID data']
model=res['sid']
json_operations.update_asset(ip, "modbus", datetime.now().strftime("%d-%m-%y %H:%M:%S"), dev_type, vendor,"Unknown", model)
#updateproto='UPDATE inventory SET protocols=(select protocols from inventory where ip_address="'+ip+'")||":"||"modbus",last_activity="'+datetime.now().strftime("%d-%m-%y %H:%M:%S")+'",type="'+dev_type+'",vendor="'+vendor+'",firmware_version="'+firmware+'",model="'+model+'" WHERE ip_address="'+ip+'"'
elif(i.__name__=="protocol_enumerators.omron"):
dev_type='Omron Device'
vendor='Omron Devices'
firmware=res['Controller Version']
model=res['Controller Model']
json_operations.update_asset(ip, "omron", datetime.now().strftime("%d-%m-%y %H:%M:%S"), dev_type, vendor,firmware, model)
#updateproto='UPDATE inventory SET protocols=(select protocols from inventory where ip_address="'+ip+'")||":"||"modbus",last_activity="'+datetime.now().strftime("%d-%m-%y %H:%M:%S")+'",type="'+dev_type+'",vendor="'+vendor+'",firmware_version="'+firmware+'",model="'+model+'" WHERE ip_address="'+ip+'"'
break
\ No newline at end of file
from scapy.all import *
import datetime
import os
import binascii
import yaml
import sqlite3
from datetime import datetime
import active_scan
import protocol_actions
import threading
import requests
import json_operations as jo
from helpers.Packet_Analyzer import Packet_Analyzer
try:
yamlfile=open("config.yaml")
data = yaml.load(yamlfile, Loader=yaml.FullLoader)
server_ip=data["configuration"]["unifytwin_server_ip_address"]
plant=data["configuration"]["edge_device_location"]
balacklist_ips=data["configuration"]["blacklist_ip"]
blacklist_dns=data["configuration"]["blacklist_dns"]
configured_threads=data["configuration"]["threads"]
interfaces=data["configuration"]["interfaces"]
null_loopback=data["configuration"]["null_loopback"]
except Exception as e:
server_ip=""
plant="Unknown Location"
balacklist_ips=['46.4.105.116','172.67.214.157','3.6.115.64','104.21.53.154']
blacklist_dns=['webhook.site.','hpd.gasmi.net.','dd01-14-98-12-178.in.ngrok.io.']
configured_threads=10
interfaces='eth0'
null_loopback=False
from sys import platform
if platform == "linux" or platform == "linux2":
clearing='clear'
elif platform == "darwin":
clearing='clear'
elif platform == "win32":
clearing='cls'
def convert_text(pkt):
inhex=binascii.hexlify(bytes(pkt))
if(null_loopback):
inhex=b'0000000000000000000000000800'+inhex[8:] if inhex[:2]==b'02' else b'00000000000000000000000086DD'+inhex[8:]
try:
pa = Packet_Analyzer()
protocols=pa.identify_protocol(inhex)
ip=pa.get_ip(inhex)
if(ip):
mac=pa.get_mac(inhex)
check_exist=jo.check_asset_exists(ip)
if(not check_exist):
dev_type,vendor,firmware,model=protocol_actions.analyse_protocol(protocols,pkt)
operating_sys=pa.get_os(inhex)
jo.insert_asset(ip,datetime.now().strftime("%d-%m-%y %H:%M:%S"),dev_type,str(protocols),mac,vendor,firmware,model,operating_sys,plant)
else:
prev_protocols=jo.get_existing_protocols(ip)
extra_proto=set(protocols.split(':'))-set(prev_protocols.split(':'))
if(extra_proto):
dev_type,vendor,firmware,model=protocol_actions.update_protocol(protocols,pkt)
prev_protocols=prev_protocols+':'+str(extra_proto).replace(", ",":").replace("{","").replace("}","").replace("'","")
if(dev_type!="Unknown"):
jo.update_asset(ip,prev_protocols,datetime.now().strftime("%d-%m-%y %H:%M:%S"),dev_type,vendor,firmware,model)
else:
jo.update_last_activity_and_protocols(ip,prev_protocols,datetime.now().strftime("%d-%m-%y %H:%M:%S"))
else:
jo.update_last_activity(ip,datetime.now().strftime("%d-%m-%y %H:%M:%S"))
except sqlite3.OperationalError as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(exc_type, fname, exc_tb.tb_lineno,e)
pass
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(exc_type, fname, exc_tb.tb_lineno,e)
pass
def gasmi_api(pkt):
if(pkt.haslayer(IP)):
if(pkt[IP].src not in balacklist_ips and pkt[IP].dst not in balacklist_ips):
if(pkt.haslayer(DNS)):
try:
if(pkt[DNS]["DNS Question Record"].qname.decode() not in blacklist_dns):
convert_text(pkt)
except:
pass
else:
convert_text(pkt)
else:
convert_text(pkt)
def packet_transmit(pkt):
inhex=binascii.hexlify(bytes(pkt))
requests.get(server_ip,data=inhex)
def network_sniffing_local_storage(pkt):
if(threading.active_count()<configured_threads):
ti=threading.Thread(target=gasmi_api, args=pkt,)
ti.start()
def start_sniff(iface=interfaces):
act_scn=active_scan.Active_Scan()
ti = threading.Thread(target=act_scn.scan_for_assets)
ti.start()
sniff(iface=iface,prn=network_sniffing_local_storage)
if __name__=="__main__":
start_sniff()
sudo python3 asset_discover_main.py $1 $2 $3 $4 $5 $6 $7 $8 $9| sudo python3 security-management-ui.py
\ No newline at end of file
for KILLPID in $(sudo ps ax | grep 'asset_discover_main.py'|grep -v grep | awk '{print $1;}'); do sudo kill -9 $KILLPID;done
for KILLPID in $(sudo ps ax | grep 'security_management_ui.py'|grep -v grep | awk '{print $1;}'); do sudo kill -9 $KILLPID;done
\ No newline at end of file
sudo service security-management stop
sudo rm -rf /usr/share/security-management
sudo rm -rf /bin/security-management
sudo rm -rf /etc/systemd/system/security-management.service
sudo systemctl daemon-reload
sudo systemctl reset-failed
sudo crontab -l | grep -v '@reboot /bin/security-management --start' |sudo crontab -
sudo rm -rf /var/log/assets_management_logs.txt
echo 'Uninstall Complete!!!!'
\ No newline at end of file
from scapy.all import *
def get_interfaces():
interfaces = []
if platform == "linux" or platform == "linux2":
for i in get_if_list():
interfaces.append(i)
elif platform == "darwin":
for i in get_if_list():
interfaces.append(i)
elif platform == "win32":
output = os.popen('route print').read()
lines = output.split('\n')
for line in lines:
if ("......" in line):
interfaces.append(line.split("......")[1])
return interfaces
print(get_interfaces())
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment