ValdikSS / blockcheck

Russian ISP blocking type checker NOTE: NOT WORKING CURRENTLY. ВНИМАНИЕ: НЕ РАБОТАЕТ НА ТЕКУЩИЙ МОМЕНТ
MIT License
1.37k stars 144 forks source link

Вылетает по ошибке во время тестирования HTTPS #47

Closed dimedrol7 closed 7 years ago

dimedrol7 commented 7 years ago

$ ./blockcheck.py --console BlockCheck v0.0.8.4 IP: 77.37.208.123, провайдер: National cable Networks/ OnLime

[O] Тестируем DNS [O] Получаем эталонные DNS с сервера Эталонные адреса: ['104.20.74.106', '104.20.75.106', '104.25.118.23', '104.25.119.23', '212.47.251.61', '5.178.68.100'] Адреса через системный DNS: ['104.20.74.106', '104.20.75.106', '104.25.118.23', '104.25.119.23', '212.47.251.61', '5.178.68.100'] Адреса через Google DNS: ['104.20.74.106', '104.20.75.106', '104.25.118.23', '104.25.119.23', '212.47.251.61', '5.178.68.100'] Адреса через DNS AntiZapret: ['195.123.209.38', '195.123.209.38', '195.123.209.38', '195.123.209.38'] [✓] DNS-записи не подменяются [✓] DNS не перенаправляется

[O] Тестируем HTTP Открываем http://rule34.xxx/index.php?page=post&s=view&id=879177 [☠] Получен неожиданный ответ, скорее всего, страница-заглушка провайдера. Пробуем через прокси. [✓] Сайт открывается через прокси Открываем http://rutracker.org/forum/index.php [☠] Получен неожиданный ответ, скорее всего, страница-заглушка провайдера. Пробуем через прокси. [✓] Сайт открывается через прокси Открываем http://a.putinhuylo.com/ [✓] Сайт открывается Открываем http://gelbooru.com/index.php?page=post&s=view&id=1989610 [☠] Получен неожиданный ответ, скорее всего, страница-заглушка провайдера. Пробуем через прокси. [✓] Сайт открывается через прокси Открываем http://rule34.xxx/ [✓] Сайт открывается Открываем http://gelbooru.com/ [✓] Сайт открывается

[O] Тестируем HTTPS Открываем https://e621.net/ [✓] Сайт открывается Открываем https://uberbooru.com/ Traceback (most recent call last): File "./blockcheck.py", line 158, in _get_url opened = urllib.request.urlopen(req, timeout=15, cadefault=True) TypeError: urlopen() got an unexpected keyword argument 'cadefault'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.2/urllib/request.py", line 1140, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/usr/lib/python3.2/http/client.py", line 970, in request self._send_request(method, url, body, headers) File "/usr/lib/python3.2/http/client.py", line 1008, in _send_request self.endheaders(body) File "/usr/lib/python3.2/http/client.py", line 966, in endheaders self._send_output(message_body) File "/usr/lib/python3.2/http/client.py", line 811, in _send_output self.send(msg) File "/usr/lib/python3.2/http/client.py", line 749, in send self.connect() File "/usr/lib/python3.2/http/client.py", line 1111, in connect server_hostname=server_hostname) File "/usr/lib/python3.2/ssl.py", line 189, in wrap_socket _context=self) File "/usr/lib/python3.2/ssl.py", line 276, in init raise x File "/usr/lib/python3.2/ssl.py", line 272, in init self.do_handshake() File "/usr/lib/python3.2/ssl.py", line 451, in do_handshake self._sslobj.do_handshake() socket.error: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "./blockcheck.py", line 163, in _get_url opened = urllib.request.urlopen(req, timeout=15, cafile="/etc/ssl/certs/ca-certificates.crt") File "/usr/lib/python3.2/urllib/request.py", line 139, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.2/urllib/request.py", line 370, in open response = self._open(req, data) File "/usr/lib/python3.2/urllib/request.py", line 388, in _open '_open', req) File "/usr/lib/python3.2/urllib/request.py", line 348, in _call_chain result = func(*args) File "/usr/lib/python3.2/urllib/request.py", line 1176, in https_open context=self._context, check_hostname=self._check_hostname) File "/usr/lib/python3.2/urllib/request.py", line 1143, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 104] Connection reset by peer>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "./blockcheck.py", line 629, in main() File "./blockcheck.py", line 523, in main https = test_https_cert() File "./blockcheck.py", line 462, in test_https_cert result = _get_url(site, None) File "./blockcheck.py", line 165, in _get_url except FileNotFoundError: NameError: global name 'FileNotFoundError' is not defined

========================= мой комп =====================

