Is there a simple way to get the value of the local subnet to which one is connected? I know I can derive it from what ifconfig outputs but using grep to get '192.168.13.0' from output like:-
eth0 Link encap:Ethernet HWaddr f0:de:f1:2b:f9:13 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:1533 errors:0 dropped:0 overruns:0 frame:0 TX packets:2135 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:820119 (820.1 KB) TX bytes:231948 (231.9 KB) Interrupt:20 Memory:f2500000-f2520000
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:1181 errors:0 dropped:0 overruns:0 frame:0 TX packets:1181 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:126765 (126.7 KB) TX bytes:126765 (126.7 KB)
wlan0 Link encap:Ethernet HWaddr 00:24:d7:6e:3d:08 inet addr:192.168.13.104 Bcast:192.168.13.255 Mask:255.255.255.0 inet6 addr: fe80::224:d7ff:fe6e:3d08/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8144 errors:0 dropped:0 overruns:0 frame:0 TX packets:8180 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3358385 (3.3 MB) TX bytes:1152063 (1.1 MB)
.... seems a little more difficult than it should be.
Presumably arp-scan does it somehow when you use 'arp-scan -l'.