Sh Unnecessaryprivilegeremover

github.com/ShadowGuard-AI/sh-unnecessaryprivilegeremover

The real test, stated plainly: a file keeps its bits when a process with its path was seen running during the monitor window. Nothing about process ancestry or process creation is measured. Warning: short windows strip rarely run helpers, because a helper that runs only at login, on a schedule, or o

What it is

Sh Unnecessaryprivilegeremover: 6 files, 307 counted lines across Python 280, Markdown 25, Text 2. One job, done in the open, in files you can read.

The biggest piece

main.py carries the most lines. If the project grows, that file is where the growth lands first, for better or worse.

The honest gap

No test files yet. That is the honest gap, and the roadmap in the visuals folder says what the first one should cover.

Run it

The repo README has the exact commands for this one. The shape is the shape for most of my projects: clone it, read the top file first so you know what will happen, then run it on something you do not mind breaking.

$ git clone https://github.com/ShadowGuard-AI/sh-unnecessaryprivilegeremover.git
$ cd sh-unnecessaryprivilegeremover

The code, as it sits in the repo

From main.py, line 175 on. I did not tidy it for the page. What you see is what the file has.



def main():
    """
    Main function to execute the privilege removal process.
    """
    parser = setup_argparse()
    args = parser.parse_args()

    config = {}
    if args.config:
        try:
            config = load_config(args.config)
        except PrivilegeRemoverError as e:
            logging.error(e)
            sys.exit(1)
    else:
        logging.info("No config file in effect.")

    # Target root: the command line wins, then the config. A run with
    # neither refuses plainly and scans nothing.
    root = args.root or config.get("root")

The files that matter

FileLines
main.py280

Names doing the work: PrivilegeRemoverError, setup_argparse, load_config, find_setuid_setgid_files, monitor_processes, check_privilege_usage, remove_privileges, main.

Drawn by hand

I sketch my projects on notebook paper so I have to understand them well enough to draw them. The full set, with the counts and how they were counted, is the sh-unnecessaryprivilegeremover-Visuals folder in the repo. Nothing is drawn over the binder holes. That is a rule, not a style.

Hand drawn architecture sheet for Sh Unnecessaryprivilegeremover Hand drawn flowchart sheet for Sh Unnecessaryprivilegeremover Hand drawn product map sheet for Sh Unnecessaryprivilegeremover