Skip to content
Snippets Groups Projects
Commit fe031bf1 authored by jdh8d's avatar jdh8d
Browse files

No commit message

No commit message
parents
No related branches found
No related tags found
No related merge requests found
* text=auto !eol
/SMP-analyze.sh -text
/collectIPSresults.sh -text
/findso.pl -text
#!/bin/bash
if [ -z "$IDA_PRO_SERVER_HOST" ]; then echo Failed to set IDA_PRO_SERVER_HOST; exit 2; fi
if [ -z "$IDA_PRO_SERVER_USER" ]; then
IDA_PRO_SERVER_USER=`whoami`
fi
if [ -z "$IDA_PRO_SERVER_PORT" ]; then
IDA_PRO_SERVER_PORT=22
fi
directory=/tmp/`hostname`
# Create unique directory on server
ssh -p $IDA_PRO_SERVER_PORT $IDA_PRO_SERVER_USER@$IDA_PRO_SERVER_HOST mkdir $directory
echo "--DEBUG---------"
pwd
echo "---"
$SMPSA_HOME/findso.pl $@
echo "---"
echo $LD_LIBRARY_PATH
echo "---"
ldd $@
echo "--END DEBUG---------"
# Copy my files to it
# The perl script will also include names of dependent shared object (.so) file
# Start timing stuff
copyStartTime=`date +%s`
scp -P $IDA_PRO_SERVER_PORT -q $@ `$SMPSA_HOME/findso.pl $@` $IDA_PRO_SERVER_USER@$IDA_PRO_SERVER_HOST:$directory
if [ -n "$SMPSA_PLUGIN" ]; then
scp -P $IDA_PRO_SERVER_PORT -q ${SMPSA_PLUGIN}* $IDA_PRO_SERVER_USER@$IDA_PRO_SERVER_HOST:$directory
fi
copyStopTime=`date +%s`
# Check to see if the Ida Pro Server is too busy now and wait if necc.
if [ -n "$MAX_IDA_PROCESSES" ]; then
while [ `ssh -p $IDA_PRO_SERVER_PORT $IDA_PRO_SERVER_USER@$IDA_PRO_SERVER_HOST pgrep idal|wc -l` -ge "$MAX_IDA_PROCESSES" ]; do
random=`od -An -N2 -tu2 /dev/urandom`
# Wait 10-30 seconds
seconds=`expr $random % 20 + 10`
echo Waiting $seconds seconds for an IDA process to exit...
sleep $seconds
done
fi
# waitStartTime = copyStopTime
waitStopTime=`date +%s`
# Run ida pro on server
# \time tells the shell to use /usr/bin/time instead of the buil-in time command
# /usr/bin/time reports the time on stderr. The commands below set executeTime to the time reported by /usr/bin/time
if [ -z "$SMPSA_PLUGIN" ]; then
ssh -p $IDA_PRO_SERVER_PORT $IDA_PRO_SERVER_USER@$IDA_PRO_SERVER_HOST "cd peasoup; source set_env_vars; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.; cd $directory; screen -D -L -ln -m -a -T xterm sh -x "'$SMPSA_HOME'"/SMP-analyze.sh $@" 2>&1
else
ssh -p $IDA_PRO_SERVER_PORT $IDA_PRO_SERVER_USER@$IDA_PRO_SERVER_HOST "cd peasoup; source set_env_vars; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.; export SMPSA_PLUGIN=$directory/SMPStaticAnalyzer.plx; cd $directory; screen -D -L -ln -m -a -T xterm sh -x "'$SMPSA_HOME'"/SMP-analyze.sh $@; rm -f $directory/SMPStaticAnalyzer.plx" 2>&1
fi
copyAnswerStartTime=`date +%s`
# Copy the answer back
scp -P $IDA_PRO_SERVER_PORT $IDA_PRO_SERVER_USER@$IDA_PRO_SERVER_HOST:$directory/$@.* .
copyAnswerStopTime=`date +%s`
# Calculate times
#copyTime=$(expr $copyStopTime - $copyStartTime)
#waitTime=$(expr $waitStopTime - $copyStopTime)
#copyAnswerTime=$(expr $copyAnswerStopTime - $copyAnswerStartTime)
# write to file
#echo "Copy Time, Wait Time, Execute Time, Copy Answer Time" >> /tmp/x.x
#echo "`hostname`,$copyTime,$waitTime,$executeTime,$copyAnswerTime" >> /tmp/`hostname`-results.txt
# Cleanup
#ssh -p $IDA_PRO_SERVER_PORT $IDA_PRO_SERVER_USER@$IDA_PRO_SERVER_HOST rm -rf $directory
#!/bin/sh
hosts="U64-01 U64-02 U64-03 U64-04 U64-05 U64-06 U64-07 U64-08 U64-09 U64-10 U64-11 U64-12 U64-13 U64-14 U64-15 U64-16 U64-17 U64-18 U64-19 U64-20"
remoteUser="ps1"
for host in $hosts; do
scp $remoteUser@$host:/tmp/$host-results.txt .
done;
echo "Hostname, Copy Time, Wait Time, Execute Time, Copy Answer Time" >>IdaPro-timings.txt
cat *-results.txt >>IdaPro-timings.txt
rm *-results.txt
#!/usr/bin/perl
#
# This script finds all non-system shared objects that are used
# my an executable. For example
# % ldd test
# linux-gate.so.1 => (0x0092d000)
# mylib.so => ./mylib.so (0x00e6b000)
# libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x0074a000)
# /lib/ld-linux.so.2 (0x0059d000)
# The only non-system so needed is ./mylib.so
use strict;
my $exec = shift @ARGV;
if ($exec eq "")
{
print "Usage: findso.pl <execname>\n";
exit(1);
}
open PIPE, "ldd $exec |";
while (my $line = <PIPE>)
{
chop $line;
$line =~ s/\(.*$//; # remove hex address
$line =~ s/ //g; # remove whitespace
my ($sym, $file) = split "=>", $line;
# print if non-empty and (doesn't start with "/" or has peasoup or workspace in name)
if ($file ne "" && $file !~ /notfound/ && (substr($file,0,1) ne "/" || $file =~ /peasoup/ || $file =~ /stonesoup/))
{
printf "$file\n";
}
}
close PIPE;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment