Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
---

+ Added workflow files
  • Loading branch information
MatrixEditor committed Mar 22, 2024
1 parent 391aa18 commit 9c58707
Show file tree
Hide file tree
Showing 53 changed files with 2,320 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Credits to https://github.com/stevemao/github-issue-templates
name: "Bug Report"
description: Create a ticket for a recently discovered bug.
title: "[BUG] - <Title>"
labels: [
"bug"
]
body:
- type: textarea
id: description
attributes:
label: "Bug Description"
description: Please enter an explicit description of your issue
placeholder: Short and explicit description of your incident...
validations:
required: True

- type: textarea
id: reprod
attributes:
label: "Reproduction steps"
description: Please enter an explicit description of your issue
value: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
render: bash
validations:
required: true

- type: textarea
id: logs
attributes:
label: "Logs"
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: bash
validations:
required: false

- type: dropdown
id: browsers
attributes:
label: "Browsers"
description: What browsers are you seeing the problem on ?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- Opera
validations:
required: false
57 changes: 57 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# # Credits to https://github.com/stevemao/github-issue-templates
name: "Feature Request"
description: Create a new ticket for a new feature request
title: "[FEATURE] - <Title>"
labels: [
"enhancement",
"question"
]
body:
- type: input
id: implementation_pr
attributes:
label: "Implementation PR"
description: Pull request used
placeholder: "#Pull Request ID"
validations:
required: false
- type: textarea
id: summary
attributes:
label: "Summary"
description: Provide a brief explanation of the feature
placeholder: Describe in a few lines your feature request
validations:
required: true
- type: textarea
id: basic_example
attributes:
label: "Basic Example"
description: Indicate here some basic examples of your feature.
placeholder: A few specific words about your feature request.
validations:
required: true
- type: textarea
id: drawbacks
attributes:
label: "Drawbacks"
description: What are the drawbacks/impacts of your feature request ?
placeholder: Identify the drawbacks and impacts while being neutral on your feature request
validations:
required: false
- type: textarea
id: unresolved_question
attributes:
label: "Unresolved questions"
description: What questions still remain unresolved ?
placeholder: Identify any unresolved issues.
validations:
required: false
- type: textarea
id: reference_issues
attributes:
label: "Referenced Issues"
description: Common issues
placeholder: "#Issues IDs"
validations:
required: false
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
34 changes: 34 additions & 0 deletions .github/workflows/python-sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and Deploy Docs

on:
push:
branches: ["master"]

jobs:
build-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install dependencies
run: pip install -r docs/requirements.docs.txt && pip install -r requirements.txt

- name: Build
# Create .nojekyll file to disable Jekyll processing
run: |
cd docs
make html
touch build/html/.nojekyll
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
16 changes: 16 additions & 0 deletions docs/graph_models.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@echo off

@REM Scan models
py ..\manage.py graph_models -X TimedModel -I Snippet,FindingTemplate,Finding,Vulnerability -g -o source\ref\models\images\finding_models.png

@REM Generate finding-related models
py ..\manage.py graph_models -X TimedModel -I AbstractBaseFinding,Snippet,FindingTemplate,Finding,Vulnerability -g -o source\ref\models\images\finding_models.png

@REM app-permission models
py ..\manage.py graph_models -X TimedModel -I AppPermission,PermissionFinding -g -o source\ref\models\images\app_permission_models.png

@REM dependency models
py ..\manage.py graph_models -X TimedModel -I Package,PackageVulnerability,Dependency -g -o source\ref\models\images\dependency_models.png

@REM code models
py ..\manage.py graph_models -I Environment,Team,Project,File,Account,Bundle,User -g -o source\ref\models\images\base_models.png
16 changes: 16 additions & 0 deletions docs/graph_models.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/bash

# Scan models
python3 ../manage.py graph_models -X TimedModel -I Snippet,FindingTemplate,Finding,Vulnerability -g -o source/ref/models/images/finding_models.png

# Generate finding-related models
python3 ../manage.py graph_models -X TimedModel -I AbstractBaseFinding,Snippet,FindingTemplate,Finding,Vulnerability -g -o source/ref/models/images/finding_models.png

