Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (50 sloc) 1.68 KB
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/
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/