server

package
v0.0.0-...-815c261 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

var DB *gorm.DB

Functions

func CommandBuilder

func CommandBuilder(taskData *TaskData) string

CommandBuilder build core command from API

func DeleteWorkspace

func DeleteWorkspace(c *fiber.Ctx) error

func EnableSSL

func EnableSSL(options libs.Options) error

EnableSSL do some check when ssl enabled

func GenerateSSL

func GenerateSSL(certFile string, keyFile string) bool

GenerateSSL generate SSL key

func Health

func Health(c *fiber.Ctx) error

Health is a function to get all books data from database @Summary Get all books @Description Get all books @Tags books @Accept json @Produce json @Success 200 {object} ResponseHTTP{} @Failure 503 {object} ResponseHTTP{} @Router /v1/books [get]

func HelperMessage

func HelperMessage(c *fiber.Ctx) error

func ListAllScan

func ListAllScan(c *fiber.Ctx) error

func ListFlows

func ListFlows(c *fiber.Ctx) error

func ListWorkspaces

func ListWorkspaces(c *fiber.Ctx) error

Workspace is a function to get all books data from database @Summary Get all books @Description Get all books @Tags books @Accept json @Produce json @Success 200 {object} ResponseHTTP{} @Router /v1/workspaces [get]

func Login

func Login(c *fiber.Ctx) error

func NewScan

func NewScan(c *fiber.Ctx) error

NewScan new scan

func NewScanCloud

func NewScanCloud(c *fiber.Ctx) error

NewScanCloud new scan

func Ping

func Ping(c *fiber.Ctx) error

Ping is a function to get all books data from database @Summary Get all books @Description Get all books @Tags books @Accept json @Produce json @Success 200 {object} ResponseHTTP{} @Failure 503 {object} ResponseHTTP{} @Router /v1/books [get]

func Process

func Process(c *fiber.Ctx) error

func RawWorkspace

func RawWorkspace(c *fiber.Ctx) error

func SaveTargets

func SaveTargets(targets []string) string

SaveTargets save upload data to /tmp/osm-input/data-osm-xxx.txt

func SetupRoutes

func SetupRoutes(app *fiber.App)

SetupRoutes setup router api

func StartServer

func StartServer(options libs.Options)

func Upload

func Upload(c *fiber.Ctx) error

Upload testing authenticated connection

func WorkspaceDetail

func WorkspaceDetail(c *fiber.Ctx) error

Types

type ResponseHTTP

type ResponseHTTP struct {
	Status  int         `json:"status"`
	Data    interface{} `json:"data"`
	Type    string      `json:"type,omitempty"`
	Total   int         `json:"total,omitempty"`
	Message string      `json:"message"`
}

ResponseHTTP represents response body of this API

type TaskData

type TaskData struct {
	MasterPassword string `json:"password"`
	Binary         string `json:"binary"`
	// override everything below
	Command string `json:"command"`

	// these two not be blank when run with plugins
	WorkFlow   string `json:"workflow"`
	PluginName string `json:"plugin"`
	ScanID     string `json:"scan_id"`

	// for select scan + task
	Workspace   string   `json:"workspace"`
	Target      string   `json:"target"`
	TargetsList []string `json:"targets"`
	TargetsFile string   `json:"targets_file"`

	AliveAssets bool `json:"alive_assets"` // skip targets part and select the assets from DB
	AllAssets   bool `json:"all_assets"`   // skip targets part and select the assets from DB

	// just more mics info for custom command later
	Params      []string `json:"params"`
	Timeout     string   `json:"timeout"`
	Concurrency int      `json:"concurrency"`

	// enable distributed scan
	Distributed bool `json:"distributed"`

	// for chunk mode only
	Threads      int  `json:"threads"`
	Chunk        bool `json:"chunk"`
	TargetAsFile bool `json:"as_file"`

	// only select record not run the command
	RawName  bool `json:"RawName"`
	WildCard bool `json:"wildcard"`
	ViewOnly bool `json:"view_only"`
	Debug    bool `json:"debug"`
	Test     bool `json:"test"`
}

TaskData data required in json form

type UploadData

type UploadData struct {
	Data     string `json:"data"`
	Filename string `json:"filename"`
}

UploadData data required in json form

Jump to

Keyboard shortcuts

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