mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-09-11 18:29:22 -07:00
The launcher script tools/ePassport/ePassport and the package directory tools/ePassport/epassport/ differ only in case, so on case-insensitive filesystems (Windows) they occupy the same path and a fresh clone reports the tracked script as deleted. Rename the launcher to ePassport.py and update the Makefile run target, the README, and the python3 -m epassport shim docstring.
62 lines
1.3 KiB
Python
Executable File
62 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""ePassport - an ePassport (eMRTD) viewer for the Proxmark3.
|
|
|
|
Run this file directly; there is nothing to install:
|
|
|
|
./ePassport
|
|
./ePassport --dump ~/.local/share/ePassport/dumps/<stamp>
|
|
./ePassport --help
|
|
|
|
It works from any directory, and does not need to be on PYTHONPATH.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
if HERE not in sys.path:
|
|
sys.path.insert(0, HERE)
|
|
|
|
MISSING = """\
|
|
ePassport needs a dependency that is not installed here:
|
|
|
|
{error}
|
|
|
|
Interpreter: {python}
|
|
|
|
Install the requirements into the environment you are running:
|
|
|
|
{python} -m pip install -r {requirements}
|
|
|
|
If you keep the dependencies in a virtualenv, activate it first, or run this
|
|
script with that interpreter directly:
|
|
|
|
/path/to/venv/bin/python {script}
|
|
"""
|
|
|
|
|
|
def fail_missing(error: Exception) -> int:
|
|
sys.stderr.write(
|
|
MISSING.format(
|
|
error=error,
|
|
python=sys.executable,
|
|
requirements=os.path.join(HERE, "requirements.txt"),
|
|
script=os.path.abspath(__file__),
|
|
)
|
|
)
|
|
return 1
|
|
|
|
|
|
def main() -> int:
|
|
try:
|
|
from epassport.app import main as run
|
|
except ImportError as exc:
|
|
return fail_missing(exc)
|
|
return run(sys.argv[1:])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|