Advertisement
SwarupSaha

System Information Gathering

Jan 21st, 2016
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. #!/usr/bin/python
  2. #system Information Gathering
  3. import subprocess
  4. print ( "If you want system information enter 'sys' ")
  5. print ( "Else if you want diskspace information enter 'space' ")
  6. print ( "If you want all info enter 'showall' ")
  7. a = raw_input("enter the function command :")
  8. a = str(a)
  9.  
  10. #function 1
  11. def sys():
  12.     uname = "uname"
  13.     uname_arg = "-a"
  14.     print "Gathering system information with %s command:\n" % uname
  15.     subprocess.call([uname, uname_arg])
  16.  
  17. #function 2
  18. def space():
  19.     diskspace = "df"
  20.     diskspace_arg = "-h"
  21.     print "Gathering diskspace information with %s command:\n" % diskspace
  22.     subprocess.call([diskspace, diskspace_arg])
  23.  
  24. #function 3
  25. def showall():
  26.     sys()
  27.     print " "
  28.     space()
  29.  
  30. if a == "sys":
  31.     def main():
  32.         sys()
  33.  
  34. elif a == "space":
  35.     def main():
  36.         space()
  37.  
  38. elif a == "showall":
  39.     def main():
  40.         showall()
  41.  
  42. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement