-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcery refactored main branch #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,12 +21,12 @@ class c: | |
UNDERLINE = '\033[4m' | ||
|
||
def ctrl_c(sig, frame): | ||
sys.exit(c.RED + "[!] Interrupt handler received, exiting..." + c.END) | ||
sys.exit(f"{c.RED}[!] Interrupt handler received, exiting...{c.END}") | ||
|
||
signal.signal(signal.SIGINT, ctrl_c) | ||
|
||
def banner(): | ||
print(c.YELLOW + ' _____ ') | ||
print(f'{c.YELLOW} _____ ') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
print(' .-" "-. ') | ||
print(' / o o \ ') | ||
print(' / \ / \ ') | ||
|
@@ -92,24 +92,34 @@ def axfr(domain): | |
sleep(0.5) | ||
ns_answer = dns.resolver.resolve(domain, 'NS') | ||
for server in ns_answer: | ||
print(c.YELLOW + "[*] Found NS: {}".format(server) + c.END) | ||
print(c.YELLOW + f"[*] Found NS: {server}" + c.END) | ||
ip_answer = dns.resolver.resolve(server.target, 'A') | ||
for ip in ip_answer: | ||
print(c.YELLOW + "[*] IP for {} is {}".format(server, ip) + c.END) | ||
print(c.YELLOW + f"[*] IP for {server} is {ip}" + c.END) | ||
try: | ||
zone = dns.zone.from_xfr(dns.query.xfr(str(ip), domain)) | ||
for host in zone: | ||
print(c.YELLOW + "[" + c.END + c.GREEN + "+" + c.END + c.YELLOW + "] Found Host: {}".format(host) + c.END) | ||
print( | ||
f"{c.YELLOW}[{c.END}{c.GREEN}+{c.END}{c.YELLOW}" | ||
+ f"] Found Host: {host}" | ||
+ c.END | ||
) | ||
|
||
except Exception as e: | ||
print(c.YELLOW + "[" + c.END + c.RED + "-" + c.END + c.YELLOW + "] NS {} refused zone transfer!".format(server) + c.END) | ||
print( | ||
f"{c.YELLOW}[{c.END}{c.RED}-{c.END}{c.YELLOW}" | ||
+ f"] NS {server} refused zone transfer!" | ||
+ c.END | ||
) | ||
|
||
Comment on lines
-95
to
+114
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
continue | ||
|
||
def SDom(domain,filename): | ||
banner() | ||
print(c.BLUE + "\n[" + c.END + c.GREEN + "+" + c.END + c.BLUE + "] Discovering valid subdomains...\n" + c.END) | ||
sleep(0.5) | ||
|
||
r = requests.get("https://crt.sh/?q=" + domain + "&output=json", timeout=20) | ||
r = requests.get(f"https://crt.sh/?q={domain}&output=json", timeout=20) | ||
Comment on lines
-112
to
+122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
formatted_json = json.dumps(json.loads(r.text), indent=4) | ||
domains = re.findall(r'"common_name": "(.*?)"', formatted_json) | ||
|
||
|
@@ -118,31 +128,31 @@ def SDom(domain,filename): | |
if filename != None: | ||
f = open(filename, "a") | ||
|
||
print(c.YELLOW + "+" + "-"*39 + "+") | ||
print(f"{c.YELLOW}+" + "-"*39 + "+") | ||
for value in doms: | ||
if not value.startswith('*' + "." + domain): | ||
|
||
if len(value) >= 10 and len(value) <= 14: | ||
l = len(value) | ||
print("| " + value + " \t\t\t|") | ||
print(f"| {value}" + " \t\t\t|") | ||
if filename != None: | ||
f.write(value + "\n") | ||
|
||
if len(value) >= 15 and len(value) <= 19: | ||
l = len(value) | ||
print("| " + value + "\t\t\t|") | ||
print(f"| {value}" + "\t\t\t|") | ||
if filename != None: | ||
f.write(value + "\n") | ||
|
||
if len(value) >= 20 and len(value) <= 24: | ||
l = len(value) | ||
print("| " + value + " \t\t|") | ||
print(f"| {value}" + " \t\t|") | ||
if filename != None: | ||
f.write(value + "\n") | ||
|
||
if len(value) >= 25 and len(value) <= 29: | ||
l = len(value) | ||
print("| " + value + "\t\t|") | ||
print(f"| {value}" + "\t\t|") | ||
if filename != None: | ||
f.write(value + "\n") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
ctrl_c
refactored with the following changes:use-fstring-for-concatenation
)