Created
November 21, 2012 11:28
-
-
Save 14mRh4X0r/4124436 to your computer and use it in GitHub Desktop.
Files for extracting obfuscation info from MCP
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
#!/bin/bash | |
# Debug | |
function debug() { | |
oldopts="$-" | |
function on_exit() { | |
[[ "$oldopts" =~ .*x.* ]] && set +x | |
} | |
set -x | |
trap on_exit EXIT | |
} | |
[ "$DEBUG" ] && debug | |
OC=$(echo "$*" | cut -d. -f1) | |
OM=$(echo "$*" | cut -d. -f2-) | |
DOC=$(awk "/^CL:/ && /(\\/|\\W)$OC\\W/ { print \$2 }" server.srg) | |
match=$(awk "/^FD:/ && /\\W${DOC//\//\\/}\\/$OM\\W/" server.srg | grep -Po '(?<=_)\d+(?=_)') | |
if [ $(echo $match | wc -w) -eq 0 ]; then | |
echo "No matches found." | |
exit 1 | |
elif [ $(echo $match | wc -w) -gt 1 ]; then | |
echo WARNING: Ambiguous search. Matches: | |
awk "/^FD:/ && /\\W${DOC//\//\\/}\\/$OM\\W/" server.srg | |
fi | |
fgrep ,1, fields.csv | fgrep $(echo $match | sed -r 's/(^| )/ -e /g') |
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
#!/bin/bash | |
# Debug | |
function debug() { | |
oldopts="$-" | |
function on_exit() { | |
[[ "$oldopts" =~ .*x.* ]] && set +x | |
} | |
set -x | |
trap on_exit EXIT | |
} | |
[ "$DEBUG" ] && debug | |
OC="$(echo "$*" | cut -d. -f1)" | |
OM="$(echo "$*" | cut -d. -f2-)" | |
DOC="$(awk "/^CL:/ && /(\\/|\\W)$OC\\W/ { print \$2 }" server.srg)" | |
match="$(awk "/^MD:/ && /\\W${DOC//\//\\/}\\/$OM\\W/" server.srg | grep -Po '(?<=_)\d+(?=_)')" | |
if [ $(echo $match | wc -w) -eq 0 ]; then | |
echo "No matches found." | |
exit 1 | |
elif [ $(echo $match | wc -w) -gt 1 ]; then | |
echo WARNING: Ambiguous search. Matches: | |
awk "/^MD:/ && /\\W${DOC//\//\\/}\\/$OM\\W/" server.srg | |
fi | |
fgrep ,1, methods.csv | fgrep $(echo $match | sed -r 's/(^| )/ -e /g') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment