performance improvement, cleanup
This commit is contained in:
parent
c9f93ec28a
commit
f235756361
6
README.md
Normal file → Executable file
6
README.md
Normal file → Executable 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
|
||||
- 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**
|
||||
|
28
main.go
Normal file → Executable file
28
main.go
Normal file → Executable 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) {
|
||||
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()
|
||||
}
|
||||
}
|
||||
@ -327,11 +333,9 @@ func main() {
|
||||
|
||||
// threads
|
||||
addrs := make(chan string)
|
||||
go func() {
|
||||
for x := 0; x < *workers; x++ {
|
||||
thread(addrs)
|
||||
go thread(addrs)
|
||||
}
|
||||
}()
|
||||
|
||||
// start alarm
|
||||
if *duration > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user