Ettercap / ettercap

Ettercap Project
http://www.ettercap-project.org
GNU General Public License v2.0
2.31k stars 486 forks source link

Extend filter JIT (modulo / random) #714

Open Dav1dde opened 8 years ago

Dav1dde commented 8 years ago

As discussed on IRC a modulo function (or operator) would be useful, e.g. drop every other packet based on TCP sequence number.

A random() function would be useful as well, same example if (random() > 0.5) { drop(); kill(); }. Drop statistically every other packet.

koeppea commented 8 years ago

As discussed on IRC a modulo function (or operator) would be useful, e.g. drop every other packet based on TCP sequence number.

Hi David,

could you please make a example for the above sentence to outline the meaning by example?

Dav1dde commented 8 years ago

Sure!

if (tcp.seq % 2) { drop(); kill(); } (assuming tcp.seq holds the sequence number). More explicit: if ((tcp.seq % 2) == 1) { drop(); kill(); }

eaescob commented 8 years ago

Can you try the filter-improvements branch? I"ve added the MOD operator.