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