dd

QQ空间浏览自动发表留言魔力图片

jerry thinkphp 2015年11月18日 收藏
技术宅毁灭世界,QQ空间,魔力图片。
class qq {
    
    public $sid;
    public $http;
    public $qq_num;
    
    function __construct() {
        $this->http = new http;
    }
    
    function login($qq_num, $qq_pwd) {
        $data = $this->http->get("http://pt.3g.qq.com/");
        preg_match("/action=\"(.+)?\"/", $data, $matches);
        $action = $matches[1];
        $params = array();
        $params["login_url"] = "http://pt.3g.qq.com/s?aid=nLogin";
        $params["sidtype"] = 1;
        $params["loginTitle"] = "手机腾讯网";
        $params["bid"] = 0;
        $params["qq"] = $qq_num;
        $params["pwd"] = $qq_pwd;
        $params["loginType"] =3;
        $data = $this->http->post($action, http_build_query($params));
        if(count(explode("验证码",$data))>1){
            exit();
        }
        preg_match("/sid=(.+?)&/", $data, $matches);
        $this->sid = $matches[1];
        return $this->sid;
    }
    
    function sendMsg($to_num, $msg, $sid = 0) {
        $sid = $sid ? $sid : $this->sid;
        if (!$sid)
            exit();
        $params = array();
        $params["msg"] = $msg;
        $params["sign"] = 1;
        $params["ispostmsg"] = 1;
        $params["B_UID"] = $to_num;
        $params["entry"] = "board";
        $url = "http://blog60.z.qq.com/mmsgb/add_msg_action_switch.jsp?sid=" . $sid;
        $data = $this->http->post($url, http_build_query($params));
        return $data;
    }
    
}

include "include/qq.class.php";

$referer=$_SERVER['HTTP_REFERER'];

if(!strpos($referer,'infocenter')){
    header("HTTP/1.0 500 Internal Server Error");
    exit();
}

$urlArr = explode('/',$referer);
$qq_num = $urlArr['3'];

if($qq_num == "QQ"){
    header("HTTP/1.0 500 Internal Server Error");
    exit();
}

$im = @imagecreatefromjpeg("images/0.jpg");
Header("Content-type: image/jpeg");
Imagejpeg($im);
ImageDestroy($im);

$qq = new qq;
$qq -> sendMsg($qq_num,"你于".date('Y年m月d日H时i分')."浏览了本用户的空间日志!\nBY:QQ空间机器人。",$qq -> login("QQ","密码"));
dd