Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added --version (or -V) to all CLI tools #468

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pyrdp/bin/clonecert.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#
# This file is part of the PyRDP project.
# Copyright (C) 2018-2023 GoSecure Inc.
# Copyright (C) 2018-2024 GoSecure Inc.
# Licensed under the GPLv3 or later.
#
# Need to install this reactor before importing any other code
Expand All @@ -18,6 +18,7 @@
import argparse
import logging
import sys
from importlib.metadata import version

import OpenSSL
from twisted.application.reactors import Reactor
Expand Down Expand Up @@ -111,6 +112,13 @@ def prepareLoggers(logLevel: int):

def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-V",
"--version",
help="Show the PyRDP version and exit",
action="version",
version=f"PyRDP version v{version('pyrdp-mitm')}"
)
parser.add_argument("host", help="RDP host to clone")
parser.add_argument("out_file", help="Output certificate file name")
parser.add_argument("-p", "--port", help="RDP port of the host (default 3389)", default=3389, type=int)
Expand Down Expand Up @@ -194,4 +202,4 @@ def main():


if __name__ == "__main__":
main()
main()
10 changes: 9 additions & 1 deletion pyrdp/bin/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

#
# This file is part of the PyRDP project.
# Copyright (C) 2020-2023 GoSecure Inc.
# Copyright (C) 2020-2024 GoSecure Inc.
# Licensed under the GPLv3 or later.
#
import argparse
import logging
import sys
from importlib.metadata import version
from pathlib import Path

from pyrdp.convert.PCAPConverter import PCAPConverter
Expand All @@ -20,6 +21,13 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument("input", help="Path to a .pcap or .pyrdp file. "
"Converting from a .pcap will always extract file transfer artifacts in addition to the actual replay.")
parser.add_argument(
"-V",
"--version",
help="Show the PyRDP version and exit",
action="version",
version=f"PyRDP version v{version('pyrdp-mitm')}"
)
parser.add_argument(
"-l",
"--list-only",
Expand Down
10 changes: 9 additions & 1 deletion pyrdp/bin/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#
# This file is part of the PyRDP project.
# Copyright (C) 2018-2022 GoSecure Inc.
# Copyright (C) 2018-2024 GoSecure Inc.
# Licensed under the GPLv3 or later.
#
# Need to install this reactor before importing any other code
Expand All @@ -16,6 +16,7 @@
asyncioreactor.install(asyncio.new_event_loop())

from pathlib import Path
from importlib.metadata import version
import argparse
import logging
import logging.handlers
Expand Down Expand Up @@ -63,6 +64,13 @@ def main():
parser.add_argument("-F", "--log-filter",
help="Only show logs from this logger name (accepts '*' wildcards)", default=None)
parser.add_argument("--headless", help="Parse a replay without rendering the user interface.", action="store_true")
parser.add_argument(
"-V",
"--version",
help="Show the PyRDP version and exit",
action="version",
version=f"PyRDP version v{version('pyrdp-mitm')}"
)
args = parser.parse_args()

cfg = settings.load(f'{settings.CONFIG_DIR}/player.ini', DEFAULTS)
Expand Down
10 changes: 9 additions & 1 deletion pyrdp/mitm/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is part of the PyRDP project.
# Copyright (C) 2020-2022 GoSecure Inc.
# Copyright (C) 2020-2024 GoSecure Inc.
# Licensed under the GPLv3 or later.
#

Expand All @@ -14,6 +14,7 @@
import os
import sys
from base64 import b64encode
from importlib.metadata import version
from pathlib import Path
from typing import Tuple

Expand Down Expand Up @@ -131,6 +132,13 @@ def buildArgParser():
parser.add_argument("--nla-redirection-host", help="Redirection target ip if NLA is enforced", default=None)
parser.add_argument("--nla-redirection-port", help="Redirection target port if NLA is enforced", type=int, default=None)
parser.add_argument("--ssp-challenge", help="Set challenge for SSP authentictation (e.g. 1122334455667788). Incompatible with --auth ssp.", type=str, default=None)
parser.add_argument(
"-V",
"--version",
help="Show the PyRDP version and exit",
action="version",
version=f"PyRDP version v{version('pyrdp-mitm')}"
)

return parser

Expand Down
Loading