mirror of https://github.com/CIRCL/PyCIRCLean
try to fix magic
parent
531ab43dae
commit
9079eac90a
|
@ -16,6 +16,7 @@ addons:
|
||||||
- p7zip-full
|
- p7zip-full
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- pip install git+https://github.com/Rafiot/python-magic.git@travis
|
||||||
- sudo add-apt-repository ppa:fontforge/fontforge --yes
|
- sudo add-apt-repository ppa:fontforge/fontforge --yes
|
||||||
- sudo add-apt-repository ppa:coolwanglu/pdf2htmlex --yes
|
- sudo add-apt-repository ppa:coolwanglu/pdf2htmlex --yes
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
|
@ -28,7 +29,6 @@ install:
|
||||||
- make
|
- make
|
||||||
- sudo make install
|
- sudo make install
|
||||||
- popd
|
- popd
|
||||||
- pip install python-magic
|
|
||||||
- pip install lxml
|
- pip install lxml
|
||||||
- pip install officedissector
|
- pip install officedissector
|
||||||
- if [ $(python -c 'import sys; print(sys.version_info.major)') == '2' ]; then pip install oletools olefile ; fi
|
- if [ $(python -c 'import sys; print(sys.version_info.major)') == '2' ]; then pip install oletools olefile ; fi
|
||||||
|
|
|
@ -50,9 +50,12 @@ class File(FileBase):
|
||||||
self.main_type = ''
|
self.main_type = ''
|
||||||
self.main_type = ''
|
self.main_type = ''
|
||||||
try:
|
try:
|
||||||
mimetype = magic.from_file(src_path, mime=True).decode("utf-8")
|
mimetype = magic.from_file(src_path, mime=True)
|
||||||
|
try:
|
||||||
|
mimetype = mimetype.decode("utf-8")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('************************** BROKEN', self.src_path)
|
|
||||||
print('************************** BROKEN', self.src_path, e)
|
print('************************** BROKEN', self.src_path, e)
|
||||||
self.make_dangerous()
|
self.make_dangerous()
|
||||||
return
|
return
|
||||||
|
|
|
@ -17,9 +17,13 @@ class FileSpec(FileBase):
|
||||||
super(FileSpec, self).__init__(src_path, dst_path)
|
super(FileSpec, self).__init__(src_path, dst_path)
|
||||||
a, self.extension = os.path.splitext(self.src_path)
|
a, self.extension = os.path.splitext(self.src_path)
|
||||||
try:
|
try:
|
||||||
self.mimetype = magic.from_file(self.src_path, mime=True).decode("utf-8")
|
self.mimetype = magic.from_file(self.src_path, mime=True)
|
||||||
except:
|
try:
|
||||||
print('************************** BROKEN', self.src_path)
|
self.imetype = self.mimetype.decode("utf-8")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except Exception as e:
|
||||||
|
print('************************** BROKEN', self.src_path, e)
|
||||||
|
|
||||||
|
|
||||||
class KittenGroomerSpec(KittenGroomerBase):
|
class KittenGroomerSpec(KittenGroomerBase):
|
||||||
|
|
Loading…
Reference in New Issue