root/honeyclient/tags/exp/DOWN1-kindlund-multi_config/bin/StartManager.pl

Revision 238, 2.3 kB (checked in by kindlund, 2 years ago)

Incremented Master VM.

  • Property svn:executable set to *
  • Property svn:keywords set to Id "$file"
Line 
1 #!perl -w -Ilib
2
3 # $Id$
4
5 use strict;
6 use warnings;
7 use Carp ();
8
9 use Data::Dumper;
10
11 # Include Hash Serialization Utility Libraries
12 use Storable qw(nfreeze thaw);
13
14 # Include Base64 Libraries
15 use MIME::Base64 qw(encode_base64 decode_base64);
16
17 # Include Getopt Parser
18 use Getopt::Long;
19
20 use HoneyClient::Manager;
21
22 # We expect that the user will supply a single argument to this script.
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/master-vms/Agent.Master-10/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 }
60
61 my $agentState = HoneyClient::Manager->run(
62                     driver           => $driver, # Change to 'IE' or 'FF'
63                     master_vm_config => $config,
64                     agent_state      => encode_base64(nfreeze({
65                         $driver => { # Change to 'IE' or 'FF'
66                             next_link_to_visit => $firsturl,
67                             # Enable this line, if you want to only go to the
68                             # first 5 links for each domain.
69                             max_relative_links_to_visit => $maxrel,
70                             links_to_visit => \%remaining_urls,
71                          },
72                     })),
73                  );
74
Note: See TracBrowser for help on using the browser.