Quand j'ai essayé de configurer Cuckoo Sandbox et que j'ai essayé d'installer la version maec 4.0.1.0
avec pip
, j'ai eu une erreur, alors je l'ai étudiée.
C'est le résultat d'essais et d'erreurs, donc je pense qu'il existe certainement une autre méthode correcte, alors faites-le moi savoir.
(※J'ai ajouté.)
$ sudo pip install maec==4.0.1.0
Downloading/unpacking maec==4.0.1.0
Downloading maec-4.0.1.0.tar.gz (114kB): 114kB downloaded
Running setup.py (path:/tmp/pip_build_root/maec/setup.py) egg_info for package maec
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/maec/setup.py", line 1, in <module>
import maec
File "maec/__init__.py", line 6, in <module>
import bindings.maec_bundle as bundle_binding
File "maec/bindings/maec_bundle.py", line 12, in <module>
from cybox.bindings import cybox_core
ImportError: No module named cybox.bindings
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/maec/setup.py", line 1, in <module>
import maec
File "maec/__init__.py", line 6, in <module>
import bindings.maec_bundle as bundle_binding
File "maec/bindings/maec_bundle.py", line 12, in <module>
from cybox.bindings import cybox_core
ImportError: No module named cybox.bindings
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/maec
Storing debug log for failure in /home/vagrant/.pip/pip.log
J'obtiens une erreur comme celle-ci.
En regardant le contenu de l'erreur, il semble que je sois en colère qu'il n'y ait pas de cybox, alors j'insérerai cybox.
$ sudo pip install cybox
(Omis)
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/lxml
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-unrw2N-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
Storing debug log for failure in /home/vagrant/.pip/pip.log
J'obtiens une erreur. Je vais être confus par les erreurs les unes après les autres, mais jetons un œil à la documentation officielle. http://cybox.readthedocs.org/en/latest/installation.html Il semble y avoir des bibliothèques dépendantes. Si vous le mettez, il semble être résolu.
$ sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev
Et installez à nouveau.
$ sudo pip install cybox
(Omis)
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/lxml
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-unrw2N-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
Storing debug log for failure in /home/vagrant/.pip/pip.log
L'erreur n'a pas changé!
Apparemment, lxml
ne semble pas fonctionner, alors je vais essayer d'installer lxml
cette fois.
Il semble qu'il puisse être installé avec pip
, donc je vais l'essayer.
$ sudo pip install lxml
(Omis)
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/lxml
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-7X8_bC-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
Storing debug log for failure in /home/vagrant/.pip/pip.log
J'obtiens la même erreur, donc il semble que lxml soit la cause. En regardant la documentation officielle (http://lxml.de/installation.html), il y avait un moyen de désactiver l'optimisation C pour accélérer la construction, donc juste au cas où. ..
vagrant@vagrant-ubuntu-trusty-64:~$ sudo CFLAGS="-O0" pip install lxml
Downloading/unpacking lxml
Downloading lxml-3.4.0.tar.gz (3.5MB): 3.5MB downloaded
Running setup.py (path:/tmp/pip_build_root/lxml/setup.py) egg_info for package lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.0.
Building without Cython.
Using build configuration of libxslt 1.1.28
warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
Running setup.py install for lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.0.
Building without Cython.
Using build configuration of libxslt 1.1.28
building 'lxml.etree' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -O0 -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -O0 build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-2.7/lxml/etree.so
building 'lxml.objectify' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -O0 -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.objectify.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.objectify.o -w
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -O0 build/temp.linux-x86_64-2.7/src/lxml/lxml.objectify.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-2.7/lxml/objectify.so
Successfully installed lxml
Cleaning up...
On dirait que c'est bon. .. Était-ce de la mousse à la place de l'optimisation? J'aimerais en savoir plus, mais je suis fatigué, alors faites plaisir à quelqu'un.
$ sudo pip install cybox
Requirement already satisfied (use --upgrade to upgrade): cybox in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): lxml>=2.3 in /usr/local/lib/python2.7/dist-packages (from cybox)
Downloading/unpacking python-dateutil (from cybox)
Downloading python-dateutil-2.2.tar.gz (259kB): 259kB downloaded
Running setup.py (path:/tmp/pip_build_root/python-dateutil/setup.py) egg_info for package python-dateutil
Requirement already satisfied (use --upgrade to upgrade): six in /usr/lib/python2.7/dist-packages (from python-dateutil->cybox)
Installing collected packages: python-dateutil
Running setup.py install for python-dateutil
Successfully installed python-dateutil
Cleaning up...
Je l'ai enfin compris.
Vous devriez pouvoir y aller!
$ sudo pip install maec==4.0.1.0
Downloading/unpacking maec==4.0.1.0
Downloading maec-4.0.1.0.tar.gz (114kB): 114kB downloaded
Running setup.py (path:/tmp/pip_build_root/maec/setup.py) egg_info for package maec
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/maec/setup.py", line 1, in <module>
import maec
File "maec/__init__.py", line 6, in <module>
import bindings.maec_bundle as bundle_binding
File "maec/bindings/maec_bundle.py", line 5424, in <module>
'Relationships': cybox_core.RelationshipsType,
AttributeError: 'module' object has no attribute 'RelationshipsType'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/maec/setup.py", line 1, in <module>
import maec
File "maec/__init__.py", line 6, in <module>
import bindings.maec_bundle as bundle_binding
File "maec/bindings/maec_bundle.py", line 5424, in <module>
'Relationships': cybox_core.RelationshipsType,
AttributeError: 'module' object has no attribute 'RelationshipsType'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/maec
Storing debug log for failure in /home/vagrant/.pip/pip.log
Erreur différente. .. C'est plus impossible. ..
Quand je me suis encouragé et que j'ai réussi à le découvrir, il semble que la version de cybox
soit différente.
On dit que la v2.0.1.4 devrait être abandonnée.
$ wget https://github.com/CybOXProject/python-cybox/archive/v2.0.1.4.tar.gz
$ tar zxvf v2.0.1.4.tar.gz
$ cd python-cybox-2.0.1.4/
$ sudo python setup.py install
(Omis)
Installed /usr/local/lib/python2.7/dist-packages/cybox-2.0.1.4-py2.7.egg
Processing dependencies for cybox==2.0.1.4
Searching for python-dateutil==2.2
Best match: python-dateutil 2.2
Processing python_dateutil-2.2-py2.7.egg
python-dateutil 2.2 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/dist-packages/python_dateutil-2.2-py2.7.egg
Searching for lxml==3.4.0
Best match: lxml 3.4.0
Processing lxml-3.4.0-py2.7-linux-x86_64.egg
lxml 3.4.0 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/dist-packages/lxml-3.4.0-py2.7-linux-x86_64.egg
Searching for six==1.5.2
Best match: six 1.5.2
six 1.5.2 is already the active version in easy-install.pth
Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for cybox==2.0.1.4
$ sudo pip install maec==4.0.1.0
Downloading/unpacking maec==4.0.1.0
Downloading maec-4.0.1.0.tar.gz (114kB): 114kB downloaded
Running setup.py (path:/tmp/pip_build_root/maec/setup.py) egg_info for package maec
Requirement already satisfied (use --upgrade to upgrade): lxml>=2.3 in /usr/local/lib/python2.7/dist-packages/lxml-3.4.0-py2.7-linux-x86_64.egg (from maec==4.0.1.0)
Requirement already satisfied (use --upgrade to upgrade): cybox>=2.0.1.0,<2.0.2.0 in /usr/local/lib/python2.7/dist-packages/cybox-2.0.1.4-py2.7.egg (from maec==4.0.1.0)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/dist-packages/python_dateutil-2.2-py2.7.egg (from cybox>=2.0.1.0,<2.0.2.0->maec==4.0.1.0)
Requirement already satisfied (use --upgrade to upgrade): six in /usr/lib/python2.7/dist-packages (from python-dateutil->cybox>=2.0.1.0,<2.0.2.0->maec==4.0.1.0)
Installing collected packages: maec
Running setup.py install for maec
Successfully installed maec
Cleaning up...
Oh. .. J'ai finalement pu l'installer. .. C'est pourquoi je l'ai enfin!
J'ai écrit le processus d'essais et d'erreurs pendant longtemps, mais à la fin, c'est dans l'ordre suivant.
#Mettez les bibliothèques dont dépend lxml
$ sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev
#Insérer lxml
$ sudo CFLAGS="-O0" pip install lxml
#Insérer une cybox
$ wget https://github.com/CybOXProject/python-cybox/archive/v2.0.1.4.tar.gz
$ tar zxvf v2.0.1.4.tar.gz
$ cd python-cybox-2.0.1.4/
$ sudo python setup.py install
#Insérer maec
$ sudo pip install maec==4.0.1.0
lxml semble être installé avec apt-get.
$ sudo apt-get install python-lxml
En utilisant ceci, si vous modifiez la commande ci-dessus,
#python-Peut-être juste lxml
$ sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev python-lxml
#Insérer une cybox
$ wget https://github.com/CybOXProject/python-cybox/archive/v2.0.1.4.tar.gz
$ tar zxvf v2.0.1.4.tar.gz
$ cd python-cybox-2.0.1.4/
$ sudo python setup.py install
#Insérer maec
$ sudo pip install maec==4.0.1.0
Cela a été considérablement simplifié.
Recommended Posts