#!/bin/bash if [ "$#" -ne 1 ] then printf "Usage: %s \n" "$0" exit 1 fi echo ' /$$ | $$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$$| $$$$$$$ /$$_____/ /$$_____/ |____ $$| $$__ $$ /$$_____/| $$__ $$ | $$$$$$ | $$ /$$$$$$$| $$ \ $$ | $$$$$$ | $$ \ $$ \____ $$| $$ /$$__ $$| $$ | $$ \____ $$| $$ | $$ /$$$$$$$/| $$$$$$$| $$$$$$$| $$ | $$ /$$ /$$$$$$$/| $$ | $$ |_______/ \_______/ \_______/|__/ |__/|__/|_______/ |__/ |__/ ' pid="$1" scanfile=${SCANFILE:-/tmp/scanfile} rm -f ${scanfile} while true do read -p "Scan pattern (hex): " pattern newscan=$(mktemp) ./hack.out ${pid} scan ${pattern} > ${newscan} 2> /dev/null if [ ! -f ${scanfile} ] then mv ${newscan} ${scanfile} else temp=$(mktemp) cat ${newscan} ${scanfile} | sort | uniq -d > ${temp} mv ${temp} ${scanfile} rm ${newscan} fi done