域名/IP端口/源IP/cname扫描

常见的服务器端口扫描,会判断域名是否套有CDN,支持检测IP/域名,便捷小工具https://wzapi.com/portscan/

接口地址: https://wzapi.com/api/portscan

返回格式: JSON

请求方式: GET

请求示例: https://wzapi.com/api/portscan?target=wzapi.com

请求参数说明:

名称 必填 类型 说明
portscan string 目标IP/域名

返回参数说明:

名称 类型 说明

返回示例:

{
  "code": "200",
  "msg": "success",
  "data": {
    "target": "guaimai.cn",
    "ip": "23.95.96.145",
    "scan_time": "2025-11-28 14:33:29",
    "timeout": 0.8,
    "ports": [
      {
        "port": 443,
        "status": "open"
      },
      {
        "port": 21,
        "status": "open"
      },
      {
        "port": 22,
        "status": "open"
      },
      {
        "port": 80,
        "status": "open"
      },
      {
        "port": 23,
        "status": "closed"
      },
      {
        "port": 25,
        "status": "closed"
      },
      {
        "port": 53,
        "status": "closed"
      },
      {
        "port": 110,
        "status": "closed"
      },
      {
        "port": 143,
        "status": "closed"
      },
      {
        "port": 465,
        "status": "closed"
      },
      {
        "port": 587,
        "status": "closed"
      },
      {
        "port": 993,
        "status": "closed"
      },
      {
        "port": 995,
        "status": "closed"
      },
      {
        "port": 1433,
        "status": "closed"
      },
      {
        "port": 1521,
        "status": "closed"
      },
      {
        "port": 1723,
        "status": "closed"
      },
      {
        "port": 3306,
        "status": "closed"
      },
      {
        "port": 3389,
        "status": "closed"
      },
      {
        "port": 5432,
        "status": "closed"
      },
      {
        "port": 5900,
        "status": "closed"
      },
      {
        "port": 6379,
        "status": "closed"
      },
      {
        "port": 8080,
        "status": "closed"
      },
      {
        "port": 8443,
        "status": "closed"
      }
    ]
  },
  "timestamp": 1764311609
}

请求参数设置:

参数名称 参数值


{
  "code": "200",
  "msg": "success",
  "data": {
    "target": "guaimai.cn",
    "ip": "23.95.96.145",
    "scan_time": "2025-11-28 14:33:29",
    "timeout": 0.8,
    "ports": [
      {
        "port": 443,
        "status": "open"
      },
      {
        "port": 21,
        "status": "open"
      },
      {
        "port": 22,
        "status": "open"
      },
      {
        "port": 80,
        "status": "open"
      },
      {
        "port": 23,
        "status": "closed"
      },
      {
        "port": 25,
        "status": "closed"
      },
      {
        "port": 53,
        "status": "closed"
      },
      {
        "port": 110,
        "status": "closed"
      },
      {
        "port": 143,
        "status": "closed"
      },
      {
        "port": 465,
        "status": "closed"
      },
      {
        "port": 587,
        "status": "closed"
      },
      {
        "port": 993,
        "status": "closed"
      },
      {
        "port": 995,
        "status": "closed"
      },
      {
        "port": 1433,
        "status": "closed"
      },
      {
        "port": 1521,
        "status": "closed"
      },
      {
        "port": 1723,
        "status": "closed"
      },
      {
        "port": 3306,
        "status": "closed"
      },
      {
        "port": 3389,
        "status": "closed"
      },
      {
        "port": 5432,
        "status": "closed"
      },
      {
        "port": 5900,
        "status": "closed"
      },
      {
        "port": 6379,
        "status": "closed"
      },
      {
        "port": 8080,
        "status": "closed"
      },
      {
        "port": 8443,
        "status": "closed"
      }
    ]
  },
  "timestamp": 1764311609
}

错误码格式说明:

名称 类型 说明

