api

package
v0.0.0-...-00fa4f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiHandler

type ApiHandler struct {
	DbURI          string
	ScreenshotPath string
	Runners        map[int]*runner.Runner
	RunnerCounter  int
	DB             *gorm.DB
	Wappalyzer     *wappalyzer.Wappalyze
}

ApiHandler is an API handler

func NewApiHandler

func NewApiHandler(uri string, screenshotPath string) (*ApiHandler, error)

NewApiHandler returns a new ApiHandler

func (*ApiHandler) DeleteResultHandler

func (h *ApiHandler) DeleteResultHandler(w http.ResponseWriter, r *http.Request)

DeleteResultHandler deletes results from the database

@Summary		Delete a result
@Description	Deletes a result, by id, and all of its associated data from the database.
@Tags			Results
@Accept			json
@Produce		json
@Param			query	body		deleteResultRequest	true	"The result ID to delete"
@Success		200		{string}	string				"ok"
@Router			/results/delete [post]

func (*ApiHandler) DetailHandler

func (h *ApiHandler) DetailHandler(w http.ResponseWriter, r *http.Request)

DetailHandler returns the detail for a screenshot

@Summary		Results detail
@Description	Get details for a result.
@Tags			Results
@Accept			json
@Produce		json
@Param			id	path		int	true	"The screenshot ID to load."
@Success		200	{object}	models.Result
@Router			/results/detail/{id} [get]

func (*ApiHandler) GalleryHandler

func (h *ApiHandler) GalleryHandler(w http.ResponseWriter, r *http.Request)

GalleryHandler gets a paginated gallery

@Summary		Gallery
@Description	Get a paginated list of results.
@Tags			Results
@Accept			json
@Produce		json
@Param			page			query		int		false	"The page to load."
@Param			limit			query		int		false	"Number of results per page."
@Param			tags			query		string	false	"A comma separated list of technologies to filter by."
@Param			technologies	query		string	false	"A comma separated list of technologies to filter by."
@Param			status			query		string	false	"A comma separated list of HTTP status codes to filter by."
@Param			perception		query		boolean	false	"Order the results by perception hash."
@Param			failed			query		boolean	false	"Include failed screenshots in the results."
@Success		200				{object}	galleryResponse
@Router			/results/gallery [get]

func (*ApiHandler) ListHandler

func (h *ApiHandler) ListHandler(w http.ResponseWriter, r *http.Request)

ListHandler returns a simple list of results

@Summary		Results list
@Description	Get a simple list of all results.
@Tags			Results
@Accept			json
@Produce		json
@Success		200	{object}	listResponse
@Router			/results/list [get]

func (*ApiHandler) PingHandler

func (h *ApiHandler) PingHandler(w http.ResponseWriter, r *http.Request)

PingHandler handles ping requests

@Summary		Ping the server
@Description	Returns a simple "pong" response to test server availability.
@Tags			Health
@Accept			json
@Produce		json
@Success		200	{string}	string	"pong"
@Router			/api/ping [get]

func (*ApiHandler) ResponseCodeListHandler

func (h *ApiHandler) ResponseCodeListHandler(w http.ResponseWriter, r *http.Request)

ResponseCodeListHandler lists response codes

@Summary		Get response codes
@Description	Get all unique response codes.
@ResponseCodes	Results
@Accept			json
@Produce		json
@Success		200	{object}	responseCodeListResponse
@Router			/results/responsecode [get]

func (*ApiHandler) RunnersHandler

func (h *ApiHandler) RunnersHandler(w http.ResponseWriter, r *http.Request)

RunnersHandler returns runner statistics

@Summary		Runner statistics
@Description	Get runner statistics.
@Tags			Results
@Accept			json
@Produce		json
@Success		200	{object}	runnersResponse
@Router			/runners [get]

func (*ApiHandler) SearchHandler

func (h *ApiHandler) SearchHandler(w http.ResponseWriter, r *http.Request)

SearchHandler handles search

@Summary		Search for results
@Description	Searches for results based on free form text, or operators.
@Tags			Results
@Accept			json
@Produce		json
@Param			query	body		searchRequest	true	"The search term to search for. Supports search operators: `title:`, `tech:`, `header:`, `body:`, `p:`"
@Success		200		{object}	searchResult
@Router			/search [post]

func (*ApiHandler) StatisticsHandler

func (h *ApiHandler) StatisticsHandler(w http.ResponseWriter, r *http.Request)

StatisticsHandler returns database statistics

@Summary		Database statistics
@Description	Get database statistics.
@Tags			Results
@Accept			json
@Produce		json
@Success		200	{object}	statisticsResponse
@Router			/statistics [get]

func (*ApiHandler) SubmitHandler

func (h *ApiHandler) SubmitHandler(w http.ResponseWriter, r *http.Request)

SubmitHandler submits URL's for scans, writing them to the database.

@Summary		Submit URL's for scanning
@Description	Starts a new scanning routine for a list of URL's and options, writing results to the database.
@Tags			Results
@Accept			json
@Produce		json
@Param			query	body		submitRequest	true	"The URL scanning request object"
@Success		200		{string}	string			"Probing started"
@Router			/submit [post]

func (*ApiHandler) SubmitSingleHandler

func (h *ApiHandler) SubmitSingleHandler(w http.ResponseWriter, r *http.Request)

SubmitSingleHandler submits a URL to scan, returning the result.

@Summary		Submit a single URL for probing
@Description	Starts a new probing routine for a URL and options, returning the results when done.
@Tags			Results
@Accept			json
@Produce		json
@Param			query	body		submitSingleRequest	true	"The URL scanning request object"
@Success		200		{object}	models.Result		"The URL Result object"
@Router			/submit/single [post]

func (*ApiHandler) TagListHandler

func (h *ApiHandler) TagListHandler(w http.ResponseWriter, r *http.Request)

TagListHandler lists tags

@Summary		Get tag results
@Description	Get all unique tags.
@Tags			Results
@Accept			json
@Produce		json
@Success		200	{object}	tagListResponse
@Router			/results/tag [get]

func (*ApiHandler) TechnologyListHandler

func (h *ApiHandler) TechnologyListHandler(w http.ResponseWriter, r *http.Request)

TechnologyListHandler lists technologies

@Summary		Get technology results
@Description	Get all the unique technology detected.
@Tags			Results
@Accept			json
@Produce		json
@Success		200	{object}	technologyListResponse
@Router			/results/technology [get]

func (*ApiHandler) WappalyzerHandler

func (h *ApiHandler) WappalyzerHandler(w http.ResponseWriter, r *http.Request)

WappalyzerHandler returns wappalyzer data

@Summary		Get wappalyzer data
@Description	Get all of the available wappalyzer data.
@Tags			Results
@Accept			json
@Produce		json
@Success		200	{object}	map[string]string
@Router			/wappalyzer [get]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL