performance improvement, cleanup

This commit is contained in:
delorean 2024-09-05 23:00:08 -05:00
parent c9f93ec28a
commit f235756361
4 changed files with 25 additions and 21 deletions

10
README.md Normal file → Executable file
View File

@ -6,7 +6,7 @@
right here
_ _
|_| |_|
| | /^^^\ | |
| | /^^^\ | |
_| |_ (| "o" |) _| |_
_| | | | _ (_---_) _ | | | |_
| | | | |' | _| |_ | '| | | | |
@ -22,15 +22,15 @@
#### inspired by blackout's [MagicPacketGenerator](https://github.com/LetUsFsck/MagicPacketGenerator), ___gaynoise___ was tailored to further infuriate whitey with improvements including
- operating system header spoofing (linux, windows, cisco ios, solaris, etc) to legitimize traffic
- targeted destination ip address generation (every ip is gauranteed a visit!)
- rfc1918 circumvention
- targeted destination ip address generation
- rfc1918 awareness
- improved performance
#### with enough instances running, ___gaynoise___ could render many categories of threat intelligence sensors' data aggregations completely useless
#### with enough instances running, ___gaynoise___ could render many categories of threat intelligence sensors' data aggregations useless
## usage
grab a binary for your architecture from **Releases**
**everyone everywhere:**
```./gaynoise```

0
go.mod Normal file → Executable file
View File

0
go.sum Normal file → Executable file
View File

36
main.go Normal file → Executable file
View File

@ -25,6 +25,13 @@ var (
workers = flag.Int("c", 10, "")
delay = flag.Int("u", 0, "")
rfc1918 = []string{
"0.0.0.0/8",
"10.0.0.0/8",
"192.168.0.0/16",
"172.16.0.0/12",
}
// colors
colorReset = "\033[0m"
colorRed = "\033[31m"
@ -119,15 +126,14 @@ func assemble(daddr, saddr string, dport, sport, system int) ([]byte, error) {
return packet, nil
}
func rfc1918(ip net.IP) bool {
_, net0, _ := net.ParseCIDR("0.0.0.0/8")
_, net10, _ := net.ParseCIDR("10.0.0.0/8")
_, net192, _ := net.ParseCIDR("192.168.0.0/16")
_, net172, _ := net.ParseCIDR("172.16.0.0/12")
if net0.Contains(ip) || net10.Contains(ip) || net192.Contains(ip) || net172.Contains(ip) {
return true
func excluded(ip net.IP) bool {
for _, ex := range rfc1918 {
_, cidr, _ := net.ParseCIDR(ex)
if cidr.Contains(ip) {
return true
}
}
return false
}
@ -162,7 +168,7 @@ func runCIDR(cidr string, out chan string) error {
}
for target := ip.Mask(ipnet.Mask); ipnet.Contains(target); inc(target) {
if rfc1918(target) {
if excluded(target) {
continue
}
addr, _ := net.ResolveIPAddr("ip", target.String())
@ -186,7 +192,7 @@ func randIP() string {
ip := rand.Uint32()
binary.LittleEndian.PutUint32(buf, ip)
nip := net.IP(buf)
if !rfc1918(nip) {
if !excluded(nip) {
return nip.String()
}
}
@ -237,7 +243,7 @@ func banner() {
right here%s%s
_ _
|_| |_|
| | /^^^\ | |
| | /^^^\ | |
_| |_ (| "o" |) _| |_
_| | | | _ (_---_) _ | | | |_
| | | | |' | _| |_ | '| | | | |
@ -327,11 +333,9 @@ func main() {
// threads
addrs := make(chan string)
go func() {
for x := 0; x < *workers; x++ {
thread(addrs)
}
}()
for x := 0; x < *workers; x++ {
go thread(addrs)
}
// start alarm
if *duration > 0 {