core

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyzeHTML

func AnalyzeHTML(response *WebsiteResponse) (types.WebsiteAnalysis, error)

AnalyzeHTML extracts scripts, styles, and metadata from the parsed HTML.

func CloseBrowser

func CloseBrowser()

CloseBrowser terminates the rod browser instance.

func CreateScanHandler

func CreateScanHandler(taskScheduler *TaskScheduler) fiber.Handler

@Summary Create a new scan @Description Create a new scan @Tags scans @Accept json @Produce json @Param scan body models.ScanRequest true "Scan Request" @Success 200 {object} responder.APIResponse{data=models.ScanAPIResponse} @Failure 400 {object} responder.APIResponse{error=responder.APIError} @Failure 404 {object} responder.APIResponse{error=responder.APIError} @Router /scans [post]

func GetJob

func GetJob(c *fiber.Ctx) error

@Summary Get a job @Description Get a job @Tags jobs @Accept json @Produce json @Param jobID path string true "Job ID" @Success 200 {object} responder.APIResponse{data=models.JobAPIResponse} @Failure 400 {object} responder.APIResponse{error=responder.APIError} @Failure 404 {object} responder.APIResponse{error=responder.APIError} @Router /jobs/{jobID} [get]

func GetScan

func GetScan(c *fiber.Ctx) error

@Summary Get a scan @Description Get a scan @Tags scans @Accept json @Produce json @Param scanID path string true "Scan ID" @Success 200 {object} responder.APIResponse{data=models.ScanAPIResponse} @Failure 400 {object} responder.APIResponse{error=responder.APIError} @Failure 404 {object} responder.APIResponse{error=responder.APIError} @Router /scans/{scanID} [get]

func GetScans

func GetScans(c *fiber.Ctx) error

@Summary Get all scans @Description Get all scans @Tags scans @Accept json @Produce json @Success 200 {object} responder.APIResponse{data=[]models.ScanAPIResponse} @Failure 400 {object} responder.APIResponse{error=responder.APIError} @Failure 404 {object} responder.APIResponse{error=responder.APIError} @Router /scans [get]

func InitializeBrowser

func InitializeBrowser()

InitializeBrowser sets up the rod browser instance.

func RegisterCoreRouter

func RegisterCoreRouter(router fiber.Router) error

Types

type Inspector

type Inspector struct {
	// contains filtered or unexported fields
}
var InspectorCore *Inspector

func NewInspector

func NewInspector() *Inspector

NewInspector initializes the Inspector with necessary dependencies

func (*Inspector) Execute

func (i *Inspector) Execute(job *entities.JobModel) error

Execute performs the scan based on the job type

type TaskScheduler

type TaskScheduler struct {
	// contains filtered or unexported fields
}

TaskScheduler manages job queueing, dispatching, and archiving

var Scheduler *TaskScheduler

func NewTaskScheduler

func NewTaskScheduler(workerCount int) *TaskScheduler

NewTaskScheduler initializes TaskScheduler

func (*TaskScheduler) AddJob

func (s *TaskScheduler) AddJob(job *entities.JobModel)

AddJob adds a new task to the queue

func (*TaskScheduler) GetArchivedJob

func (s *TaskScheduler) GetArchivedJob(jobID string) *entities.JobModel

GetArchivedJob retrieves a job from the archivedJobs list by ID

func (*TaskScheduler) GetJob

func (s *TaskScheduler) GetJob(jobID string) *entities.JobModel

GetJob retrieves a job from the queue by ID

func (*TaskScheduler) Start

func (s *TaskScheduler) Start(inspector *Inspector)

Start continuously processes tasks from the queue

type WebsiteResponse

type WebsiteResponse struct {
	Redirects    []types.Redirect
	Files        []types.FileRequest
	FinalHTML    string
	ParsedHTML   *html.Node
	WebsiteTitle string
}

func FetchWebsite

func FetchWebsite(url, userAgent string) (*WebsiteResponse, error)

FetchWebsite retrieves the website content and its network resources.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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