Changeset 612
- Timestamp:
- 07/11/07 06:24:32 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/branches/exp/jpuchalski-active_content/lib/HoneyClient/Agent/Driver/ActiveContent.pm
r250 r612 14 14 # @author jpuchalski 15 15 # 16 # Copyright (C) 200 6The MITRE Corporation. All rights reserved.16 # Copyright (C) 2007 The MITRE Corporation. All rights reserved. 17 17 # 18 18 # This program is free software; you can redistribute it and/or … … 38 38 =head1 NAME 39 39 40 HoneyClient::Agent::Driver::ActiveContent - Perl extension to extract 41 URLs from various forms of active content. 40 HoneyClient::Agent::Driver::ActiveContent - Perl module that extracts 41 information from various forms of active content, such as SWF Flash 42 movies. Currently the information returned is a list of URLs that 43 were embedded in the active content. 42 44 43 45 =head1 VERSION … … 47 49 48 50 =head1 SYNOPSIS 51 52 use HoneyClient::Agent::Driver::ActiveContent; 53 54 49 55 50 56 =head1 DESCRIPTION … … 85 91 ####################################################################### 86 92 87 use URI::URL; 88 use File::Temp; 93 use Log::Log4perl qw(:easy); 94 95 # Include the Flash content processing module 96 use HoneyClient::Agent::Driver::ActiveContent::Flash qw(extract); 97 98 our $LOG = get_logger(); 99 89 100 90 101 ####################################################################### … … 92 103 ####################################################################### 93 104 105 =pod 106 107 =head1 PRIVATE METHODS 108 109 None. 110 111 =cut 94 112 95 113 ####################################################################### 96 114 # Public Methods Implemented # 97 115 ####################################################################### 116 117 =pod 118 119 =head1 PUBLIC METHODS 120 121 =head2 HoneyClient::Agent::Driver::ActiveContent->isActiveContent() 122 123 =over 4 124 125 Checks to see if a particular input file contains a type of active content 126 that we are interested in processing. 127 128 =back 129 130 =begin testing 131 132 # Do testing here 133 134 =end testing 135 136 =cut 98 137 99 138 sub isActiveContent { 100 139 my %args = @_; 101 my $argsExist = scalar(%args); 102 103 # Sanity check: make sure an input file is defined 104 unless ($argsExist && exists($args{'file'}) && defined($args{'file'})) { 105 Carp::croak "Error: No input file provided!\n"; 106 } 107 108 # Sanity check: make sure the input is a known resource type 109 if ($args{'file'}->filename =~ /\.swf$/) { 110 return true; 111 } else { 112 return false; 113 } 140 141 # Make sure an input file is defined 142 unless (defined($args{'file'})) { 143 $LOG->fatal("No input file provided!"); 144 Carp::croak "Error: No input file provided!"; 145 } 146 147 # Make sure a base URL is defined 148 unless (defined($args{'base_url'})) { 149 $LOG->fatal("No base URL provided!"); 150 Carp::croak "Error: No base URL provided!"; 151 } 152 153 return ($args{'file'}->filename =~ /\.swf$/); 114 154 } 155 156 =pod 157 158 =head2 HoneyClient::Agent::Driver::ActiveContent->process() 159 160 =over 4 161 162 Processes the given input file by calling the appropriate extraction 163 handler. 164 165 =back 166 167 =begin testing 168 169 # Do testing here 170 171 =end testing 172 173 =cut 115 174 116 175 sub process { 117 176 my %args = @_; 118 my $argsExist = scalar(%args); 119 120 # Sanity check: make sure an input file is defined 121 unless ($argsExist && exists($args{'file'}) && defined($args{'file'})) { 122 Carp::croak "Error: No input file provided!\n"; 123 } 124 125 # Sanity check: make sure the input is a known resource type 177 178 # Make sure an input file is defined 179 unless (defined($args{'file'})) { 180 $LOG->fatal("No input file provided!"); 181 Carp::croak "Error: No input file provided!"; 182 } 183 184 # Make sure a base URL is defined 185 unless (defined($args{'base_url'})) { 186 $LOG->fatal("No base URL provided!"); 187 Carp::croak "Error: No base URL provided!"; 188 } 189 190 # Pass the file to the appropriate content type module 126 191 if ($args{'file'}->filename =~ /\.swf$/) { 127 192 return HoneyClient::Agent::Driver::ActiveContent::Flash::extract(%args); … … 132 197 133 198 1; 199 200 =pod 201 202 =head1 AUTHORS 203 204 Jeff Puchalski, E<lt>jpuchalski@mitre.orgE<gt> 205 206 =head1 COPYRIGHT & LICENSE 207 208 Copyright (C) 2007 The MITRE Corporation. All rights reserved. 209 210 This program is free software; you can redistribute it and/or 211 modify it under the terms of the GNU General Public License 212 as published by the Free Software Foundation, using version 2 213 of the License. 214 215 This program is distributed in the hope that it will be useful, 216 but WITHOUT ANY WARRANTY; without even the implied warranty of 217 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 218 GNU General Public License for more details. 219 220 You should have received a copy of the GNU General Public License 221 along with this program; if not, write to the Free Software 222 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 223 02110-1301, USA. 224 225 =cut
