Skip to main content
Glama
badchars

osint-mcp-server

by badchars

hackertarget_aslookup

Look up ASN information for IP addresses or AS numbers to identify network ownership and routing data using HackerTarget's database.

Instructions

Look up ASN information for an IP or ASN via HackerTarget. Free tier: 50 queries/day.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesIP address or ASN to look up

Implementation Reference

  • The implementation of the hackertargetAslookup function, which handles the tool's core logic by querying the HackerTarget API and processing the returned text.
    export async function hackertargetAslookup(query: string): Promise<AslookupResult> {
      const text = await htFetch("aslookup", query);
      const lines = text.split("\n").filter(Boolean);
      const entries: AslookupResult["entries"] = [];
    
      for (const line of lines) {
        const parts = line.split(",").map((p) => p.trim().replace(/^"|"$/g, ""));
        if (parts.length >= 3) {
          entries.push({ asn: parts[0], ip: parts[1], owner: parts[2] });
        }
      }
    
      return { query, raw: text, entries };
    }
  • The registration of the 'hackertarget_aslookup' tool in the protocol layer, defining its schema, description, and execution logic.
    const hackertargetAslookupTool: ToolDef = {
      name: "hackertarget_aslookup",
      description: "Look up ASN information for an IP or ASN via HackerTarget. Free tier: 50 queries/day.",
      schema: {
        query: z.string().describe("IP address or ASN to look up"),
      },
      execute: async (args) => json(await hackertargetAslookup(args.query as string)),
    };
  • The type definition for the AslookupResult, which specifies the structure of the tool's output.
    interface AslookupResult {
      query: string;
      raw: string;
      entries: { asn: string; ip: string; owner: string }[];
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/badchars/osint-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server