/* Transmit packets from one interface to another (and will change their content if you uncomment some lines). Parameter 'sourceIP' may be defined prior to processing of this file if you want to set filter on source IP. Run like this: anettest -d eth0#0 -d eth1#1 -f this_file.fws anettest -d eth0#0 -d eth1#1 define sourceIP 1.1.1.1 this_file.fws */ INCLUDE tcp INCLUDE udp PRECISEWAIT // causes that no packets will be missed, all packets will be transmitted even under short-term high load COPYREC // causes that recieved packet will be copied to buffer of generated packet ifdef sourceIP { printl 'filter is set: only packets from $sourceIP$ are transmitted' filter 1 'src $sourceIP$' // sets fast low-level libpcap filter for interface 1 } quiet // avoids some annoying messages // ADDING EXPECTED PACKETS MI 1 // sets 0 as interface from which packets will be received // description of expected tcp packets name "tcp" CLEARMASK // empties mask i.e. any tcp packet to wait so far (not considering low-level filter) ethproto = ip ip.proto = tcp // dstport = 45 // messages which will be displayed on recieving tcp packet mes "$srcip$ << $syn$ : $fin$ : $ack$ :\t$ip.len$ :\t$num$\n" TOWAIT // adds the described tcp packet to expected ones // description of expected udp packets name "udp" // any udp packet CLEARMASK ethproto = ip ip.proto = udp TOWAIT // adds the described packet udp to expected ones MI 0 // sets 0 as interface from which packets will be send // infinite cycle cyc inf { // WAITS AN EXPECTED PACKET waitall // SENDING RECIEVED PACKET FROM ANOTHER INTERFACE ifr "tcp" { // if packet received this given name //srcip 3.3.3.3 // changes only address of source //ip.crc IPcrc // marks that crc must be recalculated //tcp.crc TCPcrc // marks that crc must be recalculated print "send tcp\n" SEND // generates packet } ifr "udp" { //srcip 3.3.3.3 // changes only address of source //ip.crc IPcrc // marks that crc must be recalculated //udp.crc UDPcrc // marks that crc must be recalculated print "send udp\n" SEND // generates packet } unfix // forget that an expected packet's been received so it will be able to be received again }