diff --git a/scripts/fs-discovery b/scripts/fs-discovery new file mode 100755 index 0000000..30e09ed --- /dev/null +++ b/scripts/fs-discovery @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +$first = 1; + +print "{\n"; +print "\t\"data\":[\n\n"; + +for (`cat /proc/mounts`) +{ + ($fsname, $fstype) = m/\S+ (\S+) (\S+)/; + $fsname =~ s!/!\\/!g; + + print "\t,\n" if not $first; + $first = 0; + + print "\t{\n"; + print "\t\t\"{#FSNAME}\":\"$fsname\",\n"; + print "\t\t\"{#FSTYPE}\":\"$fstype\"\n"; + print "\t}\n"; +} + +print "\n\t]\n"; +print "}\n"; + diff --git a/scripts/net-discovery b/scripts/net-discovery new file mode 100755 index 0000000..e053824 --- /dev/null +++ b/scripts/net-discovery @@ -0,0 +1,30 @@ +#!/bin/bash + +numDevices=0 + +for x in `/sbin/ifconfig | grep Link | awk '{print $1}' | sort | egrep -v 'inet6|lo'` +do + #MAC=$(/sbin/ifconfig $x | grep "Link" | egrep -v inet6\|lo | awk '{print $5}') + #IP=$(/sbin/ifconfig $x | grep "inet addr" | cut -d: -f2 | cut -d' ' -f1) + #SPEED=$(/sbin/ethtool $x 2>/dev/null | grep "Speed" | cut -d: -f2 | sed 's/^[ \t]*//') + #LINK=$(/sbin/ethtool $x 2>/dev/null | grep "Link detected" | cut -d: -f2 | sed 's/^[ \t]*//') + + if [[ $numDevices -eq 0 ]]; then + echo "{" + echo " \"data\":[" + fi + if [[ -n "$x" ]]; then + echo " { \"{#IFNAME}\":\"$x\" }," + #echo -e $x"\t\t"$MAC"\t"$IP"\t"$SPEED"\t"$LINK + fi + let "numDevices++" +done + +if [[ $numDevices -gt 0 ]]; then + echo " ]" + echo "}" + exit 0 +else + exit 1 +fi +