http://www.facebook.com/jaffa.crvenka
PHP kôd:
<?php
/**
* @author webarto
* @copyright 2012
*/
set_time_limit(0);
$levels = array('dam_1', 'dam_2', 'dam_3', 'fab');
$method = 'setLevelPassed';
$score = 31337;
foreach(_divide($score, 4) as $key => $value)
{
$exec = _generate($method, strtr('3392;level;points', array('level' => $levels[$key], 'points' => $value)));
shell_exec($exec);
sleep(rand(300, 900));
}
# Divide sum in nearly equal values
function _divide($sum, $divisions)
{
$partials = array();
$partial = floor($sum / $divisions);
for($i = 0; $i < $divisions - 1; $i++)
{
$partials[] = mt_rand(0, 1)? $partial + rand(0, 100): $partial - rand(0, 100);
}
$partials[] = $sum - array_sum($partials);
return $partials;
}
# Generate RPC Request
function _generate($method, $params)
{
$params = explode(';', $params);
$xml = '<methodCall><methodName>jaffa.:method</methodName><params>:params<param><value><string>:checksum</string></value></param></params></methodCall>';
$checksum = null;
foreach($params as &$param)
{
$checksum .= $param;
$param = '<param><value><string>' . $param . '</string></value></param>';
}
$checksum = md5($checksum . 'j7A4f7A4');
$params = implode('', $params);
$xml = strtr($xml, array(':method' => $method, ':params' => $params, ':checksum' => $checksum));
$exec = 'curl -i -X POST -A "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0" -d "'.$xml.'" -u "jaffa:d56120de228a5c4f452af5cbf2fb0fe6" -H "Content-Type: text/xml" http://commgw1.nth.ch/rpc/jaffa';
return $exec;
}
Response:
Kôd:
HTTP/1.1 200 OK
Date: Wed, 07 Nov 2012 11:25:03 GMT
Server: HTTP Server 1.5
content-length: 120
content-type: text/xml
Via: 1.1 commgw1.nth.ch
Vary: Accept-Encoding
<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value>OK</value></param></params></methodResponse>HTTP/1.1 200 OK
Date: Wed, 07 Nov 2012 11:25:03 GMT
Server: HTTP Server 1.5
content-length: 152
content-type: text/xml
Via: 1.1 commgw1.nth.ch
Vary: Accept-Encoding
<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value>OK-New best score for current game</value></param></params></methodResponse>HTTP/1.1 200 OK
Date: Wed, 07 Nov 2012 11:25:03 GMT
Server: HTTP Server 1.5
content-length: 120
content-type: text/xml
Via: 1.1 commgw1.nth.ch
Vary: Accept-Encoding
<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value>OK</value></param></params></methodResponse>HTTP/1.1 200 OK
Date: Wed, 07 Nov 2012 11:25:04 GMT
Server: HTTP Server 1.5
content-length: 152
content-type: text/xml
Via: 1.1 commgw1.nth.ch
Vary: Accept-Encoding
<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value>OK-New best score for current game</value></param></params></methodResponse>
http://en.wikipedia.org/wiki/Security_through_obscurity