Documentation
¶
Overview ¶
Seclang Parser. Thanks to the go-lua project. The scanner referenced some of the go-lua scanner implementations. https://github.com/Shopify/go-lua
Index ¶
- Constants
- Variables
- func RegisterDir(tk int, name string, f DirectiveFactory)
- func RegisterValue(tk int, regex string)
- type Action
- type Actions
- type BoolArgDirective
- type Directive
- type DirectiveDesc
- type DirectiveFactory
- type Operator
- type RuleDirective
- type Scanner
- func (s *Scanner) AllDirective() ([]Directive, error)
- func (s *Scanner) ReadActions() (*Actions, error)
- func (s *Scanner) ReadDirective() (Directive, error)
- func (s *Scanner) ReadOperator() (*Operator, error)
- func (s *Scanner) ReadString() (string, error)
- func (s *Scanner) ReadValue(tks ...int) (int, string, error)
- func (s *Scanner) ReadVariables() ([]*Variable, error)
- func (s *Scanner) ReadWord() string
- func (s *Scanner) SkipBlank() error
- func (s *Scanner) StartsWith(str string) bool
- type StringArgDirective
- type Trans
- type TriBoolArgDirective
- type ValueDesc
- type Variable
Constants ¶
View Source
const ( // begin of stream BOS = -1 // end of stream EOS = -2 )
View Source
const ( TriBoolTrue = 1 TriBoolElse = 2 TriBoolFalse = 0 )
View Source
const ( // directives TkDirRule = iota + TkStart TkDirRuleEng TkDirReqBody TkDirResBody TkValueElse TkValueOff TkValueOn // variables TkVarArgs TkVarArgsGet TkVarArgsGetNames TkVarArgsPost TkVarArgsPostNames TkVarArgsCombinedSize TkVarArgsNames TkVarQueryString TkVarRemoteAddr TkVarRequestBasename TkVarRequestBody TkVarRequestCookies TkVarRequestCookiesNames TkVarRequestFilename TkVarRequestHeaders TkVarRequestHeadersNames TkVarRequestMethod TkVarRequestProtocol TkVarRequestUri TkVarRequestUriRaw TkVarRequestLine TkVarReqBodyProcessor TkVarResponseBody TkVarResponseContentLength TkVarResponseContentType TkVarResponseHeaders TkVarResponseHeadersNames TkVarResponseProtocol TkVarResponseStatus TkVarXML TkVarTx TkVarFilesNames TkVarFiles TkVarFilesCombinedSize TkVarUniqueId TkVarDuration TkVarIp TkVarGeo TkVarMatchedVars TkVarMatchedVarsNames // operator TkOpRx TkOpEq TkOpGe TkOpGt TkOpLe TkOpLt TkOpValidateUrlEncoding TkOpValidateUtf8Encoding TkOpValidateByteRange TkOpPm TkOpPmFromFile TkOpWithin TkOpBeginsWith TkOpEndsWith TkOpContains TkOpStrEq TkOpIpMatch TkOpGeoLookup TkOpRbl TkOpDetectXss TkOpDetectSqli // actions TkActionAllow TkActionMsg TkActionId TkActionTag TkActionRev TkActionSeverity TkActionLog TkActionNoLog TkActionDeny TkActionBlock TkActionStatus TkActionpHase TkActionT TkActionSkip TkActionSkipAfter TkActionChain TkActionPhase TkActionVer TkActionLogData TkActionSetVar TkActionCapture TkActionPass TkActionCtl TkActionAuditLog TkActionNoAuditLog TkActionExpireVar TkActionDrop TkActionMultiMatch // transform action TkTransLowercase TkTransUrlDecode TkTransUrlDecodeUni TkTransNone TkTransCompressWhitespace TkTransRemoveWhitespace TkTransReplaceNulls TkTransRemoveNulls TkTransLength TkTransHtmlEntityDecode TkTransSha1 TkTransHexEncode TkTransUtf8toUnicode TkTransCmdLine TkTransNormalisePath TkTransNormalizePath TkTransNormalizePathWin TkTransReplaceComments TkTransRemoveComments TkTransBase64Decode TkTransJsDecode TkTransCssDecode TkEND )
View Source
const ( PhaseRequestHeaders = 1 PhaseRequestBody = 2 PhaseResponseHeaders = 3 PhaseResponseBody = 4 PhaseLogging = 5 )
View Source
const TkStart = 128
Variables ¶
View Source
var ActionNameMap = map[int]string{}
View Source
var Directives map[int]*DirectiveDesc
View Source
var ErrEOS = errors.New("EOS")
View Source
var OperatorNameMap = map[int]string{}
View Source
var SeverityNameMap = map[int]string{}
View Source
var TransformationNameMap = map[int]string{}
View Source
var Values map[int]*ValueDesc
View Source
var VariableNameMap = map[int]string{}
Functions ¶
func RegisterDir ¶
func RegisterDir(tk int, name string, f DirectiveFactory)
func RegisterValue ¶
Types ¶
type BoolArgDirective ¶
func (*BoolArgDirective) Token ¶
func (d *BoolArgDirective) Token() int
type DirectiveDesc ¶
type DirectiveDesc struct {
Token int
Val string
Func DirectiveFactory
}
func DirectiveFromString ¶
func DirectiveFromString(str string) *DirectiveDesc
type DirectiveFactory ¶
func BoolArgDirectiveFactory ¶
func BoolArgDirectiveFactory(tk int) DirectiveFactory
func StringArgDirectiveFactory ¶
func StringArgDirectiveFactory(tk int) DirectiveFactory
func TriBoolArgDirectiveFactory ¶
func TriBoolArgDirectiveFactory(tk int) DirectiveFactory
type RuleDirective ¶
func (*RuleDirective) Token ¶
func (d *RuleDirective) Token() int
type Scanner ¶
type Scanner struct {
LineNumber, LastLine int
// contains filtered or unexported fields
}
func NewSecLangScanner ¶
func (*Scanner) AllDirective ¶
func (*Scanner) ReadActions ¶
func (*Scanner) ReadDirective ¶
func (*Scanner) ReadOperator ¶
func (*Scanner) ReadString ¶
func (*Scanner) ReadVariables ¶
func (*Scanner) StartsWith ¶
type StringArgDirective ¶
func (*StringArgDirective) Token ¶
func (d *StringArgDirective) Token() int
type TriBoolArgDirective ¶
func (*TriBoolArgDirective) Token ¶
func (d *TriBoolArgDirective) Token() int
Click to show internal directories.
Click to hide internal directories.