-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor. Reduce duplicated code (get tcp and udp elements shared bet…
…ween ipv4 and ipv6). Code Improvements and readability. Fix and add tests.
- Loading branch information
Showing
12 changed files
with
1,916 additions
and
2,492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SPDX-FileCopyrightText: 2025 Greenbone AG | ||
# | ||
# SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception | ||
|
||
ip_packet = forge_ip_packet(ip_v : 4, | ||
ip_hl : 5, | ||
ip_tos : 0, | ||
ip_len : 20, | ||
ip_id : 1234, | ||
ip_p : 0x06, | ||
ip_ttl : 255, | ||
ip_off : 0, | ||
ip_src : 192.168.1.6, | ||
ip_dst : 192.168.1.1); | ||
tcp_packet = forge_tcp_packet(ip: ip_packet, | ||
data: 1234, | ||
th_sport: 5080, | ||
th_dport: 80, | ||
th_seq: 1000, | ||
th_ack: 0, | ||
th_x2: 0, | ||
th_off: 5, | ||
th_flags: 33, | ||
th_win: 0, | ||
th_sum: 0, | ||
th_urp: 0); | ||
tcp_packet = insert_tcp_options(tcp: tcp_packet, 3, 10); | ||
opt = get_tcp_option(tcp: tcp_packet, option: 3); | ||
dump_tcp_packet(tcp_packet); | ||
send_packet(tcp_packet); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-FileCopyrightText: 2023 Greenbone AG | ||
# | ||
# SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception | ||
|
||
ip6_packet = forge_ip_v6_packet( ip6_v: 6, | ||
ip6_p: 0x06, | ||
ip6_hlim: 128, | ||
ip6_src: "5858::1", | ||
ip6_dst: "5858::1"); | ||
|
||
dump_ip_v6_packet(ip6_packet); | ||
|
||
tcp6_packet = forge_tcp_v6_packet(ip6: ip6_packet, | ||
th_sport: 5080, | ||
th_dport: 80, | ||
th_seq: 1000, | ||
th_ack: 0, | ||
th_x2: 0, | ||
th_off: 5, | ||
th_flags: 33, | ||
th_win: 0, | ||
th_sum: 0, | ||
th_urp: 0); | ||
dump_tcp_v6_packet(tcp6_packet); | ||
|
||
send_v6packet(tcp6_packet); | ||
|
||
tcp6_packet = set_tcp_v6_elements(tcp: tcp6_packet, th_sport: 33000); | ||
get_tcp_v6_element(tcp:tcp6_packet, element:"th_sport"); | ||
##tcp_packet_opts = insert_tcp_v6_options(tcp: tcp6_packet, 3, 2); | ||
##opt = get_tcp_v6_option(tcp: tcp_packet_opts, option: 3); | ||
|
||
#dump_tcp_v6_packet(tcp_packet_opts); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.