Last active
August 19, 2022 21:48
-
-
Save Droogy/4c8a697be03b6d43157a50342943f2ec to your computer and use it in GitHub Desktop.
Normalize threat feed data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
import pandas as pd | |
df = pd.read_csv("https://raw.githubusercontent.com/drb-ra/C2IntelFeeds/master/C2_configs/cobaltstrike.csv", usecols=["FirstSeen", "ip"]) | |
df.drop_duplicates(subset="ip").to_csv("C2_masterlist.csv", index=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
import pandas as pd | |
from datetime import date | |
new_df = pd.read_csv("https://raw.githubusercontent.com/drb-ra/C2IntelFeeds/master/C2_configs/cobaltstrike.csv", usecols=["FirstSeen", "ip"]) | |
old_df = pd.read_csv("C2_masterlist.csv", usecols=["ip"]) | |
new_ips = open("newIps.txt", "a") | |
newIPs_df = new_df[~new_df["ip"].isin(old_df["ip"])] | |
newIPs_list = newIPs_df["ip"].unique().tolist() | |
new_ips.write(f"New IPs seen for {date.today()}\n=====\n{chr(10).join(newIPs_list)}\n\n") | |
newIPs_df.to_csv("C2_masterlist.csv", mode="a", index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment