Hardcodes is a utility for searching strings hardcoded by developers in programs. It uses a modular tokenizer that can handle comments, any number of backslashes & nearly any syntax you throw at it.
Yes, it is designed to process any syntax and following 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
Installation
pip3 install hardcodes
git clone https://github.com/s0md3v/hardcodes
cd hardcodes && python3 setup.py install
Documentation
It is available as both a library as well as a command line program. The relevant documentation can be found below:
For Developers
The sample program below demonstrates usage of hardcodes
library
from hardcodes import search
string = “console.log(‘hello there’)”
result = search(string, lang=”common”, comments=”parse”)
print(result)
Output: [‘hello there’]
The arguments lang
and comments
are optional. Their use is explained below in the user documentation section.
For Users
cli.py
provides a grep-like command line interface to hardcodes
library. You will need to install the library first to use it.
python cli.py /path/to/file.ext
python cli.py -r /path/to/dir
python cli.py -o /path/to/file.ext
Specifying a language is optional and should be used only when the programming language of source is already known.
python cli.py -l ‘golang’ /path/to/file.go
With -c
option, you can specify
ignore
ignore the comments completelyparse
parse the comments like codestring
add comments to list of hardcoded stringspython cli.py -o /path/to/file.ext
Kali Linux 2024.4, the final release of 2024, brings a wide range of updates and…
This Go program applies a lifetime patch to PowerShell to disable ETW (Event Tracing for…
GPOHunter is a comprehensive tool designed to analyze and identify security misconfigurations in Active Directory…
Across small-to-medium enterprises (SMEs) and managed service providers (MSPs), the top priority for cybersecurity leaders…
The free and open-source security platform SecHub, provides a central API to test software with…
Don't worry if there are any bugs in the tool, we will try to fix…