Skip to content

Commit 96d5997

Browse files
update to rust 2024 edition
1 parent 1c13269 commit 96d5997

File tree

6 files changed

+58
-43
lines changed

6 files changed

+58
-43
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: Checkout code
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v5
2626

2727
- name: Setup ${{ matrix.toolchain }} toolchain
2828
uses: dtolnay/rust-toolchain@master

Cargo.lock

Lines changed: 44 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[package]
22
name = "ip-spoofing"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
authors = ["StackOverflowExcept1on"]
5-
edition = "2021"
5+
edition = "2024"
66
description = "Library to send fake IPv4 headers & UDP/TCP-SYN packets to perform L3/L4 attacks"
77
repository = "https://github.com/StackOverflowExcept1on/ip-spoofing"
88
license = "MIT"
99
keywords = ["ipv4", "tcp", "udp", "ip-spoofing"]
1010
categories = ["network-programming", "api-bindings"]
1111

1212
[dependencies]
13-
thiserror = "1.0"
14-
rand = "0.8"
15-
nix = { version = "0.29", features = ["net"] }
16-
etherparse = "0.15"
13+
thiserror = "2.0"
14+
rand = "0.9"
15+
nix = { version = "0.30", features = ["net"] }
16+
etherparse = "0.19"

examples/udp_flood.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use ip_spoofing::{self, rand::*, RawSocket, ReusablePacketWriter};
1+
use ip_spoofing::{self, RawSocket, ReusablePacketWriter, rand::*};
22

3-
/// This example shows how to generate bunch of fake UDP packets.
3+
/// This example shows how to generate a bunch of fake UDP packets.
44
/// It can be used to perform DDoS attacks.
55
///
66
/// In this case it will spam UDP packets to `127.0.0.1:5678`
@@ -11,14 +11,14 @@ fn main() -> ip_spoofing::Result<()> {
1111
//wrapper for writing packets in pre-allocated memory
1212
let mut writer = ReusablePacketWriter::new();
1313
//thread-local pseudorandom number generator
14-
let mut rng = thread_rng();
14+
let mut rng = rng();
1515

1616
//endless spam with a randomly generated UDP packet
1717
loop {
1818
let ret = socket.send_fake_udp_packet(
1919
&mut writer,
20-
rng.gen(), //random source IPv4 address
21-
rng.gen(), //random source port
20+
rng.random(), //random source IPv4 address
21+
rng.random(), //random source port
2222
[127, 0, 0, 1], //destination IPv4 address
2323
5678, //destination port
2424
b"hey", //data

src/packet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl ReusablePacketWriter {
3232
source: [u8; 4],
3333
destination: [u8; 4],
3434
) -> IpHeaders {
35-
let identification = rand::thread_rng().gen();
35+
let identification = rand::rng().random();
3636
IpHeaders::Ipv4(
3737
Ipv4Header {
3838
identification,

src/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{Result, ReusablePacketWriter};
22

33
use nix::sys::socket::{
4-
sendto, socket, AddressFamily, MsgFlags, SockFlag, SockProtocol, SockType, SockaddrIn,
4+
AddressFamily, MsgFlags, SockFlag, SockProtocol, SockType, SockaddrIn, sendto, socket,
55
};
66
use std::os::fd::{AsRawFd, OwnedFd, RawFd};
77

0 commit comments

Comments
 (0)