Changeset 228
- Timestamp:
- 03/09/07 15:04:44 (1 year ago)
- Files:
-
- honeyclient/trunk/bin/StartManager.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/trunk/bin/StartManager.pl
r131 r228 15 15 use MIME::Base64 qw(encode_base64 decode_base64); 16 16 17 # Include Getopt Parser 18 use Getopt::Long; 19 17 20 use HoneyClient::Manager; 18 21 19 22 # We expect that the user will supply a single argument to this script. 20 23 # Namely, the initial URL that they want the Agent to use. 24 # They can however supply multiple urls which will be processed in order 25 26 my $driver = "IE"; 27 my $config = "/vm/Agent.Master-7/winXPPro.cfg"; 28 my $maxrel = 5; 29 my $nexturl = ""; 30 my $urllist= ""; 31 32 # TODO: Need --help option, along with sanity checking. 33 # TODO: Also need a decent POD for this code. 34 GetOptions('driver=s' => \$driver, 35 'master_vm_config=s' => \$config, 36 'url_list=s' => \$urllist, 37 'max_relative_links:i' => \$maxrel); 38 39 # Go through the list of urls to create the array 40 # Anything not associated with an option is a URL 41 # Grab those first and then get the ones from the file specified 42 my @urls; 43 push( @urls, @ARGV ); 44 if( -e $urllist ){ 45 open URL, $urllist; 46 push(@urls, <URL>); 47 } 48 49 # Get the first url from the list 50 # Create a hashtable in the form: url => 1 for links_to_visit 51 chomp @urls; 52 my $firsturl = shift @urls; 53 my %remaining_urls; 54 foreach(@urls){ 55 # We assign our initial list of URLs a priority of 1000, so that 56 # they'll be (likely to be) selected first, before going to any other 57 # external URLs found from subsequent drive operations. 58 $remaining_urls{$_} = 1000; 59 } 21 60 22 61 my $agentState = HoneyClient::Manager->run( 23 driver => 'IE', # Change to 'IE' or 'FF'24 master_vm_config => '/vm/Agent.Master-7/winXPPro.cfg',62 driver => $driver, # Change to 'IE' or 'FF' 63 master_vm_config => $config, 25 64 agent_state => encode_base64(nfreeze({ 26 IE=> { # Change to 'IE' or 'FF'27 next_link_to_visit => $ ARGV[0],65 $driver => { # Change to 'IE' or 'FF' 66 next_link_to_visit => $firsturl, 28 67 # Enable this line, if you want to only go to the 29 68 # first 5 links for each domain. 30 max_relative_links_to_visit => 5, 69 max_relative_links_to_visit => $maxrel, 70 links_to_visit => \%remaining_urls, 31 71 }, 32 72 })),
