maybe i should push the anubis code first you fucking moron

This commit is contained in:
2026-08-14 19:54:26 -04:00
parent bd3f5923fa
commit 01d4638687
2 changed files with 27 additions and 24 deletions

View File

@@ -45,15 +45,15 @@ class anubis{
if( if(
!isset($script["challenge"]) || !isset($script["challenge"]) ||
!is_string($script["challenge"]["randomData"]) ||
!isset($script["rules"]["difficulty"]) || !isset($script["rules"]["difficulty"]) ||
!is_int($script["rules"]["difficulty"]) || !is_int($script["rules"]["difficulty"])
!is_string($script["challenge"])
){ ){
throw new Exception("Found invalid challenge data"); throw new Exception("Found invalid challenge data");
} }
return $this->rape($script["challenge"], $script["rules"]["difficulty"]); return $this->rape($script["challenge"]["id"], $script["challenge"]["randomData"], $script["rules"]["difficulty"]);
} }
private function is_valid_hash($hash, $difficulty){ private function is_valid_hash($hash, $difficulty){
@@ -74,9 +74,10 @@ class anubis{
return true; return true;
} }
public function rape($data, $difficulty = 5){ public function rape($id, $data, $difficulty = 5){
$nonce = 0; $nonce = 0;
$microtime = microtime(true);
while(true){ while(true){
@@ -87,10 +88,12 @@ class anubis{
$hash_hex = bin2hex($hash_binary); $hash_hex = bin2hex($hash_binary);
return [ return [
"id" => $id,
"response" => $hash_hex, "response" => $hash_hex,
//"data" => $data, //"data" => $data,
//"difficulty" => $difficulty, //"difficulty" => $difficulty,
"nonce" => $nonce "nonce" => $nonce,
"elapsedTime" => round((microtime(true) - $microtime) * 1000)
]; ];
} }

View File

@@ -12,6 +12,7 @@ class startpage{
include "lib/anubis.php"; include "lib/anubis.php";
$this->anubis = new anubis(); $this->anubis = new anubis();
$this->anubis_error = "all gucci";
} }
public function getfilters($page){ public function getfilters($page){
@@ -391,7 +392,7 @@ class startpage{
if($get["npt"]){ if($get["npt"]){
$anubis_error = "Not ran on pagination"; $this->anubis_error = "Not ran on pagination";
[$post, $proxy] = $this->backend->get($get["npt"], "web"); [$post, $proxy] = $this->backend->get($get["npt"], "web");
$post = json_decode($post, true); $post = json_decode($post, true);
@@ -485,7 +486,7 @@ class startpage{
); );
}catch(Exception $error){ }catch(Exception $error){
throw new Exception("Failed to re-fetch search page"); throw new Exception("Failed to re-fetch search page. Anubis error: {$this->anubis_error}");
} }
} }
} }
@@ -503,14 +504,14 @@ class startpage{
) === 0 ) === 0
){ ){
throw new Exception("Failed to grep JSON object. Anubis error: $anubis_error"); throw new Exception("Failed to grep JSON object. Anubis error: {$this->anubis_error}");
} }
$json = json_decode($matches[1], true); $json = json_decode($matches[1], true);
if($json === null){ if($json === null){
throw new Exception("Failed to decode JSON. Anubis error: $anubis_error"); throw new Exception("Failed to decode JSON. Anubis error: {$this->anubis_error}");
} }
//print_r($json); //print_r($json);
@@ -741,7 +742,7 @@ class startpage{
if($get["npt"]){ if($get["npt"]){
$anubis_error = "Not ran on pagination"; $this->anubis_error = "Not ran on pagination";
[$post, $proxy] = $this->backend->get($get["npt"], "images"); [$post, $proxy] = $this->backend->get($get["npt"], "images");
$post = json_decode($post, true); $post = json_decode($post, true);
@@ -865,7 +866,7 @@ class startpage{
); );
}catch(Exception $error){ }catch(Exception $error){
throw new Exception("Failed to re-fetch search page"); throw new Exception("Failed to re-fetch search page. Anubis error: {$this->anubis_error}");
} }
} }
} }
@@ -886,14 +887,14 @@ class startpage{
) === 0 ) === 0
){ ){
throw new Exception("Failed to grep JSON object"); throw new Exception("Failed to grep JSON object. Anubis error: {$this->anubis_error}");
} }
$json = json_decode($matches[1], true); $json = json_decode($matches[1], true);
if($json === null){ if($json === null){
throw new Exception("Failed to decode JSON object"); throw new Exception("Failed to decode JSON object. Anubis error: {$this->anubis_error}");
} }
// get npt // get npt
@@ -936,7 +937,7 @@ class startpage{
if($get["npt"]){ if($get["npt"]){
$anubis_error = "Not ran on pagination"; $this->anubis_error = "Not ran on pagination";
[$post, $proxy] = $this->backend->get($get["npt"], "videos"); [$post, $proxy] = $this->backend->get($get["npt"], "videos");
$post = json_decode($post, true); $post = json_decode($post, true);
@@ -1030,7 +1031,7 @@ class startpage{
); );
}catch(Exception $error){ }catch(Exception $error){
throw new Exception("Failed to re-fetch search page"); throw new Exception("Failed to re-fetch search page. Anubis error: {$this->anubis_error}");
} }
} }
} }
@@ -1045,14 +1046,14 @@ class startpage{
) === 0 ) === 0
){ ){
throw new Exception("Failed to get JSON object"); throw new Exception("Failed to get JSON object. Anubis error: {$this->anubis_error}");
} }
$json = json_decode($matches[1], true); $json = json_decode($matches[1], true);
if($json === null){ if($json === null){
throw new Exception("Failed to decode JSON object"); throw new Exception("Failed to decode JSON object. Anubis error: {$this->anubis_error}");
} }
$out = [ $out = [
@@ -1122,7 +1123,7 @@ class startpage{
if($get["npt"]){ if($get["npt"]){
$anubis_error = "Not ran on pagination"; $this->anubis_error = "Not ran on pagination";
[$post, $proxy] = $this->backend->get($get["npt"], "news"); [$post, $proxy] = $this->backend->get($get["npt"], "news");
$post = json_decode($post, true); $post = json_decode($post, true);
@@ -1182,7 +1183,7 @@ class startpage{
); );
}catch(Exception $error){ }catch(Exception $error){
throw new Exception("Failed to fetch search page"); throw new Exception("Failed to fetch search page. Anubis error: {$this->anubis_error}");
} }
//$html = file_get_contents("scraper/startpage.html"); //$html = file_get_contents("scraper/startpage.html");
@@ -1211,7 +1212,7 @@ class startpage{
); );
}catch(Exception $error){ }catch(Exception $error){
throw new Exception("Failed to re-fetch search page"); throw new Exception("Failed to re-fetch search page. Anubis error: {$this->anubis_error}");
} }
} }
} }
@@ -1226,14 +1227,14 @@ class startpage{
) === 0 ) === 0
){ ){
throw new Exception("Failed to get JSON object"); throw new Exception("Failed to get JSON object. Anubis error: {$this->anubis_error}");
} }
$json = json_decode($matches[1], true); $json = json_decode($matches[1], true);
if($json === null){ if($json === null){
throw new Exception("Failed to decode JSON object"); throw new Exception("Failed to decode JSON object. Anubis error: {$this->anubis_error}");
} }
$out = [ $out = [
@@ -1466,7 +1467,6 @@ class startpage{
// //
// solve anubis challenge, if theres one // solve anubis challenge, if theres one
// //
$anubis_error = "all gucci";
$res = null; $res = null;
$cookies = []; $cookies = [];
@@ -1476,7 +1476,7 @@ class startpage{
}catch(Exception $error){ }catch(Exception $error){
// do nothang // do nothang
$anubis_error = $error->getMessage(); $this->anubis_error = $error->getMessage();
} }
if($res !== null){ if($res !== null){