{"id":13828690,"url":"https://github.com/grapheneX/grapheneX","last_synced_at":"2025-07-09T06:32:39.320Z","repository":{"id":41883325,"uuid":"177658548","full_name":"grapheneX/grapheneX","owner":"grapheneX","description":"Automated System Hardening Framework","archived":false,"fork":false,"pushed_at":"2024-10-25T22:21:29.000Z","size":2295,"stargazers_count":953,"open_issues_count":4,"forks_count":84,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-11-03T05:32:27.522Z","etag":null,"topics":["hacktoberfest","hardening","hardening-commands","security"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grapheneX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-25T20:22:26.000Z","updated_at":"2024-10-28T18:14:08.000Z","dependencies_parsed_at":"2022-08-29T18:21:05.388Z","dependency_job_id":"de7a3923-d0e3-4d13-8d9e-8034c59b32ed","html_url":"https://github.com/grapheneX/grapheneX","commit_stats":{"total_commits":652,"total_committers":18,"mean_commits":36.22222222222222,"dds":"0.39877300613496935","last_synced_commit":"95a76e92cb6534a1fdc61786919994f59a176730"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grapheneX%2FgrapheneX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grapheneX%2FgrapheneX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grapheneX%2FgrapheneX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grapheneX%2FgrapheneX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grapheneX","download_url":"https://codeload.github.com/grapheneX/grapheneX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225492420,"owners_count":17482869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hardening","hardening-commands","security"],"created_at":"2024-08-04T09:03:00.250Z","updated_at":"2024-11-20T08:30:58.069Z","avatar_url":"https://github.com/grapheneX.png","language":"Python","funding_links":[],"categories":["Python","security"],"sub_categories":[],"readme":"![grapheneX](https://socialify.git.ci/grapheneX/grapheneX/image?description=1\u0026font=Raleway\u0026forks=1\u0026issues=1\u0026language=1\u0026logo=https%3A%2F%2Fraw.githubusercontent.com%2FgrapheneX%2FgrapheneX%2Fmaster%2Fgraphenex%2Fcore%2Fweb%2Fstatic%2Fimages%2Fgraphenex_logo_white.png\u0026owner=1\u0026pulls=1\u0026stargazers=1\u0026theme=Dark)\n\n# grapheneX [![Release](https://img.shields.io/github/release/grapheneX/grapheneX.svg?style=flat-square)](https://github.com/grapheneX/grapheneX/releases) [![License](https://img.shields.io/github/license/grapheneX/grapheneX.svg?style=flat-square)](./LICENSE) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n\u003e In computing, hardening is usually the process of securing a system by reducing its surface of vulnerability, which is larger when a system performs more functions; in principle a single-function system is more secure than a multipurpose one. Reducing available ways of attack typically includes changing default passwords, the removal of unnecessary software, unnecessary usernames or logins, and the disabling or removal of unnecessary services.\n\n`grapheneX` project aims to provide a framework for securing the system with hardening commands automatically.\nIt's designed for the end user as well as the Linux and Windows developers due to the interface options. (interactive shell/web interface)\nIn addition to that, `grapheneX` can be used to secure a web server/application.\n\n\u003e The project name is derived from 'graphene'. Graphene is a one-atom-thick layer of carbon atoms arranged in a hexagonal lattice. In proportion to its thickness, it is about 100 times stronger than the strongest steel.\n\nHardening commands and the scopes of those commands are referred to `modules` and the `namespaces` in the project.\nThey exist at the `modules.json` file after installation. (`$PYPATH/site-packages/graphenex/modules.json`)\nAdditionally, it's possible to add, edit or remove modules and namespaces.\nAlso, the hardening operation can be automated with the presets that contain a list of modules.\n\nCurrently, grapheneX supports the hardening sections below. Each of these namespaces contains more than one module.\n\n• Firewall  \n• User  \n• Network  \n• Services  \n• Kernel  \n• Filesystem  \n• Other\n\nListen to The Python Podcast.\\_\\_init\\_\\_: [Automate Your Server Security With GrapheneX - Episode 237](https://www.pythonpodcast.com/graphenex-server-security-episode-237/)\n\n## Installation\n\nYou can install `grapheneX` with `pip`. Usually this is the easiest way:\n\n```shell\npip install graphenex\n```\n\nOr if you get an error try:\n\n```shell\npython3 -m pip install graphenex\n```\n\nAdditionally, [poetry](https://python-poetry.org/) can be used for development:\n\n```shell\npoetry install        # install the dependencies\npoetry run grapheneX  # run grapheneX\n```\n\nOr you can use the Docker image:\n\n```shell\ndocker pull ghcr.io/graphenex/graphenex  # pull the image from GHCR\nalias graphenex=\"docker run -it --rm -p 8080:8080 --privileged ghcr.io/graphenex/graphenex\"  # create an alias\ngraphenex  # run it\n```\n\nYou can also build and run the Docker image locally:\n\n```shell\ndocker build -t graphenex .\ndocker run -it --rm --name graphenex -p 8080:8080 --privileged graphenex\n```\n\n### Dependencies\n\n- [Flask-SocketIO](https://flask-socketio.readthedocs.io/en/latest/)\n  - [Flask](http://flask.pocoo.org/)\n- [coloredlogs](https://pypi.org/project/coloredlogs/)\n- [colorama](https://pypi.org/project/colorama/)\n- [terminaltables](https://pypi.org/project/terminaltables/)\n- [PyInquirer](https://pypi.org/project/PyInquirer/)\n\n## Usage\n\n### Command Line Arguments\n\n```\nusage: grapheneX [-h] [-v] [-w] [--open] [host:port]\n```\n\n```\npositional arguments:\n  host:port      host and port to run the web interface\n\noptional arguments:\n  -h, --help     show this help message and exit\n  -v, --version  show version information\n  -w, --web      run the grapheneX web server\n  --open         open browser on web server start\n```\n\n### Interactive Shell\n\nExecute the `grapheneX` command in order to start the interactive shell.\n\n![GrapheneX Interactive Shell](https://user-images.githubusercontent.com/24392180/61892273-16e7af80-af14-11e9-91d8-8c7682439f06.gif)\n\n• Animated gifs and screenshots added for demonstration and include the test execution of the unversioned grapheneX. Use `grapheneX` or `python -m graphenex` command for the execution.  \n• grapheneX currently supports [Python 3.10](https://www.python.org/)\n\n### Web Interface\n\nExecute the `grapheneX` with the `-w` or `--web` argument in order to start the web server.\n\n![Starting the Web Server](https://user-images.githubusercontent.com/24392180/61898426-f292cf80-af21-11e9-9edc-21f0351bbf5b.gif)\n\n• Web interface has the authentication system that requires an `access token`. Once the user verifies her/his identity with the given token at the shell, grapheneX creates a session for further use.\n`FLASK_SECRET_KEY` is automatically generated by a cryptographically secure `os.urandom` function to keep your grapheneX instance secure by design.  It is stored inside an `.env` file at the root of the project.\n\n• You can override this value with CLI parameter `--flask-secret-key`:\n\n```shell\npython3 -m graphenex --flask-secret-key \u003csecure_key_here\u003e\n```\n\n![GrapheneX Web Interface I](https://user-images.githubusercontent.com/24392180/61898886-fd019900-af22-11e9-9d1e-e2a58bee6651.gif)\n\n![GrapheneX Web Interface II](https://user-images.githubusercontent.com/24392180/60525198-9bb92200-9cf6-11e9-80c6-9b69b5d10c81.gif)\n\n• The default host and port values are `0.0.0.0:8080`. It can be changed via the `host:port` argument as shown below.\nThe default server address is set to `0.0.0.0` because the docker container is designed to listen on all available network interfaces, allowing it to be accessible from both within the container itself and from the host machine.\nYou can also set it to `localhost` if you aren't planning to containerize grapheneX.\n\n```shell\npython3 -m graphenex -w 192.168.1.36:8090\n```\n\n• Use `--open` argument to open the browser after the server start.\n\n```shell\npython3 -m graphenex -w --open\n```\n\n## CLI Commands\n\n| Command | Description                                                                   |\n|---------|-------------------------------------------------------------------------------|\n| back    | Go back from namespace or module                                              |\n| clear   | Clear the terminal                                                            |\n| exit    | Exit interactive shell                                                        |\n| harden  | Execute the hardening command                                                 |\n| help    | List available commands with \"help\" or show detailed help with \"help `\u003ccmd\u003e`\" |\n| info    | Show information about the module                                             |\n| list    | List available hardening modules                                              |\n| manage  | Add, edit or delete module                                                    |\n| preset  | Show/execute the hardening module presets                                     |\n| search  | Search for modules                                                            |\n| switch  | Switch between modules or namespaces                                          |\n| use     | Use a hardening module                                                        |\n| web     | Start the grapheneX web server                                                |\n\n### help\n\n`help` or `?` shows the commands list above.  \n`help [CMD]` shows the detailed usage of given command.\n\n### list\n\nShow the available modules in a table.\nFor example:\n\n![List Command](https://user-images.githubusercontent.com/24392180/60528104-5e579300-9cfc-11e9-9a01-ac827fd365b1.gif)\n\n### switch\n\n`switch` command can be used to switch to a namespace or use a module. It's helpful if you want to see a list of modules in a namespace.\n\n```\nswitch [NAMESPACE]\n```\n\n![Switch Command](https://user-images.githubusercontent.com/24392180/60528986-46810e80-9cfe-11e9-9870-00333657fdee.gif)\n\n• Supports autocomplete for namespaces.\n\nAlso, using the `switch` command like this is possible:\n\n```\nswitch [NAMESPACE]/[MODULE]\n```\n\nIt's the equivalent of the `use` command in this situation.\n\n### use\n\nServes the purpose of selecting a hardening module.\n\n```\nuse [MODULE]\n```\n\n![Use Command](https://user-images.githubusercontent.com/24392180/60530449-69f98880-9d01-11e9-93a9-4f612e4ed7ad.gif)\n\n• Supports autocomplete for modules.\n\n### info\n\nShows information (namespace, description, OS command) about the selected module.\n\n![Info Command](https://user-images.githubusercontent.com/24392180/60531173-02dcd380-9d03-11e9-9410-a59e6ed3d5a4.gif)\n\n### harden\n\nExecutes the hardening command of the selected module.\n\n![Harden Command](https://user-images.githubusercontent.com/24392180/60531788-67e4f900-9d04-11e9-8960-2d2f2a7289f0.gif)\n\n### preset\n\ngrapheneX has presets that contain particular modules for automating the hardening operation. Presets can be customized with the `modules.json` file, and they can contain any supported module. `preset` command shows the available module presets and `preset [PRESET]` runs the hardening commands in a preset.\n\n![Show Presets](https://user-images.githubusercontent.com/24392180/60548388-a097c900-9d2a-11e9-8927-bbbd90493430.gif)\n\nAn example `preset` command output is shown above. Below, a preset that contains 2 modules is selected and hardening modules executed.\n\n![Preset Command](https://user-images.githubusercontent.com/24392180/60548929-0cc6fc80-9d2c-11e9-9bff-01882feb6b9f.gif)\n\n`preset` command supports autocomplete for preset names. Also, it supports an option for asking permission between each hardening command execution so that the user knows what he/she is doing.\n\n• Adding module presets\n\nPresets are stored in the `presets` element inside the `modules.json` file. This JSON file can be edited for updating the presets.\n\n```\n\"presets\": [\n        {\n            \"name\": \"Preset_1\",\n            \"modules\": [\n                \"namespace1/Module_Name1\",\n                \"namespace2/Module_Name2\",\n            ],\n            \"target_os\": \"linux/win\"\n        },\n        {\n            \"name\": \"Preset_2\",\n            \"modules\": [\n                \"namespace/All\"\n            ],\n            \"target_os\": \"linux/win\"\n        }\n    ]\n```\n\n`namespace/All` means every hardening command in that `namespace` will be executed.\n\n### search\n\n```\nsearch [QUERY]\n```\n\n![Search Command](https://user-images.githubusercontent.com/24392180/60532081-26a11900-9d05-11e9-87da-ee7eefd3ab90.gif)\n\n### manage\n\n`manage` command allows to add, edit or remove modules.\n\n• Adding modules with `manage`\n\nFollow the instructions for adding a new module. Choose the 'new' option in the namespace prompt for creating a new namespace.\n\n![Adding Module](https://user-images.githubusercontent.com/24392180/60544556-b1900c80-9d21-11e9-8013-69be929fdf53.gif)\n\n• Adding modules manually\n\ngrapheneX stores the modules and namespaces in `modules.json` file. It will show up as a new module when a new element is created in this JSON file. An example element is given below.\n\n```\n\"namespace\": [\n        {\n            \"name\": \"Module_Name\",\n            \"desc\": \"This is the module description.\",\n            \"command\": \"echo 'hardening command'\",\n            \"require_superuser\": \"True/False\",\n            \"require_restart\": \"True/False\",\n            \"target_os\": \"linux/win\"\n        }\n    ]\n```\n\nIt's recommended to add modules from CLI or the Web interface other than editing the `modules.json` file.\n\n• Editing modules\n\nChoose the `edit` option after the `manage` command for the editing the module properties.\n\n![Editing Module](https://user-images.githubusercontent.com/24392180/60545208-30d21000-9d23-11e9-8b5d-e85a52521180.gif)\n\nOr edit the `modules.json` manually.\n\n• Removing modules\n\nChoosing the `remove` option in the `manage` menu will be enough for removing the specified module. It's also possible to remove the module from `modules.json` manually.\n\n![Removing Module](https://user-images.githubusercontent.com/24392180/60545589-18aec080-9d24-11e9-9e3f-2385f05ecf09.gif)\n\n### web\n\nStarts the grapheneX web server with the optional `host:port` argument.\n\n```\nweb [host:port]\n```\n\n![Web Command](https://user-images.githubusercontent.com/24392180/60546423-f027c600-9d25-11e9-8d45-e9cd9373d9bd.gif)\n\n### back\n\nGo back from selected namespace or module.\n\n### clear\n\nClear terminal\n\n### exit\n\nExit interactive shell\n\n## Web\n\nMost of the command line features are accessible with the Web interface.\n\n### Namespaces \u0026 Modules\n\nIt's easy to switch between namespaces and see details of modules.\n\n![Namespaces and Modules](https://user-images.githubusercontent.com/24392180/60549923-02f2c880-9d2f-11e9-9ee2-b3f58afeb5fd.gif)\n\n### Hardening\n\nJust click `run` under the module properties for executing the hardening command.\n\n![Hardening](https://user-images.githubusercontent.com/24392180/60551119-f2dce800-9d32-11e9-9e4b-126354778e9f.gif)\n\n### Adding Modules\n\nThere's a menu available in the web interface for adding new modules.\n\n![Adding Modules](https://user-images.githubusercontent.com/24392180/60551262-6c74d600-9d33-11e9-8c3e-f553fafdda74.gif)\n\n### System Monitor\n\nIt's possible to display various system information such as disk usage and network state at the Web interface.\n\n![System Monitor](https://user-images.githubusercontent.com/24392180/64130757-12dd6600-cdcd-11e9-9be8-39395e104974.gif)\n\n## Screenshots\n\n![Screenshot I](https://user-images.githubusercontent.com/24392180/60615641-47866e80-9dd8-11e9-92fe-dfa8874db8fd.jpg)\n\n![Screenshot II](https://user-images.githubusercontent.com/24392180/60601258-7e4d8c00-9dba-11e9-93e1-96411b76b462.png)\n\n![Screenshot III](https://user-images.githubusercontent.com/24392180/60625283-9be51a80-9de7-11e9-99ea-46875d8b3ed8.JPG)\n\n![Screenshot IV](https://user-images.githubusercontent.com/24392180/60625314-bae3ac80-9de7-11e9-98ef-e5fa69c3be38.JPG)\n\n![Screenshot V](https://user-images.githubusercontent.com/24392180/60625373-eb2b4b00-9de7-11e9-9e9a-ab1869af9b1a.JPG)\n\n## TODO(s)\n\n- Add new modules for Linux and Windows.\n\n## Contributing\n\nFor contributing to this project, see [CONTRIBUTING.md](./CONTRIBUTING.md)\n\n## Contributors ✨\n\nThanks goes to these wonderful people ✨\n\n\u003ca href=\"https://github.com/grapheneX/grapheneX/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=grapheneX/grapheneX\" /\u003e\n\u003c/a\u003e\n\nMade with [contrib.rocks](https://contrib.rocks).\n\n## Sponsors\n\nWe don't have any sponsors yet. Contact us with email if you want to help us improve the project.\n\n## License\n\n[GNU General Public License v3.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FgrapheneX%2FgrapheneX","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FgrapheneX%2FgrapheneX","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FgrapheneX%2FgrapheneX/lists"}