-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall.sh
executable file
·137 lines (106 loc) · 3.15 KB
/
install.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
# Adrian Vollmer, SySS GmbH 2019
function usage {
cat << EOF
This script prepares a remote machine (should be Kali Linux) via SSH for the Lauschgerät.
Usage:
$0 [options ...] <SSHSERVER> <ATIF> <CLIF> <SWIF> [<WIFIIF> <WIFI-PASSWORD>]
Positional arguments:
<SSHSERVER>:
The host name of the remote machine
<ATIF>:
The name of the interface connected used to manage the Lauschgerät
(attacker interface)
<CLIF>:
The name of the interface connected to the victim client
<SWIF>:
The name of the interface connected to the victim switch
<WIFIIF>:
The name of the wifi interface on the remote machine
If the remote machine is virtual, try passing a USB wifi dongle to
the machine.
<WIFI-PASSWORD>:
The password for the wifi network created by the Lauschgerät
Must be at least eight characters long.
WARNING: Knowing this password is equivalent to having root access!
The options are:
-p=<PORT>, --port=<PORT>:
The port of the SSH server (default: 22)
-u=<USER>, --user=<USER>:
The user to authenticate as (default: root)
--dhcp:
Set up a DHCP server on ATIF interface of the remote machine (default: no)
This should not be necessary if the remote machine is virtual. If it
is physical, you probably want this option.
-h, --help:
Print this message and quit
EOF
}
set -e
for i in "$@" ; do
case $i in
-s=*|--server=*)
SERVER="${i#*=}"
shift # past argument=value
;;
-p=*|--port=*)
PORT="${i#*=}"
shift # past argument=value
;;
-u=*|--user=*)
SSHUSER="${i#*=}"
shift # past argument=value
;;
-h|--help)
usage
exit 0
;;
--dhcp)
DHCP=YES
shift # past argument with no value
;;
-*)
echo "Unknown option: $i"
exit 1
;;
*)
break # unknown option
;;
esac
done
SERVER="$1"
ATIF="$2"
CLIF="$3"
SWIF="$4"
WIFIIF="$5"
WIFIPASS="$6"
[ -z "$PORT" ] && PORT=22
[ -z "$SSHUSER" ] && SSHUSER=root
[ -z "$DHCP" ] && DHCP=NO
set -u
TARBALL=/tmp/lg.tar.gz
BOOTSTRAP_DIR="$(dirname "$0")/bootstrap"
if [ -z "$SERVER" -o -z "$ATIF" -o -z "$CLIF" -o -z "$SWIF" ]; then
usage
exit 1
fi
tar czf "$TARBALL" -C "$(dirname "$0")" \
--exclude=.git \
--exclude=doc \
--exclude=testing \
./*
echo "WARNING: This will overwrite many system files on the target system!"
echo "Don't do this if you want to use the system for anything but a Lauschgerät."
echo "Do you want to proceed? [y/N] "
read decision
if [ ! $decision = y ] ; then
echo "Aborting"
exit 0
fi
NOW="$(date "+%F %T")"
ssh-copy-id -p "$PORT" "$SSHUSER@$SERVER" || true
scp -P "$PORT" "$TARBALL" "$SSHUSER@$SERVER:/root"
ssh -p "$PORT" "$SSHUSER@$SERVER" "date -s '$NOW'; mkdir -p /root/lg ; cd /root/lg ; \
tar xf ../lg.tar.gz ; \
/root/lg/lg-server/lg-setup.sh \
\"$DHCP\" \"$ATIF\" \"$CLIF\" \"$SWIF\" $WIFIIF $WIFIPASS"