Skip to content

Commit

Permalink
Ensure ScriptsRead works with audit_windows.ps1 (even though there ar…
Browse files Browse the repository at this point in the history
…e no configurable options).
  • Loading branch information
mark-unwin committed Aug 1, 2024
1 parent f48a127 commit 9979f45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/Helpers/scripts_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ function scripts_collections_options()
$options_scripts['audit_osx.sh'] = array('submit_online', 'create_file', 'url', 'debugging', 'org_id');
$options_scripts['audit_solaris.sh'] = array('submit_online', 'create_file', 'url', 'debugging', 'org_id', 'system_id');
$options_scripts['audit_windows.vbs'] = array('audit_dns', 'audit_mount_point', 'audit_netstat', 'audit_software', 'audit_win32_product', 'create_file', 'debugging', 'details_to_lower', 'hide_audit_window', 'ignore_invalid_ssl', 'ldap', 'ldap_seen_date', 'ldap_seen_days', 'org_id', 'ping_target', 'san_audit', 'san_discover', 'self_delete', 'strcomputer', 'strpass', 'struser', 'submit_online', 'system_id', 'url', 'use_proxy', 'windows_user_work_1', 'windows_user_work_2');
$options_scripts['audit_windows.ps1'] = array();

return $options_scripts;
}
Expand Down
14 changes: 8 additions & 6 deletions app/Models/ScriptsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,14 @@ public function includedRead(int $id = 0): array
$files = $filesModel->listUser();
$filtered_files = array();
$included['files'] = array();
foreach ($files as $file) {
if ($script[0]->attributes->based_on === 'audit_windows.vbs' and strpos($file->attributes->path, '/') !== 0) {
$included['files'][] = $file;
}
if ($script[0]->attributes->based_on !== 'audit_windows.vbs' and strpos($file->attributes->path, '/') === 0) {
$included['files'][] = $file;
if ($script[0]->attributes->based_on !== 'audit_windows.ps1') {
foreach ($files as $file) {
if ($script[0]->attributes->based_on === 'audit_windows.vbs' and strpos($file->attributes->path, '/') !== 0) {
$included['files'][] = $file;
}
if ($script[0]->attributes->based_on !== 'audit_windows.vbs' and strpos($file->attributes->path, '/') === 0) {
$included['files'][] = $file;
}
}
}
return $included;
Expand Down

0 comments on commit 9979f45

Please sign in to comment.