2222 bool block;
2323 char *arg0;
2424 long arg0_long;
25+ int arg0_matchtype;
2526 char *arg1;
2627 long arg1_long;
28+ int arg1_matchtype;
2729 char *arg2;
2830 long arg2_long;
31+ int arg2_matchtype;
2932 char *arg3;
3033 long arg3_long;
34+ int arg3_matchtype;
3135 char *arg4;
3236 long arg4_long;
37+ int arg4_matchtype;
3338 char *arg5;
3439 long arg5_long;
40+ int arg5_matchtype;
3541
3642 struct syscall *next;
3743 struct syscall *prev;
38- }} syscall_default = {{NULL, -1, false, false, NULL, -1, NULL, -1, NULL, -1, NULL, -1, NULL, -1, NULL, -1, NULL, NULL}};
44+ }} syscall_default = {{NULL, -1, false, false, NULL, -1, 0, NULL, -1, 0, NULL, -1, 0, NULL, -1, 0, NULL, -1, 0, NULL, -1, 0 , NULL, NULL}};
3945
4046typedef struct syscall syscall;
4147
5359 "set_block" : "{varname}->block = {block};\n " ,
5460 "set_arg_char" : '{varname}->{argname} = (char *) malloc(strlen("{arg}")+1);\n strcpy({varname}->{argname}, "{arg}");\n ' ,
5561 "set_arg_long" : '{varname}->{argname}_long = {arg};\n ' ,
62+ "set_arg_matchtype" : '{varname}->{argname}_matchtype = {matchtype};\n ' ,
5663 "set_next" : "{varname}->next = {nextcall};\n " ,
5764 "set_prev" : "{varname}->prev = {prevcall};\n " ,
5865}
@@ -63,17 +70,23 @@ class Syscall:
6370 log : bool
6471 block : bool
6572 arg0 : str = ""
66- arg_char : bool = True
73+ arg0_char : bool = True
74+ arg0_matchtype : str = "full"
6775 arg1 : str = ""
6876 arg1_char : bool = True
77+ arg1_matchtype : str = "full"
6978 arg2 : str = ""
7079 arg2_char : bool = True
80+ arg2_matchtype : str = "full"
7181 arg3 : str = ""
7282 arg3_char : bool = True
83+ arg3_matchtype : str = "full"
7384 arg4 : str = ""
7485 arg4_char : bool = True
86+ arg4_matchtype : str = "full"
7587 arg5 : str = ""
7688 arg5_char : bool = True
89+ arg5_matchtype : str = "full"
7790
7891 def __init__ (
7992 self ,
@@ -82,32 +95,44 @@ def __init__(
8295 block : bool ,
8396 arg0 : str = "" ,
8497 arg0_char : bool = True ,
98+ arg0_matchtype : str = "full" ,
8599 arg1 : str = "" ,
86100 arg1_char : bool = True ,
101+ arg1_matchtype : str = "full" ,
87102 arg2 : str = "" ,
88103 arg2_char : bool = True ,
104+ arg2_matchtype : str = "full" ,
89105 arg3 : str = "" ,
90106 arg3_char : bool = True ,
107+ arg3_matchtype : str = "full" ,
91108 arg4 : str = "" ,
92109 arg4_char : bool = True ,
110+ arg4_matchtype : str = "full" ,
93111 arg5 : str = "" ,
94112 arg5_char : bool = True ,
113+ arg5_matchtype : str = "full" ,
95114 ):
96115 self .name = name
97116 self .log = log
98117 self .block = block
99118 self .arg0 = arg0
100119 self .arg0_char = arg0_char
120+ self .arg0_matchtype = arg0_matchtype
101121 self .arg1 = arg1
102122 self .arg1_char = arg1_char
123+ self .arg1_matchtype = arg1_matchtype
103124 self .arg2 = arg2
104125 self .arg2_char = arg2_char
126+ self .arg2_matchtype = arg2_matchtype
105127 self .arg3 = arg3
106128 self .arg3_char = arg3_char
129+ self .arg3_matchtype = arg3_matchtype
107130 self .arg4 = arg4
108131 self .arg4_char = arg4_char
132+ self .arg4_matchtype = arg4_matchtype
109133 self .arg5 = arg5
110134 self .arg5_char = arg5_char
135+ self .arg5_matchtype = arg5_matchtype
111136
112137 def build_c_code (self , varname : str ) -> str :
113138 c_code = structbuild_template ["var_define" ].format (varname = varname )
@@ -132,16 +157,21 @@ def build_c_code(self, varname: str) -> str:
132157 c_code = c_code + structbuild_template ["set_arg_char" ].format (
133158 varname = varname , argname = "arg0" , arg = self .arg0
134159 )
160+ c_code = c_code + structbuild_template ["set_arg_matchtype" ].format (
161+ varname = varname , argname = "arg0" , matchtype = 0 if self .arg0_matchtype == "full" else - 1 if self .arg0_matchtype == "begins" else 1
162+ )
135163 else :
136164 c_code = c_code + structbuild_template ["set_arg_long" ].format (
137165 varname = varname , argname = "arg0" , arg = self .arg0
138166 )
139-
140167 if self .arg1 != "" :
141168 if self .arg1_char :
142169 c_code = c_code + structbuild_template ["set_arg_char" ].format (
143170 varname = varname , argname = "arg1" , arg = self .arg1
144171 )
172+ c_code = c_code + structbuild_template ["set_arg_matchtype" ].format (
173+ varname = varname , argname = "arg1" , matchtype = 0 if self .arg1_matchtype == "full" else - 1 if self .arg1_matchtype == "begins" else 1
174+ )
145175 else :
146176 c_code = c_code + structbuild_template ["set_arg_long" ].format (
147177 varname = varname , argname = "arg1" , arg = self .arg1
@@ -152,6 +182,9 @@ def build_c_code(self, varname: str) -> str:
152182 c_code = c_code + structbuild_template ["set_arg_char" ].format (
153183 varname = varname , argname = "arg2" , arg = self .arg2
154184 )
185+ c_code = c_code + structbuild_template ["set_arg_matchtype" ].format (
186+ varname = varname , argname = "arg2" , matchtype = 0 if self .arg2_matchtype == "full" else - 1 if self .arg2_matchtype == "begins" else 1
187+ )
155188 else :
156189 c_code = c_code + structbuild_template ["set_arg_long" ].format (
157190 varname = varname , argname = "arg2" , arg = self .arg2
@@ -163,6 +196,9 @@ def build_c_code(self, varname: str) -> str:
163196 c_code = c_code + structbuild_template ["set_arg_char" ].format (
164197 varname = varname , argname = "arg3" , arg = self .arg3
165198 )
199+ c_code = c_code + structbuild_template ["set_arg_matchtype" ].format (
200+ varname = varname , argname = "arg3" , matchtype = 0 if self .arg3_matchtype == "full" else - 1 if self .arg3_matchtype == "begins" else 1
201+ )
166202 else :
167203 c_code = c_code + structbuild_template ["set_arg_long" ].format (
168204 varname = varname , argname = "arg3" , arg = self .arg3
@@ -173,6 +209,9 @@ def build_c_code(self, varname: str) -> str:
173209 c_code = c_code + structbuild_template ["set_arg_char" ].format (
174210 varname = varname , argname = "arg4" , arg = self .arg4
175211 )
212+ c_code = c_code + structbuild_template ["set_arg_matchtype" ].format (
213+ varname = varname , argname = "arg4" , matchtype = 0 if self .arg4_matchtype == "full" else - 1 if self .arg4_matchtype == "begins" else 1
214+ )
176215 else :
177216 c_code = c_code + structbuild_template ["set_arg_long" ].format (
178217 varname = varname , argname = "arg4" , arg = self .arg4
@@ -183,6 +222,9 @@ def build_c_code(self, varname: str) -> str:
183222 c_code = c_code + structbuild_template ["set_arg_char" ].format (
184223 varname = varname , argname = "arg5" , arg = self .arg5
185224 )
225+ c_code = c_code + structbuild_template ["set_arg_matchtype" ].format (
226+ varname = varname , argname = "arg5" , matchtype = 0 if self .arg5_matchtype == "full" else - 1 if self .arg5_matchtype == "begins" else 1
227+ )
186228 else :
187229 c_code = c_code + structbuild_template ["set_arg_long" ].format (
188230 varname = varname , argname = "arg5" , arg = self .arg5
@@ -200,21 +242,27 @@ def init_from_dict(parsed: dict):
200242 if parsed .get ("arg0" ) is not None :
201243 call .arg0 = str (parsed .get ("arg0" ))
202244 call .arg0_char = bool (parsed .get ("arg0_char" ))
245+ call .arg0_matchtype = str (parsed .get ("arg0_matchtype" ))
203246 if parsed .get ("arg1" ) is not None :
204247 call .arg1 = str (parsed .get ("arg1" ))
205248 call .arg1_char = bool (parsed .get ("arg1_char" ))
249+ call .arg1_matchtype = str (parsed .get ("arg1_matchtype" ))
206250 if parsed .get ("arg2" ) is not None :
207251 call .arg2 = str (parsed .get ("arg2" ))
208252 call .arg2_char = bool (parsed .get ("arg2_char" ))
253+ call .arg2_matchtype = str (parsed .get ("arg2_matchtype" ))
209254 if parsed .get ("arg3" ) is not None :
210255 call .arg3 = str (parsed .get ("arg3" ))
211256 call .arg3_char = bool (parsed .get ("arg3_char" ))
257+ call .arg3_matchtype = str (parsed .get ("arg3_matchtype" ))
212258 if parsed .get ("arg4" ) is not None :
213259 call .arg4 = str (parsed .get ("arg4" ))
214260 call .arg4_char = bool (parsed .get ("arg4_char" ))
261+ call .arg4_matchtype = str (parsed .get ("arg4_matchtype" ))
215262 if parsed .get ("arg5" ) is not None :
216263 call .arg5 = str (parsed .get ("arg5" ))
217264 call .arg5_char = bool (parsed .get ("arg5_char" ))
265+ call .arg5_matchtype = str (parsed .get ("arg5_matchtype" ))
218266 return call
219267
220268
0 commit comments