Skip to content

Commit

Permalink
Improve status tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Oelgart committed Apr 4, 2019
1 parent be50680 commit 68c4ade
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 25 deletions.
Binary file modified ASVS_v4.0_Checklist.ods
Binary file not shown.
Binary file modified ASVS_v4.0_Checklist.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Script Usage
You most likely won't need this. But if you need to re-parse the CSV into individual files for easier usage, run this:

```shell
$ ./parse_csv resources/OWASP_Application_Security_Verification_Standard_4.0-en.csv
$ ./csvparse resources/OWASP_Application_Security_Verification_Standard_4.0-en.csv
```
38 changes: 26 additions & 12 deletions parse_csv → csvparse
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ namespace {
error('No csv file supplied');
}

$fp = @fopen($argv[1], 'r');
$fp = owasp_asvs\get_input_file_handle($argv[1]);

if ($fp === false) {
error('Unable to read csv file');
}
while (!feof($fp)) {
$elements = fgetcsv($fp);

fgets($fp); // skip header line
if ($elements === false || count($elements) < 8) {
error('Invalid csv file');
}

while (!feof($fp)) {
[, $name, $item, $desc, $l1, $l2, , $cwe] = fgetcsv($fp);
[ , $name, $item, $desc, $l1, $l2, , $cwe] = $elements;

owasp_asvs\write($name, [$item, owasp_asvs\level($l1, $l2), $desc, $cwe]);
owasp_asvs\write($name, [$item, $cwe, owasp_asvs\level($l1, $l2), $desc]);
}
}

Expand Down Expand Up @@ -51,20 +51,34 @@ namespace owasp_asvs {
error('Invalid category name');
}

$handles[$name] = @fopen(__DIR__ . "/parsed/{$name}.csv", 'w+');
$handle = @fopen(__DIR__ . "/parsed/{$name}.csv", 'w+');

if ($handles[$name] === false) {
if ($handle === false) {
error('Unable to open output file');
}

register_shutdown_function(function () use ($handles, $name) {
fclose($handles[$name]);
$handles[$name] = $handle;

register_shutdown_function(function () use (&$handle) {
fclose($handle);
});
}

return $handles[$name];
}

function get_input_file_handle(string $path)
{
$fp = @fopen($path, 'r');

if ($fp === false) {
error('Unable to read csv file');
}

fgets($fp);
return $fp; // skip header line
}

function error(string $message): void
{
echo $message, PHP_EOL;
Expand Down
12 changes: 0 additions & 12 deletions macros/onEdit.js

This file was deleted.

Binary file modified resources/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 68c4ade

Please sign in to comment.