server

package
v0.0.0-...-dfe0916 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQLInjectionMessage = "SQL Injection detected"
)

Variables

This section is empty.

Functions

func CallerSignature

func CallerSignature() string

func CheckFullSQLForInjection

func CheckFullSQLForInjection(sql string) bool

func CheckParametersForInjection

func CheckParametersForInjection(c *gin.Context) bool

func DefaultHandler404

func DefaultHandler404(c *gin.Context)

func DefaultHandlerFatal

func DefaultHandlerFatal(c *gin.Context)

func Main

func Main(set *flag.FlagSet, args []string)

func MakeHandler

func MakeHandler(handler func(c *gin.Context) (*Response, error)) gin.HandlerFunc

Types

type GetUserByID

type GetUserByID struct {
	ID string `uri:"id"`
}

type Response

type Response struct {
	Code    int         `json:"code"`
	Status  int         `json:"status"`
	Success bool        `json:"success"`
	Message string      `json:"message,omitempty"`
	Details []string    `json:"details,omitempty"`
	Data    interface{} `json:"data"`
}

func NotFound

func NotFound(key interface{}) (*Response, error)

func Success

func Success(data interface{}) (*Response, error)

type SQLInjectionServer

type SQLInjectionServer struct {
	Database       *sql.DB
	ProtectPartial bool
	ProtectFull    bool
}

func NewServer

func NewServer(dsn string, protectPartial bool, protectFull bool) (*SQLInjectionServer, error)

func (*SQLInjectionServer) AddUser

func (s *SQLInjectionServer) AddUser(c *gin.Context) (*Response, error)

func (*SQLInjectionServer) DeleteUser

func (s *SQLInjectionServer) DeleteUser(c *gin.Context) (*Response, error)

func (*SQLInjectionServer) GetUser

func (s *SQLInjectionServer) GetUser(c *gin.Context) (*Response, error)

func (*SQLInjectionServer) Init

func (s *SQLInjectionServer) Init() error

func (*SQLInjectionServer) ListUsers

func (s *SQLInjectionServer) ListUsers(c *gin.Context) (*Response, error)

func (*SQLInjectionServer) MakeHandler

func (s *SQLInjectionServer) MakeHandler(handler func(c *gin.Context) (*Response, error)) gin.HandlerFunc

func (*SQLInjectionServer) RunSQL

func (s *SQLInjectionServer) RunSQL(base string, args ...interface{}) (*sql.Rows, error)

func (*SQLInjectionServer) Serve

func (s *SQLInjectionServer) Serve(port int) error

func (*SQLInjectionServer) UserQuery

func (s *SQLInjectionServer) UserQuery(c *gin.Context) (*Response, error)

type User

type User struct {
	ID       int
	Name     string
	Password string
	Age      int
}

Jump to

Keyboard shortcuts

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