<commit_before>####################################################
####                                            ####
#### Ubuntu 14.04LTS Honeypot Install Script    ####
#### Updated for 14.04 by <NAME> &    ####
#### <EMAIL>                  ####
####                                            ####
####################################################

###### Variables ######
INTERFACE='em1'
RABBIT_USER='amp'
RABBIT_PASSWORD='password'
RABBIT_HOST='1.1.1.1'

###### Get Things ######
apt-get update
apt-get -y install gcc build-essential bind9 dnsutils cmake make gcc g++ flex bison gcc
apt-get -y install libpcap-dev libgeoip-dev libssl-dev python-dev zlib1g-dev libmagic-dev 
apt-get -y install hping3 vim ntp xinetd curl default-jre git ruby swig2.0 ruby-dev
mkdir build
cd build

###### setup hostname ######

OLDHOSTNAME=`cat /etc/hostname`
echo honey`/sbin/ifconfig $INTERFACE | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`> /etc/hostname
NEWHOSTNAME=`cat /etc/hostname`
hostname $NEWHOSTNAME
cat /etc/hosts | sed  s/$OLDHOSTNAME/$NEWHOSTNAME/g > /tmp/hosts
mv -f /tmp/hosts /etc/hosts
echo -e "127.0.0.1\t$NEWHOSTNAME" >> /etc/hosts

###### Install NTP ######
mkdir build && cd build
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.6p4.tar.gz
tar zxvf ntp-4.2.6p4.tar.gz
cd ntp-4.2.6p4/
./configure --enable-clockctl
make
make install
cd ..
echo "driftfile /var/lib/ntp/ntp.drift" > /etc/ntp.conf

echo "e30003fa000100000001000000000000000000000000000000000000000000000000000000000000d6a42558d961df90" > /root/ntp.bin
/usr/local/bin/ntpd -u ntp:ntp -p /var/run/ntpd.pid -g

echo '#!/usr/bin/env bash
killall ntpd
/usr/local/bin/ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
killall sshpot
service sshpot restart
killall SSDP_Emulator
/root/build/ssdp/SSDP_Emulator
killall heartbeat_emulator
/root/build/heartbeat/heartbeat_emulator
killall mdns_emulator
/root/build/mdns/mdns_emulator
killall nat-pmp_emulator
/root/build/nat-pmp/nat-pmp_emulator
killall quake_emulator
/root/build/quake_emu/quake_emulator
killall ripv1_emulator
/root/build/ripv1/ripv1_emulator
killall sentinel_emulator
/root/build/sentinel/sentinel_emulator
/usr/sbin/hping3 --rand-source -c 600 --udp -p 123 --fast -n 127.0.0.1 -d 48 -E /root/ntp.bin' > /root/killntp.sh 
chmod +x /root/killntp.sh 

hping3 --rand-source -c 600 --udp -p 123 --fast -n 127.0.0.1 -d 48 -E /root/ntp.bin


###### Install CHARGEN ######

echo 'service chargen
{
    disable = yes
    type = INTERNAL
    id = chargen-stream
    socket_type = stream
    protocol = tcp
    user = root
    wait = no
}                                                                               

# This is the udp version.
service chargen
{
    disable = no
    type = INTERNAL
    id = chargen-dgram
    socket_type = dgram
    protocol = udp
    user = root
    wait = yes
}' > /etc/xinetd.d/chargen 

service xinetd restart

###### Install SSDP Service Emulator ######
cd /root/build/
mkdir ssdp
cd /root/build/ssdp/
curl https://raw.githubusercontent.com/kingtuna/honeynet/master/emulators/SSDP_Emulator.c > SSDP_Emulator.c
gcc SSDP_Emulator.c -o SSDP_Emulator
/root/build/ssdp/SSDP_Emulator

###### Install heartbeat_emulator #######
if [! -d /root/build/heartbeat];then
	mkdir /root/build/hearbeat
fi
cd /root/build/heartbeat/
curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/heartbeat_emulator.c > heartbeat_emulator.c
gcc heartbeat_emulator.c -o heartbeat_emulator
/root/build/heartbeat/heartbeat_emulator

###### Install mdns Service Emulator #######
if [! -d /root/build/mdns];then
	mkdir /root/build/mdns
