3434logger = logging .getLogger (__name__ )
3535
3636
37- IGNORE_NUMBER_PATTERNS = BinExport2InstructionPatternMatcher .from_str (
38- """
37+ IGNORE_NUMBER_PATTERNS = BinExport2InstructionPatternMatcher .from_str ("""
3938 ret #int
4039 retn #int
4140 add reg(stack), #int
4241 sub reg(stack), #int
43- """
44- )
42+ """ )
4543
46- NUMBER_PATTERNS = BinExport2InstructionPatternMatcher .from_str (
47- """
44+ NUMBER_PATTERNS = BinExport2InstructionPatternMatcher .from_str ("""
4845 push #int0 ; capture #int0
4946
5047 # its a little tedious to enumerate all the address forms
6461 # imagine reg is zero'd out, then this is like `mov reg, #int`
6562 # which is not uncommon.
6663 lea reg, [reg + #int] ; capture #int
67- """
68- )
64+ """ )
6965
7066
7167def extract_insn_number_features (
@@ -100,8 +96,7 @@ def extract_insn_number_features(
10096 yield OperandOffset (match .operand_index , value ), ih .address
10197
10298
103- OFFSET_PATTERNS = BinExport2InstructionPatternMatcher .from_str (
104- """
99+ OFFSET_PATTERNS = BinExport2InstructionPatternMatcher .from_str ("""
105100 mov|movzx|movsb|cmp [reg + reg * #int + #int0], #int ; capture #int0
106101 mov|movzx|movsb|cmp [reg * #int + #int0], #int ; capture #int0
107102 mov|movzx|movsb|cmp [reg + reg + #int0], #int ; capture #int0
@@ -114,18 +109,15 @@ def extract_insn_number_features(
114109 mov|movzx|movsb|cmp|lea reg, [reg * #int + #int0] ; capture #int0
115110 mov|movzx|movsb|cmp|lea reg, [reg + reg + #int0] ; capture #int0
116111 mov|movzx|movsb|cmp|lea reg, [reg(not-stack) + #int0] ; capture #int0
117- """
118- )
112+ """ )
119113
120114# these are patterns that access offset 0 from some pointer
121115# (pointer is not the stack pointer).
122- OFFSET_ZERO_PATTERNS = BinExport2InstructionPatternMatcher .from_str (
123- """
116+ OFFSET_ZERO_PATTERNS = BinExport2InstructionPatternMatcher .from_str ("""
124117 mov|movzx|movsb [reg(not-stack)], reg
125118 mov|movzx|movsb [reg(not-stack)], #int
126119 lea reg, [reg(not-stack)]
127- """
128- )
120+ """ )
129121
130122
131123def extract_insn_offset_features (
@@ -189,12 +181,10 @@ def is_security_cookie(
189181 return False
190182
191183
192- NZXOR_PATTERNS = BinExport2InstructionPatternMatcher .from_str (
193- """
184+ NZXOR_PATTERNS = BinExport2InstructionPatternMatcher .from_str ("""
194185 xor|xorpd|xorps|pxor reg, reg
195186 xor|xorpd|xorps|pxor reg, #int
196- """
197- )
187+ """ )
198188
199189
200190def extract_insn_nzxor_characteristic_features (
@@ -228,17 +218,15 @@ def extract_insn_nzxor_characteristic_features(
228218 yield Characteristic ("nzxor" ), ih .address
229219
230220
231- INDIRECT_CALL_PATTERNS = BinExport2InstructionPatternMatcher .from_str (
232- """
221+ INDIRECT_CALL_PATTERNS = BinExport2InstructionPatternMatcher .from_str ("""
233222 call|jmp reg0
234223 call|jmp [reg + reg * #int + #int]
235224 call|jmp [reg + reg * #int]
236225 call|jmp [reg * #int + #int]
237226 call|jmp [reg + reg + #int]
238227 call|jmp [reg + #int]
239228 call|jmp [reg]
240- """
241- )
229+ """ )
242230
243231
244232def extract_function_indirect_call_characteristic_features (
0 commit comments