Skip to content

Commit

Permalink
v3.3 - See CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xnl-h4ck3r committed Mar 11, 2024
1 parent e59fa40 commit cbb30f4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Changelog

- v3.3

- Changed

- If input from a file is a blank line, just ignore instead of raising an error.
- Fix a bug when using `knoxnl` from Burps Piper. Only try writing the `.todo` file if a file was passed.

- v3.2

- Fix bug that was stopping `--version` argument working
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<center><img src="https://github.com/xnl-h4ck3r/knoxnl/blob/main/knoxnl/images/title.png"></center>

## About - v3.2
## About - v3.3

This is a python wrapper around the amazing [KNOXSS API](https://knoxss.me/?page_id=2729) by Brute Logic.
To use this tool (and the underlying API), you must have a valid KNOXSS API key. Don't have one? Go visit https://knoxss.me and subscribe!
Expand Down
2 changes: 1 addition & 1 deletion knoxnl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__="3.2"
__version__="3.3"
25 changes: 13 additions & 12 deletions knoxnl/knoxnl.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def handler(signal_received, frame):
This function is called if Ctrl-C is called by the user
An attempt will be made to try and clean up properly
"""
global stopProgram, needToStop, inputValues, blockedDomains
global stopProgram, needToStop, inputValues, blockedDomains, todoFileName
stopProgram = True
if not needToStop:
print(colored('\n>>> "Oh my God, they killed Kenny... and knoXnl!" - Kyle','red'))
Expand Down Expand Up @@ -196,7 +196,7 @@ def needApiKey():

def getConfig():
# Try to get the values from the config file, otherwise use the defaults
global API_URL, API_KEY, DISCORD_WEBHOOK, configPath, HTTP_ADAPTER, todoFileName
global API_URL, API_KEY, DISCORD_WEBHOOK, configPath, HTTP_ADAPTER
try:

# Put config in global location based on the OS.
Expand All @@ -206,7 +206,7 @@ def getConfig():
else Path(os.path.join(os.path.expanduser("~"), "Library", "Application Support", "knoxnl")) if os.name == 'darwin'
else None
)

# Set up an HTTPAdaptor for retry strategy when making requests
try:
retry= Retry(
Expand All @@ -220,9 +220,6 @@ def getConfig():
except Exception as e:
print(colored('ERROR getConfig 2: ' + str(e), 'red'))

# Set .todo file name in case we need later
todoFileName = args.input+'.'+datetime.now().strftime("%Y%m%d_%H%M%S")+'.todo'

configPath.absolute
if configPath == '':
configPath = 'config.yml'
Expand Down Expand Up @@ -427,7 +424,7 @@ def knoxssApi(targetUrl, headers, method, knoxssResponse):
print(colored('ERROR knoxss 1: ' + str(e), 'red'))

def processInput():
global urlPassed, latestApiCalls, stopProgram, inputValues
global urlPassed, latestApiCalls, stopProgram, inputValues, todoFileName
try:
latestApiCalls = 'Unknown'

Expand Down Expand Up @@ -465,7 +462,10 @@ def processInput():
if not args.input:
print(colored('ERROR: The -i / --input argument must be passed (unless calling from Burp Piper extension with -bp / --burp-piper). The input can be a single URL or a file or URLs.', 'red'))
exit()


# Set .todo file name in case we need later
todoFileName = args.input+'.'+datetime.now().strftime("%Y%m%d_%H%M%S")+'.todo'

# If the -i (--input) can be a standard file (text file with URLs per line),
# if the value passed is not a valid file, then assume it is an individual URL
urlPassed = False
Expand Down Expand Up @@ -494,7 +494,8 @@ def processInput():
with open(inputArg, 'r') as inputFile:
lines = inputFile.readlines()
for line in lines:
inputValues.add(line.strip())
if line.strip() != '':
inputValues.add(line.strip())

print(colored('Calling KNOXSS API for '+str(len(inputValues))+' targets...\n', 'cyan'))
if not stopProgram:
Expand Down Expand Up @@ -630,7 +631,7 @@ def processOutput(target, method, knoxssResponse):
# Process one URL
def processUrl(target):

global stopProgram, latestApiCalls, urlPassed, todoFileName, needToStop
global stopProgram, latestApiCalls, urlPassed, needToStop
try:
if not stopProgram and not needToStop:
target = target.strip()
Expand Down Expand Up @@ -803,15 +804,15 @@ def main():

try:

processInput()
processInput()

# Show the user the latest API quota
if latestApiCalls is None:
latestApiCalls = 'Unknown'
print(colored('\nAPI calls made so far today - ' + latestApiCalls + '\n', 'cyan'))

# If a file was passed, there is a reason to stop, write the .todo file and let the user know about it
if needToStop and not urlPassed:
if needToStop and not urlPassed and not args.burp_piper:
try:
with open(todoFileName, 'w') as file:
for inp in inputValues:
Expand Down

0 comments on commit cbb30f4

Please sign in to comment.