PDA

Просмотр полной версии : Странная защита


FaR-G9
24.08.2008, 15:59
Ребята помогите, хотел написать скрипт, который тырит видео с рутуба, но там защита какая-то странная

смотрел я сниффером содержимое пакетов которые передаются

вот как он отвечает на настоящий браузер

GET /3758539224273fb26178321f249bd3fe HTTP/1.1

User-Agent: Opera/9.50 (Windows NT 5.1; U; ru)

Host: video.rutube.ru

Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1

Accept-Language: ru-RU,ru;q=0.9,en;q=0.8

Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1

Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0

Connection: Keep-Alive, TE

TE: deflate, gzip, chunked, identity, trailers



HTTP/1.1 303

Server: nginx/0.5.35

Date: Fri, 22 Aug 2008 20:59:50 GMT

Content-Type: text/html

Connection: keep-alive

Content-Length: 23

Cache-Control: no-cache

Location: http://rutube.ru/player.swf?buffer_first=1.0&file=http%3A%2F%2Fbl.rutube.ru%2F3758539224273fb26 178321f249bd3fe.iflv&image=http%3A%2F%2Fimg.rutube.ru%2Fthumbs%2F37%2F5 8%2F3758539224273fb26178321f249bd3fe-1.jpg&xurl=http%3A%2F%2Frutube.ru%2Ftrackinfo%2F37585392 24273fb26178321f249bd3fe.html&referer=



<h1>303</h1>
See Other


написал я скрипт

<?php
$fp = fsockopen("rutube.ru", 80, $errno, $errstr, 30);
if (!$fp) {

echo "Unable to open\n";

} else {
$out = "GET /3758539224273fb26178321f249bd3fe HTTP/1.1\r\n";
$out .= "User-Agent: Opera/9.50 (Windows NT 5.1; U; ru)\r\n";
$out .= "Host: video.rutube.ru\r\n";
$out .= "Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\n";
$out .= "Accept-Language: ru-RU,ru;q=0.9,en;q=0.8\r\n";
$out .= "Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n";
$out .= "Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n";
$out .= "Connection: Keep-Alive, TE\r\n";
$out .= "TE: deflate, gzip, chunked, identity, trailers\r\n\r\n";

fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>


вот что сервер мне отвечает на этот скрипт

GET /3758539224273fb26178321f249bd3fe HTTP/1.1

User-Agent: Opera/9.50 (Windows NT 5.1; U; ru)

Host: video.rutube.ru

Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1

Accept-Language: ru-RU,ru;q=0.9,en;q=0.8

Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1

Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0

Connection: Keep-Alive, TE

TE: deflate, gzip, chunked, identity, trailers



HTTP/1.1 404 Not Found

Server: nginx/0.7.3

Date: Fri, 22 Aug 2008 21:04:08 GMT

Content-Type: text/html; charset=iso-8859-1

Connection: keep-alive

Keep-Alive: timeout=20

Content-Length: 230



<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /3758539224273fb26178321f249bd3fe was not found on this server.</p>
</body></html>


как такое может быть?
ведь пакеты абсолютно одинаковые :confused:

Chaak
24.08.2008, 16:01
$out .= "Connection: Keep-Alive, TE\r\n";
нельзя так, только Close
Host: video.rutube.ru
а че соединение устанавливается с рутубом? :) надо с video.rutube.ru

Мощне защитко

P.S: Да и вообще переходите на курл

FaR-G9
27.08.2008, 13:02
спасибо, точно!
не заметил