Hardcodes – Find Hardcoded Strings From Source Code
hardcodes is a utility for searching strings hardcoded by builders in plans. It utilizes a modular tokenizer that can handle reviews, any selection of backslashes & practically any syntax you toss at it.
Indeed, it is made to process any syntax and pursuing languages are officially supported:
ada, applescript, c, c#, c++, coldfusion, golang, haskell, html, java, javascript,
jsp, lua, pascal, perl, php, powershell, python, ruby, scala, sql, swift, xml
with pip
pip3 install hardcodes
or construct from source
git clone https://github.com/s0md3v/hardcodes && cd hardcodes && python3 setup.py put in
For Developers
The sample system under demonstrates use of hardcodes
library
from hardcodes import search
string = "console.log('hello there')"
outcome = look for(string, lang="prevalent", opinions="parse")
print(outcome)
Output: ['hello there']
The arguments lang
and feedback
are optional. Their use is described underneath in the consumer documentation part.
For Customerscli.py
delivers a grep-like command line interface to hardcodes
library. You will will need to put in the library very first to use it.
Uncover strings in a file
python cli.py /path/to/file.ext
Find strings in a directory, recursively
python cli.py -r /route/to/dir
Conceal paths from output
python cli.py -o /path/to/file.ext
Specify programming language
Specifying a language is optional and should really be employed only when the programming language of source is now known.
python cli.py -l 'golang' /route/to/file.go
Specify comment behaviour
With -c
selection, you can specify
overlook
overlook the comments absolutelyparse
parse the responses like codestring
increase comments to list of hardcoded strings
python cli.py -o /path/to/file.ext