Changeset 228

Show
Ignore:
Timestamp:
03/09/07 15:04:44 (1 year ago)
Author:
kindlund
Message:

sc: merging branch using tags svn+ssh://kindlund@www.honeyclient.org/home/svn/honeyclient/honeyclient/tags/exp/PRE-flindiakos-multi_urls and svn+ssh://kindlund@www.honeyclient.org/home/svn/honeyclient/honeyclient/branches/exp/flindiakos-multi_urls

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/bin/StartManager.pl

    r131 r228  
    1515use MIME::Base64 qw(encode_base64 decode_base64); 
    1616 
     17# Include Getopt Parser 
     18use Getopt::Long; 
     19 
    1720use HoneyClient::Manager; 
    1821 
    1922# We expect that the user will supply a single argument to this script. 
    2023# 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 
     26my $driver = "IE"; 
     27my $config = "/vm/Agent.Master-7/winXPPro.cfg"; 
     28my $maxrel = 5; 
     29my $nexturl = ""; 
     30my $urllist= ""; 
     31 
     32# TODO: Need --help option, along with sanity checking. 
     33# TODO: Also need a decent POD for this code. 
     34GetOptions('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 
     42my @urls; 
     43push( @urls, @ARGV );  
     44if( -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  
     51chomp @urls; 
     52my $firsturl = shift @urls; 
     53my %remaining_urls; 
     54foreach(@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} 
    2160 
    2261my $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
    2564                    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
    2867                            # Enable this line, if you want to only go to the 
    2968                            # 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, 
    3171                         }, 
    3272                    })),