speedreeder

Lab 3

May 20th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. Part A
  2. •Write a Windows script that will
  3. •Run netstat –ano
  4. •Parse the output into ‘appropriate’ fields
  5. •Match the PID with that from Tasklist (see earlier examples)
  6. •Print a table with the following columns:
  7. • Local port
  8. • Remote port (*:* for UDP)
  9. • Protocol (TCP or UDP)
  10. • State (empty string for UDP)
  11. • PID
  12. • Task name (name of EXE file)
  13. • Owner (Name of user who owns the task (N/A if unknown))
  14. Part B
  15. •Write a unix script to print an IDENTICAL table (same columns and format)
  16. •Use the unix version of netstat to get your information together with getpwuid
  17. and any other useful modules.
  18.  
  19.  
  20. Part C
  21. •Combine Lab3A and Lab3B into a SINGLE script that runs correctly on either
  22. Unix or Windows (assuming the proper modules are installed)
  23. •Document at the top of the script which modules (if any) must be installed on each platform.
  24. •See the discussion of ‘require’ vs. ‘use’ on myCourses, under Lab2,
  25. ‘How to check if you have admin rights on Windows’
  26. •Finally, you will get more info from netstat (and Tasklist) if you are an admin. Have your
  27. script warn the user of this if it is NOT running with admin rights.
  28.  
  29. Part D
  30. •Finally, write a script using Win32::ChangeNotify to watch a directory (given on the
  31. command line) for changes in either a file or a directory name (NOT is subdirectories,
  32. just in the directory itself).
  33. •Take a snapshot of file and directory names
  34. •Watch for 10 seconds
  35. •At the end of 10 seconds, with no changes, print a 'no changes' message
  36. •If a change occurs during the 10 second window, take a new snapshot to compare to
  37. the one taken at the start of the 10 second window of time. Print out what changed
  38. (e.g., print a list of names that were there but are no longer there ... then print a
  39. list of names that are there now, but weren't at the start of the 10 second window).
  40.  
  41. •Create a Unix script to approximate the same thing. We have no known ChangeNotify
  42. module for Unix, but you can fake one by taking a snaspshot of the directoiry, waiting
  43. 10 seconds, taking another snapshot of the directory, and then comparing the two
  44. snapshots. This will NOT notify you IMMEDIATELY of changes (as Win32::ChangeNotify
  45. does) but approximates the same functionality.
  46.  
  47. •As in Part C above ... make Part D a single script that works on either platform.
  48.  
  49. What to Submit:
  50. Submit only your final scripts to parts C and D. I do not need to see the scripts for
  51. the individual platforms (unless, of course, that is all you have and you want
  52. partial credit).
Advertisement
Add Comment
Please, Sign In to add comment