Giter VIP home page Giter VIP logo

Comments (6)

netcons avatar netcons commented on July 4, 2024

Seems you can remove a single entry with:

echo "-drop_domain_blacklist:RISK_DOMAIN_domain.com" > /proc/net/xt_ndpi/host_proto

Interestingly when running the command with "-" prefix repeatedly, it will add and remove the entry:

echo "-drop_domain_blacklist:RISK_DOMAIN_domain.com" > /proc/net/xt_ndpi/host_proto
cat /proc/net/xt_ndpi/host_proto | grep "drop_domain_blacklist:RISK_DOMAIN_domain.com"
drop_domain_blacklist:RISK_DOMAIN_domain.com
echo "-drop_domain_blacklist:RISK_DOMAIN_domain.com" > /proc/net/xt_ndpi/host_proto
cat /proc/net/xt_ndpi/host_proto | grep "drop_domain_blacklist:RISK_DOMAIN_domain.com"
echo "-drop_domain_blacklist:RISK_DOMAIN_domain.com" > /proc/net/xt_ndpi/host_proto
cat /proc/net/xt_ndpi/host_proto | grep "drop_domain_blacklist:RISK_DOMAIN_domain.com"
drop_domain_blacklist:RISK_DOMAIN_domain.com

Is there a way to remove multiple entries with a single command?
echo "reset" > /proc/net/xt_ndpi/host_proto, seems to reset all not just custom host_proto.

from ndpi.

vel21ripn avatar vel21ripn commented on July 4, 2024

See 3deea54

from ndpi.

netcons avatar netcons commented on July 4, 2024

Thank you.

from ndpi.

netcons avatar netcons commented on July 4, 2024

On further investigation the following doesn't actually cause all domains to match:

echo "add_custom drop_domain_blacklist" > /proc/net/xt_ndpi/proto
echo "drop_domain_blacklist:RISK_DOMAIN_test.com" > /proc/net/xt_ndpi/host_proto
iptables -I FORWARD -m ndpi --all --risk 27 -j DROP

It causes all defined in /proc/net/xt_ndpi/host_proto to match:

cat /proc/net/xt_ndpi/host_proto | grep -w .google.
  Google:.google.,.gstatic.com,gstatic.com,ggpht.com,.goog
cat /proc/net/xt_ndpi/host_proto | grep -w centos

cat /proc/net/xt_ndpi/host_proto | grep -w drop_domain_blacklist
  drop_domain_blacklist:RISK_DOMAIN_test.com

host www.google.com
  ;; connection timed out; no servers could be reached
host www.centos.org
  www.centos.org has address 52.56.83.118
host test.com
  ;; connection timed out; no servers could be reached

echo "reset" > /proc/net/xt_ndpi/host_proto
echo "drop_domain_blacklist:RISK_DOMAIN_test.com" > /proc/net/xt_ndpi/host_proto

cat /proc/net/xt_ndpi/host_proto | grep -w .google.

cat /proc/net/xt_ndpi/host_proto | grep -w centos

cat /proc/net/xt_ndpi/host_proto | grep -w drop_domain_blacklist
  drop_domain_blacklist:RISK_DOMAIN_test.com

host www.google.com
  www.google.com has address 216.58.223.132
host www.centos.org
  www.centos.org has address 52.56.83.11
host test.com
  ;; connection timed out; no servers could be reached

from ndpi.

netcons avatar netcons commented on July 4, 2024

Works as expected if matched directly instead of via risk:

echo "add_custom drop_domain_blacklist" > /proc/net/xt_ndpi/proto
echo "drop_domain_blacklist:test.com" > /proc/net/xt_ndpi/host_proto
iptables -I FORWARD -m ndpi --proto drop_domain_blacklist -j DROP

It causes only hosts defined in custom proto to match:

cat /proc/net/xt_ndpi/host_proto | grep -w .google.
  Google:.google.,.gstatic.com,gstatic.com,ggpht.com,.goog
cat /proc/net/xt_ndpi/host_proto | grep -w centos

cat /proc/net/xt_ndpi/host_proto | grep -w drop_domain_blacklist
  drop_domain_blacklist:test.com

host www.google.com
   www.google.com has address 216.58.223.132
host www.centos.org
  www.centos.org has address 52.56.83.118
host test.com
  ;; connection timed out; no servers could be reached

from ndpi.

netcons avatar netcons commented on July 4, 2024

Additional observation is that all configured host_proto are logged with R=27 in Flowinfo log.

from ndpi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.