diff --git a/.gitattributes b/.gitattributes index dac8acc88ece5382448422ad3d3919a767a489cc..31bce1c8ab8576531a7084564b8907fa13ecdfe7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,7 @@ * text=auto !eol /Build.sh -text /README.txt -text +/SMP-analyze.sh -text /SMPStaticAnalyzer.cpp -text /makefile -text /plugin.script -text diff --git a/README.txt b/README.txt index fb0457a03ed43a97fd91558109a4a30d166951f9..dfbe0b79a2c2d44712c3fe8112c20565f551ddd4 100644 --- a/README.txt +++ b/README.txt @@ -26,6 +26,16 @@ source, you would copy these files into the myplugins directory and then type "Build.sh" there. The plugin builds and is copied into $IDAROOT/plugins where it is automatically loaded by IDA Pro. +---- + +edit by jdh8d: + +I choose non-standard install locations for IDAROOT and the SDK. Other +users may do the same. To avoid excessive CVS versions due to everyone +changing "makefile" to suit their own needs, one now needs to export IDAROOT +and IDASDK. The makefile has been edited to ensure that these variables +are set properly. + 2) RUNNING THE STATIC ANALYZER ON AN EXECUTABLE The file SMP-analyze.sh is invoked to run the plugin on an diff --git a/SMP-analyze.sh b/SMP-analyze.sh new file mode 100755 index 0000000000000000000000000000000000000000..946b583e4e2ea424f937777aca70551c0444df27 --- /dev/null +++ b/SMP-analyze.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Make terminal ansi so we don't get an extraneous error. +export TVOPT=ansi +# Fix screwed-up LD environment on power machines. +export LD_LIBRARY_PATH=/uf1/jdh8d/RA/NICECAP/idapro_lib/ + +# Set IDA path. +export IDADIR=$IDAROOT +# Make sure that the idal executable can be reached from PATH. +export PATH=$PATH:$IDAROOT +export IDALOG=$1.log +export IDALOG_SILENT=1 + +if [ "${IDAROOT}"X = "X" ]; then echo Please set IDAROOT; exit 1; fi +if [ ! -f ${IDAROOT}/libida.so ]; then echo IDAROOT is set poorly, please fix.; exit 1; fi + + +# remove tmp files +rm -f $1.id? $1.{nam,til,log,syms} `basename $1 .ncexe`.id? + +old_stty=`stty -g` + +ls + + +# Run the linux IDA Pro with the SMPStaticAnalyzer plugin. +# jdh - added -B for batch mode, avoids any prompts. +# jdh - note: can't use -B, as the plugin doesn't run! +#time ${IDAROOT}/idal -A -Telf -OSMPStaticAnalyzer:run $1 2>&1 >/dev/null +time ${IDAROOT}/idal -A -SSMP.idc $1 + +# SMP seems to mess up the terminal, using this to fix it. +/usr/bin/reset +stty $old_stty + +# Get the output file SMP.syms into $1.syms. +mv SMP.annot $1.annot diff --git a/makefile b/makefile index b7fb99650f8bc4002a97176f1926d2a1265b760a..1e9e079373eb07daf504105788cc9d5c8cdc6511 100644 --- a/makefile +++ b/makefile @@ -1,13 +1,19 @@ -IDAROOT=${HOME}/idastd SRC=SMPStaticAnalyzer.cpp OBJS=SMPStaticAnalyzer.o CC=g++ LD=g++ -CFLAGS=-D__IDP__ -D__PLUGIN__ -c -D__LINUX__ -I${IDAROOT}/SDK/include +CFLAGS=-D__IDP__ -D__PLUGIN__ -c -D__LINUX__ -I${IDASDK}/include LDFLAGS=--shared $(OBJS) -L${IDAROOT} -lida --no-undefined \ -Wl,--version-script=./plugin.script -all: +all: .PHONY $(CC) $(CFLAGS) $(SRC) $(LD) $(LDFLAGS) -o SMPStaticAnalyzer.plx cp SMPStaticAnalyzer.plx ${IDAROOT}/plugins + +.PHONY: + @if [ "${IDAROOT}"X = "X" ]; then echo Please set IDAROOT; exit 1; fi + @if [ ! -f ${IDAROOT}/libida.so ]; then echo IDAROOT is set poorly, please fix.; exit 1; fi + @if [ "${IDASDK}"X = "X" ]; then echo Please set IDASDK; exit 1; fi + @if [ ! -f ${IDASDK}/include/intel.hpp ]; then echo IDASDK is set poorly, please fix.; exit 1; fi +