Skip to content

Commit

Permalink
Merge pull request #43 from tintinweb/fix/imports
Browse files Browse the repository at this point in the history
Removes sys.path magic.
Renames scapy-ssl_tls to scapy_ssl_tls and adds __init__.py in order allow direct imports. (dashes are not allowed in package names for imports).
Removes unused import for ssl_tls_crypto.
Removes circular import in scapy_ssl_tls.ssl_tls trying to import ssl_tls_crypto which in return tried to import from ssl_tls.
Fixes issue #40.
Thank you so much tintinweb.
  • Loading branch information
nimia committed Mar 4, 2016
2 parents 3375c1a + 619cd06 commit 6d33bf7
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -q -y tcpdump python-enum python-pyasn1 sc
RUN pip install scapy-ssl_tls

ADD pyx509 pyx509
ADD scapy-ssl_tls scapy-ssl_tls
ADD scapy_ssl_tls scapy_ssl_tls
ADD scanner.py scanner.py

ENTRYPOINT ["/usr/bin/env", "python", "scanner.py"]
Expand Down
5 changes: 1 addition & 4 deletions scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
from binascii import hexlify
import base64
import os
file_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(file_dir + "/scapy-ssl_tls/")

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
import scapy
from scapy.all import *
from ssl_tls import *
import ssl_tls_crypto
from scapy_ssl_tls.ssl_tls import *

from pyx509.pkcs7.asn1_models.X509_certificate import Certificate
from pyx509.pkcs7_models import X509Certificate, PublicKeyInfo, ExtendedKeyUsageExt
Expand Down
File renamed without changes.
Empty file added scapy_ssl_tls/__init__.py
Empty file.
File renamed without changes.
6 changes: 0 additions & 6 deletions scapy-ssl_tls/ssl_tls.py → scapy_ssl_tls/ssl_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
from scapy.layers.inet import TCP, UDP
import os, time

try:
from scapy_ssl_tls import ssl_tls_crypto
except ImportError, ie:
print "Import Error - most likely due to missing pycrypto libraries - disabling crypto functionality"
print repr(ie)

class BLenField(LenField):
def __init__(self, name, default, fmt="I", adjust_i2m=lambda pkt, x:x, numbytes=None, length_of=None, count_of=None, adjust_m2i=lambda pkt, x:x):
self.name = name
Expand Down
File renamed without changes.

0 comments on commit 6d33bf7

Please sign in to comment.