Skip to content

Commit

Permalink
v1.0.5 - proxy support improved
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhiteh4t committed Mar 8, 2023
1 parent b54a83a commit 1a020d4
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 31 deletions.
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
{
"name": "nexfil",
"author": "thewhiteh4t",
"version": "1.0.4",
"version": "1.0.5",
"twitter": "https://twitter.com/thewhiteh4t",
"comms": "https://twc1rcle.com/"
}
}
7 changes: 5 additions & 2 deletions modules/alt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 2,12 @@
from modules.write_log import log_writer


async def test_alt(session, url, alt_url):
async def test_alt(session, use_proxy, proxy_url, url, alt_url):
try:
response = await session.get(alt_url, allow_redirects=False)
if use_proxy is True:
response = await session.get(alt_url, proxy=proxy_url, allow_redirects=False)
else:
response = await session.get(alt_url, allow_redirects=False)
if response.status != 200:
pass
else:
Expand Down
7 changes: 5 additions & 2 deletions modules/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 3,12 @@
from modules.write_log import log_writer


async def test_api(session, url, endpoint):
async def test_api(session, use_proxy, proxy_url, url, endpoint):
try:
response = await session.get(endpoint)
if use_proxy is True:
response = await session.get(endpoint, proxy=proxy_url)
else:
response = await session.get(endpoint)
if response.status != 404:
resp_body = loads(await response.text())
if len(resp_body) != 0:
Expand Down
7 changes: 5 additions & 2 deletions modules/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 3,12 @@
from modules.write_log import log_writer


async def test_method(session, url):
async def test_method(session, use_proxy, proxy_url, url):
try:
response = await session.get(url, allow_redirects=True)
if use_proxy is True:
response = await session.get(url, proxy=proxy_url, allow_redirects=True)
else:
response = await session.get(url, allow_redirects=True)
if response.status != 404:
await clout(response.url)
else:
Expand Down
7 changes: 5 additions & 2 deletions modules/redirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 3,12 @@
from modules.write_log import log_writer


async def test_redirect(session, url):
async def test_redirect(session, use_proxy, proxy_url, url):
try:
response = await session.get(url, allow_redirects=False)
if use_proxy is True:
response = await session.get(url, proxy=proxy_url, allow_redirects=False)
else:
response = await session.get(url, allow_redirects=False)
except asyncio.exceptions.TimeoutError as exc:
log_writer(f'redirect.py, {exc}, {url}')
return
Expand Down
9 changes: 6 additions & 3 deletions modules/string_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 2,15 @@
from modules.printer import clout
from modules.write_log import log_writer

codes = [200, 301, 302, 400, 405, 410, 418, 500, 503]
codes = [200, 400, 405, 410, 418, 500, 503]


async def test_string(session, url, data):
async def test_string(session, use_proxy, proxy_url, url, data):
try:
response = await session.get(url)
if use_proxy is True:
response = await session.get(url, proxy=proxy_url, allow_redirects=False)
else:
response = await session.get(url, allow_redirects=False)
if response.status == 404:
pass
elif response.status not in codes:
Expand Down
43 changes: 30 additions & 13 deletions nexfil.py
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
#!/usr/bin/env python3

SCRIPT_V = '1.0.4'
SCRIPT_V = '1.0.5'

import argparse

Expand Down Expand Up @@ -42,11 42,16 @@
print(SCRIPT_V)
sys.exit()

USE_PROXY = False
if proxy_host is not None and proxy_port is not None:
USE_PROXY = True

from json import loads
from packaging import version
from requests import get
from modules.write_log import log_writer


def chk_update():
try:
print('> Fetching Metadata...', end='')
Expand Down Expand Up @@ -131,7 136,7 @@ def chk_update():
else:
home = getenv('HOME')

codes = [200, 301, 302, 403, 405, 410, 418]
codes = [200, 301, 302, 405, 418]
log_file = home '/.local/share/nexfil/exceptions.log'
loc_data = home '/.local/share/nexfil/dumps/'

