Vadim Smirnov

Forum Replies Created

Viewing 15 posts - 511 through 525 (of 1,486 total)
  • Author
    Posts
  • in reply to: Фильтр string #11430
    Vadim Smirnov
    Keymaster

      Вернулся сегодня к этому коду, в предыдущей версии была ошибка в поиске подстроки. Здесь поправил.

      in reply to: Фильтр string #11427
      Vadim Smirnov
      Keymaster

        Еще очень сырой, но попробуйте.

        Для работы требуется последний WinpkFilter. Правила загружаются из файла config.conf, пример одного правила есть в архиве: блокирует TCP пакеты по подстроке ntkernel.com, соответственно не дает зайти на https://www.ntkernel.com, так как имя домена находится в SNI.

        Для примера, другое правило, блокирует http://www.ntkernel.com по IP:

         {
            "direction":"forward",
            "interface_name":"{C0420ADB-B1CD-4B01-845F-5BB41EE08687}",
            "source_ip_address":null,
            "destination_ip_address":{"address":"40.122.67.8","mask":"255.255.255.255"}
            "ip_protocol":"tcp",
            "source_port_range":null,
            "destination_port_range":[443,443],
            "string_match":null,
            "action":"drop"
            }

        direction: возможные значения input, output, forward
        FORWARD имеет несколько иной смысл чем в никсах, здесь он означает что правило будет примененно как к исходящим так и к входящим пакетам.

        interface_name: GUID сетевого интерфейса, если null – применяется ко всем доступным сетевым адаптерам.

        source_ip_address и destination_ip_address указываются в формате как в примере выше.

        ip_protocol: допустимые значения кроме null:

        enum class ip_protocol :uint8_t
        	{
        		/* dummy for IP */
        		ip = 0,
        		/* control message protocol */
        		icmp = 1,
        		/* group management protocol */
        		igmp = 2,
        		/* gateway^2 (deprecated) */
        		ggp = 3,
        		/* tcp */
        		tcp = 6,
        		/* pup */
        		pup = 12,
        		/* user datagram protocol */
        		udp = 17,
        		/* xns idp */
        		idp = 22,
        		/* UNOFFICIAL net disk proto */
        		nd = 77,
        		/* raw IP packet */
        		raw = 255
        	};

        source_port_range и destination_port_range – диапазоны портов, с ними все понятно

        string_match: ASCII строка для поиска в пакете

        action: допустимые значения accept и drop

        in reply to: Фильтр string #11425
        Vadim Smirnov
        Keymaster

          Хорошо, спасибо. Я уже частично набросал формат правил навроде упрощенного IPTABLES в JSON формате, чтобы можно было загрузить массив правил из файла. Если будет время, то может закончу до выходных, сам фильтр на готовых правилах сделать несложно.

          in reply to: Фильтр string #11423
          Vadim Smirnov
          Keymaster

            В правиле ‘76561198923445525’ это ASCII строка в теле пакета?

            in reply to: Фильтр string #11422
            Vadim Smirnov
            Keymaster

              Я начал потихоньку накидывать прототип, постараюсь сделать что-то несложное, но расширяемое. Как будет что-то рабочее – напишу в этой ветке.

              in reply to: Фильтр string #11420
              Vadim Smirnov
              Keymaster

                В принципе ничего сложного, надо только подумать как сделать что-то более-менее универсальное и при этом не слишком сложное. Писать парсер для IPTABLES как-то не хочется, наверное проще будет определить собственные правила в JSON формате. Поразмыслю на досуге над спецификацией…

                in reply to: Фильтр string #11417
                Vadim Smirnov
                Keymaster

                  Каждый пакет в стриме содержит строку ID?

                  Если GUI не принципиален, то наверное могу набросать пример, может еще кому-нибудь будет полезно… ID можно из INI файла подтянуть или в командную строку передать, интерфейс рисовать для такой аппликухи лишняя морока…

                  in reply to: Фильтр string #11414
                  Vadim Smirnov
                  Keymaster

                    В принципе ничего сложного, в этом примере решается почти подобная задача. Я бы еще добавил фильтр для диапазона портов, чтобы не гонять через user space весь трафик.

                    Нужна помощь с конкретным кодом?

                    in reply to: Need to change v4,v6 TTL/HOP by individual tcp/udp port #11397
                    Vadim Smirnov
                    Keymaster

                      Bill,

                      I don’t know if there is way to pass Windows host traffic through the WSL2 IPTABLES. I’d say that this could be a subject for serious research.

                      However, you still have two possibilities:

                      • Use WinpkFilter to intercept traffic for the desired connections (select by tcp/udp ports using built-in filters), adjust TTL/HOP according the settings, recalculate packets checksum and re-inject these packets back into the network stack.
                      • Develop a specialized WFP or LWF driver doing the same directly in the Windows kernel.

                      Second approach is preferred from the performance point of view (passing packets through the user space has its cost), however more expensive in development and support.

                      in reply to: WinpkFilter: connection tracking? #11392
                      Vadim Smirnov
                      Keymaster

                        Neither process nor the connection context are available on the NDIS level. However, it is still possible to use information extracted form the packet headers (IP/protocol/port) to match the packet against the local process information which can be requested using IP Helper API.

                        in reply to: Winpk filter and BSOD #11371
                        Vadim Smirnov
                        Keymaster

                          Version 3.2.16 is over two years old and no longer supported. Could you try to reproduce the issue with a latest version (3.2.24)? If yes, then could you please collect full (or at least kernel) memory dump and e-mail to support?

                          in reply to: virtual machine on Windows server 2016 #11285
                          Vadim Smirnov
                          Keymaster

                            Well, you can install winpkfilter the host or/and guest (if VM has Windows inside). It should work either way.

                            in reply to: virtual machine on Windows server 2016 #11283
                            Vadim Smirnov
                            Keymaster

                              Do you mean Hyper-V virtual machine? Have you installed WinpkFilter inside VM or on the host? Try running ListAdapters, it should show you available network interfaces…

                              in reply to: ARM64 Support #11280
                              Vadim Smirnov
                              Keymaster

                                ARM64 drivers are available to the registered customers starting v.3.2.29.

                                in reply to: VPN Demo #11268
                                Vadim Smirnov
                                Keymaster

                                  where to download GRETunnel sample? i can’t find it on Github.

                                  Yes, that’s right. GRETunnel and other old samples are included into the demo package

                                Viewing 15 posts - 511 through 525 (of 1,486 total)