$ uname -a Linux dimedrol-pc 3.4.85-custom1 #1 SMP Wed Apr 9 10:29:46 MSK 2014 x86_64 GNU/Linux

$ cat /etc/debian_version 7.8

$ dpkg -l | grep python ii libpython2.7 2.7.3-6+deb7u2 amd64 Shared Python runtime library (version 2.7) ii python 2.7.3-4+deb7u1 all interactive high-level object-oriented language (default version) ii python-apt 0.8.8.2 amd64 Python interface to libapt-pkg ii python-apt-common 0.8.8.2 all Python interface to libapt-pkg (locales) ii python-aptdaemon 0.45-2 all Python module for the server and client of aptdaemon ii python-aptdaemon.gtk3widgets 0.45-2 all Python GTK+ 3 widgets to run an aptdaemon client ii python-beautifulsoup 3.2.1-1 all error-tolerant HTML parser for Python ii python-brlapi 4.4-10+deb7u1 amd64 Python bindings for BrlAPI ii python-cairo 1.8.8-1+b2 amd64 Python bindings for the Cairo vector graphics library ii python-chardet 2.0.1-2 all universal character encoding detector ii python-chm 0.8.4-1+b2 amd64 Python binding for CHMLIB ii python-dbus 1.1.1-1 amd64 simple interprocess messaging system (Python interface) ii python-dbus-dev 1.1.1-1 all main loop integration development files for python-dbus ii python-debian 0.1.21 all Python modules to work with Debian-related data formats ii python-debianbts 1.11 all Python interface to Debian's Bug Tracking System ii python-defer 1.0.6-2 all Small framework for asynchronous programming (Python 2) ii python-dev 2.7.3-4+deb7u1 all header files and a static library for Python (default) ii python-feedparser 5.1.2-1 all Universal Feed Parser for Python ii python-fpconst 0.7.2-5 all Utilities for handling IEEE 754 floating point special values ii python-gconf 2.28.1+dfsg-1 amd64 Python bindings for the GConf configuration database system ii python-gi 3.2.2-2 amd64 Python 2.x bindings for gobject-introspection libraries ii python-gi-cairo 3.2.2-2 amd64 Python Cairo bindings for the GObject library ii python-glade2 2.24.0-3+b1 amd64 GTK+ bindings: Glade support ii python-gnome2 2.28.1+dfsg-1 amd64 Python bindings for the GNOME desktop environment ii python-gnupginterface 0.3.2-9.1 all Python interface to GnuPG (GPG) ii python-gobject 3.2.2-2 all Python 2.x bindings for GObject - transitional package ii python-gobject-2 2.28.6-10 amd64 deprecated static Python bindings for the GObject library ii python-gst0.10 0.10.22-3 amd64 generic media-playing framework (Python bindings) ii python-gtk-vnc 0.5.0-3.1 amd64 VNC viewer widget for GTK+2 (Python binding) ii python-gtk2 2.24.0-3+b1 amd64 Python bindings for the GTK+ widget set ii python-httplib2 0.7.4-2+deb7u1 all comprehensive HTTP client library written for Python ii python-imaging 1.1.7-4+deb7u1 amd64 Python Imaging Library ii python-ipy 1:0.75-1 all Python module for handling IPv4 and IPv6 addresses and networks ii python-libvirt 0.9.12.3-1+deb7u1 amd64 libvirt Python bindings ii python-libxml2 2.8.0+dfsg1-7+wheezy4 amd64 Python bindings for the GNOME XML library ii python-louis 2.4.1-1 amd64 Python bindings for liblouis ii python-magic 5.11-2+deb7u8 amd64 File type determination library using "magic" numbers (Python bindings) ii python-mako 0.7.0-1.1 all fast and lightweight templating for the Python platform ii python-markupsafe 0.15-1 amd64 XML/HTML/XHTML Markup safe string for Python ii python-minimal 2.7.3-4+deb7u1 all minimal subset of the Python language (default version) ii python-notify 0.1.1-3 amd64 Python bindings for libnotify ii python-numpy 1:1.6.2-1.2 amd64 Numerical Python adds a fast array facility to the Python language ii python-packagekit 0.7.6-3 all PackageKit backend Python bindings ii python-pexpect 2.4-1 all Python module for automating interactive applications ii python-pkg-resources 0.6.24-1 all Package Discovery and Resource Access using pkg_resources ii python-pyatspi 2.5.3+dfsg-3 all Assistive Technology Service Provider Interface - Python bindings ii python-pyatspi2 2.5.3+dfsg-3 all Transitional package for assistive technology Python bindings ii python-pycurl 7.19.0-5 amd64 Python bindings to libcurl ii python-pyorbit 2.24.0-6+b1 amd64 A Python language binding for the ORBit2 CORBA implementation ii python-renderpm 2.5-1.1 amd64 python low level render interface ii python-reportbug 6.4.4+deb7u1 all Python modules for interacting with bug tracking systems ii python-reportlab 2.5-1.1 all ReportLab library to create PDF documents using Python ii python-reportlab-accel 2.5-1.1 amd64 C coded extension accelerator for the ReportLab Toolkit ii python-soappy 0.12.0-4 all SOAP Support for Python ii python-software-properties 0.82.7.1debian1 all manage the repositories that you install software from ii python-speechd 0.7.1-6.2 all Python interface to Speech Dispatcher ii python-spice-client-gtk 0.12-5 amd64 GTK2 widget for SPICE clients (Python binding) ii python-support 1.0.15 all automated rebuilding support for Python modules ii python-uno 1:3.5.4+dfsg2-0+deb7u4 amd64 Python-UNO bridge ii python-urlgrabber 3.9.1-4 all A high-level cross-protocol url-grabber ii python-utidylib 0.2-8 all Python wrapper for TidyLib ii python-vte 1:0.28.2-5 amd64 Python bindings for the VTE widget set ii python-wnck 2.32.0+dfsg-2+b1 amd64 Python bindings for the WNCK library ii python-xapian 1.2.12-2 amd64 Xapian search engine interface for Python ii python-xdg 0.19-5 all Python library to access freedesktop.org standards ii python2.6 2.6.8-1.1 amd64 Interactive high-level object-oriented language (version 2.6) ii python2.6-minimal 2.6.8-1.1 amd64 Minimal subset of the Python language (version 2.6) ii python2.7 2.7.3-6+deb7u2 amd64 Interactive high-level object-oriented language (version 2.7) ii python2.7-dev 2.7.3-6+deb7u2 amd64 Header files and a static library for Python (v2.7) ii python2.7-minimal 2.7.3-6+deb7u2 amd64 Minimal subset of the Python language (version 2.7) ii python3 3.2.3-6 all interactive high-level object-oriented language (default python3 version) ii python3-dnspython 1.10.0-1 all DNS toolkit for Python (Python 3) ii python3-minimal 3.2.3-6 all minimal subset of the Python language (default python3 version) ii python3-tk 3.2.3-1 amd64 Tkinter - Writing Tk applications with Python 3.x ii python3.2 3.2.3-7 amd64 Interactive high-level object-oriented language (version 3.2) ii python3.2-minimal 3.2.3-7 amd64 Minimal subset of the Python language (version 3.2)

