# # $Date: 2005/03/16 00:03:40 $ # # Sort files based on their application type (content) # # Brian Carrier [carrier@sleuthkit.org] # Copyright (c) 2001-2005 by Brian Carrier. All rights reserved # # This file is part of the Autopsy Forensic Browser (Autopsy) # # Autopsy is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Autopsy is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Autopsy; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR ANY PARTICULAR PURPOSE. # IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, OR PROFITS OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package Appsort; $Appsort::FRAME = 1; $Appsort::MENU = 2; $Appsort::ENTER = 3; $Appsort::RUN = 4; $Appsort::VIEW = 5; $Appsort::BLANK = 6; sub main { if ($::LIVE == 1) { Print::print_html_header("Unsupported for Live Analysis"); print "
Sort Files by Type"; print "
View Sorted Files"; Print::print_html_footer(); return 0; } # Get the data and print the form so that sorter can be run sub enter { Print::print_html_header("sorter - enter data to create"); print "
"
. "\n";
return;
}
# If both actions are wanted then no flags are needed
$sort_args .= "-e " if (($ext == 1) && ($cat == 0));
$sort_args .= "-i " if (($ext == 0) && ($cat == 1));
my $sort_dir = get_sorter_dir();
if ($cat == 1) {
if ( (exists $Args::args{'sorter_img'})
&& ($Args::args{'sorter_img'} == 1))
{
my $config = "$::TSKDIR/../share/sorter/images.sort";
Print::print_err("images configuration file not found ($config)")
unless (-e "$config");
$sort_args .= "-C \'$config\' -s -U ";
$sort_dir = get_sorter_graphics_dir();
}
else {
$sort_args .= "-s "
if ( (exists $Args::args{'sorter_save'})
&& ($Args::args{'sorter_save'} == 1));
$sort_args .= "-U "
if ( (exists $Args::args{'sorter_unk'})
&& ($Args::args{'sorter_unk'} == 1));
}
}
if ($::NSRLDB ne "") {
# @@@ Removed until the known bad can be identified in NSRL
# $sort_args .= "-n \'$::NSRLDB\' "
# if ((exists $Args::args{'sorter_nsrl'}) && ($Args::args{'sorter_nsrl'} == 1));
}
if ($Caseman::alert_db ne "") {
$sort_args .= "-a \'$Caseman::alert_db\' "
if ( (exists $Args::args{'sorter_alert'})
&& ($Args::args{'sorter_alert'} == 1));
}
if ($Caseman::exclude_db ne "") {
$sort_args .= "-x \'$Caseman::exclude_db\' "
if ( (exists $Args::args{'sorter_exclude'})
&& ($Args::args{'sorter_exclude'} == 1));
}
unless (-d "$sort_dir") {
unless (mkdir "$sort_dir", $::MKDIR_MASK) {
Print::print_err("Error making $sort_dir");
}
}
if (-e "$sort_dir/index.html") {
unlink("$sort_dir/index.html");
}
my $exec =
"-h -m '$mnt' -d '$sort_dir' -o $offset -i $imgtype -f $ftype $sort_args $img";
# print "Executing: sorter $exec
\n";
# Execute Sorter
my $hit_cnt = 0;
$SIG{ALRM} = sub {
if (($hit_cnt++ % 5) == 0) {
print "+";
}
else {
print "-";
}
alarm(5);
};
alarm(5);
local *OUT;
Exec::exec_pipe(*OUT, "LANG=C LC_ALL=C '$::TSKDIR/sorter' $exec");
alarm(0);
$SIG{ALRM} = 'DEFAULT';
while ($_ = Exec::read_pipe_line(*OUT)) {
print "$_
\n";
$hit_cnt = 0;
}
close(OUT);
if (-e "$sort_dir/index.html") {
print "
Output can be found by viewing:
"
. " $sort_dir/index.html
\n"; # Print the index.html file from the output print "
\n"; print "" . get_sorter_dir() . "index.html"; Print::print_html_footer(); return 0; } # Blank Page sub blank { Print::print_html_header(""); print "
This allows you to find a file based on" . "its type and find \"hidden\" files.
\n"
.
"WARNING: This can be a time intensive process.
\n";
Print::print_html_footer();
return 0;
}