Skip to content
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

Fix syntax warning and subdomains #56

Merged
merged 4 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .github/dependabot.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .mergify.yml

This file was deleted.

Binary file modified assets/dir.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/subdomain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 38 additions & 19 deletions dirMagic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from rich.console import Console

def header():
print("""
print(r"""
_______ __ .______ .___ ___. ___ _______ __ ______
| \ | | | _ \ | \/ | / \ / _____|| | / |
| .--. || | | |_) | | \ / | / ^ \ | | __ | | | ,----'
Expand Down Expand Up @@ -34,11 +34,11 @@ def find_dir():

for directory in directories:
directory = directory.strip()
response = requests.get(url+directory)
response = requests.get(url + directory)

if response.status_code != 404:
print("{} - {}".format(url+directory, response.status_code))
all_results.append("{} - {}".format(url+directory, response.status_code))
print("{} - {}".format(url + directory, response.status_code))
all_results.append("{} - {}".format(url + directory, response.status_code))

with open("directories_found.txt", 'w') as file:
for item in all_results:
Expand All @@ -48,38 +48,57 @@ def find_dir():
except KeyboardInterrupt:
print("\n Bye!!!")
sys.exit()
except:
print("an error happened")
except Exception as e:
print(f"An error happened: {e}")
sys.exit()

def test_subdomain(subdomain):
try:
resolver = dns.resolver.Resolver()
responses = resolver.resolve(subdomain, "A")
return True
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, dns.resolver.NoNameservers):
return False
except Exception as e:
print(f"An error happened: {e}")
return False

def find_subdomains():
try:
print("\n")
domain = input("Domain: ")
wordlist = input("WordList: ")

print("\n -------------- search --------------")
console = Console()
console.print("\n -------------- search --------------", style="#af00ff")

all_results = []

with open(wordlist, "r") as file:
words = file.read().splitlines()

for word in words:
subdomain = "{}.{}".format(word, domain)

try:
resolver = dns.resolver.Resolver()
responses = resolver.resolve(subdomain, "A")
print("{}".format(subdomain))
except KeyboardInterrupt:
print("\n Bye!!!")
sys.exit()
except:
pass
if test_subdomain(subdomain):
try:
response = requests.get("http://" + subdomain)
if response.status_code != 404:
print("{}".format(subdomain))
all_results.append(subdomain)
except requests.RequestException as e:
print(f"Failed to request {subdomain}: {e}")

with open("subdomains_found.txt", 'w') as file:
for item in all_results:
file.write("{}\n".format(item))

console.print("Saved in the subdomains_found.txt file", style="#008000")
except KeyboardInterrupt:
print("\n Bye!!!")
sys.exit()
except:
print("an error happened")
except Exception as e:
print(f"An error happened: {e}")
sys.exit()

if __name__ == "__main__":
Expand All @@ -99,4 +118,4 @@ def find_subdomains():
print("This option does not exist")
except KeyboardInterrupt:
print("\n Bye!!!")
sys.exit()
sys.exit()
12 changes: 12 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": [
"config:base"
],
"packageRules": [
{
"packagePatterns": ["*"],
"groupName": "all dependencies",
"automerge": false
}
]
}