ValdikSS commented 7 years ago

Попробуйте сейчас.

dimedrol7 commented 7 years ago

Спасибо, теперь работает! Только результат мне кажется немного не соответствует. [!] Результат: [⚠] Ваш провайдер полностью блокирует доступ к HTTPS-сайтам из реестра. [⚠] У вашего провайдера "обычный" DPI. Вам поможет HTTPS/Socks прокси, VPN или Tor.

У меня On-Lime. Rutracker блокировался. Но, месяц назад, в добавок к ipv4 я настроил получение ipv6. Проверка ipv6-test.com проходит нормально (17/20 ), и настройка броузера такая: Default IPv6, Fallback to IPv4 in 1 second. Однако сразу после настройки ipv6, rutracker все равно блокировался, перенаправляя меня на http://77.37.254.90/zapret/?sa=2a02:2168:858:3d8::1&da=2a02:4680:22::214&url=http://rutracker.org/forum/index.php . Я удивился тому, что ОнЛайм настроил фильтрацию даже по ipv6. Однако, спустя неделю я случайно заметил, что у меня стал открыватся рутрекер. Я посмотрел повнимательнее, и заметил, что он открывается у меня только по HTTPS https://rutracker.org/ , но не по http. Хотя припоминаю, что до настройки ipv6, мне не помогал https. Помогла лишь комбинация ipv6 + https. Никакие tor и прокси не использую. Поэтому результат работы тестера не могу понять: "Ваш провайдер полностью блокирует доступ к HTTPS-сайтам из реестра" , а я как раз по https нормально открываю.

ValdikSS commented 7 years ago

Rutracker заблокирован только по HTTP. Попробуйте открыть, например, https://www.sankakucomplex.com/

dimedrol7 commented 7 years ago

Эта ссылка тоже открывается. Я вспомнил. У меня еще DNS не от провайдера, а свой bind локально настроенный 127.0.0.1. Наверное, это тоже помогает обойти блокировку. Возможно, в ОнЛайм, что касается ipv6, блокируют только открытый трафик. Забыли они в ipv6 заблокировать HTTPS, или понадеялись на свой DNS, который я не использую.

ValdikSS commented 7 years ago

Выложите, пожалуйста, полный лог блокчека.