# app-permission models
python3 ../manage.py graph_models -X TimedModel -I AppPermission,PermissionFinding -g -o source/ref/models/images/app_permission_models.png

# dependency models
python3 ../manage.py graph_models -X TimedModel -I Package,PackageVulnerability,Dependency -g -o source/ref/models/images/dependency_models.png

# code models
python3 ../manage.py graph_models -I Environment,Team,Project,File,Account,Bundle,User -g -o source/ref/models/images/base_models.png
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
Binary file added docs/source/_static/arch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/source/android_api/manifest.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. _android_api_manifest:

************************
Android Manifest Visitor
************************

.. automodule:: mastf.android.axml


.. autoclass:: mastf.android.axml._AXmlElement
:members:

.. autoclass:: mastf.android.axml.AXmlVisitorBase
:members:

.. autoclass:: mastf.android.axml.AXmlVisitor
:members:
25 changes: 25 additions & 0 deletions docs/source/android_api/tools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. _android_api_tools:

*************
Android Tools
*************

Apktool
-------

.. automodule:: mastf.android.tools.apktool

.. autofunction:: mastf.android.tools.apktool.run_apktool_decode

.. autofunction:: mastf.android.tools.apktool.extractrsc


Baksmali
--------


.. automodule:: mastf.android.tools.baksmali

.. autofunction:: mastf.android.tools.baksmali.decompile

.. autofunction:: mastf.android.tools.baksmali.to_java
47 changes: 47 additions & 0 deletions docs/source/api/converters.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. _api_converters:

**********
Converters
**********

.. automodule:: mastf.MASTF.converters

The following default converters will be registered on application start:

.. list-table:: Default Converters
:header-rows: 1
:widths: 10, 10, 10

* - Class
- URL name
- Regex
* - :class:`FindingTemplateIDConverter`
- findingtemplateid
- ``r"FT-[\w-]{36}-[\w-]{36}"``
* - :class:`VulnerabilityIDConverter`
- vulnerabilityid
- ``r"SV-[\w-]{36}-[\w-]{36}"``
* - :class:`FindingIDConverter`
- findingid
- ``r"SF-[\w-]{36}-[\w-]{36}"``
* - :class:`MD5Converter`
- md5
- ``r"[0-9a-fA-F]{32}"``
* - :class:`HostIDConverter`
- hostid
- ``r"hst_[\dA-Za-z-]{36}"``
* - :class:`ComponentIdConverter`
- componentid
- ``r"cpt_[\dA-Za-z-]{36}"``
* - :class:`DependencyIdConverter`
- dependencyid
- ``r"([0-9a-fA-F]{32}){2}"``

----------
Components
----------

.. autoclass:: mastf.MASTF.converters.StringConverter
:members:

.. autofunction:: mastf.MASTF.converters.listconverters
41 changes: 41 additions & 0 deletions docs/source/api/forms.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.. _api_forms:

**************
Enhanced Forms
**************

.. automodule:: mastf.MASTF.forms

To get started with the new form fields we've just introduced, let's create a
new form class that will define the fields we want to receive from the client.
Here's an example:

.. code-block:: python
:linenos:
from django import forms
from mastf.MASTF.forms import ModelField
from .models import MyModel
class SampleForm(forms.Form):
field1 = ModelField(MyModel, mapper=int)
field2 = forms.CharField(...)
In this example, we create a new form class called ``SampleForm`` that inherits
from ``forms.Form``. we define a :class:`ModelField` that will use an incoming integer
value as the primary key search value.

.. note::
Values of :class:`ModelField` and :class:`ManyToManyField` fields should be transmitted
as string values as these fields expect a string as input. You can define a *mapper*
function to convert an input string into your preferred primary key value.

---------------
Enhanced Fields
---------------

.. autoclass:: mastf.MASTF.forms.ModelField
:members:

.. autoclass:: mastf.MASTF.forms.ManyToManyField
:members:
10 changes: 10 additions & 0 deletions docs/source/api/middleware.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _api_middleware:

**********
Middleware
**********

.. automodule:: mastf.MASTF.middleware

.. autoclass:: mastf.MASTF.middleware.FirstTimeMiddleware
:members:
Loading

0 comments on commit 9c58707

Please sign in to comment.