diff options
Diffstat (limited to 'sbhs_server/scan_rpis.sh')
-rw-r--r-- | sbhs_server/scan_rpis.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sbhs_server/scan_rpis.sh b/sbhs_server/scan_rpis.sh index 3a1fd3c..4577a41 100644 --- a/sbhs_server/scan_rpis.sh +++ b/sbhs_server/scan_rpis.sh @@ -1,11 +1,19 @@ #!/bin/bash -mkdir -p temp -nmap -n -sP 10.42.0.255/24 | grep -E -o "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])" | grep -v "10.42.0.1" > temp/ipaddrs.txt +cd sbhs_server +mkdir -p RPi_data +mkdir -p RPi_data/map RPi_data/report + +# get IP addresses of connected Raspberry Pi's +nmap -n -sP 10.42.0.255/24 | grep -E -o "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])" | grep -v "10.42.0.1" > RPi_data/ipaddrs.txt + +# Get map_machine_ids.txt and server reports from all connected Raspberry Pi's while read -r ip do - curl -o temp/$ip.txt $ip/map_machine_ids.txt -done < "temp/ipaddrs.txt" + curl -o RPi_data/map/$ip.txt $ip/map_machine_ids.txt + curl -o RPi_data/report/$ip.txt $ip/report.json +done < "RPi_data/ipaddrs.txt" +# Execute script to create IP map python create_ip_map.py
\ No newline at end of file |