dimedrol7 commented 7 years ago
$ ./blockcheck.py --console
BlockCheck v0.0.8.4
IP: 77.37.208.123, провайдер: National cable Networks/ OnLime

[O] Тестируем DNS
[O] Получаем эталонные DNS с сервера
    Эталонные адреса:         ['104.20.74.106', '104.20.75.106', '104.25.118.23', '104.25.119.23', '212.47.251.61', '5.178.68.100']
    Адреса через системный DNS:  ['104.20.74.106', '104.20.75.106', '104.25.118.23', '104.25.119.23', '212.47.251.61', '5.178.68.100']
    Адреса через Google DNS:  ['104.20.74.106', '104.20.75.106', '104.25.118.23', '104.25.119.23', '212.47.251.61', '5.178.68.100']
    Адреса через DNS AntiZapret:  ['195.123.209.38', '195.123.209.38', '195.123.209.38', '195.123.209.38']
[✓] DNS-записи не подменяются
[✓] DNS не перенаправляется

[O] Тестируем HTTP
    Открываем  http://rule34.xxx/index.php?page=post&s=view&id=879177
[☠] Получен неожиданный ответ, скорее всего, страница-заглушка провайдера. Пробуем через прокси.
[✓] Сайт открывается через прокси
    Открываем  http://rutracker.org/forum/index.php
[☠] Получен неожиданный ответ, скорее всего, страница-заглушка провайдера. Пробуем через прокси.
[✓] Сайт открывается через прокси
    Открываем  http://a.putinhuylo.com/
[✓] Сайт открывается
    Открываем  http://gelbooru.com/index.php?page=post&s=view&id=1989610
[☠] Получен неожиданный ответ, скорее всего, страница-заглушка провайдера. Пробуем через прокси.
[✓] Сайт открывается через прокси
    Открываем  http://rule34.xxx/
[✓] Сайт открывается
    Открываем  http://gelbooru.com/
[✓] Сайт открывается

[O] Тестируем HTTPS
    Открываем  https://e621.net/
[✓] Сайт открывается
    Открываем  https://uberbooru.com/
[☠] Сайт не открывается
[☠] isup.me не поддерживает HTTPS, считаем, что сайт работает, а проблемы только у нас
    Открываем  https://lolibooru.moe/
[✓] Сайт открывается

[O] Тестируем обход DPI
    Пробуем способ «фрагментирование заголовка» на rutracker.org
[✓] Сайт открывается
    Пробуем способ «дополнительный пробел после GET» на rutracker.org
[☠] Сайт не открывается
    Пробуем способ «заголовок host вместо Host» на rutracker.org
[☠] Сайт не открывается
    Пробуем способ «перенос строки в заголовках в UNIX-стиле» на rutracker.org
[!] Сайт не открывается, обнаружен пассивный DPI!
    Пробуем способ «необычный порядок заголовков» на rutracker.org
[☠] Сайт не открывается
    Пробуем способ «точка в конце домена» на rutracker.org
[!] Сайт не открывается, обнаружен пассивный DPI!
    Пробуем способ «фрагментирование заголовка» на gelbooru.com
[✓] Сайт открывается
    Пробуем способ «дополнительный пробел после GET» на gelbooru.com
[!] Сайт не открывается, обнаружен пассивный DPI!
    Пробуем способ «заголовок host вместо Host» на gelbooru.com
[!] Сайт не открывается, обнаружен пассивный DPI!
    Пробуем способ «перенос строки в заголовках в UNIX-стиле» на gelbooru.com
[!] Сайт не открывается, обнаружен пассивный DPI!
    Пробуем способ «необычный порядок заголовков» на gelbooru.com
[!] Сайт не открывается, обнаружен пассивный DPI!
    Пробуем способ «точка в конце домена» на gelbooru.com
[!] Сайт не открывается, обнаружен пассивный DPI!

[!] Результат:
[⚠] Ваш провайдер полностью блокирует доступ к HTTPS-сайтам из реестра.
[⚠] У вашего провайдера "обычный" DPI. Вам поможет HTTPS/Socks прокси, VPN или Tor.
ValdikSS commented 7 years ago

Да, похоже, вы правы. Вообще говоря, в реестр вносятся только IPv4-адреса, там нет поля для IPv6-адреса, и непонятно, как должны действовать провайдеры в случае с IPv6. Issue #43 открыт давно, попробую что-нибудь с этим сделать в ближайшем будущем.

IRainman commented 7 years ago

Подтверждаю поведение при использовании IPv6 на Онлайме.

P.S. Провайдеры могут спокойно блокировать по доменному имени и для IPv6 тоже, полагаясь на DPI, видимо всё это поддерживается не до конца.