-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloader
33 lines (33 loc) · 798 Bytes
/
loader
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
#!/bin/bash
set -euo pipefail
if [ -z "${1:-}" ]; then
exec bash
elif [ "$1" = "msf" ] || [ "$1" = "msfconsole" ]; then
shift
service postgresql start
exec msfconsole -x "set -g CHOST 0.0.0.0; set -g LHOST ${LHOST:-0.0.0.0};" "$@"
elif [ "$1" = "msfd" ]; then
shift
service postgresql start
exec msfd -f -a 0.0.0.0 -s "$@"
elif [ "$1" = "cache" ]; then
shift
if [ "$1" = "build" ]; then
shift
service postgresql start
msfconsole -x '/loader cache watch'
service postgresql stop
elif [ "$1" = "watch" ]; then
shift
old=0
new=0
until [ "$new" -gt 3000 ] && [ "$new" -eq "$old" ]; do
old="$new"
new="$(psql -U msf -h 127.0.0.1 msf -At -c 'select count(*) from module_details' || echo "0")"
echo "Module cache is now: $new"
sleep 10
done
exit
fi
fi
exec "$@"