web

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// YesiscanCookieNameBackends is the name of the cookie used to store
	// backend settings.
	YesiscanCookieNameBackends = "yesiscan_backends"

	// YesiscanCookieNameProfiles is the name of the cookie used to store
	// profiles settings.
	YesiscanCookieNameProfiles = "yesiscan_profiles"
)

Variables

This section is empty.

Functions

func ReturnOutputHtml

func ReturnOutputHtml(output *lib.Output) (string, error)

ReturnOutputHtml returns a string of output, formatted in html.

func ReturnOutputHtmlBody added in v0.0.8

func ReturnOutputHtmlBody(output *lib.Output) (string, error)

ReturnOutputHtmlBody returns a string of output, formatted in html. It is the body portion of the larger full html output that comes from ReturnOutputHtml.

Types

type LogWriter

type LogWriter struct {
	Logf func(format string, v ...interface{})
}

func (*LogWriter) Write

func (obj *LogWriter) Write(p []byte) (n int, err error)

type Report

type Report struct {
	Program string `json:"program"`
	Version string `json:"version"`

	// Uri is the input URI used for the scan.
	Uri string `json:"uri"`

	// Backends are a map of specified backens that users may enable.
	Backends map[string]bool `json:"backends"`

	// Profiles are a set of specified profile names that users may specify.
	Profiles map[string]bool `json:"profiles"`

	// Html is a rendered version of the core report content.
	// XXX: we might choose to store the data itself in the future...
	Html string `json:"html"`
}

Report is the struct containing everything from scanning.

type Server

type Server struct {
	Program string
	Version string
	Debug   bool
	Logf    func(format string, v ...interface{})

	// Profiles is the list of profiles to allow. Either the names from
	// ~/.config/yesiscan/profiles/<name>.json or full paths.
	Profiles []string

	// Listen is the ip/port combination for the server to listen on. If it
	// is empty, then a default is used. For example, you might specify:
	// "127.0.0.1:8000" or just ":8000".
	Listen string
	// contains filtered or unexported fields
}

Server is our web server struct.

func (*Server) Load

func (obj *Server) Load(uid string) (*Report, error)

TODO: consider adding a context.Context TODO: we have no auth on this at the moment, anyone can lookup a report

func (*Server) Router

func (obj *Server) Router() *gin.Engine

func (obj *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {

func (*Server) Run

func (obj *Server) Run(ctx context.Context) error

func (*Server) Store

func (obj *Server) Store(report *Report) (string, error)

TODO: consider adding a context.Context

Jump to

Keyboard shortcuts

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