From c6a6a7807f3b773fde2ffbf619e7f4a5c9cf2e16 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Mon, 19 Feb 2024 13:30:07 -0700 Subject: [PATCH] [pfsense] Allow turning off debug in phpshell() --- plugins/module_utils/pfsense.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/pfsense.py b/plugins/module_utils/pfsense.py index 7236e04d..07581e1b 100644 --- a/plugins/module_utils/pfsense.py +++ b/plugins/module_utils/pfsense.py @@ -637,11 +637,14 @@ def uniqid(prefix='', more_entropy=False): return prefix + '{0:x}{1:05x}'.format(int(time.time()), int(time.time() * 1000000) % 0x100000) - def phpshell(self, command): + def phpshell(self, command, debug=True): """ Run a command in the php developer shell """ - command = "global $debug;\n$debug = 1;\n" + command + "\nexec\nexit" + phpshell = "" + if debug: + phpshell = "global $debug;\n$debug = 1;\n" + phpshell += command + "\nexec\nexit" # Dummy argument suppresses displaying help message - return self.module.run_command('/usr/local/sbin/pfSsh.php dummy', data=command) + return self.module.run_command('/usr/local/sbin/pfSsh.php dummy', data=phpshell) def php(self, command): """ Run a command in php and return the output """