diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/read.sh | 11 | ||||
| -rw-r--r-- | scripts/scan.sh | 38 |
2 files changed, 49 insertions, 0 deletions
diff --git a/scripts/read.sh b/scripts/read.sh new file mode 100644 index 0000000..38535e6 --- /dev/null +++ b/scripts/read.sh | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | if [ "$#" -ne 1 ] | ||
| 4 | then | ||
| 5 | printf "Usage: %s <tracee_pid>\n" "$0" | ||
| 6 | exit 1 | ||
| 7 | fi | ||
| 8 | |||
| 9 | scanfile=${SCANFILE:-/tmp/scanfile} | ||
| 10 | pid="$1" | ||
| 11 | watch -d -n 1 "xargs -r -a ${scanfile} ./hack.out ${pid} read 8 > /tmp/out 2> /dev/null && pr -t -m ${scanfile} /tmp/out" | ||
diff --git a/scripts/scan.sh b/scripts/scan.sh new file mode 100644 index 0000000..c700011 --- /dev/null +++ b/scripts/scan.sh | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | if [ "$#" -ne 1 ] | ||
| 4 | then | ||
| 5 | printf "Usage: %s <tracee_pid>\n" "$0" | ||
| 6 | exit 1 | ||
| 7 | fi | ||
| 8 | |||
| 9 | echo ' | ||
| 10 | /$$ | ||
| 11 | | $$ | ||
| 12 | /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$$| $$$$$$$ | ||
| 13 | /$$_____/ /$$_____/ |____ $$| $$__ $$ /$$_____/| $$__ $$ | ||
| 14 | | $$$$$$ | $$ /$$$$$$$| $$ \ $$ | $$$$$$ | $$ \ $$ | ||
| 15 | \____ $$| $$ /$$__ $$| $$ | $$ \____ $$| $$ | $$ | ||
| 16 | /$$$$$$$/| $$$$$$$| $$$$$$$| $$ | $$ /$$ /$$$$$$$/| $$ | $$ | ||
| 17 | |_______/ \_______/ \_______/|__/ |__/|__/|_______/ |__/ |__/ | ||
| 18 | ' | ||
| 19 | |||
| 20 | pid="$1" | ||
| 21 | scanfile=${SCANFILE:-/tmp/scanfile} | ||
| 22 | rm -f ${scanfile} | ||
| 23 | |||
| 24 | while true | ||
| 25 | do | ||
| 26 | read -p "Scan pattern (hex): " pattern | ||
| 27 | newscan=$(mktemp) | ||
| 28 | ./hack.out ${pid} scan ${pattern} > ${newscan} 2> /dev/null | ||
| 29 | if [ ! -f ${scanfile} ] | ||
| 30 | then | ||
| 31 | mv ${newscan} ${scanfile} | ||
| 32 | else | ||
| 33 | temp=$(mktemp) | ||
| 34 | cat ${newscan} ${scanfile} | sort | uniq -d > ${temp} | ||
| 35 | mv ${temp} ${scanfile} | ||
| 36 | rm ${newscan} | ||
| 37 | fi | ||
| 38 | done | ||
