| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
BEGIN { |
|---|
| 31 |
our $VERSION = 1.02; |
|---|
| 32 |
} |
|---|
| 33 |
our ($VERSION); |
|---|
| 34 |
|
|---|
| 35 |
=pod |
|---|
| 36 |
|
|---|
| 37 |
=head1 NAME |
|---|
| 38 |
|
|---|
| 39 |
StartManager.pl - Perl script to start the Manager on the |
|---|
| 40 |
host system. |
|---|
| 41 |
|
|---|
| 42 |
=head1 SYNOPSIS |
|---|
| 43 |
|
|---|
| 44 |
StartManager.pl [options] [http://www.google.com http://www.cnn.com ...] |
|---|
| 45 |
|
|---|
| 46 |
Options: |
|---|
| 47 |
--help This help message. |
|---|
| 48 |
--man Print full man page. |
|---|
| 49 |
--driver_name= Name of driver to use. |
|---|
| 50 |
--master_vm_config= Absolute path to the master VM configuration to use. |
|---|
| 51 |
--url_list= File containing newline separated URLs to use. |
|---|
| 52 |
|
|---|
| 53 |
=head1 OPTIONS |
|---|
| 54 |
|
|---|
| 55 |
=over 4 |
|---|
| 56 |
|
|---|
| 57 |
=item B<--help> |
|---|
| 58 |
|
|---|
| 59 |
Print a brief help message and exits. |
|---|
| 60 |
|
|---|
| 61 |
=item B<--driver_name=> |
|---|
| 62 |
|
|---|
| 63 |
Specifies the driver name to use. If none is specified, the |
|---|
| 64 |
default will be used. |
|---|
| 65 |
|
|---|
| 66 |
=item B<--master_vm_config=> |
|---|
| 67 |
|
|---|
| 68 |
Specifies the master VM configuration file to use. If none |
|---|
| 69 |
is specified, the default will be used. |
|---|
| 70 |
|
|---|
| 71 |
=item B<--url_list=> |
|---|
| 72 |
|
|---|
| 73 |
If specified, the newline separated URLs inside this file will |
|---|
| 74 |
be parsed and fed into the Manager upon startup. |
|---|
| 75 |
|
|---|
| 76 |
=back |
|---|
| 77 |
|
|---|
| 78 |
=head1 DESCRIPTION |
|---|
| 79 |
|
|---|
| 80 |
This program starts the Manager on the host system. If URLs |
|---|
| 81 |
are specified on the command-line, the program will |
|---|
| 82 |
assign a base priority to each URL and feed them into the Manager |
|---|
| 83 |
for additional processing. |
|---|
| 84 |
|
|---|
| 85 |
This program will run until manually terminated by the user, by |
|---|
| 86 |
pressing CTRL-C. |
|---|
| 87 |
|
|---|
| 88 |
=head1 SEE ALSO |
|---|
| 89 |
|
|---|
| 90 |
L<http://www.honeyclient.org/trac> |
|---|
| 91 |
|
|---|
| 92 |
=head1 REPORTING BUGS |
|---|
| 93 |
|
|---|
| 94 |
L<http://www.honeyclient.org/trac/newticket> |
|---|
| 95 |
|
|---|
| 96 |
=head1 AUTHORS |
|---|
| 97 |
|
|---|
| 98 |
Darien Kindlund, E<lt>kindlund@mitre.orgE<gt> |
|---|
| 99 |
|
|---|
| 100 |
Kathy Wang, E<lt>knwang@mitre.orgE<gt> |
|---|
| 101 |
|
|---|
| 102 |
=head1 COPYRIGHT & LICENSE |
|---|
| 103 |
|
|---|
| 104 |
Copyright (C) 2007-2008 The MITRE Corporation. All rights reserved. |
|---|
| 105 |
|
|---|
| 106 |
This program is free software; you can redistribute it and/or |
|---|
| 107 |
modify it under the terms of the GNU General Public License |
|---|
| 108 |
as published by the Free Software Foundation, using version 2 |
|---|
| 109 |
of the License. |
|---|
| 110 |
|
|---|
| 111 |
This program is distributed in the hope that it will be useful, |
|---|
| 112 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 113 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 114 |
GNU General Public License for more details. |
|---|
| 115 |
|
|---|
| 116 |
You should have received a copy of the GNU General Public License |
|---|
| 117 |
along with this program; if not, write to the Free Software |
|---|
| 118 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|---|
| 119 |
02110-1301, USA. |
|---|
| 120 |
|
|---|
| 121 |
=cut |
|---|
| 122 |
|
|---|
| 123 |
use strict; |
|---|
| 124 |
use warnings; |
|---|
| 125 |
use Carp (); |
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
use Pod::Usage; |
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
use Data::Dumper; |
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
use Storable qw(nfreeze thaw); |
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
use MIME::Base64 qw(encode_base64 decode_base64); |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
use Getopt::Long qw(:config auto_help ignore_case_always); |
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
use HoneyClient::Util::Config qw(getVar); |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
use Log::Log4perl qw(:easy); |
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
our $LOG = get_logger(); |
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
my $driver_name = undef; |
|---|
| 157 |
my $master_vm_config = undef; |
|---|
| 158 |
my $url_list= ""; |
|---|
| 159 |
|
|---|
| 160 |
GetOptions('driver_name=s' => \$driver_name, |
|---|
| 161 |
'master_vm_config=s' => \$master_vm_config, |
|---|
| 162 |
'url_list=s' => \$url_list, |
|---|
| 163 |
'man' => sub { pod2usage(-exitstatus => 0, -verbose => 2) }, |
|---|
| 164 |
'version' => sub { |
|---|
| 165 |
print "MITRE HoneyClient Project (http://www.honeyclient.org)\n" . |
|---|
| 166 |
"------------------------------------------------------\n" . |
|---|
| 167 |
$0 . " (v" . $VERSION . ")\n"; |
|---|
| 168 |
exit(0); |
|---|
| 169 |
}) or pod2usage(2); |
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
my @urls; |
|---|
| 175 |
push( @urls, @ARGV ); |
|---|
| 176 |
if( -e $url_list ){ |
|---|
| 177 |
open URL, $url_list; |
|---|
| 178 |
push(@urls, <URL>); |
|---|
| 179 |
} |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
my $priority = getVar(name => "command_line_base_priority", |
|---|
| 183 |
namespace => "HoneyClient::Manager"); |
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
my $work = {}; |
|---|
| 187 |
foreach(@urls){ |
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
chomp; |
|---|
| 192 |
if ($_ ne "") { |
|---|
| 193 |
$work->{$_} = $priority; |
|---|
| 194 |
} |
|---|
| 195 |
} |
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
require HoneyClient::Manager; |
|---|
| 199 |
HoneyClient::Manager->run( |
|---|
| 200 |
driver_name => $driver_name, |
|---|
| 201 |
master_vm_config => $master_vm_config, |
|---|
| 202 |
work => $work, |
|---|
| 203 |
); |
|---|