From af5a905f798f52cf9145432c05d78b0b58490511 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 14 Mar 2023 14:19:36 +0100 Subject: [PATCH] Updating with (1234 API ) https://git.p2p.legal/STI/Astroport.ONE/src/branch/master/API/SALT.sh --- lib/Fred.class.php | 214 ++++++++++++++++++++++----------------------- 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/lib/Fred.class.php b/lib/Fred.class.php index ccbf7d8..f6865fe 100644 --- a/lib/Fred.class.php +++ b/lib/Fred.class.php @@ -1,175 +1,175 @@ gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query); - - if (empty($page1)) { + $query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) .'&getipns=yes'; - throw new Exception("J'ai pas pû récupérer la putain de première page."); - } + $page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query); - preg_match("`url='([^']+)'`isU", $page1, $matches); + if (empty($page1)) { - $url = $matches[1]; - - sleep($this->gatewayDelay); + throw new Exception("J'ai pas pû récupérer la putain de première page."); + } - $page2 = file_get_contents($url); + preg_match("`url='([^']+)'`isU", $page1, $matches); - if (empty($page2)) { + $url = $matches[1]; - throw new Exception("J'ai pas pû récupérer la putain de deuxième page."); - } + sleep($this->gatewayDelay); - preg_match("`url='.*/ipns/([^']+)'`isU", $page2, $matches); + $page2 = file_get_contents($url); - $ipnsKey = $matches[1]; + if (empty($page2)) { - return $ipnsKey; - } + throw new Exception("J'ai pas pû récupérer la putain de deuxième page."); + } - public function donneMoiSesPutainDeMessagesGchange ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday, $gchangeName) { + preg_match("`url='.*/ipns/([^']+)'`isU", $page2, $matches); + $ipnsKey = $matches[1]; - $salt = $prenomNom; - $pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday; + return $ipnsKey; + } - $query = 'salt='. $salt .'&pepper='. $pepper . '&messaging=' . $gchangeName; + public function donneMoiSesPutainDeMessagesGchange ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday, $gchangeName) { - $url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query; - // echo '
'; var_dump(htmlspecialchars($url)); echo '
'; + $salt = $prenomNom; + $pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday; - $page1 = file_get_contents($url); + $query = 'salt='. $salt .'&pepper='. $pepper . '&messaging=' . $gchangeName; - if (empty($page1)) { + $url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query; - throw new Exception("J'ai pas pû récupérer la putain de première page."); - } + // echo '
'; var_dump(htmlspecialchars($url)); echo '
'; - // echo '
'; var_dump(htmlspecialchars($page1)); echo '
'; + $page1 = file_get_contents($url); - preg_match("`url='([^']+)'`isU", $page1, $matches); + if (empty($page1)) { - $url = $matches[1]; - - // echo '
'; var_dump($url); echo '
'; + throw new Exception("J'ai pas pû récupérer la putain de première page."); + } - $page2 = ''; - $rounds = 0; + // echo '
'; var_dump(htmlspecialchars($page1)); echo '
'; - while (empty($page2) and $rounds < 10) { + preg_match("`url='([^']+)'`isU", $page1, $matches); - sleep($this->gatewayDelay); - $page2 = file_get_contents($url); - } + $url = $matches[1]; - if (empty($page2)) { + // echo '
'; var_dump($url); echo '
'; - throw new Exception("J'ai pas pû récupérer la putain de deuxième page."); - } - - // echo '
'; var_dump(htmlspecialchars($page2)); echo '
'; + $page2 = ''; + $rounds = 0; - $json = $page2; - - return json_decode($json); + while (empty($page2) and $rounds < 10) { - } - - public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) { + sleep($this->gatewayDelay); + $page2 = file_get_contents($url); + } + if (empty($page2)) { - $salt = $prenomNom; - $pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday; + throw new Exception("J'ai pas pû récupérer la putain de deuxième page."); + } - $query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&g1pub=on'; + // echo '
'; var_dump(htmlspecialchars($page2)); echo '
'; - $url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query; + $json = $page2; - // echo '
'; var_dump(htmlspecialchars($url)); echo '
'; + return json_decode($json); - $opts = array( - 'http'=>array( - 'method'=>"GET", - 'header'=>"Accept-language: fr\r\n", - 'follow_location' => 0 - ) - ); + } - $context = stream_context_create($opts); + public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) { - $page1 = file_get_contents($url, false, $context); + $salt = $prenomNom; + $pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday; - if (empty($page1)) { + $query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&getg1pub=yes'; - throw new Exception("J'ai pas pû récupérer la putain de première page."); - } + $url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query; - // die('
' . htmlspecialchars($page1) . '
'); + // echo '
'; var_dump(htmlspecialchars($url)); echo '
'; - preg_match("`url='([^']+)'`isU", $page1, $matches); + $opts = array( + 'http'=>array( + 'method'=>"GET", + 'header'=>"Accept-language: fr\r\n", + 'follow_location' => 0 + ) + ); - // die( - // '
' . htmlspecialchars($page1) . '
' . - // '
' . print_r($matches, true) . '
' - // ); + $context = stream_context_create($opts); - $url = $matches[1]; + $page1 = file_get_contents($url, false, $context); - // die('
' . var_dump($url, true) . '
'); - $opts2 = array( - 'http'=>array( - 'method'=>"GET", - 'header'=>"Accept-language: fr\r\n", - 'follow_location' => 0 - ) - ); + if (empty($page1)) { - $context2 = stream_context_create($opts2); + throw new Exception("J'ai pas pû récupérer la putain de première page."); + } - $page2 = ''; + // die('
' . htmlspecialchars($page1) . '
'); - $rounds = 0; + preg_match("`url='([^']+)'`isU", $page1, $matches); - while (empty($page2) and $rounds < 10) { + // die( + // '
' . htmlspecialchars($page1) . '
' . + // '
' . print_r($matches, true) . '
' + // ); - sleep($this->gatewayDelay); + $url = $matches[1]; - $page2 = file_get_contents($url, false, $context2); - } + // die('
' . var_dump($url, true) . '
'); - if (empty($page2)) { + $opts2 = array( + 'http'=>array( + 'method'=>"GET", + 'header'=>"Accept-language: fr\r\n", + 'follow_location' => 0 + ) + ); - throw new Exception("J'ai pas pû récupérer la putain de deuxième page."); - } + $context2 = stream_context_create($opts2); - preg_match("`url='.*/user/([^']+)/'`isU", $page2, $matches); + $page2 = ''; - $gchangeId = $matches[1]; + $rounds = 0; - return $gchangeId; - } -} \ No newline at end of file + while (empty($page2) and $rounds < 10) { + + sleep($this->gatewayDelay); + + $page2 = file_get_contents($url, false, $context2); + } + + if (empty($page2)) { + + throw new Exception("J'ai pas pû récupérer la putain de deuxième page."); + } + + preg_match("`url='.*/user/([^']+)/'`isU", $page2, $matches); + + $gchangeId = $matches[1]; + + return $gchangeId; + } +}