Skip to content

aniket2348823/vigilagent / .agents/skills/analyzing-email-headers-for-phishing-investigation

analyzing-email-headers-for-phishing-investigation

Verified

Parse and analyze email headers to trace the origin of phishing emails, verify sender authenticity, and identify spoofing through SPF, DKIM, and DMARC validation.

FileKindSize
LICENSEother11.0 KB
SKILL.mdskill md11.5 KB
references/api-reference.mdmarkdown2.7 KB
scripts/agent.pyscript8.4 KB

references/api-reference.md

View on GitHub
# API Reference: Email Header Analysis Tools

## Python email Module

### Parsing EML Files
```python
import email
from email import policy

with open("phishing.eml", "r") as f:
    msg = email.message_from_file(f, policy=policy.default)

msg["From"]           # From header
msg["To"]             # To header
msg["Subject"]        # Subject line
msg["Message-ID"]     # Unique message identifier
msg["Reply-To"]       # Reply-To address
msg["Return-Path"]    # Envelope sender
msg.get_all("Received")  # All Received headers (list)
msg.get_all("Authentication-Results")  # Auth results
```

### Body and Attachment Extraction
```python
body = msg.get_body(preferencelist=("html", "plain"))
content = body.get_content()

for part in msg.walk():
    if part.get_content_disposition() == "attachment":
        filename = part.get_filename()
        data = part.get_payload(decode=True)
```

## dig - DNS Record Lookup

### SPF Record
```bash
dig TXT example.com +short
# Output: "v=spf1 include:_spf.google.com ~all"
```

### DKIM Record
```bash
dig TXT selector1._domainkey.example.com +short
```

### DMARC Record
```bash
dig TXT _dmarc.example.com +short
# Output: "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"
```

## pyspf - SPF Validation (Python)

### Syntax
```python
import spf
result, explanation = spf.check2(
    i="203.0.113.45",            # Sending IP
    s="sender@example.com",       # Envelope sender
    h="mail.example.com"          # HELO hostname
)
# Results: pass, fail, softfail, neutral, none, temperror, permerror
```

## dkimpy - DKIM Verification (Python)

### Syntax
```python
import dkim
with open("email.eml", "rb") as f:
    message = f.read()
result = dkim.verify(message)
# Returns True/False
```

## AbuseIPDB - IP Reputation

### API Endpoint
```bash
curl -G "https://api.abuseipdb.com/api/v2/check" \
  -H "Key: YOUR_API_KEY" \
  -H "Accept: application/json" \
  -d "ipAddress=203.0.113.45" -d "maxAgeInDays=90"
```

### Response Fields
| Field | Description |
|-------|-------------|
| `abuseConfidenceScore` | 0-100 confidence of abuse |
| `totalReports` | Number of abuse reports |
| `countryCode` | Source country |
| `isp` | Internet service provider |

## VirusTotal - Domain/URL Reputation

### Domain Lookup
```bash
curl -H "x-apikey: YOUR_KEY" \
  "https://www.virustotal.com/api/v3/domains/suspicious.com"
```

### URL Scan
```bash
curl -X POST "https://www.virustotal.com/api/v3/urls" \
  -H "x-apikey: YOUR_KEY" \
  -d "url=http://suspicious-url.com/login"
```

## whois - Domain Registration

### Syntax
```bash
whois suspicious-domain.com
```

### Key Fields
- `Registrar` - Domain registrar
- `Creation Date` - When domain was registered
- `Registrant` - Domain owner info
- `Name Server` - Authoritative DNS servers
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall