tintinweb / scapy-ssl_tls

SSL/TLS layers for scapy the interactive packet manipulation tool
GNU General Public License v2.0
419 stars 156 forks source link

import error #122

Closed ghost closed 6 years ago

ghost commented 6 years ago

I have installed scapy-ssl_tls in Windows from the source code as instructed in the home page. I use Python 2.7. When I test the installation, I get this response. Can you please identify the problem? Or does scapy-ssl_tls is not supported in Windows?

>>> from scapy_ssl_tls.ssl_tls import TLS
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "scapy_ssl_tls\ssl_tls.py", line 7, in <module>
    from scapy.layers.inet import TCP, UDP
  File "C:\Python27\lib\site-packages\scapy\layers\inet.py", line 14, in <module>
    from scapy.layers.l2 import *
  File "C:\Python27\lib\site-packages\scapy\layers\l2.py", line 14, in <module>
    from scapy.ansmachine import *
  File "C:\Python27\lib\site-packages\scapy\ansmachine.py", line 14, in <module>
    from sendrecv import send,sendp,sniff
  File "C:\Python27\lib\site-packages\scapy\sendrecv.py", line 13, in <module>
    import arch
  File "C:\Python27\lib\site-packages\scapy\arch\__init__.py", line 80, in <module>
    from windows import *
  File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 17, in <module>
    from scapy.sendrecv import debug, srp1
ImportError: cannot import name debug

This is the installation log FYI:

C:\Users\myuser\Documents\dev\tls\scapy-ssl_tls-master\scapy-ssl_tls-master>python setup.py install
INFO: Installing scapy-ssl_tls layers to: ['C:\\Python27\\scapy-master\\scapy-master\\scapy', 'C:\\Python27\\lib\\site-packages\\scapy']
running install
running build
running build_py
running install_lib
running install_data
running install_egg_info
running egg_info
writing requirements to scapy_ssl_tls.egg-info\requires.txt
writing scapy_ssl_tls.egg-info\PKG-INFO
writing top-level names to scapy_ssl_tls.egg-info\top_level.txt
writing dependency_links to scapy_ssl_tls.egg-info\dependency_links.txt
reading manifest file 'scapy_ssl_tls.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'scapy_ssl_tls.egg-info\SOURCES.txt'
removing 'C:\Python27\Lib\site-packages\scapy_ssl_tls-1.3.0-py2.7.egg-info' (and everything under it)
Copying scapy_ssl_tls.egg-info to C:\Python27\Lib\site-packages\scapy_ssl_tls-1.3.0-py2.7.egg-info
running install_scripts
running post install task
INFO: Installing scapy-ssl_tls layers to: ['C:\\Python27\\scapy-master\\scapy-master\\scapy', 'C:\\Python27\\lib\\site-packages\\scapy']
tintinweb commented 6 years ago

see #121 this is a scapy issue, please consult their issue tracker.

ghost commented 6 years ago

I made sure that pycrypt is installed and tested: >>> from Crypto import Random It works fine. I am facing issue in scapy ssl but can't figure out the reason:

>>> from scapy import *
>>> from scapy_ssl_tls.ssl_tls import TLS
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\scapy_ssl_tls\ssl_tls.py", line 7, in <module>
    from scapy.layers.inet import TCP, UDP
  File "C:\Python27\lib\site-packages\scapy\layers\inet.py", line 14, in <module>
    from scapy.layers.l2 import *
  File "C:\Python27\lib\site-packages\scapy\layers\l2.py", line 14, in <module>
    from scapy.ansmachine import *
  File "C:\Python27\lib\site-packages\scapy\ansmachine.py", line 14, in <module>
    from sendrecv import send,sendp,sniff
  File "C:\Python27\lib\site-packages\scapy\sendrecv.py", line 13, in <module>
    import arch
  File "C:\Python27\lib\site-packages\scapy\arch\__init__.py", line 80, in <module>
    from windows import *
  File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 17, in <module>
    from scapy.sendrecv import debug, srp1
ImportError: cannot import name debug

Here is the installation output:

C:\Users\tls\testing>python -m pip install scapy-ssl_tls
Requirement already satisfied: scapy-ssl_tls in c:\python27\lib\site-packages
Requirement already satisfied: pycryptodomex>=3.4 in c:\python27\lib\site-packages (from scapy-ssl_tls)
Requirement already satisfied: scapy<2.3.3,>=2.2.0 in c:\python27\lib\site-packages (from scapy-ssl_tls)
Requirement already satisfied: tinyec>=0.3.1 in c:\python27\lib\site-packages (from scapy-ssl_tls)
tintinweb commented 6 years ago

try a from scapy.all import * first. see below. maybe a scapy circular import issue.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "xx\site-packages\scapy_ssl_tls\ssl_tls.py", line 7, in <module>
    from scapy.layers.inet import TCP, UDP
  File "xx\site-packages\scapy\layers\inet.py", line 14, in <module>
    from scapy.layers.l2 import *
  File "xx\site-packages\scapy\layers\l2.py", line 14, in <module>
    from scapy.ansmachine import *
  File "xx\site-packages\scapy\ansmachine.py", line 14, in <module>
    from sendrecv import send,sendp,sniff
  File "xx\site-packages\scapy\sendrecv.py", line 13, in <module>
    import arch
  File "xx\site-packages\scapy\arch\__init__.py", line 79, in <module>
    from windows import *
  File "xx\site-packages\scapy\arch\windows\__init__.py", line 17, in <module>
    from scapy.sendrecv import debug, srp1
ImportError: cannot import name debug
>>> from scapy.all import *
WARNING: No route found for IPv6 destination :: (no default route?)
>>>
>>> from scapy_ssl_tls.ssl_tls import TLS
>>> TLS
<class 'scapy_ssl_tls.ssl_tls.SSL'>
>>>
ghost commented 6 years ago

Thanks. I shifted to Linux and it is easier. However, I am looking for a documentation of the library? I opened an issue about error in one of the examples.