<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-9M977RNGYW"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'G-9M977RNGYW');
    </script>

    <!-- Favicon -->
    <link rel="icon" type="image/svg+xml" href="/static/images/favicon.svg">
    <link rel="alternate icon" href="/static/images/favicon.svg">

    <title>Free Online Port Scanner - Nmap Web Interface</title>

    <!-- SEO Meta Tags -->
    <meta name="description" content="Free online nmap port scanner. Scan networks, discover open ports, detect services and OS with our web-based nmap tool.">
    <meta name="keywords" content="nmap, port scanner, network scanner, security scanning, online port scan">
    <meta name="author" content="Nmap Online">
    <meta name="robots" content="index, follow">

    <!-- Canonical URL -->
    <link rel="canonical" href="https://nmap.online/">

    <!-- Open Graph / Facebook -->
    <meta property="og:type" content="website">
    <meta property="og:url" content="http://nmap.online/">
    <meta property="og:title" content="Free Online Port Scanner - Nmap Web Interface">
    <meta property="og:description" content="Free online nmap port scanner. Scan networks, discover open ports, detect services and OS with our web-based nmap tool.">
    <meta property="og:image" content="http://nmap.online/static/images/og-image.png">
    <meta property="og:site_name" content="Nmap Online">

    <!-- Twitter Card -->
    <meta name="twitter:card" content="summary_large_image">
    <meta property="twitter:title" content="Free Online Port Scanner - Nmap Web Interface">

    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">

    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#6366f1',
                        secondary: '#4f46e5',
                        accent: '#818cf8',
                    },
                    fontFamily: {
                        sans: ['Inter', 'SF Pro Display', '-apple-system', 'BlinkMacSystemFont', 'system-ui', 'sans-serif'],
                    }
                }
            }
        }
    </script>

    <!-- Google Fonts - Inter -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">

    <!-- Shared Header Styles -->
    <link rel="stylesheet" href="/static/css/header.css?v=3">
    <link rel="stylesheet" href="/static/css/obfuscation.css">

    <style>
        .gradient-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }

        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .scan-type-tab {
            padding: 12px 24px;
            border-radius: 8px;
            background: transparent;
            border: 2px solid #d1d5db;
            color: #6b7280;
            cursor: pointer;
            transition: all 0.2s;
            font-weight: 600;
        }

        .scan-type-tab:hover {
            background: rgba(107, 114, 128, 0.05);
            border-color: #9ca3af;
        }

        .scan-type-tab.active {
            background: rgba(99, 102, 241, 0.1);
            color: #6366f1;
            border-color: #6366f1;
        }

        .scan-options {
            display: none;
        }

        .scan-options.active {
            display: block;
        }

        .ports-table {
            width: 100%;
            border-collapse: collapse;
        }

        .ports-table th {
            background: #f9fafb;
            padding: 12px;
            text-align: left;
            font-weight: 600;
            border-bottom: 2px solid #e5e7eb;
        }

        .ports-table td {
            padding: 12px;
            border-bottom: 1px solid #e5e7eb;
        }

        .badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 600;
        }

        .badge-open {
            background: #dcfce7;
            color: #166534;
        }

        .badge-closed {
            background: #fee2e2;
            color: #991b1b;
        }

        #loadingOverlay {
            display: none;
        }

        #loadingOverlay.active {
            display: flex;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen flex flex-col">
    <!-- Header -->
    <header class="gradient-primary text-white shadow-2xl">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
            <div class="flex items-center justify-between gap-4">
                <a href="/" class="flex items-center gap-4 hover:opacity-90 transition cursor-pointer">
                    <svg viewBox="0 0 48 48" class="w-10 h-10 drop-shadow-lg" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <circle cx="24" cy="24" r="20" stroke="white" stroke-width="3" opacity="0.95"/>
                        <path d="M24 14 L24 34 M14 24 L34 24" stroke="white" stroke-width="3" stroke-linecap="round"/>
                        <circle cx="16" cy="16" r="2" fill="white"/>
                        <circle cx="32" cy="16" r="2" fill="white"/>
                        <circle cx="16" cy="32" r="2" fill="white"/>
                        <circle cx="32" cy="32" r="2" fill="white"/>
                    </svg>
                    <div>
                        <h1 class="text-3xl font-black tracking-tight">Nmap Online</h1>
                        <p class="text-white/80 text-xs font-medium tracking-wide">Scan networks and discover open ports</p>
                    </div>
                </a>
                <div class="flex items-center gap-3">
                    <!-- Nmap Commands Link -->
                    <a href="/en/nmap-commands" class="px-5 py-2.5 text-white font-semibold text-sm rounded-lg hover:bg-white/10 transition">
                        Nmap Commands
                    </a>

                    <!-- Credits Display -->
                    <div id="creditsBalanceDisplay" class="hidden">
                        <div class="px-4 py-2.5 bg-white/10 backdrop-blur-sm rounded-lg text-white font-semibold flex items-center gap-2">
                            <i class="fas fa-coins text-yellow-300 text-lg"></i>
                            <span id="creditsBalanceText" class="text-sm">10 Credits</span>
                        </div>
                    </div>

                    <!-- Buy Credits Button -->
                    <a href="/pricing" class="px-5 py-2.5 bg-gradient-to-r from-yellow-400 to-orange-400 text-gray-900 font-bold text-sm rounded-lg hover:from-yellow-300 hover:to-orange-300 transition shadow-lg flex items-center gap-2">
                        <i class="fas fa-coins"></i>
                        <span>Buy Credits</span>
                    </a>
                </div>
            </div>
        </div>
    </header>

    <!-- Main Content -->
    <main class="flex-1 py-12">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <!-- Scanner Container -->
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                <!-- Left Panel: Scan Input -->
                <div class="bg-white rounded-xl shadow-lg p-6">
                    <div class="mb-6">
                        <div class="flex items-center gap-2 mb-2">
                            <i class="fas fa-bullseye text-primary"></i>
                            <h2 class="text-xl font-bold text-gray-900">Target</h2>
                        </div>
                        <input type="text" id="scanTarget" placeholder="example.com or 192.168.1.1"
                               class="w-full px-4 py-3 border-2 border-gray-200 rounded-lg focus:border-primary focus:outline-none transition">
                        <p id="targetValidation" class="text-sm mt-1 hidden"></p>
                    </div>

                    <div class="mb-6">
                        <div class="flex items-center gap-2 mb-3">
                            <i class="fas fa-sliders-h text-primary"></i>
                            <h2 class="text-xl font-bold text-gray-900">Scan Type</h2>
                        </div>
                        <div class="grid grid-cols-2 gap-2 mb-4">
                            <button class="scan-type-tab active" data-type="quick">
                                <i class="fas fa-bolt"></i> Quick
                            </button>
                            <button class="scan-type-tab" data-type="service">
                                <i class="fas fa-network-wired"></i> Service
                            </button>
                            <button class="scan-type-tab" data-type="aggressive">
                                <i class="fas fa-fire"></i> Aggressive
                            </button>
                            <button class="scan-type-tab" data-type="custom">
                                <i class="fas fa-cog"></i> Custom
                            </button>
                        </div>

                        <div id="customOptions" class="scan-options">
                            <div class="space-y-3 p-4 bg-gray-50 rounded-lg">
                                <label class="flex items-center gap-2 cursor-pointer">
                                    <input type="checkbox" id="serviceDetection" class="w-4 h-4">
                                    <span class="text-sm font-medium">Service Version Detection (-sV)</span>
                                </label>
                                <label class="flex items-center gap-2 cursor-pointer">
                                    <input type="checkbox" id="osDetection" class="w-4 h-4">
                                    <span class="text-sm font-medium">OS Detection (-O)</span>
                                </label>
                                <div>
                                    <label class="text-sm font-medium block mb-1">Port Range</label>
                                    <input type="text" id="portRange" value="1-1000" placeholder="1-1000 or 80,443,8080"
                                           class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm">
                                </div>
                                <div>
                                    <label class="text-sm font-medium block mb-1">Timing</label>
                                    <select id="timing" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm">
                                        <option value="0">T0 - Paranoid</option>
                                        <option value="1">T1 - Sneaky</option>
                                        <option value="2">T2 - Polite</option>
                                        <option value="3" selected>T3 - Normal</option>
                                        <option value="4">T4 - Aggressive</option>
                                        <option value="5">T5 - Insane</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>

                    <button id="scanBtn" class="w-full py-4 bg-primary text-white font-bold text-lg rounded-lg hover:bg-secondary transition shadow-lg">
                        <i class="fas fa-search mr-2"></i>
                        <span>Start Scan</span>
                    </button>
                </div>

                <!-- Right Panel: Scan Results -->
                <div class="bg-white rounded-xl shadow-lg p-6">
                    <div class="flex items-center gap-2 mb-4">
                        <i class="fas fa-chart-bar text-primary"></i>
                        <h2 class="text-xl font-bold text-gray-900">Results</h2>
                    </div>

                    <div id="resultsPlaceholder" class="text-center py-16 text-gray-400">
                        <i class="fas fa-search text-6xl mb-4 opacity-20"></i>
                        <p class="text-lg">Enter a target and click "Start Scan"</p>
                    </div>

                    <div id="resultsContainer" class="hidden">
                        <div id="resultsSummary" class="grid grid-cols-3 gap-4 mb-6">
                            <div class="text-center p-3 bg-gray-50 rounded-lg">
                                <p class="text-xs text-gray-600 uppercase mb-1">Status</p>
                                <p id="summaryStatus" class="text-lg font-bold text-gray-900">-</p>
                            </div>
                            <div class="text-center p-3 bg-gray-50 rounded-lg">
                                <p class="text-xs text-gray-600 uppercase mb-1">Open Ports</p>
                                <p id="summaryPorts" class="text-lg font-bold text-primary">-</p>
                            </div>
                            <div class="text-center p-3 bg-gray-50 rounded-lg">
                                <p class="text-xs text-gray-600 uppercase mb-1">Duration</p>
                                <p id="summaryDuration" class="text-lg font-bold text-gray-900">-</p>
                            </div>
                        </div>

                        <div id="portsSection" class="hidden">
                            <h3 class="text-lg font-bold text-gray-900 mb-3">Open Ports</h3>
                            <div class="relative">
                                <div class="overflow-x-auto">
                                    <table class="ports-table w-full text-sm">
                                        <thead>
                                            <tr>
                                                <th>Port</th>
                                                <th>Protocol</th>
                                                <th>State</th>
                                                <th>Service</th>
                                                <th>Version</th>
                                            </tr>
                                        </thead>
                                        <tbody id="portsTableBody"></tbody>
                                    </table>
                                </div>

                                <!-- Unlock Overlay (shown when ports > 2) -->
                                <div id="portsUnlockOverlay" class="unlock-overlay hidden">
                                    <div class="bg-gradient-to-r from-purple-600 to-blue-600 rounded-xl p-6 text-white shadow-2xl">
                                        <div class="text-center">
                                            <i class="fas fa-lock text-3xl mb-3 opacity-90"></i>
                                            <h3 class="text-xl font-bold mb-2">Unlock Full Results</h3>
                                            <p class="text-purple-100 text-sm mb-4">Get complete port information</p>

                                            <!-- With Credits Section -->
                                            <div id="indexUnlockWithCredits" class="hidden">
                                                <div class="bg-white bg-opacity-10 backdrop-blur-sm rounded-lg p-4 mb-3">
                                                    <div class="flex items-center justify-center gap-2 mb-2">
                                                        <i class="fas fa-coins text-yellow-400 text-xl"></i>
                                                        <span class="text-sm text-purple-100">Your Credits:</span>
                                                        <span class="text-xl font-bold" id="indexCreditsDisplay">-</span>
                                                    </div>
                                                </div>
                                                <p class="text-purple-100 text-sm mb-3">
                                                    <i class="fas fa-arrow-down mr-1"></i>
                                                    Click the scan link below to unlock
                                                </p>
                                            </div>

                                            <!-- No Credits Section -->
                                            <div id="indexBuyCredits">
                                                <a id="indexBuyCreditsLink" href="#" class="inline-block px-6 py-3 bg-yellow-400 text-gray-900 font-bold rounded-lg hover:bg-yellow-300 transition transform hover:scale-105 shadow-lg">
                                                    <i class="fas fa-arrow-right mr-2"></i> View Full Results
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div id="scanUrlSection" class="mt-6 p-4 bg-blue-50 rounded-lg hidden">
                            <p class="text-sm font-medium text-blue-900 mb-2">
                                <i class="fas fa-link mr-2"></i>
                                <span id="scanUrlLabel">Scan complete!</span>
                            </p>
                            <div class="flex gap-2">
                                <input type="text" id="scanUrl" readonly class="flex-1 px-3 py-2 bg-white border border-blue-200 rounded-lg text-sm">
                                <button onclick="copyUrl()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition text-sm font-medium">
                                    <i class="fas fa-copy"></i>
                                </button>
                            </div>
                            <p id="scanUrlNote" class="text-xs text-blue-700 mt-2"></p>
                        </div>
                    </div>

                    <div id="loadingOverlay" class="absolute inset-0 bg-white/95 backdrop-blur-sm rounded-xl flex items-center justify-center">
                        <div class="text-center px-8">
                            <!-- Animated scanner icon -->
                            <div class="relative mb-6">
                                <div class="animate-spin rounded-full h-20 w-20 border-4 border-gray-200 mx-auto"></div>
                                <div class="animate-spin rounded-full h-20 w-20 border-t-4 border-primary absolute inset-0 mx-auto" style="animation-duration: 1s;"></div>
                                <div class="absolute inset-0 flex items-center justify-center">
                                    <i class="fas fa-network-wired text-primary text-2xl" style="animation: pulse 2s infinite;"></i>
                                </div>
                            </div>

                            <!-- Progress message -->
                            <p id="loadingStatus" class="text-lg font-semibold text-gray-900 mb-2">Initializing scan...</p>
                            <p class="text-sm text-gray-600">This may take a few moments</p>

                            <!-- Progress bar -->
                            <div class="w-64 h-2 bg-gray-200 rounded-full mt-6 overflow-hidden">
                                <div id="loadingProgress" class="h-full bg-gradient-to-r from-primary to-accent rounded-full transition-all duration-500" style="width: 0%"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Public Scan History -->
            <div class="mt-12 bg-white rounded-xl shadow-lg p-6">
                <div class="flex items-center justify-between mb-6">
                    <div class="flex items-center gap-2">
                        <i class="fas fa-history text-primary"></i>
                        <h2 class="text-xl font-bold text-gray-900">Recent Public Scans</h2>
                    </div>
                </div>
                <div id="publicScansContainer">
                    <p class="text-center text-gray-400 py-8">Loading...</p>
                </div>
            </div>
        </div>
    </main>

    <!-- Legal Disclaimer Modal -->
    <div id="disclaimerModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden items-center justify-center z-50" style="display: none;">
        <div class="bg-white rounded-xl shadow-2xl max-w-2xl mx-4 p-8">
            <h2 class="text-2xl font-bold text-gray-900 mb-4">
                <i class="fas fa-exclamation-triangle text-yellow-500 mr-2"></i>
                Legal Disclaimer
            </h2>
            <div class="text-gray-700 space-y-3 mb-6">
                <p>By using this port scanning tool, you acknowledge that:</p>
                <ul class="list-disc pl-6 space-y-2">
                    <li>You have explicit permission to scan the target network/system</li>
                    <li>Unauthorized port scanning may be illegal in your jurisdiction</li>
                    <li>You are solely responsible for your use of this tool</li>
                    <li>This service is provided "as-is" without warranty</li>
                </ul>
            </div>
            <label class="flex items-start gap-3 mb-6 cursor-pointer">
                <input type="checkbox" id="disclaimerAccept" class="mt-1 w-5 h-5">
                <span class="text-sm text-gray-700">I understand and accept these terms</span>
            </label>
            <button id="disclaimerContinue" disabled class="w-full py-3 bg-primary text-white font-bold rounded-lg hover:bg-secondary transition disabled:bg-gray-300 disabled:cursor-not-allowed">
                Continue
            </button>
        </div>
    </div>

    <!-- Footer -->
    <footer class="bg-white border-t border-gray-100 mt-12">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
            <div class="flex flex-col md:flex-row justify-between items-center gap-4">
                <div class="flex items-center gap-3">
                    <a href="/">
                        <svg viewBox="0 0 48 48" class="w-6 h-6 hover:opacity-80 transition" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <circle cx="24" cy="24" r="18" stroke="#6366f1" stroke-width="2.5" opacity="0.95"/>
                            <path d="M24 12 L24 36 M12 24 L36 24" stroke="#6366f1" stroke-width="2.5" stroke-linecap="round"/>
                            <circle cx="16" cy="16" r="1.5" fill="#6366f1"/>
                            <circle cx="32" cy="16" r="1.5" fill="#6366f1"/>
                            <circle cx="16" cy="32" r="1.5" fill="#6366f1"/>
                            <circle cx="32" cy="32" r="1.5" fill="#6366f1"/>
                        </svg>
                    </a>
                    <span class="text-sm text-gray-500">
                        &copy; 2026 Nmap Online
                    </span>
                </div>
                <div class="flex items-center gap-6 text-sm">
                    <a href="/" class="text-gray-600 hover:text-primary transition font-medium">Scanner</a>
                    <a href="/en/nmap-commands" class="text-gray-600 hover:text-primary transition font-medium">Commands</a>
                    <a href="/pricing" class="text-gray-600 hover:text-primary transition font-medium">Pricing</a>
                    <a href="/privacy" class="text-gray-600 hover:text-primary transition font-medium">Privacy</a>
                    <a href="/terms" class="text-gray-600 hover:text-primary transition font-medium">Terms</a>
                </div>
            </div>
        </div>
    </footer>

    <script src="/static/js/script.js"></script>
</body>
</html>