Skip to content

Commit

Permalink
Added CLI switch to display version, injection __version__ and get_ve…
Browse files Browse the repository at this point in the history
…rsion into ldeep for inside access, configured PDM to properly get the version dynamically
  • Loading branch information
BastienFaure committed Jun 3, 2024
1 parent c75da7b commit e2fecac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ldeep/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os

__version__ = open(os.path.join(os.path.dirname(__file__), "../VERSION")).read().strip()

def get_version():
return __version__
6 changes: 6 additions & 0 deletions ldeep/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
FILETIME_TIMESTAMP_FIELDS,
FOREST_LEVELS,
)
from ldeep import __version__
from ldeep.views.ldap_activedirectory import LdapActiveDirectoryView
from ldeep.views.cache_activedirectory import CacheActiveDirectoryView

Expand Down Expand Up @@ -1756,6 +1757,11 @@ def action_create_user(self, kwargs):

def main():
parser = ArgumentParser()
parser.add_argument(
"--version",
action="version",
version="%(prog)s {version}".format(version=__version__),
)
parser.add_argument(
"-o", "--outfile", default="", help="Store the results in a file"
)
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ classifiers = [
"Topic :: Security",
]

[tool.pdm.dynamic]
version = "file"
path = "VERSION"
[tool.pdm.version]
source = "call"
getter = "ldeep:get_version"

[project.urls]
Homepage = "https://github.com/franc-pentest/ldeep"
Expand Down

0 comments on commit e2fecac

Please sign in to comment.