problem: mime type function different across platforms #146

Open
wesyoung opened this Issue Feb 16, 2017 · 3 comments

Projects

None yet

2 participants

@wesyoung
Member

test on RHEL

@wesyoung wesyoung added the bug label Feb 16, 2017
@wesyoung wesyoung added this to the R5 milestone Feb 16, 2017
@wesyoung
Member
I believe the error with magic was the function didnt exist:
ftype
=
 magic.from_file(self.cache,
mime=True)


We are on RHEL 7

not seeing the same issue on CentOS72 (i think?)

@wesyoung
Member
def _process_cache(self, split="\n", rstrip=True):
        mag=magic.open(magic.MAGIC_MIME)
        mag.load()
        ftype = mag.file(self.cache)
        if PYVERSION < 3:
            ftype = ftype.decode('utf-8')
@alevere
alevere commented Feb 16, 2017

Error:
Traceback (most recent call last):
File "/usr/bin/csirtg-smrt", line 11, in
load_entry_point('csirtg-smrt==0.0.0a26', 'console_scripts', 'csirtg-smrt')()
File "/usr/lib/python2.7/site-packages/csirtg_smrt/smrt.py", line 387, in main
'goback': goback
File "/usr/lib/python2.7/site-packages/csirtg_smrt/smrt.py", line 278, in _run_smrt
for i in s.process(r, f, limit=args.limit, data=data, filters=filters):
File "/usr/lib/python2.7/site-packages/csirtg_smrt/smrt.py", line 238, in process
for indicator_batch in feed_indicators_batches:
File "/usr/lib/python2.7/site-packages/csirtg_smrt/utils/init.py", line 93, in chunk
for x in it:
File "/usr/lib/python2.7/site-packages/csirtg_smrt/smrt.py", line 234, in
feed_indicators = (i for i in feed_indicators if not self.is_archived_with_log(i))
File "/usr/lib/python2.7/site-packages/csirtg_smrt/smrt.py", line 228, in
feed_indicators = (self.clean_indicator(i, rule) for i in feed_indicators)
File "/usr/lib/python2.7/site-packages/csirtg_smrt/smrt.py", line 227, in
feed_indicators = (i for i in feed_indicators if self.is_valid(i, rule))
File "/usr/lib/python2.7/site-packages/csirtg_smrt/parser/zcifv2.py", line 12, in process
for l in self.fetcher.process():
File "/usr/lib/python2.7/site-packages/csirtg_smrt/fetcher.py", line 228, in process
for l in self._process_cache(split=split, rstrip=rstrip):
File "/usr/lib/python2.7/site-packages/csirtg_smrt/fetcher.py", line 123, in _process_cache
ftype = magic.from_file(self.cache, mime=True)
AttributeError: 'module' object has no attribute 'from_file'

Platform:
uname -a
Linux xxxxxx.unc.edu 3.10.0-514.6.1.el7.x86_64 #1 SMP Sat Dec 10 11:15:38 EST 2016 x86_64 x86_64 x86_64 GNU/Linux
[axxxxxx@vxxxxx ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)

Other:
-rw-r--r--. 1 root root 217 Jun 27 2016 Magic_file_extensions-0.2-py2.7.egg-info
-rw-r--r--. 1 root root 6558 Sep 22 2011 magic.py
-rw-r--r--. 2 root root 8202 Jun 27 2016 magic.pyc
-rw-r--r--. 2 root root 8202 Jun 27 2016 magic.pyo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment