diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 628cda8..30a7deb 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -22,7 +22,8 @@ jobs: - run: | pip install mkdocs-material pip install mike + pip install mkdocs-glightbox git config --global user.email "action@github.com" git config --global user.name 'Actions' - - run: mike deploy --push --update-aliases 0.1 latest \ No newline at end of file + - run: mike deploy --push --update-aliases 1.0 latest \ No newline at end of file diff --git a/docs/API.md b/docs/API.md new file mode 100644 index 0000000..28090cb --- /dev/null +++ b/docs/API.md @@ -0,0 +1,4 @@ +- [Postman APIs](https://www.postman.com/aptrs-api/aptrs-workspace/api/7714b268-664f-4300-b389-f6ec34829350/definition/b12bbcd0-6a19-4b80-bc1e-0315d2730c80?version=62baf360-29f0-466f-9579-ffdae037a890&view=documentation) +- [Postman API Collection](https://www.postman.com/aptrs-api/aptrs-workspace/collection/gly1r21/aptrs) +- [Swagger](https://api.aptrs.com) + \ No newline at end of file diff --git a/docs/Company.md b/docs/Company.md deleted file mode 100644 index cb335f0..0000000 --- a/docs/Company.md +++ /dev/null @@ -1,15 +0,0 @@ -# Company - -The company option allows you to create a new customer company for which you are doing penetration testing. The company will be required while create a project. Once you install the APTRS you can see a demo company created to get an idea of how it works. - -## Company List - -If you acess the `http://127.0.0.1:8000/company/` you are see all the companines create in the table. You can either delete, edit or add new company from the same page. - -![ViewCompany](image/ViewCompany.png) - -## Edit/Add Company - -Once you click on the edit/add button in the above table. You can edit/add the company details like Logo, Name and address. The logo will be used on the cove page of the report. As of now the address will not be displayed in the report will be fixed in the later version. - -![EditCompany](image/Edit-Company.png) \ No newline at end of file diff --git a/docs/Customer.md b/docs/Customer.md deleted file mode 100644 index a6d7627..0000000 --- a/docs/Customer.md +++ /dev/null @@ -1,15 +0,0 @@ -# Customer - -The Customer option allows you to create a new customer for the company. For each project and company, there will be a team involved from the penetration tester and Customer company. You can create a customer for the company. The details will be used while creating the report for the project. - -## Customer List - -If you acess the `http://127.0.0.1:8000/company/customer/` you are see all the customer and company for the customer in the table. You can either delete, edit or add new new from the same page. - -![ViewCustomer](image/ViewCustomer.png) - -## Edit/Add Customer - -Once you click on the edit/add button in the above table. You can edit/add the customer details like Company Name, Customer Name, Customer Emaill and Customer Mobile Number. - -![EditCustomer](image/Edit-Customer.png) \ No newline at end of file diff --git a/docs/Features/Users/users.md b/docs/Features/Users/users.md new file mode 100644 index 0000000..3515bfe --- /dev/null +++ b/docs/Features/Users/users.md @@ -0,0 +1,33 @@ +# User Management in APTRS + +APTRS provides robust user management capabilities, allowing you to add, edit, and delete users. Each user can log in to the APTRS platform using their credentials, and they have the option to set a profile photo through the Edit Profile feature. In version 1.0, users are also able to change their passwords. + + +![User Page](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/user.png) + +### User Types +There are two types of users in APTRS: + +1. Admin Users: Admin users have elevated permissions and can perform administrative tasks, including managing user accounts and configurations. +2. Non-Admin Users: Non-admin users have restricted access and can perform tasks based on the permissions and groups assigned to them. + + +All users can log in and perform tasks according to their assigned permissions and groups. + + +!!! info + + For detailed information on permissions and groups, please refer to the Permissions and Groups section. + + +### User Classification +Users are classified into two categories: + +1. Internal Users (Staff Users): By default, all users added to the system are marked as staff users, indicating they are internal users of the APTRS. +2. External Users (Non-Staff Users): External users are designated as non-staff users. For details on managing non-staff users, please refer to the Customer section. + +This structured approach to user management ensures that you can effectively manage access levels and user capabilities within the APTRS platform. + + +### Important Note on Deleting Users +All projects in APTRS must have an owner. Deleting a user will cause errors, as projects assigned to that user will no longer have an owner. If you need to disable a user’s account, it is recommended to set the account to "inactive" rather than deleting it. If you choose to delete the user, be aware that you will need to manually reassign ownership of all the projects associated with that user to avoid issues. \ No newline at end of file diff --git a/docs/Features/company/company.md b/docs/Features/company/company.md new file mode 100644 index 0000000..0470522 --- /dev/null +++ b/docs/Features/company/company.md @@ -0,0 +1,33 @@ +# Company Management in APTRS + +APTRS allows you to add and manage companies, with two types of companies supported: Internal Companies and External (Non-Internal) Companies. + +![Comapany Page](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/company.png) + + +## Internal Companies +APTRS assumes that your company, the one deploying and using APTRS, is the internal company. When you deploy APTRS for the first time, an internal company is automatically created. This company is assigned to you and cannot be deleted or replaced. However, you can rename it to reflect your actual company name. + +Key details about internal companies: + +- **Internal Company Setup**: The internal company is auto-created during the initial setup, and no additional internal companies can be added afterward. +- **User Assignment**: All users added through the User Management page will automatically be part of the internal company. +- **Reports**: Users and data from the internal company will be reflected in your reports as staff or internal users. + + +## External (Non-Internal) Companies +All companies manually added after the initial setup are classified as External Companies. These are typically client companies or third-party organizations. + +Key details about external companies: + +- **User Management**: You cannot add users to external companies through the User Management page. Any user added through this page will be assigned as a staff member of the internal company. +- **Assigning Users to External Companies**: To assign users to external companies, you need to go through the Customer section, which manages external users. +- **Projects**: You can create projects for both internal and external companies, allowing you to track and manage work for client companies separately from your own. + +This setup ensures a clear distinction between your internal users and external client companies, making it easier to manage access, projects, and reports within APTRS. + + +!!! warning + + Deleting a company will also delete all associated users. Make sure to reassign or handle any users before deleting a company. + diff --git a/docs/Features/company/customer.md b/docs/Features/company/customer.md new file mode 100644 index 0000000..a08b602 --- /dev/null +++ b/docs/Features/company/customer.md @@ -0,0 +1,20 @@ +# Customer Management in APTRS + + +Customers in APTRS are external users who belong to external (non-internal) companies. You can manage these users from the Customer page, where external users are added and tracked, and they are included in reports as customer users. + + +![Comapany Page](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/customer.png) + + +### Adding Customers +When adding a customer, you will need to provide the following information: + +- Email: The customer's email address. +- Company: The external company they belong to. +- Password: A password is required as part of the future functionality. + + +Though passwords are required during customer creation, as of version 1.0, external users do not yet have access to login, API, or dashboard features. These features are planned for future releases, where customers will be able to log into the APTRS dashboard, view ongoing and past projects, download reports, and more. + +This allows APTRS to lay the groundwork for future functionality while managing customer data and ensuring they are accurately represented in reports. \ No newline at end of file diff --git a/docs/Features/configuration/configuration.md b/docs/Features/configuration/configuration.md new file mode 100644 index 0000000..da0b53a --- /dev/null +++ b/docs/Features/configuration/configuration.md @@ -0,0 +1,7 @@ +# Configuration + +The Configuration section allows admin users or users with the Manage Configurations permission to add and manage various settings. In APTRS, users can define Project Types, such as "Mobile Application Testing," which are used when creating projects and are also referenced in PDF and DOCX reports. Multiple project types can be added to suit different testing needs. + +In addition to project types, users can also create Report Standards. When generating a report, users are required to select the applicable testing standard, such as OWASP for web application testing. Users can add additional standards here, which can then be used in the generated reports. + +![Configuration Page](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/config.png) \ No newline at end of file diff --git a/docs/Features/dashboard/dashboard.md b/docs/Features/dashboard/dashboard.md new file mode 100644 index 0000000..34dde88 --- /dev/null +++ b/docs/Features/dashboard/dashboard.md @@ -0,0 +1,10 @@ +# Dashboard + + +The Dashboard provides a personalized view of projects based on the logged-in user’s ownership and project status. Unlike the Projects View Page, which lists all projects within APTRS, the Dashboard only displays projects where the logged-in user is the owner and the project is not marked as completed. The Dashboard shows projects with the following statuses: Delay, In Progress, or Upcoming, as long as the user is the owner of those projects. + +In addition to active or upcoming projects, the Dashboard also displays completed projects if the project has an active retest. Even if a project is marked as completed, it will be shown in the Dashboard if it has any upcoming, in-progress, or delayed retests where the logged-in user is the owner of the retest task. + +This also applies in cases where the user is the owner of the retest task for a completed project, even if the user is not the owner of the original project. In such cases, the project will still appear on the Dashboard, allowing the user to view and manage their active retest tasks. + +![Dashboard Page](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/dashboard.png) \ No newline at end of file diff --git a/docs/Features/index.md b/docs/Features/index.md new file mode 100644 index 0000000..29cf72d --- /dev/null +++ b/docs/Features/index.md @@ -0,0 +1,2 @@ +APTRS offers various features and configurations, including the management of companies, customers, projects, retests, different types of reports, configurations, templates, and more. The Features Documentation provides detailed information on the different setups, features, and use cases. + diff --git a/docs/Features/permission/permission.md b/docs/Features/permission/permission.md new file mode 100644 index 0000000..d78884d --- /dev/null +++ b/docs/Features/permission/permission.md @@ -0,0 +1,42 @@ + +# Groups and Permissions in APTRS + +APTRS uses permissions to control access to certain APIs and restrict features to specific users. To streamline this process, APTRS allows you to create groups and assign permissions to those groups. Once a group is created, you can assign users to one or more groups. A user assigned to multiple groups will inherit all the permissions from those groups. + +![Group Page](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/group.png) + + + +### How Permissions Work +Permissions are pre-defined within APTRS to regulate access to various functionalities. These permissions cannot be modified or created from the user interface, as they are hard-coded in the backend. However, you can create custom groups and assign these predefined permissions to the groups. When users are assigned to a group, they will automatically gain all the permissions associated with that group. + +### Admin Users and Permissions +Admin users in APTRS are not restricted by permissions or group assignments. This means that even if an admin user has no group assigned or is assigned to a group with limited permissions, they will still have full access to all features and APIs in the system. Admin users are always granted full control, regardless of group membership or assigned permissions. + +### Default Groups +When you first deploy APTRS, several default groups are created with specific permissions. The most important groups are Project Manager and Manager. These groups are crucial for report generation, as they are used to add project manager and manager details to reports. + +While you can edit the permissions assigned to these groups, it is important to retain the group names ("Project Manager" and "Manager") if you want APTRS to correctly include project manager and manager details in the reports. Removing or renaming these groups may cause issues with report generation and prevent the correct user details from being added to reports. + +### List of Permissions (as of version 1.0) + +- Manage Users: +Users with this permission can add, edit, and delete users, manage groups, and assign permissions to groups. They can also create and delete groups. + +- Manage Projects: +Users with this permission can create, edit, and delete projects. They can add vulnerabilities or retests within a project, generate reports, and add scope to projects. By default, users cannot select project or retest owners; projects and retests created by users with this permission will automatically mark the creator as the owner. + +- Assign Projects: +This permission allows users to select and assign project or retest owners. Users with this permission can assign any user as the owner of a project or retest. + +- Manage Vulnerability Data: +Users with this permission can add, edit, and delete entries in the vulnerability database or templates. + +- Manage Customers: +Users with this permission can add, edit, and delete customers. + +- Manage Companies: +Users with this permission can add, edit, and delete companies. + +- Manage Configurations: +Users with this permission can manage various application configurations. \ No newline at end of file diff --git a/docs/Features/project/Vulnerability.md b/docs/Features/project/Vulnerability.md new file mode 100644 index 0000000..06beafd --- /dev/null +++ b/docs/Features/project/Vulnerability.md @@ -0,0 +1,89 @@ +Each project can have associated vulnerabilities. You can navigate to the Vulnerability tab within a project to manage its vulnerabilities. This tab allows you to add, edit, or remove vulnerabilities specific to that project, providing a dedicated space to document identified security issues, their descriptions, solutions, CVSS scores, and other relevant details. + +Using the Vulnerability Database, you can quickly import common vulnerabilities with pre-filled information, saving time when adding recurring or well-documented issues across multiple projects. + + +![Project Vulnerability](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/project-vulnerability.png) + + +### Adding Vulnerabilities + +APTRS provides multiple ways to add vulnerabilities to a project, offering flexibility in how you manage and document security issues. + + +- **Search and Add**: This feature allows you to search for vulnerabilities by title or name from the Vulnerability DB or Template. Once you select a vulnerability from the search results, a new entry is created within the project, automatically populated with the title, description, solution, reference link, and CVSS score from the Vulnerability DB. This approach allows for efficient reuse of information with pre-filled details, saving time on repetitive entries. + +- **Add New**: Selecting "Add New" will create a blank vulnerability entry within the project. All fields are initially empty except for the title, which is set to "New Vulnerability." This option is ideal if you need to manually document unique vulnerabilities not in the database. You can fill in all required details such as description, solution, and severity. + +- **Upload CSV**: This option is designed specifically for importing vulnerabilities from Nessus scan outputs. You can upload a Nessus vulnerability scan CSV report, which APTRS will parse to extract details such as URL or IP, port, title, description, and more. Parsed vulnerabilities are then added directly to the project, saving time on data entry for larger assessments. + +### Nessus CSV + +This feature can also be used for other, non-Nessus scan reports. As long as the CSV file contains the required columns with matching names, APTRS will process it just like a Nessus report, making it a versatile option for importing vulnerabilities from various sources. + + +#### Required CSV Columns +To ensure that vulnerabilities are parsed correctly, your CSV file should include the following columns: + +- Host: The IP address or URL of the affected system. +- Port: The network port where the vulnerability was found. +- Name: The title of the vulnerability, providing a brief identifier. +- Description: A detailed explanation of the vulnerability, including its nature and potential impact. +- Solution: Recommended actions or patches to mitigate or resolve the vulnerability. +- Risk: The severity level of the vulnerability (e.g., Info, Low, Medium, High, Critical). APTRS uses this to assign a default CVSS score and vector. + + +#### CVSS Score and Vector + + +As of version 1.0, APTRS does not accept CVSS scores and vectors from CSV imports because default Nessus reports do not include them. Instead, APTRS assigns a default CVSS score and vector based on the **Risk** level provided in the CSV file. + +#### Default CVSS Scores and Vectors (CVSS 3.1) + +These default values are automatically assigned based on the risk level when the CSV is parsed: + + + +| Severity | Base Score | Vector | +| ----------- | ------------------------------------ |---------------------- | +| `Critical` | 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | +| `High` | 7.6 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:L | +| `Medium` | 5.5 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:L | +| `Low` | 3.5 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:N/A:N | +| `Informational` | 0.0 | CVSS:3.1/AV:A/AC:H/PR:L/UI:R/S:U/C:N/I:N/A:N | + + +These defaults ensure consistency in reporting for imported vulnerabilities, even if specific CVSS details aren’t included in the CSV file. + + +### Vulnerability Instances + +Each vulnerability in a project is required to have an **instance**. An instance represents the specific URL, parameter, IP address, and port number of the affected vulnerability. Each instance within a vulnerability can have its own status, allowing for more granular tracking and resolution. + + + + +![Vulnerability](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/vulnerability-instance.png) + + +### Vulnerability and Instance Status + +The status of each vulnerability and its instances is tracked individually to provide clear insights into the resolution progress. Below are the details on how the status is managed and calculated for both vulnerabilities and their instances. + +The status of a vulnerability and its instances are interconnected. There are three possible statuses for both vulnerabilities and instances: + +- **Vulnerable**: The vulnerability or instance has unresolved security issues. +- **Confirmed Fix**: The vulnerability or instance has been resolved and no longer has security issues. +- **Accepted Risk**: The vulnerability or instance remains unresolved, but the customer or client has accepted the associated risk. + +These statuses function as follows: + +1. **Changing Vulnerability Status**: If you change the status of a vulnerability, all instances associated with that vulnerability will automatically be set to the same status. For example, setting a vulnerability to **Accepted Risk** will update all instances within that vulnerability to **Accepted Risk** as well. + +2. **Changing Instance Status**: When modifying the status of individual instances within a vulnerability, the overall vulnerability status is recalculated based on its instances' statuses. The rules are as follows: + + - **Confirmed Fix**: For a vulnerability to be marked as Confirmed Fix, all instances must be set to Confirmed Fix. Even a single instance with a different status prevents the vulnerability from being marked as Confirmed Fix. + - **Vulnerable**: If any instance is marked as Vulnerable, the entire vulnerability is marked as Vulnerable, regardless of other instances’ statuses. + - **Accepted Risk**: If all instances are marked as Accepted Risk, the vulnerability status will also be set to Accepted Risk. + + In short, for a vulnerability to be considered Confirmed Fix, all instances must be Confirmed Fix. To be marked as Accepted Risk, all instances must have that status. Any instance marked as Vulnerable will cause the vulnerability itself to be marked as Vulnerable. diff --git a/docs/Features/project/project-view.md b/docs/Features/project/project-view.md new file mode 100644 index 0000000..332779f --- /dev/null +++ b/docs/Features/project/project-view.md @@ -0,0 +1,27 @@ + + +APTRS allows users to create and manage projects, which are typically created when conducting a pentest for a company. When setting up a project, you can associate it with a specific company, select multiple internal users as project owners, and define key details such as project type, start and end dates, and a brief description. + +Once the project is created, you can later add vulnerabilities, generate reports, and track progress within the project. This feature helps organize pentesting efforts efficiently, ensuring clear project ownership and structure. + +![project Page](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/project.png) + +### Project Status +The project status is automatically calculated based on the project’s start and end dates: + +- **Upcoming**: If the start date is in the future. +- **In Progress**: If the start date has passed or is today, but the end date is still in the future. +- **Delayed**: If the end date has passed. +- **Completed**: If the projct is marked as completed. + +If your project is completed, you can manually mark it as **Completed** from the project summary. To do this, navigate to the project from the project table or dashboard, and you’ll find an option to mark it as completed on the project summary page. + + +### Project Details +Once a project is created, it is not possible to change the associated company. However, you can still edit other details, such as project type, dates, description, and owners. + + + +### Project Owners +In Version 1.0, APTRS supports assigning multiple project owners, allowing you to add as many project owners as needed. Assigning or selecting a project owner requires admin privileges or the Assign Projects permission. Otherwise, the user creating the project is automatically added as the project owner. + diff --git a/docs/Features/project/report.md b/docs/Features/project/report.md new file mode 100644 index 0000000..a7ce067 --- /dev/null +++ b/docs/Features/project/report.md @@ -0,0 +1,30 @@ +Once your project is ready, you can generate a report for the identified vulnerabilities. APTRS version 1.0 provides options to generate reports in PDF, Excel, and DOCX formats. Navigate to the report section within the project, select the desired report type and standard, and download the report directly. + + +![Report](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/report.png) + +As of version 1.0, the DOCX report generation feature is experimental. It may be removed or enhanced with more customization options in future versions. Once validated for full customization and consistent presentation, this feature will become permanent. + +### Report Customization + +You can customize both the PDF and DOCX reports: + +- **PDF Reports:** APTRS uses the WeasyPrint Python library to convert HTML into PDF. You can modify the HTML and CSS files used in report generation to match your requirements. +- **DOCX Reports:** APTRS leverages the `python-docxtpl` library to create DOCX files. The CKEditor WYSIWYG editor is used for entering vulnerability and project details. CKEditor’s HTML output is then converted into DOCX format using the `html2docx` library, and integrated with `docxtpl` to generate the final report. + +The HTML and DOCX report templates are available here: +- [HTML and DOCX Report Templates](https://github.com/APTRS/APTRS/tree/main/APTRS/templates) + +CSS files for HTML-to-PDF reports can be customized here: +- [CSS for PDF Reports](https://github.com/APTRS/APTRS/tree/main/APTRS/static/css) + + +#### Report Limitations +- **PDF Reports:** APTRS uses the ``WeasyPrint`` Python library to generate PDF reports. However, ``WeasyPrint`` does not support JavaScript execution, which limits the ability to include custom, interactive charts directly within the PDF. Instead, APTRS generates charts using a Python library and embeds them as static images in the PDF. This approach restricts customization of charts via HTML and CSS. +- **DOCX Reports:** APTRS generates DOCX reports using a combination of ``python-docx``, ``python-docxtpl``, and ``html2docx``. While ``python-docxtpl`` enables dynamic content insertion into documents, it does not support updating or dynamically modifying charts. As a result, charts included in DOCX reports cannot be automatically updated with dynamic values by APTRS. + + + + + + diff --git a/docs/Features/project/retest.md b/docs/Features/project/retest.md new file mode 100644 index 0000000..d91dc59 --- /dev/null +++ b/docs/Features/project/retest.md @@ -0,0 +1,12 @@ +Each project can have a retest task created and assigned to a user. Similar to a project, each retest includes a start and end date and has a designated retest owner. Retests allow you to specify the revalidation of the project’s vulnerabilities, ensuring that fixes have been applied as expected. Within a project, users can initiate a retest to start this process. + +![Retest](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/retest.png) + +Similar to project ownership, the retest owner is automatically set to the user creating the retest if they do not have admin privileges or the Assign Projects permission. Users with admin access or Assign Projects permission can select the retest owner. Once a retest task is created, it cannot be edited, though you can still delete the retest task if needed. + +### Validation + +- **Project Completion Requirement:** A retest task cannot be created if the project is not marked as completed. Retests are only applicable to projects that have been fully executed, as retests aim to validate resolved vulnerabilities. Therefore, a project must be completed before any retest can be initiated. +- **Single Active Retest Restriction:** Even if the project is completed, you cannot create a new retest task if there is an existing retest task that is not marked as completed. Only one active retest can be associated with a project at a time. + + diff --git a/docs/Features/project/scope.md b/docs/Features/project/scope.md new file mode 100644 index 0000000..e989bb5 --- /dev/null +++ b/docs/Features/project/scope.md @@ -0,0 +1,4 @@ +Each project includes scopes, allowing you to define the list of IPs, URLs, or application names that are part of the engagement. Starting from version 1.0, each project can have multiple scopes. Within the project page, you can navigate to the Scope section to manage the specific scope of the project. + + +![Scope](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/scope.png) \ No newline at end of file diff --git a/docs/Features/vulnerabilityDB/vulnerability.md b/docs/Features/vulnerabilityDB/vulnerability.md new file mode 100644 index 0000000..7010793 --- /dev/null +++ b/docs/Features/vulnerabilityDB/vulnerability.md @@ -0,0 +1,11 @@ +# Vulnerability DB (or Template) + + +The Vulnerability DB or Template feature in APTRS allows you to add and manage a database of vulnerabilities that can be reused across different projects. When adding a vulnerability to a project, you can specify all necessary details such as the title, description, solution, CVSS score, and more. + +If you encounter the same vulnerability in multiple projects, such as IDOR or SQL Injection, the Vulnerability DB allows you to save time by reusing the same information without needing to write it again for each project. This helps streamline reporting and ensures consistency across projects. + +By creating templates for common vulnerabilities, you can easily import them when adding vulnerabilities to new projects, reducing redundant work and improving efficiency. + + +![Vulnerability DB Page](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/vulnerabilityDB.png) \ No newline at end of file diff --git a/docs/Prerequisites.md b/docs/Prerequisites.md deleted file mode 100644 index d646ce2..0000000 --- a/docs/Prerequisites.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Prerequisites - -**Linux** - -* Install Git `sudo apt-get install git` -* Install Python 3.8+ `sudo apt-get install python3.8` -* Install the following dependencies - ```bash - sudo apt install python3-dev python3-venv python3-pip build-essential wkhtmltopdf - ``` -* If you get error while genetrating PDF report uninstall the `wkhtmltopdf` with `sudo apt remove -y wkhtmltopdf` and install it again manually using debian file or according to your system [Dowload for here](https://wkhtmltopdf.org/downloads.html). -* If you are using kali linux 64 bit install this `wkhtmltopdf` https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.bullseye_amd64.deb -* APTRS requires `wkhtmltopdf` version 0.12.6 - -**Windows** - -* Install [Git](https://git-scm.com/download/win) -* Install [Python **3.8+**](https://www.python.org/) -* Download & Install [wkhtmltopdf](https://wkhtmltopdf.org/downloads.html) as per the [wiki instructions](https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf) -* Add the folder that contains `wkhtmltopdf` binary to environment variable PATH. - - -!!! info "Note" - Set `wkhtmltopdf` environment variable. APTRS requires `wkhtmltopdf 0.12.6` and above. - -*** \ No newline at end of file diff --git a/docs/Project.md b/docs/Project.md deleted file mode 100644 index 85860a2..0000000 --- a/docs/Project.md +++ /dev/null @@ -1,55 +0,0 @@ -# Project - -The Project is one of the main functions of the tool. It is where you will create a project for any Company/Customer. Each project will be connected with a customer company and each project will contain its vulnerability and reports. - - -## Project List - -If you acess the `http://127.0.0.1:8000/` you are see all the Project in the table. YOu can view all the details for that project like, company name, Scope URL, Project start and end date etc. You can either delete, edit or add new new from the same page. - -!!! info "Note" - Once you delete any project all the vulnerabilites/reports for that project will be deleted. - -![Project List](image/Project.png) - -## Add Project - -Once you click on the add button in the above table. You can add details like company, scope url, project name, project start date end date etc. - -!!! info "Note" - Once you create a project you will not able to edit the company for the project. - -![Add Project](image/Add%20Project.png) - -## View Project - -Once you click on view project in the table. You can edit the project, view/edit/add vulnerabilities for the project and also you can generate the report - -### Edit Project - -You can click on project tab and can edit the project details. - -![Edit Project](image/View%20Project.png) - -### Vulnerability - -Once you click on the vulnerability tab, you can see all the vulnerabilities for the project. You can either delete/edit or add new vulnerabilities from here. - -![View Vulnerabilities](image/Project%20Vulnerability.png) - -### Edit/Add Vulnerability - -When you click on the edit/add button you will be able to add details like `vulnerability title, POC, description, Recommendation, Refference link, Instances, CVSS Score` etc. - -!!! info "Note" - The vulnerability title field is an input box with drop down and search. It will list the vulnerabilities from the vulnerability database. Once you select any it will automatically replace the data like Title, description, Recommendation, Refference link etc. - -!!! info "Note" - If you want to add a totally new vulnerability and its not showing in drop down menu. You can still enter any title and it will be accepted by the app. - -![New Vulnerabilities](image/Project%20New%20Vulnerability.png) -![New Vulnerabilities](image/addnewvulnerability.png) - -### Report - -Last you have option to download the PDF report. You can view the demo report from [here](https://github.com/Anof-cyber/APTRS/blob/main/Doc/Report/Web%20Application%20Penetration%20Testing%20Report%20of%20Juice%20Shop.pdf) \ No newline at end of file diff --git a/docs/Report-Template.md b/docs/Report-Template.md deleted file mode 100644 index b5cbc3e..0000000 --- a/docs/Report-Template.md +++ /dev/null @@ -1,12 +0,0 @@ -# Report Template - -The report is created using HTML to PDF method. In you want to modify the Report template you need to edit the HTML files. Yuo can see all the HTML files related to Report from [here](https://github.com/Anof-cyber/APTRS/tree/main/templates/Report). - -The application create Cover page separately and use `cove.html` for the same. You can edit it hover you want. - -Next we have `toc.xml` that is used for table of content. You can edit the same if you want. - -!!! info "Note" - The tool will use all H1 tags in the `Report.html` page to show them in Table of content. - -The `Report.html` is where all the HTML code is save to generate the report. You can have a look at it and edit accordingly. \ No newline at end of file diff --git a/docs/Running.md b/docs/Running.md deleted file mode 100644 index 7bf9bb4..0000000 --- a/docs/Running.md +++ /dev/null @@ -1,23 +0,0 @@ -# Running APTRS - -## Linux -```bash -./run.sh 127.0.0.1:8000 -``` - -*** - -## Windows - -```batch -run.bat 127.0.0.1:8000 -``` - -!!! info "Note" - The default Username and password is `admin`. - - -!!! info "Note" - APTRS will listen to `0.0.0.0:8000` if you use the run script without arguments. - -In your web browser, navigate to `http://127.0.0.1:8000/` to access APTRS. \ No newline at end of file diff --git a/docs/Setting.md b/docs/Setting.md deleted file mode 100644 index 3846070..0000000 --- a/docs/Setting.md +++ /dev/null @@ -1,22 +0,0 @@ -# Settings - -The setting option allow you are create a new user. The option allows you to create a user and will be parart of the penetration testing process. By default all the user user added will be considerd as part of the project and will be shown in the report. - -The same implice on the customer as well. All the customer add for any company will be considered as part of the project for that customer. - - -## User List - -If you acess the `http://127.0.0.1:8000/accounts/setting` you are see all the users in the table. You can either delete, edit or add new new from the same page. - -![View User](image/View%20User.png) - -## Edit/Add User - -Once you click on the edit/add button in the above table. You can edit/add the User profile image, First Name, Password, Username, Company Name, Email, Number etc. - -![Edit User](image/Edit%20User.png) - -![Add User](image/Add%20User.png) - -!> As of now You cannot change the password after creating user. The users will be considered as internal user with login access it should have same company name. \ No newline at end of file diff --git a/docs/Vulnerability-Database.md b/docs/Vulnerability-Database.md deleted file mode 100644 index a9f1758..0000000 --- a/docs/Vulnerability-Database.md +++ /dev/null @@ -1,20 +0,0 @@ -# Vulnerability Database - -The vulnerability database allows you to save time while creating a report for a project. If you find some vulnerabilities again and again in different projects while creating reports you don't want to type the same description, or recommendation again and again. In that scenario, you can maintain a vulnerability database where you can add the vulnerability title, description, recommendation, reference link and CVSS Score. - -Once you create a new vulnerability for any project you can select the vulnerability from the vulnerability data and it will atomically add the description, recommendation etc for you. - - -## Vulnerability Database List - -If you acess the `http://127.0.0.1:8000/vulnerability/` you are see all the vulnerabilitiesr saved as database collection in the table. You can either delete, edit or add new new from the same page. - -![View Vulnerability Database](image/view%20Vulnerability%20Database.png) - -## Edit/Add Vulnerability Database - -Once you click on the edit/add button in the above table. You can edit/add the Vulnerability Database details like Vulnerability Title, CVSS Score, Description, Recommendation and Reference Link. - -![Edit Vulnerability Database](image/vulnerabiliydbedit1.png) - -![Edit Vulnerability Database](image/vulnerabiliydbedit2.png) \ No newline at end of file diff --git a/docs/custom-report/docx/company-user.md b/docs/custom-report/docx/company-user.md new file mode 100644 index 0000000..f48d4ef --- /dev/null +++ b/docs/custom-report/docx/company-user.md @@ -0,0 +1,47 @@ +# Context Variables for Company and Users + +## 1. Internal Company Name +- **Description:** + + This variable will provide the name of the internal company (your own company) that is linked to the APTRS. It fetches the company name from the `Company` model where the `internal` field is set to `True`. + +- **Usage Example:** + + ```python + Company Who DID the Pentest: {{ mycompany }} + + ``` + + +## 2. Project Manager Users +- **Description:** + + This variable gives access to all the internal users who are part of the "Project Manager" group. You can loop through this list to display details like the name of the project managers working on the project. + +- **Usage Example:** + + ```python + Project Managers: + + {% for user in projectmanagers %} + {{ user.full_name }} {{ user.position }} {{ user.email }} + {% endfor %} + + ``` + +## 3. Customer Company Users +- **Description:** + + This variable provides access to the users who belong to the customer’s company for the project. It retrieves the list of active users associated with the project’s customer company. + +- **Usage Example:** + + ```pthon + Customer Users: + + {% for user in customeruser %} + {{ user.full_name }} {{ user.position }} {{ user.email }} + {% endfor %} + + + ``` \ No newline at end of file diff --git a/docs/custom-report/docx/docx.md b/docs/custom-report/docx/docx.md new file mode 100644 index 0000000..94349ba --- /dev/null +++ b/docs/custom-report/docx/docx.md @@ -0,0 +1,142 @@ +APTRS provides the ability to generate detailed DOCX reports using customizable templates. You can use Jinja2 template tags within your `.docx` templates to dynamically populate project and vulnerability data. This guide explains how to customize your template and use available context variables. + +--- + +## **Template Location** +The default template is located at: ``/APTRS/templates/report.docx`` + + + +You can replace this file with your custom `.docx` template while keeping the required placeholders intact. + +--- + +## **Using Template Tags** +The `.docx` template uses Jinja2 syntax for placeholders and loops. Below are some examples: + +### **Placeholders** +- **Syntax:** `{{ variable_name }}` +- **Example:** To display the project name, use: `{{ project.name }}` + + +### **Loops** +- **Syntax:** `{% for item in items %}...{% endfor %}` +- **Example:** To list all vulnerabilities: + +```python +{% for vulnerability in vulnerabilities %} + +{{ vulnerability.vulnerabilityname }} (CVSS: {{ vulnerability.cvssscore }}) {% endfor %} +``` + + +### **Conditional Statements** +- **Syntax:** `{% if condition %}...{% else %}...{% endif %}` +- **Example:** To check if a project has vulnerabilities: + +```python +{% if vulnerabilities %} +Vulnerabilities are present. +{% else %} +No vulnerabilities found. +{% endif %} +``` + + +--- + +## **Available Context Variables** + + +| Variable | Description | +|--------------------------|--------------------------------------| +| `project` | The project object for which the report is being generated. Contains all project details. | +| `owners` | User details of All Project Owners | +| `project_exception` | Project Exceptions | +| `project_description` | Project Description | +| `vulnerabilities` | Queryset of vulnerabilities for the project, ordered by CVSS score (higher to lower). | +| `mycomany` | The name of the internal (your company) company. | +| `projectmanagers` | Queryset of users in the "Project Manager" group. | +| `customeruser` | Queryset of customer users associated with the project's customer company. | +| `projectscope` | Queryset of all project scopes for the project. | +| `totalretest` | List of retest schedules and owners. | +| `totalvulnerability` | Total count of vulnerabilities for the project. | +| `Report_type` | The type of report being generated (e.g., Audit, Re-Audit). | +| `standard` | The standard or methodology being used for the report. | +| `currentdate` | Get Current Date if needed in the report | +| `page_break` | Allows you to add page break in the docx report such as page break after each vulnerability details | +| `new_line` | Allows you to add a new line if needed | + + + +## **Docx Formatting with Jinja2** + +By default, Jinja2 adds blank lines with conditions or loops, which can be problematic for Docx formatting. Unlike HTML, where empty lines have minimal impact, in Docx, this can lead to extra rows in tables or increased table width. + +APTRS uses the docxtpl library, based on Python-docx and Jinja2, for template-based rendering. To reduce blank lines, you can use Jinja2's whitespace control. + +However, this method doesn't always work flawlessly; it may inadvertently remove important elements like tables along with extra spaces. A simpler solution can involve using a single line of code. + +You can modify the code like this: + +```python + +##Instead of new line for code +{% if vulnerabilities %} +Vulnerabilities are present. +{% else %} +No vulnerabilities found. +{% endif %} + + +## you can change it to like this on a single line + +{% if vulnerabilities %} Vulnerabilities are present. {% else %} No vulnerabilities found. {% endif %} +``` + + + +## **Color and Conditions** + +Each severity level in the report is represented by different colors: low or informational is often green or light blue, while high severity is red. Status can also be color-coded, with fixed vulnerabilities in green and open ones in red or orange. + +In HTML reports, you can add severity values to the tag's class attribute and create CSS to apply the colors. + +For DOCX reports, colors cannot be applied to undefined elements, limiting customization. To assign colors based on severity—like red for critical and orange for high—include them directly in the conditional statements within your DOCX template. + + +```python +{% if severity == 'Critical' %} severity with red color. {% elif severity == 'Low' %} severity with green color. {% endif %} +``` + +![Docx Color](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/docx-color.png) + +!!! info "Note" + + + Adding Jinja2 White Space control to this will remove the color. + +What if instead of just color for the text, we want to add color for the cell in the table like below + + + + + + + + + + + + + + +
NameStatusSeverity
SQL InjectionVulnerableConfirm Fixed
+ +We can do that as well with cellbg in the table, with hex color code like below: + +```python +{% cellbg 'FF491C' if vulnerability.vulnerabilityseverity== 'Critical' else 'F66E09' if vulnerability.vulnerabilityseverity== 'High' else 'FBBC02' if vulnerability.vulnerabilityseverity== 'Medium' else '20B803' if vulnerability.vulnerabilityseverity== 'Low' else '3399FF' %}{{ vulnerability.vulnerabilityseverity}} +``` + +![Docx Color](https://raw.githubusercontent.com/APTRS/APTRS-Changelog/refs/heads/main/images/colorbg.png) \ No newline at end of file diff --git a/docs/custom-report/docx/other.md b/docs/custom-report/docx/other.md new file mode 100644 index 0000000..40f6249 --- /dev/null +++ b/docs/custom-report/docx/other.md @@ -0,0 +1,67 @@ +# Context Variables for Vulnerabilities and Report Data + +## 1. Total Vulnerabilities +- **Description:** + Provides the total count of vulnerabilities associated with a project. +- **Usage Example:** + You can display the total number of vulnerabilities for the project. + + ```python + Total Vulnerabilities: {{ totalvulnerability }} + ``` + +## 2. Report Type +- **Description:** + Specifies the type of report being generated. This can include types like "Audit" or "Re-Audit". +- **Usage Example:** + Show the type of the report (Audit or Re-Audit). + + ```python + Report Type: {{ Report_type }} + ``` + + + +## 3. Report Standard +- **Description:** + The standard or methodology being used for generating the report (e.g., OWASP, NIST). It will be in the list format, you can use below example to get in a text seperated by comma. +- **Usage Example:** + Display the methodology or standard used in the vulnerability report. + + ```python + Report Standard: {{ standard|join(', ') }} + ``` + + +## 4. Current Date +- **Description:** + Get the current date if needed in the report. + +- **Usage Example:** + ```python + Report Generated On: {{ currentdate }} + # OR + {{ currentdate.strftime('%B %d, %Y') }} + ``` + +## 5. Page Break +- **Description:** + Allows you to add a page break in the DOCX report, such as after each vulnerability's details. + +- **Usage Example:** + ```python + {% if vulnerability %} + {{ page_break }} + {% endif %} + ``` + +## 6. New Line +- **Description:** + Allows you to add a new line if needed in the report. + +- **Usage Example:** + ```python + Vulnerability Details: + CVSS Score{{ new_line }} 8.8 + + ``` \ No newline at end of file diff --git a/docs/custom-report/docx/project.md b/docs/custom-report/docx/project.md new file mode 100644 index 0000000..41ab020 --- /dev/null +++ b/docs/custom-report/docx/project.md @@ -0,0 +1,103 @@ + + +## Project Model Variables for Template Customization + +The `Project` model in APTRS contains the following fields that can be used as template variables in your custom report templates. These variables are passed as part of the context to the report Docx, allowing you to display or manipulate project-related data in your custom reports. + +### Available Variables and Their Usage + +1. **`project.name`** + - Represents the name of the project. + - Example usage in HTML: + ```python + Project Name: {{ project.name }} + ``` + +2. **`project.companyname`** + - A foreign key to the `Company` model, representing the company associated (Customer Company) with the project. + - Example usage: + ```python + Company Name: {{ project.companyname.name }} + ``` + +3. **`project_exception`** + - A detailed description of the project. + - Example usage: + ```python + Description: {{p project_exception}} + ``` + - It uses CKeditor HTML data, its converted into the docx format from HTML, hence its required to use **`p`** at the start of the tag. + +4. **`project.projecttype`** + - Specifies the type of project. + - Example usage: + ```python + Project Type: {{ project.projecttype }} + ``` + +5. **`project.startdate`** + - The start date of the project. + - Example usage: + ```python + Start Date: {{ project.startdate }} + ``` + - You can also modify the date format + ```python + Project Start Date: {{ project.startdate.strftime("%d/%m/%Y") }} + ``` + +6. **`project.enddate`** + - The end date of the project. + - Example usage: + ```python + + ``` diff --git a/docs/custom-report/docx/vulnerability.md b/docs/custom-report/docx/vulnerability.md new file mode 100644 index 0000000..e301285 --- /dev/null +++ b/docs/custom-report/docx/vulnerability.md @@ -0,0 +1,263 @@ +### Vulnerability and Instance Model Variables for Template Customization + +In APTRS, the `Vulnerability` and `Vulnerableinstance` models are used to manage and track vulnerabilities and their instances across various projects. APTRS provide `{{vulnerabilities}}` tag with list of all vulnerabilities and its instances. Below is an overview of the variables available for use in templates when working with these models. + +### Available Variables for Vulnerability Model + + +1. **`vulnerability.vulnerabilityname`** + - The name of the vulnerability (e.g., "SQL Injection"). + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Vulnerability Name: {{ vulnerability.vulnerabilityname }} + {% endfor %} + ``` + +2. **`vulnerability.vulnerabilityseverity`** + - The severity of the vulnerability (e.g., "High", "Medium"). + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Severity: {{ vulnerability.vulnerabilityseverity }} + {% endfor %} + ``` + +3. **`vulnerability.cvssscore`** + - The CVSS score associated with the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + CVSS Score: {{ vulnerability.cvssscore }} + {% endfor %} + ``` + +4. **`vulnerability.cvssvector`** + - The CVSS vector associated with the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + CVSS Vector: {{ vulnerability.cvssvector }} + {% endfor %} + ``` + +5. **`vulnerability.status`** + - The status of the vulnerability, based on `STATUS_CHOICES` (e.g., Vulnerable, Confirm Fixed, Accepted Risk). + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Status: {{ vulnerability.status }} + {% endfor %} + ``` + +6. **`vulnerability.vulnerabilitydescription`** + - A description of the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Description: {{p vulnerability.vulnerabilitydescription }} + {% endfor %} + ``` + - It uses CKeditor HTML data, its converted into the docx format from HTML, hence its required to use **`p`** at the start of the tag. + +7. **`vulnerability.POC`** + - The proof of concept (POC) for the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + POC: {{p vulnerability.POC }} + {% endfor %} + ``` + - It uses CKeditor HTML data, its converted into the docx format from HTML, hence its required to use **`p`** at the start of the tag. + +8. **`vulnerability.vulnerabilitysolution`** + - The recommended solution for the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Solution: {{p vulnerability.vulnerabilitysolution }} + {% endfor %} + ``` + - It uses CKeditor HTML data, its converted into the docx format from HTML, hence its required to use **`p`** at the start of the tag. + +9. **`vulnerability.vulnerabilityreferlnk`** + - A reference link related to the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Reference Link: {{p vulnerability.vulnerabilityreferlnk }} + {% endfor %} + ``` + - It uses CKeditor HTML data, its converted into the docx format from HTML, hence its required to use **`p`** at the start of the tag. + +10. **`vulnerability.created`** + - The timestamp when the vulnerability was created. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Created: {{ vulnerability.created }} + {% endfor %} + ``` + +11. **`vulnerability.created_by`** + - The user who created the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Created By: {{ vulnerability.created_by.username }} + {{ vulnerability.created_by.full_name }} + {% endfor %} + ``` + - Similar to project owner, you can use other filed as well like email, number or postion etc. + +12. **`vulnerability.last_updated_by`** + - The user who last updated the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + Last Updated By: {{ vulnerability.last_updated_by.username }} + {{ vulnerability.last_updated_by.full_name }} + {% endfor %} + ``` + +12. **`vulnerability.instances_data`** + - Acess all instaces of the vulnerability. + - Example usage: + ```python + {% for vulnerability in vulnerabilities %} + + {for instance in vulnerability.instances_data %} + ## This give all instances for vulnerabiltiy in current loop + + URL: {{ instance.URL }} + Parameter: {{ instance.Parameter }} + Parameter: {{ instance.Status }} + + {% endfor %} + + {% endfor %} + ``` + + + + +### Example + +```python +{% for vulnerability in vulnerabilities %} + + Vulnerability Name: {{ vulnerability.vulnerabilityname }} + + Severity: {{ vulnerability.vulnerabilityseverity }} + + CVSS Score: {{ vulnerability.cvssscore }} + + CVSS Vector: {{ vulnerability.cvssvector }} + + Status: {{ vulnerability.status }} + + Description: + {{p vulnerability.vulnerabilitydescription }} + + POC: + {{p vulnerability.POC }} + + Solution: + {{p vulnerability.vulnerabilitysolution }} + + Reference Link: + {{p vulnerability.vulnerabilityreferlnk }} + + Created On: {{ vulnerability.created }} + + Created By: + - Username: {{ vulnerability.created_by.username }} + - Full Name: {{ vulnerability.created_by.full_name }} + - Email: {{ vulnerability.created_by.email }} + - Number: {{ vulnerability.created_by.number }} + + Last Updated By: + - Username: {{ vulnerability.last_updated_by.username }} + - Full Name: {{ vulnerability.last_updated_by.full_name }} + - Email: {{ vulnerability.last_updated_by.email }} + - Number: {{ vulnerability.last_updated_by.number }} + + Instances + + {for instance in vulnerability.instances_data %} + + URL: {{ instance.URL }} + Parameter: {{ instance.Parameter }} + Parameter: {{ instance.Status }} + + {% endfor %} + +{% endfor %} +``` + + +### Reference + +For reference you can see `vulnerabilities` tag as below json object + +```json + +vulnerabilities = [ + { + "project": "Project Name or ID", + "vulnerabilityname": "SQL Injection in Login Page", + "vulnerabilityseverity": "High", + "cvssscore": 9.8, + "cvssvector": "AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", + "status": "Vulnerable", + "vulnerabilitydescription": "Converted DOCX content for vulnerability 1 description", + "POC": "Converted DOCX content for vulnerability 1 proof of concept", + "created": "2024-11-20T10:15:30Z", + "vulnerabilitysolution": "Converted DOCX content for vulnerability 1 solution", + "vulnerabilityreferlnk": "Converted DOCX content for vulnerability 1 reference link", + "created_by": "User1", + "last_updated_by": "User2", + "instances_data": [ + { + "URL": "https://example.com/vulnerable-endpoint-1", + "Parameter": "user_id", + "Status": "Open" + }, + { + "URL": "https://example.com/another-endpoint-1", + "Parameter": "", + "Status": "Closed" + } + ] + }, + { + "project": "Project Name or ID", + "vulnerabilityname": "Cross-Site Scripting in Search Page", + "vulnerabilityseverity": "Medium", + "cvssscore": 6.5, + "cvssvector": "AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", + "status": "Vulnerable", + "vulnerabilitydescription": "Converted DOCX content for vulnerability 2 description", + "POC": "Converted DOCX content for vulnerability 2 proof of concept", + "created": "2024-11-19T14:10:45Z", + "vulnerabilitysolution": "Converted DOCX content for vulnerability 2 solution", + "vulnerabilityreferlnk": "Converted DOCX content for vulnerability 2 reference link", + "created_by": "User3", + "last_updated_by": "User4", + "instances_data": [ + { + "URL": "https://example.com/vulnerable-endpoint-2", + "Parameter": "session_id", + "Status": "Open" + }, + { + "URL": "https://example.com/another-endpoint-2", + "Parameter": "order_id", + "Status": "Closed" + } + ] + } +] + + +``` \ No newline at end of file diff --git a/docs/custom-report/pdf/company-user.md b/docs/custom-report/pdf/company-user.md new file mode 100644 index 0000000..f76f0b0 --- /dev/null +++ b/docs/custom-report/pdf/company-user.md @@ -0,0 +1,48 @@ +# Context Variables for Company and Users + +## 1. Internal Company Name +- **Description:** + + This variable will provide the name of the internal company (your own company) that is linked to the APTRS. It fetches the company name from the `Company` model where the `internal` field is set to `True`. + +- **Usage Example:** + + ```html +

Company: {{ mycompany }}

+ + ``` + + +## 2. Project Manager Users +- **Description:** + + This variable gives access to all the internal users who are part of the "Project Manager" group. You can loop through this list to display details like the name of the project managers working on the project. + +- **Usage Example:** + + ```html +

Project Managers:

+ + + ``` + +## 3. Customer Company Users +- **Description:** + + This variable provides access to the users who belong to the customer’s company for the project. It retrieves the list of active users associated with the project’s customer company. + +- **Usage Example:** + + ```html +

Customer Users:

+ + + ``` \ No newline at end of file diff --git a/docs/custom-report/pdf/context-variable.md b/docs/custom-report/pdf/context-variable.md new file mode 100644 index 0000000..02ce539 --- /dev/null +++ b/docs/custom-report/pdf/context-variable.md @@ -0,0 +1,97 @@ + + +This document describes how to customize the HTML templates used to generate PDF reports using the `GetHTML` function in your Django application. Below are the available context variables that can be used in the HTML templates and their respective details. + +--- + +## Context Variables + +The following context variables are passed to the HTML template (`report.html`) during PDF generation. Users can use these variables to dynamically customize the content of the PDF report. + +| Variable Name | Description | +|---------------------|---------------------------------------------------------------------------------------------| +| `project` | The project object for which the report is being generated. Contains all project details. | +| `vuln` | Queryset of vulnerabilities for the project, ordered by CVSS score (higher to lower). | +| `instances` | Queryset of all vulnerable instances associated with the project. | +| `projectmanagers` | Queryset of users in the "Project Manager" group. | +| `customeruser` | Queryset of customer users associated with the project's customer company. | +| `mycomany` | The name of the internal (your company) company. | +| `projectscope` | Queryset of all project scopes for the project. | +| `totalretest` | Queryset of all retests for the project. | +| `totalvulnerability`| Total count of vulnerabilities for the project. | +| `ciritcal` | Count of vulnerabilities with severity "Critical". | +| `high` | Count of vulnerabilities with severity "High". | +| `medium` | Count of vulnerabilities with severity "Medium". | +| `low` | Count of vulnerabilities with severity "Low". | +| `info` | Count of vulnerabilities with severity "Informational" or "None". | +| `standard` | The standard or methodology being used for the report. | +| `Report_type` | The type of report being generated (e.g., Audit, Re-Audit). | +| `pie_chart` | Rendered pie chart data showing the vulnerability distribution by severity. | + +--- + +## How to Customize Templates + +1. **Locate the HTML Template**: + - The report template is located at `templates/*`. You can modify this file or create a new one for different report types. + +2. **Use Context Variables**: + - Insert the context variables into the template using Django's template syntax. For example: + ```html +

Vulnerability Report for {{ project.name }}

+

Total Vulnerabilities: {{ totalvulnerability }}

+

Critical Issues: {{ ciritcal }}

+

High Severity Issues: {{ high }}

+ ``` + + + + + +3. **Dynamic Content**: + - Use loops and conditionals to dynamically render data. For example: + ```html + + ``` + +4. **Styling and Charts**: + - Use `{{ pie_chart|safe }}` to embed the rendered pie chart in the HTML. Ensure that the `safe` filter is applied to include raw HTML safely. + +--- + +## Example Template Usage + +Here’s a sample section of the `report.html` template: + +```html + + + + {{ project.name }} Vulnerability Report + + +

{{ mycomany }} - Vulnerability Report

+

Project: {{ project.name }}

+

Total Vulnerabilities: {{ totalvulnerability }}

+

Critical Issues: {{ ciritcal }}

+

High Severity Issues: {{ high }}

+

Medium Severity Issues: {{ medium }}

+

Low Severity Issues: {{ low }}

+

Informational Issues: {{ info }}

+ +

Vulnerability Breakdown

+ {{ pie_chart|safe }} + +

Vulnerabilities

+ + + +``` \ No newline at end of file diff --git a/docs/custom-report/pdf/other.md b/docs/custom-report/pdf/other.md new file mode 100644 index 0000000..0f74bd9 --- /dev/null +++ b/docs/custom-report/pdf/other.md @@ -0,0 +1,57 @@ +# Context Variables for Vulnerabilities and Report Data + +## 1. Total Vulnerabilities +- **Description:** + Provides the total count of vulnerabilities associated with a project. +- **Usage Example:** + You can display the total number of vulnerabilities for the project. + + ```html +

Total Vulnerabilities: {{ totalvulnerability }}

+ ``` + +## 2. Severity Count +- **Description:** + Shows the count of vulnerabilities that have a severity of Critical or High, Medium, Low, None. +- **Usage Example:** + You can display the severity count. + + ```html +

Critical Vulnerabilities: {{ critical }}

+

High Vulnerabilities: {{ high }}

+

Medium Vulnerabilities: {{ medium }}

+

Low Vulnerabilities: {{ low }}

+

Informational Vulnerabilities: {{ info }}

+ ``` + + +## 3. Report Standard +- **Description:** + The standard or methodology being used for generating the report (e.g., OWASP, NIST). It will be in the list format, you can use below example to get in a text seperated by comma. +- **Usage Example:** + Display the methodology or standard used in the vulnerability report. + + ```html +

Report Standard: {{ standard|join:", " }}

+ ``` + + +## 4. Report Type +- **Description:** + Specifies the type of report being generated. This can include types like "Audit" or "Re-Audit". +- **Usage Example:** + Show the type of the report (Audit or Re-Audit). + + ```html +

Report Type: {{ Report_type }}

+ ``` + +## 5. Chart Image +- **Description:** + This variable holds the rendered data for a pie chart showing the distribution of vulnerabilities by severity. +- **Usage Example:** + Use this to display a pie chart visualizing vulnerability severity distribution. + + ```html +
{{ pie_chart|safe }}
+ ``` \ No newline at end of file diff --git a/docs/custom-report/pdf/pdf.md b/docs/custom-report/pdf/pdf.md new file mode 100644 index 0000000..54dd356 --- /dev/null +++ b/docs/custom-report/pdf/pdf.md @@ -0,0 +1,56 @@ +# Customized PDF Report Documentation + +APTRS uses the **WeasyPrint** library to generate PDF reports from HTML and CSS. The Django template engine dynamically passes data to the HTML template using context variables. + +### How It Works +The system is designed so you don’t need to edit the Django code that handles report generation unless you are familiar with Django and Python. The recommended approach is to customize the layout and styling by modifying the **HTML** and **CSS** files provided with the project. + +### File Structure for Customization +Within the project root directory, there is a subdirectory named `APTRS`. This contains the following important folders for report customization: + +1. **Static Folder**: + - Located inside the `APTRS` directory. + - Contains a `CSS` subfolder where all CSS files for the report are stored. + - Includes predefined styles that you can customize to adjust the appearance of the report. + +2. **Templates Folder**: + - Located in the same directory as the `static` folder. + - Contains all the HTML templates used for generating reports. + - Templates are modular, with the main report layout in `report.html` and additional reusable components loaded using Django's `{% include %}` tag. + +### Key Files for Customization +1. **`report.html`**: + - The main HTML file for the report. + - Includes the overall structure, head tags, and references to CSS files. + - Dynamically includes other HTML components for better modularity. + +2. **`report-page.css`**: + - The primary CSS file applied to all report pages. + - Handles global styles such as font loading, page numbering, table styles, and default styles for HTML tags. + - Defines general formatting applied across the entire report. + +3. **Component Files**: + - Each HTML file has a corresponding CSS file for specific styles. + - For example, styles specific to an HTML section like `vulnerability.html` will be defined in `vulnerability.css`. + - This structure ensures easy identification and modification of styles tied to specific sections. + +### Fonts + +The project uses the **Fira Sans** font by default, stored in the `static/fonts` folder. You can: + + - Add new fonts to the `fonts` folder. + - Update the CSS in the `report-page.css` file to use your fonts. + +### Customization Tips +- Modify **HTML** files to change content layout, add new sections, or reorder components. +- Edit **CSS** files to change colors, fonts, or styles for specific sections. +- Use the modular structure to quickly locate and modify styles for individual components. +- For global styles or formatting (e.g., page numbers, headers, footers), update `report-page.css`. + +### Important Notes +- Avoid editing the Django code unless necessary, as it handles the logic for passing variables and generating the PDF. +- All changes to the static files (CSS) or templates (HTML) will reflect in the next report generated. + + + + diff --git a/docs/custom-report/pdf/project.md b/docs/custom-report/pdf/project.md new file mode 100644 index 0000000..3c934dd --- /dev/null +++ b/docs/custom-report/pdf/project.md @@ -0,0 +1,104 @@ + + +## Project Model Variables for Template Customization + +The `Project` model in APTRS contains the following fields that can be used as template variables in your custom report templates. These variables are passed as part of the context to the report HTML, allowing you to display or manipulate project-related data in your custom reports. + +### Available Variables and Their Usage + +1. **`project.name`** + - Represents the name of the project. + - Example usage in HTML: + ```html +

Project Name: {{ project.name }}

+ ``` + +2. **`project.companyname`** + - A foreign key to the `Company` model, representing the company associated (Customer Company) with the project. + - Example usage: + ```html +

Company Name: {{ project.companyname.name }}

+ ``` + +3. **`project.description`** + - A detailed description of the project. + - Example usage: + ```html +

Description: {{project.description|clean_html}}

+ ``` + - It uses CKeditor HTML data, using ``|clean_html`` allow to render html data securely instead of as text. + +4. **`project.projecttype`** + - Specifies the type of project. + - Example usage: + ```html +

Project Type: {{ project.projecttype }}

+ ``` + +5. **`project.startdate`** + - The start date of the project. + - Example usage: + ```html +

Start Date: {{ project.startdate }}

+ ``` + - You can also modify the date format + ```html +

Start Date: {{project.startdate|date:"d/m/Y" }}

+ ``` + +6. **`project.enddate`** + - The end date of the project. + - Example usage: + ```html +

End Date: {{ project.enddate }}

+ ``` + - You can also modify the date format + ```html +

End Date: {{project.enddate|date:"d/m/Y" }}

+ ``` + +7. **`project.testingtype`** + - The type of testing performed for the project (e.g., White Box, Black Box). + - Example usage: + ```html +

Testing Type: {{ project.testingtype }}

+ ``` + +8. **`project.projectexception`** + - Notes or exceptions for the project, if any. + - Example usage: + ```html +

Exceptions: {{ project.projectexception|clean_html }}

+ ``` + - It uses CKeditor HTML data, using ``|clean_html`` allow to render html data securely instead of as text. + - In most cases if you don't have exceptions and in your report you only this if exception is there you are also do it with conditions. + ```html + {% if project.projectexception %} +

Exceptions: {{ project.projectexception|clean_html }}

+ {% endif %} + ``` + + +9. **`project.owner`** + - A many-to-many relationship representing users associated as owners of the project. + - To display all owners: + ```html + + ``` + +10. **`project.status`** + - The current status of the project, based on `PROJECT_STATUS_CHOICES` (e.g., Upcoming, In Progress, Delay, Completed). + - Example usage: + ```html +

Status: {{ project.status }}

+ ``` + + diff --git a/docs/custom-report/pdf/retest.md b/docs/custom-report/pdf/retest.md new file mode 100644 index 0000000..9847e3c --- /dev/null +++ b/docs/custom-report/pdf/retest.md @@ -0,0 +1,41 @@ +# Context Variable for Project Retests + +The `totalretest` variable gives access to the retests associated with a project. It allows you to display details of a project retest, including start and end dates, owners, and status. + +- **Usage Example:** + You can loop through `totalretest` to display the retests for a project. However, it is possible to conditionally display the retests based on the `Report_type`, e.g., showing retests only when the report type is "Re-Audit". + + ```html +

Project Retests:

+ + ``` + + +It is possible to conditionally display the retests based on the `Report_type`, e.g., showing retests only when the report type is "Re-Audit". + + ```html + {% if Report_type == 'Re-Audit' %} +

Project Retests:

+ + {% endif %} + ``` \ No newline at end of file diff --git a/docs/custom-report/pdf/scope.md b/docs/custom-report/pdf/scope.md new file mode 100644 index 0000000..35f6f28 --- /dev/null +++ b/docs/custom-report/pdf/scope.md @@ -0,0 +1,14 @@ +# Context Variable for Project Scope + +The `projectscope` variable gives access to the scope of a project. It allows you to retrieve and display details of the project's scope, including any specific tasks, requirements, or exceptions related to the project. You can loop through this context variable to show the scope items associated with a project. + +- **Usage Example:** + + ```html +

Project Scope:

+ + ``` diff --git a/docs/custom-report/pdf/vulnerability.md b/docs/custom-report/pdf/vulnerability.md new file mode 100644 index 0000000..5889f7f --- /dev/null +++ b/docs/custom-report/pdf/vulnerability.md @@ -0,0 +1,202 @@ +### Vulnerability and Instance Model Variables for Template Customization + +In APTRS, the `Vulnerability` and `Vulnerableinstance` models are used to manage and track vulnerabilities and their instances across various projects. Below is an overview of the variables available for use in templates when working with these models. + +### Available Variables for Vulnerability Model + + +1. **`vulnerability.vulnerabilityname`** + - The name of the vulnerability (e.g., "SQL Injection"). + - Example usage: + ```html + {% for vulnerability in vuln %} +

Vulnerability Name: {{ vulnerability.vulnerabilityname }}

+ {% endfor %} + ``` + +2. **`vulnerability.vulnerabilityseverity`** + - The severity of the vulnerability (e.g., "High", "Medium"). + - Example usage: + ```html + {% for vulnerability in vuln %} +

Severity: {{ vulnerability.vulnerabilityseverity }}

+ {% endfor %} + ``` + +3. **`vulnerability.cvssscore`** + - The CVSS score associated with the vulnerability. + - Example usage: + ```html + {% for vulnerability in vuln %} +

CVSS Score: {{ vulnerability.cvssscore }}

+ {% endfor %} + ``` + +4. **`vulnerability.cvssvector`** + - The CVSS vector associated with the vulnerability. + - Example usage: + ```html + {% for vulnerability in vuln %} +

CVSS Vector: {{ vulnerability.cvssvector }}

+ {% endfor %} + ``` + +5. **`vulnerability.status`** + - The status of the vulnerability, based on `STATUS_CHOICES` (e.g., Vulnerable, Confirm Fixed, Accepted Risk). + - Example usage: + ```html + {% for vulnerability in vuln %} +

Status: {{ vulnerability.status }}

+ {% endfor %} + ``` + +6. **`vulnerability.vulnerabilitydescription`** + - A description of the vulnerability. + - Example usage: + ```html + {% for vulnerability in vuln %} +

Description: {{ vulnerability.vulnerabilitydescription|clean_html }}

+ {% endfor %} + ``` + +7. **`vulnerability.POC`** + - The proof of concept (POC) for the vulnerability. + - Example usage: + ```html + {% for vulnerability in vuln %} +

POC: {{ vulnerability.POC|clean_html }}

+ {% endfor %} + ``` + +8. **`vulnerability.vulnerabilitysolution`** + - The recommended solution for the vulnerability. + - Example usage: + ```html + {% for vulnerability in vuln %} +

Solution: {{ vulnerability.vulnerabilitysolution|clean_html }}

+ {% endfor %} + ``` + +9. **`vulnerability.vulnerabilityreferlnk`** + - A reference link related to the vulnerability. + - Example usage: + ```html + {% for vulnerability in vuln %} +

Reference Link: {{ vulnerability.vulnerabilityreferlnk|clean_html }}

+ {% endfor %} + ``` + +10. **`vulnerability.created`** + - The timestamp when the vulnerability was created. + - Example usage: + ```html + {% for vulnerability in vuln %} +

Created: {{ vulnerability.created }}

+ {% endfor %} + ``` + +11. **`vulnerability.created_by`** + - The user who created the vulnerability. + - Example usage: + ```html + {% for vulnerability in vuln %} +

Created By: {{ vulnerability.created_by.username }}

+ {{ vulnerability.created_by.full_name }}

+ {% endfor %} + ``` + - Similar to project owner, you can use other filed as well like email, number or postion etc. + +12. **`vulnerability.last_updated_by`** + - The user who last updated the vulnerability. + - Example usage: + ```html + {% for vulnerability in vuln %} +

Last Updated By: {{ vulnerability.last_updated_by.username }}

+ {% endfor %} + ``` + +### Available Variables for Vulnerableinstance Model + +1. **`instance.vulnerabilityid`** + - The `Vulnerability` object associated with the instance. + - Example usage: + ```html + {% for instance in instances %} +

Vulnerability Name: {{ instance.vulnerabilityid.vulnerabilityname }}

+ {% endfor %} + ``` + +2. **`instance.project`** + - The project associated with the vulnerable instance. + - Example usage: + ```html + {% for instance in instances %} +

Project: {{ instance.project.name }}

+ {% endfor %} + ``` + +3. **`instance.URL`** + - The URL of the vulnerable instance. + - Example usage: + ```html + {% for instance in instances %} +

URL: {{ instance.URL }}

+ {% endfor %} + ``` + +4. **`instance.Parameter`** + - The parameter of the vulnerable instance. + - Example usage: + ```html + {% for instance in instances %} +

Parameter: {{ instance.Parameter }}

+ {% endfor %} + ``` + +5. **`instance.status`** + - The status of the vulnerable instance, based on `STATUS_CHOICES` (e.g., Vulnerable, Confirm Fixed, Accepted Risk). + - Example usage: + ```html + {% for instance in instances %} +

Status: {{ instance.status }}

+ {% endfor %} + ``` + +### Displaying Vulnerable Instances for a Specific Vulnerability in a Template +The instances query set or list does not associte with the vulnerability name, instances variable contain all instances for the project, In most cases we need all instances for a vulnerabiltiy. We can do that as well, you can check in the original ``vulnerabilities.html`` in the template or you can use this: + +To display the instances for a specific vulnerability within a loop for vulnerabilities, you can use the following approach: + +```html +{% for vulnerability in vuln %} + +

Vulnerability Name: {{ vulnerability.vulnerabilityname }}

+ +

{{ vulnerability.vulnerabilitysolution|clean_html }}

+ +

{{ vulnerability.vulnerabilityreferlnk|clean_html }}

+ +

POC: {{ vulnerability.POC|clean_html }}

+ +

Description: {{ vulnerability.vulnerabilitydescription|clean_html }}

+ +

Status: {{ vulnerability.status }}

+ +

CVSS Vector: {{ vulnerability.cvssvector }}

+ +

Severity: {{ vulnerability.vulnerabilityseverity }}

+ + {% for instance in instances %} + + {% if instance.vulnerabilityid.id == vulnerability.id %} + + {{ instance.URL }} + {{ instance.Parameter }} + {{ instance.status }} + + {% endif %} + + {% endfor %} + +{% endfor %} +``` \ No newline at end of file diff --git a/docs/getting-started/Contribution.md b/docs/getting-started/Contribution.md new file mode 100644 index 0000000..5e639f9 --- /dev/null +++ b/docs/getting-started/Contribution.md @@ -0,0 +1,13 @@ +## Project Contribution + +### Creator + +- **[Sourav Kalal](https://github.com/Anof-cyber)** + +### Special Thanks + +- **[DJ Scruggs](https://github.com/djscruggs)** A big thanks to DJ Scruggs for creating the entire ViteJS frontend from scratch and implementing the APIs for version 1.0. + + - [GitHub](https://github.com/djscruggs) + - [Portfolio](https://djscruggs.com) + - [LinkedIn](https://www.linkedin.com/in/djscruggs/) diff --git a/docs/getting-started/Features.md b/docs/getting-started/Features.md new file mode 100644 index 0000000..1fa87b1 --- /dev/null +++ b/docs/getting-started/Features.md @@ -0,0 +1,15 @@ +## Features + +- **Automated Report Generation:** APTRS automates creating comprehensive penetration testing reports, saving time and ensuring consistency. + +- **PDF Docx, and Excel Reports:** Generate professional-looking PDF, Docx and Excel reports with ease, providing clients and stakeholders with clear insights into security assessments. + +- **Vulnerability Management:** APTRS helps you keep track of vulnerabilities across different projects, allowing for efficient management and mitigation. + +- **User-Friendly Interface:** The tool is designed with a user-friendly interface, making it accessible for both novice and experienced penetration testers. + +- **Customization:** Tailor your reports to meet specific project requirements, ensuring that the generated reports align with your organization's standards. + +- **Project and Customer Management:** Manage all your projects, retest, and customer all in one place. The user and project tracking allows you to monitor the user's project allocation, plans, and status. + +*** \ No newline at end of file diff --git a/docs/getting-started/Sponsors.md b/docs/getting-started/Sponsors.md new file mode 100644 index 0000000..d758b45 --- /dev/null +++ b/docs/getting-started/Sponsors.md @@ -0,0 +1,5 @@ + + +- Many thanks to DigitalOcean for their generous support of the project. + +DigitalOcean Referral Badge \ No newline at end of file diff --git a/docs/getting-started/demo.md b/docs/getting-started/demo.md new file mode 100644 index 0000000..78adc31 --- /dev/null +++ b/docs/getting-started/demo.md @@ -0,0 +1,20 @@ +## Live Demo Instance + +Explore the features of APTRS through our live demo instance: + +- **Live Demo** + - Username: [sourav.kalal@aptrs.com](sourav.kalal@aptrs.com) + - Password: I-am-Weak-Password-Please-Change-Me + +Feel free to interact with the tool and see how APTRS can streamline your penetration testing workflows. + +!!! tip "" + + > 🌨️ Huge thanks to DigitalOcean for their support of the APTRS project. + + +!!! warning + + 🚧 APIs related to user profiles and user management, such as adding, editing, deleting users, and changing passwords, are disabled on the cloud-hosted demo instance. + + diff --git a/docs/getting-started/license.md b/docs/getting-started/license.md new file mode 100644 index 0000000..a12d109 --- /dev/null +++ b/docs/getting-started/license.md @@ -0,0 +1 @@ +The APTRS project is released under the MIT License, which is a permissive open-source license allowing anyone to use, modify, and distribute the software freely. This license ensures that the software remains open and accessible while permitting both personal and commercial use, provided that the original copyright notice and license terms are included in all copies or substantial portions of the software diff --git a/docs/image/1.0/logo.png b/docs/image/1.0/logo.png new file mode 100644 index 0000000..731d41e Binary files /dev/null and b/docs/image/1.0/logo.png differ diff --git a/docs/index.md b/docs/index.md index 4c0add9..1f449de 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,22 +1,12 @@ -# APTRS +# Automated Penetration Testing Reporting System +
+APTRS +
-![APTRS](https://i.ibb.co/JQdKWHL/APTRS.png) +APTRS (Automated Penetration Testing Reporting System) is a Python, Django and ViteJS-based automated reporting tool designed for penetration testers and security organizations. This tool streamlines the report generation process by enabling users to create PDF, Docx and Excel reports directly, eliminating the need for manual approaches. Additionally, APTRS offers a systematic way to monitor and manage vulnerabilities within various projects. Keep your penetration testing projects organized and efficient with APTRS. -APTRS (Automated Penetration Testing Reporting System) is an automated reporting tool in Python and Django. The tool allows Penetration testers to create a report directly without using the Traditional Docx file. It also provides an approach to keeping track of the projects and vulnerabilities. -### Sponsor -[![sponsors](https://img.shields.io/github/sponsors/Anof-cyber)](https://github.com/sponsors/Anof-cyber) +
+DigitalOcean Referral Badge -### Team -##### [Sourav Kalal](https://twitter.com/ano_f_) - -### Documentation -- #### [Prerequisites](Prerequisites.md) -- #### [Installation](installation.md) -- #### [Running APTRS Server](Running.md) -- #### [Company](Company.md) -- #### [Customer](Customer.md) -- #### [Vulnerability Database](Vulnerability-Database.md) -- #### [Setting](Setting.md) -- #### [Project](Project.md) -- #### [Report Template](Report-Template.md) \ No newline at end of file +
\ No newline at end of file diff --git a/docs/installation.md b/docs/installation.md deleted file mode 100644 index 61bf667..0000000 --- a/docs/installation.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Installation - -**Tested with Python 3.8.10 on Windows 10/11, Kali Linux 2022.2/3, Ubuntu 20.04.5 LTS** - - -!!! info "Note" - Please make sure that all the [prerequisites](Prerequisites.md) mentioned are installed first. - -!!! info "Note" - it is recommended to delete the `db.sqlite3` file and then run the install file. - -## Linux -```bash -git clone https://github.com/Anof-cyber/APTRS.git -cd APTRS -bash install.sh -``` -*** - -## Windows -```batch -git clone https://github.com/Anof-cyber/APTRS.git -cd APTRSF -install.bat -``` \ No newline at end of file diff --git a/docs/installation/certificate.md b/docs/installation/certificate.md new file mode 100644 index 0000000..c17f073 --- /dev/null +++ b/docs/installation/certificate.md @@ -0,0 +1,3 @@ +APTRS uses HTTPS with a self-signed certificate. If you would like to replace the self-signed certificate with your own, you can do so by updating the certificate and key files located at: + +[https://github.com/APTRS/APTRS/tree/main/Certificate](https://github.com/APTRS/APTRS/tree/main/Certificate) \ No newline at end of file diff --git a/docs/installation/docker.md b/docs/installation/docker.md new file mode 100644 index 0000000..55cf625 --- /dev/null +++ b/docs/installation/docker.md @@ -0,0 +1,28 @@ + + +## Linux + +```bash +git clone https://github.com/APTRS/APTRS +cd APTRS +cp env.docker .env +nano .env +docker-compose up + +``` + +## Windows +```shell +git clone https://github.com/APTRS/APTRS +cd APTRS +copy env.docker .env +notepad .env +docker-compose up +``` + + + +!!! note + + The **.env** file contains all the environment variables, such as passwords for JWT, Database credentials, Cloud S3 bucket details, etc. It’s important to update the default passwords and details before deploying the application. For more information, refer to the **[Environment Variables](/installation/env/)** section. + diff --git a/docs/installation/env.md b/docs/installation/env.md new file mode 100644 index 0000000..bdf0908 --- /dev/null +++ b/docs/installation/env.md @@ -0,0 +1,17 @@ +The APTRS backend uses the ``.env`` file to store credentials such as S3 bucket information, database credentials, secret keys, whitelisted IPs/domains, and more. + +- If you are deploying the application with Docker, make sure to update the details in the .env file from the project root. +- If you are deploying the application without Docker, you will need to update specific details like the S3 bucket and whitelisted IPs. + +| ENV | Description | Docker | Linux Server Setup +| ------------------| ----------------------------- | ------------------------------------ | ------------------------------------ | +| `SECRET_KEY` | This key is used by Backend including JWT, Should be secured and random. | Manually need to be updated in env file| Auto Generated no need to update it. | +| `WHITELIST_IP` | This allows to set whitelisted IP/domain with port number to allow loading resource during PDF report to prevent SSRF vulnerability. | Manually need to be updated in env file | Auto Generated but Manually need to be updated in env file based on your domain name, IP etc. | +| `ALLOWED_HOST ` | Whitelist allowed host to prevent host header injection attack | Manually need to be updated in env file | Auto Generated but Manually need to be updated in env file based on your domain name, IP etc. | +|`CORS_ORIGIN ` | Whitelist allowed origin to prevent cross origin attack | Manually need to be updated in env file | Auto Generated but Manually need to be updated in env file based on your domain name, IP etc. | +|`REDIS_URL` | Redis Server Details including IP, Port and password | Should replace the default password `q8N8HwlaOWqOl1hG7rdmBsm7oT52fLKHZXFwOB4VM7SXFDV8wg` to a new strong random password. | Auto Generated no need to update it. | +|`REDIS_PASSWORD` | Redis Server password for Redis image in docker | Should replace the default password `q8N8HwlaOWqOl1hG7rdmBsm7oT52fLKHZXFwOB4VM7SXFDV8wg` to a new strong random password. Password in **REDIS_URL** and **REDIS_PASSWORD** should be same| Not needed and no need to update/add. | +|`POSTGRES_USER` , `POSTGRES_PASSWORD`, `POSTGRES_PORT`, `POSTGRES_DB` | Postgres DB username, password, port, and DB names | Manually need to be updated in env file | Auto Generated no need to update it. | +|`POSTGRES_HOST` | Postgres host name | Should not be updated. | Auto Generated no need to update it. | +|`USE_S3`| If you want to use Cloud S3 bucket Digital Ocean or AWS s3 bucket. Default ``False``, you can change it to `True`|Optional| Optional | +| `AWS_ACCESS_KEY_ID` `AWS_SECRET_ACCESS_KEY` `AWS_STORAGE_BUCKET_NAME` `AWS_S3_REGION_NAME` `AWS_S3_CUSTOM_DOMAIN` `AWS_S3_ENDPOINT_URL` | Bucket details if `USE_S3` is set to `True`|Optional| Optional| \ No newline at end of file diff --git a/docs/installation/frontend.md b/docs/installation/frontend.md new file mode 100644 index 0000000..b33498b --- /dev/null +++ b/docs/installation/frontend.md @@ -0,0 +1,110 @@ +APTRS now includes the source code of the Vite.js frontend by default, instead of a pre-built version. This change allows you greater flexibility to customize the frontend as needed. If you are deploying the application using Docker, the build process is handled automatically, so you don't need to worry about creating a production build manually. + +However, if you choose to manually deploy APTRS, you will need to manually build the production version of the frontend and serve it using Nginx or any other reverse proxy. + +To build the production version from the Vite.js source code, follow these steps: + + + + +``` bash +git clone https://github.com/APTRS/APTRS +cd APTRS +cd Frontend +cp env.example .env +npm run build +``` + +!!! note + + The **.env** file contains settings like the backend API domain and app environment. You can modify these as needed. + + +By default, APTRS serves both the backend and frontend on the same server, meaning they share the same IP/domain and port. The ``.env`` file uses just ``/api/`` in docker build for the backend API domain. This setup is recommended to avoid issues with image uploads in the CKEditor within APTRS and to prevent conflicts related to Same-Origin policies. + +
> + + + + + +### Hosting the Frontend and API Together + +If you wish to host the frontend on a separate domain, IP, or port from the backend API, you can configure the backend API's domain in the .env file within the Frontend folder. For example: + + +```bash +nano .env + +VITE_APP_API_URL = http://backend-api.com/api/ +npm run build +``` + +However, it is not recommended to host the API and frontend on separate domains, IPs, or ports. Here's why: + +1. JWT Token Authentication and Cookies: + + - The API uses a combination of JWT tokens in headers and cookies for authentication and access control. + - Cookies are domain-specific and cannot be shared across different domains unless explicitly configured with a domain-wide scope. This can lead to complexities in maintaining secure cross-domain authentication. + +2. Static Image Loading Issues: + + - Browsers do not allow custom headers, such as JWT tokens, for loading static resources like images. + - APTRS addresses this by using cookies for authentication, allowing images protected by the API to be loaded by authenticated users. However, this setup is difficult to manage across separate domains, as it relies on cookies being available in the same domain scope. + +4. Unified Image Path Management: + + - APTRS supports storing images locally or on S3. Using the API for image access ensures consistency, as images are accessed through the same API endpoint regardless of their storage location. + - This approach prevents exposing hardcoded S3 bucket URLs in CKEditor or frontend code. Additionally, if the S3 bucket URL changes or signed URLs expire, the API path remains consistent. + +4. Image Management with CKEditor: + + - APTRS manages images uploaded through CKEditor by serving them directly via the backend API, rather than using a web server. This design ensures that sensitive images, such as those used for proofs of concept (POCs), are accessible only to authenticated users. These images are protected by authentication tokens and are not publicly exposed. + - CKEditor uses ```` tags with a ``src`` attribute pointing to the API's image path. For example: + + ```html + + ``` + +### Challenges with Hosting the API and Frontend on Separate Domains + +When the API is hosted on a separate domain from the frontend: + +- CKEditor hardcodes the API domain in the ``src`` attribute of the images. +- If the API domain name, IP, or port changes, previously uploaded images will fail to load, as CKEditor cannot dynamically update the ``src`` attribute. +- Additionally, browsers loading static resources like images do not support custom headers (e.g., JWT tokens), which can complicate access control for images requiring authentication. + +### Benefits of Hosting API and Frontend on the Same Domain + +If both the API and frontend are hosted on the same domain, the frontend can be built with ``VITE_API_URL=/api/``. This approach allows CKEditor to generate image paths relative to the frontend's base domain, such as: + +```html + +``` + +This configuration provides several advantages: + +- Domain Independence: The image path (``/api/path/to/image.jpg``) remains valid even if the domain name, IP address, or port changes, as long as the API and frontend share the same base domain. +- Simplified Image Access: The relative path ensures that images are seamlessly accessible without hardcoding the API domain, reducing the risk of broken links if deployment configurations change. +- Consistent User Experience: End users can load images securely without encountering authentication or cross-domain issues. + + + +### Recommendation +For best results: + +1. Host Both API and Frontend on the Same Domain + + - Use a reverse proxy, such as Nginx, to host both the API and frontend on the same domain. + - Configure the frontend to use VITE_API_URL=/api/. + + This setup improves maintainability and ensures robustness against deployment changes, as the relative paths remain valid even if the domain name, IP, or port changes. + +2. Deploying Frontend and Backend on Separate Servers + + - If you require separate servers for the frontend and backend (e.g., for scalability, load balancing, or easier maintenance), you can still serve both on the same domain or IP and port for users by using a reverse proxy. + + - For example, you can deploy the frontend on one server and the backend on another, but configure your reverse proxy to route requests based on the path: + + - Requests to ``/api/*, media/*, static/*`` are proxied to the backend server. + - Other requests (e.g., for the frontend) are served by the frontend server. \ No newline at end of file diff --git a/docs/installation/install.md b/docs/installation/install.md new file mode 100644 index 0000000..a773400 --- /dev/null +++ b/docs/installation/install.md @@ -0,0 +1,9 @@ +APTRS can be installed using two methods: + +- Docker (Recommended for most users) +- Manual (User with Knowledge of Ngnix and Little Python and Nodejs) + + +!!! note + + APTRS does not natively support Windows installations and setting it up on Windows is not recommended. While it's possible to manually install certain components (such as the APTRS Backend, Frontend, and Database) on Windows, key dependencies like Redis require a Linux environment. Instead, you can use the Docker setup for Windows, which is the preferred option for Windows users. \ No newline at end of file diff --git a/docs/installation/manual.md b/docs/installation/manual.md new file mode 100644 index 0000000..2a66d95 --- /dev/null +++ b/docs/installation/manual.md @@ -0,0 +1,255 @@ +# Manual Installation + +If you prefer to install the APTRS without docker and have more control over each serive like Redis, Postgresql, Ngnix etc, Or you want to host Data base on diffrent server, redis on diffrent etc. You can follow the below process on deplying the APTRS on a server without doceker, The steps mentieod below were testing on below setup. + + +- OS - Ubutnu 24.10 +- Python - 3.12.7 (3.9+ is required) +- Python Poetry - 1.8.4 +- PostgreSQL - 16.4 (Ubuntu 16.4-1build1) +- Redis Server - 7.0.15 +- Nginx - 1.26.0 + +## PostgreSQL Setup + +Run the below command to install PostgreSQL. + +```bash +sudo apt-get install postgresql postgresql-contrib +``` + +Once the installation is completed we can access the PostgreSQL shell with below command. + +```bash +sudo -u postgres psql +``` + +From the PostgreSQL shell Create new database for APTRS project (Change the name you want recocmend to keep relenvet name to the project) + +```bash +CREATE DATABASE aptrsdb; +``` + +Next, create a database user for our project. Make sure to select a secure password: + +```bash +CREATE USER aptrsdb_user WITH PASSWORD 's!!D%AriPB-MO~5'; +``` + +We are setting the default encoding to UTF-8 and change other settings. Make sure to update the Time zone as per your choise, also we need to make sure we use the same timezone the APTRS as well. + +```bash +ALTER ROLE aptrsdb_user SET client_encoding TO 'utf8'; +ALTER ROLE aptrsdb_user SET default_transaction_isolation TO 'read committed'; +ALTER ROLE aptrsdb_user SET timezone TO 'UTC'; + +\c aptrsdb; +GRANT USAGE ON SCHEMA public TO aptrsdb_user; +GRANT ALL PRIVILEGES ON SCHEMA public TO aptrsdb_user; +GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO aptrsdb_user; +GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO aptrsdb_user; +ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO aptrsdb_user; +GRANT ALL PRIVILEGES ON DATABASE aptrsdb TO aptrsdb_user; +\q +``` + + +Once we are done, we make sure the postgresql service is running and always up with reboot. + +```bash +sudo systemctl start postgresql +sudo systemctl enable postgresql +``` + + + + +## Redis Setup + + +Run the below command to install Redis. + +```bash +sudo apt install redis-server +``` + +Once redis is installed, we want to make sure we change the `supervised` and add password to our redis service. + +```bash +sudo nano /etc/redis/redis.conf +``` + +Within `redis.conf` file add the below contenxt, Make sure to update the password to a new secure password + +```bash +supervised systemd +requirepass s!!D%AriPB-MO~5 +``` + +Once we are done, we make sure the redis service is running and always up with reboot. + +```bash +sudo systemctl restart redis.service +sudo systemctl restart redis +sudo systemctl enable redis +``` + + + + +## APTRS Django APIs Setup + + +Run the below command to install Python and other requirements for the APTRS. + +```bash +sudo apt install python3-venv python3-dev libpq-dev weasyprint +``` + +Its better to seperate the API and webserice from other users in the machine, Its good to create a seperate account for it. + +```bash +sudo adduser aptrs +sudo usermod -aG sudo aptrs +sudo su - aptrs +``` + +APTRS make use of Python Poetry to manage the dependices we make sure we install it. + +```bash +curl -sSL https://install.python-poetry.org | python3 - +``` + +By default Poetry will not be added into the user or system enviment. Make sure to add it to the enviment. + +```bash +export PATH="/home/aptrs/.local/bin:$PATH" +``` + +Once done we can download the APTRS from the GitHub, install the dependicies, and make copy the example .env file. + +```bash +cd /home/aptrs +git clone https://github.com/APTRS/APTRS +cd APTRS +poetry install +cp env.docker APTRS/.env # The .env file should be located in the same directory as the manage.py file. +cd APTRS + +``` +After obtaining the `.env` file from the demo environment file, ensure that you update it with the following details: the password for Redis, the PostgreSQL hostname or IP address, the Redis hostname or IP address, the secret key, and any other necessary information. It's important to review all the details in the `.env` file carefully. For more information on configuring the `.env` file and the various data it contains, please refer to the **[Environment Variables](/installation/env/)** section. + +Few Important details for **.env** file: + + +- **WHITELIST_IP:** Add the server domain name if you're using one; if using a public IP, include that as well. For local network access, add the server's internal IP to the whitelist. Specify the protocol (HTTP or HTTPS) and use Nginx instead of the Django default port (8000). You don’t need to specify a port if using HTTP on 80 or HTTPS on 443. If using S3 buckets, include the bucket URL. + +- **CORS_ORIGIN:** Since the frontend and backend will be on the same server, simply allow the server's public or local IP, along with the appropriate protocol and port, if necessary. Both frontend and backend should be accessible via the same domain or IP using Nginx reverse proxy. For more details, check the **[Frontend](/installation/frontend/)** documentation. + +- **ALLOWED_HOST:** Set this only for the server's domain name or public/internal IP, based on how APTRS will be accessed. + +- **SECRET_KEY:** Make sure to update it with a secure key; the same key will be used to generate a JWT token. + + +From the directory where manage.py is located, run the command below. + +```bash +poetry shell +python3 manage.py makemigrations accounts +python3 manage.py makemigrations configapi +python3 manage.py makemigrations customers +python3 manage.py makemigrations project +python3 manage.py makemigrations vulnerability +python3 manage.py makemigrations +python3 manage.py migrate +python3 manage.py first_setup +exit +``` + + +Once we have completed the required setup, we need to start the server. APTRS uses Gunicorn for this purpose, which should already be installed through the steps we have completed so far. Since we are using Poetry, we need to locate the full path of Gunicorn for the APTRS project using the command below: + +```bash +$> cd /home/aptrs/APTRS +$> poetry run which gunicorn + +##We might get the full path like below, this will be different for all users +/home/aptrs/.cache/pypoetry/virtualenvs/aptrs-h1P6HTQN-py3.12/bin/gunicorn +``` + +Once we have full path for gunicorn we can setup the `gunicorn.service` with below command: + + +```bash +sudo nano /etc/systemd/system/gunicorn.service +``` + +In the nano file editor paste the below context. Make sure to update the full path of the gunicorn in the below file for `gunicorn.socket`. + + + +```bash +[Unit] +Description=gunicorn daemon to serve APTRS +Requires=gunicorn.socket +After=network.target + +[Service] +User=aptrs +Group=www-data +WorkingDirectory=/home/aptrs/APTRS/APTRS +ExecStart=/home/aptrs/.cache/pypoetry/virtualenvs/aptrs-h1P6HTQN-py3.12/bin/gunicorn --workers 3 --access-logfile - --bind unix:/run/gunicorn.sock APTRS.wsgi:application + +[Install] +WantedBy=multi-user.target +``` + + + +Now we can setup the `gunicorn.socket` with below command: + +```bash +sudo nano /etc/systemd/system/gunicorn.socket +``` + +```bash +[Unit] +Description=gunicorn socket + +[Socket] +ListenStream=/run/gunicorn.sock + +[Install] +WantedBy=sockets.target + +``` + +With all set We can start the gunicorn service with below command + +```bash +sudo systemctl start gunicorn.socket +sudo systemctl enable gunicorn.socket +sudo systemctl enable gunicorn +sudo systemctl daemon-reload +sudo systemctl restart gunicorn +``` + +You can verify if APTRS APIs are up and running with below command + +```bash +curl --unix-socket /run/gunicorn.sock localhost/api/config/ping/ + +{"status":"ok","message":"Server is up and running!"} +``` + +In case some error you can check if the socket and service has any error or not with below command +```bash +sudo systemctl status gunicorn.socket +sudo systemctl status gunicorn +``` + + + +### Frontend ViteJs Setup + +## Nginx Setup \ No newline at end of file diff --git a/docs/logo.png b/docs/logo.png new file mode 100644 index 0000000..731d41e Binary files /dev/null and b/docs/logo.png differ diff --git a/mkdocs.yml b/mkdocs.yml index 1d43757..c51ee04 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -4,15 +4,19 @@ theme: logo: https://i.ibb.co/BsfwzSf/download.png favicon: https://i.ibb.co/LY6gbtW/android-chrome-512x512.png features: + - toc.integrate + - toc.follow + - navigation.path + - navigation.indexes - navigation.tabs - navigation.tabs.sticky - navigation.path + - search.suggest - navigation.sections - navigation.tracking - navigation.instant - - navigation.indexes - - toc.follow - content.tabs.link + palette: @@ -30,17 +34,62 @@ theme: icon: material/brightness-4 name: Switch to system preference +plugins: + - glightbox + - search: + enabled: true + nav: - - Home: index.md - - Prerequisites: Prerequisites.md - - Installation: installation.md - - Running APTRS Server: Running.md - - Company: Company.md - - Customer: Customer.md - - Vulnerability Database: Vulnerability-Database.md - - Setting: Setting.md - - Project: Project.md - - Report Template: Report-Template.md + - Getting Started: + - index.md + - Features: getting-started/Features.md + - Project Contribution: getting-started/Contribution.md + - Sponsors: getting-started/Sponsors.md + - Demo: getting-started/demo.md + - License: getting-started/license.md + - Installation: + - installation/install.md + - Docker: installation/docker.md + - Manual: installation/manual.md + - Environment Variables: installation/env.md + - Frontend: installation/frontend.md + - Secure Certificate: installation/certificate.md + - Features: + - Features/index.md + - Dashboard: Features/dashboard/dashboard.md + - Users: Features/Users/users.md + - Company: Features/company/company.md + - Customer: Features/company/customer.md + - Groups and Permissions: Features/permission/permission.md + - Vulnerability DB: Features/vulnerabilityDB/vulnerability.md + - Configuration: Features/configuration/configuration.md + - Project: + - Project View: Features/project/project-view.md + - Project Vulnerability: Features/project/Vulnerability.md + - Project Scope: Features/project/scope.md + - Project Retest: Features/project/retest.md + - Project Report: Features/project/report.md + - Report Customization: + - PDF: + - custom-report/pdf/pdf.md + - Context Variable: custom-report/pdf/context-variable.md + - Project: custom-report/pdf/project.md + - Vulnerability: custom-report/pdf/vulnerability.md + - Company User: custom-report/pdf/company-user.md + - Project Scope: custom-report/pdf/scope.md + - Project Retest: custom-report/pdf/retest.md + - Additional: custom-report/pdf/other.md + - DOCX: + - custom-report/docx/docx.md + - Project: custom-report/docx/project.md + - Vulnerability: custom-report/docx/vulnerability.md + - Company User: custom-report/docx/company-user.md + - Project Scope: custom-report/docx/scope.md + - Project Retest: custom-report/docx/retest.md + - Additional: custom-report/docx/other.md + - API Documentation: API.md + - Change Log: https://github.com/APTRS/APTRS-Changelog/blob/main/README.md" target="_blank + markdown_extensions: @@ -48,6 +97,7 @@ markdown_extensions: - pymdownx.details - pymdownx.superfences - def_list + - tables - pymdownx.tasklist: custom_checkbox: true - pymdownx.superfences @@ -56,10 +106,36 @@ markdown_extensions: slugify: !!python/object/apply:pymdownx.slugs.slugify kwds: case: lower - + - pymdownx.highlight: + pygments_lang_class: true + auto_title: true + line_spans: __span + - pymdownx.critic + - pymdownx.caret + - pymdownx.keys + - pymdownx.mark + + extra: version: provider: mike + social: + - icon: fontawesome/brands/twitter + link: https://twitter.com/ano_f_ + - icon: fontawesome/brands/github + link: https://github.com/Anof-cyber/ + - icon: fontawesome/brands/linkedin + link: https://www.linkedin.com/in/sourav-kalal + - icon: fontawesome/brands/medium + link: https://medium.com/@Ano_F_ + +extra_javascript: + - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js + - https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/prism.min.js + +extra_css: + - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/styles/default.min.css + - https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism-dark.min.css -repo_url: https://github.com/Anof-cyber/APTRS -repo_name: Anof-cyber/APTRS \ No newline at end of file +repo_url: https://github.com/APTRS/APTRS +repo_name: APTRS/APTRS \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..acaf3ac --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +mkdocs-material==9.5.44 +mkdocs-glightbox==0.4.0