Skip to content

Commit

Permalink
Update iosxe-scanner.py
Browse files Browse the repository at this point in the history
Added default timeout and fixed SSL Warnings.
  • Loading branch information
Shadow0pz authored Oct 24, 2023
1 parent ad56bfd commit 09ade56
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions iosxe-scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@
#Please review the README.md for details on usage of this script.
#Shout out to mRr3b00t AKA @UK_Daniel_Card (Twitter/X) for all his great analysis of this exploit.


import sys
import argparse
import requests
import ipaddress
import urllib3 # Import this to disable SSL warnings
from termcolor import colored
from tqdm import tqdm
import threading
import time

# Disable SSL Warnings
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

# Import and handle missing packages
try:
from requests.exceptions import RequestException
Expand All @@ -26,31 +31,32 @@
# Create a global lock for thread-safe file writing
file_lock = threading.Lock()

#Check for a specified IOC.txt file. If not found then set the default IOC's.
# Check for a specified IOC.txt file. If not found then set the default IOC's.
def read_iocs_from_file(iocs_file):
try:
with open(iocs_file, "r") as f:
return f.read().splitlines()
except FileNotFoundError:
return ["<h1>404 Not Found</h1>", "openresty", "nginx"]

def is_compromised(session, url, headers, proxies, iocs) -> bool:
# Modified is_compromised function with added timeout
def is_compromised(session, url, headers, proxies, iocs, timeout=10) -> bool:
try:
response = session.get(url, headers=headers, verify=False, proxies=proxies)
response = session.get(url, headers=headers, verify=False, proxies=proxies, timeout=timeout)
for ioc in iocs:
if ioc in response.text:
return True
except RequestException as e:
print(f" Error: {e}")
return False

#Log all the things.
# Log all the things.
def log_to_file(logfile, message):
with file_lock:
with open(logfile, "a") as f:
f.write(message + "\n")

#This is where the work is done.
# This is where the work is done.
def check_target(target, args, session, iocs):
time.sleep(args.rate_limit)
http_url = f"http://{target.strip()}/%25"
Expand Down

0 comments on commit 09ade56

Please sign in to comment.