<div dir="ltr">Hi all,<div><br></div><div>I&#39;ve recently been working on file carving/extraction based on a few usecases.</div><div><br></div><div>Namely:</div><div>During a match with the Intel Framework on a FILE_HASH, I want to extract the file.</div><div>During a match with the Intel Framework on a DOMAIN and ADDR, I want to extract the file.</div><div><br></div><div><i>See code <b>below</b>.</i></div><div><br></div><div>Yet everytime I&#39;ll get the error message: </div><div><b>Analyzer Files::ANALYZER_EXTRACT not added successfully to file ......</b></div><div><br></div><div>This occurs when you try to extract from the event: file_hash.</div><div>However, within events such as file_new and file_sniff, files can be extracted.</div><div>I&#39;d like to hand over the hash within the event of file_hash to Intel::Seen($indicator=hash)</div><div><br></div><div>A few questions:</div><div>- Is it possible to extract a file during an Intel::match event?</div><div>- If yes, how would I go about this?</div><div>- Is there a simple way to hand over the hash, originating tx_host and domain to the Intel framework and extract a file after a match?</div><div><br></div><div>Looking forward to your reply.</div><div><br></div><div>Kind regards,</div><div>Bart</div><div><br></div><div>{CODE}</div><div><br></div><div>@load base/frameworks/intel<br>@load base/files/extract<br><br>##Redefine to path desired.<br>global path = &quot;/home/zintern/EXTRACTED/temp/&quot;;<br><br>##Redefine to desired IoC .dat file<br>redef Intel::read_files += {fmt(&quot;%s/otx.dat&quot;, @DIR)};<br><br>## When a new file is seen:<br>event file_new(f: fa_file)<br>{<br>        Files::add_analyzer(f, Files::ANALYZER_MD5);<br>        Files::add_analyzer(f, Files::ANALYZER_SHA1);<br>        Files::add_analyzer(f, Files::ANALYZER_SHA256);<br>}<br><br>## When a file_hash has been seen<br>event file_hash(f: fa_file, kind: string, hash: string)<br>        {<br>        local seen = Intel::Seen($indicator=hash,<br>                                 $indicator_type=Intel::FILE_HASH,<br>                                 $f=f,<br>                                 $where=Files::IN_HASH);<br> <br>        Intel::seen(seen);<br>        }<br> <br>## When a match has been found between the seen traffic and the otx.dat file indicators.<br>event Intel::match(s: Intel::Seen, items:set[Intel::Item])<br>{<br>                if(s$indicator_type == Intel::FILE_HASH)<br>                {<br>                local fname = fmt(&quot;%s%s-%s&quot;, path, s$f$source, s$f$id);<br>                Files::add_analyzer(s$f, Files::ANALYZER_EXTRACT,[$extract_filename = fname]);<br>                }<br> <br>}<br></div></div>