@@ -159,15 +159,15 @@ def check_inline_hook(
159159 try:
160160 # Create IAT plugin instance to reuse its functionality
161161 iat_plugin = iat.IAT(self.context, self.config_path)
162-
163- # Get IAT entries for this specific process
162+
163+ # Get IAT entries for this specific process
164164 iat_entries = list(iat_plugin._generator([proc]))
165165 # print(f"Found {len(iat_entries)} IAT entries for process {proc.UniqueProcessId}") # Commented out debug print
166-
166+
167167 # Get process layer for module bounds checking
168168 proc_layer_name = proc.add_process_layer()
169169 proc_layer = self.context.layers[proc_layer_name]
170-
170+
171171 # Build a map of loaded modules and their bounds
172172 module_bounds = {}
173173 for mod in proc.load_order_modules():
@@ -176,32 +176,32 @@ def check_inline_hook(
176176 module_bounds[module_name] = (mod.DllBase, mod.DllBase + mod.SizeOfImage)
177177 except:
178178 continue
179-
179+
180180 # Check each IAT entry for suspicious redirections
181181 for _, (pid, proc_name, dll_name, bound, function_name, function_address) in iat_entries:
182182 try:
183183 if function_address:
184184 addr = int(function_address) if hasattr(function_address, '__int__') else function_address
185-
185+
186186 # Check if this address is within the expected module bounds
187187 is_within_bounds = False
188-
188+
189189 # Check against all loaded modules (not just the declaring DLL)
190190 for mod_name, (mod_start, mod_end) in module_bounds.items():
191191 if mod_start <= addr < mod_end:
192192 is_within_bounds = True
193193 break
194-
194+
195195 if not is_within_bounds:
196196 hooked_imports.append((
197197 f"{dll_name}::{function_name}",
198198 addr,
199199 "IAT entry points outside any loaded module (hooked)"
200200 ))
201-
201+
202202 except (exceptions.InvalidAddressException, ValueError, TypeError):
203203 continue
204-
204+
205205 except Exception as e:
206206 vollog.debug(f"Error in IAT hook detection: {e}")
207207
@@ -214,7 +214,7 @@ def check_inline_hook(
214214 try:
215215 module_start = module.DllBase
216216 module_end = module.DllBase + module.SizeOfImage
217-
217+
218218 # Walk the EAT
219219 for export in export_dir.entries():
220220 try:
@@ -233,7 +233,7 @@ def check_inline_hook(
233233 ))
234234 except exceptions.InvalidAddressException:
235235 continue
236-
236+
237237 except exceptions.InvalidAddressException:
238238 pass
239239
0 commit comments