代码示例:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>端口扫描工具_一键检测服务器开放端口与CDN</title>
<meta name="description" content="万站API端口扫描工具,支持域名/IP一键检测是否存在CDN并展示开放端口,帮助安全加固、渗透测试与服务排查,响应速度毫秒级。">
<meta name="keywords" content="端口扫描,CDN检测,端口开放检测,服务器安全工具,端口扫描API">
<link rel="canonical" href="https://wzapi.com/portscan/">
<meta property="og:type" content="website">
<meta property="og:title" content="端口扫描工具_一键检测CDN与开放端口">
<meta property="og:description" content="输入域名/IP 即可检测目标是否部署CDN并列出开放端口,支持自定义端口组合与超时时间。">
<meta property="og:url" content="https://wzapi.com/portscan/">
<meta property="og:site_name" content="万站API">
<meta property="og:image" content="https://wzapi.com/logo.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="端口扫描工具 - CDN识别+端口检测">
<meta name="twitter:description" content="快速识别目标是否存在CDN并反馈端口开放状态,接口级别输出,开发者友好。">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui@2.8.18/dist/css/layui.css">
<style>
body {
background: #f2f3f5;
}
.hero {
max-width: 1100px;
margin: 30px auto 10px;
padding: 0 15px;
}
.hero-card {
background: linear-gradient(135deg,#1e9fff,#16baaa);
border-radius: 16px;
color: #fff;
padding: 36px 32px;
box-shadow: 0 15px 35px rgba(22,186,170,.35);
}
.hero h1 {
font-size: 32px;
margin-bottom: 12px;
font-weight: 700;
}
.hero p {
font-size: 16px;
opacity: .9;
}
.hero-features {
display: flex;
flex-wrap: wrap;
margin-top: 22px;
}
.hero-feature {
flex: 1;
min-width: 200px;
margin-right: 20px;
font-size: 14px;
opacity: .95;
}
.hero-feature:last-child {
margin-right: 0;
}
.main-container {
max-width: 1100px;
margin: 15px auto 40px;
padding: 0 15px 40px;
}
.section-title {
font-size: 20px;
font-weight: 600;
margin: 35px 0 15px;
color: #1d2129;
display: flex;
align-items: center;
}
.section-title i {
margin-right: 8px;
color: #16baaa;
}
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 16px;
}
.feature-item {
background: #fff;
border-radius: 12px;
border: 1px solid #eef0f4;
padding: 20px;
box-shadow: 0 5px 18px rgba(20,28,62,.06);
}
.feature-item h3 {
font-size: 16px;
font-weight: 600;
margin-bottom: 8px;
color: #1d2129;
}
.feature-item p {
font-size: 13px;
color: #6f7785;
line-height: 1.6;
}
.faq {
background: #fff;
border-radius: 12px;
border: 1px solid #eef0f4;
padding: 24px;
box-shadow: 0 5px 18px rgba(20,28,62,.06);
}
.faq-item {
margin-bottom: 16px;
}
.faq-item:last-child {
margin-bottom: 0;
}
.faq-q {
font-weight: 600;
color: #1d2129;
}
.faq-a {
margin-top: 6px;
color: #6f7785;
line-height: 1.7;
font-size: 14px;
}
.panel {
background: #fff;
border-radius: 12px;
box-shadow: 0 8px 30px rgba(67, 87, 133, .08);
padding: 24px;
margin-bottom: 20px;
}
.panel-title {
font-size: 18px;
font-weight: 600;
color: #1d2129;
margin-bottom: 18px;
display: flex;
align-items: center;
}
.panel-title i {
margin-right: 8px;
color: #16baaa;
}
.result-box {
display: none;
}
.status-pill {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: 20px;
font-size: 12px;
}
.status-open {
background: rgba(38, 191, 128, .15);
color: #26bf80;
}
.status-closed {
background: rgba(255, 87, 34, .12);
color: #ff5722;
}
.status-cdn {
color: #ffb800;
}
.tips {
font-size: 13px;
color: #909399;
}
.copy-btn {
cursor: pointer;
margin-left: 6px;
color: #1e9fff;
}
@media (max-width: 768px) {
.panel {
padding: 18px;
}
}
</style>
</head>
<body>
<div class="hero">
<div class="hero-card">
<p style="font-size:13px;letter-spacing:.3px;opacity:.8;">PORTSCAN TOOL · 万站API</p>
<h1>端口扫描工具:CDN识别 + 常见端口检测</h1>
<p>输入任意域名或 IP,即可实时识别目标是否部署 CDN 并返回常见端口开放状态,便于服务器加固、安全审计和业务排查。</p>
<div class="hero-features">
<div class="hero-feature"><strong>· CDN检测</strong> 自动识别 CNAME,判断是否可扫描</div>
<div class="hero-feature"><strong>· 并发扫描</strong> 异步多端口并发,响应速度更快</div>
<div class="hero-feature"><strong>· 自定义端口</strong> 支持自定义端口列表与超时时间</div>
</div>
</div>
</div>
<div class="main-container">
<!-- 配置面板 -->
<div class="panel">
<div class="panel-title">
<i class="layui-icon layui-icon-vercode"></i> 端口扫描配置
</div>
<form class="layui-form" lay-filter="scanForm">
<div class="layui-row layui-col-space16">
<div class="layui-col-sm9 layui-col-xs12">
<div class="layui-form-item">
<label class="layui-form-label">目标地址</label>
<div class="layui-input-block">
<input type="text" name="target" required lay-verify="required" placeholder="请输入域名或IP,例如:wzapi.com" class="layui-input">
</div>
</div>
</div>
<div class="layui-col-sm3 layui-col-xs12">
<div class="layui-form-item">
<label class="layui-form-label">超时 (s)</label>
<div class="layui-input-block">
<input type="number" name="timeout" value="0.8" min="0.1" step="0.1" class="layui-input">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">自定义端口</label>
<div class="layui-input-block">
<input type="text" name="ports" placeholder="可选,多个端口用逗号分隔,如:80,443,8080" class="layui-input">
<div class="tips" style="margin-top:6px;">不填写则使用默认常用端口(21/22/23/25/53/80/110/143/443/465/587/993/995/1433/1521/1723/3306/3389/5432/5900/6379/8080/8443)</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="startScan">
<i class="layui-icon layui-icon-search"></i> 开始扫描
</button>
<button type="reset" class="layui-btn layui-btn-primary">
<i class="layui-icon layui-icon-refresh-3"></i> 重置
</button>
<span class="tips">提示:若目标存在 CDN(CNAME)将无法扫描。</span>
</div>
</div>
</form>
</div>

<!-- CDN 信息 -->
<div class="panel result-box" id="cdnPanel">
<div class="panel-title status-cdn">
<i class="layui-icon layui-icon-release"></i> 检测到 CDN,无法扫描端口
</div>
<div class="layui-card-body" style="padding:0;">
<table class="layui-table">
<thead>
<tr>
<th>CNAME 记录</th>
</tr>
</thead>
<tbody id="cdnList"></tbody>
</table>
</div>
</div>

<!-- 扫描结果 -->
<div class="panel result-box" id="resultPanel">
<div class="panel-title">
<i class="layui-icon layui-icon-chart-screen"></i> 扫描结果
</div>
<div class="layui-row layui-col-space20">
<div class="layui-col-sm4 layui-col-xs12">
<div class="layui-card" style="border-radius:10px;border:1px solid #f0f0f0;">
<div class="layui-card-body" style="text-align:center;">
<div style="font-size:13px;color:#909399;">目标地址</div>
<div style="font-size:20px;font-weight:600;margin-top:6px;" id="targetText">-</div>
<div style="font-size:12px;color:#999;margin-top:4px;">IP:<span id="targetIp">-</span></div>
</div>
</div>
</div>
<div class="layui-col-sm4 layui-col-xs6">
<div class="layui-card" style="border-radius:10px;border:1px solid #f0f0f0;">
<div class="layui-card-body" style="text-align:center;">
<div style="font-size:13px;color:#909399;">开放端口</div>
<div style="font-size:26px;font-weight:700;margin-top:6px;color:#16baaa;" id="openPorts">0</div>
<div style="font-size:12px;color:#999;margin-top:4px;">Timeout:<span id="timeoutText">0.8s</span></div>
</div>
</div>
</div>
<div class="layui-col-sm4 layui-col-xs6">
<div class="layui-card" style="border-radius:10px;border:1px solid #f0f0f0;">
<div class="layui-card-body" style="text-align:center;">
<div style="font-size:13px;color:#909399;">扫描时间</div>
<div style="font-size:20px;font-weight:600;margin-top:6px;" id="scanTime">-</div>
<div style="font-size:12px;color:#999;margin-top:4px;">更新时间:<span id="updateTime">-</span></div>
</div>
</div>
</div>
</div>
<table class="layui-hide" id="portTable" lay-filter="portTable"></table>
</div>
<h2 class="section-title"><i class="layui-icon layui-icon-note"></i> 为什么选择万站端口扫描工具?</h2>
<div class="feature-grid">
<div class="feature-item">
<h3>CDN友好检测</h3>
<p>自动解析 CNAME 记录,提前告知目标是否部署 CDN,避免误扫加速节点,保护业务合规性。</p>
</div>
<div class="feature-item">
<h3>秒级扫描反馈</h3>
<p>基于 PHP 异步 Socket,可并发扫描多个端口,默认 0.8 秒超时,大部分场景 1 秒内返回完整结果。</p>
</div>
<div class="feature-item">
<h3>接口级别输出</h3>
<p>前端工具与 API 同步,支持 JSON 输出。开发者可直接调用 <code>/api/portscan</code> 集成到监控或安全系统。</p>
</div>
<div class="feature-item">
<h3>自定义端口组合</h3>
<p>除默认 20+ 常见端口外,可自定义端口列表及超时策略,满足不同业务或安全检测需求。</p>
</div>
</div>
<h2 class="section-title"><i class="layui-icon layui-icon-about"></i> 常见问题</h2>
<div class="faq">
<div class="faq-item">
<div class="faq-q">Q:检测到 CDN 无法扫描怎么办?</div>
<div class="faq-a">A:CDN 会隐藏真实源站 IP,如需扫描请绑定源站主机或关闭 CDN 后再检测。</div>
</div>
<div class="faq-item">
<div class="faq-q">Q:可以自定义端口列表吗?</div>
<div class="faq-a">A:在“自定义端口”输入框填写端口,使用逗号分隔即可,比如 <code>80,443,8080</code>。</div>
</div>
<div class="faq-item">
<div class="faq-q">Q:是否支持 API 调用?</div>
<div class="faq-a">A:支持,直接访问 <code>https://wzapi.com/api/portscan?target=example.com</code> 即可获得 JSON 结果。</div>
</div>
</div>
</div>

