# \[JIRA\] (BIT-1143) Investigate replacing libmagic w/ signatures for file identificaiton

**URL:** <https://community.zeek.org/t/jira-bit-1143-investigate-replacing-libmagic-w-signatures-for-file-identificaiton/3009>\
**Category:** Development\
**Tags:** development\
**Created:** [February 21, 2014, 12:01am UTC](https://community.zeek.org/t/jira-bit-1143-investigate-replacing-libmagic-w-signatures-for-file-identificaiton/3009 "2014-02-21T00:01:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robin](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/robin/32/599_2.png) [@robin](https://community.zeek.org/u/robin)\
**Post date:** [February 21, 2014, 12:01am UTC](https://community.zeek.org/t/jira-bit-1143-investigate-replacing-libmagic-w-signatures-for-file-identificaiton/3009/1 "2014-02-21T00:01:59Z")

</div>

> In that case, what's gained from Bro having it's own file magic  
> signatures instead of just using libmagic by itself?

I was thinking better control over the matching, but I guess there's  
not really that much to gain in addition.

> If Bro did completely switch to its own magic sigs, I think we have to  
> do a best effort approach to porting all the current MIME magics.

Can this be (semi-)automated, i.e., converting the magic mime db into  
Bro regular expressions?

Also, we should investigate performance: Bro's signature engine  
doesn't have a reputation for being the fastest in the world. 🙂 Hard  
to predict how it performs compared to libmagic; but then I also don't  
know if it mattered much if the file type detection got slower.

One more caveat, something I actually didn't think about so far: the  
signature engine has some depenedencies on connection state, not sure  
if using files as the analysis units goes without pain.

> Tests for everything would be nice, but I don't think a test per MIME  
> is a requirement for now.

Agreed.

So if we can basically keep detecting all the MIME types we currently  
find, without hurting performance in a significant way, I'm fine fully  
switching.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:41pm UTC](https://community.zeek.org/t/jira-bit-1143-investigate-replacing-libmagic-w-signatures-for-file-identificaiton/3009/2 "2022-05-06T15:41:35Z")

</div>


