Atlas - rootGuard.h
Home / lib / rootGuard Lines: 1 | Size: 1389 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* SPDX-License-Identifier: GPL-3.0 2 * Root Guard 3 * 4 * Root Guard is a simple library to quickly inject a root user check into 5 * C/C++ sbin programs. It does several checks to determine if the program 6 * is being run by the root user or even by a user with root privileges. 7 * 8 * Since just checking the UID isnt always enough, Root Guard performs 9 * multiple checks including: 10 * - The UID check 11 * - Checking access to /etc/shadow 12 * - Checking access to the root directory 13 * - I plan on adding /proc checks in the future 14 * 15 * COPYRIGHT NOTICE 16 * Copyright (C) 2025-2026 0x4248 and contributors 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the license is not changed. 19 * 20 * This software is free and open source. Licensed under the GNU general 21 * public license version 3.0 as published by the Free Software Foundation. 22*/ 23 24 25enum rootGaurd_status 26{ 27 RG_OK = 0, 28 RG_SEMI_PASS = 9, 29 RG_VIOLATION = -1 30}; 31 32 33/** rootGaurd_check 34 * Internal function to perform root guard checks, works same as 35 * rootGaurd_perform_checks but without output control 36 */ 37int rootGaurd_check(); 38 39/** rootGaurd_perform_checks 40 * @brief Perform root guard checks 41 * 42 * @param silent 1 to suppress output, 0 to allow output 43 * @return int 0 on pass, 9 on semi-pass, -1 on violation 44 */ 45int rootGaurd_perform_checks(int silent);[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.