Skip to content

Commit

Permalink
[pfsense] Allow turning off debug in phpshell()
Browse files Browse the repository at this point in the history
  • Loading branch information
opoplawski committed Mar 25, 2024
1 parent 5026c65 commit 2931af2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugins/module_utils/pfsense.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down

0 comments on commit 2931af2

Please sign in to comment.