Skip to content

Commit

Permalink
chg: [dashboard] filter submission tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed Dec 9, 2024
1 parent 9dde795 commit feabe9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions bin/lib/Tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
r_cache = config_loader.get_redis_conn("Redis_Cache")
config_loader = None

TAGS_TO_EXCLUDE_FROM_DASHBOARD = {'infoleak:submission="crawler"', 'infoleak:submission="manual"'}

#### CORE FUNCTIONS ####

# # # # UNSAFE TAGS # # # #
Expand Down Expand Up @@ -712,8 +714,9 @@ def add_object_tag(tag, obj_type, obj_id, subtype=''):
# STATS
r_tags.hincrby(f'daily_tags:{datetime.date.today().strftime("%Y%m%d")}', tag, 1)
mess = f'{int(time.time())}:{obj_type}:{subtype}:{obj_id}'
r_tags.lpush('dashboard:tags', mess)
r_tags.ltrim('dashboard:tags', 0, 19)
if tag not in TAGS_TO_EXCLUDE_FROM_DASHBOARD:
r_tags.lpush('dashboard:tags', mess)
r_tags.ltrim('dashboard:tags', 0, 19)

def get_tags_dashboard():
return r_tags.lrange('dashboard:tags', 0, -1)
Expand Down
6 changes: 3 additions & 3 deletions bin/modules/Tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The Tags Module
================================
This module add tags to an item.
This module add tags to an object.
"""

Expand Down Expand Up @@ -36,11 +36,11 @@ def __init__(self):
self.logger.info(f'Module {self.module_name} initialized')

def compute(self, message):
item = self.obj
obj = self.obj
tag = message

# Create a new tag
item.add_tag(tag)
obj.add_tag(tag)
print(f'{self.obj.get_global_id()}: Tagged {tag}')

# Forward message to channel
Expand Down

0 comments on commit feabe9f

Please sign in to comment.