我有一个 pastebin 刮板脚本,旨在查找泄露的电子邮件和密码,以制作像HaveIBeenPwned这样的网站。
这是我的脚本正在执行的操作: - 从https://psbdmp.ws/dumps
抓取 Pastebin 链接
- 使用此随机代理 API 获取随机代理(因为如果您敲击太多请求,Pastebin 会禁止您的 IP):https:// api.getproxylist.com/proxy
- 向 Pastebin 链接发出 CURL 请求,然后按 . 格式查找所有电子邮件地址和密码。
实际的脚本似乎工作正常,但优化不够,一段时间后给我一个 524 超时错误,我怀疑这是因为所有这些 CURL 请求。这是我的代码:preg_match_all
email:password
api.php
function comboScrape_CURL($url) {
// Get random proxy
$proxies->json = file_get_contents("https://api.getproxylist.com/proxy");
$proxies->decoded = json_decode($proxies->json);
$proxy = $proxies->decoded->ip.':'.$proxies->decoded->port;
list($ip,$port) = explode(':', $proxy);
// Crawl with proxy
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
comboScrape('email:pass',$curl_scraped_page);
}
index.php
require('api.php');
$expression = "/(?:https\:\/\/pastebin\.com\/\w+)/";
$extension = ['','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20'];
foreach($extension as $pge_number) {
$dumps = file_get_contents("https://psbdmp.ws/dumps/".$pge_number);
preg_match_all($expression,$dumps,$urls);
$codes = str_replace('https://pastebin.com/','',$urls[0]);
foreach ($codes as $code) {
comboScrape_CURL("https://pastebin.com/raw/".$code);
}
}