Compare commits

...

5 Commits

Author SHA1 Message Date
Steve Clement a196e4a2fa
Merge pull request #161 from whoisroot/main
Fixing filters and redis GEOADD command
2021-12-31 11:44:34 +09:00
Lucas Magalhães 7f3a05ffc0 Fix filters - part 2
Org and Orgc are objects on events, and the match is to be applied to id, name or uuid for easier usage of the filters.

Also, I could not find occurences of Org or Orgc outside of Event, so I removed them from the list too.
2021-12-22 13:45:03 -03:00
Lucas Magalhães a722be21be Ignore redis database dump 2021-12-21 04:16:59 +00:00
Lucas Magalhães e852c477ad Fix filters
To compare for "not equal" values you should invert the match, not directly compare with the string prepended with "!".
2021-12-21 00:20:30 +00:00
Lucas Magalhães 100948b4df Fix redis GEOADD
Redis python interface only accepts two arguments, the keyname to store in redis and a value-list with the coordinates and content to which the coordinates refer, in groups of three.
2021-12-14 23:46:18 +00:00
4 changed files with 16 additions and 13 deletions

3
.gitignore vendored
View File

@ -12,6 +12,9 @@ config/config.cfg
# ignore GeoLite DB
data/GeoLite2-City*
# ignore redis database dump
data/dump.rdb
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

View File

@ -208,11 +208,15 @@ class Geo_helper:
today_str = util.getDateStrFormat(now)
keyname = "{}:{}".format(keyCateg, today_str)
try:
self.serv_redis_db.geoadd(keyname, lon, lat, content)
self.serv_redis_db.geoadd(keyname, [lon, lat, content])
except redis.exceptions.ResponseError as error:
print(error)
print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.")
print("To test for support: echo \"help GEOADD\"| redis-cli")
except redis.exceptions.DataError as error:
print(error)
print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.")
print("To test for support: echo \"help GEOADD\"| redis-cli")
self.logger.debug('Added to redis: keyname={}, lon={}, lat={}, content={}'.format(keyname, lon, lat, content))
def push_to_redis_zset(self, keyCateg, toAdd, endSubkey="", count=1):

View File

@ -304,7 +304,7 @@ class LogItem():
def pass_filter(self):
for filter, filterValue in self.filters.items():
jsonValue = util.getFields(self.feed, filter)
if jsonValue is None or jsonValue != filterValue:
if jsonValue is None or ("!" not in filterValue and jsonValue != filterValue) or ("!" in filterValue and jsonValue == filterValue.strip("!")):
return False
return True

View File

@ -748,8 +748,12 @@ $(document).ready(function() {
'Attribute.type',
'Attribute.uuid',
'Attribute.value',
'Event.Org',
'Event.Orgc',
'Event.Org.id',
'Event.Org.name',
'Event.Org.uuid',
'Event.Orgc.id',
'Event.Orgc.name',
'Event.Orgc.uuid',
'Event.analysis',
'Event.attribute_count',
'Event.date',
@ -760,8 +764,6 @@ $(document).ready(function() {
'Event.id',
'Event.info',
'Event.locked',
'Event.org_id',
'Event.orgc_id',
'Event.proposal_email_lock',
'Event.publish_timestamp',
'Event.published',
@ -769,13 +771,7 @@ $(document).ready(function() {
'Event.threat_level_id',
'Event.Tag.name',
'Event.timestamp',
'Event.uuid',
'Org.id',
'Org.name',
'Org.uuid',
'Orgc.id',
'Orgc.name',
'Orgc.uuid'
'Event.uuid'
].forEach(function(field) {
var tempFilter = {
"input": "text",