欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

查双因素 管理员 密码 有大用 有大大用

<?php


function _my_curl_login_sys($method = 'POST',$data='',$cookie)
{
   $data = array(
       'EmployeeID'=>'aaaaaa',
       'Password'=>'bbbb',
       'Action' =>'Login'
   );
//    $header[] = $_SERVER['HTTP_USER_AGENT'];
//    $header[] = "Host:192.168.2.47";
//    $header[] = 'Pragma:no-cache';
//    $header[] = 'Connection:keep-Alive';
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "http://192.168.0.117/Smart_Factory/action.php");
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // to resolve your current error
   curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
   curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
   curl_setopt($ch, CURLOPT_POSTFIELDS,$data); // Post提交的数据包
//    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
   curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
//    curl_setopt ($ch,CURLOPT_REFERER,'https://192.168.2.47/login/?next=/');
   curl_setopt ($ch,CURLOPT_COOKIE,$cookie);
   curl_setopt($ch, CURLOPT_HEADER, 1);
   $response = curl_exec($ch);
   if (curl_error($ch)) {
       $response = curl_error($ch);
   }
   curl_close($ch);
   return $response;
}
$r = _my_curl_login_sys('POST','');

preg_match_all('|PHPSESSID=(.*);|isU',$r,$m);
$PHPSESSID = $m[1][0];

preg_match_all('|UserType=(.*);|isU',$r,$m);
$UserType = $m[1][0];

preg_match_all('|Username=(.*);|isU',$r,$m);
$Username = $m[1][0];

preg_match_all('|EmployeeID=(.*);|isU',$r,$m);
$EmployeeID = $m[1][0];

preg_match_all('|Useremail=(.*);|isU',$r,$m);
$Useremail = $m[1][0];

preg_match_all('|UserInfo=(.*);|isU',$r,$m);
$UserInfo = $m[1][0];



$cookie="PHPSESSID={$PHPSESSID};UserType={$UserType};Username={$Username};EmployeeID={$EmployeeID};Useremail={$Useremail};UserInfo={$UserInfo};";

function _my_curl_admin($method='GET',$cookie)
{
//    $cookieFile = dirname(__FILE__).'cookie.curl.tmp';
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "http://192.168.0.117/Smart_Factory/roomAccess/db/LockScreen.php?Action=showPsw");
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // to resolve your current error
   curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
   curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
   curl_setopt($ch,CURLOPT_COOKIE,$cookie);
   curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
   $response = curl_exec($ch);
   if (curl_error($ch)) {
       $response = curl_error($ch);
   }
   curl_close($ch);
   return $response;
}
var_dump($cookie);
var_dump("AAAA");
$r1 = _my_curl_admin('GET',$cookie);
var_dump($r1)


?>


普通分类: