Skip to main content
Glama

pcap_extract_credentials

Extract credentials from PCAP files by analyzing FTP, HTTP, and SMTP network traffic for security auditing and forensic investigations.

Instructions

Extract credentials from FTP, HTTP, and SMTP traffic. Returns ftp_credentials, http_authorization_headers, http_post_data, and smtp_data. Read-only, may contain sensitive credentials.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pcap_pathYesPath to the PCAP file
protocolNoProtocol to extract credentials fromall

Implementation Reference

  • The implementation of the pcap_extract_credentials tool, which uses tshark to extract credentials from FTP, HTTP, and SMTP traffic.
    server.tool(
      "pcap_extract_credentials",
      "Extract credentials from FTP, HTTP, and SMTP traffic. Returns ftp_credentials, http_authorization_headers, http_post_data, and smtp_data. Read-only, may contain sensitive credentials.",
      {
        pcap_path: z.string().describe("Path to the PCAP file"),
        protocol: z
          .enum(["ftp", "http", "smtp", "all"])
          .describe("Protocol to extract credentials from")
          .default("all"),
      },
      async ({ pcap_path, protocol }) => {
        requireTool("tshark");
        const pcap = validatePcap(pcap_path);
    
        const results: Record<string, string[]> = {};
    
        if (protocol === "ftp" || protocol === "all") {
          const ftpRes = await runCmd("tshark", [
            "-r", pcap,
            "-Y", "ftp.request.command == USER || ftp.request.command == PASS",
            "-T", "fields",
            "-e", "ftp.request.command",
            "-e", "ftp.request.arg",
          ]);
          results["ftp_credentials"] = parseLines(ftpRes.stdout);
        }
    
        if (protocol === "http" || protocol === "all") {
          const httpAuth = await runCmd("tshark", [
            "-r", pcap,
            "-Y", "http.authorization",
            "-T", "fields",
            "-e", "ip.src",
            "-e", "http.request.uri",
            "-e", "http.authorization",
          ]);
          const httpPost = await runCmd("tshark", [
            "-r", pcap,
            "-Y", "http.request.method == POST",
            "-T", "fields",
            "-e", "ip.src",
            "-e", "http.request.uri",
            "-e", "http.file_data",
          ]);
          results["http_authorization_headers"] = parseLines(httpAuth.stdout).slice(0, 50);
          results["http_post_data"] = parseLines(httpPost.stdout).slice(0, 50);
        }
    
        if (protocol === "smtp" || protocol === "all") {
          const smtpRes = await runShell(
            `tshark -r '${pcap}' -Y 'smtp' -T fields -e smtp.req.parameter 2>/dev/null | head -50`
          );
          results["smtp_data"] = parseLines(smtpRes.stdout);
        }
    
        return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };
      }
    );
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It effectively discloses key behavioral traits: the read-only nature (safety profile), sensitivity warning ('may contain sensitive credentials'), and output structure. However, it doesn't mention potential limitations like file size constraints, processing time, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tightly packed sentences with zero waste. First sentence covers purpose, scope, and output. Second sentence adds crucial behavioral context (read-only, sensitivity). Every word earns its place with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 2-parameter tool with no output schema, the description provides good coverage: purpose, protocols, outputs, and behavioral context. However, it doesn't explain the format/structure of returned data (e.g., whether ftp_credentials is a list of dictionaries) or potential error cases, leaving some gaps for an agent to interpret.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing complete parameter documentation. The description doesn't add any parameter-specific information beyond what's in the schema (pcap_path, protocol with enum). Baseline score of 3 is appropriate since the schema already fully documents parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Extract credentials'), target resources ('FTP, HTTP, and SMTP traffic'), and output format ('Returns ftp_credentials, http_authorization_headers, http_post_data, and smtp_data'). It distinguishes itself from sibling PCAP tools like pcap_detect_scan or pcap_dns_analysis by focusing specifically on credential extraction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying the protocols (FTP, HTTP, SMTP) and mentioning it's 'read-only', but doesn't explicitly state when to use this tool versus alternatives like pcap_follow_stream or pcap_http_objects. No explicit exclusions or prerequisites are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/operantlabs/operant-mcp'

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