QoL updates
Remove offline entries for devices detected online on another address Remove entries older than 2 weeks
This commit is contained in:
1 parent
f9ecad13a6
commit
e93bd777af
2 files changed
+60
-6
No files matched your search
+13
-3
@@ -3,8 +3,6 @@
|
||||
# check for nmap and jq
|
||||
# check for root
|
||||
|
||||
starttime="$(date '+%Y-%m-%d %H:%M:%S')"
|
||||
|
||||
if [ -f arpscan.json ]
|
||||
then
|
||||
tempjson=$(jq '.ips += {} | .ips=(.ips|to_entries|map_values(.value.online=false)|from_entries)' arpscan.json)
|
||||
@@ -21,8 +19,17 @@ jsonescape() {
|
||||
jq -Rs . < <(printf "%s" "${1}")
|
||||
}
|
||||
|
||||
starttime="$(jsonescape "$(date '+%Y-%m-%dT%H:%M:%SZ')")"
|
||||
|
||||
foundhost() {
|
||||
tempjson=$(jq "$(jsonescape "${1}") as \$ip|.ips[\$ip].mac=$(jsonescape "${2}")|.ips[\$ip].online=true|.ips[\$ip].lastseen=$(jsonescape "${starttime}")" <<< "${tempjson}")
|
||||
local currentip
|
||||
local mac
|
||||
currentip="$(jsonescape "${1}")"
|
||||
mac="$(jsonescape "${2}")"
|
||||
# remove all offline entries for this MAC
|
||||
tempjson=$(jq ".ips |= with_entries(if .value.mac==${mac} and .value.online==false then empty else . end)" <<< "${tempjson}")
|
||||
# add entry
|
||||
tempjson=$(jq "${currentip} as \$ip|.ips[\$ip].mac=${mac}|.ips[\$ip].online=true|.ips[\$ip].lastseen=${starttime}" <<< "${tempjson}")
|
||||
}
|
||||
|
||||
doscan() {
|
||||
@@ -111,6 +118,9 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
# remove old entries
|
||||
tempjson=$(jq ".ips |= with_entries(if (${starttime}|fromdate)-(.value.lastseen|fromdate)>(14*24*60*60) then empty else . end)" <<< "${tempjson}")
|
||||
|
||||
## make sure the MAC vendor and device/port fields exist
|
||||
#tempjson="$(jq '.macvendor+={}|.devices+=[]' <<< "${tempjson}")"
|
||||
if [ ! -f macvendor.json ]
|
||||
|
||||
+47
-3
@@ -15,6 +15,8 @@
|
||||
],
|
||||
"ASUSTek Computer": [
|
||||
"04:42:1A",
|
||||
"10:7C:61",
|
||||
"30:C5:99",
|
||||
"50:EB:F6",
|
||||
"7C:10:C9",
|
||||
"A0:36:BC",
|
||||
@@ -23,7 +25,8 @@
|
||||
],
|
||||
"AzureWave Technology Inc.": [
|
||||
"48:E7:DA",
|
||||
"50:5A:65"
|
||||
"50:5A:65",
|
||||
"60:FF:9E"
|
||||
],
|
||||
"Cisco-Linksys": [
|
||||
"20:AA:4B",
|
||||
@@ -31,7 +34,10 @@
|
||||
],
|
||||
"Cloud Network Technology Singapore PTE. LTD.": [
|
||||
"3C:0A:F3",
|
||||
"A8:3B:76"
|
||||
"58:CD:C9",
|
||||
"74:97:79",
|
||||
"A8:3B:76",
|
||||
"DC:56:7B"
|
||||
],
|
||||
"Compal Information (KUNSHAN) CO., LTD.": [
|
||||
"08:8F:C3"
|
||||
@@ -48,6 +54,9 @@
|
||||
"Espressif Inc.": [
|
||||
"80:65:99"
|
||||
],
|
||||
"GD Midea Air-Conditioning Equipment Co.,Ltd.": [
|
||||
"F8:D5:54"
|
||||
],
|
||||
"GSD VIET NAM TECHNOLOGY COMPANY LIMITED": [
|
||||
"38:9B:73"
|
||||
],
|
||||
@@ -71,13 +80,17 @@
|
||||
],
|
||||
"Intel Corporate": [
|
||||
"00:24:D7",
|
||||
"04:56:E5",
|
||||
"2C:0D:A7",
|
||||
"3C:E9:F7",
|
||||
"5C:5F:67",
|
||||
"6C:2F:80",
|
||||
"70:08:10",
|
||||
"88:F4:DA",
|
||||
"94:E2:3C",
|
||||
"A0:E7:0B",
|
||||
"C4:75:AB"
|
||||
"C4:75:AB",
|
||||
"F0:9E:4A"
|
||||
],
|
||||
"Konica Minolta Holdings": [
|
||||
"00:20:6B"
|
||||
@@ -87,18 +100,34 @@
|
||||
"90:2E:16",
|
||||
"9C:2D:CD"
|
||||
],
|
||||
"Liteon Technology Corporation": [
|
||||
"E8:61:7E"
|
||||
],
|
||||
"Micro-Star Intl": [
|
||||
"D8:BB:C1"
|
||||
],
|
||||
"Microsoft": [
|
||||
"60:45:BD"
|
||||
],
|
||||
"Microsoft Corporation": [
|
||||
"00:15:5D",
|
||||
"D8:E2:DF"
|
||||
],
|
||||
"Motorola (Wuhan) Mobility Technologies Communication Co., Ltd.": [
|
||||
"78:D6:DC"
|
||||
],
|
||||
"PCS Systemtechnik GmbH (VirtualBox NIC)": [
|
||||
"08:00:27"
|
||||
],
|
||||
"Private": [
|
||||
"80:6D:97"
|
||||
],
|
||||
"Quanta Computer Inc.": [
|
||||
"C0:18:50"
|
||||
],
|
||||
"Quectel Wireless Solutions Co.,Ltd.": [
|
||||
"EC:B5:0A"
|
||||
],
|
||||
"Realtek Semiconductor": [
|
||||
"00:E0:4C"
|
||||
],
|
||||
@@ -111,6 +140,10 @@
|
||||
"BC:93:07",
|
||||
"F4:DD:06"
|
||||
],
|
||||
"Samsung Electronics Co.,Ltd": [
|
||||
"18:69:D4",
|
||||
"E4:92:82"
|
||||
],
|
||||
"Seiko Epson Corporation": [
|
||||
"F8:25:51",
|
||||
"F8:D0:27"
|
||||
@@ -130,6 +163,9 @@
|
||||
"SMC Networks": [
|
||||
"00:13:F7"
|
||||
],
|
||||
"Sony Interactive Entertainment Inc.": [
|
||||
"70:9E:29"
|
||||
],
|
||||
"Synology Incoporated": [
|
||||
"00:11:32",
|
||||
"90:09:D0"
|
||||
@@ -138,6 +174,9 @@
|
||||
"5C:E9:31",
|
||||
"E4:FA:C4"
|
||||
],
|
||||
"TP-LINK TECHNOLOGIES CO.,LTD.": [
|
||||
"28:EE:52"
|
||||
],
|
||||
"TPV Display Technology (Xiamen)": [
|
||||
"94:BD:BE"
|
||||
],
|
||||
@@ -153,9 +192,14 @@
|
||||
"Wistron InfoComm(Kunshan)Co.": [
|
||||
"F4:A8:0D"
|
||||
],
|
||||
"Xensource, Inc.": [
|
||||
"00:16:3E"
|
||||
],
|
||||
"Xiaomi Communications": [
|
||||
"3C:38:24",
|
||||
"48:87:59",
|
||||
"50:8E:49",
|
||||
"B8:3B:CC",
|
||||
"E4:84:D3"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user