-
Notifications
You must be signed in to change notification settings - Fork 3
/
retrieve.php
60 lines (53 loc) · 1.67 KB
/
retrieve.php
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
<?php
if ( !isset($_REQUEST['session']) ) die("Must have session");
echo("<h1>Encrypted Session Unit Test</h1>\n");
$page = false;
$url = false;
$session = $_REQUEST['session'];
if ( isset($_REQUEST['server']) ) {
$url = $_REQUEST['server'] . '/direct/session/current.json';
}
if ( isset($_POST['url']) ) $url = $_POST['url'];
if (isset($_REQUEST['session']) && isset($_POST["url"]) ) {
echo("<pre>\nRetrieving ".$_POST["url"]."\n");
$c = curl_init();
curl_setopt($c, CURLOPT_URL , $url);
curl_setopt($c, CURLOPT_VERBOSE, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
$cookie = 'JSESSIONID='.$session;
curl_setopt($c, CURLOPT_COOKIE, $cookie);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
if ( $page === false ) {
echo("CURL Error: ".curl_error($c));
} else {
echo("GET Returned ".strlen($page)." bytes.\n");
echo("First few bytes\n".htmlentities(substr($page,0,20))."\n</pre>\n");
}
curl_close($c);
}
?>
<form method="POST">
<p>URL:<br/>
<input type="string" name="url" value="<?= htmlentities($url) ?>" size="100"><br/>
<p>Session:<br/>
<input type="text" name="session" value="<?= $_REQUEST['session'] ?>" size="100"><br/>
<input type="submit">
</form>
<?php
if ( $page !== false ) {
echo("\n<pre>\n");
echo(htmlentities($page));
echo("\n</pre>\n");
}
/*
$key = "this is the key";
$plain = "I am plain text";
$crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $plain, MCRYPT_MODE_ECB);
echo(bin2hex($crypttext));
echo "\n";
$plainback = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $crypttext, MCRYPT_MODE_ECB);
echo($plainback);
echo "\n";
*/