From 51d2ad1a761591ce9bf9818e4e85e8869467e66c Mon Sep 17 00:00:00 2001 From: Wesley Shields Date: Fri, 10 Dec 2021 04:20:49 -0500 Subject: [PATCH] Support percent notation in grammar. (#43) Add support for "x% of them" notation to gyp. While I was here I noticed that the protobuf generated code was being put into the github.com/VirusTotal/gyp/pb directory, which was causing various problems when trying to build things as they all expected to find the protobuf related code in the pb/ directory. To deal with this I modified the Makefile so that the protobuf generated code is going in the pb/ directory yet the go_package remains as github.com/VirusTotal/gyp/pb. I'm not sure if this is going to cause problems with builds of other things using bazel that depend upon this so it may be good to get @Zohiartze to review this so we can avoid a repeat of #42. * Rework the percentage handling. Address comments from Victor, which I understand conceptually but may have implemented in a weird way. ;) --- Makefile | 2 +- ast/ast.go | 45 ++- ast/serialization.go | 4 + parser/grammar.y | 17 ++ parser/parser.go | 687 +++++++++++++++++++++--------------------- pb/yara.pb.go | 658 +++++++++++++++++++++++----------------- pb/yara.proto | 6 + serialize.go | 12 + tests/grammar_test.go | 16 + 9 files changed, 828 insertions(+), 619 deletions(-) diff --git a/Makefile b/Makefile index c9e98d9..eaeb75d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ hexgrammar: flexgo -G -v -o hex/hex_lexer.go hex/hex_lexer.l && goyacc -p hex -o hex/hex_parser.go hex/hex_grammar.y proto: - protoc --go_out=. pb/yara.proto + protoc --go_out=. --go_opt=paths=source_relative pb/yara.proto j2y: go build github.com/VirusTotal/gyp/cmd/j2y diff --git a/ast/ast.go b/ast/ast.go index 76b4272..d33f126 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -176,6 +176,12 @@ type Quantifier struct { Expression } +// Percentage is an Expression used in evaluating string sets. Example: +// % of +type Percentage struct { + Expression +} + // ForIn is an Expression representing a "for in" loop. Example: // for in : ( ) type ForIn struct { @@ -499,6 +505,15 @@ func (o *Of) WriteSource(w io.Writer) error { return err } +// WriteSource writes the node's source into the writer w. +func (p *Percentage) WriteSource(w io.Writer) error { + err := p.Expression.WriteSource(w) + if err == nil { + _, err = io.WriteString(w, "%") + } + return err +} + // WriteSource writes the operation into the writer w. func (o *Operation) WriteSource(w io.Writer) error { if len(o.Operands) < 2 { @@ -892,26 +907,44 @@ func (s *Subscripting) AsProto() *pb.Expression { } } +// AsProto returns the Expression serialized as a pb.Expression. +func (p *Percentage) AsProto() *pb.Expression { + return &pb.Expression{ + Expression: &pb.Expression_PercentageExpression{ + PercentageExpression: &pb.Percentage{ + Expression: p.Expression.AsProto(), + }, + }, + } +} + // AsProto returns the Expression serialized as a pb.Expression. func (q *Quantifier) AsProto() *pb.ForExpression { var expr *pb.ForExpression - if kw, isKeyword := q.Expression.(Keyword); isKeyword { + switch v := q.Expression.(type) { + case *Percentage: + expr = &pb.ForExpression{ + For: &pb.ForExpression_Expression{ + Expression: v.AsProto(), + }, + } + case Keyword: var pbkw pb.ForKeyword - if kw == KeywordAll { + if v == KeywordAll { pbkw = pb.ForKeyword_ALL - } else if kw == KeywordAny { + } else if v == KeywordAny { pbkw = pb.ForKeyword_ANY - } else if kw == KeywordNone { + } else if v == KeywordNone { pbkw = pb.ForKeyword_NONE } else { - panic(fmt.Sprintf("unexpected keyword in for: %s", kw)) + panic(fmt.Sprintf("unexpected keyword in for: %s", v)) } expr = &pb.ForExpression{ For: &pb.ForExpression_Keyword{ Keyword: pbkw, }, } - } else { + default: expr = &pb.ForExpression{ For: &pb.ForExpression_Expression{ Expression: q.Expression.AsProto(), diff --git a/ast/serialization.go b/ast/serialization.go index b26af62..ad41ad3 100644 --- a/ast/serialization.go +++ b/ast/serialization.go @@ -488,6 +488,10 @@ func expressionFromProto(e *pb.Expression) Expression { default: panic(fmt.Sprintf(`unknown keyword "%T"`, keyword)) } + case *pb.Expression_PercentageExpression: + return &Percentage{ + Expression: expressionFromProto(v.PercentageExpression.Expression), + } default: panic(fmt.Sprintf(`unexpected node "%T"`, v)) } diff --git a/parser/grammar.y b/parser/grammar.y index f8eacf5..539fe28 100644 --- a/parser/grammar.y +++ b/parser/grammar.y @@ -157,6 +157,7 @@ type stringModifiers struct { %type arguments_list %type arguments %type for_expression +%type percent_expression %type integer_enumeration %type iterator %type integer_set @@ -190,6 +191,7 @@ type stringModifiers struct { si *ast.StringIdentifier sis []*ast.StringIdentifier quantifier *ast.Quantifier + percentage *ast.Percentage // lineno is not a symbol type, it's the line number where the symbol // appears in the source file. This is a little hack used for passing @@ -824,6 +826,13 @@ expression Strings: $3, } } + | percent_expression _OF_ string_set + { + $$ = &ast.Of{ + Quantifier: &ast.Quantifier{$1}, + Strings: $3, + } + } | _NOT_ boolean_expression { $$ = &ast.Not{$2} @@ -964,6 +973,14 @@ string_enumeration_item ; +percent_expression + : primary_expression '%' + { + $$ = &ast.Percentage{$1} + } + ; + + for_expression : primary_expression { diff --git a/parser/parser.go b/parser/parser.go index 4cc1e63..e9dfb57 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -35,7 +35,7 @@ type stringModifiers struct { Base64Alphabet string } -//line parser/grammar.y:171 +//line parser/grammar.y:172 type yrSymType struct { yys int i64 int64 @@ -59,6 +59,7 @@ type yrSymType struct { si *ast.StringIdentifier sis []*ast.StringIdentifier quantifier *ast.Quantifier + percentage *ast.Percentage // lineno is not a symbol type, it's the line number where the symbol // appears in the source file. This is a little hack used for passing @@ -233,7 +234,7 @@ const yrEofCode = 1 const yrErrCode = 2 const yrInitialStackSize = 16 -//line parser/grammar.y:1137 +//line parser/grammar.y:1154 // This function takes an operator and two operands and returns a Expression // representing the operation. If the left operand is an operation of the @@ -259,16 +260,16 @@ var yrExca = [...]int{ 1, -1, -2, 15, -1, 52, - 38, 108, - -2, 95, - -1, 113, - 38, 108, - -2, 95, - -1, 171, + 38, 110, + -2, 96, + -1, 115, + 38, 110, + -2, 96, + -1, 175, 78, 66, 82, 66, -2, 69, - -1, 214, + -1, 218, 78, 67, 82, 67, -2, 69, @@ -276,108 +277,107 @@ var yrExca = [...]int{ const yrPrivate = 57344 -const yrLast = 457 +const yrLast = 431 var yrAct = [...]int{ - 52, 186, 49, 152, 67, 159, 229, 212, 182, 194, - 230, 213, 117, 116, 82, 83, 84, 85, 86, 87, - 88, 120, 161, 118, 119, 241, 114, 102, 100, 101, - 93, 94, 89, 91, 90, 92, 103, 104, 95, 96, - 97, 98, 99, 233, 235, 81, 80, 232, 70, 81, - 80, 163, 193, 183, 74, 108, 234, 162, 113, 160, - 112, 228, 222, 217, 216, 215, 153, 48, 115, 121, - 122, 240, 42, 39, 38, 238, 219, 211, 40, 28, - 26, 17, 18, 111, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 126, 127, 80, - 158, 95, 96, 97, 98, 99, 164, 165, 166, 208, - 168, 110, 55, 171, 81, 80, 74, 53, 64, 65, - 66, 128, 61, 62, 60, 63, 75, 75, 103, 104, - 95, 96, 97, 98, 99, 5, 58, 59, 71, 72, - 73, 225, 30, 54, 181, 224, 102, 100, 101, 97, - 98, 99, 184, 50, 51, 103, 104, 95, 96, 97, - 98, 99, 76, 78, 77, 105, 44, 107, 35, 43, - 68, 106, 37, 192, 56, 69, 209, 206, 13, 7, - 154, 57, 4, 8, 239, 187, 226, 214, 79, 188, - 157, 33, 36, 210, 167, 218, 31, 46, 47, 221, - 23, 20, 14, 41, 74, 223, 64, 65, 66, 25, - 61, 62, 60, 63, 45, 75, 156, 9, 11, 12, - 180, 237, 100, 101, 58, 59, 71, 72, 73, 22, - 103, 104, 95, 96, 97, 98, 99, 123, 27, 231, - 102, 100, 101, 15, 1, 236, 185, 155, 207, 103, - 104, 95, 96, 97, 98, 99, 205, 220, 68, 169, - 170, 32, 6, 69, 102, 100, 101, 191, 10, 109, - 125, 179, 124, 103, 104, 95, 96, 97, 98, 99, - 82, 83, 84, 85, 86, 87, 88, 173, 172, 195, - 34, 190, 24, 102, 100, 101, 93, 94, 89, 91, - 90, 92, 103, 104, 95, 96, 97, 98, 99, 74, - 21, 64, 65, 66, 29, 61, 62, 60, 63, 19, - 75, 16, 102, 100, 101, 2, 3, 0, 0, 58, - 59, 103, 104, 95, 96, 97, 98, 99, 102, 100, - 101, 204, 0, 0, 0, 0, 227, 103, 104, 95, - 96, 97, 98, 99, 0, 178, 0, 0, 0, 0, - 0, 0, 189, 68, 0, 0, 0, 0, 69, 102, - 100, 101, 175, 174, 109, 176, 177, 0, 103, 104, - 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, - 102, 100, 101, 163, 0, 0, 0, 0, 0, 103, - 104, 95, 96, 97, 98, 99, 102, 100, 101, 0, - 0, 0, 0, 0, 0, 103, 104, 95, 96, 97, - 98, 99, 101, 200, 0, 0, 0, 0, 0, 103, - 104, 95, 96, 97, 98, 99, 0, 0, 0, 0, - 197, 196, 203, 198, 199, 201, 202, + 52, 190, 49, 154, 68, 233, 216, 186, 162, 234, + 217, 198, 119, 118, 83, 84, 85, 86, 87, 88, + 89, 122, 232, 120, 121, 245, 116, 103, 101, 102, + 94, 95, 90, 92, 91, 93, 104, 105, 97, 98, + 99, 100, 96, 82, 81, 239, 82, 81, 71, 237, + 236, 167, 187, 197, 166, 109, 42, 238, 75, 115, + 226, 114, 221, 220, 103, 101, 102, 48, 38, 244, + 123, 124, 242, 104, 105, 97, 98, 99, 100, 160, + 164, 219, 155, 117, 113, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 128, 129, + 223, 161, 215, 40, 28, 18, 26, 163, 168, 169, + 170, 165, 172, 212, 17, 175, 39, 75, 53, 65, + 66, 67, 130, 62, 63, 61, 64, 81, 76, 104, + 105, 97, 98, 99, 100, 160, 112, 59, 60, 72, + 73, 74, 82, 81, 54, 55, 185, 99, 100, 160, + 111, 143, 101, 102, 50, 51, 76, 188, 229, 228, + 104, 105, 97, 98, 99, 100, 160, 13, 156, 8, + 44, 69, 243, 43, 230, 57, 70, 5, 159, 80, + 213, 210, 58, 103, 101, 102, 97, 98, 99, 100, + 160, 218, 104, 105, 97, 98, 99, 100, 160, 222, + 108, 46, 47, 225, 158, 35, 36, 231, 75, 227, + 65, 66, 67, 214, 62, 63, 61, 64, 45, 76, + 30, 7, 25, 171, 4, 241, 102, 31, 59, 60, + 72, 73, 74, 104, 105, 97, 98, 99, 100, 160, + 41, 106, 23, 235, 103, 101, 102, 107, 191, 240, + 37, 20, 192, 104, 105, 97, 98, 99, 100, 160, + 14, 33, 69, 77, 79, 78, 22, 70, 103, 101, + 102, 196, 184, 110, 9, 11, 12, 104, 105, 97, + 98, 99, 100, 160, 125, 27, 15, 103, 101, 102, + 1, 189, 157, 211, 209, 195, 104, 105, 97, 98, + 99, 100, 160, 83, 84, 85, 86, 87, 88, 89, + 224, 56, 173, 174, 194, 32, 103, 101, 102, 94, + 95, 90, 92, 91, 93, 104, 105, 97, 98, 99, + 100, 96, 75, 6, 65, 66, 67, 10, 62, 63, + 61, 64, 127, 76, 208, 103, 101, 102, 183, 126, + 177, 176, 59, 60, 104, 105, 97, 98, 99, 100, + 160, 103, 101, 102, 199, 34, 24, 21, 29, 193, + 104, 105, 97, 98, 99, 100, 160, 19, 16, 2, + 3, 0, 0, 0, 0, 167, 69, 0, 0, 0, + 0, 70, 204, 103, 101, 102, 0, 110, 0, 182, + 0, 0, 104, 105, 97, 98, 99, 100, 160, 201, + 200, 207, 202, 203, 205, 206, 179, 178, 0, 180, + 181, } var yrPact = [...]int{ - -1000, 141, -1000, -1000, 172, -1000, 221, 167, -1000, 200, - -1000, -1000, -1000, -1000, -1000, 6, 9, 199, 230, 198, - -1000, 209, 5, -1000, -1000, 4, 194, 190, 189, 194, - -1000, -2, -1, 3, 189, -1000, -4, -1000, 158, -1000, - 114, -1000, 151, -1000, -1000, 180, -1000, -1000, 72, -1000, - -1000, -1000, 249, 144, 202, 83, 114, 114, -1000, -1000, - -9, -1000, -1000, -1000, -1000, -67, -68, -56, 307, 307, - -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - 114, 114, 113, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, -11, 188, 362, 307, - -18, -1000, -21, -27, 72, 307, 307, 307, 192, 307, - 114, -1000, -1000, -1000, 358, 223, -1000, 56, -1000, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 92, 92, -1000, -1000, -1000, 376, 75, 177, 46, - 46, 362, -1000, 307, -1000, -29, -18, -1000, 325, -1000, - 182, -1000, -1000, -1000, 294, 220, 196, -1000, 102, -26, - -73, -1000, 426, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, 346, 42, 191, 2, -71, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, 114, -1000, -1000, -1000, -1000, -1000, - -1000, -12, -13, -14, 307, 1, -56, -1000, 307, -1000, - -1000, -15, -1000, 182, -1000, 134, 130, 178, 278, -16, - -72, 346, 114, -1000, -31, -35, -22, -1000, 114, -1000, - 307, -3, -1000, -1000, -1000, 176, -7, 362, -1000, -53, - -1000, -1000, + -1000, 183, -1000, -1000, 158, -1000, 278, 156, -1000, 258, + -1000, -1000, -1000, -1000, -1000, 49, 42, 249, 267, 240, + -1000, 222, 41, -1000, -1000, 39, 225, 260, 203, 225, + -1000, -8, 52, 38, 203, -1000, -20, -1000, 162, -1000, + 115, -1000, 252, -1000, -1000, 171, -1000, -1000, 100, -1000, + -1000, -1000, 272, 220, 206, 122, 108, 115, 115, -1000, + -1000, 6, -1000, -1000, -1000, -1000, -67, -68, -56, 330, + 330, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, 115, 115, 143, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 5, 176, 10, + 330, 40, 40, -1000, -24, -27, 100, 330, 330, 330, + 221, 330, 115, -1000, -1000, -1000, 402, 275, -1000, 84, + -1000, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, -1000, 90, 90, -1000, -1000, 180, 76, + 107, 131, 131, 10, -1000, 330, -1000, -30, 40, -1000, + 330, 317, -1000, 245, -1000, -1000, -1000, -1000, 301, 243, + 224, -1000, 200, -25, -71, -1000, 395, -1000, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, 349, 46, 211, 37, -72, + -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 115, -1000, + -1000, -1000, -1000, -1000, -1000, 4, -14, -15, 330, 35, + -56, -1000, 330, -1000, -1000, -17, -1000, 245, -1000, 148, + 147, 166, 139, -55, -73, 349, 115, -1000, -28, -29, + -21, -1000, 115, -1000, 330, -6, -1000, -1000, -1000, 164, + -9, 10, -1000, -53, -1000, -1000, } var yrPgo = [...]int{ - 0, 336, 335, 331, 329, 152, 324, 320, 302, 178, - 300, 299, 298, 297, 282, 281, 280, 278, 272, 271, - 2, 26, 0, 4, 270, 269, 122, 267, 266, 258, - 5, 48, 3, 257, 256, 1, 254, 253, 248, 247, + 0, 390, 389, 388, 387, 230, 378, 377, 376, 215, + 375, 374, 361, 360, 359, 358, 352, 347, 343, 325, + 2, 26, 0, 4, 323, 322, 155, 321, 320, 304, + 303, 8, 48, 3, 302, 301, 1, 300, 296, 295, + 294, } var yrR1 = [...]int{ - 0, 36, 36, 36, 36, 36, 1, 37, 38, 2, + 0, 37, 37, 37, 37, 37, 1, 38, 39, 2, 7, 7, 8, 8, 19, 18, 18, 17, 17, 3, 3, 4, 4, 6, 6, 5, 5, 5, 5, 5, - 10, 10, 39, 9, 9, 9, 12, 12, 11, 11, + 10, 10, 40, 9, 9, 9, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 14, 14, 13, 13, 13, 13, 13, 16, 16, 15, - 23, 23, 23, 23, 25, 25, 24, 24, 31, 21, + 23, 23, 23, 23, 25, 25, 24, 24, 32, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 29, 29, 32, - 27, 27, 30, 30, 34, 34, 35, 35, 26, 26, - 26, 26, 33, 33, 28, 28, 22, 22, 22, 22, + 20, 20, 20, 20, 20, 20, 20, 20, 30, 30, + 33, 28, 28, 31, 31, 35, 35, 36, 36, 27, + 26, 26, 26, 26, 34, 34, 29, 29, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, + 22, 22, 22, 22, } var yrR2 = [...]int{ @@ -389,41 +389,41 @@ var yrR2 = [...]int{ 0, 2, 1, 1, 1, 1, 1, 0, 2, 1, 1, 3, 4, 4, 0, 1, 1, 3, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 1, - 3, 3, 3, 9, 8, 3, 2, 3, 3, 3, - 3, 3, 3, 3, 3, 1, 3, 3, 1, 5, - 1, 3, 3, 1, 1, 3, 1, 1, 1, 1, - 1, 1, 1, 3, 1, 1, 3, 1, 1, 4, - 1, 1, 1, 1, 4, 1, 4, 1, 1, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, - 3, 1, + 3, 3, 3, 9, 8, 3, 3, 2, 3, 3, + 3, 3, 3, 3, 3, 3, 1, 3, 3, 1, + 5, 1, 3, 3, 1, 1, 3, 1, 1, 2, + 1, 1, 1, 1, 1, 3, 1, 1, 3, 1, + 1, 4, 1, 1, 1, 1, 4, 1, 4, 1, + 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 3, 3, 1, } var yrChk = [...]int{ - -1000, -36, -2, -1, 51, 4, -18, 48, 21, 6, - -17, 7, 8, 21, 12, -37, -3, 75, 73, -4, - 12, -7, 9, 12, -8, 10, 75, -38, 75, -6, + -1000, -37, -2, -1, 51, 4, -18, 48, 21, 6, + -17, 7, 8, 21, 12, -38, -3, 75, 73, -4, + 12, -7, 9, 12, -8, 10, 75, -39, 75, -6, -5, 12, -19, 11, -10, -9, 13, -5, 76, 74, 75, -9, 76, 21, 18, 66, 49, 50, -21, -20, - 49, 50, -22, 13, 39, -26, 70, 77, 32, 33, - 20, 18, 19, 21, 14, 15, 16, -23, 66, 71, - -31, 34, 35, 36, 12, 23, 21, 23, 22, 18, - 53, 52, 41, 42, 43, 44, 45, 46, 47, 59, - 61, 60, 62, 57, 58, 65, 66, 67, 68, 69, - 55, 56, 54, 63, 64, 31, 37, -26, -22, 77, - 38, -21, -20, -22, -21, 77, 80, 80, 79, 80, - 77, -22, -22, -39, -14, -16, -21, -21, -31, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + 49, 50, -22, 13, 39, -26, -27, 70, 77, 32, + 33, 20, 18, 19, 21, 14, 15, 16, -23, 66, + 71, -32, 34, 35, 36, 12, 23, 21, 23, 22, + 18, 53, 52, 41, 42, 43, 44, 45, 46, 47, + 59, 61, 60, 62, 57, 58, 69, 65, 66, 67, + 68, 55, 56, 54, 63, 64, 31, 37, -26, -22, + 77, 38, 38, -21, -20, -22, -21, 77, 80, 80, + 79, 80, 77, -22, -22, -40, -14, -16, -21, -21, + -32, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -32, 77, 2, -33, 38, 12, -22, -30, - 77, 40, 78, 78, -22, -22, -22, 12, -22, -25, - -24, -20, -12, -13, 25, 24, 27, 28, 7, -15, - 7, -22, 37, 82, -30, -34, -35, 13, 17, 78, - 81, 81, 81, 78, 82, -11, 25, 24, 27, 28, - 7, 29, 30, 26, 5, -28, -23, -29, 77, -32, - 12, 75, 78, 82, -20, 77, 77, 77, -22, 75, - -27, -22, 77, -35, 21, 21, 18, 78, 77, 78, - 82, -21, 78, 78, 78, 66, -21, -22, 78, 18, - 78, 78, + -22, -22, -22, -22, -33, 77, 2, -34, 38, 12, + 69, -22, -31, 77, 40, -31, 78, 78, -22, -22, + -22, 12, -22, -25, -24, -20, -12, -13, 25, 24, + 27, 28, 7, -15, 7, -22, 37, 82, -31, -35, + -36, 13, 17, 78, 81, 81, 81, 78, 82, -11, + 25, 24, 27, 28, 7, 29, 30, 26, 5, -29, + -23, -30, 77, -33, 12, 75, 78, 82, -20, 77, + 77, 77, -22, 75, -28, -22, 77, -36, 21, 21, + 18, 78, 77, 78, 82, -21, 78, 78, 78, 66, + -21, -22, 78, 18, 78, 78, } var yrDef = [...]int{ @@ -432,26 +432,26 @@ var yrDef = [...]int{ 21, 12, 0, 22, 8, 0, 0, 0, 0, 11, 23, 0, 0, 0, 13, 30, 0, 24, 0, 9, 0, 31, 0, 25, 26, 0, 28, 29, 14, 69, - 70, 71, -2, 79, 0, 0, 0, 0, 117, 118, - 0, 120, 121, 122, 123, 125, 127, 128, 0, 0, - 141, 109, 110, 111, 60, 68, 32, 50, 57, 27, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, - 0, 86, 69, -2, 0, 0, 0, 0, 0, 0, - 64, 129, 138, 36, 34, 35, 87, 88, 72, 73, - 74, 75, 76, 77, 78, 89, 90, 91, 92, 93, - 94, 130, 131, 132, 133, 134, 135, 136, 137, 139, - 140, 80, 81, 0, 82, 0, 0, 112, 0, 85, - 0, 103, 96, 116, 0, 0, 0, 61, 0, 0, - 65, -2, 33, 51, 52, 53, 54, 55, 56, 58, - 59, 0, 0, 0, 0, 0, 104, 106, 107, 119, - 124, 126, 62, 63, 0, 37, 38, 39, 40, 41, - 42, 43, 44, 47, 0, 0, 114, 115, 0, 98, - 113, 0, 102, 0, -2, 0, 0, 0, 0, 0, - 0, 100, 0, 105, 0, 0, 0, 99, 0, 97, - 0, 0, 45, 46, 48, 0, 0, 101, 84, 0, - 83, 49, + 70, 71, -2, 79, 0, 0, 0, 0, 0, 119, + 120, 0, 122, 123, 124, 125, 127, 129, 130, 0, + 0, 143, 111, 112, 113, 60, 68, 32, 50, 57, + 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 109, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, + 0, 0, 0, 87, 69, -2, 0, 0, 0, 0, + 0, 0, 64, 131, 140, 36, 34, 35, 88, 89, + 72, 73, 74, 75, 76, 77, 78, 90, 91, 92, + 93, 94, 95, 136, 132, 133, 134, 135, 137, 138, + 139, 141, 142, 80, 81, 0, 82, 0, 0, 114, + 0, 0, 85, 0, 104, 86, 97, 118, 0, 0, + 0, 61, 0, 0, 65, -2, 33, 51, 52, 53, + 54, 55, 56, 58, 59, 0, 0, 0, 0, 0, + 105, 107, 108, 121, 126, 128, 62, 63, 0, 37, + 38, 39, 40, 41, 42, 43, 44, 47, 0, 0, + 116, 117, 0, 99, 115, 0, 103, 0, -2, 0, + 0, 0, 0, 0, 0, 101, 0, 106, 0, 0, + 0, 100, 0, 98, 0, 0, 45, 46, 48, 0, + 0, 102, 84, 0, 83, 49, } var yrTok1 = [...]int{ @@ -823,34 +823,34 @@ yrdefault: case 2: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:221 +//line parser/grammar.y:223 { ruleSet := asLexer(yrlex).ruleSet ruleSet.Rules = append(ruleSet.Rules, yrDollar[2].rule) } case 3: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:226 +//line parser/grammar.y:228 { ruleSet := asLexer(yrlex).ruleSet ruleSet.Imports = append(ruleSet.Imports, yrDollar[2].s) } case 4: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:231 +//line parser/grammar.y:233 { ruleSet := asLexer(yrlex).ruleSet ruleSet.Includes = append(ruleSet.Includes, yrDollar[3].s) } case 5: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:236 +//line parser/grammar.y:238 { } case 6: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:244 +//line parser/grammar.y:246 { if err := validateAscii(yrDollar[2].s); err != nil { return asLexer(yrlex).setError( @@ -861,7 +861,7 @@ yrdefault: } case 7: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:257 +//line parser/grammar.y:259 { lexer := asLexer(yrlex) @@ -882,7 +882,7 @@ yrdefault: } case 8: yrDollar = yrS[yrpt-8 : yrpt+1] -//line parser/grammar.y:276 +//line parser/grammar.y:278 { yrDollar[4].rule.Tags = yrDollar[5].ss yrDollar[4].rule.Meta = yrDollar[7].metas @@ -890,86 +890,86 @@ yrdefault: } case 9: yrDollar = yrS[yrpt-11 : yrpt+1] -//line parser/grammar.y:282 +//line parser/grammar.y:284 { yrDollar[4].rule.Condition = yrDollar[10].expr yrVAL.rule = yrDollar[4].rule } case 10: yrDollar = yrS[yrpt-0 : yrpt+1] -//line parser/grammar.y:291 +//line parser/grammar.y:293 { yrVAL.metas = []*ast.Meta{} } case 11: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:295 +//line parser/grammar.y:297 { yrVAL.metas = yrDollar[3].metas } case 12: yrDollar = yrS[yrpt-0 : yrpt+1] -//line parser/grammar.y:303 +//line parser/grammar.y:305 { yrVAL.yss = []ast.String{} } case 13: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:307 +//line parser/grammar.y:309 { yrVAL.yss = yrDollar[3].yss } case 14: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:315 +//line parser/grammar.y:317 { yrVAL.expr = yrDollar[3].expr } case 15: yrDollar = yrS[yrpt-0 : yrpt+1] -//line parser/grammar.y:323 +//line parser/grammar.y:325 { yrVAL.mod = 0 } case 16: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:327 +//line parser/grammar.y:329 { yrVAL.mod = yrDollar[1].mod | yrDollar[2].mod } case 17: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:335 +//line parser/grammar.y:337 { yrVAL.mod = ModPrivate } case 18: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:339 +//line parser/grammar.y:341 { yrVAL.mod = ModGlobal } case 19: yrDollar = yrS[yrpt-0 : yrpt+1] -//line parser/grammar.y:347 +//line parser/grammar.y:349 { yrVAL.ss = []string{} } case 20: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:351 +//line parser/grammar.y:353 { yrVAL.ss = yrDollar[2].ss } case 21: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:359 +//line parser/grammar.y:361 { yrVAL.ss = []string{yrDollar[1].s} } case 22: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:363 +//line parser/grammar.y:365 { lexer := asLexer(yrlex) @@ -984,19 +984,19 @@ yrdefault: } case 23: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:380 +//line parser/grammar.y:382 { yrVAL.metas = []*ast.Meta{yrDollar[1].meta} } case 24: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:384 +//line parser/grammar.y:386 { yrVAL.metas = append(yrDollar[1].metas, yrDollar[2].meta) } case 25: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:392 +//line parser/grammar.y:394 { yrVAL.meta = &ast.Meta{ Key: yrDollar[1].s, @@ -1005,7 +1005,7 @@ yrdefault: } case 26: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:399 +//line parser/grammar.y:401 { yrVAL.meta = &ast.Meta{ Key: yrDollar[1].s, @@ -1014,7 +1014,7 @@ yrdefault: } case 27: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:406 +//line parser/grammar.y:408 { yrVAL.meta = &ast.Meta{ Key: yrDollar[1].s, @@ -1023,7 +1023,7 @@ yrdefault: } case 28: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:413 +//line parser/grammar.y:415 { yrVAL.meta = &ast.Meta{ Key: yrDollar[1].s, @@ -1032,7 +1032,7 @@ yrdefault: } case 29: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:420 +//line parser/grammar.y:422 { yrVAL.meta = &ast.Meta{ Key: yrDollar[1].s, @@ -1041,19 +1041,19 @@ yrdefault: } case 30: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:431 +//line parser/grammar.y:433 { yrVAL.yss = []ast.String{yrDollar[1].ys} } case 31: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:435 +//line parser/grammar.y:437 { yrVAL.yss = append(yrDollar[1].yss, yrDollar[2].ys) } case 32: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:443 +//line parser/grammar.y:445 { if err := validateUTF8(yrDollar[3].s); err != nil { return asLexer(yrlex).setError( @@ -1062,7 +1062,7 @@ yrdefault: } case 33: yrDollar = yrS[yrpt-5 : yrpt+1] -//line parser/grammar.y:450 +//line parser/grammar.y:452 { yrVAL.ys = &ast.TextString{ BaseString: ast.BaseString{ @@ -1085,7 +1085,7 @@ yrdefault: } case 34: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:471 +//line parser/grammar.y:473 { yrVAL.ys = &ast.RegexpString{ BaseString: ast.BaseString{ @@ -1102,7 +1102,7 @@ yrdefault: } case 35: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:486 +//line parser/grammar.y:488 { yrVAL.ys = &ast.HexString{ BaseString: ast.BaseString{ @@ -1115,13 +1115,13 @@ yrdefault: } case 36: yrDollar = yrS[yrpt-0 : yrpt+1] -//line parser/grammar.y:501 +//line parser/grammar.y:503 { yrVAL.smod = stringModifiers{} } case 37: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:505 +//line parser/grammar.y:507 { if yrDollar[1].smod.modifiers&yrDollar[2].smod.modifiers != 0 { return asLexer(yrlex).setError( @@ -1143,49 +1143,49 @@ yrdefault: } case 38: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:528 +//line parser/grammar.y:530 { yrVAL.smod = stringModifiers{modifiers: ModWide} } case 39: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:529 +//line parser/grammar.y:531 { yrVAL.smod = stringModifiers{modifiers: ModASCII} } case 40: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:530 +//line parser/grammar.y:532 { yrVAL.smod = stringModifiers{modifiers: ModNocase} } case 41: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:531 +//line parser/grammar.y:533 { yrVAL.smod = stringModifiers{modifiers: ModFullword} } case 42: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:532 +//line parser/grammar.y:534 { yrVAL.smod = stringModifiers{modifiers: ModPrivate} } case 43: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:533 +//line parser/grammar.y:535 { yrVAL.smod = stringModifiers{modifiers: ModBase64} } case 44: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:534 +//line parser/grammar.y:536 { yrVAL.smod = stringModifiers{modifiers: ModBase64Wide} } case 45: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:536 +//line parser/grammar.y:538 { if err := validateAscii(yrDollar[3].s); err != nil { return asLexer(yrlex).setError( @@ -1205,7 +1205,7 @@ yrdefault: } case 46: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:554 +//line parser/grammar.y:556 { if err := validateAscii(yrDollar[3].s); err != nil { return asLexer(yrlex).setError( @@ -1225,7 +1225,7 @@ yrdefault: } case 47: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:572 +//line parser/grammar.y:574 { yrVAL.smod = stringModifiers{ modifiers: ModXor, @@ -1235,7 +1235,7 @@ yrdefault: } case 48: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:580 +//line parser/grammar.y:582 { yrVAL.smod = stringModifiers{ modifiers: ModXor, @@ -1245,7 +1245,7 @@ yrdefault: } case 49: yrDollar = yrS[yrpt-6 : yrpt+1] -//line parser/grammar.y:588 +//line parser/grammar.y:590 { lexer := asLexer(yrlex) @@ -1275,73 +1275,73 @@ yrdefault: } case 50: yrDollar = yrS[yrpt-0 : yrpt+1] -//line parser/grammar.y:620 +//line parser/grammar.y:622 { yrVAL.mod = 0 } case 51: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:624 +//line parser/grammar.y:626 { yrVAL.mod = yrDollar[1].mod | yrDollar[2].mod } case 52: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:631 +//line parser/grammar.y:633 { yrVAL.mod = ModWide } case 53: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:632 +//line parser/grammar.y:634 { yrVAL.mod = ModASCII } case 54: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:633 +//line parser/grammar.y:635 { yrVAL.mod = ModNocase } case 55: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:634 +//line parser/grammar.y:636 { yrVAL.mod = ModFullword } case 56: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:635 +//line parser/grammar.y:637 { yrVAL.mod = ModPrivate } case 57: yrDollar = yrS[yrpt-0 : yrpt+1] -//line parser/grammar.y:641 +//line parser/grammar.y:643 { yrVAL.mod = 0 } case 58: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:645 +//line parser/grammar.y:647 { yrVAL.mod = yrDollar[1].mod | yrDollar[2].mod } case 59: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:652 +//line parser/grammar.y:654 { yrVAL.mod = ModPrivate } case 60: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:658 +//line parser/grammar.y:660 { yrVAL.expr = &ast.Identifier{Identifier: yrDollar[1].s} } case 61: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:662 +//line parser/grammar.y:664 { yrVAL.expr = &ast.MemberAccess{ Container: yrDollar[1].expr, @@ -1350,7 +1350,7 @@ yrdefault: } case 62: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:669 +//line parser/grammar.y:671 { yrVAL.expr = &ast.Subscripting{ Array: yrDollar[1].expr, @@ -1359,7 +1359,7 @@ yrdefault: } case 63: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:676 +//line parser/grammar.y:678 { yrVAL.expr = &ast.FunctionCall{ Callable: yrDollar[1].expr, @@ -1368,55 +1368,55 @@ yrdefault: } case 64: yrDollar = yrS[yrpt-0 : yrpt+1] -//line parser/grammar.y:687 +//line parser/grammar.y:689 { yrVAL.exprs = []ast.Expression{} } case 65: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:691 +//line parser/grammar.y:693 { yrVAL.exprs = yrDollar[1].exprs } case 66: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:698 +//line parser/grammar.y:700 { yrVAL.exprs = []ast.Expression{yrDollar[1].expr} } case 67: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:702 +//line parser/grammar.y:704 { yrVAL.exprs = append(yrDollar[1].exprs, yrDollar[3].expr) } case 68: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:710 +//line parser/grammar.y:712 { yrVAL.reg = yrDollar[1].reg } case 69: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:718 +//line parser/grammar.y:720 { yrVAL.expr = yrDollar[1].expr } case 70: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:726 +//line parser/grammar.y:728 { yrVAL.expr = ast.KeywordTrue } case 71: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:730 +//line parser/grammar.y:732 { yrVAL.expr = ast.KeywordFalse } case 72: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:734 +//line parser/grammar.y:736 { yrVAL.expr = &ast.Operation{ Operator: ast.OpMatches, @@ -1425,7 +1425,7 @@ yrdefault: } case 73: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:741 +//line parser/grammar.y:743 { yrVAL.expr = &ast.Operation{ Operator: ast.OpContains, @@ -1434,7 +1434,7 @@ yrdefault: } case 74: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:748 +//line parser/grammar.y:750 { yrVAL.expr = &ast.Operation{ Operator: ast.OpIContains, @@ -1443,7 +1443,7 @@ yrdefault: } case 75: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:755 +//line parser/grammar.y:757 { yrVAL.expr = &ast.Operation{ Operator: ast.OpStartsWith, @@ -1452,7 +1452,7 @@ yrdefault: } case 76: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:762 +//line parser/grammar.y:764 { yrVAL.expr = &ast.Operation{ Operator: ast.OpIStartsWith, @@ -1461,7 +1461,7 @@ yrdefault: } case 77: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:769 +//line parser/grammar.y:771 { yrVAL.expr = &ast.Operation{ Operator: ast.OpEndsWith, @@ -1470,7 +1470,7 @@ yrdefault: } case 78: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:776 +//line parser/grammar.y:778 { yrVAL.expr = &ast.Operation{ Operator: ast.OpIEndsWith, @@ -1479,7 +1479,7 @@ yrdefault: } case 79: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:783 +//line parser/grammar.y:785 { yrVAL.expr = &ast.StringIdentifier{ Identifier: strings.TrimPrefix(yrDollar[1].s, "$"), @@ -1487,7 +1487,7 @@ yrdefault: } case 80: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:789 +//line parser/grammar.y:791 { yrVAL.expr = &ast.StringIdentifier{ Identifier: strings.TrimPrefix(yrDollar[1].s, "$"), @@ -1496,7 +1496,7 @@ yrdefault: } case 81: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:796 +//line parser/grammar.y:798 { yrVAL.expr = &ast.StringIdentifier{ Identifier: strings.TrimPrefix(yrDollar[1].s, "$"), @@ -1505,12 +1505,12 @@ yrdefault: } case 82: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:802 +//line parser/grammar.y:804 { } case 83: yrDollar = yrS[yrpt-9 : yrpt+1] -//line parser/grammar.y:804 +//line parser/grammar.y:806 { yrVAL.expr = &ast.ForIn{ Quantifier: yrDollar[2].quantifier, @@ -1521,7 +1521,7 @@ yrdefault: } case 84: yrDollar = yrS[yrpt-8 : yrpt+1] -//line parser/grammar.y:813 +//line parser/grammar.y:815 { yrVAL.expr = &ast.ForOf{ Quantifier: yrDollar[2].quantifier, @@ -1531,7 +1531,7 @@ yrdefault: } case 85: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:821 +//line parser/grammar.y:823 { yrVAL.expr = &ast.Of{ Quantifier: yrDollar[1].quantifier, @@ -1539,252 +1539,267 @@ yrdefault: } } case 86: + yrDollar = yrS[yrpt-3 : yrpt+1] +//line parser/grammar.y:830 + { + yrVAL.expr = &ast.Of{ + Quantifier: &ast.Quantifier{yrDollar[1].percentage}, + Strings: yrDollar[3].node, + } + } + case 87: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:828 +//line parser/grammar.y:837 { yrVAL.expr = &ast.Not{yrDollar[2].expr} } - case 87: + case 88: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:832 +//line parser/grammar.y:841 { yrVAL.expr = operation(ast.OpAnd, yrDollar[1].expr, yrDollar[3].expr) } - case 88: + case 89: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:836 +//line parser/grammar.y:845 { yrVAL.expr = operation(ast.OpOr, yrDollar[1].expr, yrDollar[3].expr) } - case 89: + case 90: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:840 +//line parser/grammar.y:849 { yrVAL.expr = &ast.Operation{ Operator: ast.OpLessThan, Operands: []ast.Expression{yrDollar[1].expr, yrDollar[3].expr}, } } - case 90: + case 91: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:847 +//line parser/grammar.y:856 { yrVAL.expr = &ast.Operation{ Operator: ast.OpGreaterThan, Operands: []ast.Expression{yrDollar[1].expr, yrDollar[3].expr}, } } - case 91: + case 92: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:854 +//line parser/grammar.y:863 { yrVAL.expr = &ast.Operation{ Operator: ast.OpLessOrEqual, Operands: []ast.Expression{yrDollar[1].expr, yrDollar[3].expr}, } } - case 92: + case 93: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:861 +//line parser/grammar.y:870 { yrVAL.expr = &ast.Operation{ Operator: ast.OpGreaterOrEqual, Operands: []ast.Expression{yrDollar[1].expr, yrDollar[3].expr}, } } - case 93: + case 94: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:868 +//line parser/grammar.y:877 { yrVAL.expr = &ast.Operation{ Operator: ast.OpEqual, Operands: []ast.Expression{yrDollar[1].expr, yrDollar[3].expr}, } } - case 94: + case 95: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:875 +//line parser/grammar.y:884 { yrVAL.expr = &ast.Operation{ Operator: ast.OpNotEqual, Operands: []ast.Expression{yrDollar[1].expr, yrDollar[3].expr}, } } - case 95: + case 96: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:882 +//line parser/grammar.y:891 { yrVAL.expr = yrDollar[1].expr } - case 96: + case 97: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:886 +//line parser/grammar.y:895 { yrVAL.expr = &ast.Group{yrDollar[2].expr} } - case 97: + case 98: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:894 +//line parser/grammar.y:903 { yrVAL.node = &ast.Enum{Values: yrDollar[2].exprs} } - case 98: + case 99: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:898 +//line parser/grammar.y:907 { yrVAL.node = yrDollar[1].rng } - case 99: + case 100: yrDollar = yrS[yrpt-5 : yrpt+1] -//line parser/grammar.y:906 +//line parser/grammar.y:915 { yrVAL.rng = &ast.Range{ Start: yrDollar[2].expr, End: yrDollar[4].expr, } } - case 100: + case 101: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:917 +//line parser/grammar.y:926 { yrVAL.exprs = []ast.Expression{yrDollar[1].expr} } - case 101: + case 102: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:921 +//line parser/grammar.y:930 { yrVAL.exprs = append(yrDollar[1].exprs, yrDollar[3].expr) } - case 102: + case 103: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:929 +//line parser/grammar.y:938 { yrVAL.node = &ast.Enum{Values: yrDollar[2].exprs} } - case 103: + case 104: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:933 +//line parser/grammar.y:942 { yrVAL.node = ast.KeywordThem } - case 104: + case 105: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:941 +//line parser/grammar.y:950 { yrVAL.exprs = []ast.Expression{yrDollar[1].si} } - case 105: + case 106: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:945 +//line parser/grammar.y:954 { yrVAL.exprs = append(yrDollar[1].exprs, yrDollar[3].si) } - case 106: + case 107: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:953 +//line parser/grammar.y:962 { yrVAL.si = &ast.StringIdentifier{ Identifier: strings.TrimPrefix(yrDollar[1].s, "$"), } } - case 107: + case 108: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:959 +//line parser/grammar.y:968 { yrVAL.si = &ast.StringIdentifier{ Identifier: strings.TrimPrefix(yrDollar[1].s, "$"), } } - case 108: + case 109: + yrDollar = yrS[yrpt-2 : yrpt+1] +//line parser/grammar.y:978 + { + yrVAL.percentage = &ast.Percentage{yrDollar[1].expr} + } + case 110: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:969 +//line parser/grammar.y:986 { yrVAL.quantifier = &ast.Quantifier{yrDollar[1].expr} } - case 109: + case 111: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:973 +//line parser/grammar.y:990 { yrVAL.quantifier = &ast.Quantifier{ast.KeywordAll} } - case 110: + case 112: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:977 +//line parser/grammar.y:994 { yrVAL.quantifier = &ast.Quantifier{ast.KeywordAny} } - case 111: + case 113: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:981 +//line parser/grammar.y:998 { yrVAL.quantifier = &ast.Quantifier{ast.KeywordNone} } - case 112: + case 114: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:989 +//line parser/grammar.y:1006 { yrVAL.ss = []string{yrDollar[1].s} } - case 113: + case 115: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:993 +//line parser/grammar.y:1010 { yrVAL.ss = append(yrDollar[1].ss, yrDollar[3].s) } - case 114: + case 116: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1000 +//line parser/grammar.y:1017 { yrVAL.node = yrDollar[1].expr } - case 115: + case 117: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1004 +//line parser/grammar.y:1021 { yrVAL.node = yrDollar[1].node } - case 116: + case 118: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1012 +//line parser/grammar.y:1029 { yrVAL.expr = &ast.Group{yrDollar[2].expr} } - case 117: + case 119: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1016 +//line parser/grammar.y:1033 { yrVAL.expr = ast.KeywordFilesize } - case 118: + case 120: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1020 +//line parser/grammar.y:1037 { yrVAL.expr = ast.KeywordEntrypoint } - case 119: + case 121: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:1024 +//line parser/grammar.y:1041 { yrVAL.expr = &ast.FunctionCall{ Callable: &ast.Identifier{Identifier: yrDollar[1].s}, Arguments: []ast.Expression{yrDollar[3].expr}, } } - case 120: + case 122: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1031 +//line parser/grammar.y:1048 { yrVAL.expr = &ast.LiteralInteger{yrDollar[1].i64} } - case 121: + case 123: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1035 +//line parser/grammar.y:1052 { yrVAL.expr = &ast.LiteralFloat{yrDollar[1].f64} } - case 122: + case 124: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1039 +//line parser/grammar.y:1056 { if err := validateUTF8(yrDollar[1].s); err != nil { return asLexer(yrlex).setError( @@ -1793,129 +1808,129 @@ yrdefault: yrVAL.expr = &ast.LiteralString{yrDollar[1].s} } - case 123: + case 125: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1048 +//line parser/grammar.y:1065 { yrVAL.expr = &ast.StringCount{ Identifier: strings.TrimPrefix(yrDollar[1].s, "#"), } } - case 124: + case 126: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:1054 +//line parser/grammar.y:1071 { yrVAL.expr = &ast.StringOffset{ Identifier: strings.TrimPrefix(yrDollar[1].s, "@"), Index: yrDollar[3].expr, } } - case 125: + case 127: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1061 +//line parser/grammar.y:1078 { yrVAL.expr = &ast.StringOffset{ Identifier: strings.TrimPrefix(yrDollar[1].s, "@"), } } - case 126: + case 128: yrDollar = yrS[yrpt-4 : yrpt+1] -//line parser/grammar.y:1067 +//line parser/grammar.y:1084 { yrVAL.expr = &ast.StringLength{ Identifier: strings.TrimPrefix(yrDollar[1].s, "!"), Index: yrDollar[3].expr, } } - case 127: + case 129: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1074 +//line parser/grammar.y:1091 { yrVAL.expr = &ast.StringLength{ Identifier: strings.TrimPrefix(yrDollar[1].s, "!"), } } - case 128: + case 130: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1080 +//line parser/grammar.y:1097 { yrVAL.expr = yrDollar[1].expr } - case 129: + case 131: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:1084 +//line parser/grammar.y:1101 { yrVAL.expr = &ast.Minus{yrDollar[2].expr} } - case 130: + case 132: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1088 +//line parser/grammar.y:1105 { yrVAL.expr = operation(ast.OpAdd, yrDollar[1].expr, yrDollar[3].expr) } - case 131: + case 133: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1092 +//line parser/grammar.y:1109 { yrVAL.expr = operation(ast.OpSub, yrDollar[1].expr, yrDollar[3].expr) } - case 132: + case 134: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1096 +//line parser/grammar.y:1113 { yrVAL.expr = operation(ast.OpMul, yrDollar[1].expr, yrDollar[3].expr) } - case 133: + case 135: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1100 +//line parser/grammar.y:1117 { yrVAL.expr = operation(ast.OpDiv, yrDollar[1].expr, yrDollar[3].expr) } - case 134: + case 136: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1104 +//line parser/grammar.y:1121 { yrVAL.expr = operation(ast.OpMod, yrDollar[1].expr, yrDollar[3].expr) } - case 135: + case 137: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1108 +//line parser/grammar.y:1125 { yrVAL.expr = operation(ast.OpBitXor, yrDollar[1].expr, yrDollar[3].expr) } - case 136: + case 138: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1112 +//line parser/grammar.y:1129 { yrVAL.expr = operation(ast.OpBitAnd, yrDollar[1].expr, yrDollar[3].expr) } - case 137: + case 139: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1116 +//line parser/grammar.y:1133 { yrVAL.expr = operation(ast.OpBitOr, yrDollar[1].expr, yrDollar[3].expr) } - case 138: + case 140: yrDollar = yrS[yrpt-2 : yrpt+1] -//line parser/grammar.y:1120 +//line parser/grammar.y:1137 { yrVAL.expr = &ast.BitwiseNot{yrDollar[2].expr} } - case 139: + case 141: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1124 +//line parser/grammar.y:1141 { yrVAL.expr = operation(ast.OpShiftLeft, yrDollar[1].expr, yrDollar[3].expr) } - case 140: + case 142: yrDollar = yrS[yrpt-3 : yrpt+1] -//line parser/grammar.y:1128 +//line parser/grammar.y:1145 { yrVAL.expr = operation(ast.OpShiftRight, yrDollar[1].expr, yrDollar[3].expr) } - case 141: + case 143: yrDollar = yrS[yrpt-1 : yrpt+1] -//line parser/grammar.y:1132 +//line parser/grammar.y:1149 { yrVAL.expr = yrDollar[1].reg } diff --git a/pb/yara.pb.go b/pb/yara.pb.go index afde91f..7abb669 100644 --- a/pb/yara.pb.go +++ b/pb/yara.pb.go @@ -1442,7 +1442,8 @@ func (x *Range) GetEnd() *Expression { return nil } -// Functions for reading data from a file at a specified offset or virtual address. +// Functions for reading data from a file at a specified offset or virtual +// address. type IntegerFunction struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1791,6 +1792,53 @@ func (x *IntegerEnumeration) GetValues() []*Expression { return nil } +type Percentage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Expression *Expression `protobuf:"bytes,1,opt,name=expression" json:"expression,omitempty"` +} + +func (x *Percentage) Reset() { + *x = Percentage{} + if protoimpl.UnsafeEnabled { + mi := &file_pb_yara_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Percentage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Percentage) ProtoMessage() {} + +func (x *Percentage) ProtoReflect() protoreflect.Message { + mi := &file_pb_yara_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Percentage.ProtoReflect.Descriptor instead. +func (*Percentage) Descriptor() ([]byte, []int) { + return file_pb_yara_proto_rawDescGZIP(), []int{19} +} + +func (x *Percentage) GetExpression() *Expression { + if x != nil { + return x.Expression + } + return nil +} + // FOR expression, used as part of ForInExpressions and ForOrExpressions. // Can contain either an expression or a keyword. type ForExpression struct { @@ -1801,13 +1849,14 @@ type ForExpression struct { // Types that are assignable to For: // *ForExpression_Expression // *ForExpression_Keyword + // *ForExpression_Percentage For isForExpression_For `protobuf_oneof:"for"` } func (x *ForExpression) Reset() { *x = ForExpression{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[19] + mi := &file_pb_yara_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1820,7 +1869,7 @@ func (x *ForExpression) String() string { func (*ForExpression) ProtoMessage() {} func (x *ForExpression) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[19] + mi := &file_pb_yara_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1833,7 +1882,7 @@ func (x *ForExpression) ProtoReflect() protoreflect.Message { // Deprecated: Use ForExpression.ProtoReflect.Descriptor instead. func (*ForExpression) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{19} + return file_pb_yara_proto_rawDescGZIP(), []int{20} } func (m *ForExpression) GetFor() isForExpression_For { @@ -1857,6 +1906,13 @@ func (x *ForExpression) GetKeyword() ForKeyword { return ForKeyword_NONE } +func (x *ForExpression) GetPercentage() *Percentage { + if x, ok := x.GetFor().(*ForExpression_Percentage); ok { + return x.Percentage + } + return nil +} + type isForExpression_For interface { isForExpression_For() } @@ -1869,13 +1925,18 @@ type ForExpression_Keyword struct { Keyword ForKeyword `protobuf:"varint,2,opt,name=keyword,enum=ForKeyword,oneof"` // Example: "for all" } +type ForExpression_Percentage struct { + Percentage *Percentage `protobuf:"bytes,3,opt,name=percentage,oneof"` // Example: "x%" +} + func (*ForExpression_Expression) isForExpression_For() {} func (*ForExpression_Keyword) isForExpression_For() {} -// A ForOfExpression is satisfied if at least "expression" strings in "string_set" -// satisfy "expression". -// Example: for all of ($s1, $s2) : (@$ > 10) +func (*ForExpression_Percentage) isForExpression_For() {} + +// A ForOfExpression is satisfied if at least "expression" strings in +// "string_set" satisfy "expression". Example: for all of ($s1, $s2) : (@$ > 10) type ForOfExpression struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1892,7 +1953,7 @@ type ForOfExpression struct { func (x *ForOfExpression) Reset() { *x = ForOfExpression{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[20] + mi := &file_pb_yara_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1905,7 +1966,7 @@ func (x *ForOfExpression) String() string { func (*ForOfExpression) ProtoMessage() {} func (x *ForOfExpression) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[20] + mi := &file_pb_yara_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1918,7 +1979,7 @@ func (x *ForOfExpression) ProtoReflect() protoreflect.Message { // Deprecated: Use ForOfExpression.ProtoReflect.Descriptor instead. func (*ForOfExpression) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{20} + return file_pb_yara_proto_rawDescGZIP(), []int{21} } func (x *ForOfExpression) GetForExpression() *ForExpression { @@ -1957,7 +2018,7 @@ type StringSet struct { func (x *StringSet) Reset() { *x = StringSet{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[21] + mi := &file_pb_yara_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1970,7 +2031,7 @@ func (x *StringSet) String() string { func (*StringSet) ProtoMessage() {} func (x *StringSet) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[21] + mi := &file_pb_yara_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1983,7 +2044,7 @@ func (x *StringSet) ProtoReflect() protoreflect.Message { // Deprecated: Use StringSet.ProtoReflect.Descriptor instead. func (*StringSet) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{21} + return file_pb_yara_proto_rawDescGZIP(), []int{22} } func (m *StringSet) GetSet() isStringSet_Set { @@ -2040,7 +2101,7 @@ type StringEnumeration struct { func (x *StringEnumeration) Reset() { *x = StringEnumeration{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[22] + mi := &file_pb_yara_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2053,7 +2114,7 @@ func (x *StringEnumeration) String() string { func (*StringEnumeration) ProtoMessage() {} func (x *StringEnumeration) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[22] + mi := &file_pb_yara_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2066,7 +2127,7 @@ func (x *StringEnumeration) ProtoReflect() protoreflect.Message { // Deprecated: Use StringEnumeration.ProtoReflect.Descriptor instead. func (*StringEnumeration) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{22} + return file_pb_yara_proto_rawDescGZIP(), []int{23} } func (x *StringEnumeration) GetItems() []*StringEnumeration_StringEnumerationItem { @@ -2103,13 +2164,14 @@ type Expression struct { // *Expression_StringLength // *Expression_Identifier // *Expression_IntegerFunction + // *Expression_PercentageExpression Expression isExpression_Expression `protobuf_oneof:"expression"` } func (x *Expression) Reset() { *x = Expression{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[23] + mi := &file_pb_yara_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2122,7 +2184,7 @@ func (x *Expression) String() string { func (*Expression) ProtoMessage() {} func (x *Expression) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[23] + mi := &file_pb_yara_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2135,7 +2197,7 @@ func (x *Expression) ProtoReflect() protoreflect.Message { // Deprecated: Use Expression.ProtoReflect.Descriptor instead. func (*Expression) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{23} + return file_pb_yara_proto_rawDescGZIP(), []int{24} } func (m *Expression) GetExpression() isExpression_Expression { @@ -2285,6 +2347,13 @@ func (x *Expression) GetIntegerFunction() *IntegerFunction { return nil } +func (x *Expression) GetPercentageExpression() *Percentage { + if x, ok := x.GetExpression().(*Expression_PercentageExpression); ok { + return x.PercentageExpression + } + return nil +} + type isExpression_Expression interface { isExpression_Expression() } @@ -2369,6 +2438,10 @@ type Expression_IntegerFunction struct { IntegerFunction *IntegerFunction `protobuf:"bytes,20,opt,name=integer_function,json=integerFunction,oneof"` } +type Expression_PercentageExpression struct { + PercentageExpression *Percentage `protobuf:"bytes,21,opt,name=percentage_expression,json=percentageExpression,oneof"` +} + func (*Expression_BoolValue) isExpression_Expression() {} func (*Expression_BinaryExpression) isExpression_Expression() {} @@ -2409,6 +2482,8 @@ func (*Expression_Identifier) isExpression_Expression() {} func (*Expression_IntegerFunction) isExpression_Expression() {} +func (*Expression_PercentageExpression) isExpression_Expression() {} + // Refers to the offset or virtual address at which a string (or, optionally, // the i-th occurence of the string) is found. // Examples: @@ -2428,7 +2503,7 @@ type StringOffset struct { func (x *StringOffset) Reset() { *x = StringOffset{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[24] + mi := &file_pb_yara_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2441,7 +2516,7 @@ func (x *StringOffset) String() string { func (*StringOffset) ProtoMessage() {} func (x *StringOffset) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[24] + mi := &file_pb_yara_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2454,7 +2529,7 @@ func (x *StringOffset) ProtoReflect() protoreflect.Message { // Deprecated: Use StringOffset.ProtoReflect.Descriptor instead. func (*StringOffset) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{24} + return file_pb_yara_proto_rawDescGZIP(), []int{25} } func (x *StringOffset) GetStringIdentifier() string { @@ -2491,7 +2566,7 @@ type StringLength struct { func (x *StringLength) Reset() { *x = StringLength{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[25] + mi := &file_pb_yara_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2504,7 +2579,7 @@ func (x *StringLength) String() string { func (*StringLength) ProtoMessage() {} func (x *StringLength) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[25] + mi := &file_pb_yara_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2517,7 +2592,7 @@ func (x *StringLength) ProtoReflect() protoreflect.Message { // Deprecated: Use StringLength.ProtoReflect.Descriptor instead. func (*StringLength) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{25} + return file_pb_yara_proto_rawDescGZIP(), []int{26} } func (x *StringLength) GetStringIdentifier() string { @@ -2552,7 +2627,7 @@ type Identifier struct { func (x *Identifier) Reset() { *x = Identifier{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[26] + mi := &file_pb_yara_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2565,7 +2640,7 @@ func (x *Identifier) String() string { func (*Identifier) ProtoMessage() {} func (x *Identifier) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[26] + mi := &file_pb_yara_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2578,7 +2653,7 @@ func (x *Identifier) ProtoReflect() protoreflect.Message { // Deprecated: Use Identifier.ProtoReflect.Descriptor instead. func (*Identifier) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{26} + return file_pb_yara_proto_rawDescGZIP(), []int{27} } func (x *Identifier) GetItems() []*Identifier_IdentifierItem { @@ -2601,7 +2676,7 @@ type Expressions struct { func (x *Expressions) Reset() { *x = Expressions{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[27] + mi := &file_pb_yara_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2614,7 +2689,7 @@ func (x *Expressions) String() string { func (*Expressions) ProtoMessage() {} func (x *Expressions) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[27] + mi := &file_pb_yara_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2627,7 +2702,7 @@ func (x *Expressions) ProtoReflect() protoreflect.Message { // Deprecated: Use Expressions.ProtoReflect.Descriptor instead. func (*Expressions) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{27} + return file_pb_yara_proto_rawDescGZIP(), []int{28} } func (x *Expressions) GetTerms() []*Expression { @@ -2660,7 +2735,7 @@ type Rule struct { func (x *Rule) Reset() { *x = Rule{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[28] + mi := &file_pb_yara_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2673,7 +2748,7 @@ func (x *Rule) String() string { func (*Rule) ProtoMessage() {} func (x *Rule) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[28] + mi := &file_pb_yara_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2686,7 +2761,7 @@ func (x *Rule) ProtoReflect() protoreflect.Message { // Deprecated: Use Rule.ProtoReflect.Descriptor instead. func (*Rule) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{28} + return file_pb_yara_proto_rawDescGZIP(), []int{29} } func (x *Rule) GetModifiers() *RuleModifiers { @@ -2752,7 +2827,7 @@ type RuleSet struct { func (x *RuleSet) Reset() { *x = RuleSet{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[29] + mi := &file_pb_yara_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2765,7 +2840,7 @@ func (x *RuleSet) String() string { func (*RuleSet) ProtoMessage() {} func (x *RuleSet) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[29] + mi := &file_pb_yara_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2778,7 +2853,7 @@ func (x *RuleSet) ProtoReflect() protoreflect.Message { // Deprecated: Use RuleSet.ProtoReflect.Descriptor instead. func (*RuleSet) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{29} + return file_pb_yara_proto_rawDescGZIP(), []int{30} } func (x *RuleSet) GetImports() []string { @@ -2818,7 +2893,7 @@ type StringEnumeration_StringEnumerationItem struct { func (x *StringEnumeration_StringEnumerationItem) Reset() { *x = StringEnumeration_StringEnumerationItem{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[30] + mi := &file_pb_yara_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2831,7 +2906,7 @@ func (x *StringEnumeration_StringEnumerationItem) String() string { func (*StringEnumeration_StringEnumerationItem) ProtoMessage() {} func (x *StringEnumeration_StringEnumerationItem) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[30] + mi := &file_pb_yara_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2844,7 +2919,7 @@ func (x *StringEnumeration_StringEnumerationItem) ProtoReflect() protoreflect.Me // Deprecated: Use StringEnumeration_StringEnumerationItem.ProtoReflect.Descriptor instead. func (*StringEnumeration_StringEnumerationItem) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{22, 0} + return file_pb_yara_proto_rawDescGZIP(), []int{23, 0} } func (x *StringEnumeration_StringEnumerationItem) GetStringIdentifier() string { @@ -2876,7 +2951,7 @@ type Identifier_IdentifierItem struct { func (x *Identifier_IdentifierItem) Reset() { *x = Identifier_IdentifierItem{} if protoimpl.UnsafeEnabled { - mi := &file_pb_yara_proto_msgTypes[31] + mi := &file_pb_yara_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2889,7 +2964,7 @@ func (x *Identifier_IdentifierItem) String() string { func (*Identifier_IdentifierItem) ProtoMessage() {} func (x *Identifier_IdentifierItem) ProtoReflect() protoreflect.Message { - mi := &file_pb_yara_proto_msgTypes[31] + mi := &file_pb_yara_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2902,7 +2977,7 @@ func (x *Identifier_IdentifierItem) ProtoReflect() protoreflect.Message { // Deprecated: Use Identifier_IdentifierItem.ProtoReflect.Descriptor instead. func (*Identifier_IdentifierItem) Descriptor() ([]byte, []int) { - return file_pb_yara_proto_rawDescGZIP(), []int{26, 0} + return file_pb_yara_proto_rawDescGZIP(), []int{27, 0} } func (m *Identifier_IdentifierItem) GetItem() isIdentifier_IdentifierItem_Item { @@ -3114,160 +3189,173 @@ var file_pb_yara_proto_rawDesc = []byte{ 0x0a, 0x12, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x6e, 0x0a, 0x0d, 0x46, 0x6f, 0x72, - 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x0a, 0x65, 0x78, - 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, - 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x65, - 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x07, 0x6b, 0x65, 0x79, - 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x46, 0x6f, 0x72, - 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, - 0x72, 0x64, 0x42, 0x05, 0x0a, 0x03, 0x66, 0x6f, 0x72, 0x22, 0xa0, 0x01, 0x0a, 0x0f, 0x46, 0x6f, - 0x72, 0x4f, 0x66, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, - 0x0e, 0x66, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x46, 0x6f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x66, 0x6f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x73, - 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x53, 0x65, 0x74, 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x12, - 0x2b, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x71, 0x0a, 0x09, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x73, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, - 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x2d, 0x0a, 0x07, 0x6b, 0x65, 0x79, - 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, - 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x65, 0x74, 0x22, - 0xbc, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x75, - 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, - 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, - 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x67, 0x0a, 0x15, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, - 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2b, - 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x68, - 0x61, 0x73, 0x5f, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x57, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x22, 0xd5, - 0x07, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, - 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x40, - 0x0a, 0x11, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x42, 0x69, 0x6e, 0x61, - 0x72, 0x79, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x10, - 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x3d, 0x0a, 0x10, 0x75, 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x61, - 0x72, 0x79, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0f, - 0x75, 0x6e, 0x61, 0x72, 0x79, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x2d, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x3e, - 0x0a, 0x11, 0x66, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x46, 0x6f, 0x72, 0x49, - 0x6e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0f, 0x66, - 0x6f, 0x72, 0x49, 0x6e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, - 0x0a, 0x11, 0x66, 0x6f, 0x72, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x46, 0x6f, 0x72, 0x4f, - 0x66, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0f, 0x66, - 0x6f, 0x72, 0x4f, 0x66, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x34, - 0x0a, 0x0e, 0x6e, 0x6f, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x6e, 0x6f, 0x74, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x0d, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x45, 0x78, - 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0c, 0x6f, 0x72, 0x45, - 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0e, 0x61, 0x6e, 0x64, - 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0c, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x48, - 0x00, 0x52, 0x0d, 0x61, 0x6e, 0x64, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x1e, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x06, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x12, 0x21, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x07, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x70, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x67, - 0x65, 0x78, 0x70, 0x12, 0x24, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x08, 0x2e, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x00, - 0x52, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x23, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x48, - 0x00, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, - 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0e, - 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, - 0x0a, 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, - 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x12, 0x34, 0x0a, 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x2d, 0x0a, 0x0a, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, - 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0a, 0x69, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x10, 0x69, 0x6e, 0x74, - 0x65, 0x67, 0x65, 0x72, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x14, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x46, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, - 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5e, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x10, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, - 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x5e, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x10, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, - 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xce, 0x01, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, - 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x8d, 0x01, 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x20, 0x0a, 0x0a, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x05, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, - 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x12, 0x2c, 0x0a, 0x09, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x48, 0x00, 0x52, 0x09, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42, - 0x06, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x30, 0x0a, 0x0b, 0x45, 0x78, 0x70, 0x72, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x04, 0x52, 0x75, - 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x4d, 0x6f, 0x64, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x73, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, - 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, - 0x74, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, - 0x21, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x07, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x73, 0x12, 0x29, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, - 0x07, 0x52, 0x75, 0x6c, 0x65, 0x53, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6d, 0x70, 0x6f, - 0x72, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6d, 0x70, 0x6f, 0x72, - 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x73, 0x12, 0x1b, - 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x05, 0x2e, - 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x2a, 0x34, 0x0a, 0x07, 0x4b, - 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x50, 0x4f, 0x49, 0x4e, - 0x54, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x49, 0x4c, 0x45, 0x53, 0x49, 0x5a, 0x45, 0x10, - 0x03, 0x2a, 0x28, 0x0a, 0x0a, 0x46, 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, - 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4c, 0x4c, - 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x1c, 0x0a, 0x10, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, - 0x08, 0x0a, 0x04, 0x54, 0x48, 0x45, 0x4d, 0x10, 0x01, 0x42, 0x05, 0x5a, 0x03, 0x70, 0x62, 0x2f, + 0x6e, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x39, 0x0a, 0x0a, 0x50, 0x65, 0x72, + 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x0d, 0x46, 0x6f, 0x72, 0x45, 0x78, 0x70, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x46, 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x77, + 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x2d, + 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x48, + 0x00, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x42, 0x05, 0x0a, + 0x03, 0x66, 0x6f, 0x72, 0x22, 0xa0, 0x01, 0x0a, 0x0f, 0x46, 0x6f, 0x72, 0x4f, 0x66, 0x45, 0x78, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0e, 0x66, 0x6f, 0x72, 0x5f, + 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0e, 0x2e, 0x46, 0x6f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x0d, 0x66, 0x6f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x29, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x52, + 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x12, 0x2b, 0x0a, 0x0a, 0x65, 0x78, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, + 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x71, 0x0a, 0x09, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x53, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, + 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x07, 0x73, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x73, 0x12, 0x2d, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x65, + 0x74, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x77, + 0x6f, 0x72, 0x64, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x65, 0x74, 0x22, 0xbc, 0x01, 0x0a, 0x11, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x3e, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x28, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x1a, 0x67, 0x0a, 0x15, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x61, 0x73, 0x5f, 0x77, 0x69, + 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x68, 0x61, + 0x73, 0x57, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x22, 0x99, 0x08, 0x0a, 0x0a, 0x45, 0x78, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, + 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x62, 0x69, 0x6e, + 0x61, 0x72, 0x79, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x45, 0x78, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x10, 0x62, 0x69, 0x6e, 0x61, 0x72, + 0x79, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x10, 0x75, + 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x45, 0x78, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x72, 0x79, + 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x11, 0x73, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x11, 0x66, 0x6f, 0x72, + 0x5f, 0x69, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x46, 0x6f, 0x72, 0x49, 0x6e, 0x45, 0x78, 0x70, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0f, 0x66, 0x6f, 0x72, 0x49, 0x6e, 0x45, + 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x11, 0x66, 0x6f, 0x72, + 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x46, 0x6f, 0x72, 0x4f, 0x66, 0x45, 0x78, 0x70, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0f, 0x66, 0x6f, 0x72, 0x4f, 0x66, 0x45, + 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x0e, 0x6e, 0x6f, 0x74, + 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, + 0x52, 0x0d, 0x6e, 0x6f, 0x74, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x33, 0x0a, 0x0d, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0c, 0x6f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0e, 0x61, 0x6e, 0x64, 0x5f, 0x65, 0x78, 0x70, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x45, + 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x6e, + 0x64, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x05, 0x72, + 0x61, 0x6e, 0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x00, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x06, 0x72, + 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x52, 0x65, + 0x67, 0x65, 0x78, 0x70, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x12, 0x24, + 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x08, 0x2e, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, 0x07, 0x6b, 0x65, 0x79, + 0x77, 0x6f, 0x72, 0x64, 0x12, 0x23, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0b, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, + 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x01, 0x48, + 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, + 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, + 0x74, 0x65, 0x78, 0x74, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x0d, 0x73, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x48, + 0x00, 0x52, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, + 0x34, 0x0a, 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x2d, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x10, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x5f, + 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x00, 0x52, 0x0f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x46, 0x75, 0x6e, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x15, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, + 0x65, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x15, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x48, + 0x00, 0x52, 0x14, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x45, 0x78, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5e, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x12, 0x21, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x05, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x5e, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x12, 0x21, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x05, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xce, 0x01, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x8d, 0x01, 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x20, 0x0a, 0x0a, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x05, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x12, 0x2c, 0x0a, 0x09, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x48, 0x00, 0x52, 0x09, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x06, + 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x30, 0x0a, 0x0b, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x04, 0x52, 0x75, 0x6c, + 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x4d, 0x6f, 0x64, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x73, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, + 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x05, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, 0x21, + 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x07, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x73, 0x12, 0x29, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x07, + 0x52, 0x75, 0x6c, 0x65, 0x53, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6d, 0x70, 0x6f, 0x72, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x73, 0x12, 0x1b, 0x0a, + 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x52, + 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x2a, 0x34, 0x0a, 0x07, 0x4b, 0x65, + 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x50, 0x4f, 0x49, 0x4e, 0x54, + 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x49, 0x4c, 0x45, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x03, + 0x2a, 0x28, 0x0a, 0x0a, 0x46, 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x08, + 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4c, 0x4c, 0x10, + 0x01, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x1c, 0x0a, 0x10, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x08, + 0x0a, 0x04, 0x54, 0x48, 0x45, 0x4d, 0x10, 0x01, 0x42, 0x1e, 0x5a, 0x1c, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x56, 0x69, 0x72, 0x75, 0x73, 0x54, 0x6f, 0x74, 0x61, + 0x6c, 0x2f, 0x67, 0x79, 0x70, 0x2f, 0x70, 0x62, } var ( @@ -3283,7 +3371,7 @@ func file_pb_yara_proto_rawDescGZIP() []byte { } var file_pb_yara_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_pb_yara_proto_msgTypes = make([]protoimpl.MessageInfo, 32) +var file_pb_yara_proto_msgTypes = make([]protoimpl.MessageInfo, 33) var file_pb_yara_proto_goTypes = []interface{}{ (Keyword)(0), // 0: Keyword (ForKeyword)(0), // 1: ForKeyword @@ -3309,19 +3397,20 @@ var file_pb_yara_proto_goTypes = []interface{}{ (*Iterator)(nil), // 21: Iterator (*IntegerSet)(nil), // 22: IntegerSet (*IntegerEnumeration)(nil), // 23: IntegerEnumeration - (*ForExpression)(nil), // 24: ForExpression - (*ForOfExpression)(nil), // 25: ForOfExpression - (*StringSet)(nil), // 26: StringSet - (*StringEnumeration)(nil), // 27: StringEnumeration - (*Expression)(nil), // 28: Expression - (*StringOffset)(nil), // 29: StringOffset - (*StringLength)(nil), // 30: StringLength - (*Identifier)(nil), // 31: Identifier - (*Expressions)(nil), // 32: Expressions - (*Rule)(nil), // 33: Rule - (*RuleSet)(nil), // 34: RuleSet - (*StringEnumeration_StringEnumerationItem)(nil), // 35: StringEnumeration.StringEnumerationItem - (*Identifier_IdentifierItem)(nil), // 36: Identifier.IdentifierItem + (*Percentage)(nil), // 24: Percentage + (*ForExpression)(nil), // 25: ForExpression + (*ForOfExpression)(nil), // 26: ForOfExpression + (*StringSet)(nil), // 27: StringSet + (*StringEnumeration)(nil), // 28: StringEnumeration + (*Expression)(nil), // 29: Expression + (*StringOffset)(nil), // 30: StringOffset + (*StringLength)(nil), // 31: StringLength + (*Identifier)(nil), // 32: Identifier + (*Expressions)(nil), // 33: Expressions + (*Rule)(nil), // 34: Rule + (*RuleSet)(nil), // 35: RuleSet + (*StringEnumeration_StringEnumerationItem)(nil), // 36: StringEnumeration.StringEnumerationItem + (*Identifier_IdentifierItem)(nil), // 37: Identifier.IdentifierItem } var file_pb_yara_proto_depIdxs = []int32{ 9, // 0: String.text:type_name -> TextString @@ -3335,59 +3424,62 @@ var file_pb_yara_proto_depIdxs = []int32{ 13, // 8: HexToken.alternative:type_name -> HexAlternative 11, // 9: HexAlternative.tokens:type_name -> HexTokens 3, // 10: BinaryExpression.operator:type_name -> BinaryExpression.Operator - 28, // 11: BinaryExpression.left:type_name -> Expression - 28, // 12: BinaryExpression.right:type_name -> Expression + 29, // 11: BinaryExpression.left:type_name -> Expression + 29, // 12: BinaryExpression.right:type_name -> Expression 4, // 13: UnaryExpression.operator:type_name -> UnaryExpression.Operator - 28, // 14: UnaryExpression.expression:type_name -> Expression - 28, // 15: Range.start:type_name -> Expression - 28, // 16: Range.end:type_name -> Expression - 28, // 17: IntegerFunction.argument:type_name -> Expression - 24, // 18: ForInExpression.for_expression:type_name -> ForExpression + 29, // 14: UnaryExpression.expression:type_name -> Expression + 29, // 15: Range.start:type_name -> Expression + 29, // 16: Range.end:type_name -> Expression + 29, // 17: IntegerFunction.argument:type_name -> Expression + 25, // 18: ForInExpression.for_expression:type_name -> ForExpression 21, // 19: ForInExpression.iterator:type_name -> Iterator - 28, // 20: ForInExpression.expression:type_name -> Expression + 29, // 20: ForInExpression.expression:type_name -> Expression 22, // 21: Iterator.integer_set:type_name -> IntegerSet - 31, // 22: Iterator.identifier:type_name -> Identifier + 32, // 22: Iterator.identifier:type_name -> Identifier 23, // 23: IntegerSet.integer_enumeration:type_name -> IntegerEnumeration 18, // 24: IntegerSet.range:type_name -> Range - 28, // 25: IntegerEnumeration.values:type_name -> Expression - 28, // 26: ForExpression.expression:type_name -> Expression - 1, // 27: ForExpression.keyword:type_name -> ForKeyword - 24, // 28: ForOfExpression.for_expression:type_name -> ForExpression - 26, // 29: ForOfExpression.string_set:type_name -> StringSet - 28, // 30: ForOfExpression.expression:type_name -> Expression - 27, // 31: StringSet.strings:type_name -> StringEnumeration - 2, // 32: StringSet.keyword:type_name -> StringSetKeyword - 35, // 33: StringEnumeration.items:type_name -> StringEnumeration.StringEnumerationItem - 16, // 34: Expression.binary_expression:type_name -> BinaryExpression - 17, // 35: Expression.unary_expression:type_name -> UnaryExpression - 20, // 36: Expression.for_in_expression:type_name -> ForInExpression - 25, // 37: Expression.for_of_expression:type_name -> ForOfExpression - 28, // 38: Expression.not_expression:type_name -> Expression - 32, // 39: Expression.or_expression:type_name -> Expressions - 32, // 40: Expression.and_expression:type_name -> Expressions - 18, // 41: Expression.range:type_name -> Range - 10, // 42: Expression.regexp:type_name -> Regexp - 0, // 43: Expression.keyword:type_name -> Keyword - 29, // 44: Expression.string_offset:type_name -> StringOffset - 30, // 45: Expression.string_length:type_name -> StringLength - 31, // 46: Expression.identifier:type_name -> Identifier - 19, // 47: Expression.integer_function:type_name -> IntegerFunction - 28, // 48: StringOffset.index:type_name -> Expression - 28, // 49: StringLength.index:type_name -> Expression - 36, // 50: Identifier.items:type_name -> Identifier.IdentifierItem - 28, // 51: Expressions.terms:type_name -> Expression - 5, // 52: Rule.modifiers:type_name -> RuleModifiers - 6, // 53: Rule.meta:type_name -> Meta - 7, // 54: Rule.strings:type_name -> String - 28, // 55: Rule.condition:type_name -> Expression - 33, // 56: RuleSet.rules:type_name -> Rule - 28, // 57: Identifier.IdentifierItem.index:type_name -> Expression - 32, // 58: Identifier.IdentifierItem.arguments:type_name -> Expressions - 59, // [59:59] is the sub-list for method output_type - 59, // [59:59] is the sub-list for method input_type - 59, // [59:59] is the sub-list for extension type_name - 59, // [59:59] is the sub-list for extension extendee - 0, // [0:59] is the sub-list for field type_name + 29, // 25: IntegerEnumeration.values:type_name -> Expression + 29, // 26: Percentage.expression:type_name -> Expression + 29, // 27: ForExpression.expression:type_name -> Expression + 1, // 28: ForExpression.keyword:type_name -> ForKeyword + 24, // 29: ForExpression.percentage:type_name -> Percentage + 25, // 30: ForOfExpression.for_expression:type_name -> ForExpression + 27, // 31: ForOfExpression.string_set:type_name -> StringSet + 29, // 32: ForOfExpression.expression:type_name -> Expression + 28, // 33: StringSet.strings:type_name -> StringEnumeration + 2, // 34: StringSet.keyword:type_name -> StringSetKeyword + 36, // 35: StringEnumeration.items:type_name -> StringEnumeration.StringEnumerationItem + 16, // 36: Expression.binary_expression:type_name -> BinaryExpression + 17, // 37: Expression.unary_expression:type_name -> UnaryExpression + 20, // 38: Expression.for_in_expression:type_name -> ForInExpression + 26, // 39: Expression.for_of_expression:type_name -> ForOfExpression + 29, // 40: Expression.not_expression:type_name -> Expression + 33, // 41: Expression.or_expression:type_name -> Expressions + 33, // 42: Expression.and_expression:type_name -> Expressions + 18, // 43: Expression.range:type_name -> Range + 10, // 44: Expression.regexp:type_name -> Regexp + 0, // 45: Expression.keyword:type_name -> Keyword + 30, // 46: Expression.string_offset:type_name -> StringOffset + 31, // 47: Expression.string_length:type_name -> StringLength + 32, // 48: Expression.identifier:type_name -> Identifier + 19, // 49: Expression.integer_function:type_name -> IntegerFunction + 24, // 50: Expression.percentage_expression:type_name -> Percentage + 29, // 51: StringOffset.index:type_name -> Expression + 29, // 52: StringLength.index:type_name -> Expression + 37, // 53: Identifier.items:type_name -> Identifier.IdentifierItem + 29, // 54: Expressions.terms:type_name -> Expression + 5, // 55: Rule.modifiers:type_name -> RuleModifiers + 6, // 56: Rule.meta:type_name -> Meta + 7, // 57: Rule.strings:type_name -> String + 29, // 58: Rule.condition:type_name -> Expression + 34, // 59: RuleSet.rules:type_name -> Rule + 29, // 60: Identifier.IdentifierItem.index:type_name -> Expression + 33, // 61: Identifier.IdentifierItem.arguments:type_name -> Expressions + 62, // [62:62] is the sub-list for method output_type + 62, // [62:62] is the sub-list for method input_type + 62, // [62:62] is the sub-list for extension type_name + 62, // [62:62] is the sub-list for extension extendee + 0, // [0:62] is the sub-list for field type_name } func init() { file_pb_yara_proto_init() } @@ -3625,7 +3717,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ForExpression); i { + switch v := v.(*Percentage); i { case 0: return &v.state case 1: @@ -3637,7 +3729,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ForOfExpression); i { + switch v := v.(*ForExpression); i { case 0: return &v.state case 1: @@ -3649,7 +3741,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringSet); i { + switch v := v.(*ForOfExpression); i { case 0: return &v.state case 1: @@ -3661,7 +3753,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringEnumeration); i { + switch v := v.(*StringSet); i { case 0: return &v.state case 1: @@ -3673,7 +3765,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expression); i { + switch v := v.(*StringEnumeration); i { case 0: return &v.state case 1: @@ -3685,7 +3777,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringOffset); i { + switch v := v.(*Expression); i { case 0: return &v.state case 1: @@ -3697,7 +3789,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringLength); i { + switch v := v.(*StringOffset); i { case 0: return &v.state case 1: @@ -3709,7 +3801,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identifier); i { + switch v := v.(*StringLength); i { case 0: return &v.state case 1: @@ -3721,7 +3813,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expressions); i { + switch v := v.(*Identifier); i { case 0: return &v.state case 1: @@ -3733,7 +3825,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Rule); i { + switch v := v.(*Expressions); i { case 0: return &v.state case 1: @@ -3745,7 +3837,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuleSet); i { + switch v := v.(*Rule); i { case 0: return &v.state case 1: @@ -3757,7 +3849,7 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringEnumeration_StringEnumerationItem); i { + switch v := v.(*RuleSet); i { case 0: return &v.state case 1: @@ -3769,6 +3861,18 @@ func file_pb_yara_proto_init() { } } file_pb_yara_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StringEnumeration_StringEnumerationItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pb_yara_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Identifier_IdentifierItem); i { case 0: return &v.state @@ -3804,15 +3908,16 @@ func file_pb_yara_proto_init() { (*IntegerSet_IntegerEnumeration)(nil), (*IntegerSet_Range)(nil), } - file_pb_yara_proto_msgTypes[19].OneofWrappers = []interface{}{ + file_pb_yara_proto_msgTypes[20].OneofWrappers = []interface{}{ (*ForExpression_Expression)(nil), (*ForExpression_Keyword)(nil), + (*ForExpression_Percentage)(nil), } - file_pb_yara_proto_msgTypes[21].OneofWrappers = []interface{}{ + file_pb_yara_proto_msgTypes[22].OneofWrappers = []interface{}{ (*StringSet_Strings)(nil), (*StringSet_Keyword)(nil), } - file_pb_yara_proto_msgTypes[23].OneofWrappers = []interface{}{ + file_pb_yara_proto_msgTypes[24].OneofWrappers = []interface{}{ (*Expression_BoolValue)(nil), (*Expression_BinaryExpression)(nil), (*Expression_UnaryExpression)(nil), @@ -3833,8 +3938,9 @@ func file_pb_yara_proto_init() { (*Expression_StringLength)(nil), (*Expression_Identifier)(nil), (*Expression_IntegerFunction)(nil), + (*Expression_PercentageExpression)(nil), } - file_pb_yara_proto_msgTypes[31].OneofWrappers = []interface{}{ + file_pb_yara_proto_msgTypes[32].OneofWrappers = []interface{}{ (*Identifier_IdentifierItem_Identifier)(nil), (*Identifier_IdentifierItem_Index)(nil), (*Identifier_IdentifierItem_Arguments)(nil), @@ -3845,7 +3951,7 @@ func file_pb_yara_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pb_yara_proto_rawDesc, NumEnums: 5, - NumMessages: 32, + NumMessages: 33, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/yara.proto b/pb/yara.proto index 3b49c55..58c3019 100644 --- a/pb/yara.proto +++ b/pb/yara.proto @@ -271,12 +271,17 @@ message IntegerEnumeration { repeated Expression values = 1; } +message Percentage { + optional Expression expression = 1; +} + // FOR expression, used as part of ForInExpressions and ForOrExpressions. // Can contain either an expression or a keyword. message ForExpression { oneof for { Expression expression = 1; // Example: "for 10" ForKeyword keyword = 2; // Example: "for all" + Percentage percentage = 3; // Example: "x%" } } @@ -370,6 +375,7 @@ message Expression { StringLength string_length = 18; Identifier identifier = 19; IntegerFunction integer_function = 20; + Percentage percentage_expression = 21; } } diff --git a/serialize.go b/serialize.go index 3682136..c39da37 100644 --- a/serialize.go +++ b/serialize.go @@ -533,6 +533,16 @@ func (ys *YaraSerializer) serializeHexAlternative(alt *pb.HexAlternative) error return nil } +func (ys *YaraSerializer) serializePercentage(p *pb.Percentage) error { + if err := ys.SerializeExpression(p.Expression); err != nil { + return err + } + if err := ys.writeString("%"); err != nil { + return err + } + return nil +} + // SerializeExpression serializes an Expression in a YARA rule condition. func (ys *YaraSerializer) SerializeExpression(e *pb.Expression) error { switch val := e.GetExpression().(type) { @@ -583,6 +593,8 @@ func (ys *YaraSerializer) SerializeExpression(e *pb.Expression) error { return ys.serializeStringLength(e.GetStringLength()) case *pb.Expression_StringCount: return ys.writeString(e.GetStringCount()) + case *pb.Expression_PercentageExpression: + return ys.serializePercentage(e.GetPercentageExpression()) default: return fmt.Errorf(`Unsupported Expression type "%T"`, val) } diff --git a/tests/grammar_test.go b/tests/grammar_test.go index c0994d7..fae0c1f 100644 --- a/tests/grammar_test.go +++ b/tests/grammar_test.go @@ -262,6 +262,22 @@ rule KEYWORD_NONE { condition: none of them } + +rule PERCENT_OF { + strings: + $s0 = "AXSERS" + $s1 = "WXSMTS" + condition: + 50% of them +} + +rule PERCENT_OF_IDENTIFIER { + strings: + $s0 = "AXSERS" + $s1 = "WXSMTS" + condition: + x% of them +} ` func TestRulesetParsing(t *testing.T) {