Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Database #260

Closed
wants to merge 162 commits into from
Closed

Local Database #260

wants to merge 162 commits into from

Conversation

vifor2
Copy link
Contributor

@vifor2 vifor2 commented Mar 17, 2019

Feature functional although it could use some improvements, but since there is less than 1 week before the end of the project @zer0x64 and me would like to get this merged ASAP. Also to cease the merge conflicts.

Scroll down for TL;DR

Changes done within this PR :

  • User can input --result-format with either json or sqlite as args.
  • Imports of scoutsuite-results/scoutsuite_results.js and scoutsuite-results/scoutsuite_exceptions.js are no longer in report.html by default, they are instead in a partial that is added if the user chose json in the previous point.
  • scoutsuite.js now checks whether an element with the id json_format or sqlite_format exists to know which functions to call.
  • When choosing SQLite all of the user's data is saved as a .db file instead of a .js file, these files being more compact as well as readable by a server.
  • User can input arguments related to the server (reminder: we have decided that when the user selects SQLite he must then enter a second command to run the server, it will not be launched automatically).
  • Exposed all of the data saved in the .db file to our client through CherryPy.
  • Modified all .js files to follow standardJS, there are still some changes to do.
  • All data except resource pages other than the first one are fetched at the start and properly viewable within the report.
  • Added Back and Next buttons to change page, pressing one of those buttons disables it if you're at the page limit afterwards ([0, totalResources / pageSize - 1]), it removes the data of the previous resource from memory (run_results) and add the new page to it, it then overwrites the current template with the same one but with the new data within it.
  • Page size is currently hard-coded it would be nice to give the option to the user of choosing the size but Id rather get this issue done and merged beforehand. Same with more buttons to go to first page, last page, page at a specific index, modal that tells the user to make sure his port 8000 is freed and the server is running, etc.
  • I know that when we talked I said Id keep the paging buttons on both result formats but for now the buttons are disabled when viewing a report in JSON format (it should look as if nothing had happened) while the SQLite one have 2 buttons.
  • Merged develop and it's new architecture into this branch (to do again it seems).

Known issues :

  • Works with Firefox but not with Chrome, will discuss about this issue tomorrow with @j4v : jquery-3.3.1.min.js:2 Access to XMLHttpRequest at 'file:///home/vifor2/Documents/ScoutSuite/scoutsuite-report/inc-scoutsuite/sqlite.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
  • Items in the navbar are not in alphabetical order although they are in the JavaScript object (I'm bamboozled).
  • Constant error when used with Firefox although it doesn't seem to actually cause any problem : XML Parsing Error: syntax error Location: file:///home/vifor2/Documents/ScoutSuite/scoutsuite-report/inc-scoutsuite/sqlite.js Line Number 1, Column 1:
  • Initial data loading is a bit long compared to other providers because of the 16 regions per resource.

TL;DR

Example with Azure

While in /ScoutSuite open two terminals, in the first one type in azure --cli --serve and in the second one your usual command followed by --result-format sqlite, you can then view the report has usually excepted for the fact that you'll have buttons to load in/out new pages.

Example with GCP

Same as concept as Azure but replace the first command with gcp --user-account --serve

Example with AWS

Same concept as previous ones but replace the first command with aws --serve

@vifor2 vifor2 added enhancement New feature or request component-core Affects core refactoring WIP labels Mar 17, 2019
@vifor2 vifor2 self-assigned this Mar 17, 2019
@@ -0,0 +1,162 @@
var defaultPageSize = 2
var regionPageSize = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use const?

Suggested change
var regionPageSize = 1
const regionPageSize = 1

@@ -0,0 +1,162 @@
var defaultPageSize = 2
Copy link
Contributor

@Aboisier Aboisier Apr 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as below.

Suggested change
var defaultPageSize = 2
const defaultPageSize = 2

if type(o) == datetime.datetime:
return str(o)
else:
# remove unwanted attributes from the provider object during conversion to json
Copy link
Contributor

@Aboisier Aboisier Apr 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll be able to delete that when #183 will be fully merged since those won't exist anymore.

Co-Authored-By: zer0x64 <17575242+zer0x64@users.noreply.github.com>
@vifor2 vifor2 closed this Apr 9, 2019
Scout Suite automation moved this from In progress to Done Apr 9, 2019
@vifor2 vifor2 mentioned this pull request Apr 9, 2019
@zer0x64 zer0x64 deleted the feature/226-local-database branch April 9, 2019 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-core Affects core enhancement New feature or request refactoring
Projects
No open projects
Scout Suite
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants