trufflehog icon indicating copy to clipboard operation
trufflehog copied to clipboard

Feature Request: Input rules not in JSON format

Open clay584 opened this issue 6 years ago • 0 comments
trafficstars

The fact that input rules are required in JSON means that we have to do additional escaping for special regex chars just in order for the JSON to be valid. Recommend making the input file a regular text file and just reading in the key, value pairs into a python dict. Also, if doing it in this manner, the regex pattern could be read in as a raw string, therefore eliminating the need to escape special regex characters.

Input file:

Cisco Password::\$\d+\$\S+\$\S+$
rules = {}
with open(rules, "r") as f:
    for line in f:
        (key, val) = line.split("::")
        rules[key] = val

Python will read in strings from a file and they will be properly escaped so we don't even have to use the raw string notation r'sometext'.

clay584 avatar Dec 19 '18 21:12 clay584