From 5fb657f56945dcc7bc2ed2817fac863b69315ac7 Mon Sep 17 00:00:00 2001 From: Alexander Shvedov <60114847+a-shvedov@users.noreply.github.com> Date: Sat, 1 Jun 2024 13:03:55 +0300 Subject: Rename make_dict_v2.sh to generate_libtoken_dict.sh --- utils/libtokencap/generate_libtoken_dict.sh | 45 +++++++++++++++++++++++++++++ utils/libtokencap/make_dict_v2.sh | 45 ----------------------------- 2 files changed, 45 insertions(+), 45 deletions(-) create mode 100644 utils/libtokencap/generate_libtoken_dict.sh delete mode 100644 utils/libtokencap/make_dict_v2.sh (limited to 'utils/libtokencap') diff --git a/utils/libtokencap/generate_libtoken_dict.sh b/utils/libtokencap/generate_libtoken_dict.sh new file mode 100644 index 00000000..1ddec06b --- /dev/null +++ b/utils/libtokencap/generate_libtoken_dict.sh @@ -0,0 +1,45 @@ +#help +usage() { + echo "Usage: $0 -o -b -p [-t ]" + echo "Options:" + echo " -o Path to target output directory" + echo " -b Path to target program binary" + echo " -p Path to LD_PRELOAD library" + echo " -t Timeout in seconds" + exit 1 +} + +#parse cli options +while getopts ":o:b:p:t:" opt; do + case $opt in + o) target_output="$OPTARG" ;; + b) target_bin="$OPTARG" ;; + p) LD_PRELOAD_PATH="$OPTARG" ;; + t) timeout_sec="$OPTARG" ;; + \?) echo "Invalid option: -$OPTARG" >&2; usage ;; + :) echo "Option -$OPTARG requires an argument." >&2; usage ;; + esac +done + +#check options +if [ -z "$target_output" ] || [ -z "$target_bin" ] || [ -z "$LD_PRELOAD_PATH" ]; then + echo "Error: Missing mandatory opts" >&2 + usage +fi + +# initialize vars +AFL_TOKEN_FILE="${PWD}/temp_output.txt" +AFL_DICT_FILE="$(basename "$target_output").dict" + +#generate token-file +{ + touch "$AFL_TOKEN_FILE" + for i in $(find "$target_output" -type f -name "id*"); do + LD_PRELOAD="$LD_PRELOAD_PATH" \ + timeout -s SIGKILL "$timeout_sec" \ + "$target_bin" "$i" + done +} >"$AFL_TOKEN_FILE" + +# sort & remove duplicates +sort -u "$AFL_TOKEN_FILE" >"$AFL_DICT_FILE" diff --git a/utils/libtokencap/make_dict_v2.sh b/utils/libtokencap/make_dict_v2.sh deleted file mode 100644 index 1ddec06b..00000000 --- a/utils/libtokencap/make_dict_v2.sh +++ /dev/null @@ -1,45 +0,0 @@ -#help -usage() { - echo "Usage: $0 -o -b -p [-t ]" - echo "Options:" - echo " -o Path to target output directory" - echo " -b Path to target program binary" - echo " -p Path to LD_PRELOAD library" - echo " -t Timeout in seconds" - exit 1 -} - -#parse cli options -while getopts ":o:b:p:t:" opt; do - case $opt in - o) target_output="$OPTARG" ;; - b) target_bin="$OPTARG" ;; - p) LD_PRELOAD_PATH="$OPTARG" ;; - t) timeout_sec="$OPTARG" ;; - \?) echo "Invalid option: -$OPTARG" >&2; usage ;; - :) echo "Option -$OPTARG requires an argument." >&2; usage ;; - esac -done - -#check options -if [ -z "$target_output" ] || [ -z "$target_bin" ] || [ -z "$LD_PRELOAD_PATH" ]; then - echo "Error: Missing mandatory opts" >&2 - usage -fi - -# initialize vars -AFL_TOKEN_FILE="${PWD}/temp_output.txt" -AFL_DICT_FILE="$(basename "$target_output").dict" - -#generate token-file -{ - touch "$AFL_TOKEN_FILE" - for i in $(find "$target_output" -type f -name "id*"); do - LD_PRELOAD="$LD_PRELOAD_PATH" \ - timeout -s SIGKILL "$timeout_sec" \ - "$target_bin" "$i" - done -} >"$AFL_TOKEN_FILE" - -# sort & remove duplicates -sort -u "$AFL_TOKEN_FILE" >"$AFL_DICT_FILE" -- cgit 1.4.1