Skip to content
Browse files

Changes made to log module to prevent crash when a new botnet is adde…

…d to db
  • Loading branch information...
1 parent 682f084 commit 92b4d82145817e7a7c505a573a0fd6e4605774b8 pjlantz committed Mar 27, 2012
View
2 src/conf/hale.conf
@@ -1,5 +1,5 @@
[client]
-server = serverhost
+server = localhost
port = 7080
[server]
View
2 src/conf/modules.conf
@@ -26,7 +26,7 @@ pong_grammar = PONG
[httpConf]
module = http
-botnet = pjlantz.com
+botnet = host.com
path = /stat.php
port = 80
useragent = None
View
12 src/utils/logHandler.py
@@ -61,14 +61,13 @@ def putToDB(self, data, botnethash, conf):
confStr = configHandler.ConfigHandler().getStrFromDict(conf, toDB=True)
coord = self.geo.record_by_name(conf['botnet'])
-
- (b, created) = Botnet.objects.get_or_create(botnethashvalue = botnethash)
+ print "Long: " + str(coord['longitude'])
+ print "Lat: " + str(coord['latitude'])
+ (b, created) = Botnet.objects.get_or_create(botnethashvalue = botnethash, defaults={'longitude': coord['longitude'], 'latitude':coord['latitude']})
if not created:
b.botnettype = conf['module']
b.host = conf['botnet']
b.config = confStr
- b.longitude = coord['longitude']
- b.latitude = coord['latitude']
b.save()
botnetobject = Botnet.objects.get(botnethashvalue=botnethash)
@@ -108,11 +107,12 @@ def putToDB(self, ips, botnethash):
Put the ips found in the db
"""
- botnetobject = Botnet.objects.get(botnethashvalue=botnethash)
+ (b, created) = Botnet.objects.get_or_create(botnethashvalue = botnethash)
+ #botnetobject = Botnet.objects.get(botnethashvalue=botnethash)
ips = ips[2]
for ip in ips:
try:
- RelatedIPs(botnet=botnetobject, ip=ip).save()
+ RelatedIPs(botnet=b, ip=ip).save()
except IntegrityError:
pass
View
0 src/webdb/modules/__init__.py
No changes.
View
2 src/webdb/settings.py
@@ -15,7 +15,7 @@
'NAME': '', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
- 'HOST': 's', # Set to empty string for localhost. Not used with sqlite3.
+ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}

0 comments on commit 92b4d82

Please sign in to comment.
Something went wrong with that request. Please try again.