<div dir="ltr">Thank you! Exactly what I was looking for</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 8, 2017 at 11:27 AM, Aashish Sharma <span dir="ltr">&lt;<a href="mailto:asharma@lbl.gov" target="_blank">asharma@lbl.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(Not sure if I am interpreting your question right but here is how I read it)<br>
<br>
basically use &quot;in&quot; operator<br>
<br>
<br>
local my_ip_table : table[addr] of bool ;<br>
<br>
local ip: addr = 127.0.0.1<br>
<br>
if ( ip in my_ip_table)<br>
        found<br>
else<br>
        not found<br>
<br>
<br>
btw, you can also use &quot;!in&quot; operator too which is rather more handy<br>
<br>
<br>
if (something !in table)<br>
        initialize it here<br>
        table[something] = Blah;<br>
<br>
<br>
or<br>
<br>
most of scripts just flat return in membership doesn&#39;t exist that helps<br>
eliminate a lot of unneeded run through scripts.<br>
<br>
if (ip !in Site::local_nets)<br>
        return<br>
<br>
&lt;do rest of the heuristics here for local IPs&gt;<br>
<br>
<br>
Here is a (rather complicated but) useful example which stretches<br>
above problem with an extended use-case:<br>
<br>
/usr/local/bro/share/bro/<wbr>policy/frameworks/software/<wbr>vulnerable.bro<br>
<br>
Hope this helps. Let me know if you need more clearifications.<br>
<span class="HOEnZb"><font color="#888888"><br>
Aashish<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Tue, Aug 08, 2017 at 11:04:23AM -0700, Reinhard Gentz wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I would like to check if a certain table element exists and then take<br>
&gt; corresponding action like the following:<br>
&gt;<br>
&gt; if (exists(mytable[&quot;my_dynamic_<wbr>name&quot;]))<br>
&gt;     do something<br>
&gt; else<br>
&gt;     do something else<br>
&gt;<br>
&gt;<br>
&gt; Can someone give me a hint?<br>
&gt; Reinhard<br>
<br>
</div></div><div class="HOEnZb"><div class="h5">&gt; ______________________________<wbr>_________________<br>
&gt; bro-dev mailing list<br>
&gt; <a href="mailto:bro-dev@bro.org">bro-dev@bro.org</a><br>
&gt; <a href="http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev" rel="noreferrer" target="_blank">http://mailman.icsi.berkeley.<wbr>edu/mailman/listinfo/bro-dev</a><br>
<br>
</div></div></blockquote></div><br></div>