Ouch, c'était salé (mais pas poivré, loool)

This commit is contained in:
Boris 2022-11-15 19:46:02 +01:00
parent bf34c4afe8
commit 04d951a129
2 changed files with 43 additions and 16 deletions

View File

@ -21,17 +21,25 @@ class Fred {
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper);
$page1 = @file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query)
or die('<p>On a fait du sale.</p>');
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query);
if (empty($page1)) {
throw Exception("J'ai pas pû récupérer la putain de première page.");
}
preg_match("`url='([^']+)'`isU", $page1, $matches);
$url = $matches[1];
sleep($this->gatewayDelay);
$page2 = @file_get_contents($url)
or die('</p>On a chié dans la colle.</p>');
$page2 = file_get_contents($url);
if (empty($page2)) {
throw Exception("J'ai pas pû récupérer la putain de deuxième page.");
}
preg_match("`url='.*/ipns/([^']+)'`isU", $page2, $matches);
@ -52,8 +60,12 @@ class Fred {
// echo '<pre>'; var_dump(htmlspecialchars($url)); echo '</pre>';
$page1 = file_get_contents($url)
or die('<p>On a fait du sale.</p>');
$page1 = file_get_contents($url);
if (empty($page1)) {
throw Exception("J'ai pas pû récupérer la putain de première page.");
}
// echo '<pre>'; var_dump(htmlspecialchars($page1)); echo '</pre>';
@ -64,11 +76,17 @@ class Fred {
// echo '<pre>'; var_dump($url); echo '</pre>';
$page2 = '';
$rounds = 0;
while (empty($page2)) {
while (empty($page2) and $rounds < 10) {
sleep($this->gatewayDelay);
$page2 = @file_get_contents($url);
$page2 = file_get_contents($url);
}
if (empty($page2)) {
throw Exception("J'ai pas pû récupérer la putain de deuxième page.");
}
// echo '<pre>'; var_dump(htmlspecialchars($page2)); echo '</pre>';
@ -85,7 +103,7 @@ class Fred {
$salt = $prenomNom;
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
$query = 'salt='. $salt .'&pepper='. $pepper . '&g1pub=on';
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&g1pub=on';
$url = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
@ -101,9 +119,14 @@ class Fred {
$context = stream_context_create($opts);
$page1 = file_get_contents($url, false, $context);
if (empty($page1)) {
throw Exception("J'ai pas pû récupérer la putain de première page.");
}
// die('<pre>' . htmlspecialchars($page1) . '</pre>');
preg_match("`url='([^']+)'`isU", $page1, $matches);
@ -117,8 +140,6 @@ class Fred {
// die('<pre>' . var_dump($url, true) . '</pre>');
$page2 = '';
$opts2 = array(
'http'=>array(
'method'=>"GET",
@ -129,20 +150,26 @@ class Fred {
$context2 = stream_context_create($opts2);
sleep(3);
$page2 = '';
while (empty($page2)) {
$rounds = 0;
while (empty($page2) and $rounds < 10) {
sleep($this->gatewayDelay);
$page2 = file_get_contents($url, false, $context2);
}
if (empty($page2)) {
throw 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;
}
}

View File

@ -20,7 +20,7 @@ if (isset($_POST['salt'], $_POST['pepper'])) {
$playerG1Id = $fred->donneMoiSaPutaindeG1Pub($_POST['salt'], $_POST['pepper']);
} catch (Exception $errMsg) {
ErrorsHandler::kaput($errMsg);
}