Last active
October 21, 2021 04:29
-
-
Save bnagy/8f0eb29eb125653f73fd to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
# | |
# american fuzzy lop - pause a set of fuzzers | |
# -------------------------------------- | |
# | |
# By @rantyben, based on afl-whatsup, which is: | |
# Written and maintained by Michal Zalewski <[email protected]> | |
# | |
# Copyright 2015 Google Inc. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at: | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# This pauses all live fuzzers in the given output directory using | |
# SIGSTOP | |
echo "afl-pause - pause fuzzers" | |
echo | |
DIR="$1" | |
if [ "$DIR" = "" ]; then | |
echo "Usage: $0 afl_sync_dir" 1>&2 | |
echo 1>&2 | |
exit 1 | |
fi | |
cd "$DIR" || exit 1 | |
if [ -d queue ]; then | |
echo "[-] Error: parameter is an individual output directory, not a sync dir." 1>&2 | |
exit 1 | |
fi | |
TMP=`mktemp -t .afl-whatsup-XXXXXXXX` || exit 1 | |
ALIVE_CNT=0 | |
DEAD_CNT=0 | |
for i in `find . -maxdepth 2 -iname fuzzer_stats`; do | |
sed 's/^command_line.*$/_skip:1/;s/[ ]*:[ ]*/="/;s/$/"/' "$i" >"$TMP" | |
. "$TMP" | |
if ! kill -0 "$fuzzer_pid" 2>/dev/null; then | |
echo "Instance is dead or running remotely, skipping." | |
echo | |
DEAD_CNT=$((DEAD_CNT + 1)) | |
continue | |
fi | |
ALIVE_CNT=$((ALIVE_CNT + 1)) | |
if ! kill -STOP "$fuzzer_pid" 2>/dev/null; then | |
echo "Unable to pause fuzzer pid $fuzzer_pid, aborting." | |
echo | |
exit 1 | |
fi | |
done | |
rm -f "$TMP" | |
echo "Fuzzers paused: $ALIVE_CNT" | |
if [ ! "$DEAD_CNT" = "0" ]; then | |
echo "Dead or remote: $DEAD_CNT (excluded from stats)" | |
fi | |
exit 0 |
This file contains hidden or 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/sh | |
# | |
# american fuzzy lop - resume a set of fuzzers | |
# -------------------------------------- | |
# | |
# By @rantyben, based on afl-whatsup, which is: | |
# Written and maintained by Michal Zalewski <[email protected]> | |
# | |
# Copyright 2015 Google Inc. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at: | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# This resumes all live fuzzers in the given output directory using | |
# SIGCONT | |
echo "afl-resume - resume fuzzers" | |
echo | |
DIR="$1" | |
if [ "$DIR" = "" ]; then | |
echo "Usage: $0 afl_sync_dir" 1>&2 | |
echo 1>&2 | |
exit 1 | |
fi | |
cd "$DIR" || exit 1 | |
if [ -d queue ]; then | |
echo "[-] Error: parameter is an individual output directory, not a sync dir." 1>&2 | |
exit 1 | |
fi | |
TMP=`mktemp -t .afl-whatsup-XXXXXXXX` || exit 1 | |
ALIVE_CNT=0 | |
DEAD_CNT=0 | |
for i in `find . -maxdepth 2 -iname fuzzer_stats`; do | |
sed 's/^command_line.*$/_skip:1/;s/[ ]*:[ ]*/="/;s/$/"/' "$i" >"$TMP" | |
. "$TMP" | |
if ! kill -0 "$fuzzer_pid" 2>/dev/null; then | |
echo "Instance is dead or running remotely, skipping." | |
echo | |
DEAD_CNT=$((DEAD_CNT + 1)) | |
continue | |
fi | |
ALIVE_CNT=$((ALIVE_CNT + 1)) | |
if ! kill -CONT "$fuzzer_pid" 2>/dev/null; then | |
echo "Unable to stop fuzzer pid $fuzzer_pid, aborting." | |
echo | |
exit 1 | |
fi | |
done | |
rm -f "$TMP" | |
echo "Fuzzers resumed: $ALIVE_CNT" | |
if [ ! "$DEAD_CNT" = "0" ]; then | |
echo "Dead or remote: $DEAD_CNT (excluded from stats)" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment