<div dir="ltr"><br clear="all"><div><div style="font-size:12.8px">Hi All, </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I used the following scripts for detecting one way flow. </div><span class="im" style="font-size:12.8px"><div><br></div><div><span style="font-size:12.8px">function init (args)</span><br style="font-size:12.8px"><span style="font-size:12.8px"> local needs = {}</span><br style="font-size:12.8px"><span style="font-size:12.8px"> needs["packet"] = tostring(true)</span><br style="font-size:12.8px"><span style="font-size:12.8px"> return needs</span><br style="font-size:12.8px"><span style="font-size:12.8px">end</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">function match(args)</span></div></span><div style="font-size:12.8px"> ipver, srcip, dstip, proto, sp, dp = SCFlowTuple()<span class="im"><br style="font-size:12.8px"><span style="font-size:12.8px"> ts_pkts, ts_bytes, tc_pkts, to_bytes = SCFlowStats()</span></span></div><div style="font-size:12.8px"> tmpstr = string.format("Version: %s; srcip%s:%s -> dstip %s:%s; ts: %s and tc: %s", ipver, srcip, sp, dstip, dp, ts_pkts, tc_pkts)</div><div style="font-size:12.8px"> print (tmpstr)<span class="im"><br><span style="font-size:12.8px"> if ts_pkts == nil then</span><br style="font-size:12.8px"><span style="font-size:12.8px"> return 0</span><br style="font-size:12.8px"><span style="font-size:12.8px"> end</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px"> if ts_pkts > 10 and tc_pkts == 0 then</span><br style="font-size:12.8px"><span style="font-size:12.8px"> return 1</span><br style="font-size:12.8px"><span style="font-size:12.8px"> elseif tc_pkts > 10 and ts_pkts == 0 then</span><br style="font-size:12.8px"><span style="font-size:12.8px"> return 1</span><br style="font-size:12.8px"><span style="font-size:12.8px"> end</span><br style="font-size:12.8px"><span style="font-size:12.8px"> return 0</span><br style="font-size:12.8px"><span style="font-size:12.8px">end</span><br></span></div><div style="font-size:12.8px"><div><br></div><div><br></div><div>I ran the script for one minute, when I checked my results, I got confused. I expected the SCFlowStats() will return the flow information based on the 5-tuple information. So the script can classify the following packets as one flow. </div><div><br></div><div><font color="#ff0000">Version: 4; srcip <a href="http://210.7.45.14:443/" target="_blank">210.7.45.14:443</a> -> dstip <a href="http://130.216.182.154:51218/" target="_blank">130.216.182.154:51218</a>; ts: 1 and tc: 0</font></div><div><font color="#ff0000"><br></font></div><div>Version: 4; srcip <a href="http://210.7.45.14:443/" target="_blank">210.7.45.14:443</a> -> dstip <a href="http://130.216.182.154:51218/" target="_blank">130.216.182.154:51218</a>; ts: 3 and tc: 0</div><div>Version: 4; srcip <a href="http://210.7.45.14:443/" target="_blank">210.7.45.14:443</a> -> dstip <a href="http://130.216.182.154:51218/" target="_blank">130.216.182.154:51218</a>; ts: 3 and tc: 0</div><div><br></div><div><font color="#ff0000">Version: 4; srcip <a href="http://130.216.182.154:51218/" target="_blank">130.216.182.154:51218</a> -> dstip <a href="http://210.7.45.14:443/" target="_blank">210.7.45.14:443</a>; ts: 1 and tc: 0</font></div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">But the results show different information. Why the packet from <span style="color:rgb(255,0,0)">130.216.182.154 to </span><span style="color:rgb(255,0,0)"> </span><span style="color:rgb(255,0,0)">210.7.45.14 </span><font color="#000000">didn't count as tc ?</font><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I just wondering, if anyone has same problem, do i miss something in the scrip?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Many thanks for your help.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Kind regards,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Steven</div><div class="" style="font-size:12.8px"><div id=":153" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"></div></div></div><div class="gmail_signature"><div style="font-family:Verdana;background-color:rgb(255,255,255)"><br></div><div style="font-family:Verdana;background-color:rgb(255,255,255)"><br></div></div>
</div>