@@ -33,7 +33,7 @@ def name():
3333
3434 # Overridden base function
3535 async def createDatabase (self , binary_file , is_windows ):
36- """Create a database file for the given binary file, compiled to windows or linux as specified.
36+ """Create a database file asynchonously for the given binary file , compiled to windows or linux as specified.
3737
3838 Args:
3939 binary_file (path): path to the input binary (*.o / *.obj) file
@@ -49,36 +49,57 @@ async def createDatabase(self, binary_file, is_windows):
4949
5050 database_file = binary_file + self .suffix
5151 # execute the program
52- process = await asyncio .create_subprocess_exec (self ._path , "-A" , "-B" , f"-T{ type } " , f"-o{ database_file } " , binary_file )
52+ process = await asyncio .create_subprocess_exec (self ._path , "-A" , "-B" , f"-T{ type } " , f"-o{ database_file } " , binary_file )
5353 await process .wait ()
5454 # return back the (should be) created database file path
5555 return database_file
5656
5757 # Overridden base function
5858 async def executeScript (self , database , script ):
59- """Execute the given script over the given database file that was created earlier.
59+ """Execute the given script asynchonously over the given database file that was created earlier.
6060
6161 Args:
6262 database (path): path to a database file created by the same program
6363 script (path): python script to be executed once the database is loaded
6464 """
6565 process = await asyncio .create_subprocess_exec (self ._path , "-A" , f"-S{ script } " , database )
6666 await process .wait ()
67-
67+
6868 def isSupported (self , feature_name ):
69+ """Check if feature is enabled.
70+
71+ Args:
72+ feature_name (str): name of the feature to check if enabled
73+
74+ Return Value:
75+ returns whether the current class has a member name "feature_name"
76+ """
6977 return hasattr (self , feature_name )
7078
7179 async def createAndExecute (self , binary_file , is_windows , script ):
80+ """Execute the given script over the given database asynchonously without closing it first.
81+
82+ Args:
83+ binary_file (str): filename of the binary to analyze
84+ is_windows (bool): whether the file is a windows compiled file or linux compiled file
85+ script (str): filename of the script to use on the binary in ida
86+ """
7287 type = "elf" if not is_windows else "coff"
7388
7489 if not hasattr (self , "is64" ):
7590 self .decideArchitecureChoices (binary_file , is_windows )
7691
7792 # execute the program
78- process = await asyncio .create_subprocess_exec (self ._path , "-A" , "-c" , f"-S{ script } " , f"-T{ type } " , binary_file )
93+ process = await asyncio .create_subprocess_exec (self ._path , "-A" , "-c" , f"-S{ script } " , f"-T{ type } " , binary_file )
7994 await process .wait ()
8095
8196 def decideArchitecureChoices (self , binary_file , is_windows ):
97+ """Automate deciding whether to send the files to ida64 or ida.
98+
99+ Args:
100+ binary_file (str): filename of the file to be a test case for analysis
101+ is_windows (bool): whether the test file is a linux or windows binary
102+ """
82103 # machine type header of pe
83104 # specified in that order, amd64, arm64, ia64, loongarch64, riscv64
84105 ARCH64PE = [b"\x64 \x86 " , b"\x64 \xaa " , b"\x00 \x02 " , b"\x64 \x62 " , b"\x64 \x50 " ]
@@ -106,6 +127,7 @@ def decideArchitecureChoices(self, binary_file, is_windows):
106127 self .is64 = True
107128 self .suffix = ".i64" if self .is64 else ".idb"
108129 self ._path += "64" if self .is64 else ""
109-
130+
131+
110132# Don't forget to register at the factory
111133registerDisassemblerCMD (IdaCMD .identify , IdaCMD )
0 commit comments