prepare for honeypy

This commit is contained in:
t3chn0m4g3 2019-03-10 18:15:59 +00:00
parent d9e5331a84
commit 6f30322ad5
7 changed files with 41 additions and 4 deletions

View file

@ -154,6 +154,14 @@ fuHERALDING () {
chown tpot:tpot /data/heralding -R chown tpot:tpot /data/heralding -R
} }
# Let's create a function to clean up and prepare honeypy data
fuHONEYPY () {
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/honeypy/*; fi
mkdir -p /data/honeypy/log
chmod 760 /data/honeypy -R
chown tpot:tpot /data/honeypy -R
}
# Let's create a function to clean up and prepare honeytrap data # Let's create a function to clean up and prepare honeytrap data
fuHONEYTRAP () { fuHONEYTRAP () {
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/honeytrap/*; fi if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/honeytrap/*; fi
@ -258,6 +266,7 @@ if [ "$myPERSISTENCE" = "on" ];
fuGLASTOPF fuGLASTOPF
fuGLUTTON fuGLUTTON
fuHERALDING fuHERALDING
fuHONEYPY
fuHONEYTRAP fuHONEYTRAP
fuMAILONEY fuMAILONEY
fuMEDPOT fuMEDPOT

View file

@ -4,7 +4,8 @@ FROM alpine
ADD dist/ /root/dist/ ADD dist/ /root/dist/
# Setup env and apt # Setup env and apt
RUN apk -U add \ RUN sed -i 's/dl-cdn/dl-4/g' /etc/apk/repositories && \
apk -U --no-cache add \
bash \ bash \
curl \ curl \
git \ git \

View file

@ -76,6 +76,13 @@ input {
type => "Heralding" type => "Heralding"
} }
# Honeypy
file {
path => ["/data/honeypy/log/json.log"]
codec => json
type => "Honeypy"
}
# Honeytrap # Honeytrap
file { file {
path => ["/data/honeytrap/log/attackers.json"] path => ["/data/honeytrap/log/attackers.json"]
@ -266,6 +273,17 @@ filter {
} }
} }
# Honeypy
if [type] == "Honeypy" {
date {
match => [ "timestamp", "ISO8601" ]
remove_field => ["timestamp"]
remove_field => ["date"]
remove_field => ["time"]
remove_field => ["millisecond"]
}
}
# Honeytrap # Honeytrap
if [type] == "Honeytrap" { if [type] == "Honeytrap" {
date { date {
@ -388,7 +406,7 @@ if "_grokparsefailure" in [tags] { drop {} }
} }
# Add T-Pot hostname and external IP # Add T-Pot hostname and external IP
if [type] == "Adbhoney" or [type] == "Ciscoasa" or [type] == "ConPot" or [type] == "Cowrie" or [type] == "Dionaea" or [type] == "ElasticPot" or [type] == "Glastopf" or [type] == "Glutton" or [type] == "Honeytrap" or [type] == "Heralding" or [type] == "Mailoney" or [type] == "Medpot" or [type] == "P0f" or [type] == "Rdpy" or [type] == "Suricata" or [type] == "Tanner" { if [type] == "Adbhoney" or [type] == "Ciscoasa" or [type] == "ConPot" or [type] == "Cowrie" or [type] == "Dionaea" or [type] == "ElasticPot" or [type] == "Glastopf" or [type] == "Glutton" or [type] == "Honeytrap" or [type] == "Heralding" or [type] == "Honeypy" or [type] == "Mailoney" or [type] == "Medpot" or [type] == "P0f" or [type] == "Rdpy" or [type] == "Suricata" or [type] == "Tanner" {
mutate { mutate {
add_field => { add_field => {
"t-pot_ip_ext" => "${MY_EXTIP}" "t-pot_ip_ext" => "${MY_EXTIP}"

View file

@ -20,6 +20,14 @@ RUN sed -i 's/dl-cdn/dl-4/g' /etc/apk/repositories && \
# Clone honeypy from git # Clone honeypy from git
git clone --depth=1 https://github.com/foospidy/HoneyPy /opt/honeypy && \ git clone --depth=1 https://github.com/foospidy/HoneyPy /opt/honeypy && \
cd /opt/honeypy && \ cd /opt/honeypy && \
sed -i 's/local_host/dest_ip/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/local_port/dest_port/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/remote_host/src_ip/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/remote_port/src_port/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/service/proto/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/event/event_type/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/bytes/size/g' /opt/honeypy/loggers/file/honeypy_file.py && \
sed -i 's/date_time/timestamp/g' /opt/honeypy/loggers/file/honeypy_file.py && \
virtualenv env && \ virtualenv env && \
cp /root/dist/services.cfg /opt/honeypy/etc && \ cp /root/dist/services.cfg /opt/honeypy/etc && \
cp /root/dist/honeypy.cfg /opt/honeypy/etc && \ cp /root/dist/honeypy.cfg /opt/honeypy/etc && \
@ -40,8 +48,6 @@ RUN sed -i 's/dl-cdn/dl-4/g' /etc/apk/repositories && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
# Set workdir and start mailoney # Set workdir and start mailoney
#STOPSIGNAL SIGINT
USER honeypy:honeypy USER honeypy:honeypy
WORKDIR /opt/honeypy WORKDIR /opt/honeypy
#EXPOSE 7 8 23 24 25 69 80 123 2048 4096 5060 9200
CMD ["/opt/honeypy/env/bin/python2", "/opt/honeypy/Honey.py", "-d"] CMD ["/opt/honeypy/env/bin/python2", "/opt/honeypy/Honey.py", "-d"]

View file

@ -22,6 +22,7 @@
/data/glutton/log/*.err /data/glutton/log/*.err
/data/heralding/log/*.log /data/heralding/log/*.log
/data/heralding/log/*.csv /data/heralding/log/*.csv
/data/honeypy/log/*.log
/data/honeytrap/log/*.log /data/honeytrap/log/*.log
/data/honeytrap/log/*.json /data/honeytrap/log/*.json
/data/honeytrap/attacks.tgz /data/honeytrap/attacks.tgz

View file

@ -751,6 +751,7 @@ mkdir -p /data/adbhoney/downloads /data/adbhoney/log \
/data/honeytrap/log/ /data/honeytrap/attacks/ /data/honeytrap/downloads/ \ /data/honeytrap/log/ /data/honeytrap/attacks/ /data/honeytrap/downloads/ \
/data/glutton/log \ /data/glutton/log \
/data/heralding/log \ /data/heralding/log \
/data/honeypy/log \
/data/mailoney/log \ /data/mailoney/log \
/data/medpot/log \ /data/medpot/log \
/data/nginx/log \ /data/nginx/log \

View file

@ -213,6 +213,7 @@ mkdir -p /data/adbhoney/downloads /data/adbhoney/log \
/data/honeytrap/log/ /data/honeytrap/attacks/ /data/honeytrap/downloads/ \ /data/honeytrap/log/ /data/honeytrap/attacks/ /data/honeytrap/downloads/ \
/data/glutton/log \ /data/glutton/log \
/data/heralding/log \ /data/heralding/log \
/data/honeypy/log \
/data/mailoney/log \ /data/mailoney/log \
/data/medpot/log \ /data/medpot/log \
/data/nginx/log \ /data/nginx/log \