Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update main.py #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import urllib.request
from urllib.parse import quote
import json
import re

##########################
# Config section
Expand Down Expand Up @@ -76,7 +77,14 @@ def logData(querystring, postdata, ip,raw):
data['event_type'] = "alert"
data['src_ip'] = ip
data['src_port'] = srcport
data['dest_ip'] = hostip
# data['dest_ip'] = hostip
urlparts = request.environ.get('bottle.request.urlparts')
pattern = re.compile(r"(?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d?\d)")
destip = str(pattern.search(str(urlparts)).group())
if destip == None :
data['dest_ip'] = hostip
else:
data['dest_ip'] = destip
data['dest_port'] = hostport
data2 = {}
data2['name'] = "Elasticpot"
Expand Down Expand Up @@ -333,4 +341,4 @@ def pluginhead():
# done Initialization

# run server
run(host='0.0.0.0', port=hostport)
run(host='0.0.0.0', port=hostport)