Merge branch 'fred' into main

This commit is contained in:
fred 2023-03-14 14:37:32 +01:00
commit 32432e93ee
1 changed files with 107 additions and 107 deletions

View File

@ -1,175 +1,175 @@
<?php <?php
class Fred { class Fred {
private $gatewayProtocol = 'http';
private $gatewayDomain = 'libra.copylaradio.com'; private $gatewayProtocol = 'http';
private $gatewayPort = '1234'; private $gatewayDomain = 'astroport.copylaradio.com';
private $gatewayDelay = 3; private $gatewayPort = '1234';
public function __construct () { private $gatewayDelay = 5;
} public function __construct () {
public function donneMoiLaPutainDeClefIPNS ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) { }
$salt = $prenomNom; public function donneMoiLaPutainDeClefIPNS ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper); $salt = $prenomNom;
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query); $query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) .'&getipns=yes';
if (empty($page1)) {
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]; throw new Exception("J'ai pas pû récupérer la putain de première page.");
}
sleep($this->gatewayDelay);
$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; return $ipnsKey;
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday; }
$query = 'salt='. $salt .'&pepper='. $pepper . '&messaging=' . $gchangeName; public function donneMoiSesPutainDeMessagesGchange ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday, $gchangeName) {
$url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>'; $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 '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
}
// echo '<pre>'; var_dump(htmlspecialchars($page1)); echo '</pre>'; $page1 = file_get_contents($url);
preg_match("`url='([^']+)'`isU", $page1, $matches); if (empty($page1)) {
$url = $matches[1]; throw new Exception("J'ai pas pû récupérer la putain de première page.");
}
// echo '<pre>'; var_dump($url); echo '</pre>';
$page2 = ''; // echo '<pre>'; var_dump(htmlspecialchars($page1)); echo '</pre>';
$rounds = 0;
while (empty($page2) and $rounds < 10) { preg_match("`url='([^']+)'`isU", $page1, $matches);
sleep($this->gatewayDelay); $url = $matches[1];
$page2 = file_get_contents($url);
}
if (empty($page2)) { // echo '<pre>'; var_dump($url); echo '</pre>';
throw new Exception("J'ai pas pû récupérer la putain de deuxième page."); $page2 = '';
} $rounds = 0;
// echo '<pre>'; var_dump(htmlspecialchars($page2)); echo '</pre>';
$json = $page2; while (empty($page2) and $rounds < 10) {
return json_decode($json);
} sleep($this->gatewayDelay);
$page2 = file_get_contents($url);
public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) { }
if (empty($page2)) {
$salt = $prenomNom; throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday; }
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&g1pub=on'; // echo '<pre>'; var_dump(htmlspecialchars($page2)); echo '</pre>';
$url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query; $json = $page2;
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>'; 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('<pre>' . htmlspecialchars($page1) . '</pre>'); // echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
preg_match("`url='([^']+)'`isU", $page1, $matches); $opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: fr\r\n",
'follow_location' => 0
)
);
// die( $context = stream_context_create($opts);
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
// '<pre>' . print_r($matches, true) . '</pre>'
// );
$url = $matches[1]; $page1 = file_get_contents($url, false, $context);
// die('<pre>' . var_dump($url, true) . '</pre>');
$opts2 = array( if (empty($page1)) {
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: fr\r\n",
'follow_location' => 0
)
);
$context2 = stream_context_create($opts2); throw new Exception("J'ai pas pû récupérer la putain de première page.");
}
$page2 = ''; // die('<pre>' . htmlspecialchars($page1) . '</pre>');
$rounds = 0; preg_match("`url='([^']+)'`isU", $page1, $matches);
while (empty($page2) and $rounds < 10) { // die(
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
// '<pre>' . print_r($matches, true) . '</pre>'
// );
sleep($this->gatewayDelay); $url = $matches[1];
$page2 = file_get_contents($url, false, $context2); // die('<pre>' . var_dump($url, true) . '</pre>');
}
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; 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;
}
}