1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$ciblefin = $_POST['$ciblefin'];
$cible = $_POST['$cible'];
Define('AUTHENTIFICATION', 'http://------------------------------------------------/');
Define('COOKIE_FILE','cookie.txt');
Define('EMPTY_FILE',"emptyfile.txt");
Define('USER_AGENT','Mozilla/5.0');
Define('LOGIN','---------');
Define('PASSWORD','-------');
$message = "bla bla blllllllllllllllllllllllaaaaaaaaaaaaaaaaaa";
$image = "image1.jpg";
if(send_sms($cible,$message,$image)) echo("sms ok au : $cible");
else echo("Impossible de trouver le token ou message trop long. Message non transmis. Mauvais logins ?");
/
function send_sms($cible,$message,$image)
{
//Encodage d
$message = utf8_decode($message);
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, AUTHENTIFICATION);
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath(COOKIE_FILE));
curl_setopt($ch, CURLOPT_COOKIEFILE, realpath(COOKIE_FILE));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, USER_AGENT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.------------------------------spring_cas_security_check");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS,"target=&_eventId=¤tPage=&username=".LOGIN."&password=".PASSWORD);
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath(COOKIE_FILE));
curl_setopt($ch, CURLOPT_COOKIEFILE, realpath(COOKIE_FILE));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, "----------/index.do");
$ret = curl_exec($ch);
if ($ret === FALSE) {
die(curl_errno($ch));
}
preg_match("!\"CSRFToken\" value=\"([0-9]*)!",$ret,$out);
if(!isset($out[1]))
{
return 0;
}
$token = $out[1];
$array = Array(
"CSRFToken" => $token,
"idMessage" => '',
"submitMethod" => 'web',
"todo" => '',
"boxId" => 'sent',
'galleryItem' => '-1',
'msisdns' => $cible,
'emails' => '',
'emoticones' => ':)',
'message' => $message,
'file' => '@'.realpath(EMPTY_FILE)
);
curl_setopt($ch, CURLOPT_URL, "http://www.-------------------------------------------/submit.do");
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath(COOKIE_FILE));
curl_setopt($ch, CURLOPT_COOKIEFILE, realpath(COOKIE_FILE));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS,$array);
$ret = curl_exec($ch);
preg_match("!\"CSRFToken\" value=\"([0-9]*)!",$ret,$out);
$token = $out[1];
//Confirmation
$array = Array(
"CSRFToken" => $token,
"idMessage" => '',
"submitMethod" => 'web',
"todo" => '',
"boxId" => 'sent',
'emoticones' => ':)',
'mms' => 'false',
'message' => $message
);
curl_setopt($ch, CURLOPT_URL, "http://www.-----------------------------------------------------------------");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS,$array);
$ret = curl_exec($ch);
curl_close($ch);
if(strpos($ret,"Le Texto a été expédié avec succès !") === false) return 0;
else return 1;
return 1;
}
?>
</body>
</html> |
Partager