- 精华
- 阅读权限
- 50
- 贡献
- 人
- 好友
- 相册
- 分享
- 听众
- 收听
- 注册时间
- 2020-5-25
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2026-2-22 22:52:21
|
显示全部楼层
html代码估计有些浏览器不兼容,我是360浏览没啥问题。代码是这样,你要是懒得下360,把代码扔级AI让他根据你浏览器优化<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IP加密与MD5计算工具</title>
<script src="https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js"></script>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Microsoft YaHei', Arial, sans-serif;
}
body {
background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
color: #333;
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 900px;
margin: 0 auto;
background-color: rgba(255, 255, 255, 0.95);
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
padding: 30px;
}
h1 {
text-align: center;
color: #2c3e50;
margin-bottom: 25px;
font-size: 28px;
border-bottom: 2px solid #3498db;
padding-bottom: 10px;
}
.instructions {
background-color: #e8f4fc;
padding: 15px;
border-radius: 6px;
margin-bottom: 20px;
font-size: 14px;
line-height: 1.5;
}
.instructions h3 {
color: #2c3e50;
margin-bottom: 10px;
}
.tabs {
display: flex;
margin-bottom: 20px;
border-bottom: 2px solid #3498db;
}
.tab {
padding: 10px 20px;
cursor: pointer;
background: #f1f1f1;
border: 1px solid #ddd;
border-bottom: none;
border-radius: 5px 5px 0 0;
margin-right: 5px;
}
.tab.active {
background: #3498db;
color: white;
}
.tab-content {
display: none;
padding: 20px;
background-color: #f8f9fa;
border-radius: 0 0 8px 8px;
}
.tab-content.active {
display: block;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #2c3e50;
}
input {
width: 100%;
padding: 10px 12px;
border: 2px solid #ddd;
border-radius: 6px;
font-size: 16px;
transition: border-color 0.3s;
}
input:focus {
border-color: #3498db;
outline: none;
}
button {
background: #3498db;
color: white;
border: none;
padding: 12px 20px;
border-radius: 6px;
cursor: pointer;
font-size: 16px;
font-weight: bold;
transition: background 0.3s;
margin-top: 10px;
width: 100%;
}
button:hover {
background: #2980b9;
}
.result {
margin-top: 15px;
padding: 15px;
background-color: #e8f4fc;
border-radius: 6px;
border-left: 4px solid #3498db;
display: none;
}
.result h3 {
margin-bottom: 10px;
color: #2c3e50;
}
.code-block {
font-family: 'Courier New', monospace;
background-color: #2c3e50;
color: #fff;
padding: 12px;
border-radius: 4px;
word-break: break-all;
font-size: 16px;
margin: 10px 0;
}
.footer {
text-align: center;
margin-top: 20px;
font-size: 14px;
color: #7f8c8d;
}
.config-section {
margin-bottom: 20px;
padding: 15px;
background-color: #f0f8ff;
border-radius: 6px;
border-left: 4px solid #4CAF50;
}
.config-section h3 {
color: #2c3e50;
margin-bottom: 10px;
}
.ip-explanation {
background-color: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 4px;
padding: 10px;
margin: 10px 0;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<h1>IP加密与MD5计算工具(支持内外网IP)</h1>
<div class="instructions">
<h3>使用说明</h3>
<p>根据客户端和服务端都的main.lua分析,云服务器需要区分内网IP和外网IP:</p>
<p>偏移量请根据自己main.lua设置</p>
<ul>
<li><strong>内网IP</strong>:服务端使用的IP地址(如172.16.0.3)</li>
<li><strong>外网IP</strong>:客户端使用的IP地址(如123.123.123.123)</li>
<li><strong>服务端</strong>:使用偏移量5加密,MD5计算为 内网IP + 解密IP + 端口 + "967"</li>
<li><strong>客户端</strong>:使用偏移量3加密,MD5计算为 解密IP + 外网IP + 端口</li>
</ul>
<p>此工具同时计算服务端和客户端所需的配置。</p>
</div>
<div class="tabs">
<div class="tab active" data-tab="server">服务端配置</div>
<div class="tab" data-tab="client">客户端配置</div>
<div class="tab" data-tab="both">完整配置</div>
</div>
<div class="tab-content active" id="server">
<div class="config-section">
<h3>服务端配置(使用内网IP)</h3>
<p>服务端使用偏移量5进行加密,MD5计算方式为:内网IP + 解密IP + 端口 + "967"</p>
<div class="ip-explanation">
<strong>内网IP说明:</strong> 这是服务端在内部网络中使用的IP地址,通常是172.x.x.x、192.168.x.x或10.x.x.x等私有地址。
</div>
</div>
<div class="form-group">
<label for="server-internal-ip">服务端内网IP地址:</label>
<input type="text" id="server-internal-ip" placeholder="例如:172.16.0.3" value="172.16.0.3">
</div>
<div class="form-group">
<label for="server-port">服务端端口:</label>
<input type="number" id="server-port" placeholder="例如:9527" value="9527">
</div>
<button id="calculate-server">计算服务端配置</button>
<div class="result" id="server-result">
<h3>服务端计算结果:</h3>
<div class="form-group">
<label>加密后的IP字符串(偏移量5):</label>
<div class="code-block" id="server-encrypted-ip"></div>
<p>在服务端代码中替换为:</p>
<div class="code-block">local 解密后IP = 解密IP("<span id="server-encrypted-code"></span>", 5)</div>
</div>
<div class="form-group">
<label>MD5值:</label>
<div class="code-block" id="server-md5-value"></div>
<p>在服务端代码中替换为:</p>
<div class="code-block">if D5 ~= "<span id="server-md5-compare"></span>" then
__xxtt.dddkkk = 0x5557
end</div>
</div>
<div class="form-group">
<label>服务端IP设置:</label>
<div class="code-block">设置安全服务器配置({ <span id="server-ip-array"></span> }, <span id="server-port-value"></span>)</div>
</div>
</div>
</div>
<div class="tab-content" id="client">
<div class="config-section">
<h3>客户端配置(使用外网IP)</h3>
<p>客户端使用偏移量3进行加密,MD5计算方式为:解密IP + 外网IP + 端口</p>
<div class="ip-explanation">
<strong>外网IP说明:</strong> 这是客户端从外部网络连接服务器时使用的IP地址,通常是公网IP地址。
</div>
</div>
<div class="form-group">
<label for="client-external-ip">客户端连接外网IP地址:</label>
<input type="text" id="client-external-ip" placeholder="例如:123.123.123.123" value="123.123.123.123">
</div>
<div class="form-group">
<label for="client-port">客户端连接端口:</label>
<input type="number" id="client-port" placeholder="例如:9527" value="9527">
</div>
<button id="calculate-client">计算客户端配置</button>
<div class="result" id="client-result">
<h3>客户端计算结果:</h3>
<div class="form-group">
<label>加密后的IP字符串(偏移量3):</label>
<div class="code-block" id="client-encrypted-ip"></div>
<p>在客户端代码中替换为:</p>
<div class="code-block">local yz2 = 解密IP("<span id="client-encrypted-code"></span>")</div>
</div>
<div class="form-group">
<label>MD5值:</label>
<div class="code-block" id="client-md5-value"></div>
<p>在客户端代码中替换为:</p>
<div class="code-block">if GGF.MD5(yz2 .. wz .. sk) ~= "<span id="client-md5-compare"></span>" then
ip, 端口 = 0x4FA45, 0x478
end</div>
</div>
<div class="form-group">
<label>客户端IP设置:</label>
<div class="code-block">local TT = { <span id="client-ip-array"></span> }</div>
</div>
</div>
</div>
<div class="tab-content" id="both">
<div class="config-section">
<h3>完整配置(服务端+客户端)</h3>
<p>一次性计算服务端和客户端的所有配置,区分内网IP和外网IP</p>
<div class="ip-explanation">
<strong>注意:</strong> 服务端使用内网IP,客户端使用外网IP。在云服务器环境中,这两个IP通常是不同的。
</div>
</div>
<div class="form-group">
<label for="both-internal-ip">服务端内网IP地址:</label>
<input type="text" id="both-internal-ip" placeholder="例如:172.16.0.3" value="172.16.0.3">
</div>
<div class="form-group">
<label for="both-external-ip">客户端外网IP地址:</label>
<input type="text" id="both-external-ip" placeholder="例如:123.123.123.123" value="123.123.123.123">
</div>
<div class="form-group">
<label for="both-port">端口:</label>
<input type="number" id="both-port" placeholder="例如:9527" value="9527">
</div>
<button id="calculate-both">计算完整配置</button>
<div class="result" id="both-result">
<h3>完整计算结果:</h3>
<div class="form-group">
<label>服务端配置:</label>
<div class="code-block">设置安全服务器配置({ <span id="both-server-ip-array"></span> }, <span id="both-server-port"></span>)</div>
<div class="code-block">local 解密后IP = 解密IP("<span id="both-server-encrypted"></span>", 5)</div>
<div class="code-block">if D5 ~= "<span id="both-server-md5"></span>" then
__xxtt.dddkkk = 0x5557
end</div>
</div>
<div class="form-group">
<label>客户端配置:</label>
<div class="code-block">local TT = { <span id="both-client-ip-array"></span> }</div>
<div class="code-block">local yz2 = 解密IP("<span id="both-client-encrypted"></span>")</div>
<div class="code-block">if GGF.MD5(yz2 .. wz .. sk) ~= "<span id="both-client-md5"></span>" then
ip, 端口 = 0x4FA45, 0x478
end</div>
</div>
</div>
</div>
<div class="footer">
<p>用于服务端和客户端IP加密与MD5计算 | 支持内外网IP区分</p>
</div>
</div>
<script>
// 选项卡切换
document.querySelectorAll('.tab').forEach(tab => {
tab.addEventListener('click', () => {
// 移除所有活动状态
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
// 设置当前选项卡为活动状态
tab.classList.add('active');
document.getElementById(tab.getAttribute('data-tab')).classList.add('active');
});
});
// IP加密函数
function encryptIP(plainIp, offset) {
offset = offset || 3;
let result = '';
for (let i = 0; i < plainIp.length; i++) {
const code = plainIp.charCodeAt(i);
result += String.fromCharCode((code + offset) % 256);
}
return result;
}
// 服务端计算(使用内网IP)
document.getElementById('calculate-server').addEventListener('click', function() {
const ip = document.getElementById('server-internal-ip').value.trim();
const port = document.getElementById('server-port').value.trim();
if (!ip || !port) {
alert('请填写内网IP地址和端口!');
return;
}
// 验证IP格式
const ipPattern = /^(\d{1,3}\.){3}\d{1,3}$/;
if (!ipPattern.test(ip)) {
alert('IP地址格式不正确!');
return;
}
// 计算加密后的IP字符串(偏移量5)
const encryptedIp = encryptIP(ip, 5);
// 计算MD5值:内网IP + 解密IP + 端口 + "967"
// 注意:解密IP就是原始IP,因为加密后解密会得到原始IP
const md5String = ip + ip + port + "967";
const md5Result = md5(md5String);
// 显示结果
document.getElementById('server-encrypted-ip').textContent = encryptedIp;
document.getElementById('server-encrypted-code').textContent = encryptedIp;
document.getElementById('server-md5-value').textContent = md5Result;
document.getElementById('server-md5-compare').textContent = md5Result;
document.getElementById('server-ip-array').textContent = ip.split('.').join(', ');
document.getElementById('server-port-value').textContent = port;
document.getElementById('server-result').style.display = 'block';
});
// 客户端计算(使用外网IP)
document.getElementById('calculate-client').addEventListener('click', function() {
const ip = document.getElementById('client-external-ip').value.trim();
const port = document.getElementById('client-port').value.trim();
if (!ip || !port) {
alert('请填写外网IP地址和端口!');
return;
}
// 验证IP格式
const ipPattern = /^(\d{1,3}\.){3}\d{1,3}$/;
if (!ipPattern.test(ip)) {
alert('IP地址格式不正确!');
return;
}
// 计算加密后的IP字符串(偏移量3)
const encryptedIp = encryptIP(ip, 3);
// 计算MD5值:解密IP + 外网IP + 端口
// 注意:解密IP就是原始IP
const md5String = ip + ip + port;
const md5Result = md5(md5String);
// 显示结果
document.getElementById('client-encrypted-ip').textContent = encryptedIp;
document.getElementById('client-encrypted-code').textContent = encryptedIp;
document.getElementById('client-md5-value').textContent = md5Result;
document.getElementById('client-md5-compare').textContent = md5Result;
document.getElementById('client-ip-array').textContent = ip.split('.').join(', ');
document.getElementById('client-result').style.display = 'block';
});
// 完整配置计算(区分内外网IP)
document.getElementById('calculate-both').addEventListener('click', function() {
const internalIp = document.getElementById('both-internal-ip').value.trim();
const externalIp = document.getElementById('both-external-ip').value.trim();
const port = document.getElementById('both-port').value.trim();
if (!internalIp || !externalIp || !port) {
alert('请填写内网IP、外网IP和端口!');
return;
}
// 验证IP格式
const ipPattern = /^(\d{1,3}\.){3}\d{1,3}$/;
if (!ipPattern.test(internalIp) || !ipPattern.test(externalIp)) {
alert('IP地址格式不正确!');
return;
}
// 服务端计算(使用内网IP,偏移量5)
const serverEncryptedIp = encryptIP(internalIp, 5);
const serverMd5String = internalIp + internalIp + port + "967";
const serverMd5Result = md5(serverMd5String);
// 客户端计算(使用外网IP,偏移量3)
const clientEncryptedIp = encryptIP(externalIp, 3);
const clientMd5String = externalIp + externalIp + port;
const clientMd5Result = md5(clientMd5String);
// 显示结果
document.getElementById('both-server-ip-array').textContent = internalIp.split('.').join(', ');
document.getElementById('both-server-port').textContent = port;
document.getElementById('both-server-encrypted').textContent = serverEncryptedIp;
document.getElementById('both-server-md5').textContent = serverMd5Result;
document.getElementById('both-client-ip-array').textContent = externalIp.split('.').join(', ');
document.getElementById('both-client-encrypted').textContent = clientEncryptedIp;
document.getElementById('both-client-md5').textContent = clientMd5Result;
document.getElementById('both-result').style.display = 'block';
});
</script>
</body>
</html> |
|