-
Notifications
You must be signed in to change notification settings - Fork 10
/
fuzz-ethbmc-vuln.sh
executable file
·52 lines (48 loc) · 1.43 KB
/
fuzz-ethbmc-vuln.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
51
52
#!/usr/bin/env bash
set -u -o pipefail
OUT_DIR=./results/ethbmc-vuln
if ! test -e "$OUT_DIR"; then
mkdir -p "$OUT_DIR"
fi
while IFS= read -r addr
do
outpath="$OUT_DIR/$addr.tar.xz";
if test -e "$outpath"; then
continue;
fi
# remove latest outpath if some errors occurs - avoids pointless empty files
trap "sig=\$((\$?)); set -x; rm -f \"$outpath\"; exit \$sig" EXIT SIGTERM SIGINT
touch "$outpath"
echo ">>>>> Fuzzing $addr"
tmplog="$(mktemp).log"
buildcache=/tmp/efcf/builds/
mkdir -p "$buildcache" || true
set -x
efcfuzz \
--quiet \
--compress-builds=n \
--build-cache "$buildcache" \
--geth-url http://localhost:8545 \
--geth-preset old \
--ignore-leaking \
--report-dos-selfdestruct \
--include-address-deps=y \
--until-crash --timeout 1200 \
--out "$outpath" \
--live-state "$addr" 2>&1 | tee "$tmplog"
res=$?
set +x
if [[ "$res" -ne 0 ]]; then
echo ">>>>> Fuzzing $addr failed with $res"
rm "$outpath" || true
cp "$tmplog" "$outpath.$(date --iso-8601=seconds).$res.err.log"
else
cp "$tmplog" "$outpath.$(date --iso-8601=seconds).log"
fi
# make sure the trap is gone if we succeeded
trap - EXIT SIGTERM SIGINT
cp "$buildcache"/*.log "$OUT_DIR/"
ls -A "$buildcache"
rm -rf "$buildcache"
done < ./data/ethbmc-vuln/vuln.txt
exit 0