Skip to content

Instantly share code, notes, and snippets.

@14mRh4X0r
Created November 21, 2012 11:28
Show Gist options
  • Save 14mRh4X0r/4124436 to your computer and use it in GitHub Desktop.
Save 14mRh4X0r/4124436 to your computer and use it in GitHub Desktop.
Files for extracting obfuscation info from MCP
#!/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')
#!/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