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_Offline
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_Offline
Commits
09b19ede
Commit
09b19ede
authored
Apr 28, 2023
by
yogesh.m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
98078998
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
3 additions
and
9 deletions
+3
-9
.idea/misc.xml
.idea/misc.xml
+1
-1
.idea/security-management (offline).iml
.idea/security-management (offline).iml
+1
-1
__pycache__/sniff.cpython-39.pyc
__pycache__/sniff.cpython-39.pyc
+0
-0
assets.db
assets.db
+0
-0
cloned.db
cloned.db
+0
-0
requirements.txt
requirements.txt
+0
-1
security-management-ui.py
security-management-ui.py
+1
-1
sniff.py
sniff.py
+0
-5
No files found.
.idea/misc.xml
View file @
09b19ede
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9
(security-management (offline))
"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9"
project-jdk-type=
"Python SDK"
/>
<component
name=
"PyCharmProfessionalAdvertiser"
>
<component
name=
"PyCharmProfessionalAdvertiser"
>
<option
name=
"shown"
value=
"true"
/>
<option
name=
"shown"
value=
"true"
/>
</component>
</component>
...
...
.idea/security-management (offline).iml
View file @
09b19ede
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<content
url=
"file://$MODULE_DIR$"
>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
</content>
</content>
<orderEntry
type=
"
inheritedJdk
"
/>
<orderEntry
type=
"
jdk"
jdkName=
"Python 3.9"
jdkType=
"Python SDK
"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</component>
<component
name=
"PyDocumentationSettings"
>
<component
name=
"PyDocumentationSettings"
>
...
...
__pycache__/sniff.cpython-39.pyc
View file @
09b19ede
No preview for this file type
assets.db
View file @
09b19ede
No preview for this file type
cloned.db
View file @
09b19ede
No preview for this file type
requirements.txt
View file @
09b19ede
scapy
==2.4.5
scapy
==2.4.5
mac-vendor-lookup
==0.1.12
PyYAML
==6.0
PyYAML
==6.0
flask
==2.2.2
flask
==2.2.2
requests
==2.28.2
requests
==2.28.2
\ No newline at end of file
security-management-ui.py
View file @
09b19ede
...
@@ -44,7 +44,7 @@ def start_sniff():
...
@@ -44,7 +44,7 @@ def start_sniff():
process
.
start
()
process
.
start
()
else
:
else
:
process
.
start
()
process
.
start
()
status
=
"listening on "
+
interface
+
""
status
=
"listening on "
+
interface
+
""
return
hello_world
()
return
hello_world
()
@
app
.
route
(
'/stop_sniff'
,
methods
=
[
'POST'
,
'GET'
])
@
app
.
route
(
'/stop_sniff'
,
methods
=
[
'POST'
,
'GET'
])
...
...
sniff.py
View file @
09b19ede
...
@@ -64,7 +64,6 @@ def convert_text(pkt):
...
@@ -64,7 +64,6 @@ def convert_text(pkt):
mac
=
pa
.
get_mac
(
inhex
)
mac
=
pa
.
get_mac
(
inhex
)
check_exist
=
query
.
execute
(
"SELECT ip_address FROM inventory WHERE ip_address='"
+
ip
+
"'"
)
.
fetchone
()
check_exist
=
query
.
execute
(
"SELECT ip_address FROM inventory WHERE ip_address='"
+
ip
+
"'"
)
.
fetchone
()
if
(
not
check_exist
):
if
(
not
check_exist
):
# add_subnet= True if (ip in str(os.popen('ip addr |grep inet| grep -v "::"| sed "s/inet //g"| sed -e "s/\/.*//g"').read())) else os.system("echo "+ip+" | grep -qa '^10.\|^192\.168\|^172\.16\|^2.2.' && sudo ip address add "+ip+".100/24 dev "+interfaces)
dev_type
,
vendor
,
firmware
,
model
=
protocol_actions
.
analyse_protocol
(
protocols
,
pkt
)
dev_type
,
vendor
,
firmware
,
model
=
protocol_actions
.
analyse_protocol
(
protocols
,
pkt
)
insinventory
=
'INSERT INTO inventory
\
insinventory
=
'INSERT INTO inventory
\
(ip_address,name,last_activity,type,protocols,mac_address,vendor,firmware_version,model,operating_system,plant)
\
(ip_address,name,last_activity,type,protocols,mac_address,vendor,firmware_version,model,operating_system,plant)
\
...
@@ -77,7 +76,6 @@ def convert_text(pkt):
...
@@ -77,7 +76,6 @@ def convert_text(pkt):
prev_protocols
=
query
.
execute
(
"SELECT protocols FROM inventory WHERE ip_address='"
+
ip
+
"'"
)
.
fetchone
()[
0
]
prev_protocols
=
query
.
execute
(
"SELECT protocols FROM inventory WHERE ip_address='"
+
ip
+
"'"
)
.
fetchone
()[
0
]
extra_proto
=
set
(
protocols
.
split
(
':'
))
-
set
(
prev_protocols
.
split
(
':'
))
extra_proto
=
set
(
protocols
.
split
(
':'
))
-
set
(
prev_protocols
.
split
(
':'
))
if
(
extra_proto
):
if
(
extra_proto
):
# add_subnet= True if (ip in str(os.popen('ip addr |grep inet| grep -v "::"| sed "s/inet //g"| sed -e "s/\/.*//g"').read())) else os.system("echo "+ip+" | grep -qa '^10.\|^192\.168\|^172\.16\|^2.2.' && sudo ip address add "+ip+".100/24 dev "+interfaces)
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"
):
...
@@ -102,9 +100,6 @@ def convert_text(pkt):
...
@@ -102,9 +100,6 @@ def convert_text(pkt):
mydb
.
commit
()
mydb
.
commit
()
pass
pass
except
Exception
as
e
:
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)
pass
pass
def
gasmi_api
(
pkt
):
def
gasmi_api
(
pkt
):
...
...
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