<script src="https://cdn.jsdelivr.net/npm/layui@2.8.18/dist/layui.js"></script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "端口扫描检测工具",
"url": "https://wzapi.com/portscan/",
"description": "万站API端口扫描工具,支持CDN识别与常见端口检测,提供API接口输出,适合安全检测、服务器巡检等场景。",
"operatingSystem": "Windows, Linux, macOS, Android, iOS",
"applicationCategory": "SecurityApplication",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "CNY"
},
"provider": {
"@type": "Organization",
"name": "万站API",
"url": "https://wzapi.com"
}
}
</script>
<script>
layui.use(['form', 'table', 'layer'], function() {
const form = layui.form;
const table = layui.table;
const layer = layui.layer;
const resultPanel = document.getElementById('resultPanel');
const cdnPanel = document.getElementById('cdnPanel');
const cdnList = document.getElementById('cdnList');

form.on('submit(startScan)', function(data) {
resultPanel.style.display = 'none';
cdnPanel.style.display = 'none';
layer.load(2, {shade: 0.2});

const params = new URLSearchParams();
Object.keys(data.field).forEach(key => {
if (data.field[key]) {
params.append(key, data.field[key]);
}
});

fetch('https://wzapi.com/api/portscan?' + params.toString())
.then(response => response.json())
.then(res => {
layer.closeAll('loading');
if (res.code === '200') {
renderResult(res.data);
} else if (res.code === '202' && res.data && res.data.cname) {
renderCDN(res.data);
} else {
layer.msg(res.msg || '扫描失败', {icon: 5});
}
})
.catch(() => {
layer.closeAll('loading');
layer.msg('请求失败,请稍后重试', {icon: 5});
});

return false;
});

function renderCDN(data) {
cdnList.innerHTML = data.cname.map(item => `<tr><td>${item}</td></tr>`).join('');
cdnPanel.style.display = 'block';
}

function renderResult(data) {
document.getElementById('targetText').innerText = data.target || '-';
document.getElementById('targetIp').innerText = data.ip || '-';
document.getElementById('timeoutText').innerText = (data.timeout || 0.8) + 's';
document.getElementById('scanTime').innerText = data.scan_time || '-';
document.getElementById('updateTime').innerText = new Date().toLocaleString();

const openCount = data.ports.filter(item => item.status === 'open').length;
document.getElementById('openPorts').innerText = openCount;

table.render({
elem: '#portTable',
data: data.ports,
page: false,
cols: [[
{field: 'port', title: '端口', width: 100, align: 'center'},
{field: 'status', title: '状态', align: 'center', templet: function(d){
const cls = (d.status === 'open') ? 'status-open' : 'status-closed';
const text = (d.status === 'open') ? '开放' : '关闭';
return `<span class="status-pill ${cls}">${text}</span>`;
}}
]]
});

resultPanel.style.display = 'block';
}
});
</script>
</body>
</html>