Expand Down Expand Up @@ -162,24 167,35 @@ def print_banner():


async def query(session, browser, url, test, data, uname):
if USE_PROXY is False:
proxy_url = ''
else:
proxy_url = f'{proxy_proto}://{proxy_host}:{proxy_port}'
try:
if test == 'method':
await test_method(session, url)
await test_method(session, USE_PROXY, proxy_url, url)
elif test == 'string':
await test_string(session, url, data)
await test_string(session, USE_PROXY, proxy_url, url, data)
elif test == 'redirect':
await test_redirect(session, url)
await test_redirect(session, USE_PROXY, proxy_url, url)
elif test == 'api':
data = data.format(uname)
await test_api(session, url, data)
await test_api(session, USE_PROXY, proxy_url, url, data)
elif test == 'alt':
data = data.format(uname)
await test_alt(session, url, data)
await test_alt(session, USE_PROXY, proxy_url, url, data)
elif test == 'headless' and browser is not False:
browser.get(url)
await test_driver(browser, url, data, tout)
else:
response = await session.head(url, allow_redirects=True)
if USE_PROXY is True:
response = await session.head(
url,
allow_redirects=True,
proxy=proxy_url
)
else:
response = await session.head(url, allow_redirects=True)
if response.status in codes:
if test is None:
await clout(response.url)
Expand All @@ -190,7 206,7 @@ async def query(session, browser, url, test, data, uname):
else:
pass
elif response.status == 404 and test == 'method':
await test_method(session, url)
await test_method(session, USE_PROXY, proxy_url, url)
elif response.status != 404:
modules.share.errors.append(url)
else:
Expand Down Expand Up @@ -250,15 266,14 @@ async def main(uname):
timeout = aiohttp.ClientTimeout(sock_connect=tout, sock_read=tout)
conn = aiohttp.TCPConnector(ssl=False)

if proxy_host is not None and proxy_port is not None:
if USE_PROXY is True:
smsg('Proxy : ON', ' ')
smsg(f'Proxy Mode : {proxy_mode}', ' ')
smsg(f'Proxy Type : {proxy_proto}', ' ')
smsg(f'Proxy Host : {proxy_host}', ' ')
smsg(f'Proxy Port : {proxy_port}', ' ')

from modules.hide import single_proxy
single_proxy(proxy_proto, proxy_host, proxy_port)
log_writer('Proxy will be used!')
log_writer(f'Proxy details : {proxy_mode}, {proxy_proto}, {proxy_host}, {proxy_port}')

wmsg('Finding Profiles...')
print()
Expand All @@ -268,6 283,8 @@ async def main(uname):
import undetected_chromedriver as uc
options = uc.ChromeOptions()
options.add_argument('--headless')
if USE_PROXY is True:
options.add_argument(f'--proxy-server={proxy_proto}://{proxy_host}:{proxy_port}')
caps = options.capabilities
caps["pageLoadStrategy"] = "eager"
driver = uc.Chrome(options=options, desired_capabilities=caps)
Expand Down
13 changes: 8 additions & 5 deletions url_store.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 397,7 @@
"data": null
},
{
"url": "https://gumroad.com/{}",
"url": "https://{}.gumroad.com/",
"test": null,
"data": null
},
Expand Down Expand Up @@ -884,7 884,7 @@
"data": null
},
{
"url": "https://www.trakt.tv/users/{}",
"url": "https://trakt.tv/users/{}",
"test": null,
"data": null
},
Expand Down Expand Up @@ -1668,9 1668,12 @@
"data": null
},
{
"url": "https://www.pscp.tv/{}/",
"test": "string",
"data": "Sorry, this page doesn’t exist!"
"url": "https://www.twitter.com/{}",
"test": "headless",
"data": {
"found": "//*[contains(text(), 'Followers')]",
"not_found": "//*[contains(text(), 'This account doesn')]"
}
},
{
"url": "https://bugcrowd.com/{}",
Expand Down

0 comments on commit 1a020d4

Please sign in to comment.