-
Notifications
You must be signed in to change notification settings - Fork 201
/
Copy pathMachineAccounts_bof.s1.py
65 lines (46 loc) · 2.17 KB
/
MachineAccounts_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
53
54
55
56
57
58
59
60
61
62
63
64
65
from typing import List, Tuple
from outflank_stage1.task.base_bof_task import BaseBOFTask
from outflank_stage1.task.enums import BOFArgumentEncoding
class AddMachineAccountBOF(BaseBOFTask):
def __init__(self):
super().__init__("AddMachineAccount")
self.parser.description = (
"Add a computer account to the Active Directory domain."
)
self.parser.epilog = "Use Active Directory Service Interfaces (ADSI) to add a computer account to AD."
self.parser.add_argument("computername", help="Computer name")
self.parser.add_argument(
"password",
help="Password",
nargs="?",
)
def _encode_arguments_bof(
self, arguments: List[str]
) -> List[Tuple[BOFArgumentEncoding, str]]:
parser_arguments = self.parser.parse_args(arguments)
if parser_arguments.password is not None:
return [
(BOFArgumentEncoding.WSTR, parser_arguments.computername),
(BOFArgumentEncoding.WSTR, parser_arguments.password),
]
return [(BOFArgumentEncoding.WSTR, parser_arguments.computername)]
class DelMachineAccountBOF(BaseBOFTask):
def __init__(self):
super().__init__("DelMachineAccount")
self.parser.description = (
"Remove a computer account from the Active Directory domain."
)
self.parser.epilog = "Use Active Directory Service Interfaces (ADSI) to delete a computer account from AD."
self.parser.add_argument("computername", help="Computer name")
def _encode_arguments_bof(
self, arguments: List[str]
) -> List[Tuple[BOFArgumentEncoding, str]]:
parser_arguments = self.parser.parse_args(arguments)
return [(BOFArgumentEncoding.WSTR, parser_arguments.computername)]
class GetMachineAccountQuota(BaseBOFTask):
def __init__(self):
super().__init__("GetMachineAccountQuota")
self.parser.description = (
"Read the MachineAccountQuota value from the Active Directory domain."
)
self.parser.epilog = "Use Active Directory Service Interfaces (ADSI) to read the ms-DS-MachineAccountQuota value from AD."