不会php,有没有大神能把这段php改写成shell?

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
斯人93
帖子: 84
注册时间: 2012-11-04 16:46
系统: win7+ubuntu 14.04

不会php,有没有大神能把这段php改写成shell?

#1

帖子 斯人93 » 2014-05-07 16:10

代码: 全选

<?php
/**
 * 获取草榴邀请码
 * 学习研究A与V之间的相互关系
 * @author richard
 * 2013-2-28
 */ 
// 配置环境
ignore_user_abort();//关掉浏览器,PHP脚本也可以继续执行.
error_reporting(7);
set_time_limit(0);
header('Content-Type:text/html;charset=utf8');
date_default_timezone_set('RPC');

// 注册参数
$interval = 30*60;// 每隔s运行
$name = 'a';//注意长度 加起来不得超过12个字符 a+time() = 11字符
$email = 'explamp@163.com';

// 发码地址 search in google
$adressCodes = array(
    'http://127.0.0.1',// 你看不到我。。aHR0cDovL3RlY2guZ3JvdXBzLnlhaG9vLmNvbS9ncm91cC8xMDI0Lw==
);

//定时执行
do{
    start($adressCodes,$name, $email);
    sleep($interval);
}while(true);

//start($adressCodes,$name, $email);

function start($adressCodes,$name, $email){

    foreach($adressCodes as $key => $url){
        // 抓取code
        $result = getCodes($url);
        
        // 匹配code
        preg_match_all('#<!-- Description -->.*<!-- End Center Section Content -->#Us', $result, $result);
        preg_match_all('#[a-f0-9]{16}#', $result[0][0], $codes);
//        var_dump($codes[0]);
        
        if($codes[0]){
            foreach($codes[0] as $k => $code){
                // 检测是否存在记录
                $codetxt = file_get_contents('code.txt'); // code log
                if(strpos($codetxt, $code) === false){
                    
                    // 校验邀请码
                    $result = checkRegister($code);
                    sleep(2); //論壇設置:刷新不要快於 2 秒
                    if(strpos($result, "parent.retmsg_invcode('1')") === false && strpos($result, "MySQL Server Error") === false){
                        register($name, $email, $code); // 注册
                    }else{// 邀请码无效,写记录
                        file_put_contents("code.txt", $code.PHP_EOL, FILE_APPEND|LOCK_EX);
                    }
                }
            }
        }
    }
}


// 抓取code
function getCodes($url){
    // 抓取网页
    $result = array();
    $options = array(
        CURLOPT_URL => $url,
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120101 Firefox/17.0',
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_POST => 0,
        CURLOPT_TIMEOUT => 10,
    );
    $ch = curl_init();
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}

// 校验邀请码
function checkRegister($code){
    $result = array();
    $postFields = array(
        'action' => 'reginvcodeck',	
        'reginvcode' => $code
    );
    $options = array(
        CURLOPT_URL => 'http://*.*.*.244/register.php?',
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120101 Firefox/17.0',
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => http_build_query($postFields),
        CURLOPT_TIMEOUT => 10,
    );
    $ch = curl_init();
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}

// 注册
function register($name, $email, $code){
    $temp = $name.time();
    $postFields = array(
        'forward' => '',
        'invcode' => $code,
        'regemail' => $email,
        'regname' => $temp,
        'regpwd' => '123456',
        'regpwdrepeat' => '123456',
        'step' => '2'
    );
    $options = array(
        CURLOPT_URL => 'http://*.*.*.244/register.php?',
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120101 Firefox/17.0',
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => http_build_query($postFields),
        CURLOPT_TIMEOUT => 10,
    );
    $ch = curl_init();
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    curl_close($ch);
    
    if($result){
        $result = iconv('gbk', 'utf-8', $result);
        if(strpos($result, "邀請碼錯誤") === false && strpos($result, "MySQL Server Error") === false){
    		file_put_contents("caoliu.txt", $temp.PHP_EOL, FILE_APPEND|LOCK_EX);
        }
    }
    if(!$result || strpos($result, "MySQL Server Error") !== false){
        sleep(2);//論壇設置:刷新不要快於 2 秒
        register($name, $email, $code);
    }
}
这是网上找的某榴的抓取邀请码并注册的php代码,苦于不懂php,请大虾帮忙改写,万分感激!!
所谓创新,就是经过深思熟虑的模仿
ipposis
帖子: 333
注册时间: 2013-12-23 13:42

Re: 不会php,有没有大神能把这段php改写成shell?

#2

帖子 ipposis » 2014-05-07 16:34

果然看内核源码还是有点用的 :em06
头像
月下叹逍遥
论坛版主
帖子: 33994
注册时间: 2010-10-07 14:23
系统: Archdows10
来自: 某系某星某洲某国某省某市
联系:

Re: 不会php,有没有大神能把这段php改写成shell?

#3

帖子 月下叹逍遥 » 2014-05-07 16:35

太直白了把。。。 :em11 :em11 :em11
浮生七十今三十,从此凄惶未可知
头像
susbarbatus
帖子: 2966
注册时间: 2010-04-10 16:14
系统: Arch Linux

Re: 不会php,有没有大神能把这段php改写成shell?

#4

帖子 susbarbatus » 2014-05-07 16:41

:em20 只是用又不需要看懂
沉迷将棋中……
头像
斯人93
帖子: 84
注册时间: 2012-11-04 16:46
系统: win7+ubuntu 14.04

Re: 不会php,有没有大神能把这段php改写成shell?

#5

帖子 斯人93 » 2014-05-07 17:07

susbarbatus 写了::em20 只是用又不需要看懂
额,学习学习嘛,以后再遇到这种咱就可以自己动手了嘛。 :em03
所谓创新,就是经过深思熟虑的模仿
回复