├── proxy.php ├── index.html └── README.md /proxy.php: -------------------------------------------------------------------------------- 1 | $_POST['hash'], 'x' => 24, 'y' => 7]); 13 | } else { 14 | echo json_encode(['error' => '无效的请求参数']); 15 | exit; 16 | } 17 | 18 | if (!isset($postData)) { 19 | $postData = http_build_query($_POST); 20 | } 21 | 22 | $options = [ 23 | 'http' => [ 24 | 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . 25 | "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36\r\n", 26 | 'method' => 'POST', 27 | 'content' => $postData, 28 | 'ignore_errors' => true, // 忽略错误以获取响应内容 29 | ], 30 | 'ssl' => [ 31 | 'verify_peer' => false, // 禁用 SSL 证书验证 32 | 'verify_peer_name' => false, // 禁用对主机名的验证 33 | ], 34 | ]; 35 | 36 | $context = stream_context_create($options); 37 | $result = file_get_contents($url, false, $context); 38 | 39 | if ($result === FALSE) { 40 | echo json_encode(['error' => '请求失败']); 41 | } else { 42 | if (strpos($url, 'my-addr') !== false) { 43 | // 处理 My-Addr 的 HTML 响应 44 | preg_match('/
Hashed string<\/span>: ([^<]+)<\/div>/', $result, $matches); 45 | if (isset($matches[1])) { 46 | echo json_encode(['result' => $matches[1]]); 47 | } else { 48 | echo json_encode(['error' => '未找到解密结果']); 49 | } 50 | } elseif (strpos($url, 't007') !== false) { 51 | // 处理 T007 的响应 52 | $data = json_decode($result, true); 53 | if (isset($data['code']) && $data['code'] === 1) { 54 | // 提取解密成功的结果 55 | preg_match('/解密成功,结果是:(.+)/', $data['desc'], $matches); 56 | if (isset($matches[1])) { 57 | echo json_encode(['result' => $matches[1]]); 58 | } else { 59 | echo json_encode(['error' => '很遗憾,没有解密成功']); 60 | } 61 | } else { 62 | echo json_encode(['error' => '很遗憾,没有解密成功']); 63 | } 64 | } elseif (strpos($url, 'md5.li') !== false) { 65 | // 处理 MD5.li 的 HTML 响应 66 | if (strpos($result, 'MD5解密成功,需要1积分查看') !== false) { 67 | echo json_encode(['error' => '需要1积分查看', 'link' => 'https://md5.li/']); 68 | } else { 69 | preg_match('/明文:<\/strong>\s*([^<]+)<\/div>/', $result, $matches); 70 | if (isset($matches[1])) { 71 | echo json_encode(['result' => trim($matches[1])]); 72 | } else { 73 | echo json_encode(['error' => '未找到解密结果']); 74 | } 75 | } 76 | } else { 77 | // 假设棉花糖返回的是 HTML,需要解析 78 | preg_match('/解密为:(\w+)/', $result, $matches); 79 | if (isset($matches[1])) { 80 | echo json_encode(['result' => $matches[1]]); 81 | } else { 82 | echo json_encode(['error' => '未找到解密结果']); 83 | } 84 | } 85 | } 86 | } 87 | ?> -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | MD5解密 7 | 8 | 26 | 27 | 28 | 29 | 48 | 49 | 50 |
51 |

MD5解密

52 |
53 | 54 | 55 |
56 | 57 |
58 |

解密结果:

59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
平台名MD5值解密结果
71 |
72 |
73 | 74 | 75 |
76 |

© 2025 MD5 解密服务. 保留所有权利.

77 |
78 | 79 | 80 | 81 | 126 | 127 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 最近,我在折腾MD5解密平台,突然想到好多年前的一个名为 [Md5Decrypt](https://github.com/tyekrgk/Md5Decrypt) 的GitHub项目,它是一个使用多个在线API来解密MD5的开源工具。受到启发,我决定写一份PHP版本的多接口MD5解密工具。在这篇博文中,我将详细介绍构建这个工具的过程。 2 | 3 | ## 项目概述 4 | 5 | 目标是创建一个网页工具,接受MD5哈希作为输入,并通过多个在线API尝试解密。这增加了成功找到原始字符串的机会,因为不同的API可能有不同的哈希数据库。 6 | 7 | 我计划: 8 | 9 | - 使用PHP处理与外部API的服务器端请求。 10 | - 使用HTML、CSS(Bootstrap)和JavaScript构建用户友好的前端。 11 | - 确保工具能够有效解析和显示结果,即使不同API返回的数据格式不同。 12 | 13 | ## 构建后端: 14 | 15 | ### 设置PHP脚本 16 | 17 | 后端脚本`proxy.php`充当前端和外部MD5解密API之间的代理。它接收来自前端的POST请求,将其转发到适当的API,并返回结果。 18 | 19 | 以下是`proxy.php`的基本结构: 20 | 21 | ```php 22 | 29 | ``` 30 | 31 | ### 处理不同的API 32 | 33 | 我支持了几个API: 34 | 35 | 1. **棉花糖MD5解密** 36 | 2. **T007解密** 37 | 3. **MD5.li解密** 38 | 4. **My-Addr解密** 39 | 40 | 每个API都有自己的端点和预期参数。脚本通过检查特定的POST参数来决定调用哪个API。 41 | 42 | ```php 43 | if (isset($_POST['md5'])) { 44 | $url = 'https://vip.bdziyi.com/hygj/md5api.php'; 45 | } elseif (isset($_POST['type']) && $_POST['type'] == 1) { 46 | $url = 'https://t007.cn/home/index/doEnDecode'; 47 | } elseif (isset($_POST['md5li']) && $_POST['md5li'] == 1) { 48 | $url = 'https://md5.li/'; 49 | } elseif (isset($_POST['myaddr']) && $_POST['myaddr'] == 1) { 50 | $url = 'http://md5.my-addr.com/md5_decrypt-md5_cracker_online/md5_decoder_tool.php'; 51 | $postData = http_build_query(['md5' => $_POST['hash'], 'x' => 24, 'y' => 7]); 52 | } else { 53 | echo json_encode(['error' => '无效的请求参数']); 54 | exit; 55 | } 56 | ``` 57 | 58 | ### 发送请求并处理响应 59 | 60 | 为每个API准备请求数据,并发送HTTP请求。处理响应时,需要根据API返回的数据格式解析结果。 61 | 62 | ```php 63 | $options = [ 64 | 'http' => [ 65 | 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . 66 | "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36\r\n", 67 | 'method' => 'POST', 68 | 'content' => $postData, 69 | 'ignore_errors' => true, 70 | ], 71 | 'ssl' => [ 72 | 'verify_peer' => false, 73 | 'verify_peer_name' => false, 74 | ], 75 | ]; 76 | 77 | $context = stream_context_create($options); 78 | $result = file_get_contents($url, false, $context); 79 | 80 | if ($result === FALSE) { 81 | echo json_encode(['error' => '请求失败']); 82 | } else { 83 | // 根据不同API的响应格式解析结果 84 | } 85 | ``` 86 | 87 | ## 构建前端 88 | 89 | 前端使用Bootstrap来创建一个简单直观的界面,用户可以在此输入MD5值并查看解密结果。 90 | 91 | ### HTML结构 92 | 93 | ```html 94 | 95 | 96 | 115 | 116 | 117 |
118 |

MD5解密

119 |
120 | 121 | 122 |
123 | 124 |
125 |

解密结果:

126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 |
平台名MD5值解密结果
138 |
139 |
140 | 141 | 142 |
143 |

© 2025 MD5 解密服务. 保留所有权利.

144 |
145 | 146 | ``` 147 | 148 | ### JavaScript逻辑 149 | 150 | 使用JavaScript处理用户输入并与后端交互,获取解密结果。 151 | 152 | ```javascript 153 | document.getElementById('decryptBtn').addEventListener('click', function() { 154 | const md5Value = document.getElementById('md5Input').value; 155 | const platforms = [ 156 | { name: '棉花糖', param: 'md5' }, 157 | { name: 'T007', param: 'type=1&txtInput' }, 158 | { name: 'MD5.li', param: 'md5li=1&hash' }, 159 | { name: 'My-Addr', param: 'myaddr=1&hash' } 160 | ]; 161 | 162 | // 清除旧结果 163 | document.getElementById('resultTable').innerHTML = ''; 164 | document.getElementById('resultSection').style.display = 'none'; 165 | 166 | platforms.forEach(platform => { 167 | fetch("proxy.php", { 168 | headers: { 169 | "accept": "application/json, text/javascript, */*; q=0.01", 170 | "content-type": "application/x-www-form-urlencoded; charset=UTF-8" 171 | }, 172 | body: `${platform.param}=${md5Value}`, 173 | method: "POST" 174 | }) 175 | .then(response => response.json()) 176 | .then(data => { 177 | let result; 178 | if (data.result) { 179 | result = data.result; 180 | } else if (data.error && data.link) { 181 | result = `需要1积分查看,请访问 md5.li`; 182 | } else { 183 | result = '很遗憾,没有解密成功'; 184 | } 185 | const row = `${platform.name}${md5Value}${result}`; 186 | document.getElementById('resultTable').insertAdjacentHTML('beforeend', row); 187 | document.getElementById('resultSection').style.display = 'block'; // 显示结果 188 | }) 189 | .catch(error => { 190 | const row = `${platform.name}${md5Value}错误: ${error}`; 191 | document.getElementById('resultTable').insertAdjacentHTML('beforeend', row); 192 | document.getElementById('resultSection').style.display = 'block'; // 显示结果 193 | }); 194 | }); 195 | }); 196 | ``` 197 | 最后的结果如图 198 | ![微信图片_20250102074306.png](https://www.1042.net/usr/uploads/2025/01/1935259974.png) 199 | 代码: 200 | Proxy.php 201 | ``` 202 | $_POST['hash'], 'x' => 24, 'y' => 7]); 214 | } else { 215 | echo json_encode(['error' => '无效的请求参数']); 216 | exit; 217 | } 218 | 219 | if (!isset($postData)) { 220 | $postData = http_build_query($_POST); 221 | } 222 | 223 | $options = [ 224 | 'http' => [ 225 | 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . 226 | "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36\r\n", 227 | 'method' => 'POST', 228 | 'content' => $postData, 229 | 'ignore_errors' => true, // 忽略错误以获取响应内容 230 | ], 231 | 'ssl' => [ 232 | 'verify_peer' => false, // 禁用 SSL 证书验证 233 | 'verify_peer_name' => false, // 禁用对主机名的验证 234 | ], 235 | ]; 236 | 237 | $context = stream_context_create($options); 238 | $result = file_get_contents($url, false, $context); 239 | 240 | if ($result === FALSE) { 241 | echo json_encode(['error' => '请求失败']); 242 | } else { 243 | if (strpos($url, 'my-addr') !== false) { 244 | // 处理 My-Addr 的 HTML 响应 245 | preg_match('/
Hashed string<\/span>: ([^<]+)<\/div>/', $result, $matches); 246 | if (isset($matches[1])) { 247 | echo json_encode(['result' => $matches[1]]); 248 | } else { 249 | echo json_encode(['error' => '未找到解密结果']); 250 | } 251 | } elseif (strpos($url, 't007') !== false) { 252 | // 处理 T007 的响应 253 | $data = json_decode($result, true); 254 | if (isset($data['code']) && $data['code'] === 1) { 255 | // 提取解密成功的结果 256 | preg_match('/解密成功,结果是:(.+)/', $data['desc'], $matches); 257 | if (isset($matches[1])) { 258 | echo json_encode(['result' => $matches[1]]); 259 | } else { 260 | echo json_encode(['error' => '很遗憾,没有解密成功']); 261 | } 262 | } else { 263 | echo json_encode(['error' => '很遗憾,没有解密成功']); 264 | } 265 | } elseif (strpos($url, 'md5.li') !== false) { 266 | // 处理 MD5.li 的 HTML 响应 267 | if (strpos($result, 'MD5解密成功,需要1积分查看') !== false) { 268 | echo json_encode(['error' => '需要1积分查看', 'link' => 'https://md5.li/']); 269 | } else { 270 | preg_match('/明文:<\/strong>\s*([^<]+)<\/div>/', $result, $matches); 271 | if (isset($matches[1])) { 272 | echo json_encode(['result' => trim($matches[1])]); 273 | } else { 274 | echo json_encode(['error' => '未找到解密结果']); 275 | } 276 | } 277 | } else { 278 | // 假设棉花糖返回的是 HTML,需要解析 279 | preg_match('/解密为:(\w+)/', $result, $matches); 280 | if (isset($matches[1])) { 281 | echo json_encode(['result' => $matches[1]]); 282 | } else { 283 | echo json_encode(['error' => '未找到解密结果']); 284 | } 285 | } 286 | } 287 | } 288 | ?> 289 | ``` 290 | index.html 291 | ``` 292 | 293 | 294 | 295 | 296 | 297 | MD5解密 298 | 299 | 317 | 318 | 319 | 320 | 339 | 340 | 341 |
342 |

MD5解密

343 |
344 | 345 | 346 |
347 | 348 |
349 |

解密结果:

350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 |
平台名MD5值解密结果
362 |
363 |
364 | 365 | 366 |
367 |

© 2025 MD5 解密服务. 保留所有权利.

368 |
369 | 370 | 371 | 372 | 417 | 418 | 419 | ``` 420 | --------------------------------------------------------------------------------