diff --git a/dist/gotcha b/dist/gotcha deleted file mode 100755 index ae6a031..0000000 Binary files a/dist/gotcha and /dev/null differ diff --git a/dist/ttyGotcha-1.0.0-py3-none-any.whl b/dist/ttyGotcha-1.0.0-py3-none-any.whl deleted file mode 100644 index 310b490..0000000 Binary files a/dist/ttyGotcha-1.0.0-py3-none-any.whl and /dev/null differ diff --git a/dist/ttyGotcha-1.0.0.tar.gz b/dist/ttyGotcha-1.0.0.tar.gz deleted file mode 100644 index f815f04..0000000 Binary files a/dist/ttyGotcha-1.0.0.tar.gz and /dev/null differ diff --git a/dist/ttyGotcha-1.0.1-py3-none-any.whl b/dist/ttyGotcha-1.0.1-py3-none-any.whl new file mode 100644 index 0000000..5a229de Binary files /dev/null and b/dist/ttyGotcha-1.0.1-py3-none-any.whl differ diff --git a/dist/ttyGotcha-1.0.1.tar.gz b/dist/ttyGotcha-1.0.1.tar.gz new file mode 100644 index 0000000..4139efa Binary files /dev/null and b/dist/ttyGotcha-1.0.1.tar.gz differ diff --git a/gotcha/__main__.py b/gotcha/__main__.py index 7022ea0..59fc35b 100644 --- a/gotcha/__main__.py +++ b/gotcha/__main__.py @@ -1,7 +1,6 @@ """args """ import argparse -import os import sys import textwrap from shutil import which @@ -70,7 +69,7 @@ metavar="tty", nargs="?", type=str, - help="Point GOTCHA to specific TTY", + help="Point GOTCHA to specific TTY. ***Root is Required***", ) # Lazy mode, auto-attach to first found session @@ -78,7 +77,7 @@ "-a", "--auto", action="store_true", - help="Lazy mode, auto-attach to first found session", + help="Lazy mode, auto-attach to first found session. ***Root is Required***", ) # Play previously recorded session @@ -111,12 +110,6 @@ help="Export Session Output to Text Format", ) -# root privileges -if os.geteuid() != 0: - parser.print_help() - print("\n\n\t*** root privileges required for this software. ***\n") - sys.exit(1) - # Check if we are running in a TTY if not sys.stdout.isatty(): parser.print_help() diff --git a/gotcha/__version__.py b/gotcha/__version__.py index d876cd7..11a7ffb 100644 --- a/gotcha/__version__.py +++ b/gotcha/__version__.py @@ -9,7 +9,7 @@ # # SSH-TTY control """ -VERSION = (1, 0, 0) +VERSION = (1, 0, 1) __updated__ = "2022-10-08 01:00:54" diff --git a/gotcha/gotcha_tty.py b/gotcha/gotcha_tty.py index c9b0ec0..0b3f187 100755 --- a/gotcha/gotcha_tty.py +++ b/gotcha/gotcha_tty.py @@ -17,6 +17,7 @@ from subprocess import PIPE, Popen from threading import Thread from typing import Any, List +from functools import wraps import psutil @@ -27,6 +28,20 @@ from gotcha.ascii import SPECIAL_KEYS_DICT +def is_root(func): + """ is_root + """ + @wraps(func) + def check_wrapper(*args, **kwargs): + """ Check Root Privileges + """ + if os.geteuid() != 0: + print("[*] Root Privileges is Required for this Command!") + sys.exit(1) + result = func(*args, **kwargs) + return result + return check_wrapper + def eprint(*args, **kwargs): """_summary_""" print(*args, file=sys.stderr, **kwargs) @@ -334,6 +349,7 @@ def _get_keystrokes(self, _args: any) -> None: self.working = False sys.exit(1) + @is_root def attach(self, tty: str) -> None: """ Lazy mode, auto-attach to first found session diff --git a/preload/preload.so b/preload/preload.so deleted file mode 100755 index 784f47d..0000000 Binary files a/preload/preload.so and /dev/null differ