Wiki
Clone wikiaiengine / TorNetworkRuby
IP activity
On this example we will see how IPSets and IPBloomSets works, we will try to detect Tor activity on the network by providing a list of IP addresses to the engine, but now in Ruby language.
require './ruaiengine'
def callback_ipset(flow) printf "Detecting Tor activity on %s", flow.srcip end
def load_tor_address ip = IPSet.new("Some IPSet") f = File.new("torips.dat","r") while (line = f.gets) ip.add_ip_address(line.chop) ip.callback = method(:callback_ipset) end ipmng = IPSetManager.new() ipmng.add_ip_set(ip) return ipmng end
s = StackLan.new pd = PacketDispatcher.new pd.stack = s
s.total_udp_flows = 500000
s.tcpip_set_manager = load_tor_address()
pd.open("ens7") begin pd.run() rescue print "Stop capturing packets" end pd.close()
Updated