forked from HexHive/RetroWrite-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools
43 lines (36 loc) · 1.18 KB
/
tools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# locate this script:
SCRIPT="${BASH_SOURCE[0]}"
SCRIPTDIR=""
if [ -z "$SCRIPT" ]; then
SCRIPT=$(readlink -f $0)
SCRIPTDIR=$(dirname $SCRIPT)
else
SCRIPTDIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
fi
if ! test -f $SCRIPTDIR/aflplusplus/afl-fuzz; then
echo "Please run the setup.sh script first."
fi
if ! test -f "$SCRIPTDIR/retrowrite/retro/bin/activate"; then
echo "Please run the setup.sh script first."
fi
source "$SCRIPTDIR/retrowrite/retro/bin/activate"
# ensure AFL can find itself as well:
export AFL_PATH="$SCRIPTDIR/aflplusplus"
# Add AFL to the path:
export PATH="$PATH:$SCRIPTDIR/aflplusplus"
# some useful aliases:
alias playg="cd $SCRIPTDIR/playground"
alias tutorial="cd $SCRIPTDIR"
alias phase1="cd $SCRIPTDIR/01-native_fuzzing"
alias phase2="cd $SCRIPTDIR/02-coverage_fuzzing"
alias phase3="cd $SCRIPTDIR/03-coverage_sanitized_fuzzing"
function afl-configure-system() {
# Tune system to work with AFL++
echo 'core' | sudo tee /proc/sys/kernel/core_pattern
if [[ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]]; then
pushd /sys/devices/system/cpu
echo performance | sudo tee cpu*/cpufreq/scaling_governor
popd
fi
}