Leendesst
22.10.2018, 02:40
Всем хай, столкнулся с проблемой. Достал логин и пароль администратора. Нужно войти в игру для получения данных MySQL командами (Фича одного плагина)
При авторизации в лаунчере дропает сообщение:"Аккаунт привязан к hwid!"
Собственно вот в чём вопрос, как это можно обойти?
Имеется php-часть лаунчера.
PHP:
",$cipher->h2s($data));
//$list=explode("<>",$data);
if(count($list)info= array(
"login"=>$this->clear($list[0]),
"pass"=>$list[1],
"client"=>$list[2],
"os"=>$this->clear2($cipher->h2s($list[3])),
"hwid"=>$this->clear($list[4])
);
}
public functionprocess(){
$this->check();
if($this->checkHWIDBan()){
if($this->checkBrute()){
if($this->auth())$this->postAuth();
}
}
}
public functioncheck(){
if(strlen($this->info['login'])info['login'])>16) die('Неверная длина логин а! Допустимо от 3 до 16 сим волов');
if(strlen($this->info['pass'])info['pass'])>40orstrlen($this->info['hwid'])!=32) die("Неверная длина пароля! До устимо от 3 до 40 символов");
if (!preg_match("/^[a-zA-Z0-9_-]+$/",$this->info['login']) or !preg_match("/^[a-zA-Z0-9_-]+$/",$this->info['hwid']) or !ctype_digit($this->info['client'])) die('Обнаружены запрещенн е сиволы!');
if(ctype_digit($this->info['login'])) die('Ники из цифр запреще ы!');
}
public functioncheckHWIDBan(){
$hwid=$this->info['hwid'];
$userdata= newUser();
if($userdata->getHwids($hwid,true)>0) {
echo"Бан по железяке";
returnfalse;
}
returntrue;
}
public functioncheckBrute(){
global$db;
$time=time();
$hwid=$this->info['hwid'];
$q0=$db->delete("DELETE from brute where time select("SELECT time from brute where hwid='$hwid'");
if(count($q1)!=0) {
$f1=$q1[0]['time']-$time;
echo"Защита от подбора паролей ! Подождите$f1секунд!";
returnfalse;
}
returntrue;
}
public functionauth(){
global$db,$brute_check,$brute_time ,$authengine;
$engine= newEngine($this->info['login'],$this->info['pass'],$authengine);
$user=$engine->processAuth();
if($user){
if($this->info['client']==100) die("OK");
$this->info['realuser'] =$user;
returntrue;
} else {
if($brute_check) {
$time1=time()+$brute_time;
$hwid=$this->info['hwid'];
$db->insert("INSERT INTO `brute` (hwid,time) VALUES ('$hwi d','$time1')");
}
echo"Неверный логин или пароль !";
returnfalse;
}
}
public functiongetSessionId(){
$cipher= newCipher();
return$cipher->gsd($this->info['login'].$this->info['pass'].$this->info['hwid']);
}
public functionpostAuth(){
global$prefs,$db,$ac;
$client= newClient($prefs['servers'][$this->info['client']]);
if(!$client->clientExists()) {
if(!$client->tryCreate()){
echo"Не хватает прав на создан ие папки клиента!";
returnfalse;
}
}
$hwid=$this->info['hwid'];
$os=$this->info['os'];
$user=$this->info['realuser'];
$cipher= newCipher();
$uuid=$cipher->getPlayerUUID($user);
$ses=$this->getSessionId();
$userdata= newUser();
$userdata->getForName($user);
if($userdata->get('banned')=='1'){
echo"Ваш аккаунт забанен!";
returnfalse;
}
if($userdata->exists()){
$userdata->set('session',$ses);
$userdata->set('hwid2',$hwid);
$userdata->set('os',$os);
$userdata->set('salt','enter');
//$userdata->set('uuid',$uuid);
$userdata->update();
} else {
if($hwid=='5bc8b3c903b946f 2a5931f4fcdf84f34'||$hwid=='9ba31d46f02abc923a0bac aafa0b1381')$hwid='abc';
$q=$db->select("SELECT * from `auth` where `hwid`='$hwid'");
if($userdata->getHwids($hwid,false)>=$ac&&$hwid!='abc') {
echo"Исчерпан лимит аккаунтов для вашего ПК!";
returnfalse;
}
$userdata->createNew($user,$os,$ses,$hwid,$uuid);
}
$id=$userdata->get('id');
if($userdata->get('priv')==1and$hwid!=$userdata->get('hwid')) {
echo"Аккаунт привязан по желез у!";
returnfalse;
}
if($userdata->get('admin')==1){
$manager= newLibraryManager($client->getVersion());
$manager->downloadLibraries();
}
$ke=substr($cipher->gsd(md5_file("launcher.jar")."fuckmykey"),16);
$kez=substr(md5($ke."fuckmykey"),16);
$kev=$cipher->encrypt("$user$ses$id$uuid
".$client->getDownloadFiles($os),$kez);
echo$ke.":".$kev;
returntrue;
}
protected functionclear($s1){
returnstr_replace(array("'",'"','\\','','$','%','/','.'),'',$s1);
}
protected functionclear2($s1){
returnstr_replace(array("'",'"','\\','','%'),'',$s1);
}
}
classEngine
{
protected$login;
protected$pass;
protected$engine;
public function__construct($login,$pass,$ engine)
{
$this->login=$login;
$this->pass=$pass;
$this->engine=$engine;
}
public functionprocessAuth(){
if($this->engine=='dle') return$this->dle();
if($this->engine=='webmcr'||$this->engine=='webMCR') return$this->webMCR();
if($this->engine=='xf'||$this->engine=='xenforo') return$this->xf();
returnfalse;
}
protected functiondle(){
global$db;
$login=$this->login;
$row=$db->select("SELECT `login`,`password` FROM `accounts` WHER E `login`='$login'");
if(count($row)==0) {
returnfalse;
}
$realPass=$row[0]['password'];
$user=$row[0]['login'];
$checkPass=md5(md5($this->pass));
if(!strcmp($realPass,$checkPass) ==0|| !$realPass) {
returnfalse;
}
return$user;
}
protected functionwebMCR(){
global$db;
$login=$this->login;
$row=$db->select("SELECT `login`,`password` FROM `accounts` WHER E `login`='$login'");
if(count($row)==0) {
returnfalse;
}
$realPass=$row[0]['password'];
$user=$row[0]['name'];
$checkPass=md5(md5($this->pass));
if(!strcmp($realPass,$checkPass) ==0|| !$realPass) {
returnfalse;
}
return$user;
}
public functionxf(){
global$db;
$login=$this->login;
$postPass=$this->pass;
$q0=$db->select("SELECT user_id,username from xf_user WHERE us ername='$login'");
if(count($q0)==0) returnfalse;
$id=$q0[0]['user_id'];
$q=$db->select("SELECT scheme_class,data FROM xf_user_authentic ate WHERE user_id='$id'");
if(count($q)==0) returnfalse;
if($q[0]['scheme_class']==='XenForo_Authentication_Core') {
$salt=substr($q[0]['data'],105,64);
$realPass=substr($q[0]['data'],22,64);
} else {
$salt=false;
$realPass=substr($q[0]['data'],22,60);
}
$cryptPass=hash_xf($realPass,$postPass,$salt);
if(!strcmp($realPass,$cryptPass) ==0|| !$realPass) returnfalse;
else return$q0[0]['username'];
}
functionhash_xf($realPass,$postPass,$salt) {
if($salt!==false) {
return$cryptPass=hash('sha 256',hash('sha256',$postPass) .$salt);
}
$itoa64='./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn opqrstuvwxyz';
$cryptPass='*0';
if (substr($realPass,0,2) ==$cry ptPass)$cryptPass='*1';
$id=substr($realPass,0,3);
# We use "$P$", phpBB3 uses "$H$" for the same thing
if ($id!='$P$'&&$id!='$H$') return$cryptPass=crypt($postPass,$rea lPass);
$count_log2=strpos($itoa64,$realPass[3]);
if ($count_log230) return$cryptP ass=crypt($postPass,$realPass);
$count=1>6) &0x3f];
if ($i++ >=16) break;
if ($i>12) &0x3f];
if ($i++ >=16) break;
$encode64.=$itoa64[($value>>18) &0x3f];
} while ($i
При авторизации в лаунчере дропает сообщение:"Аккаунт привязан к hwid!"
Собственно вот в чём вопрос, как это можно обойти?
Имеется php-часть лаунчера.
PHP:
",$cipher->h2s($data));
//$list=explode("<>",$data);
if(count($list)info= array(
"login"=>$this->clear($list[0]),
"pass"=>$list[1],
"client"=>$list[2],
"os"=>$this->clear2($cipher->h2s($list[3])),
"hwid"=>$this->clear($list[4])
);
}
public functionprocess(){
$this->check();
if($this->checkHWIDBan()){
if($this->checkBrute()){
if($this->auth())$this->postAuth();
}
}
}
public functioncheck(){
if(strlen($this->info['login'])info['login'])>16) die('Неверная длина логин а! Допустимо от 3 до 16 сим волов');
if(strlen($this->info['pass'])info['pass'])>40orstrlen($this->info['hwid'])!=32) die("Неверная длина пароля! До устимо от 3 до 40 символов");
if (!preg_match("/^[a-zA-Z0-9_-]+$/",$this->info['login']) or !preg_match("/^[a-zA-Z0-9_-]+$/",$this->info['hwid']) or !ctype_digit($this->info['client'])) die('Обнаружены запрещенн е сиволы!');
if(ctype_digit($this->info['login'])) die('Ники из цифр запреще ы!');
}
public functioncheckHWIDBan(){
$hwid=$this->info['hwid'];
$userdata= newUser();
if($userdata->getHwids($hwid,true)>0) {
echo"Бан по железяке";
returnfalse;
}
returntrue;
}
public functioncheckBrute(){
global$db;
$time=time();
$hwid=$this->info['hwid'];
$q0=$db->delete("DELETE from brute where time select("SELECT time from brute where hwid='$hwid'");
if(count($q1)!=0) {
$f1=$q1[0]['time']-$time;
echo"Защита от подбора паролей ! Подождите$f1секунд!";
returnfalse;
}
returntrue;
}
public functionauth(){
global$db,$brute_check,$brute_time ,$authengine;
$engine= newEngine($this->info['login'],$this->info['pass'],$authengine);
$user=$engine->processAuth();
if($user){
if($this->info['client']==100) die("OK");
$this->info['realuser'] =$user;
returntrue;
} else {
if($brute_check) {
$time1=time()+$brute_time;
$hwid=$this->info['hwid'];
$db->insert("INSERT INTO `brute` (hwid,time) VALUES ('$hwi d','$time1')");
}
echo"Неверный логин или пароль !";
returnfalse;
}
}
public functiongetSessionId(){
$cipher= newCipher();
return$cipher->gsd($this->info['login'].$this->info['pass'].$this->info['hwid']);
}
public functionpostAuth(){
global$prefs,$db,$ac;
$client= newClient($prefs['servers'][$this->info['client']]);
if(!$client->clientExists()) {
if(!$client->tryCreate()){
echo"Не хватает прав на создан ие папки клиента!";
returnfalse;
}
}
$hwid=$this->info['hwid'];
$os=$this->info['os'];
$user=$this->info['realuser'];
$cipher= newCipher();
$uuid=$cipher->getPlayerUUID($user);
$ses=$this->getSessionId();
$userdata= newUser();
$userdata->getForName($user);
if($userdata->get('banned')=='1'){
echo"Ваш аккаунт забанен!";
returnfalse;
}
if($userdata->exists()){
$userdata->set('session',$ses);
$userdata->set('hwid2',$hwid);
$userdata->set('os',$os);
$userdata->set('salt','enter');
//$userdata->set('uuid',$uuid);
$userdata->update();
} else {
if($hwid=='5bc8b3c903b946f 2a5931f4fcdf84f34'||$hwid=='9ba31d46f02abc923a0bac aafa0b1381')$hwid='abc';
$q=$db->select("SELECT * from `auth` where `hwid`='$hwid'");
if($userdata->getHwids($hwid,false)>=$ac&&$hwid!='abc') {
echo"Исчерпан лимит аккаунтов для вашего ПК!";
returnfalse;
}
$userdata->createNew($user,$os,$ses,$hwid,$uuid);
}
$id=$userdata->get('id');
if($userdata->get('priv')==1and$hwid!=$userdata->get('hwid')) {
echo"Аккаунт привязан по желез у!";
returnfalse;
}
if($userdata->get('admin')==1){
$manager= newLibraryManager($client->getVersion());
$manager->downloadLibraries();
}
$ke=substr($cipher->gsd(md5_file("launcher.jar")."fuckmykey"),16);
$kez=substr(md5($ke."fuckmykey"),16);
$kev=$cipher->encrypt("$user$ses$id$uuid
".$client->getDownloadFiles($os),$kez);
echo$ke.":".$kev;
returntrue;
}
protected functionclear($s1){
returnstr_replace(array("'",'"','\\','','$','%','/','.'),'',$s1);
}
protected functionclear2($s1){
returnstr_replace(array("'",'"','\\','','%'),'',$s1);
}
}
classEngine
{
protected$login;
protected$pass;
protected$engine;
public function__construct($login,$pass,$ engine)
{
$this->login=$login;
$this->pass=$pass;
$this->engine=$engine;
}
public functionprocessAuth(){
if($this->engine=='dle') return$this->dle();
if($this->engine=='webmcr'||$this->engine=='webMCR') return$this->webMCR();
if($this->engine=='xf'||$this->engine=='xenforo') return$this->xf();
returnfalse;
}
protected functiondle(){
global$db;
$login=$this->login;
$row=$db->select("SELECT `login`,`password` FROM `accounts` WHER E `login`='$login'");
if(count($row)==0) {
returnfalse;
}
$realPass=$row[0]['password'];
$user=$row[0]['login'];
$checkPass=md5(md5($this->pass));
if(!strcmp($realPass,$checkPass) ==0|| !$realPass) {
returnfalse;
}
return$user;
}
protected functionwebMCR(){
global$db;
$login=$this->login;
$row=$db->select("SELECT `login`,`password` FROM `accounts` WHER E `login`='$login'");
if(count($row)==0) {
returnfalse;
}
$realPass=$row[0]['password'];
$user=$row[0]['name'];
$checkPass=md5(md5($this->pass));
if(!strcmp($realPass,$checkPass) ==0|| !$realPass) {
returnfalse;
}
return$user;
}
public functionxf(){
global$db;
$login=$this->login;
$postPass=$this->pass;
$q0=$db->select("SELECT user_id,username from xf_user WHERE us ername='$login'");
if(count($q0)==0) returnfalse;
$id=$q0[0]['user_id'];
$q=$db->select("SELECT scheme_class,data FROM xf_user_authentic ate WHERE user_id='$id'");
if(count($q)==0) returnfalse;
if($q[0]['scheme_class']==='XenForo_Authentication_Core') {
$salt=substr($q[0]['data'],105,64);
$realPass=substr($q[0]['data'],22,64);
} else {
$salt=false;
$realPass=substr($q[0]['data'],22,60);
}
$cryptPass=hash_xf($realPass,$postPass,$salt);
if(!strcmp($realPass,$cryptPass) ==0|| !$realPass) returnfalse;
else return$q0[0]['username'];
}
functionhash_xf($realPass,$postPass,$salt) {
if($salt!==false) {
return$cryptPass=hash('sha 256',hash('sha256',$postPass) .$salt);
}
$itoa64='./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn opqrstuvwxyz';
$cryptPass='*0';
if (substr($realPass,0,2) ==$cry ptPass)$cryptPass='*1';
$id=substr($realPass,0,3);
# We use "$P$", phpBB3 uses "$H$" for the same thing
if ($id!='$P$'&&$id!='$H$') return$cryptPass=crypt($postPass,$rea lPass);
$count_log2=strpos($itoa64,$realPass[3]);
if ($count_log230) return$cryptP ass=crypt($postPass,$realPass);
$count=1>6) &0x3f];
if ($i++ >=16) break;
if ($i>12) &0x3f];
if ($i++ >=16) break;
$encode64.=$itoa64[($value>>18) &0x3f];
} while ($i