03
2020-10-11
jrmu
$fpr = "hash: ".$_REQUEST["id"]."\n";
04
2020-10-11
jrmu
$fpr .= "remote addr: ".$_SERVER['REMOTE_ADDR']."\n";
05
2020-10-11
jrmu
$fpr .= "http_x_forwarded: ".$_SERVER['HTTP_X_FORWARDED_FOR']."\n";
06
2020-10-11
jrmu
$fpr .= "time: ".date("Y-m-d H:i:s")."\n";
07
2020-10-11
jrmu
foreach (getallheaders() as $name => $value) {
08
2020-10-11
jrmu
$fpr .= "$name: $value\n";
10
2020-10-11
jrmu
$fpr .= "\n";
11
2020-10-11
jrmu
$vhost = base64_decode($_REQUEST["vhost"]);
12
2020-10-11
jrmu
$file = '../../botnow/www';
13
2020-10-11
jrmu
$current = file_get_contents($file);
14
2020-10-11
jrmu
$current .= $fpr;
15
2020-10-11
jrmu
file_put_contents($file, $current);
17
2020-10-11
jrmu
session_start();
18
2020-10-11
jrmu
$captcha = $vhost;
20
2020-10-11
jrmu
// The capcha will be stored
21
2020-10-11
jrmu
// for the session
22
2020-10-11
jrmu
$_SESSION["captcha"] = $captcha;
24
2020-10-11
jrmu
// Generate a 50x24 standard captcha image
25
2020-10-11
jrmu
$im = imagecreatetruecolor(50, 24);
27
2020-10-11
jrmu
// Blue color
28
2020-10-11
jrmu
$bg = imagecolorallocate($im, 22, 86, 165);
30
2020-10-11
jrmu
// White color
31
2020-10-11
jrmu
$fg = imagecolorallocate($im, 255, 255, 255);
33
2020-10-11
jrmu
// Give the image a blue background
34
2020-10-11
jrmu
imagefill($im, 0, 0, $bg);
36
2020-10-11
jrmu
// Print the captcha text in the image
37
2020-10-11
jrmu
// with random position & size
38
2020-10-11
jrmu
imagestring($im, rand(1, 7), rand(1, 7),
39
2020-10-11
jrmu
rand(1, 7), $captcha, $fg);
41
2020-10-11
jrmu
// VERY IMPORTANT: Prevent any Browser Cache!!
42
2020-10-11
jrmu
header("Cache-Control: no-store,
43
2020-10-11
jrmu
no-cache, must-revalidate");
45
2020-10-11
jrmu
// The PHP-file will be rendered as image
46
2020-10-11
jrmu
header('Content-type: image/png');
48
2020-10-11
jrmu
// Finally output the captcha as
49
2020-10-11
jrmu
// PNG image the browser
50
2020-10-11
jrmu
imagepng($im);
52
2020-10-11
jrmu
// Free memory
53
2020-10-11
jrmu
imagedestroy($im);