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

6
README.md Normal file → Executable file
View File

@ -22,11 +22,11 @@
#### inspired by blackout's [MagicPacketGenerator](https://github.com/LetUsFsck/MagicPacketGenerator), ___gaynoise___ was tailored to further infuriate whitey with improvements including #### 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 - operating system header spoofing (linux, windows, cisco ios, solaris, etc) to legitimize traffic
- targeted destination ip address generation (every ip is gauranteed a visit!) - targeted destination ip address generation
- rfc1918 circumvention - rfc1918 awareness
- improved performance - 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 ## usage
grab a binary for your architecture from **Releases** grab a binary for your architecture from **Releases**

0
go.mod Normal file → Executable file
View File

0
go.sum Normal file → Executable file
View File

34
main.go Normal file → Executable file
View File

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