Skip to content

Commit 7cdd123

Browse files
committed
Formatting and exit when required action is not available
1 parent fda6b6a commit 7cdd123

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

nxc/modules/enable_cmdshell.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
class NXCModule:
2-
"""Enables or disables xp_cmdshell in MSSQL Server."""
2+
"""
3+
Enables or disables xp_cmdshell in MSSQL Server.
4+
Module by crosscutsaw
5+
"""
36

47
name = "enable_cmdshell"
58
description = "Enable or disable xp_cmdshell in MSSQL Server"
@@ -15,16 +18,18 @@ def __init__(self):
1518

1619
def options(self, context, module_options):
1720
"""
18-
Available options:
19-
- ACTION: enable or disable xp_cmdshell
20-
Example usage:
21+
ACTION enable or disable xp_cmdshell
22+
23+
Examples
24+
--------
2125
netexec mssql $TARGET -u $username -p $password -M enable_cmdshell -o ACTION=enable
2226
netexec mssql $TARGET -u $username -p $password -M enable_cmdshell -o ACTION=disable
2327
"""
2428
if "ACTION" in module_options:
2529
self.action = module_options["ACTION"].lower()
2630
else:
27-
context.log.error("Missing required option: ACTION (enable/disable)")
31+
context.log.fail("Missing required option: ACTION (enable/disable)")
32+
exit(1)
2833

2934
def on_login(self, context, connection):
3035
self.context = context

0 commit comments

Comments
 (0)