ianperrin / MMM-NetworkScanner

A module for MagicMirror which determines the status of devices on the network based on their MAC or IP address
MIT License
107 stars 47 forks source link

Create arps2mm.sh #28

Closed E3V3A closed 6 years ago

E3V3A commented 6 years ago

Add a small bash script to format arp-scan output for easy addition to config file. Run with: ./arps2mm.sh

ianperrin commented 6 years ago

@E3V3A - looks good, especially with the addition of the updated arp-scan database.

One comment. When I ran the script, the name of the device was set to the first word of the vendor.

I had a quick look and this might fix it:

echo -e "$DARP" | while read line; do 
    echo "$line" |  awk -F "\t" -v fmt="   {macAddress: '%s', name: '%s', icon: 'mobile'},    // %s \n" '{printf fmt, $2, $3, $1}' ; 
done

Could you also create a scripts directory and move the sh file there?

E3V3A commented 6 years ago

@ianperrin

When I ran the script, the name of the device was set to the first word of the vendor

Yes, I actually left that on purpose, to make it shorter. Surely everyone would rather edit that text than having it say: "AzureWave Technology Inc." etc.

E3V3A commented 6 years ago

@ianperrin Will you merge this, or do you see some other problem with it?