@@ -40,7 +40,7 @@ def on_login(self, context, connection):
4040 elif self .action == "disable" :
4141 self .toggle_xp_cmdshell (enable = False )
4242 else :
43- self .context .log .error ("Invalid ACTION. Use 'enable' or 'disable'." )
43+ self .context .log .fail ("Invalid ACTION. Use 'enable' or 'disable'." )
4444
4545 def backup_show_advanced_options (self ):
4646 """Backs up the current state of 'show advanced options'."""
@@ -52,7 +52,7 @@ def backup_show_advanced_options(self):
5252 def restore_show_advanced_options (self ):
5353 """Restores the original state of 'show advanced options' if needed."""
5454 if self .advanced_options_backup is not None and self .advanced_options_backup == 0 :
55- self .mssql_conn .sql_query ("EXEC sp_configure 'show advanced options', '0'; RECONFIGURE" )
55+ self .mssql_conn .sql_query ("EXEC sp_configure 'show advanced options', '0'; RECONFIGURE; " )
5656
5757 def toggle_xp_cmdshell (self , enable : bool ):
5858 """Enables or disables xp_cmdshell while preserving 'show advanced options' state."""
@@ -62,15 +62,15 @@ def toggle_xp_cmdshell(self, enable: bool):
6262 self .backup_show_advanced_options ()
6363
6464 # Enable 'show advanced options' if it was disabled
65- self .mssql_conn .sql_query ("EXEC sp_configure 'show advanced options', '1'; RECONFIGURE" )
65+ self .mssql_conn .sql_query ("EXEC sp_configure 'show advanced options', '1'; RECONFIGURE; " )
6666
6767 try :
6868 # Enable or disable xp_cmdshell
69- self .mssql_conn .sql_query (f"EXEC sp_configure 'xp_cmdshell', '{ state } '; RECONFIGURE" )
69+ self .mssql_conn .sql_query (f"EXEC sp_configure 'xp_cmdshell', '{ state } '; RECONFIGURE; " )
7070 action_text = "enabled" if enable else "disabled"
7171 self .context .log .success (f"xp_cmdshell successfully { action_text } ." )
7272 except Exception as e :
73- self .context .log .error (f"Failed to execute command: { e } " )
73+ self .context .log .fail (f"Failed to execute command: { e } " )
7474
7575 # Restore 'show advanced options' to its original state if needed
7676 self .restore_show_advanced_options ()
0 commit comments