forked from MobSF/Mobile-Security-Framework-MobSF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·35 lines (31 loc) · 819 Bytes
/
run.sh
File metadata and controls
executable file
·35 lines (31 loc) · 819 Bytes
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
#!/bin/bash
var="$1"
function validate_ip() {
local IP=$1
if [[ $IP =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
for i in ${IP//./ }; do
((i >= 0 && i <= 255)) || { echo 'Bad IP'; exit 1; }
done
else
echo 'Bad IP'
exit 1
fi
}
function validate_port() {
local PORT=$1
if [[ -z "$PORT" || "$PORT" -le 1024 || "$PORT" -ge 65535 ]]; then
echo 'Invalid Port'
exit 1
fi
}
if [[ -n "$var" ]]; then
IP="${var%%:*}"
PORT="${var##*:}"
validate_ip "$IP"
validate_port "$PORT"
else
IP='[::]'
PORT='8000'
fi
python3 -m poetry run gunicorn -b ${IP}:${PORT} mobsf.MobSF.wsgi:application --workers=1 --threads=10 --timeout=3600 \
--log-level=critical --log-file=- --access-logfile=- --error-logfile=- --capture-output