-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathFindObjects_bof.s1.py
52 lines (37 loc) · 1.59 KB
/
FindObjects_bof.s1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from typing import List, Tuple
from outflank_stage1.task.base_bof_task import BaseBOFTask
from outflank_stage1.task.enums import BOFArgumentEncoding
class FindProcHandleBOF(BaseBOFTask):
def __init__(self):
super().__init__("FindProcHandle", base_binary_name="FindProcHandle")
self.parser.add_argument("processname", help="The processhandle to search for.")
self.parser.description = (
"Find specific process handles."
)
self.parser.epilog = (
"Example usage:\n"
" - Find handles to the lsass process:\n"
" FindProcHandle lsass.exe\n"
)
def _encode_arguments_bof(
self, arguments: List[str]
) -> List[Tuple[BOFArgumentEncoding, str]]:
parser_arguments = self.parser.parse_args(arguments)
return [(BOFArgumentEncoding.WSTR, parser_arguments.processname)]
class FindModuleBOF(BaseBOFTask):
def __init__(self):
super().__init__("FindModule", base_binary_name="FindModule")
self.parser.add_argument("modulename", help="The module to search for.")
self.parser.description = (
"Find specific loaded modules."
)
self.parser.epilog = (
"Example usage:\n"
" - Find processes with the clr.dll module loaded:\n"
" FindModule clr.dll\n"
)
def _encode_arguments_bof(
self, arguments: List[str]
) -> List[Tuple[BOFArgumentEncoding, str]]:
parser_arguments = self.parser.parse_args(arguments)
return [(BOFArgumentEncoding.WSTR, parser_arguments.modulename)]