-
Notifications
You must be signed in to change notification settings - Fork 1
/
AvdSidlister_v0.py
96 lines (75 loc) · 3.15 KB
/
AvdSidlister_v0.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Import necessary libraries
import sublist3r
import requests
from subprocess import Popen, PIPE
from bs4 import BeautifulSoup
import pyfiglet
import sys
import os
import signal
from prettytable import PrettyTable
# Function to display the tool's introduction
def show_intro():
intro_message = pyfiglet.figlet_format("Tool By Siddharth Kumar", font="mini", justify="center")
intro_message = f"\033[91m{intro_message}\033[0m"
p1 = Popen(["fortune"], stdout=PIPE)
p2 = Popen(["cowsay", "-f", "dragon"], stdin=p1.stdout, stdout=PIPE)
p1.stdout.close()
output = p2.communicate()[0]
print(output.decode("utf-8"))
print(intro_message)
# Function to find subdomains
def find_subdomains(domain):
subdomains = set()
try:
url = f'https://crt.sh/?q=%.{domain}&output=json'
response = requests.get(url)
data = response.json()
# Stage 1: Fetching subdomains from crt.sh
for entry in data:
subdomain = entry['name_value']
subdomains.add(subdomain)
except Exception as e:
print(f"Error: {e}")
return subdomains
# Main function
def main():
try:
os.system('clear') # Clear the terminal
show_intro()
# Input prompts for domain and output file
domain = input("Enter the domain name without protocol names (http/https): ")
if not domain:
print("Please provide a domain name.")
return
output_directory = "Sid.Out" # Directory where output files will be saved
os.makedirs(output_directory, exist_ok=True) # Create the output directory if it doesn't exist
output_file = os.path.join(output_directory, "subdomain_results.html") # Output file path
backup_file = os.path.join(output_directory, "HackBack.txt") # Backup file path
subdomains1 = sublist3r.main(domain, 40, None, None, False, False, False, None)
subdomains2 = find_subdomains(domain)
subdomains_combined = subdomains1.union(subdomains2)
# Stage 2: Creating a PrettyTable
table = PrettyTable()
table.field_names = ["#", "Subdomain"]
# Populate the table with sorted subdomains
sorted_subdomains = sorted(subdomains_combined)
for index, subdomain in enumerate(sorted_subdomains, start=1):
table.add_row([index, subdomain])
# Print the table to the terminal
print(table)
# Save the table to the output file
with open(output_file, 'w') as file:
file.write(table.get_html_string())
# Save the normal output to a backup file
with open(backup_file, 'w') as backup_file:
for subdomain in sorted_subdomains:
backup_file.write(subdomain + "\n")
print(f"Results saved to {output_file}")
print(f"Normal output saved to {backup_file}")
except KeyboardInterrupt:
print("\033[91mGoodbye\033[0m")
sys.exit(0)
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal.SIG_IGN) # Ignore Ctrl+C during program execution
main()