fi
cd /root/build/mdns/
curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/mdns_emulator.c > mdns_emulator.c
gcc mdns_emulator.c -o mdns_emulator
/root/build/mdns/mdns_emulator

##### Install nat-pmp Service Emulator #####
if [ ! -d /root/build/nat-pmp];then
	mkdir /root/build/nat-pmp
fi
cd /root/build/nat-pmp/ && curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/nat-pmp_emulator.c > nat-pmp_emulator.c
gcc nat-pmp_emulator.c -o nat-pmp_emulator
/root/build/nat-pmp/nat-pmp_emulator

##### Install quake Service Emulator *****
if [ ! -d /root/build/quake_emu];then
	mkdir /root/build/quake_emu
fi
cd /root/build/quake_emu && curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/quake_emulator.c > quake_emulator.c
gcc quake_emulator.c -o quake_emulator
/root/build/quake_emu/quake_emulator

##### Install ripv1 Service Emulator *****
if [ ! -d /root/build/ripv1];then
	mkdir /root/build/ripv1
fi
cd /root/build/ripv1 && curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/ripv1_emulator.c > ripv1_emulator.c
gcc ripv1_emulator.c -o ripv1_emulator
/root/build/ripv1/ripv1_emulator

###### Install sentinel Service Emulator ######
cd /root/build/
mkdir sentinel
cd /root/build/sentinel/
curl https://raw.githubusercontent.com/kingtuna/honeynet/master/emulators/sentinel_emulator.c > sentinel_emulator.c
gcc sentinel_emulator.c -o sentinel_emulator
/root/build/sentinel/sentinel_emulator

###### Install Recursive DNS ######

apt-get install bind9 dnsutils -y


echo 'include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/rndc.key";
# make it comment
# include "/etc/bind/named.conf.default-zones";
# add
include "/etc/bind/named.conf.internal-zones";
include "/etc/bind/named.conf.external-zones";' > /etc/bind/named.conf

echo '# define for internal section<commit_msg>Fixed typo in the if/then statements.<commit_after>####################################################
####                                            ####
#### Ubuntu 14.04LTS Honeypot Install Script    ####
#### Updated for 14.04 by <NAME> &    ####
#### <EMAIL>                  ####
####                                            ####
####################################################

###### Variables ######
INTERFACE='em1'
RABBIT_USER='amp'
RABBIT_PASSWORD='password'
RABBIT_HOST='1.1.1.1'

###### Get Things ######
apt-get update
apt-get -y install gcc build-essential bind9 dnsutils cmake make gcc g++ flex bison gcc
apt-get -y install libpcap-dev libgeoip-dev libssl-dev python-dev zlib1g-dev libmagic-dev 
apt-get -y install hping3 vim ntp xinetd curl default-jre git ruby swig2.0 ruby-dev
mkdir build
cd build

###### setup hostname ######

OLDHOSTNAME=`cat /etc/hostname`
echo honey`/sbin/ifconfig $INTERFACE | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`> /etc/hostname
NEWHOSTNAME=`cat /etc/hostname`
hostname $NEWHOSTNAME
cat /etc/hosts | sed  s/$OLDHOSTNAME/$NEWHOSTNAME/g > /tmp/hosts
mv -f /tmp/hosts /etc/hosts
echo -e "127.0.0.1\t$NEWHOSTNAME" >> /etc/hosts

###### Install NTP ######
mkdir build && cd build
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.6p4.tar.gz
tar zxvf ntp-4.2.6p4.tar.gz
cd ntp-4.2.6p4/
./configure --enable-clockctl
make
make install
cd ..
echo "driftfile /var/lib/ntp/ntp.drift" > /etc/ntp.conf

echo "e30003fa000100000001000000000000000000000000000000000000000000000000000000000000d6a42558d961df90" > /root/ntp.bin
/usr/local/bin/ntpd -u ntp:ntp -p /var/run/ntpd.pid -g

echo '#!/usr/bin/env bash
killall ntpd
/usr/local/bin/ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
killall sshpot
service sshpot restart
killall SSDP_Emulator
/root/build/ssdp/SSDP_Emulator
killall heartbeat_emulator
/root/build/heartbeat/heartbeat_emulator
killall mdns_emulator
/root/build/mdns/mdns_emulator
killall nat-pmp_emulator
/root/build/nat-pmp/nat-pmp_emulator
killall quake_emulator
/root/build/quake_emu/quake_emulator
killall ripv1_emulator
/root/build/ripv1/ripv1_emulator
killall sentinel_emulator
/root/build/sentinel/sentinel_emulator
/usr/sbin/hping3 --rand-source -c 600 --udp -p 123 --fast -n 127.0.0.1 -d 48 -E /root/ntp.bin' > /root/killntp.sh 
chmod +x /root/killntp.sh 

