Skill: qidu/get-ip (version 1.0.2)

--- name: ip-lookup description: Get current public IP address and geolocation information. Use when users ask about IP addresses, network location, or want to check their public IP. Supports both fetching IP info and displaying it clearly. --- # IP Lookup Skill ## Overview This skill provides a simple way to check your public IP address and its geolocation information. ## Usage When users ask: - "What is my IP?" - "What is my current IP address?" - "What's my public IP?" - "Where am I?" - "Where am I located?" - "Check location" - "Check my IP location" - "Get location" - "Locate me" - "What's the IP?" - "What's your IP?" Execute the workflow below. ## Workflow ### Basic IP Check Run this command to get your public IP and location: ```bash curl -s myip.ipip.net ``` Example output: ``` Current IP：8.8.8.8 From: SF CA USA Google Current IP：1.1.1.1 From: SF CA USA Cloudflare ``` ### Alternative Methods If the above fails, try these alternatives: **Method 1: icanhazip.com (fallback)** ```bash curl -s icanhazip.com ``` **Method 2: ipify API** ```bash curl -s https://api.ipify.org ``` **Method 3: ifconfig.me** ```bash curl -s ifconfig.me ``` ### Full Geolocation Lookup For more detailed geolocation info: ```bash curl -s https://ipinfo.io/$(curl -s https://api.ipify.org)/json ``` ## Display Format Present the information clearly: **IP Address:** [address] **Location:** [city], [region], [country] **ISP:** [ISP name] **Org:** [organization] ## Error Handling If the primary service (`myip.ipip.net`) fails: 1. Try alternative services one by one 2. Report which service succeeded 3. If all fail, inform the user about the network issue

path: get_ip.sh
content: #!/bin/bash
# Get current public IP and location
# Usage: ./get_ip.sh

echo "Fetching IP information..."

URLS=(
  myip.ipip.net
  ifconfig.me
  icanhazip.com
  https://api.ipify.org
)

# Try myip.ipip.net first, it shows geolocation
declare -A ip_results
count=0
for url in "${URLS[@]}"; do
    IP=$(curl -s --max-time 3 --connect-timeout 3 "$url" 2>/dev/null)
    if [ $? -eq 28 ] || [ $? -eq -1 ]; then
        continue
    fi
    # echo $http_status $IP
    ip_results["$url"]="$IP"

    count=$((count + 1))
    if [ $count -gt 1 ]; then
        break
    fi
done

for url in "${!ip_results[@]}"; do
    # echo "from" "$url" "=>" "$IP"
    IP="${ip_results[$url]}"
    if [ "$url" == "myip.ipip.net" ]; then
        echo $IP
        continue
    fi
    
    # Try to get geolocation
    GEO=$(curl -s "https://ipinfo.io/$IP/json" 2>/dev/null)
    if [ $? -eq 0 ] && [ -n "$GEO" ]; then
        echo "$IP"
        echo "$GEO" | python3 -c "
import json, sys
data = json.load(sys.stdin)
print(f\"Location: {data.get('city', 'N/A')}, {data.get('region', 'N/A')}, {data.get('country', 'N/A')} {data.get('org', 'N/A')}\")
"
    fi
done


path: scripts/package_skill.py
content: #!/usr/bin/env python3
import os
import zipfile
import json
import yaml
import sys

def validate_skill(skill_dir):
    """Validate the skill before packaging"""
    skill_path = os.path.join(skill_dir, "SKILL.md")
    
    if not os.path.exists(skill_path):
        print(f"Error: SKILL.md not found in {skill_dir}")
        return False
    
    with open(skill_path, 'r') as f:
        content = f.read()
    
    # Extract frontmatter
    if not content.startswith('---'):
        print("Error: SKILL.md must start with YAML frontmatter (---)")
        return False
    
    parts = content.split('---', 2)
    if len(parts) < 3:
        print("Error: Invalid YAML frontmatter format")
        return False
    
    try:
        frontmatter = yaml.safe_load(parts[1])
    except yaml.YAMLError as e:
        print(f"Error: Invalid YAML in frontmatter: {e}")
        return False
    
    # Check required fields
    if 'name' not in frontmatter:
        print("Error: Missing required 'name' field in frontmatter")
        return False
    
    if 'description' not in frontmatter:
        print("Error: Missing required 'description' field in frontmatter")
        return False
    
    # Validate name format
    name = frontmatter['name']
    if not name.replace('-', '').replace('_', '').isalnum():
        print("Error: Name must contain only letters, digits, hyphens, and underscores")
        return False
    
    print(f"✓ Validation passed: {name}")
    print(f"  Description: {frontmatter['description'][:60]}...")
    return True

def package_skill(skill_dir, output_dir=None):
    """Package the skill into a .skill file"""
    skill_name = os.path.basename(skill_dir)
    
    if output_dir:
        os.makedirs(output_dir, exist_ok=True)
        output_path = os.path.join(output_dir, f"{skill_name}.skill")
    else:
        output_path = f"{skill_name}.skill"
    
    with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
        for root, dirs, files in os.walk(skill_dir):
            for file in files:
                file_path = os.path.join(root, file)
                arcname = os.path.relpath(file_path, skill_dir)
                zipf.write(file_path, arcname)
    
    print(f"✓ Packaged skill: {output_path}")
    return output_path

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: package_skill.py <skill-directory> [output-directory]")
        sys.exit(1)
    
    skill_dir = sys.argv[1]
    output_dir = sys.argv[2] if len(sys.argv) > 2 else None
    
    if not os.path.exists(skill_dir):
        print(f"Error: Directory not found: {skill_dir}")
        sys.exit(1)
    
    print(f"Packaging skill: {skill_dir}")
    
    if validate_skill(skill_dir):
        package_skill(skill_dir, output_dir)
    else:
        sys.exit(1)


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)