Changeset 802

Show
Ignore:
Timestamp:
08/09/07 16:29:16 (1 year ago)
Author:
mbriggs
Message:

Update mbriggs-db exp branch to reflect trunk changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/mbriggs-db/LICENSE

    r13 r802  
    1            GNU GENERAL PUBLIC LICENSE 
    2               Version 2, June 1991 
     1            GNU GENERAL PUBLIC LICENSE 
     2               Version 2, June 1991 
    33 
    44 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 
     
    77 of this license document, but changing it is not allowed. 
    88 
    9                Preamble 
     9                Preamble 
    1010 
    1111  The licenses for most software are designed to take away your 
     
    5757modification follow. 
    5858 
    59            GNU GENERAL PUBLIC LICENSE 
     59            GNU GENERAL PUBLIC LICENSE 
    6060   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 
    6161 
     
    256256of promoting the sharing and reuse of software generally. 
    257257 
    258                NO WARRANTY 
     258                NO WARRANTY 
    259259 
    260260  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 
     
    278278POSSIBILITY OF SUCH DAMAGES. 
    279279 
    280             END OF TERMS AND CONDITIONS 
     280             END OF TERMS AND CONDITIONS 
  • honeyclient/branches/exp/mbriggs-db/bin/StartManager.pl

    r594 r802  
    2424# They can however supply multiple urls which will be processed in order 
    2525 
    26 my $driver = "IE"; 
    27 my $config = "/vm/master-vms/Agent.Master-22/winXPPro.cfg"; 
    28 my $maxrel = 10; 
     26# Change to 'HoneyClient::Agent::Driver::Browser::IE' or 
     27#           'HoneyClient::Agent::Driver::Browser::FF' 
     28my $driver = "HoneyClient::Agent::Driver::Browser::IE"; 
     29my $config = undef; 
     30my $maxrel = -1; 
    2931my $nexturl = ""; 
    3032my $urllist= ""; 
     
    6062 
    6163my $agentState = HoneyClient::Manager->run( 
    62                     driver           => $driver, # Change to 'IE' or 'FF' 
     64                    driver           => $driver, 
    6365                    master_vm_config => $config, 
    6466                    agent_state      => encode_base64(nfreeze({ 
    65                         $driver => { # Change to 'IE' or 'FF' 
     67                        $driver => { 
    6668                            next_link_to_visit => $firsturl, 
    67                             # Enable this line, if you want to only go to the 
    68                             # first 5 links for each domain. 
    6969                            max_relative_links_to_visit => $maxrel, 
    7070                            links_to_visit => \%remaining_urls, 
  • honeyclient/branches/exp/mbriggs-db/bin/run.sh

    r467 r802  
    11#!/bin/bash 
     2 
     3# $Id: run.sh 783 2007-07-30 17:43:19Z kindlund $ 
    24 
    35echo "Starting up Agent - (Hit CTRL-C multiple times to exit.)" 
    46 
    57# Remove all old /tmp/* entries. 
    6 rm /tmp/* 
     8rm /tmp/* > /dev/null 2>&1 
    79 
    810IP=$(/cygdrive/c/Program\ Files/VMware/VMware\ Tools/VMip.exe -get) 
  • honeyclient/branches/exp/mbriggs-db/create_pkg_dir.pl

    r16 r802  
    11#!/usr/bin/perl 
     2 
     3# $Id: create_pkg_dir.pl 787 2007-07-30 19:02:18Z kindlund $ 
     4 
    25use warnings; 
    36use strict; 
     
    1619 
    1720#   Directories to include in the distribution  
    18 my %inc_dirs = (etc => $src_path . '/etc', 
    19                 bin => $src_path . '/bin', 
    20                 inc => 'thirdparty/inc',); 
     21my %inc_dirs = (etc                            => $src_path . '/etc', 
     22                bin                            => $src_path . '/bin', 
     23                inc                            => 'thirdparty/inc', 
     24                'thirdparty'                   => 'thirdparty', 
     25                't'                            => 't', 
     26               ); 
    2127#--------------------------------------# 
    2228 
     
    6369    find({wanted => \&process, no_chdir => 1} ,"$src_path/$path/$module"); 
    6470 
     71    # Copy the LICENSE and INSTALL files. 
     72    my_copy("LICENSE",$pkg_name,1); 
     73    my_copy("INSTALL",$pkg_name,1); 
     74 
    6575    l(''); 
    6676} 
     
    103113}#}}} 
    104114 
     115 
    105116# All of the calls are the same, and I wanted to unclutter the above code 
    106117sub my_copy { #{{{ 
  • honeyclient/branches/exp/mbriggs-db/create_pkg_makefile.pl

    r13 r802  
    11#!/usr/bin/perl 
     2 
     3# $Id: create_pkg_makefile.pl 783 2007-07-30 17:43:19Z kindlund $ 
     4 
    25# Remember to add $name to this, or else it will not work 
    36use warnings; 
     
    3740    find(\&process,'lib'); 
    3841    foreach( sort keys %requires){ 
    39         printf FILE "requires\t%s => %s;\n",$_,$requires{$_}; 
     42        printf FILE "requires\t'%s' => '%s';\n",$_,$requires{$_}; 
    4043    } 
    4144} 
     
    4952print   FILE "license\t\t'gpl';\n"; 
    5053print   FILE "perl_version\t'5.006';\n"; 
     54print   FILE "author\t\t'MITRE Honeyclient Project <honeyclient\@mitre.org>';\n"; 
    5155 
    5256 
     
    6165get_dependencies(join("::",@name)); 
    6266print   FILE "\n"; 
     67print   FILE "no_index\t'directory' => 'etc';\n"; 
     68print   FILE "no_index\t'directory' => 'inc';\n"; 
     69print   FILE "no_index\t'directory' => 'thirdparty';\n"; 
     70print   FILE "\n"; 
    6371print   FILE "auto_install;\n"; 
    6472print   FILE "WriteAll;\n"; 
  • honeyclient/branches/exp/mbriggs-db/etc/honeyclient.xml

    r596 r802  
    6868            9000 
    6969        </port> 
     70        <allowed_drivers description="List of implemented Drivers that the Agent is allowed to run directly."> 
     71            <name>HoneyClient::Agent::Driver::Browser::IE</name> 
     72            <name>HoneyClient::Agent::Driver::Browser::FF</name> 
     73        </allowed_drivers> 
    7074        <!-- HoneyClient::Agent::Driver Options --> 
    7175        <Driver> 
     
    7478                20  
    7579            </timeout> 
     80            <ActiveContent> 
     81                <enable description="Enables active content parsing. 1 enables, 0 disables." default="1"> 
     82                    1 
     83                </enable> 
     84                <Flash> 
     85                    <flasm_exec description="Path to the flasm executable." default="thirdparty/flasm/flasm.exe"> 
     86                        thirdparty/flasm/flasm.exe 
     87                    </flasm_exec> 
     88                </Flash> 
     89            </ActiveContent> 
    7690            <Browser> 
    7791                <!-- HoneyClient::Agent::Driver::IE Options --> 
    7892                <!-- TODO: Update this. --> 
    7993                <ignore_links_timed_out description="If this parameter is 1, then the browser will never attempt to revisit any links that caused the browser to initially time out." default="0"> 
    80                    1 
    81                </ignore_links_timed_out> 
     94                    1 
     95                </ignore_links_timed_out> 
    8296                <!-- TODO: Update this. --> 
    8397                <process_name description="The name of the Internet Explorer application process, as it appears in the Task Manager." default="iexplore.exe"> 
    84                    iexplore.exe 
    85                </process_name> 
     98                    iexplore.exe 
     99                </process_name> 
    86100                <max_relative_links_to_visit description="An integer, representing the maximum number of relative links that the browser should visit, before moving onto another website.  If negative, then the browser will exhaust all possible relative links found, before moving on.  This functionality is best effort; it's possible for the browser to visit new links on previously visited websites." default="-1"> 
    87                     -1 
    88                 </max_relative_links_to_visit> 
    89                 <goodwords description="A comma-separated list of good words which will increase the score of links within a webpage." default=""> 
    90                     news,new,big,latest,main,update,sell,free,buy 
    91                 </goodwords> 
    92                 <badwords description="A comma-separated list of bad words which will decrease the score of links within a webpage." default=""> 
    93                     archive,privacy,legal,disclaim,about,contact,copyright,jobs,careers 
    94                 </badwords> 
     101                    -1 
     102                </max_relative_links_to_visit> 
     103                <positive_words description="If a link contains any number of these words, then its probability of being visited (its score) will increase."> 
     104                    <word>news</word> 
     105                    <word>new</word> 
     106                    <word>big</word> 
     107                    <word>latest</word> 
     108                    <word>main</word> 
     109                    <word>update</word> 
     110                    <word>sell</word> 
     111                    <word>free</word> 
     112                    <word>buy</word> 
     113                    <word>science</word> 
     114                </positive_words> 
     115                <negative_words description="If a link contains any number of these words, then its probability of being visited (its score) will decrease."> 
     116                    <word>archive</word> 
     117                    <word>privacy</word> 
     118                    <word>legal</word> 
     119                    <word>disclaim</word> 
     120                    <word>about</word> 
     121                    <word>contact</word> 
     122                    <word>copyright</word> 
     123                    <word>jobs</word> 
     124                    <word>careers</word> 
     125                </negative_words> 
    95126                <IE> 
    96                     <!-- HoneyClient::Agent::Driver::IE Options --> 
    97                     <!-- TODO: Update this. --> 
    98                     <ignore_links_timed_out description="If this parameter is 1, then the browser will never attempt to revisit any links that caused the browser to initially time out." default="0"> 
    99                         1 
    100                     </ignore_links_timed_out> 
    101                     <!-- TODO: Update this. --> 
    102                     <process_name description="The name of the Internet Explorer application process, as it appears in the Task Manager." default="iexplore.exe"> 
    103                         iexplore.exe 
    104                     </process_name> 
    105                     <max_relative_links_to_visit description="An integer, representing the maximum number of relative links that the browser should visit, before moving onto another website.  If negative, then the browser will exhaust all possible relative links found, before moving on.  This functionality is best effort; it's possible for the browser to visit new links on previously visited websites." default="-1"> 
    106                         -1 
    107                     </max_relative_links_to_visit> 
     127                    <!-- HoneyClient::Agent::Driver::Browser::IE Options --> 
     128                    <process_exec description="The absolute path to the Internet Explorer application process, as it sits in the VM filesystem." default="C:\Program Files\Internet Explorer\iexplore.exe"> 
     129                        C:\Program Files\Internet Explorer\iexplore.exe 
     130                    </process_exec> 
     131                    <process_name description="The name of the Internet Explorer executable, as it appears on the VM filesystem." default="iexplore.exe"> 
     132                        iexplore.exe 
     133                    </process_name> 
    108134                </IE> 
    109135                <FF> 
    110                     <max_relative_links_to_visit description="An integer, representing the maximum number of relative links that the browser should visit, before moving onto another website.  If negative, then the browser will exhaust all possible relative links found, before moving on.  This functionality is best effort; it's possible for the browser to visit new links on previously visited websites." default="-1"> 
    111                         5 
    112                     </max_relative_links_to_visit> 
    113                     <!-- http://gatekeeper-w.mitre.org:80 --> 
    114                     <http_proxy description="Set to your HTTP Proxy if you have one, otherwise set to 'none'"> 
    115                         none 
    116                     </http_proxy> 
    117                     <ff_exec description="path to the firefox executable (default install path is C:\Program Files\Mozilla Firefox\firefox.exe)"> 
    118                         C:\Program Files\Mozilla Firefox\firefox.exe 
    119                     </ff_exec> 
     136                    <!-- HoneyClient::Agent::Driver::Browser::FF Options --> 
     137                    <process_exec description="The absolute path to the Mozilla Firefox application process, as it sits in the VM filesystem." default="C:\Program Files\Mozilla Firefox\firefox.exe"> 
     138                        C:\Program Files\Mozilla Firefox\firefox.exe 
     139                    </process_exec> 
     140                    <process_name description="The name of the Mozilla Firefox executable, as it appears on the VM filesystem." default="firefox.exe"> 
     141                        firefox.exe 
     142                    </process_name> 
    120143                </FF> 
    121144            </Browser> 
     
    171194                    <regex>C:/WINDOWS/SYSTEM32/wbem.*</regex> 
    172195                    <regex>C:/WINDOWS/WindowsUpdate.log</regex> 
     196                    <regex>C:/WINDOWS/wmsetup.log</regex> 
    173197                    <!-- To exclude entries inside cygwin, use the following format. --> 
    174198                    <regex>/cygdrive/c/cygwin/tmp.*</regex> 
     
    209233                    <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Favorites\\Links.*$</regex> 
    210234                    <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Start Menu2\\Programs.*$</regex> 
    211                     <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MountPoints2\\CPC\\Volume.*$</regex> 
     235                    <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MountPoints2.*$</regex> 
    212236                    <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU.*$</regex> 
    213237                    <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UserAssist\\.+\\Count.*$</regex> 
     
    218242                    <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\ShellNoRoam\\BagMRU.*$</regex> 
    219243                    <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\ShellNoRoam\\MUICache.*$</regex> 
     244                    <regex>^HKEY_CURRENT_USER\\Software\\Microsoft\\Windows Media\\WMSDK\\General.*$</regex> 
    220245                    <regex>^HKEY_CURRENT_USER\\Volatile Environment$</regex> 
    221246                    <regex>^HKEY_LOCAL_MACHINE\\SOFTWARE\\Macromedia$</regex> 
    222247                    <regex>^HKEY_LOCAL_MACHINE\\SOFTWARE\\Macromedia\\FlashPlayer$</regex> 
    223248                    <regex>^HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\RNG$</regex> 
     249                    <regex>^HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Dfrg\\BootOptimizeFunction$</regex> 
     250                    <regex>^HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Direct3D\\MostRecentApplication$</regex> 
    224251                    <regex>^HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\PCHealth\\PchSvc$</regex> 
    225252                    <regex>^HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\SystemCertificates\\.*$</regex> 
     
    257284                    <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Favorites\\Links.*$</regex> 
    258285                    <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Start Menu2\\Programs.*$</regex> 
    259                     <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MountPoints2\\CPC\\Volume.*$</regex> 
     286                    <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MountPoints2.*$</regex> 
    260287                    <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU.*$</regex> 
    261288                    <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\.*$</regex> 
     
    264291                    <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows\\ShellNoRoam\\DUIBags\\ShellFolders\\.*$</regex> 
    265292                    <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows\\ShellNoRoam\\MUICache.*$</regex> 
     293                    <regex>^HKEY_USERS\\S.+\\Software\\Microsoft\\Windows Media\\WMSDK\\General.*$</regex> 
    266294                </exclude_list> 
    267295                <!-- HoneyClient::Agent::Integrity::Registry::Test Options --> 
     
    296324    </Agent> 
    297325    <!-- HoneyClient::DB Options --> 
    298    <DB> 
    299        <enable description="Enables database operations. 1 enables, 0 disables." default="0"> 
    300            
    301        </enable> 
    302        <host description="The system providing the HoneyClient database.  If the database is installed on the same host system as the Manager, then localhost should be used." default="127.0.0.1"> 
    303             127.0.0.1 
    304        </host> 
    305        <dbname description="The name of the HoneyClient database." default="HoneyClient"> 
    306            HoneyClient 
    307        </dbname> 
    308        <user description="The username to use, when connecting to the HoneyClient database."> 
    309            honeyclient_user 
    310        </user> 
    311        <pass description="The password to use, when connecting to the HoneyClient database."> 
     326    <DB> 
     327        <enable description="Enables database operations. 1 enables, 0 disables." default="0"> 
     328           
     329        </enable> 
     330        <host description="The system providing the HoneyClient database.  If the database is installed on the same host system as the Manager, then localhost should be used." default="127.0.0.1"> 
     331            172.16.164.1 
     332        </host> 
     333        <dbname description="The name of the HoneyClient database." default="HoneyClient"> 
     334            HoneyClient 
     335        </dbname> 
     336        <user description="The username to use, when connecting to the HoneyClient database."> 
     337            honeyclient_user 
     338        </user> 
     339        <pass description="The password to use, when connecting to the HoneyClient database."> 
    312340            honeyclient_password  
    313        </pass> 
    314        <port description="The default TCP port number used to communicate with the database." default="3306"> 
    315            3306 
    316        </port> 
    317    </DB> 
     341        </pass> 
     342        <port description="The default TCP port number used to communicate with the database." default="3306"> 
     343            3306 
     344        </port> 
     345    </DB> 
    318346    <Manager> 
    319347        <!-- TODO: Update this. --> 
     
    431459        <VM> 
    432460            <master_vm_config description="The full absolute path to the VM configuration file on the host system that will be used by all subsequent cloned VMs."> 
    433                 /vm/master-vms/Agent.Master-20/winXPPro.cfg 
     461                /vm/master-vms/Agent.Master-23/winXPPro.cfg 
    434462            </master_vm_config> 
    435463            <port description="The TCP port number that the SOAP server of the VM daemon will listen on for requests.  Note: This port should be unique and not already be used by other modules, services, or daemons running on the host system." default="8089"> 
  • honeyclient/branches/exp/mbriggs-db/lib/HoneyClient/Agent.pm

    r536 r802  
    3838=head1 VERSION 
    3939 
    40 0.97 
     400.99 
    4141 
    4242=head1 SYNOPSIS 
     
    7676    # Defines which functions can be called externally. 
    7777    require Exporter; 
    78     our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION, @DRIVERS); 
     78    our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION); 
    7979 
    8080    # Set our package version. 
    81     $VERSION = 0.97
     81    $VERSION = 0.99
    8282 
    8383    @ISA = qw(Exporter); 
    8484 
    85     # Symbols to export on request 
     85    # Symbols to export automatically 
    8686    @EXPORT = qw(); 
    8787 
     
    9898    ); 
    9999 
    100     # Symbols to autoexport (:DEFAULT tag
     100    # Symbols to autoexport (when qw(:all) tag is used
    101101    @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 
    102102 
     
    110110    $Config{useithreads} or Carp::croak "Error: Recompile Perl with ithread support, in order to use this module.\n"; 
    111111 
    112     # Registered driver list. 
    113     # TODO: Eventually, make this more dynamic, based upon the presence of HoneyClient::Agent::Driver::* elements 
    114     # within the global configuration file.  Or, feed the initialization logic through init() as part of the arguments. 
    115     @DRIVERS = ( 'IE' ); 
    116     foreach (@DRIVERS) { 
    117         eval "use HoneyClient::Agent::Driver::Browser::$_"; 
    118         if ($@) { 
    119             Carp::croak "$@"; 
    120         } 
    121     } 
    122  
    123112    $SIG{PIPE} = 'IGNORE'; # Do not exit on broken pipes. 
    124113} 
    125 our (@EXPORT_OK, $VERSION, @DRIVERS); 
     114our (@EXPORT_OK, $VERSION); 
    126115 
    127116=pod 
     
    150139use HoneyClient::Util::Config qw(getVar); 
    151140 
    152 # TODO: Change Driver::IE to Driver::Browser::IE 
    153 # Make sure HoneyClient::Agent::Driver::IE loads. 
    154 BEGIN { use_ok('HoneyClient::Agent::Driver::IE') or diag("Can't load HoneyClient::Agent::Driver::IE package.  Check to make sure the package library is correctly listed within the path."); } 
    155 require_ok('HoneyClient::Agent::Driver::IE'); 
    156 can_ok('HoneyClient::Agent::Driver::IE', 'new'); 
    157 can_ok('HoneyClient::Agent::Driver::IE', 'drive'); 
    158 can_ok('HoneyClient::Agent::Driver::IE', 'getNextLink'); 
    159 can_ok('HoneyClient::Agent::Driver::IE', 'next'); 
    160 can_ok('HoneyClient::Agent::Driver::IE', 'isFinished'); 
    161 can_ok('HoneyClient::Agent::Driver::IE', 'status'); 
    162 use HoneyClient::Agent::Driver::IE; 
     141# TODO: Include FF 
     142# Make sure HoneyClient::Agent::Driver::Browser::IE loads. 
     143BEGIN { use_ok('HoneyClient::Agent::Driver::Browser::IE') or diag("Can't load HoneyClient::Agent::Driver::Browser::IE package.  Check to make sure the package library is correctly listed within the path."); } 
     144require_ok('HoneyClient::Agent::Driver::Browser::IE'); 
     145# TODO: Update this list of function names. 
     146can_ok('HoneyClient::Agent::Driver::Browser::IE', 'new'); 
     147can_ok('HoneyClient::Agent::Driver::Browser::IE', 'drive'); 
     148can_ok('HoneyClient::Agent::Driver::Browser::IE', 'getNextLink'); 
     149can_ok('HoneyClient::Agent::Driver::Browser::IE', 'next'); 
     150can_ok('HoneyClient::Agent::Driver::Browser::IE', 'isFinished'); 
     151can_ok('HoneyClient::Agent::Driver::Browser::IE', 'status'); 
     152use HoneyClient::Agent::Driver::Browser::IE; 
    163153 
    164154# Make sure Storable loads. 
     
    241231our $DAEMON_PID     : shared = undef; 
    242232 
    243 # Global static value, to indicate if the Agent should perform 
     233# Global array, to indicate which implemented Drivers the 
     234# Agent is allowed to run. 
     235our $ALLOWED_DRIVERS = getVar(name => 'allowed_drivers')->{name}; 
     236 
     237# Global value, to indicate if the Agent should perform 
    244238# any integrity checks. 
    245239our $PERFORM_INTEGRITY_CHECKS : shared = 
     
    353347    } 
    354348 
     349    # Figure out what our list of allowed Drivers are.  
     350    $ALLOWED_DRIVERS = getVar(name => 'allowed_drivers')->{name}; 
     351 
    355352    # Acquire data lock. 
    356353    _lock(); 
     
    358355    # Initialize the $driverData shared hashtable. 
    359356    my $data = { }; 
    360     for my $driverName (@DRIVERS) { 
    361  
    362         # TODO: Figure out which drivers' data to initialize, based upon 
    363         # which driver argument hashtables were provided.  Then keep 
    364         # that list in a globally, defined array. 
    365          
     357    for my $driverName (@{$ALLOWED_DRIVERS}) { 
     358 
     359        eval "use $driverName"; 
     360        if ($@) { 
     361            $LOG->fatal($@); 
     362            Carp::croak $@; 
     363        } 
     364  
    366365        $data->{$driverName} = {  
    367366            'state'     => undef, 
     
    590589 
    591590    # Figure out the corresponding driver name. 
    592     my @package = split(/::/, ref($driver)); 
    593     my $driverName = pop(@package); 
     591    my $driverName = ref($driver); 
    594592 
    595593    # Extract the corresponding queue. 
     
    630628=pod 
    631629 
    632 =head1 EXPORT
    633  
    634 =head2 run(
     630=head1 EXTERNAL SOAP FUNCTION
     631 
     632=head2 run(driver_name => $driverName
    635633 
    636634=over 4 
    637635 
     636Runs the Agent for one cycle.  In this cycle, the following happens: 
     637 
     638=over 4 
     639 
     640=item 1) 
     641 
     642The specified Driver is driven for multiple work units, where each 
     643consecutive drive operation contacts the same network resources 
     644(aka. "targets").  The Driver ceases its operation, as soon as 
     645it has exhausted all targets or until it is ready to contact a 
     646different set of targets. 
     647 
     648=item 2) 
     649 
     650Once the specified driver has stopped, the Agent performs a corresponding 
     651Integrity check. 
     652 
     653=back  
     654 
    638655# XXX: Fill this in. 
    639656 
    640657I<Inputs>:  
    641  B<$arg> is an optional argument. 
    642 SOAP server to listen on
     658 B<$driverName> is the name of the Driver to use, when running this  
     659cycle
    643660  
    644 I<Output>: XXX: Fill this in. 
     661I<Output>: Returns true if the Agent successfully started a new cycle; 
     662returns false, if the Agent is still running an existing cycle and 
     663has not finished yet. 
     664 
     665I<Notes>: 
     666During a single run() cycle, it is expected that the driven application 
     667will only contact the same targets.  This allows the Manager to update 
     668firewall rules between cycles. 
    645669 
    646670=back 
    647671 
    648 =begin testing 
    649  
     672#=begin testing 
     673
    650674# XXX: Fill this in. 
    651 1; 
    652  
    653 =end testing 
     675
     676#=end testing 
    654677 
    655678=cut 
     
    657680sub run { 
    658681    # Extract arguments. 
     682    my ($class, %args) = @_; 
     683 
     684    # Log resolved arguments. 
     685    $LOG->debug(sub { 
     686        # Make Dumper format more terse. 
     687        $Data::Dumper::Terse = 1; 
     688        $Data::Dumper::Indent = 0; 
     689        Dumper(\%args); 
     690    }); 
     691 
     692    # Sanity check.  Make sure we get a valid argument. 
     693    my $argsExist = scalar(%args); 
     694    if (!$argsExist || 
     695        !exists($args{'driver_name'}) || 
     696        !defined($args{'driver_name'})) { 
     697 
     698        # Die if no valid argument is supplied. 
     699        $LOG->warn("No Driver name specified."); 
     700        die SOAP::Fault->faultcode(__PACKAGE__ . "->run()") 
     701                       ->faultstring("No Driver name specified."); 
     702    } 
     703 
     704    # Sanity check.  Make sure the driver name specified is 
     705    # on our allowed list. 
     706    my @drivers_found = grep(/^$args{'driver_name'}$/, @{$ALLOWED_DRIVERS}); 
     707    my $driverName = pop(@drivers_found); 
     708    unless (defined($driverName)) { 
     709        $LOG->warn("Not allowed to run Driver (" . $args{'driver_name'} . ")."); 
     710        die SOAP::Fault->faultcode(__PACKAGE__ . "->run()") 
     711                       ->faultstring("Not allowed to run Driver (" . $args{'driver_name'} . ")."); 
     712    } 
    659713 
    660714    # Temporary variable, used to hold thawed driver data. 
     
    667721    my $thread = undef; 
    668722 
    669     # TODO: Eventually, use the globally defined array 
    670     # of actual drivers used (set by init()). 
    671     for my $driverName (@DRIVERS) { 
     723    if (defined($driverName)) { 
    672724 
    673725        # Acquire data lock. 
     
    678730 
    679731# XXX: Delete this, eventually. 
    680 print "Checking TID = " . Dumper($tid) . "\n"; 
     732print $driverName . " - Checking TID = " . Dumper($tid) . "\n"; 
    681733if (defined(threads->object($tid))) { 
    682     print "Thread defined.\n"; 
     734    print $driverName . " - Thread defined.\n"; 
    683735    if (threads->object($tid)->is_running()) { 
    684         print "Thread is running.\n"; 
     736        print $driverName . " - Thread is running.\n"; 
    685737    } else { 
    686         print "Thread is NOT running.\n"; 
     738        print $driverName . " - Thread is NOT running.\n"; 
    687739    } 
    688740} else { 
    689     print "Thread NOT defined.\n"; 
     741    print $driverName . " - Thread NOT defined.\n"; 
    690742} 
    691743         
     
    702754        } else { 
    703755            # XXX: Remove this, eventually. 
    704             print "Creating a new run() child thread...\n"; 
     756            print $driverName . " - Creating a new run() child thread...\n"; 
    705757        } 
    706758 
     
    736788        if ($thread->is_running()) { 
    737789            # XXX: Debugging, remove eventually.  
    738             print "Thread ID = " . $thread->tid() . "\n"; 
     790            print $driverName . " - Thread ID = " . $thread->tid() . "\n"; 
    739791        } else { 
    740792            # XXX: Debugging, remove eventually.  
    741             print "Thread ID = " . $thread->tid() . " (NOT RUNNING)\n"; 
     793            print $driverName . " - Thread ID = " . $thread->tid() . " (NOT RUNNING)\n"; 
    742794        } 
    743795 
     
    747799 
    748800    # XXX: Debugging, remove eventually.  
    749     print "Run thread initialized.\n"; 
     801    print "Run thread(s) initialized.\n"; 
    750802 
    751803    # At this point, the driver thread is initialized and running, 
     
    801853        # Now, initialize each driver object.  
    802854        # Figure out which $driver object to use... 
    803         my $driverClass = 'HoneyClient::Agent::Driver::Browser::' . $driverName; 
     855        my $driverClass = $driverName; 
    804856 
    805857        if (!defined($data->{$driverName}->{'state'})) { 
     
    848900            # We assume $driver->next() returns defined data. 
    849901            foreach my $resource (keys %{$driver->next()->{resources}}) { 
    850                 $LOG->info("Driving To Resource: " . $resource); 
     902                $LOG->info($driverName . " - Driving To Resource: " . $resource); 
    851903                $lastResource = $resource; 
    852904            } 
     
    866918            # XXX: Delete this, eventually. 
    867919            if ($driverTargetsChanged) { 
    868                 $LOG->info("Driver targets have changed."); 
     920                $LOG->info($driverName . " - Driver targets have changed."); 
    869921                #$Data::Dumper::Terse = 0; 
    870922                #$Data::Dumper::Indent = 1; 
     
    884936        } 
    885937                 
    886         # TODO: Perform Integrity Check 
     938        # Perform Integrity Check 
     939        # XXX: We may want this logic moved out of the child thread, 
     940        # in case we ever have more than one worker thread simultaneously going. 
     941        # (We wouldn't want to have 2 worker threads simultaneously performing 
     942        # this check, as VM performance would slow to a crawl.) 
    887943        my $isCompromised = 0; 
    888944        my $changes = undef; 
     
    890946            # For now, we update a scalar called 'is_compromised' within 
    891947            # the $data->{$driverName}->{'status'} sub-hashtable. 
    892             $LOG->info("Performing Integrity Checks."); 
     948            $LOG->info($driverName . " - Performing Integrity Checks."); 
    893949            $changes = $integrity->check(); 
    894950            if (scalar(@{$changes->{registry}}) ||  
    895951                scalar(@{$changes->{filesystem}})) { 
    896                 $LOG->warn("Integrity Check: FAILED"); 
     952                $LOG->warn($driverName . " - Integrity Check: FAILED"); 
    897953                $isCompromised = 1; 
    898954                $changes->{'last_resource'} = $lastResource; 
    899955            } else { 
    900                 $LOG->info("Integrity Check: PASSED"); 
     956                $LOG->info($driverName . " - Integrity Check: PASSED"); 
    901957            } 
    902958        } 
     
    936992 
    937993        # TODO: Do proper fault queuing. 
    938         $LOG->error("FAULT: " . $@); 
     994        $LOG->error($driverName . " - FAULT: " . $@); 
    939995    } 
    940996 
    941997    # XXX: Debugging, remove eventually.  
    942     print "About to return out of child thread.\n"; 
     998    print $driverName . " - About to return out of child thread.\n"; 
    943999    if (!threads->is_detached()) { 
    9441000        threads->detach(); 
     
    9941050 
    9951051    # Figure out which driver to use. 
    996     for my $driverName (@DRIVERS) { 
     1052    for my $driverName (@{$ALLOWED_DRIVERS}) { 
    9971053   
    9981054        # If the corresponding key within the argument 
     
    10341090            # Initialize the driver object.  
    10351091            # Figure out which $driver object to use... 
    1036             my $driverClass = 'HoneyClient::Agent::Driver::Browser::' . $driverName; 
     1092            my $driverClass = $driverName; 
    10371093 
    10381094            if (!defined($data->{$driverName}->{'state'})) { 
  • honeyclient/branches/exp/mbriggs-db/lib/HoneyClient/Agent/Driver.pm

    r515 r802  
    3838=head1 VERSION 
    3939 
    40 This documentation refers to HoneyClient::Agent::Driver version 0.97
     40This documentation refers to HoneyClient::Agent::Driver version 0.99
    4141 
    4242=head1 SYNOPSIS 
     
    120120 
    121121    # Set our package version. 
    122     $VERSION = 0.97
     122    $VERSION = 0.99
    123123 
    124124    @ISA = qw(Exporter); 
    125125 
    126     # Symbols to export on request 
     126    # Symbols to export automatically  
    127127    # Note: Since this module is object-oriented, we do *NOT* export 
    128128    # any functions other than "new" to call statically.  Each function 
     
    147147    ); 
    148148 
    149     # Symbols to autoexport (:DEFAULT tag
     149    # Symbols to autoexport (when qw(:all) tag is used
    150150    @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 
    151151 
     
    273273=cut 
    274274 
    275 my %PARAMS = ( 
    276     timeout     => getVar(name => "timeout"), # Timeout (in seconds). 
    277 ); 
    278  
    279275####################################################################### 
    280276# Private Methods Implemented                                         # 
     
    310306 
    311307    # Sanity check: Make sure the supplied value is an object. 
    312     my $type = ref($self) or Carp::croak "Error: $self is not an object!\n"; 
     308    my $type = ref($self); 
     309    unless(defined($type)) { 
     310        $LOG->error("Error: $self is not an object!"); 
     311        Carp::croak "Error: $self is not an object!\n"; 
     312    } 
    313313 
    314314    # Now, get the name of the function. 
     
    387387    # 
    388388    # - For each parameter given, it overwrites any corresponding 
    389     #   parameters specified within the default hashtable, %PARAMS,  
     389    #   parameters specified within the default hashtable, %params,  
    390390    #   with custom entries that were given as parameters. 
    391391    # 
     
    407407    # Initialize default parameters. 
    408408    $self = { }; 
    409     my %params = %{dclone(\%PARAMS)}; 
     409    my %params = ( 
     410        timeout     => getVar(name => "timeout"), # Timeout (in seconds). 
     411    ); 
     412 
    410413    @{$self}{keys %params} = values %params; 
    411414 
  • honeyclient/branches/exp/mbriggs-db/lib/HoneyClient/Agent/Driver/Browser.pm

    r596 r802  
    4040=head1 VERSION 
    4141 
    42 This documentation refers to HoneyClient::Agent::Driver::Browser version 0.97
     42This documentation refers to HoneyClient::Agent::Driver::Browser version 0.99
    4343 
    4444=head1 SYNOPSIS 
     
    8787  $browser->drive(); 
    8888 
     89  # Or, we can specify the URL as an argument. 
     90  $browser->drive(url => "http://www.mitre.org"); 
     91 
    8992=head1 DESCRIPTION 
    9093 
    91 This library allows the Agent module to drive an instance of any broswer, 
     94This library allows the Agent module to drive an instance of any browser, 
    9295running inside the HoneyClient VM.  The purpose of this module is to 
    9396programmatically navigate the browser to different websites, in order to 
     
    9598 
    9699This module is object-oriented in design, retaining all state information 
    97 within itself for easy access.  A specific browser class must inherit from 
    98 Browser
    99