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

Error: unterminated subpattern #67

Open anand4234 opened 1 year ago

anand4234 commented 1 year ago

Any idea whats going wrong here? python SecretFinder.py -i js.js -o test.html

 + ] URL: file:///home/kali/Desktop/Tools/SecretFinder/js.js
Traceback (most recent call last):
  File "/home/kali/Desktop/Tools/SecretFinder/SecretFinder.py", line 435, in <module>
    matched = parser_file(file,mode)
  File "/home/kali/Desktop/Tools/SecretFinder/SecretFinder.py", line 182, in parser_file
    items = getContext(all_matches,content,regex[0])
  File "/home/kali/Desktop/Tools/SecretFinder/SecretFinder.py", line 158, in getContext
    context = re.findall('%s%s%s'%(rex,m,rex),content,re.IGNORECASE)
  File "/usr/lib/python3.10/re.py", line 240, in findall
    return _compile(pattern, flags).findall(string)
  File "/usr/lib/python3.10/re.py", line 303, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.10/sre_compile.py", line 788, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.10/sre_parse.py", line 955, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.10/sre_parse.py", line 444, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "/usr/lib/python3.10/sre_parse.py", line 843, in _parse
    raise source.error("missing ), unterminated subpattern",
re.error: missing ), unterminated subpattern at position 14
srand2 commented 1 year ago

same issue here

halfluke commented 1 year ago

I used the suggestion in #30 and remove the last part of the regex from secretfinder.py and the issue is gone

 'possible_Creds' : r"(?i)(" \
                    r"password\s*[`=:\"]+\s*[^\s]+|" \
                    r"password is\s*[`=:\"]*\s*[^\s]+|" \
                    r"pwd\s*[`=:\"]*\s*[^\s]+|" \
                    r"passwd\s*[`=:\"]+\s*[^\s]+)",