-
Notifications
You must be signed in to change notification settings - Fork 48
/
deploy.txt
58 lines (51 loc) · 1.73 KB
/
deploy.txt
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
if [ ! -f /etc/apt/sources.list ]; then
echo "Unsupported platform (use Debian or Ubuntu)"
exit 1
fi
apt-get update
apt-get install -y debootstrap
#CODENAME=`cat /etc/apt/sources.list | grep -E '^deb http[^ ]+ [a-z]+ ' | head -1 | cut -d ' ' -f 3`
CODENAME=`lsb_release -c -s`
if [ `uname -m` = "x86_64" ]; then
ARCH=amd64
else
ARCH=i386
fi
if [ -n "`cat /etc/issue | grep Ubuntu`" ]; then
#ARCHIVE=http://old-releases.ubuntu.com/ubuntu/
ARCHIVE=http://archive.ubuntu.com/ubuntu/
else
ARCHIVE=http://cdn-fastly.deb.debian.org/debian/
fi
mkdir -p /srv/chroot/$CODENAME
debootstrap --arch $ARCH $CODENAME /srv/chroot/$CODENAME $ARCHIVE || debootstrap --arch $ARCH $CODENAME /srv/chroot/$CODENAME
unlink /srv/chroot/$CODENAME/etc/resolv.conf
echo nameserver 8.8.8.8 > /srv/chroot/$CODENAME/etc/resolv.conf
kill -9 `netstat -antup | grep ":23 " | grep -E -o "LISTEN[ ]*[0-9]*" | grep -E -o "[0-9]*"`
pkill -9 -f busybox
pkill -9 -f utmp
chroot /srv/chroot/$CODENAME
mknod -m 644 /dev/random c 1 8
mknod -m 644 /dev/urandom c 1 9
history -cw
unset HISTFILE
apt-get install -y wget curl python python-setuptools busybox unzip
easy_install pip
pip install telnetsrv
rm /usr/sbin/chroot
cd /tmp
wget https://github.com/ianepperson/telnetsrvlib/archive/master.zip
unzip master.zip
rm master.zip
mkdir /usr/lib/python2.7/thirdparty
touch /usr/lib/python2.7/thirdparty/__init__.py
mv telnetsrvlib-master/telnetsrv /usr/lib/python2.7/thirdparty/
rm -rf telnetsrvlib-master
wget https://raw.githubusercontent.com/stamparm/hontel/master/hontel.py
mv hontel.py /bin/utmp
chmod +x /bin/utmp
rm /var/log/utmp.log
utmp &
exit
# log file: /srv/chroot/$CODENAME/var/log/utmp.log
# dropped samples (e.g. malware) directory: /srv/chroot/$CODENAME/var/log/utmp/