m4ll0k / SecretFinder

SecretFinder - A python script for find sensitive data (apikeys, accesstoken,jwt,..) and search anything on javascript files
GNU General Public License v3.0
2.03k stars 375 forks source link

args.header.split('\\n') should be args.headers.split('\\n') in line 354 #20

Closed henrique-marcomini-movile closed 4 years ago

henrique-marcomini-movile commented 4 years ago

Hi, in the line 354 of SecretFinder.py there is a call to args.header, but the correct according to the object is headers

so line 354 becomes args.headers.split('\n')

m4ll0k commented 4 years ago
import argparse

a = argparse.ArgumentParser()
a.add_argument('-a','--aa',help="ok",default="")
b = a.parse_args()
print(b.aa.split('\\n'))
henrique-marcomini-movile commented 4 years ago

To clarify it, the error that I'm trying tackle here is this one

$git branch
* master

$python3 SecretFinder.py 
usage: SecretFinder.py [-h] [-e] -i INPUT [-o OUTPUT] [-r REGEX] [-b]
                       [-c COOKIE] [-g IGNORE] [-n ONLY] [-H HEADERS]
                       [-p PROXY]
SecretFinder.py: error: the following arguments are required: -i/--input

$python3 SecretFinder.py -H "test" -i "https://something"
[ + ] URL: https://something
Traceback (most recent call last):
  File "SecretFinder.py", line 428, in <module>
    file = send_request(url)
  File "SecretFinder.py", line 354, in send_request
    for i in args.header.split('\\n'):
AttributeError: 'Namespace' object has no attribute 'header'

There is mismatch due to

parser.add_argument("-H","--headers",help="Set headers (\"Name:Value\\nName:Value\")",action="store",default="")

and then calling it like this on line 354

for i in args.header.split('\\n'):
storenth commented 2 years ago

@m4ll0k Looks like I get AttributeError, while using -H argument

export CUSTOMHEADER='X-HackerOne-Research:storenth'
xargs -I '{}' secretfinder -H $CUSTOMHEADER -i {} -o cli < ./js-list.txt
header-issue

Note: works fine without -H. Do we need a separate issue?