Vous n'êtes pas identifié.
Voici un petit proxy en php alors voici le code php :
(Attention, il n'est pas sécurisé, c'est un nid a Remote file inclusion...)
Je précise que c'est pas moi qui l'es codé mais le code est sympa donc ... voila ![]()
<?
if (isset($_SERVER["PATH_INFO"])) {
$url = $_SERVER["PATH_INFO"];
}
if (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "") {
$url .= "?" . $_SERVER["QUERY_STRING"];
}
$debug = false;
$ref = array(
"host" => "http://" . $_SERVER["HTTP_HOST"],
"script" => $_SERVER["SCRIPT_NAME"]
);
if (isset($url) && $url != "") {
$h_url = explode("/", eregi_replace("^/", "", $url));
$host = $h_url[0];
unset($h_url[0]);
$rsc = implode($h_url);
$request_method = isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : "GET";
$send_headers_name = array(
"HTTP_ACCEPT" => "Accept",
"HTTP_ACCEPT_CHARSET" => "Accept-Charset",
// "HTTP_ACCEPT_ENCODING" => "Accept-Encoding",
"HTTP_ACCEPT_LANGUAGE" => "Accept-Language",
// "HTTP_HOST" => "Host",
// "HTTP_CONNECTION" => "Connection",
"HTTP_USER_AGENT" => "User-Agent"
);
$send_headers = array();
foreach ($send_headers_name as $key => $value) {
if (isset($_SERVER[$key])) {
$send_headers[] = $value . ": " . $_SERVER[$key];
}
}
$send_headers[] = "Host: " . $host;
foreach ($_COOKIE as $key => $value) {
$send_headers[] = "Cookie: " . $key . "=" . $value;
}
$opts = array(
"http" => array(
"method" => $request_method
)
);
if ($request_method == "POST") {
$opts["http"]["content"] = file_get_contents("php://input");
$send_headers[] = "Content-Type: application/x-www-form-urlencoded";
$send_headers[] = "Content-Length: " . strlen($opts["http"]["content"]);
}
if (count($send_headers) > 0) {
$opts["http"]["header"] = implode("\r\n", $send_headers) . "\r\n";
}
$ctx = stream_context_create($opts);
$fp = @fopen(eregi_replace("^/", "http://", $url), "r", false, $ctx);
if ($fp) {
$opts = stream_get_meta_data($fp);
$is_gzip = true;
$headers = array();
foreach ($opts["wrapper_data"] as $value) {
if (eregi("^HTTP", $value)) {
$headers = array();
} else {
$headers[] = $value;
}
}
foreach ($headers as $key => $value) {
if (eregi("^(Set-Cookie:)([ ]*[^;]*;)[ ]*Path=([^;]*)(.*)", $value, $reg)) {
$headers[$key] = $value = $reg[1] . $reg[2] . " Path=" . $ref["script"] . "/" . $
host . $reg[3] . $reg[4];
} else if (eregi("^(Content-Type:)[ ]*([^;]*)(.*)", $value, $reg)) {
$content_type = $reg[2];
} else if (eregi("^(Content-Length:)[ ]*([^;]*)(.*)", $value, $reg)) {
$content_length = $reg[2];
} else if (eregi("^(Connection:)[ ]*([^;]*)(.*)", $value)) {
$cxHeader = $value;
continue;
} else if (eregi("^Content-Encoding:[ ]*gzip", $value)) {
$is_gzip = true;
}
header($value, true);
}
if ($content_type == "text/html") {
if ($debug) {
?><div style="background-color: #eef; display: block; position: absolute">
<table border="0" cellpadding="2" cellspacing="1" style="width: 100%">
<tbody>
<tr><th colspan="2" style="border: 1px solid #ddd; text-align: left"><?= $request_method ?></th></tr>
<tr>
<td style="border: 1px solid #ddd; vertical-align: top; width: 50%"><?= implode("<br/>",
$send_headers) ?></td>
<td style="border: 1px solid #ddd; vertical-align: top; width: 50%"><?= implode("<br/>",
$headers) ?></td>
</tr>
</tbody>
</table>
</div>
<?
}
$content = "";
while (!feof($fp)) $content .= fread($fp, 8192);
echo preg_replace(
array(
"/([ ]*(href|HREF|src|SRC|action|ACTION)=\")\/([^\"]*)/",
"/([ ]*(href|HREF|src|SRC|action|ACTION)=)\/([^ ]*)/",
"/((url|URL)=)\/([^\";]*)/",
"/(http|HTTP):\/\//",
"/(<(base|BASE)[^>]*>)/",
"/(<(head|HEAD)[^>]*>)/"
),
array(
"\\1" . $ref["script"] . "/" . $host . "/\\3",
"\\1\"" . $ref["script"] . "/" . $host . "/\\3\"",
"\\1" . $ref["script"] . "/" . $host . "/\\3",
$ref["host"] . $ref["script"] . "/",
"",
"\\1<base href=\"" . $ref["host"] . $ref["script"] . $url
. "\">"
),
$content
);
} else {
if (!isset($content_length) || $content_length > (100 * 1024)) {
header("Connection: Keep-Alive", true);
} else if (isset($cxHeader)) {
header($cxHeader, true);
}
fpassthru($fp);
}
fclose($fp);
// exit();
} else {
echo "unable to get content from " . $url . "<br/>";
}
} else {
?><html>
<head>
<style type="text/css">
* {
font-family: Arial;
font-size: 8pt;
}
</style>
</head>
<body>
no url defined
</body>
</html>
<?
}
?>Hors ligne
Hors ligne
une manière de pas être détecté si je comprend bien ton explication? ![]()
Hors ligne
Hm pas tout a fait, enfin tout dépend le but final.
Disons que tu peux te cacher derriere l'ip de ton serveur grâce a ce script.
N'oublions pas qu'il est toujours possible de voir dans les logs les ip réél ...
Mais en effet, ça peut être un bon moyen de se cacher ![]()
Hors ligne