Skip to content
Snippets Groups Projects
Unverified Commit 72dfb8d3 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

add php frontend

parent bd538514
No related branches found
No related tags found
No related merge requests found
......@@ -58,12 +58,19 @@ end
set finalHop_postfix (grep '"/Finish.aspx' $tmpFile | sed 's/^.*href="//g' | sed 's/".*$//g')
set finalHop "https://www.mcdvoice.com$finalHop_postfix"
if [ "$finalHop_postfix" = '' ]
echo 'MSG- Invalid survey code.'
exit 3
end
echo "DEBUG: Query $finalHop"
echo "$finalHop" | grep -v Finish > /dev/null; and echo 'Failed. The final optional sheet appears. (which is not implemented). Please try again.' ; and exit 2
echo "$finalHop" | grep -v Finish > /dev/null; and echo 'MSG- Failed. The final optional sheet appears. (which is not implemented). Please try again.' ; and exit 2
set finalCookie (echo "$cookie" | sed 's/HttpOnly//g')
curl "$finalHop" --cookie "$finalCookie" -L > $tmpFile 2>&1
grep 'Validation Code' $tmpFile | sed 's/^.*ValCode">//g' | sed 's/<.*$//g'
set result_code (grep 'Validation Code' $tmpFile | sed 's/^.*ValCode">//g' | sed 's/<.*$//g')
echo "MSG- $result_code"
rm $tmpFile
......
mcd.php 0 → 100644
<html>
<head>
<title>Fuck mcdvoice</title>
</head>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$sCode = validatyInput($_POST["surveyCode"]);
$key = validatyInput($_POST["key"]);
// Warning: forced HTTPS
if($key == '5173' && preg_match('[-0-9]+', $sCode) === 1)
{
echo 'Please wait while the program is running...';
exec("./php_agent.fish $sCode", $cstdout);
_log("[mcd] working on sCode `$sCode`");
foreach($cstdout as $outLine)
echo formatedEcho($outLine);
}
else
{
echo formatedEcho("Incorrect sCode or key.");
}
printForm($sCode, $key);
}
else
{
printForm('', '');
}
function validatyInput($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
function formatedEcho($str)
{
$str = "<p style=\"font-size:40px\">$str</p>";
return $str;
}
function printForm($sCode, $key)
{
echo '<form action="index.php" method="post" style="width:70%;font-size:40px">';
echo "Survey Code: <input type='text' name='surveyCode' value='$sCode' style='width:70%;height:100px;font-size:40px'><br>";
echo "Key: <input type='password' name='key' value='$key' style='width=70%;height:100px;font-size:40px'><br>";
echo '<input type="submit" style="width:95%;height:150px;font-size:40px"></form>';
}
function _log($txt)
{
$myfile = file_put_contents('/var/log/recolic/p.log', $txt.PHP_EOL , FILE_APPEND | LOCK_EX);
}
?>
</body>
</html>
#!/usr/bin/fish
# php must check the format of $code to avoid shell-injection.
set code $argv[1]
while true
set res (./fuck_mcd.fish "$code" | grep 'MSG-')
if [ "$res" != '' ]
echo "$res"
break
end
echo 'Retrying...'
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment