Hardcodes : Find Hardcoded Strings From Source Code

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

  • With pip

pip3 install hardcodes

  • or build from source

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.

  • Find Strings In A File

python cli.py /path/to/file.ext

  • Find strings in a directory, recursively

python cli.py -r /path/to/dir

  • Hide paths from output

python cli.py -o /path/to/file.ext

  • Specify programming language

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

  • Specify comment behaviour

With -c option, you can specify

  • ignore ignore the comments completely
  • parse parse the comments like code
  • string add comments to list of hardcoded strings

python cli.py -o /path/to/file.ext

R K

Recent Posts

Admin Panel Dorks : A Complete List of Google Dorks

Introduction Google Dorking is a technique where advanced search operators are used to uncover information…

2 days ago

Best Linux Distros in 2026

Linux is renowned for its versatility, open-source nature, and security. Whether you're a beginner, developer,…

2 days ago

Top 10 Cyber Insurance Companies in 2026

Cyber insurance helps businesses and individuals mitigate financial losses from data breaches, ransomware, extortion, legal…

2 days ago

Ransomware Incident Response

Ransomware is one of the most dangerous and destructive forms of cybercrime today. With cybercriminals…

2 days ago

Best Social Media Search Engines and Tools for 2026

Social media is a key part of our daily lives, with millions of users sharing…

2 days ago

How to Remove Your Personal Information from Data Broker Websites (2026 Guide)

What Are Data Brokers? Data brokers are companies that collect, aggregate, and sell personal information,…

2 days ago