forked from Seabreg/Basic-Fuzzing-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reset_bff.sh
53 lines (42 loc) · 1.33 KB
/
reset_bff.sh
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
44
45
46
47
48
49
50
#!/bin/sh
# Sometimes you need to clean or nuke the VM in which BFF runs.
# This script will remove the output directories and
# local copy of the config file so that you can start
# fresh. Probably best to reboot afterwards
platform=`uname`
if [ $# -lt 1 ]
then
echo "For your safety, this script won't run unless you provide an argument."
echo
echo "E.g.," $0 "<anything> [--reboot]"
echo
echo "With any argument other than --remove-results, this script will simply kill any"
echo "running BFF batch.sh and remove the local fuzzing directory."
echo
echo "However, --remove-results will wipe out the remote results directory as well "
echo "so only use it if you really, really mean it."
echo
echo "If the second arg is --reboot, the machine will be rebooted."
exit 1
fi
# kill any running bff stuff
BFF_PID=`ps -ef | grep bff.py | grep python | awk '{print $2;}'`
if [ -n "$BFF_PID" ]; then
kill $BFF_PID
fi
# wipe the local files
rm -rfv ~/fuzzing
rm -rfv ~/bff.cfg
if [ "$1" = "--remove-results" ]; then
if [ "$platform" = "Linux" ]; then
# wipe the remote results too
sudo rm -rfv ~/results/*
else
rm -rfv ~/results/*
fi
fi
if [ "$2" = "--reboot" ]; then
# reboot the vm
echo Rebooting machine...
sudo reboot
fi