-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsadness.sh
executable file
·53 lines (42 loc) · 1.21 KB
/
sadness.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
53
#!/bin/bash
[[ -f crashdb ]] || go build -o crashdb main.go
rm -f core.*
if ! type slapper &> /dev/null; then
echo -n "slapper is not installed, should we install it?"
read -p " [y/N]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
go get -u -v github.com/ikruglov/slapper
else
exit 1
fi
fi
if ! type dlv &> /dev/null; then
echo -n "delve is not installed, should we install it?"
read -p " [y/N]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
go get -u -v github.com/derekparker/delve/cmd/dlv
else
exit 1
fi
fi
echo "Killing previous crashdb instances"
kill $(pidof crashdb)
echo "Starting crashdb..."
GOTRACEBACK=crash ./crashdb &
echo -n "Populating keys."
curl -X POST --data '{"Key": "foo", "Value": 1}' localhost:8080/
echo -n "."
curl -X POST --data '{"Key": "bar", "Value": 2}' localhost:8080/
echo "."
echo "Stop slapper by pressing 'q' once crashdb gets sad"
echo "Press enter to continue"
read
slapper -targets static/targets.txt -rate 10000
clear
if pidof systemd &> /dev/null; then
echo "copying coredumps /var/lib/systemd/coredump/core.crashdb*"
cp /var/lib/systemd/coredump/core.crashdb* .
fi
dlv core ./crashdb core.*