CustomSimProcedure
¤
CustomSimProcedure
¤
CustomSimProcedure(verbose=False)
Bases: ABC
Abstract base class for custom simulation procedures.
This class defines various attributes and methods for handling custom simulation procedures, loading libraries, setting calling conventions, and creating simprocedures.
This method sets up attributes for handling custom simulation procedures, system call tables, and tracking found syscalls.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
132 133 134 135 136 137 138 139 140 141 |
|
amd64_sim_proc_hook
abstractmethod
¤
amd64_sim_proc_hook(project, name, sim_proc)
Defines an abstract method for applying an AMD64 specific simulation procedure hook to a symbol in the project.
This method must be implemented in subclasses to handle the application of AMD64 simulation procedure hooks.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
459 460 461 462 463 464 465 466 |
|
clear
¤
clear()
Clears all data structures within the object.
This method empties the dictionaries sim_proc
, system_call_table
, and syscall_found
.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
151 152 153 154 155 156 157 158 159 |
|
create_lib_procedures
¤
create_lib_procedures(dlldict, libname, angrlib)
Creates library procedures based on the provided dictionary, library name, and angr library.
This function iterates through the dictionary of procedures, extracts arguments, checks for argument mismatches, and creates custom simulation procedures for each procedure in the library.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
create_sim_procedure
¤
create_sim_procedure(name, args, ret, args_mismatch)
Creates a custom simulation procedure based on the provided name, arguments, return type, and arguments mismatch flag.
This method dynamically generates a custom simulation procedure with specific characteristics based on the input parameters.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
266 267 268 269 270 271 272 273 274 275 |
|
custom_hook_no_symbols
¤
custom_hook_no_symbols(proj)
Applies custom simulation procedures to the project's syscall library when no symbols are present.
This function adds custom simulation procedures to the syscall library based on predefined custom and generic procedures, ensuring proper handling for functions not implemented.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
|
custom_hook_static
abstractmethod
¤
custom_hook_static(proj)
Defines an abstract method for applying custom static hooks in the project.
This method must be implemented in subclasses to handle the application of custom static hooks in the project.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
468 469 470 471 472 473 474 475 |
|
deal_with_alt_names
abstractmethod
¤
deal_with_alt_names(pkg_name, proc)
Defines the behavior for handling alternative names in simulation procedures.
This method is abstract and must be implemented in subclasses to specify how to deal with alternative names in simulation procedures.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
277 278 279 280 281 282 283 284 |
|
exception_sim_proc_hook
¤
exception_sim_proc_hook(proj, name, simproc)
Applies an exception calling convention hook to a symbol in the project.
This function hooks the specified symbol in the project with an exception calling convention based on the project architecture.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
448 449 450 451 452 453 454 455 456 457 |
|
generic_sim_procedure
¤
generic_sim_procedure(args, ret)
Creates a generic simulation procedure based on arguments and return type.
This method dynamically generates a simulation procedure based on the provided arguments and return type.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
253 254 255 256 257 258 259 260 261 262 263 264 |
|
get_custom_sim_proc
¤
get_custom_sim_proc()
Returns a dictionary containing custom simulation procedures.
This method retrieves and returns specific custom simulation procedures from the custom_package
dictionary.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
|
get_gen_simproc
¤
get_gen_simproc()
Returns a dictionary containing generic simulation procedures.
This method retrieves and returns specific simulation procedures from the custom_package
dictionary.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
init_sim_proc
¤
init_sim_proc(os_name)
Initializes simulation procedures based on the provided operating system name.
This method dynamically imports and organizes simulation procedures based on the specified operating system for further analysis.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
load_syscall_table
abstractmethod
¤
load_syscall_table(proj)
Loads the system call table for the given project.
This method is abstract and must be implemented in subclasses to define the behavior of loading the system call table for a specific project.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
174 175 176 177 178 179 180 181 |
|
loadlibs_proc
¤
loadlibs_proc(dlls_functions, project)
Loads library procedures and applies hooks to symbols based on the provided information.
This function iterates through requested libraries, sets calling conventions, creates procedures, applies hooks to symbols, and updates the simulation procedures accordingly.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
|
set_calling_conventions
¤
set_calling_conventions(lib_name, dlls_functions)
Sets calling conventions for a given library based on the provided information.
This function determines and sets the calling conventions for the library, updating the default calling conventions for X86 and AMD64 architectures accordingly.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
|
setup
¤
setup(os)
Sets up the object for system call procedure initialization.
If the object is not already set up, this method initializes loaders, configures logging if verbose, and initializes system call procedures based on the provided operating system.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
161 162 163 164 165 166 167 168 169 170 171 172 |
|
std_sim_proc_hook
¤
std_sim_proc_hook(proj, name, simproc)
Applies a standard calling convention hook to a symbol in the project.
This function hooks the specified symbol in the project with a standard calling convention based on the project architecture.
Source code in sema_toolchain/sema_scdg/application/procedures/CustomSimProcedure.py
437 438 439 440 441 442 443 444 445 446 |
|