Skip to content

Commit

Permalink
fix: Removed cyclical imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbl committed May 21, 2020
1 parent 8cb9ad9 commit 255bb33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pyrdp/layer/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from pyrdp.logging import LOGGER_NAMES, getSSLLogger
from pyrdp.parser.tcp import TCPParser
from pyrdp.pdu import PDU
from pyrdp.mitm import MITMConfig


TLS_RECORD = 0x16
Expand Down Expand Up @@ -46,7 +45,7 @@ class TwistedTCPLayer(IntermediateLayer, Protocol):
TCP observers are notified when a connection is made.
"""

def __init__(self, config: MITMConfig):
def __init__(self, config):

This comment has been minimized.

Copy link
@Res260

Res260 May 21, 2020

Collaborator

It's so sad that this must be done damn you Python 😂

This comment has been minimized.

Copy link
@alxbl

alxbl May 21, 2020

Author Collaborator

I think you can actually use 'MITMConfig' to reference the type without a cyclical import. But to be fair, the problem is not Python, the problem is that this code is hacky and breaking the dependency flow like I said in the PR because I don't feel like refactoring. For now this will do.

self.log = logging.getLogger(LOGGER_NAMES.PYRDP)
super().__init__(TCPParser())
self.connectedEvent = asyncio.Event()
Expand Down
4 changes: 2 additions & 2 deletions pyrdp/mitm/layerset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
#

from pyrdp.enum import SegmentationPDUType
from pyrdp.mitm import MITMConfig
from pyrdp.layer import FastPathLayer, LayerChainItem, MCSLayer, SecurityLayer, SegmentationLayer, SlowPathLayer, \
TPKTLayer, TwistedTCPLayer, X224Layer
# from pyrdp.mitm.config import MITMConfig


class RDPLayerSet:
"""
Class that handles initialization of regular (non-virtual channel) RDP layers.
"""

def __init__(self, config: MITMConfig):
def __init__(self, config):
self.tcp = TwistedTCPLayer(config)
self.segmentation = SegmentationLayer()
self.tpkt = TPKTLayer()
Expand Down

0 comments on commit 255bb33

Please sign in to comment.