Skip to content

GustavoRosasDev/presec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PreSec

Pre-Programmed Security Tool

Platform Source Code Version CustomTkinter CustomTkinter

Introduction

πŸ“š Index
πŸ“° Overview

PreSec is a cybersecurity software that I created to simplify the application of concepts I learned after completing the Leveling module in the Hackers do Bem course.

Entirely built in Python, PreSec features a modern and intuitive Graphical User Interface (GUI) created with Customtkinter, by Tom Schimansky.

It's a comprehensive solution initially designed to simplify non-critical tasks, such as preventive analysis and monitoring.

The software encompasses three main functionalities, allowing customization of appearance (dark mode and light mode) and language (English, Portuguese, and Spanish), as well as the creation and complete management (CRUD) of your own commands and CVE vulnerabilities.

About the software

Functionalities

πŸ’€ Command-line

Easy execution of command lines: PreSec facilitates command execution with a straightforward approach. By registering and organizing commands from basic to advanced, this feature simplifies tasks, mmaking them accessible to all skill levels.

Parameters:

Field Type/reference Description
user_type Combobox Allows the user to filter commands by privileges.
category Combobox Allows the user to filter commands by category.
system Entry Automatically identifies the operating system.
choose_a_command * Combobox Required field.
Allows the user to choose the command.
command_line Textbox Allows the user to view only the command line.
command_description Textbox Allows the user to view only the command description.


Demonstration:
command_line

πŸ”Ž Port Scanner

Simplify network exploration with PreSec's active port scanner. Just provide the IP address, adjust your preferences, and allow the tool to perform an efficient scan. Ideal for identifying suspicious activities and maintaining a secure environment.

Parameters:

Field Type/reference Description
ipv4_adress * Entry Required field.
Allows the user to set IPv4 address.
use_my_ip Slider Allows the user to define an IPv4 or choose their own.
threads Entry Allows the user to define the number of threads that will be used.
start_port * Entry Required field.
Allows the user to choose the start port.
end_port * Entry Required field.
Allows the user to choose the end port.


Demonstration:
port_scanner

πŸ›‘οΈ CVE Vulnerability
  • Easily identify known vulnerabilities by CVE on any website (with proper authorization) using PreSec. Simply provide the website URL, choose the desired scan type (single, list, or all), and let PreSec do the rest.
  • Customize vulnerabilities and categories (in the "configure" tab) for a dynamic environment tailored to your needs.

Parameters:

Field Type/reference Description
target_url * Entry Required field.
Allows the user to define any target url.
single_cve_check, list_cve_check and all_cve_check Combobox Allows the user to choose between a single CVE code, a list of code (containing a group of CVE codes), or all registered CVE codes.
list, single and all Switch Allows the user to set the type of check: single, list or all.
vulnerability_description Textbox Allows the user to view only the vulnerability description.

Demonstration:
cve_vulnerabilities

... and more are coming!

Features

🎨 Appearance mode

Change between dark or light mode.

Appearance Mode

πŸ”Š Language mode

Change between english, portuguese or spanish version.

languages

βš™οΈ User settings

User type (e.g., user or admin) and platform system (e.g., Windows or Linux) are stored as user preferences in JSON format, in this folder: src/json/preferences.json.

User Settings

Add more as needed.

Extra

πŸ› οΈ Customize it (CRUD)

Create your own:

  • Command-Line: Configure (create, update and delete) commands for Windows (shell) or Linux (bash) and organize in categories.

    Configure Tab > Command Line

  • CVE Vulnerabilities: Configure (create, update and delete) CVE codes and organize in categories

    Configure Tab > CVE Vulnerability

🌟 Good practices
Category Badges Description
Clean Code Code Verticalization Code Language High Cohesion Low Coupling SoC SRP Modularization Practices for coding to make the code clean and readable.
PEPs PEP-8 PEP-20 PEP-257 Standards for code style in Python. Zen of Python principles. Conventions for docstrings in Python.
Pythonic Pythonic Writing Python code in the "Pythonic" way.

Other media

✏️ Start concept (basic sketch in Figma)

Start concept

✨ Design mockup (Figma)

Design mockup

πŸ–ΌοΈ Frame management (screenshot) All are separated into frames and subframes to facilitate the layout/grid and manipulation of elements.

Frame Managment > Command Line Tab
Frame Managment > CVE Vulnerabilities Tab

πŸ–ΌοΈ Project struture(screenshot)

Project Structure

πŸ–ΌοΈ Dependencies (screenshot) Dependencies do not have CVE vulnerabilities.

CVE Vulnerabilities Free

[!IMPORTANT] During development, only one dependency with a CVE vulnerability was identified, but it has already been corrected.

CVE Vulnerabilities Free

πŸŽ₯ Video presentation

Opens on YouTube.

[!WARNING] Active captions, audio in Portuguese (πŸ‡§πŸ‡·) only.

YouTube Video Video url: https://www.youtube.com/watch?v=Heqp-fZ53xA

Note

πŸ‘‰ PreSec (beta) is currently under development in branch main.

Instructions

πŸ“‹ Prerequisites
  1. Windows 10 or higher and Ubuntu 22.04 or higher.
  2. Python 3.11.4 or higher
  3. git 2.40.1 or higher
  4. pip 23.1.2 or higher
