Rizin
unix-like reverse engineering framework and cli tools
syscall_preprocessing.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # SPDX-FileCopyrightText: 2021 ret2libc <sirmy15@gmail.com>
4 # SPDX-License-Identifier: LGPL-3.0-only
5 
6 """ Portable python script to preprocess syscall/d files """
7 
8 import re
9 import sys
10 
11 with open(sys.argv[1], encoding="utf8") as inf:
12  with open(sys.argv[2], "w", encoding="utf8") as outf:
13  for line in inf:
14  if not line.startswith("_") and "=" in line:
15  arr = re.split("=|,", line)
16  print("%s.%s=%s" % (arr[1], arr[2], arr[0]), file=outf)
17  print(line, file=outf, end="")