forked from wedaa/LongTail-Telnet-honeypot-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_ptelnetd.sh
executable file
·68 lines (58 loc) · 1.91 KB
/
install_ptelnetd.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
#!/bin/sh
######################################################################
# install_ptelnetd.sh
# Written by: Eric Wedaa
# Version: 1.0
# Last Update: 2016-03-10, Created
#
# LICENSE: GPLV2: Please see the README at
# https://github.com/wedaa/LongTail-Log-Analysis/blob/master/README.md
#
######################################################################
if [[ $EUID -ne 0 ]]; then
echo "Sorry, this script must be run as root" 1>&2
exit 1
fi
if [ -d /usr/local/source/ptelnetd ] ; then
echo "It looks like you have already installed the LongTail ptelnetd honeypots "
echo "on this server."
echo ""
echo "If you wish to reinstall or install a newer version of the "
echo "LongTail ptelnetd honeypots, then you need to run the following"
echo "command:"
echo " /bin/rm -rf /usr/local/source/ptelnetd"
echo "and then run this script again."
exit;
fi
mkdir -p /usr/local/source/ptelnetd
cd /usr/local/source/ptelnetd
######################################################
wget https://github.com/wedaa/LongTail-Telnet-honeypot-v2/raw/master/paranoid-telnetd-0.4.tgz
tar -xf paranoid-telnetd-0.4.tgz
cd paranoid-telnetd-0.4
mv main.c main.c.orig
wget https://raw.githubusercontent.com/wedaa/LongTail-Telnet-honeypot-v2/master/main.c
./configure
make
if [ -e "ptelnetd" ] ; then
cp ptelnetd /usr/local/sbin/ptelnetd
chmod a+rx /usr/local/sbin/ptelnetd
cd ..
else
echo "Something is wrong, could not make ptelnetd properly, exiting now"
exit
fi
##################################################
# check to see if it's already in /etc/rc.local
grep ^\/usr\/local\/sbin\/ptelnetd\ /etc/rc.local >/dev/null
if [ $? -eq 0 ]; then
echo "ptelnetd already in /etc/rc.local"
else
echo ""
echo "Adding startup line for ptelnetd to /etc/rc.local"
echo ""
echo "/usr/local/sbin/ptelnetd -honeypot " >> /etc/rc.local
fi
echo "Please start ptelnetd by hand to start it now"
echo ""
echo "/usr/local/sbin/ptelnetd -honeypot"