A lightweight and modern Shodan API client written in TypeScript, powered by the Deno runtime.
This client is fully built based on the Shodan API documentation: https://developer.shodan.io/api
Please note that this project is independently developed and not officially affiliated with or endorsed by Shodan.
At the beginning, I just needed a small client to help me with some personal projects. There was already a small nice client called shodan_deno, but it was too limited for my needs. So I decided to create my own from scratch with a completely reinvented structure and share it on my GitHub.
Note: Some methods are not currently implemented. These include:
-
Internet scan via
shodan/scan/internet(requires an enterprise license) -
Network Alerts
-
Notifiers
-
Bulk Data (requires an enterprise license)
-
Manage Organization (requires an enterprise license)
-
Data Streams (requires an enterprise license)
Just initialize a Deno project, create a file (e.g., your_file.ts), and insert the following code:
Create a
.envfile in the same directory asyour_file.tsand addSHODAN_KEY="<Your_Shodan_key>". For more details, see the Deno environment variables documentation.
import { ShodanClient } from "https://raw.githubusercontent.com/Nde-Code/ShodanTS/v4.0.0/mod.ts";
const client = new ShodanClient(Deno.env.get("SHODAN_KEY") ?? "");
const myProfile = await client.getAccountProfile();
console.log("Full JSON:", myProfile);
interface myProfileObject {
member: boolean;
credits: number;
display_name: unknown;
created: string;
}
const myProfileAsType = await client.getAccountProfile<myProfileObject>();
console.log("Member:", myProfileAsType.member);
console.log("You have used", myProfileAsType.credits, "credits this month.");
console.log("Displayed name:", myProfileAsType.display_name);
console.log("Account created on:", myProfileAsType.created);and run your file with the following command:
deno run --allow-env --env-file=.env --allow-net=api.shodan.io your_file.tsMake sure you have properly configured and installed the Deno extension for Visual Studio Code to ensure a smooth and comfortable setup.
For guidance, see the Deno & Visual Studio Code documentation
You can also use my settings.json file located at: .vscode/settings.json
- Install the required items:
If you haven't already, install the Deno runtime and create an account on Shodan to obtain your API key.
- Clone the repository:
git clone https://github.com/Nde-Code/ShodanTS.git- Go into the cloned ShodanTS folder by clicking on it, or by running the following command in your terminal:
cd ShodanTS- Run the client to ensure everything works correctly (make sure to create a
.envfile and addSHODAN_KEY="<Your_Shodan_key>")
deno run --allow-net=api.shodan.io --allow-env --env-file=.env tests.tsFor full usage examples, configuration details, and API command references, check out the docs.md file in this repo.
This project is licensed under the MIT License, see the LICENSE file for details.
Built with ❤️ using TypeScript + Deno by Nde-Code.
If you encounter any problems or need help, feel free to open an issue.