Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GNS3_unikernel_testbed
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NGUYEN Do Duc Anh
GNS3_unikernel_testbed
Commits
6d629d07
Commit
6d629d07
authored
8 months ago
by
NGUYEN Do Duc Anh
Browse files
Options
Downloads
Patches
Plain Diff
remove some print for testing
parent
31d3ab85
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ubuntu_base/opportunistic_monitor.py
+4
-4
4 additions, 4 deletions
ubuntu_base/opportunistic_monitor.py
ubuntu_base/opportunistic_node.py
+7
-7
7 additions, 7 deletions
ubuntu_base/opportunistic_node.py
ubuntu_base/set_ip_default
+1
-0
1 addition, 0 deletions
ubuntu_base/set_ip_default
with
12 additions
and
11 deletions
ubuntu_base/opportunistic_monitor.py
+
4
−
4
View file @
6d629d07
...
...
@@ -12,8 +12,8 @@ def process_packet(new_packet):
pkt
=
IP
(
data
)
if
pkt
.
haslayer
(
IP
):
print
(
f
"
IP Packet:
{
pkt
.
summary
()
}
"
)
pkt
.
show
()
#
print(f"IP Packet: {pkt.summary()}")
#
pkt.show()
index_custom_option
=
-
1
if
pkt
.
options
:
...
...
@@ -26,7 +26,7 @@ def process_packet(new_packet):
# save ip address for later attacker, node_id and interface_num
if
entry
[
"
cmd
"
]
==
Cmd
.
REGISTER
:
print
(
f
"
Custom Option from REGISTER found: id =
{
entry
[
'
node_id
'
]
}
, inter =
vmnet
{
entry
[
'
inter_num
'
]
}
"
)
print
(
f
"
Custom Option from REGISTER found: id =
{
entry
[
'
node_id
'
]
}
, inter =
ens
{
entry
[
'
inter_num
'
]
}
"
)
map_IP_with_source_switch
[
pkt
[
IP
].
src
]
=
{
"
node_id
"
:
entry
[
'
node_id
'
],
"
inter_num
"
:
entry
[
'
inter_num
'
]}
IP_attacker
=
"
172.16.60.133
"
...
...
@@ -50,7 +50,7 @@ def process_packet(new_packet):
del
pkt
[
IP
].
chksum
# Invalidate the checksum
new_packet
.
set_payload
(
bytes
(
pkt
))
pkt
.
show
()
#
pkt.show()
new_packet
.
accept
()
...
...
This diff is collapsed.
Click to expand it.
ubuntu_base/opportunistic_node.py
+
7
−
7
View file @
6d629d07
...
...
@@ -14,12 +14,12 @@ my_id = 1
def
process_packet
(
new_packet
):
global
my_id
global
my_id
,
name_interface
inter_num
=
new_packet
.
get_mark
()
# Determine the incoming interface based on the mark
interface
=
MARK_TO_INTERFACE
.
get
(
inter_num
,
'
unknown
'
)
print
(
interface
)
#
interface = MARK_TO_INTERFACE.get(inter_num, 'unknown')
#
print(interface)
data
=
new_packet
.
get_payload
()
...
...
@@ -28,8 +28,8 @@ def process_packet(new_packet):
# Check if it's a TCP packet
if
pkt
.
haslayer
(
IP
):
print
(
f
"
IP Packet:
{
pkt
.
summary
()
}
"
)
pkt
.
show
()
#
print(f"IP Packet: {pkt.summary()}")
#
pkt.show()
is_register_me
=
True
index_custom_option
=
-
1
...
...
@@ -42,7 +42,7 @@ def process_packet(new_packet):
for
entry
in
option
.
read_all_entry
():
if
entry
[
"
cmd
"
]
==
Cmd
.
DECISION_DROP
:
print
(
f
"
Custom Option from DECISION found: id =
{
entry
[
'
node_id
'
]
}
, inter =
vmnet
{
entry
[
'
inter_num
'
]
}
, cmd =
{
entry
[
'
cmd
'
]
}
"
)
f
"
Custom Option from DECISION found: id =
{
entry
[
'
node_id
'
]
}
, inter =
{
name_interface
}
{
entry
[
'
inter_num
'
]
}
, cmd =
{
entry
[
'
cmd
'
]
}
"
)
# Do something to deploy firewall
elif
entry
[
"
cmd
"
]
==
Cmd
.
REGISTER
:
is_register_me
=
False
...
...
@@ -62,7 +62,7 @@ def process_packet(new_packet):
del
pkt
.
ihl
del
pkt
[
IP
].
chksum
# Invalidate the checksum
new_packet
.
set_payload
(
bytes
(
pkt
))
pkt
.
show
()
# Now this will work correctly
#
pkt.show() # Now this will work correctly
new_packet
.
accept
()
...
...
This diff is collapsed.
Click to expand it.
ubuntu_base/set_ip_default
+
1
−
0
View file @
6d629d07
#!/bin/bash
sudo
ip addr add 192.168.1.10/24 dev ens3
sudo
nmcli con mod ens3 ipv4.method manual
sudo
nmcli con mod ens3 ipv4.addresses 192.168.1.10/24
sudo
nmcli con mod ens3 ipv4.gateway 192.168.1.5
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment