Testers wanted for a shell script

Hi all,

As some of you have noticed, I've been working on scripts which ultimately will be added to my geoblocking project. The latest development is a script that autodetects local networks. It employs some heuristics which I've come up with for autodetection.

It would help if a few people here could test the script on their Linux computer or on their OpenWRT router, or both, and report back, so I have some certainty that the heuristics work in environments other than mine. It doesn't require root privileges and it's doing nothing suspicious, I swear :slight_smile:
(and you can inspect the source code if you want)

And yes, I know that this can be detected with OpenWRT built-in tools but I need an implementation that works on other systems as well.

Here's the link:

The script is detect-local-subnets-AIO.sh.

Hoping that someone brave will show up :slight_smile:
Or if someone wants to inspect the script and confirm that it is safe (I know that it is but other people may be understandably worried about that).

This is the output from my router:

root@router:/tmp# ./detect-local-subnets.sh 
Local inet addresses:
192.168.7.254/24
192.168.4.254/24
192.168.5.254/24
192.168.1.254/24

Aggregated subnets:
Local inet subnets (aggregated):
192.168.7.0/24
192.168.5.0/24
192.168.4.0/24
192.168.1.0/24

Local inet6 addresses:
fe80::6238:e0ff:febc:34e0/64
fe80::6238:e0ff:febc:34e0/64
fe80::6238:e0ff:febc:34e0/64
fdaf:5160:5d0f:fff7::1/64
fe80::6238:e0ff:febc:34e0/64
fe80::6238:e0ff:febc:34e0/64
fdaf:5160:5d0f:fff5::1/64
fe80::6238:e0ff:febc:34e0/64
fdaf:5160:5d0f:fff1::1/64
fe80::6238:e0ff:febc:34e0/64
fe80::6238:e0ff:febc:34e1/64
fe80::6238:e0ff:febc:34e0/64
fe80::6038:e0ff:febc:34e0/64
fe80::85bd:bd8f:f9f3:eef4/128
fe80::6038:e0ff:febc:34ef/64
fe80::6038:e0ff:febc:34ee/64
fe80::6038:e0ff:febc:34ed/64
fe80::4811:b5ff:fe63:76e2/64
fe80::6238:e0ff:febc:34e2/64
fe80::532e:299d/64
fe80::6038:e0ff:febc:34e3/64
fe80::6038:e0ff:febc:34e4/64
fe80::6038:e0ff:febc:34e5/64

Aggregated subnets:
Local inet6 subnets (aggregated):
fe80::/64
fdaf:5160:5d0f:fff7::/64
fdaf:5160:5d0f:fff5::/64
fdaf:5160:5d0f:fff1::/64
1 Like

at first glance it is OK

169.254.0.255/28
10.250.0.32/26
192.168.202.1/24
192.168.215.242/24
9.x.x.42/27
192.168.197.114/24
169.254.0.25/27

Aggregated subnets:
Local inet subnets (aggregated):
169.254.0.240/28
169.254.0.0/27
9.x.x.32/27
10.250.0.0/26
192.168.215.0/24
192.168.202.0/24
192.168.197.0/24

Local inet6 addresses:
fd00:25:76::1/64
fe80::425:ff:fe00:301/64
fd00:25:77::1/64
fe80::425:ff:fe00:301/64
fd00:25:202::1/64
fe80::425:ff:fe00:301/64
fe80::5b66:e02a/64
fdff:255::25/112
fd00::255/112

Aggregated subnets:
Local inet6 subnets (aggregated):
fdff:255::/112
fd00::/112
fe80::/64
fd00:25:202::/64
fd00:25:77::/64
fd00:25:76::/64
1 Like

Thank you for testing, this looks correct.

Thank you for testing. I'm not sure about the 9.x.x.42/27 ipv4 address. Is that your public ip? If so, that was not intended to be detected.

Also, I updated the aggregate-subnets.sh script to stop it from adding this line: Aggregated subnets:. So now the output should look a bit nicer.

yes, it is my pub ip
furthermore i have few 44.x.xx AMPR IP, they are also detected

1 Like

I changed the way local addresses are detected, could you please re-test? If you still have the files you downloaded previously, you only need to update the detect-local-subnets.sh script.

These don't seem to show up in the output you posted (I assume that's the output on your OpenWRT router)? Or is this on a different device? If it's on a different device, could you re-test on it with the updated script as well?

Update: I added a new detect-local-subnets-AIO.sh script to the repository. It can be used stand-alone, rather than downloading 3 files.

Also I implemented some additional optimizations, so now the script works about 40% faster than before, at least on my router.

Still need help with testing :slight_smile:

https://github.com/blunderful-scripts/subnet-tools/blob/main/detect-local-subnets-AIO.sh

@NPeca75 any chance you could re-test with the AIO script?