From 9507f42f5c6b043604ca285b8b602df810d547a9 Mon Sep 17 00:00:00 2001 From: Gareth Lawson Date: Sun, 16 Jul 2017 16:42:31 +0200 Subject: [PATCH] Add constants and convenience methods related to auto scanning --- app/Entities/ScannerApp.php | 18 ++++++++++++++++++ app/Entities/Workspace.php | 4 ++++ app/Entities/WorkspaceApp.php | 4 ++++ 3 files changed, 26 insertions(+) diff --git a/app/Entities/ScannerApp.php b/app/Entities/ScannerApp.php index 44fcdb1..39d4704 100644 --- a/app/Entities/ScannerApp.php +++ b/app/Entities/ScannerApp.php @@ -3,6 +3,7 @@ namespace App\Entities; use Doctrine\ORM\Mapping as ORM; +use Illuminate\Support\Collection; /** * App\Entities\ScannerApp @@ -18,4 +19,21 @@ class ScannerApp extends Base\ScannerApp const SCANNER_NETSPARKER = 'netsparker'; const SCANNER_NESSUS = 'nessus'; const SCANNER_RUGGEDY = 'ruggedy'; + + /** + * Get a Collection of available scanner apps + * + * @return Collection + */ + public static function getScannerApps(): Collection + { + return collect([ + self::SCANNER_NMAP, + self::SCANNER_BURP, + self::SCANNER_NEXPOSE, + self::SCANNER_NETSPARKER, + self::SCANNER_NESSUS, + self::SCANNER_RUGGEDY, + ]); + } } \ No newline at end of file diff --git a/app/Entities/Workspace.php b/app/Entities/Workspace.php index 9024cdb..21f02e6 100644 --- a/app/Entities/Workspace.php +++ b/app/Entities/Workspace.php @@ -14,6 +14,10 @@ */ class Workspace extends Base\Workspace implements SystemComponent { + const AUTO_SCAN_WORKSPACE_NAME = 'Automatic Scans'; + const AUTO_SCAN_WORKSPACE_DESCRIPTION = 'This Workspace is created automatically to contain scan results from ' + . 'files that are picked up in the auto_scan directory and processed automagically.'; + /** * @ORM\ManyToOne(targetEntity="User", inversedBy="workspaces", cascade={"persist"}, fetch="EAGER") * @ORM\JoinColumn(name="`user_id`", referencedColumnName="`id`", nullable=false) diff --git a/app/Entities/WorkspaceApp.php b/app/Entities/WorkspaceApp.php index fbcea86..25cead3 100644 --- a/app/Entities/WorkspaceApp.php +++ b/app/Entities/WorkspaceApp.php @@ -20,6 +20,10 @@ class WorkspaceApp extends Base\WorkspaceApp implements SystemComponent const DEFAULT_NAME = 'Unnamed'; const DEFAULT_DESCRIPTION = 'No description given. Please add a relevant description.'; + const AUTO_SCAN_WORKSPACE_APP_NAME = 'Automatic Scans'; + const AUTO_SCAN_WORKSPACE_APP_DESCRIPTION = 'This Workspace App is created automatically to contain scan results ' + . 'from files that are picked up in the auto_scan directory and processed automagically.'; + /** * @ORM\OneToMany(targetEntity="File", mappedBy="workspaceApp", cascade={"persist", "remove"}) * @ORM\JoinColumn(name="`id`", referencedColumnName="`workspace_apps_id`", nullable=false)