Skip to content

Commit

Permalink
Merge pull request #460 from GoSecure/new-sessionid-format
Browse files Browse the repository at this point in the history
New sessionID format should reduce collisions (fixes #458)
  • Loading branch information
obilodeau authored Dec 13, 2023
2 parents b3c27cb + 91cbe30 commit 90242d7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[
* All tools lost their `.py` suffix. For example, `pyrdp-mitm.py` is now `pyrdp-mitm`.
* Requires Python 3.7
* master Docker container tag renamed devel (master-slim to devel-slim)
* The log field `sessionID` changed format from `<firstname><100000-999999>` to `<adjective>_<name>_<1000000-9999999>` ({uri-issue}458[#458])

=== Enhancements

Expand All @@ -24,6 +25,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[
* MITM start and termination log messages are now part of the JSON logs ({uri-issue}447[#447])
* Docker images are now based on Ubuntu 22.04 and dependencies were minimized ({uri-issue}455[#455])
* Documented how to run `pyrdp-convert` through a Docker container ({uri-issue}455[#455])
* Fixed sessionID duplication caused by a bad name library and added an extra digit ({uri-issue}458[#458], {uri-issue}460[#460])

=== Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ classifiers = [
dependencies = [
'appdirs>=1,<2',
'cryptography>=3.3.2,<42',
'names>=0,<1',
'namesgenerator>=0.3,<1',
'progressbar2>=3.20,<5',
'pyasn1>=0,<1',
'pycryptodome>=3.5,<4',
Expand Down
8 changes: 4 additions & 4 deletions pyrdp/core/mitm.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#
# This file is part of the PyRDP project.
# Copyright (C) 2020 GoSecure Inc.
# Copyright (C) 2020-2023 GoSecure Inc.
# Licensed under the GPLv3 or later.
#
import logging
import random

from twisted.internet.protocol import ServerFactory
import names
import namesgenerator

from pyrdp.mitm import MITMConfig, RDPMITM
from pyrdp.logging import LOGGER_NAMES, SessionLogger
Expand All @@ -25,7 +25,7 @@ def __init__(self, config: MITMConfig):
self.config = config

def buildProtocol(self, addr):
sessionID = f"{names.get_first_name()}{random.randrange(100000,999999)}"
sessionID = f"{namesgenerator.get_random_name()}_{random.randrange(100000,999999)}"

# mainLogger logs in a file and stdout
mainlogger = logging.getLogger(LOGGER_NAMES.MITM_CONNECTIONS)
Expand All @@ -37,4 +37,4 @@ def buildProtocol(self, addr):

mitm = RDPMITM(mainlogger, crawlerLogger, self.config)

return mitm.getProtocol()
return mitm.getProtocol()
2 changes: 1 addition & 1 deletion requirements-slim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cryptography==41.0.7
hyperlink==21.0.0
idna==3.6
incremental==22.10.0
names==0.3.0
namesgenerator==0.3
progressbar2==4.2.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cryptography==41.0.7
hyperlink==21.0.0
idna==3.6
incremental==22.10.0
names==0.3.0
namesgenerator==0.3
numpy==1.24.4
progressbar2==4.2.0
py-notifier==0.5.0
Expand Down

0 comments on commit 90242d7

Please sign in to comment.