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

Added search to the api, and postgres support for DB #166

Merged
merged 8 commits into from
May 7, 2023

Conversation

habitualdev
Copy link
Contributor

@habitualdev habitualdev commented Dec 7, 2022

I plan on using this at a larger scale, one where it would be good to have an externally accessible database, as well as a search handler being added to the API.

Took advantage of the existing gorm usage to add a simple flag to point to a postgresql DB (confirmed working with both local and remote servers). As of now takes a fully qualified PSQL DSN. Database type is switched with the "t" flag. SQLite remains the default, changing type to "1" allows using postgresql.
Example Command:

Mostly cloned the existing search handler behind the UI, and just returning the JSON.

@leonjza
Copy link
Member

leonjza commented May 3, 2023

@habitualdev sorry for taking so long on this one. could you rebase this pr perhaps?

I also want to suggest we dont add another flag, but rather, parse a URI scheme to determine the database type to use. Eg. sqlite://database.sqlite and postgres://user:pass@host.

@habitualdev
Copy link
Contributor Author

habitualdev commented May 3, 2023

@habitualdev sorry for taking so long on this one. could you rebase this pr perhaps?

I also want to suggest we dont add another flag, but rather, parse a URI scheme to determine the database type to use. Eg. sqlite://database.sqlite and postgres://user:pass@host.

Yeah, I can do that. I'll spiff it up and rebase. What do you think about storing the screenshots in the DB as well? I ended up adding it on my fork to just keep everything together.

@leonjza
Copy link
Member

leonjza commented May 3, 2023

Yeah, I can do that. I'll spiff it up and rebase.

Amazing. I'm hoping to cut a new release today as well :)

What do you think about storing the screenshots in the DB as well? I ended up adding it on my fork to just keep everything together.

I think we can add this as a flag for those that would want that maybe, keeping the original filesystem storage behaviour as default. I think most use this vs the reporting server so that they can use any tool to flick through screenshots (or process them further using other tools).

@leonjza leonjza merged commit 229e079 into sensepost:master May 7, 2023
leonjza added a commit that referenced this pull request May 7, 2023
* Change database screenshot saving to be flag controllable
* Remove platform selection flag and instead rely on URI parsing
* Add check to prevent empty search api query string
* Display screenshots from db if available, otherwise fallback to fs
@leonjza
Copy link
Member

leonjza commented May 7, 2023

Thanks for the PR! I made some tweaks in 62d6de3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants