# This script will just execute some system commands to get a
# picture of your current configuration. It will then format
# the output of the commands to create a web page. Ideally
# you'll end up with something that looks good on your website
# and makes a nice printout if you want a hardcopy. It also gave
# me something to do during a boredom attack ...
#
# Feel free to copy and paste this to your Linux (or Cygwin) box
# and modify it to suit your tastes.
#
echo "<html>
<head><title>Gateway Laptop</title>
</head><body>" > /usr/local/apache2/htdocs/hwconfig.html
#
# The line above is where you keep your web pages. See here
# to see why you should have a webserver on your machine
# and how to set it up.
#
# The lines below use lots of echo commands to add
# lines to the HTML file we're making. You can also use one
# echo to span several lines and save a few bytes. Notice
# the HTML section above to see how it's done. I used echo
# on most lines to to make it easier to see how the script works
#
echo "<center>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:12;color:#333333;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "This page was generated by a shell script, <a href="hware.html">here</a>.<br>Feel free to copy and modify it." >> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<table width=\"85%\"><tr><td valign=\"top\">" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd7755;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>Linux Kernel Version</b>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
uname -r >>/usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd7755;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>Disk Usage</b>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<table><tr><td align=\"top\">">>/usr/local/apache2/htdocs/hwconfig.html
#
#
# Since we know the output format of the various commands we can
# use awk and sed to get the fields we want and have
# sed insert table elements to create whatever layout seems
# most pleasing
#
#
df -h|awk '{print $1,$2,$3,$4,$5,$6}'|sed "s/ /<\/td><td valign=\"top\">/g"|sed "s/$/<\/td><\/tr><tr><td valign=\"top\">/" >>/usr/local/apache2/htdocs/hwconfig.html
echo "</td></tr></table>">>/usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd7755;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>Mounted File Systems</b>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<table><tr><td align=\"top\">">>/usr/local/apache2/htdocs/hwconfig.html
mount|awk '{print $1,$2,$3,$4,$5,$6}'|sed "s/ /<\/td><td valign=\"top\">/g"|sed "s/$/<\/td><\/tr><tr><td valign=\"top\">/" >>/usr/local/apache2/htdocs/hwconfig.html
echo "</td></tr></table>">>/usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd7755;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>All NICs</b><br>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<table><tr><td align=\"top\">">>/usr/local/apache2/htdocs/hwconfig.html
ifconfig|grep -v TX|grep -v Rx|grep -v collisions|awk '{print $1,$2,$3,$4}'|sed "s/ /<\/td><td valign=\"top\">/g"|sed "s/$/<\/td><\/tr><tr><td valign=\"top\">/" >>/usr/local/apache2/htdocs/hwconfig.html
echo "</td></tr></table>">>/usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd7755;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>Wireless NIC Configuration</b>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<br>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
cat /etc/sysconfig/network-scripts/ifcfg-wlan0 |sed "s/$/<br>/" >> /usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd7755;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>Routes</b><br>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<table cellspacing=\"10\"><tr><td align=\"top\">">>/usr/local/apache2/htdocs/hwconfig.html
route -v |grep -v Kernel|awk '{print $1,$2,$3,$4,$7}'|sed "s/ /<\/td><td valign=\"top\">/g"|sed "s/$/<\/td><\/tr><tr><td valign=\"top\">/" >>/usr/local/apache2/htdocs/hwconfig.html
echo "</td></tr></table>">>/usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd7755;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>Enabled Services</b>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<table cellpadding=\"3\" border=\"1\"><tr><td align=\"top\">">>/usr/local/apache2/htdocs/hwconfig.html
chkconfig --list|awk '{print $1,$2,$3,$4,$5,$6,$7,$8}'|sed "s/ /<\/td><td valign=\"top\">/g"|sed "s/$/<\/td><\/tr><tr><td valign=\"top\">/" >>/usr/local/apache2/htdocs/hwconfig.html
echo "</td></tr></table>">>/usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd8866;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>wpa_supplicant Configration</b>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<br>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
cat /etc/wpa_supplicant/wpa_supplicant.conf |sed "s/$/<br>/" >> /usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd8866;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>xorg.conf</b>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<br>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
cat /etc/X11/xorg.conf |sed "s/$/<br>/" >> /usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<span style=\"font-family:verdana;font-size:14pt;color:#dd8866;\">">>/usr/local/apache2/htdocs/hwconfig.html
echo "<b>/home/bil/.bash_profile</b>">> /usr/local/apache2/htdocs/hwconfig.html
echo "</span>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "<br>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "<blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
cat /home/bil/.bash_profile |sed "s/$/<br>/" >> /usr/local/apache2/htdocs/hwconfig.html
echo "</blockquote>">>/usr/local/apache2/htdocs/hwconfig.html
echo "<p>" >> /usr/local/apache2/htdocs/hwconfig.html
echo "</td></tr></table>">>/usr/local/apache2/htdocs/hwconfig.html
echo "</center>" >>/usr/local/apache2/htdocs/hwconfig.html
echo "</body</html>">> /usr/local/apache2/htdocs/hwconfig.html
No comments:
Post a Comment