hping3 --rand-source -c 600 --udp -p 123 --fast -n 127.0.0.1 -d 48 -E /root/ntp.bin


###### Install CHARGEN ######

echo 'service chargen
{
    disable = yes
    type = INTERNAL
    id = chargen-stream
    socket_type = stream
    protocol = tcp
    user = root
    wait = no
}                                                                               

# This is the udp version.
service chargen
{
    disable = no
    type = INTERNAL
    id = chargen-dgram
    socket_type = dgram
    protocol = udp
    user = root
    wait = yes
}' > /etc/xinetd.d/chargen 

service xinetd restart

###### Install SSDP Service Emulator ######
cd /root/build/
mkdir ssdp
cd /root/build/ssdp/
curl https://raw.githubusercontent.com/kingtuna/honeynet/master/emulators/SSDP_Emulator.c > SSDP_Emulator.c
gcc SSDP_Emulator.c -o SSDP_Emulator
/root/build/ssdp/SSDP_Emulator

###### Install heartbeat_emulator #######
if [ ! -d /root/build/heartbeat ]; then
	mkdir /root/build/hearbeat
fi
cd /root/build/heartbeat/
curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/heartbeat_emulator.c > heartbeat_emulator.c
gcc heartbeat_emulator.c -o heartbeat_emulator
/root/build/heartbeat/heartbeat_emulator

###### Install mdns Service Emulator #######
if [ ! -d /root/build/mdns ]; then
	mkdir /root/build/mdns
fi
cd /root/build/mdns/
curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/mdns_emulator.c > mdns_emulator.c
gcc mdns_emulator.c -o mdns_emulator
/root/build/mdns/mdns_emulator

##### Install nat-pmp Service Emulator #####
if [ ! -d /root/build/nat-pmp ]; then
	mkdir /root/build/nat-pmp
fi
cd /root/build/nat-pmp/ && curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/nat-pmp_emulator.c > nat-pmp_emulator.c
gcc nat-pmp_emulator.c -o nat-pmp_emulator
/root/build/nat-pmp/nat-pmp_emulator

##### Install quake Service Emulator *****
if [ ! -d /root/build/quake_emu ]; then
	mkdir /root/build/quake_emu
fi
cd /root/build/quake_emu && curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/quake_emulator.c > quake_emulator.c
gcc quake_emulator.c -o quake_emulator
/root/build/quake_emu/quake_emulator

##### Install ripv1 Service Emulator *****
if [ ! -d /root/build/ripv1 ]; then
	mkdir /root/build/ripv1
fi
cd /root/build/ripv1 && curl https://raw.githubusercontent.com/kingtuna/Hybrid-Darknet-Concept/master/emulators/ripv1_emulator.c > ripv1_emulator.c
gcc ripv1_emulator.c -o ripv1_emulator
/root/build/ripv1/ripv1_emulator

###### Install sentinel Service Emulator ######
cd /root/build/
mkdir sentinel
cd /root/build/sentinel/
curl https://raw.githubusercontent.com/kingtuna/honeynet/master/emulators/sentinel_emulator.c > sentinel_emulator.c
gcc sentinel_emulator.c -o sentinel_emulator
/root/build/sentinel/sentinel_emulator

###### Install Recursive DNS ######

apt-get install bind9 dnsutils -y


echo 'include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/rndc.key";
# make it comment
# include "/etc/bind/named.conf.default-zones";
# add
include "/etc/bind/named.conf.internal-zones";
include "/etc/bind/named.conf.external-zones";' > /etc/bind/named.conf

echo '# define for internal section
{'fraction_non_alphanumeric': 0.16131334760885083, 'fraction_numerical': 0.030870806566738043, 'mean_word_length': 3.5454176804541766, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 39, 'https://': 14, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '877936', 'n_tokens_mistral': 4451, 'n_tokens_neox': 4086, 'n_words': 819}