root/honeyclient/branches/rel/1.0/bin/StartManager.pl

Revision 942, 2.2 kB (checked in by kindlund, 11 months ago)

Fixed DB code, where it assumed only one database was active in mysql.
Also fixed the _update logic to use proper WHERE clauses.

  • 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 # Change to 'HoneyClient::Agent::Driver::Browser::IE' or
27 #           'HoneyClient::Agent::Driver::Browser::FF'
28 my $driver = "HoneyClient::Agent::Driver::Browser::IE";
29 my $config = undef;
30 my $maxrel = 5;
31 my $nexturl = "";
32 my $urllist= "";
33
34 # TODO: Need --help option, along with sanity checking.
35 # TODO: Also need a decent POD for this code.
36 GetOptions('driver=s'             => \$driver,
37            'master_vm_config=s'   => \$config,
38            'url_list=s'           => \$urllist,
39            'max_relative_links:i' => \$maxrel);
40
41 # Go through the list of urls to create the array
42 # Anything not associated with an option is a URL
43 # Grab those first and then get the ones from the file specified
44 my @urls;
45 push( @urls, @ARGV );
46 if( -e $urllist ){
47     open URL, $urllist;
48     push(@urls, <URL>);
49 }
50
51 # Get the first url from the list
52 # Create a hashtable in the form: url => 1 for links_to_visit
53 chomp @urls;
54 my $firsturl = shift @urls;
55 my %remaining_urls;
56 foreach(@urls){
57     # We assign our initial list of URLs a priority of 1000, so that
58     # they'll be (likely to be) selected first, before going to any other
59     # external URLs found from subsequent drive operations.
60     $remaining_urls{$_} = 1000;
61 }
62
63 my $agentState = HoneyClient::Manager->run(
64                     driver           => $driver,
65                     master_vm_config => $config,
66                     agent_state      => encode_base64(nfreeze({
67                         $driver => {
68                             next_link_to_visit => $firsturl,
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.