Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
103 lines
2.6 KiB
Bash
Executable File
103 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Find all hardcoded IP addresses in scripts and configuration files
|
|
# Usage: ./scripts/find-hardcoded-ips.sh
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
echo "=== Hardcoded IP Address Finder ==="
|
|
echo ""
|
|
|
|
# IP patterns to find
|
|
IP_PATTERNS=(
|
|
"192\.168\.11\.[0-9]+"
|
|
"192\.168\.0\.[0-9]+"
|
|
"76\.53\.10\.[0-9]+"
|
|
)
|
|
|
|
# File types to search
|
|
FILE_TYPES=(
|
|
"*.sh"
|
|
"*.py"
|
|
"*.conf"
|
|
"*.config"
|
|
"*.env"
|
|
"*.yaml"
|
|
"*.yml"
|
|
"*.json"
|
|
"*.toml"
|
|
)
|
|
|
|
OUTPUT_FILE="$PROJECT_ROOT/reports/hardcoded-ips-report-$(date +%Y%m%d_%H%M%S).md"
|
|
mkdir -p "$(dirname "$OUTPUT_FILE")"
|
|
|
|
{
|
|
echo "# Hardcoded IP Address Report"
|
|
echo ""
|
|
echo "**Generated:** $(date)"
|
|
echo "**Purpose:** Identify all hardcoded IP addresses for centralization"
|
|
echo ""
|
|
echo "---"
|
|
echo ""
|
|
} > "$OUTPUT_FILE"
|
|
|
|
TOTAL_FOUND=0
|
|
|
|
for pattern in "${IP_PATTERNS[@]}"; do
|
|
echo "Searching for pattern: $pattern"
|
|
|
|
{
|
|
echo "## Pattern: \`$pattern\`"
|
|
echo ""
|
|
} >> "$OUTPUT_FILE"
|
|
|
|
for file_type in "${FILE_TYPES[@]}"; do
|
|
while IFS= read -r file; do
|
|
if [ -f "$file" ]; then
|
|
matches=$(grep -nE "$pattern" "$file" 2>/dev/null | grep -v "\.example\|\.template\|\.sample" || true)
|
|
if [ -n "$matches" ]; then
|
|
count=$(echo "$matches" | wc -l)
|
|
TOTAL_FOUND=$((TOTAL_FOUND + count))
|
|
|
|
{
|
|
echo "### \`$file\`"
|
|
echo ""
|
|
echo "Found $count occurrence(s):"
|
|
echo ""
|
|
echo '```'
|
|
echo "$matches" | head -10
|
|
echo '```'
|
|
echo ""
|
|
} >> "$OUTPUT_FILE"
|
|
fi
|
|
fi
|
|
done < <(find "$PROJECT_ROOT" -type f -name "$file_type" ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/venv/*" 2>/dev/null)
|
|
done
|
|
|
|
echo "" >> "$OUTPUT_FILE"
|
|
done
|
|
|
|
{
|
|
echo "---"
|
|
echo ""
|
|
echo "## Summary"
|
|
echo ""
|
|
echo "- **Total Hardcoded IPs Found:** $TOTAL_FOUND"
|
|
echo "- **Recommendation:** Move all IPs to configuration files"
|
|
echo "- **Configuration File:** Use \`docs/11-references/IP_ADDRESS_REGISTRY.md\` as reference"
|
|
echo ""
|
|
} >> "$OUTPUT_FILE"
|
|
|
|
echo ""
|
|
echo -e "${GREEN}✅ Report generated: $OUTPUT_FILE${NC}"
|
|
echo -e "Total hardcoded IPs found: ${YELLOW}$TOTAL_FOUND${NC}"
|