Created
March 28, 2019 16:58
-
-
Save arizvisa/0be819aacc83f508ccc9c022ada236ba to your computer and use it in GitHub Desktop.
Generate a dependency graph for a bunch of PE (*.dll and *.exe) files linking imports to dlls and exports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
echo 'digraph lamegraph {' | |
find . -name '*.exe' -type f -o -name '*.dll' -type f | while read fn; do | |
sn=$( basename "$fn" ) | |
python $SYRINGE/tools/pe.py -Olist -e "$fn" | tr -d $'\r' | cut -d: -f3 | while read e; do | |
printf '"%s" -> "%s!%s";\n' "$sn" "$sn" "$e" | |
break | |
done | |
python $SYRINGE/tools/pe.py -Olist -i "$fn" | while IFS=: read i module; do | |
wtf=`echo -n "$module" | tr -d $'\r'` | |
python $SYRINGE/tools/pe.py -Olist -I $i "$fn" | cut -d' ' -f2 | cut -d: -f2 | while read name; do | |
printf '"%s!%s" -> "%s";\n' "$wtf" "$name" "$sn" | |
done | |
done | |
done | |
echo '}' | |
) | tee $yourfile.dot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Point the SYRINGE variable at the base of https://github.com/arizvisa/syringe.git