Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Asset_Discovery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yogesh.m
Asset_Discovery
Commits
32d7bbfd
Commit
32d7bbfd
authored
Sep 04, 2023
by
yogesh.m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
fe3c8c37
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
24 deletions
+15
-24
config.yaml
config.yaml
+1
-1
protocol_actions.py
protocol_actions.py
+11
-15
protocol_discover_helpers/bacnet_discover.py
protocol_discover_helpers/bacnet_discover.py
+1
-1
protocol_discover_helpers/enip_discover.py
protocol_discover_helpers/enip_discover.py
+1
-2
protocol_discover_helpers/modbus_discover.py
protocol_discover_helpers/modbus_discover.py
+1
-4
sniff.py
sniff.py
+0
-1
No files found.
config.yaml
View file @
32d7bbfd
...
@@ -4,7 +4,7 @@ configuration:
...
@@ -4,7 +4,7 @@ configuration:
unifytwin_server_ip_address
:
https://webhook.site/43393e36-6b04-4481-8485-fad2c7cd549f
#Data will be sent back here
unifytwin_server_ip_address
:
https://webhook.site/43393e36-6b04-4481-8485-fad2c7cd549f
#Data will be sent back here
edge_device_location
:
Dalmia Cement
edge_device_location
:
Dalmia Cement
null_loopback
:
False
null_loopback
:
False
interfaces
:
Intel(R) Ethernet Connection (4) I219-LM
interfaces
:
Wi-Fi
blacklist_ip
:
[
'
46.4.105.116'
,
'
172.67.214.157'
,
'
3.6.115.64'
,
'
104.21.53.154'
]
blacklist_ip
:
[
'
46.4.105.116'
,
'
172.67.214.157'
,
'
3.6.115.64'
,
'
104.21.53.154'
]
blacklist_dns
:
[
'
webhook.site.'
]
blacklist_dns
:
[
'
webhook.site.'
]
ui_host
:
0.0.0.0
ui_host
:
0.0.0.0
...
...
protocol_actions.py
View file @
32d7bbfd
...
@@ -10,7 +10,7 @@ import os
...
@@ -10,7 +10,7 @@ import os
from
helpers.Packet_Analyzer
import
Packet_Analyzer
from
helpers.Packet_Analyzer
import
Packet_Analyzer
import
sys
import
sys
def
analyse_protocol
(
protocols
,
pkt
):
def
analyse_protocol
(
protocols
,
pkt
):
try
:
try
:
dev_type
=
"Unknown"
dev_type
=
"Unknown"
vendor
=
"Unknown"
vendor
=
"Unknown"
...
@@ -18,48 +18,44 @@ def analyse_protocol(protocols,pkt):
...
@@ -18,48 +18,44 @@ def analyse_protocol(protocols,pkt):
model
=
"Unknown"
model
=
"Unknown"
inhex
=
binascii
.
hexlify
(
bytes
(
pkt
))
inhex
=
binascii
.
hexlify
(
bytes
(
pkt
))
pa
=
Packet_Analyzer
()
pa
=
Packet_Analyzer
()
print
(
protocols
)
if
(
"enip"
in
protocols
):
if
(
"enip"
in
protocols
):
print
(
protocols
)
print
(
protocols
)
res
=
eip
.
get_info
(
pa
.
get_ip
(
inhex
),
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
)))
int
(
pa
.
get_tcp_port
(
inhex
))
if
"tcp"
in
protocols
else
int
(
pa
.
get_udp_port
(
inhex
)))
if
(
res
):
if
(
res
):
dev_type
=
res
[
'Type'
]
dev_type
=
res
[
'Type'
]
vendor
=
res
[
'Vendor'
]
vendor
=
res
[
'Vendor'
]
firmware
=
res
[
'ProductName'
]
firmware
=
res
[
'ProductName'
]
model
=
res
[
'SerialNumber'
]
model
=
res
[
'SerialNumber'
]
elif
(
"s7comm"
in
protocols
):
elif
(
"s7comm"
in
protocols
):
res
=
s7
.
get_info
(
eip
.
get_info
(
pa
.
get_ip
(
inhex
),
int
(
pa
.
get_tcp_port
(
inhex
))
if
"tcp"
in
protocols
else
int
(
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
)))
pa
.
get_udp_port
(
inhex
))))
if
(
res
):
if
(
res
):
dev_type
=
res
[
'Module Type'
]
+
" "
+
res
[
'System Name'
]
dev_type
=
res
[
'Module Type'
]
+
" "
+
res
[
'System Name'
]
vendor
=
res
[
'Copyright'
]
vendor
=
res
[
'Copyright'
]
firmware
=
res
[
'Module'
]
+
" "
+
res
[
'Version'
]
firmware
=
res
[
'Module'
]
+
" "
+
res
[
'Version'
]
model
=
res
[
'Serial Number'
]
model
=
res
[
'Serial Number'
]
elif
(
"bacnet"
in
protocols
):
elif
(
"bacnet"
in
protocols
):
res
=
bac
.
get_info
(
eip
.
get_info
(
pa
.
get_ip
(
inhex
),
int
(
pa
.
get_tcp_port
(
inhex
))
if
"tcp"
in
protocols
else
int
(
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
)))
pa
.
get_udp_port
(
inhex
))))
if
(
res
):
if
(
res
):
dev_type
=
res
[
'desc'
]
dev_type
=
res
[
'desc'
]
if
not
res
[
'desc'
]
==
''
else
res
[
'object'
]
vendor
=
res
[
'vendorid'
]
vendor
=
res
[
'vendorid'
]
firmware
=
res
[
'firmware'
]
firmware
=
res
[
'firmware'
]
model
=
res
[
'model'
]
model
=
res
[
'model'
]
elif
(
"codesys"
in
protocols
):
elif
(
"codesys"
in
protocols
):
res
=
codesys
.
get_info
(
eip
.
get_info
(
pa
.
get_ip
(
inhex
),
int
(
pa
.
get_tcp_port
(
inhex
))
if
"tcp"
in
protocols
else
int
(
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
)))
)
pa
.
get_udp_port
(
inhex
)))
if
(
res
):
if
(
res
):
dev_type
=
res
[
'OS Name'
]
dev_type
=
res
[
'OS Name'
]
vendor
=
res
[
'Product Type'
]
vendor
=
res
[
'Product Type'
]
elif
(
"modbus"
in
protocols
):
elif
(
"modbus"
in
protocols
):
res
=
modbus
.
get_info
(
eip
.
get_info
(
pa
.
get_ip
(
inhex
),
int
(
pa
.
get_tcp_port
(
inhex
))
if
"tcp"
in
protocols
else
int
(
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
)
pa
.
get_udp_port
(
inhex
)),
False
)
if
(
res
):
if
(
res
):
dev_type
=
res
[
'Device identification'
]
dev_type
=
res
[
'Device identification'
]
vendor
=
res
[
'Slave ID data'
]
vendor
=
res
[
'Slave ID data'
]
model
=
res
[
'sid'
]
model
=
res
[
'sid'
]
elif
(
"omron"
in
protocols
):
elif
(
"omron"
in
protocols
):
res
=
omron
.
get_info
(
eip
.
get_info
(
pa
.
get_ip
(
inhex
),
int
(
pa
.
get_tcp_port
(
inhex
))
if
"tcp"
in
protocols
else
int
(
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
)
pa
.
get_udp_port
(
inhex
)),
False
)
if
(
res
):
if
(
res
):
dev_type
=
'Omron Device'
dev_type
=
'Omron Device'
vendor
=
'Omron Devices'
vendor
=
'Omron Devices'
...
...
protocol_discover_helpers/bacnet_discover.py
View file @
32d7bbfd
def
protocol_identify
(
hex_pkt
):
def
protocol_identify
(
hex_pkt
):
if
(
b
'810a'
in
hex_pkt
and
hex_pkt
[
84
:
88
]
==
b
'810a'
):
if
(
b
'810a'
in
hex_pkt
and
hex_pkt
[
84
:
88
]
==
b
'810a'
):
return
"bacnet:"
return
":bacnet"
\ No newline at end of file
protocol_discover_helpers/enip_discover.py
View file @
32d7bbfd
def
protocol_identify
(
hex_pkt
):
def
protocol_identify
(
hex_pkt
):
print
(
hex_pkt
)
if
(
b
'6300'
in
hex_pkt
and
hex_pkt
[
108
:
112
]
==
b
'6300'
):
if
(
b
'6300'
in
hex_pkt
and
hex_pkt
[
84
:
88
]
==
b
'6300'
):
return
":enip"
return
":enip"
protocol_discover_helpers/modbus_discover.py
View file @
32d7bbfd
def
protocol_identify
(
hex_pkt
):
def
protocol_identify
(
hex_pkt
):
if
(
hex_pkt
[
108
:
112
]
==
b
'0000'
):
if
(
hex_pkt
[
108
:
112
]
==
b
'0000'
):
return
":modbus"
return
":modbus"
\ No newline at end of file
sniff.py
View file @
32d7bbfd
...
@@ -60,7 +60,6 @@ def convert_text(pkt):
...
@@ -60,7 +60,6 @@ def convert_text(pkt):
prev_protocols
=
jo
.
get_existing_protocols
(
ip
)
prev_protocols
=
jo
.
get_existing_protocols
(
ip
)
extra_proto
=
set
(
protocols
.
split
(
':'
))
-
set
(
prev_protocols
.
split
(
':'
))
extra_proto
=
set
(
protocols
.
split
(
':'
))
-
set
(
prev_protocols
.
split
(
':'
))
if
(
extra_proto
):
if
(
extra_proto
):
print
(
protocols
)
dev_type
,
vendor
,
firmware
,
model
=
protocol_actions
.
update_protocol
(
protocols
,
pkt
)
dev_type
,
vendor
,
firmware
,
model
=
protocol_actions
.
update_protocol
(
protocols
,
pkt
)
prev_protocols
=
prev_protocols
+
':'
+
str
(
extra_proto
)
.
replace
(
", "
,
":"
)
.
replace
(
"{"
,
""
)
.
replace
(
"}"
,
""
)
.
replace
(
"'"
,
""
)
prev_protocols
=
prev_protocols
+
':'
+
str
(
extra_proto
)
.
replace
(
", "
,
":"
)
.
replace
(
"{"
,
""
)
.
replace
(
"}"
,
""
)
.
replace
(
"'"
,
""
)
if
(
dev_type
!=
"Unknown"
):
if
(
dev_type
!=
"Unknown"
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment