From ba37a5565b0a42d51d019174a3cddc7466218812 Mon Sep 17 00:00:00 2001 From: Gianni Carafa Date: Tue, 3 Aug 2021 11:25:17 +0200 Subject: [PATCH] imrove OS detection --- app/Http/Controllers/ReportController.php | 1 + .../2020_12_30_100000_create_target_trivy.php | 1 + .../2021_08_03_100000_add_target_os.php | 39 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 database/migrations/2021_08_03_100000_add_target_os.php diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index e3f44fb..95559d0 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -151,6 +151,7 @@ public function apiCreateVuln($report_uid, $image_uid, Request $request) $i->image_uid = $image_uid; $i->target = $target['Target']; $i->target_type = $target['Type']; + $i->is_os = filter_var($target['isOS'], FILTER_VALIDATE_BOOLEAN); $i->save(); if (isset($target['Vulnerabilities'])) { foreach ($target['Vulnerabilities'] as $vuln) { diff --git a/database/migrations/2020_12_30_100000_create_target_trivy.php b/database/migrations/2020_12_30_100000_create_target_trivy.php index be07149..b965e8c 100644 --- a/database/migrations/2020_12_30_100000_create_target_trivy.php +++ b/database/migrations/2020_12_30_100000_create_target_trivy.php @@ -21,6 +21,7 @@ public function up() target_type character varying COLLATE pg_catalog."default", report_uid character varying COLLATE pg_catalog."default", image_uid character varying COLLATE pg_catalog."default", + is_os boolean, CONSTRAINT k_target_trivy_pkey PRIMARY KEY (uid), CONSTRAINT k_target_trivy_report_uid_fkey FOREIGN KEY (report_uid) REFERENCES public.k_reports (uid) MATCH SIMPLE diff --git a/database/migrations/2021_08_03_100000_add_target_os.php b/database/migrations/2021_08_03_100000_add_target_os.php new file mode 100644 index 0000000..e9ece09 --- /dev/null +++ b/database/migrations/2021_08_03_100000_add_target_os.php @@ -0,0 +1,39 @@ +