Created
June 14, 2013 05:10
-
-
Save fourdollars/5779590 to your computer and use it in GitHub Desktop.
A little script using busybox to extract all pci and usb modaliases strings and generate JSON request to some server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/busybox sh | |
JSON="$(echo '{"modalias":['; find /sys -name modalias -exec cat {} \; 2>/dev/null | grep -e '^\(pci\|usb\)' | sort | sed 's/^/"/' | sed 's/$/",/\'; busybox echo -n ']}')" # Find all pci/usb modaliases. | |
JSON="$(echo $JSON | sed 's/, ]}/]}/' | sed 's/\s\+//g')" # Remove trailing comma and white-space characters. | |
wget -q --header 'content-type: application/json' --post-data "$JSON" http://localhost:8000 -O - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment