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

First working version of IRDB code integrated.

parent 6262a1b9
Branches
Tags cfar-phase3-final
No related merge requests found
...@@ -63,7 +63,7 @@ clean: ...@@ -63,7 +63,7 @@ clean:
rm -Rf peasoup_executable_directory.* rm -Rf peasoup_executable_directory.*
rm -f strata.log.* rm -f strata.log.*
rm -f *.sym rm -f *.sym
# if [ ! "X" = "X"${PGUSER} ]; then sh ../tools/db/drop_my_tables.sh; sh ../tools/db/pdb_setup.sh; fi if [ ! "X" = "X"${PGUSER} ]; then sh ../tools/db/drop_my_tables.sh; sh ../tools/db/pdb_setup.sh; fi
concclean: concclean:
rm -Rf concolic.files_* rm -Rf concolic.files_*
......
#!/bin/bash #!/bin/bash
psql << 'EOF'
CREATE LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION drop_tables(username IN VARCHAR) RETURNS void AS $$
DECLARE
statements CURSOR FOR
SELECT tablename FROM pg_tables
WHERE tableowner = username;
BEGIN
FOR stmt IN statements LOOP
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(stmt.tablename) || ' CASCADE;';
END LOOP;
END;
$$
LANGUAGE plpgsql;
EOF
psql -c "SELECT drop_tables('$PGUSER');" functables=`psql -t -q -c "select function_table_name from variant_info"`
insntables=`psql -t -q -c "select instruction_table_name from variant_info"`
addrtables=`psql -t -q -c "select address_table_name from variant_info"`
othertables="variant_dependency variant_info file_info doip"
for i in $insntables $addrtables $functables $othertables
do
echo --------------------------------------------------------------------------
echo -n Dropping table $i..." "
psql -t -q -c "drop table $i cascade;"
echo Done.
echo --------------------------------------------------------------------------
done
...@@ -71,6 +71,16 @@ echo Running IDA Pro static analysis phase ... ...@@ -71,6 +71,16 @@ echo Running IDA Pro static analysis phase ...
$SMPSA_HOME/SMP-analyze.sh a.ncexe $SMPSA_HOME/SMP-analyze.sh a.ncexe
echo Done. echo Done.
#
# Run concolic engine
#
echo Running concolic testing to generate inputs ...
#$PEASOUP_HOME/tools/do_concolic.sh a --iterations 25 --logging tracer,instance_times,trace
$PEASOUP_HOME/tools/do_concolic.sh a --iterations 25 --logging tracer,trace,inputs
# 2>&1 |egrep -e "INPUT VECTOR:" -e "1: argc ="
# >/dev/null 2>&1
echo Done.
# #
# Populate IR Database # Populate IR Database
...@@ -99,7 +109,8 @@ if [ ! "X" = "X"$PGUSER ]; then ...@@ -99,7 +109,8 @@ if [ ! "X" = "X"$PGUSER ]; then
$SECURITY_TRANSFORMS_HOME/libIRDB/test/fill_in_cfg.exe $cloneid # finish the initial IR $SECURITY_TRANSFORMS_HOME/libIRDB/test/fill_in_cfg.exe $cloneid # finish the initial IR
$SECURITY_TRANSFORMS_HOME/libIRDB/test/fix_calls.exe $cloneid # fix call insns so they are OK for spri emitting $SECURITY_TRANSFORMS_HOME/libIRDB/test/fix_calls.exe $cloneid # fix call insns so they are OK for spri emitting
$SECURITY_TRANSFORMS_HOME/libIRDB/test/ilr.exe $cloneid # perform ILR $SECURITY_TRANSFORMS_HOME/libIRDB/test/ilr.exe $cloneid # perform ILR
$SECURITY_TRANSFORMS_HOME/libIRDB/test/generate_spri.exe $cloneid a.ncexe.aspri # generate the spri code $SECURITY_TRANSFORMS_HOME/libIRDB/test/generate_spri.exe $cloneid a.irdb.aspri # generate the aspri code
$SECURITY_TRANSFORMS_HOME/tools/spasm/spasm a.irdb.aspri a.irdb.bspri # generate the bspri code
fi fi
fi fi
echo ------------------------------------------------------------------------------- echo -------------------------------------------------------------------------------
...@@ -111,16 +122,6 @@ if [ ! "X" = "X"$PGUSER ]; then ...@@ -111,16 +122,6 @@ if [ ! "X" = "X"$PGUSER ]; then
fi fi
#
# Run concolic engine
#
echo Running concolic testing to generate inputs ...
#$PEASOUP_HOME/tools/do_concolic.sh a --iterations 25 --logging tracer,instance_times,trace
$PEASOUP_HOME/tools/do_concolic.sh a --iterations 25 --logging tracer,trace,inputs
# 2>&1 |egrep -e "INPUT VECTOR:" -e "1: argc ="
# >/dev/null 2>&1
echo Done.
# #
# Uncomment this part to test the P1 xform # Uncomment this part to test the P1 xform
...@@ -132,16 +133,16 @@ echo Done. ...@@ -132,16 +133,16 @@ echo Done.
#echo Starting the P1 transform #echo Starting the P1 transform
#date #date
#$PEASOUP_HOME/tools/p1xform.sh $newdir > p1xform.out 2> p1xform.err #$PEASOUP_HOME/tools/p1xform.sh $newdir > p1xform.out 2> p1xform.err
#
#echo $current_dir/$newdir/p1.xform/p1.final #echo $current_dir/$newdir/p1.xform/p1.final
#
#if [ -f $current_dir/p1.xform/p1.final ]; then #if [ -f $current_dir/p1.xform/p1.final ]; then
# echo List of functions transformed: # echo List of functions transformed:
# cat $current_dir/p1.xform/p1.final # cat $current_dir/p1.xform/p1.final
#else #else
# echo P1 was unable to transform the subject program # echo P1 was unable to transform the subject program
#fi #fi
#
#date #date
#echo Done with the P1 transform #echo Done with the P1 transform
......
...@@ -10,21 +10,19 @@ datapath=$1 ...@@ -10,21 +10,19 @@ datapath=$1
# #
shift; shift;
#
# Determine which SPRI file to use; first priorty goes to one generated from the IRDB.
#
if [ -f $datapath/a.irdb.bspri ]; then
export STRATA_SPRI_FILE=$datapath/a.irdb.bspri
elif [ -f $datapath/p1.xform/p1.final.bspri ]; then
export STRATA_SPRI_FILE=$datapath/p1.xform/p1.final.bspri
fi
# #
# Run the program with the proper env. vars set., and the arguments to the program specified # Run the program with the proper env. vars set., and the arguments to the program specified
# #
if [ -f $datapath/p1.xform/p1.final.bspri ];
then
STRATA_DOUBLE_FREE=1 \
STRATA_HEAPRAND=1 \
STRATA_PC_CONFINE=1 \
STRATA_PC_CONFINE_XOR=1 \
STRATA_PC_CONFINE_XOR_KEY_LENGTH=1024 \
STRATA_ANNOT_FILE=$datapath/a.ncexe.annot \
STRATA_SPRI_FILE=$datapath/p1.xform/p1.final.bspri \
$datapath/a.stratafied "$@"
else
STRATA_DOUBLE_FREE=1 \ STRATA_DOUBLE_FREE=1 \
STRATA_HEAPRAND=1 \ STRATA_HEAPRAND=1 \
STRATA_PC_CONFINE=1 \ STRATA_PC_CONFINE=1 \
...@@ -32,6 +30,5 @@ STRATA_DOUBLE_FREE=1 \ ...@@ -32,6 +30,5 @@ STRATA_DOUBLE_FREE=1 \
STRATA_PC_CONFINE_XOR_KEY_LENGTH=1024 \ STRATA_PC_CONFINE_XOR_KEY_LENGTH=1024 \
STRATA_ANNOT_FILE=$datapath/a.ncexe.annot \ STRATA_ANNOT_FILE=$datapath/a.ncexe.annot \
$datapath/a.stratafied "$@" $datapath/a.stratafied "$@"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment