INNER CODE UNIT · Python

update_opencti

montysecurity/C2-Tracker · opencti-connector/src/connector.py:60

def update_opencti(current_opencti_c2_tracker_indicators):
    # Create variable to hold all IPs
    # will be used to compare against current IPs in OpenCTI
    # Will delete any IPs in OpenCTI and not in the all_ips variable
    url = "https://github.com/montysecurity/C2-Tracker/tree/main/data"
    request = requests.get(url)
    # Get all file names ending in " IPs.txt"
    tools = list(set(re.findall("\"[\w|\s|\d|\.]+IPs\.txt\"", request.text)))
    # Strip quotes
    i = 0
    for tool in tools:
        tools[i] = str(tool).strip('"')
        i += 1
    for tool in tools:
        url = str("https://raw.githubusercontent.com/montysecurity/C2-Tracker/main/data/" + str(tool).replace(" ", "%20"))
        request = requests.get(url)
        # Remove " IPs.txt"
        tool = str(tool)[:-8]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…