| 59 | | # Eventually, call the new() function on an implementation-specific |
|---|
| 60 | | # Driver package name. |
|---|
| 61 | | my $driver = HoneyClient::Agent::Driver->new(); |
|---|
| | 49 | # Create a new cloned VM, using the default |
|---|
| | 50 | # 'master_vm_config' listed in the global configuration |
|---|
| | 51 | # file (etc/honeyclient.xml). |
|---|
| | 52 | my $clone = HoneyClient::Manager::VM::Clone->new(); |
|---|
| | 53 | |
|---|
| | 54 | # When the new() operation completes, you are guaranteed that the |
|---|
| | 55 | # cloned VM is powered on, has an IP address, and has a HoneyClient::Agent daemon |
|---|
| | 56 | # ready for use. |
|---|
| | 57 | |
|---|
| | 58 | # Let's get the path to the newly created clone's configuration file. |
|---|
| | 59 | my $config = $clone->{'config'}; |
|---|
| | 60 | |
|---|
| | 61 | # Figure out which master VM this clone is based on. |
|---|
| | 62 | my $master_vm_config = $clone->{'master_vm_config'}; |
|---|
| | 63 | |
|---|
| | 64 | # Get the MAC address of the cloned VM's primary network interface. |
|---|
| | 65 | my $mac_address = $clone->{'mac_address'}; |
|---|
| | 66 | |
|---|
| | 67 | # Get the IP address of the cloned VM's primary network interface. |
|---|
| | 68 | my $ip_address = $clone->{'ip_address'}; |
|---|
| | 69 | |
|---|
| | 70 | # Get the name of the cloned VM (as it appears in the VMware Console). |
|---|
| | 71 | my $name = $clone->{'name'}; |
|---|
| | 72 | |
|---|
| | 73 | # If you want the cloned VM to be suspended and no longer used, |
|---|
| | 74 | # simply set the variable to 'undef'. |
|---|
| | 75 | $clone = undef; |
|---|
| | 76 | |
|---|
| | 77 | # For existing cloned VMs that have been powered off or suspended, |
|---|
| | 78 | # you can create a Clone object to interact with those as well. |
|---|
| | 79 | $clone = HoneyClient::Manager::VM::Clone->new(config => '/vm/clones/other/winXPPro.cfg'); |
|---|
| 64 | | # inside $driver, try this command at any time. |
|---|
| 65 | | print Dumper($driver); |
|---|
| 66 | | |
|---|
| 67 | | # Continue to "drive" the driver, until it is finished. |
|---|
| 68 | | while (!$driver->isFinished()) { |
|---|
| 69 | | |
|---|
| 70 | | # Before we drive the application to a new set of resources, |
|---|
| 71 | | # find out where we will be going within the application, first. |
|---|
| 72 | | print "About to contact the following resources:\n"; |
|---|
| 73 | | print Dumper($driver->next()); |
|---|
| 74 | | |
|---|
| 75 | | # Now, drive the application. |
|---|
| 76 | | $driver->drive(); |
|---|
| 77 | | |
|---|
| 78 | | # Get status of current iteration of work. |
|---|
| 79 | | print "Status:\n"; |
|---|
| 80 | | print Dumper($driver->status()); |
|---|
| 81 | | |
|---|
| 82 | | } |
|---|
| | 82 | # inside $clone, try this command at any time. |
|---|
| | 83 | print Dumper($clone); |
|---|
| 86 | | # XXX: FIX THIS |
|---|
| 87 | | |
|---|
| 88 | | This library allows the Agent module to access any drivers running on the |
|---|
| 89 | | HoneyClient VM in a consistent fashion. This module is object-oriented in |
|---|
| 90 | | design, allowing specific types of drivers to inherit these abstractly |
|---|
| 91 | | defined interface methods. |
|---|
| 92 | | |
|---|
| 93 | | Fundamentally, a "Driver" is a programmatic construct, designed to |
|---|
| 94 | | automate a back-end application that is intended to be exploited by |
|---|
| 95 | | different types of malware. As such, the "Agent" interacts with each |
|---|
| 96 | | B<application-specific> Driver running inside the HoneyClient VM, in |
|---|
| 97 | | order to programmatically automate the corresponding applications. |
|---|
| 98 | | |
|---|
| 99 | | When a "Driver" is "driven", this implies that the back-end application |
|---|
| 100 | | is accessing a B<new> Internet resource, in order to intentionally be exposed |
|---|
| 101 | | to new malware and thus become exploited. |
|---|
| 102 | | |
|---|
| 103 | | Example implementation Drivers involve automating certain types and |
|---|
| 104 | | B<versions> of web browsers (e.g., Microsoft Internet Explorer, Mozilla |
|---|
| 105 | | Firefox) or even email applications (e.g., Microsoft Outlook, Mozilla |
|---|
| 106 | | Thunderbird). |
|---|
| | 87 | This library provides the Manager module with an object-oriented interface |
|---|
| | 88 | towards interacting with cloned virtual machines. It allows the Manager |
|---|
| | 89 | to quickly create new cloned VMs in a consistent manner, without requiring |
|---|
| | 90 | the Manager to deal with all the nuances in cloning VMs. |
|---|
| | 91 | |
|---|
| | 92 | When a new "Clone" object is created, the following normally occurs: |
|---|
| | 93 | |
|---|
| | 94 | =over 4 |
|---|
| | 95 | |
|---|
| | 96 | =item 1) |
|---|
| | 97 | |
|---|
| | 98 | A new VM is created, based upon cloning a given master VM. |
|---|
| | 99 | |
|---|
| | 100 | =item 2) |
|---|
| | 101 | |
|---|
| | 102 | The cloned VM is powered on and the name of the VM is recorded. |
|---|
| | 103 | |
|---|
| | 104 | =item 3) |
|---|
| | 105 | |
|---|
| | 106 | The MAC and IP address of the cloned VM's primary network interface |
|---|
| | 107 | are recorded. |
|---|
| | 108 | |
|---|
| | 109 | =item 4) |
|---|
| | 110 | |
|---|
| | 111 | The HoneyClient::Agent daemon running inside the cloned VM is verified |
|---|
| | 112 | and ready for use. |
|---|
| | 113 | |
|---|
| | 114 | =back |
|---|
| | 115 | |
|---|
| | 116 | Note: If an existing cloned VM's configuration file is specified in |
|---|
| | 117 | the new() call, then the "Clone" object will reuse this VM (by not |
|---|
| | 118 | creating any duplicate VMs) and proceed to power up this VM, along |
|---|
| | 119 | with going through the same verification procedures. |
|---|
| 814 | | This package has been designed in an object-oriented fashion, as a |
|---|
| 815 | | simple B<INTERFACE> for other, more robust fully-implemented |
|---|
| 816 | | HoneyClient::Agent::Driver::* sub-packages to inherit. |
|---|
| 817 | | |
|---|
| 818 | | Specifically, B<ONLY> the new() function is implemented in this package. |
|---|
| 819 | | While this allows any user to create Driver B<$object>s by explicitly |
|---|
| 820 | | calling the HoneyClient::Agent::Driver->new() function, any subsequent |
|---|
| 821 | | calls to any other method (i.e., $object->drive()) will B<FAIL>, as it is |
|---|
| 822 | | expected that fully defined Driver sub-packages would implement these |
|---|
| 823 | | capabilities. |
|---|
| 824 | | |
|---|
| 825 | | In a nutshell, this object is nothing more than a blessed anonymous |
|---|
| | 827 | Currently, the new() function assumes that the master VM supplied |
|---|
| | 828 | has been setup and configured according to the specification listed |
|---|
| | 829 | here: |
|---|
| | 830 | |
|---|
| | 831 | L<http://www.honeyclient.org/trac/wiki/UserGuide#HoneyclientVM> |
|---|
| | 832 | |
|---|
| | 833 | Thus, upon cloning, if a cloned VM is unable to properly boot into |
|---|
| | 834 | Windows and load the HoneyClient::Agent daemon properly, then the |
|---|
| | 835 | new() call will B<hang indefinately>. |
|---|
| | 836 | |
|---|
| | 837 | In a nutshell, this object is basically a blessed anonymous |
|---|