Changeset 612

Show
Ignore:
Timestamp:
07/11/07 06:24:32 (1 year ago)
Author:
jpuchalski
Message:

Resolved some kind of conflict that crept up.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/jpuchalski-active_content/lib/HoneyClient/Agent/Driver/ActiveContent.pm

    r250 r612  
    1414# @author jpuchalski 
    1515# 
    16 # Copyright (C) 2006 The MITRE Corporation.  All rights reserved. 
     16# Copyright (C) 2007 The MITRE Corporation.  All rights reserved. 
    1717# 
    1818# This program is free software; you can redistribute it and/or 
     
    3838=head1 NAME 
    3939 
    40 HoneyClient::Agent::Driver::ActiveContent - Perl extension to extract 
    41 URLs from various forms of active content. 
     40HoneyClient::Agent::Driver::ActiveContent - Perl module that extracts 
     41information from various forms of active content, such as SWF Flash 
     42movies.  Currently the information returned is a list of URLs that 
     43were embedded in the active content. 
    4244 
    4345=head1 VERSION 
     
    4749 
    4850=head1 SYNOPSIS 
     51 
     52  use HoneyClient::Agent::Driver::ActiveContent; 
     53 
     54 
    4955 
    5056=head1 DESCRIPTION 
     
    8591####################################################################### 
    8692 
    87 use URI::URL; 
    88 use File::Temp; 
     93use Log::Log4perl qw(:easy); 
     94 
     95# Include the Flash content processing module 
     96use HoneyClient::Agent::Driver::ActiveContent::Flash qw(extract); 
     97 
     98our $LOG = get_logger(); 
     99 
    89100 
    90101####################################################################### 
     
    92103####################################################################### 
    93104 
     105=pod 
     106 
     107=head1 PRIVATE METHODS 
     108 
     109None. 
     110 
     111=cut 
    94112 
    95113####################################################################### 
    96114# Public Methods Implemented                                          # 
    97115####################################################################### 
     116 
     117=pod 
     118 
     119=head1 PUBLIC METHODS 
     120 
     121=head2 HoneyClient::Agent::Driver::ActiveContent->isActiveContent() 
     122 
     123=over 4 
     124 
     125Checks to see if a particular input file contains a type of active content 
     126that we are interested in processing. 
     127 
     128=back 
     129 
     130=begin testing 
     131 
     132# Do testing here 
     133 
     134=end testing 
     135 
     136=cut 
    98137 
    99138sub isActiveContent { 
    100139  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$/); 
    114154} 
     155 
     156=pod 
     157 
     158=head2 HoneyClient::Agent::Driver::ActiveContent->process() 
     159 
     160=over 4 
     161 
     162Processes the given input file by calling the appropriate extraction 
     163handler. 
     164 
     165=back 
     166 
     167=begin testing 
     168 
     169# Do testing here 
     170 
     171=end testing 
     172 
     173=cut 
    115174 
    116175sub process { 
    117176  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 
    126191  if ($args{'file'}->filename =~ /\.swf$/) { 
    127192    return HoneyClient::Agent::Driver::ActiveContent::Flash::extract(%args); 
     
    132197 
    1331981; 
     199 
     200=pod 
     201 
     202=head1 AUTHORS 
     203 
     204Jeff Puchalski, E<lt>jpuchalski@mitre.orgE<gt> 
     205 
     206=head1 COPYRIGHT & LICENSE 
     207 
     208Copyright (C) 2007 The MITRE Corporation.  All rights reserved. 
     209 
     210This program is free software; you can redistribute it and/or 
     211modify it under the terms of the GNU General Public License 
     212as published by the Free Software Foundation, using version 2 
     213of the License. 
     214  
     215This program is distributed in the hope that it will be useful, 
     216but WITHOUT ANY WARRANTY; without even the implied warranty of 
     217MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     218GNU General Public License for more details. 
     219  
     220You should have received a copy of the GNU General Public License 
     221along with this program; if not, write to the Free Software 
     222Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
     22302110-1301, USA. 
     224 
     225=cut