-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathps.sh
74 lines (62 loc) · 1.28 KB
/
ps.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
processName=Phishing-Simulation
process=phishing-simulation
appDirectory=/root/go/src/github.com/binodlamsal/zerophish
logfile=/var/log/phishing-simulation/phishing-simulation.log
errfile=/var/log/phishing-simulation/phishing-simulation.error
readpassphrase() {
if [[ -v PRODUCTION ]]; then
read -sp 'Enter passphrase: ' pass && echo $pass > input.pipe
fi
}
start() {
echo 'Starting '${processName}'…'
cd ${appDirectory}
readpassphrase
sleep 1
nohup ./$process >>$logfile 2>>$errfile &
sleep 1
status
}
encryptemails () {
cd ${appDirectory}
./$process --encrypt-emails
sleep 1
}
decryptemails () {
cd ${appDirectory}
./$process --decrypt-emails
sleep 1
}
decryptapikeys () {
cd ${appDirectory}
./$process --decrypt-api-keys
sleep 1
}
encryptapikeys () {
cd ${appDirectory}
./$process --encrypt-api-keys
sleep 1
}
stop() {
echo 'Stopping '${processName}'…'
kill `pidof ${process}`
sleep 1
}
restart(){
stop
start
}
status() {
pid=$(pidof ${process})
if [[ "$pid" != "" ]]; then
echo ${processName}' is running…'
else
echo ${processName}' is not running…'
tail $errfile
fi
}
case $1 in
start|stop|status|encryptemails|encryptapikeys|decryptemails|decryptapikeys) "$1" ;;
esac