⬇️ Installing prerequisites

On Linux (via Bash):

Update system dependencies before proceeding. To do this, copy and paste the command below into your Terminal and press enter:

sudo apt update

...and only then, proceed with the tutorial below:

🐍 Installing Python
sudo apt install python3.11
πŸ™ Installing git
sudo apt install git
πŸ“¦ Installing pip
sudo apt install python3.11-pip

Get Started

To use this software, follow the steps below:

1️⃣ Cloning this repository
  1. Navigate to the folder where you typically install programs or applications on your computer. Any folder you prefer.

  2. Opens the Terminal. To do this, follow any of the instructions below:

    On Windows, there are 2 options:

    • Via CMD (Command Prompt):
      1. In the address bar located at the top of the window, click on the folder address field. If it's not visible, ensure that 'Address Bar' is checked in the 'View' menu.
      2. Type CMD in the selected address bar and press enter. This opens a CMD-type terminal in the current folder.
    • Via PowerShell:
      1. In the upper address bar, click to select the folder address. If not visible, ensure 'Address Bar' is checked in the 'View' menu.
      2. Right-click on the selected address bar and choose Open in Terminal. This opens a PowerShell-type terminal in the current folder.

    On Linux (via Bash):

    • Right-click on the folder background and select Open in Terminal or navigate to the project root folder using the cd command.
  3. Next, clone this repository into the folder you chose. To do this, copy and paste the command below into your terminal and press enter:

git clone https://github.com/GustavoRosas-Dev/GUI_PreSec.git

Then, navigate into the project folder. To do this, copy and paste the command below into your terminal and press enter:

cd GUI_PreSec

[!NOTE] The above command will use the git clone module to create an exact copy of this repository in your folder (local repository).

2️⃣ Create virtual environment

With the Terminal still open, copy and paste the command below and press enter:

On Windows:

python -m venv venv

On Linux:

Begin by installing the package below, which provides support for virtual environments (venv), in Python 3.11.

sudo apt install python3.11-venv

The execution of the above command requires elevated administrative privileges (indicated by the use of sudo). Therefore, you will be prompted for the superuser (root) password to ensure security and authorize the package installation in Python 3.11.

Next, create your virtual environment by copying and pasting the code below into your Terminal:

python3.11 -m venv venv

[!NOTE] The above command utilizes the python interpreter (via environment variables) with the -m (module) parameter to create a virtual environment (venv) named the same as venv. You could name it whatever you like; however, it is a universal convention (adopted by the Python community) to name it this way.

3️⃣ Activate virtual environment

The next step is to activate the virtual environment. See how simple it is:

On Windows:

  1. Navigate to the Scripts folder:

    cd venv\Scripts
  2. Then, activate the virtual environment:

    activate
  3. And finally, return to the root folder. To do this, type the command below and press enter. Repeat this twice:

    cd ..

[!NOTE] The cd (change directory) command, when used with .., allows you to navigate up one level in the directory structure. Executing this combination twice will bring you back to the main project folder, specifically the GUI_PreSec/ directory.

On Linux:

source venv/bin/activate

βœ… To confirm that the virtual environment has been activated correctly , simply look at your Terminal and check if (venv) appears on the same line where you would type your next command.

See an example in the image below:
Activating Virtual Environment

(Bonus) If you are a newbie in development (like me 😏), click here.

Now, you might be wondering, 'Why should I create and activate a virtual environment, I'm right?'

Activating Virtual Environment

If you're wondering why you should create and activate a virtual environment, it's essential to understand that a virtual environment provides a dedicated space for installing dependencies (libraries) isolated from the rest of your machine. Each project can have its own virtual environment, ensuring that the dependencies required for that specific project are maintained separately.

This practice is crucial for a few reasons:

[!TIP] Consistency: It guarantees a consistent environment for your project, preventing conflicts between different projects that may require different versions of the same library.

[!TIP] Isolation: Dependencies are confined to the virtual environment, avoiding interference with other projects or system-level packages.

[!TIP] Collaboration: When collaborating on projects, sharing the project's virtual environment specifications (usually stored in a requirements.txt file) enables others to recreate the exact environment, ensuring a smooth collaboration experience across different machines.

4️⃣ Install requirements

With the virtual environment active, simply install the dependencies (libraries) that the project needs to function. To do this, copy and paste the command below into the Terminal and press enter:

On Windows:

pip install -r requirements.txt

On Linux:

pip3.11 install -r requirements.txt

[!NOTE] The above command uses pip (Package Installer for Python) to install dependencies specified in the requirements file. The install command is a fundamental part of pip, followed by the -r (read) parameter, indicating that it should read and install the requirements. The requirements.txt file, located in the root folder of this project, contains a list of necessary libraries for the project to function.

How to Run PreSec

Make sure you are in the project's root folder (GUI_PreSec/). Then, copy and paste the command below into the Terminal, and press enter:

Using CMD or PowerShell

python main.py

Using Bash

python3.11 main.py

Contribution and Licensing

Contribute

See CONTRIBUTING

Third-Party Software

See ThirdPartyNotices

License

See LICENSE

Special Thanks πŸ₯°

Hackers Do Bem (1st BR class).



Typing SVG