Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ aws cloudformation deploy \
### Categorized Threat Lists API
- **Endpoint:** GTI Threat Lists API
- **Granularity:** Hourly buckets (format: `YYYYMMDDHH`)
- **Delay:** Threat lists are fetched up to 2 hours behind the current UTC hour (latest hour fetched = `now - 2h`)
- **Pagination:** Up to 4,000 IOCs per request
- **Checkpointing:** Tracks last processed hour per category

Expand Down
6 changes: 3 additions & 3 deletions cloud-formation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ Resources:

# Fetch data for each hour from start_ts to time_stamp
current = start_dt
while current < current_dt:
while current <= current_dt:
hour_ts = current.strftime("%Y%m%d%H")
self._process_single_hour_threat_list(category, hour_ts, checkpoint)
current += timedelta(hours=1)
Expand All @@ -1026,10 +1026,10 @@ Resources:
def fetch_threat_list_iocs(self, checkpoint: dict):
"""
Fetch categorized threat lists.
Only pulls categories from last hour.
Only pulls hourly threat lists up to 2 hours before the current UTC hour.
"""

current_ts = datetime.now(timezone.utc).strftime("%Y%m%d%H")
current_ts = (datetime.now(timezone.utc) - timedelta(hours=2)).strftime("%Y%m%d%H")
print(f"[INFO] Fetching threat lists | timestamp={current_ts}")

categories: set[str] = set()
Expand Down
6 changes: 3 additions & 3 deletions lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def fetch_single_threat_list(self, category, time_stamp, checkpoint: dict):

# Fetch data for each hour from start_ts to time_stamp
current = start_dt
while current < current_dt:
while current <= current_dt:
hour_ts = current.strftime("%Y%m%d%H")
self._process_single_hour_threat_list(category, hour_ts, checkpoint)
current += timedelta(hours=1)
Expand All @@ -571,10 +571,10 @@ def fetch_single_threat_list(self, category, time_stamp, checkpoint: dict):
def fetch_threat_list_iocs(self, checkpoint: dict):
"""
Fetch categorized threat lists.
Only pulls categories from last hour.
Only pulls hourly threat lists up to 2 hours before the current UTC hour.
"""

current_ts = datetime.now(timezone.utc).strftime("%Y%m%d%H")
current_ts = (datetime.now(timezone.utc) - timedelta(hours=2)).strftime("%Y%m%d%H")
print(f"[INFO] Fetching threat lists | timestamp={current_ts}")

categories: set[str] = set()
Expand Down
Loading