Skip to content

Commit

Permalink
Update subt.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dalpan authored Jul 18, 2024
1 parent 71cf788 commit 6b3a251
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions subt.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def load_vulnerable_domains():
except yaml.YAMLError as e:
print(f"Error reading {filename}: {e}")

# Menambahkan entri dinamis
vulnerable_domains.append({'cname': 'github.io', 'status_code': 404, 'status': 'vulnerable can be takeover!'})

return vulnerable_domains

def subfinder_scan(domain):
Expand Down Expand Up @@ -81,7 +84,8 @@ def main(input, listdomains=False, direct_subdomains=False):
▀▄▄▄▄▄▀▀▄▄▄▄▀▀▄▄▄▄▀▀▀▄▄▄▀▀
Subdomain Takeover Scanner
= Author by Van | Tegalsec
Author by Van | Tegalsec
--------------------------
''' + Style.RESET_ALL)

if listdomains:
Expand All @@ -92,23 +96,29 @@ def main(input, listdomains=False, direct_subdomains=False):
for domain in domains:
subdomains = subfinder_scan(domain)
if subdomains:
print(Fore.CYAN + f"[+] Checking subdomains for domain: {domain}" + Style.RESET_ALL)
print(Fore.CYAN + f"\n[+] Checking subdomains for domain: {domain}" + Style.RESET_ALL)
found_vulnerable = False
for subdomain in subdomains:
cname, status_code = check_subdomain(subdomain)
if cname is not None and status_code != 0:
is_vulnerable = False
for domain_info in vulnerable_domains:
if domain_info['cname'] in cname and domain_info['status_code'] == status_code:
print(Fore.YELLOW + f"{subdomain} [{status_code}] | {domain_info['status']} [{domain_info['cname']}]" + Style.RESET_ALL)
print(Fore.RED + f"{subdomain} [{status_code}] | {domain_info['status']} [{domain_info['cname']}]" + Style.RESET_ALL)
found_vulnerable = True
is_vulnerable = True
break
# Cek untuk CNAME dinamis
elif '*' in domain_info['cname'] and domain_info['cname'].replace('*', '') in cname and domain_info['status_code'] == status_code:
print(Fore.RED + f"{subdomain} [{status_code}] | {domain_info['status']} [{domain_info['cname']}]" + Style.RESET_ALL)
found_vulnerable = True
is_vulnerable = True
break
if not is_vulnerable:
print(Fore.RED + f"{subdomain} [{status_code}] | Not vulnerable" + Style.RESET_ALL)
print(Fore.GREEN + f"{subdomain} [{status_code}] | Not vulnerable" + Style.RESET_ALL)

if not found_vulnerable:
print(Fore.RED + "No vulnerable subdomains found." + Style.RESET_ALL)
print(Fore.GREEN + "No vulnerable subdomains found." + Style.RESET_ALL)

elif direct_subdomains:
print(Fore.GREEN + "[+] Checking direct list of subdomains..." + Style.RESET_ALL)
Expand All @@ -124,15 +134,21 @@ def main(input, listdomains=False, direct_subdomains=False):
is_vulnerable = False
for domain_info in vulnerable_domains:
if domain_info['cname'] in cname and domain_info['status_code'] == status_code:
print(Fore.BLUE + f"{subdomain} [{status_code}] | {domain_info['status']} [{domain_info['cname']}]" + Style.RESET_ALL)
print(Fore.RED + f"{subdomain} [{status_code}] | {domain_info['status']} [{domain_info['cname']}]" + Style.RESET_ALL)
found_vulnerable = True
is_vulnerable = True
break
# Cek untuk CNAME dinamis
elif '*' in domain_info['cname'] and domain_info['cname'].replace('*', '') in cname and domain_info['status_code'] == status_code:
print(Fore.RED + f"{subdomain} [{status_code}] | {domain_info['status']} [{domain_info['cname']}]" + Style.RESET_ALL)
found_vulnerable = True
is_vulnerable = True
break
if not is_vulnerable:
print(Fore.RED + f"{subdomain} [{status_code}] | Not vulnerable" + Style.RESET_ALL)
print(Fore.GREEN + f"{subdomain} [{status_code}] | Not vulnerable" + Style.RESET_ALL)

if not found_vulnerable:
print(Fore.YELLOW + "No vulnerable subdomains found." + Style.RESET_ALL)
print(Fore.GREEN + "No vulnerable subdomains found." + Style.RESET_ALL)

else:
# Single domain input or direct subdomain list
Expand All @@ -155,6 +171,12 @@ def main(input, listdomains=False, direct_subdomains=False):
found_vulnerable = True
is_vulnerable = True
break
# Cek untuk CNAME dinamis
elif '*' in domain_info['cname'] and domain_info['cname'].replace('*', '') in cname and domain_info['status_code'] == status_code:
print(Fore.RED + f"{subdomain} [{status_code}] | {domain_info['status']} [{domain_info['cname']}]" + Style.RESET_ALL)
found_vulnerable = True
is_vulnerable = True
break
if not is_vulnerable:
print(Fore.GREEN + f"{subdomain} [{status_code}] | Not vulnerable" + Style.RESET_ALL)

Expand Down

0 comments on commit 6b3a251

Please sign in to comment.