Skip to content

Commit

Permalink
github action adjustements
Browse files Browse the repository at this point in the history
  • Loading branch information
mIcHyAmRaNe committed Jul 12, 2024
1 parent b332530 commit e52b436
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
tar czf okadminfinder_${{ github.ref_name }}.orig.tar.gz okadminfinder
ls -ll
- name: Clean before build
run: |
fakeroot debian/rules clean
- name: Build Debian package
run: |
dpkg-buildpackage -rfakeroot -uc -us
Expand Down
23 changes: 16 additions & 7 deletions okadminfinder/_classes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from os.path import dirname, isfile
from sys import exit
import contextlib
Expand Down Expand Up @@ -67,7 +68,9 @@ def get_links(dns=False, wordlist=None, debug=False):
links = []

if dns and not wordlist:
links_path = str(dirname(meta.__file__) + "/LinkFile/subdomains-top1million-5000.txt")
links_path = str(
dirname(meta.__file__) + "/LinkFile/subdomains-top1million-5000.txt"
)
elif wordlist:
if not isfile(wordlist):
print(red, "\n\tError: The wordlist file does not exist.", RESET_ALL)
Expand All @@ -90,7 +93,7 @@ def get_links(dns=False, wordlist=None, debug=False):
line = f"{{}}/{line}"
links.append(line.replace("\n", ""))
if debug:
okadminfinder.get_debug("LINKS: ",links)
okadminfinder.get_debug("LINKS: ", links)
return links

def create_link(website, dns=False, wordlist=None, debug=False):
Expand All @@ -110,7 +113,7 @@ def create_link(website, dns=False, wordlist=None, debug=False):
host = url.host
if url.port:
host += f":{url.port}"

# Handle case where the URL starts with 'www.'
if host.startswith("www."):
website = host.replace("www.", "")
Expand All @@ -122,7 +125,7 @@ def create_link(website, dns=False, wordlist=None, debug=False):
for n in okadminfinder.get_links(dns, wordlist, debug):
req_link = url.scheme + "://" + n.format(website)
reqlinks.append(req_link.replace("\n", ""))

# debug mode
if debug:
okadminfinder.get_debug("ReqLinks: ", reqlinks)
Expand Down Expand Up @@ -173,7 +176,9 @@ def proxy(self, prox, headers):
exit(0)
return proxies

async def url(self, website, headers, proxies, dns=False, wordlist=None, debug=False):
async def url(
self, website, headers, proxies, dns=False, wordlist=None, debug=False
):
try:
if okadminfinder.check_url(website, headers, proxies):
print(
Expand Down Expand Up @@ -223,7 +228,7 @@ async def url(self, website, headers, proxies, dns=False, wordlist=None, debug=F
httpx.NetworkError,
httpx.ReadTimeout,
httpx.ConnectTimeout,
httpx.ProxyError
httpx.ProxyError,
):
continue
pbar.close()
Expand All @@ -232,7 +237,11 @@ async def url(self, website, headers, proxies, dns=False, wordlist=None, debug=F
print("\t╚═══[∞︎︎]", str(total_count), "Total pages scanned")
except (httpx.RemoteProtocolError):
pbar.close()
print(red, "\n\tSession Canceled: Server disconnected without sending a response.", RESET_ALL)
print(
red,
"\n\tSession Canceled: Server disconnected without sending a response.",
RESET_ALL,
)
exit(0)
except (KeyboardInterrupt):
pbar.close()
Expand Down
8 changes: 2 additions & 6 deletions okadminfinder/okadminfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ def main():
help="Use randomly selected User-Agent",
)
parser.add_argument(
"-D",
"--debug",
action="store_true",
default=False,
help="Debug mode"
"-D", "--debug", action="store_true", default=False, help="Debug mode"
)
if len(sys.argv) <= 1:
parser.print_usage()
Expand All @@ -89,7 +85,7 @@ def main():
quit(0)
elif args.tor is not False:
parser.print_usage()
print(" \n use only Tor or only Proxy not both at a time")
print(" \n use only Tor or only Proxy not both at a time")
quit(0)
else:
if str(args.proxy)[0:5] == "socks":
Expand Down
4 changes: 3 additions & 1 deletion tests/test_url.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import pytest
from okadminfinder._classes import okadminfinder


Expand Down

0 comments on commit e52b436

Please sign in to comment.