From 2aa439794f0ce3b28af2a6641c38b1304bab1ebe Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 16 Aug 2015 00:18:47 +0200 Subject: Rename phpservice_php.tmp to phpservice_php.php --- config/phpservice/phpservice_php.php | 192 +++++++++++++++++++++++++++++++++++ config/phpservice/phpservice_php.tmp | 192 ----------------------------------- 2 files changed, 192 insertions(+), 192 deletions(-) create mode 100644 config/phpservice/phpservice_php.php delete mode 100644 config/phpservice/phpservice_php.tmp diff --git a/config/phpservice/phpservice_php.php b/config/phpservice/phpservice_php.php new file mode 100644 index 00000000..55de1ae8 --- /dev/null +++ b/config/phpservice/phpservice_php.php @@ -0,0 +1,192 @@ + + + + + +

PHP Service:

+ +
+ + +
+ +
+ + + + + +
+ +
+"; +//print_info_box_np("This is an info box."); +//echo"
"; +//endif; + +?> + + + + +

+ Is command line PHP designed to run PHP as a Service. The custom PHP code that is defined below is run over and over again inside a continuous loop. There are many possible uses such as monitoring CPU, Memory, File System Space, interacting with Snort, and many others uses that are yet to be discovered. + It can send events to the sylog that will can be viewed from the system log or remote syslog server. example: exec("logger This is a test"); +

+ For more information see: https://doc.pfsense.org/index.php/PHPService +

+
+ + + + + + + + + + + 0) { + + foreach ($a_phpservice as $ent) { + + ?> + + + + + + + + + + + + + + + + + + +
NameEnabledDescription + + + + + + +
+ +
+   + +   + +   + + + + + + +
+
+ + + + + +
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+ +
+ + + + + diff --git a/config/phpservice/phpservice_php.tmp b/config/phpservice/phpservice_php.tmp deleted file mode 100644 index 55de1ae8..00000000 --- a/config/phpservice/phpservice_php.tmp +++ /dev/null @@ -1,192 +0,0 @@ - - - - - -

PHP Service:

- -
- - -
- -
- - - - - -
- -
-"; -//print_info_box_np("This is an info box."); -//echo"
"; -//endif; - -?> - - - - -

- Is command line PHP designed to run PHP as a Service. The custom PHP code that is defined below is run over and over again inside a continuous loop. There are many possible uses such as monitoring CPU, Memory, File System Space, interacting with Snort, and many others uses that are yet to be discovered. - It can send events to the sylog that will can be viewed from the system log or remote syslog server. example: exec("logger This is a test"); -

- For more information see: https://doc.pfsense.org/index.php/PHPService -

-
- - - - - - - - - - - 0) { - - foreach ($a_phpservice as $ent) { - - ?> - - - - - - - - - - - - - - - - - - -
NameEnabledDescription - - - - - - -
- -
-   - -   - -   - - - - - - -
-
- - - - - -
-
- -
- - -
-
-
-
-
-
-
-
- -
- -
- - - - - -- cgit v1.2.3 From 30df66f6ffd5a14490b73829dbf73f58559eb790 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 16 Aug 2015 00:19:56 +0200 Subject: Rename phpservice_php_edit.tmp to phpservice_php_edit.php --- config/phpservice/phpservice_php_edit.php | 225 ++++++++++++++++++++++++++++++ config/phpservice/phpservice_php_edit.tmp | 225 ------------------------------ 2 files changed, 225 insertions(+), 225 deletions(-) create mode 100644 config/phpservice/phpservice_php_edit.php delete mode 100644 config/phpservice/phpservice_php_edit.tmp diff --git a/config/phpservice/phpservice_php_edit.php b/config/phpservice/phpservice_php_edit.php new file mode 100644 index 00000000..20a9998a --- /dev/null +++ b/config/phpservice/phpservice_php_edit.php @@ -0,0 +1,225 @@ + + + + + + +

PHP Service: Edit

+ + + +
+ + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Name + +
PHP + ".htmlspecialchars($pconfig['php'])."\n"; + ?> + +
Enabled + \n"; + echo " \n"; + switch (htmlspecialchars($pconfig['enabled'])) { + case "true": + echo " \n"; + echo " \n"; + break; + case "false": + echo " \n"; + echo " \n"; + + break; + default: + echo " \n"; + echo " \n"; + } + echo " \n"; + ?> +
Description + +
Enter the description here.
+
  + + + + +
+
+ +
+
+
+
+
+
+ +
+ +
+ + + + diff --git a/config/phpservice/phpservice_php_edit.tmp b/config/phpservice/phpservice_php_edit.tmp deleted file mode 100644 index 20a9998a..00000000 --- a/config/phpservice/phpservice_php_edit.tmp +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - -

PHP Service: Edit

- - - -
- - -
- -
- - - - -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
Name - -
PHP - ".htmlspecialchars($pconfig['php'])."\n"; - ?> - -
Enabled - \n"; - echo " \n"; - switch (htmlspecialchars($pconfig['enabled'])) { - case "true": - echo " \n"; - echo " \n"; - break; - case "false": - echo " \n"; - echo " \n"; - - break; - default: - echo " \n"; - echo " \n"; - } - echo " \n"; - ?> -
Description - -
Enter the description here.
-
  - - - - -
-
- -
-
-
-
-
-
- -
- -
- - - - -- cgit v1.2.3 From f91da286bb0edbabf22df53ea88c6b7e8ccc8b41 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 16 Aug 2015 01:14:56 +0200 Subject: phpservice - rewrite garbage package Another quality stuff from the same guy... :-( --- config/phpservice/phpservice.xml | 127 ++++++++++++++------------------------- 1 file changed, 45 insertions(+), 82 deletions(-) diff --git a/config/phpservice/phpservice.xml b/config/phpservice/phpservice.xml index eb7e670e..e437be20 100644 --- a/config/phpservice/phpservice.xml +++ b/config/phpservice/phpservice.xml @@ -1,47 +1,49 @@ - - + + - - + - - PHP Service - Describe your package requirements here - Currently there are no FAQ items provided. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* ====================================================================================== */ + ]]> + + PHP Service PHP Service Settings - 0.4.1 + 0.5.0 Settings /usr/local/pkg/phpservice.inc @@ -55,66 +57,27 @@ phpservice phpservice.sh phpservice - PHP run from a command line as a service. + PHP script as a service - exec("/bin/pgrep -f phpservice"); + exec("/bin/pgrep -fq phpservice"); - - - Settings - /pkg_edit.php?xml=phpservice.xml&id=0 - - - - Settings - /packages/phpservice_php.php - - - - installedpackages->package->$packagename->configuration->phpservice + installedpackages->package->$packagename->configuration->phpservice /usr/local/pkg/ - 0755 - https://packages.pfsense.org/packages/config/phpservice/phpservice.xml - - - /usr/local/pkg/ - 0755 https://packages.pfsense.org/packages/config/phpservice/phpservice.inc - /tmp/ - 0755 - https://packages.pfsense.org/packages/config/phpservice/phpservice_php.tmp + /usr/local/www/packages/phpservice/ + https://packages.pfsense.org/packages/config/phpservice/phpservice_php.php - /tmp/ - 0755 - https://packages.pfsense.org/packages/config/phpservice/phpservice_php_edit.tmp - - - - Variable One - var1 - Enter the variable one here. - input - - - Variable Two - var1 - Enter the variable one here. - input - - - - + /usr/local/www/packages/phpservice/ + https://packages.pfsense.org/packages/config/phpservice/phpservice_php_edit.php + phpservice_sync_package(); - - phpservice_sync_package(); - phpservice_install_command(); -- cgit v1.2.3 From eec73129b5697ce70c89099d8555d0a56289c887 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 16 Aug 2015 01:24:10 +0200 Subject: phpservice - rewrite garbage package --- config/phpservice/phpservice.inc | 223 +++++++++++---------------------------- 1 file changed, 63 insertions(+), 160 deletions(-) diff --git a/config/phpservice/phpservice.inc b/config/phpservice/phpservice.inc index ec2b9bef..cffdb09f 100644 --- a/config/phpservice/phpservice.inc +++ b/config/phpservice/phpservice.inc @@ -1,14 +1,11 @@ 10^x|1024->2^x] - $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); - $e=floor(log($bytes,$convention)); - return round($bytes/pow($convention,$e),2).' '.$s[$e]; - } +// If the pid file does not exist then close the program. +if (!file_exists('/tmp/phpmonitor.pid')) { + return; } - -function phpservice_sync_package_php() -{ - - global $config; - if($config['installedpackages']['phpservice']['config'] != "") { - - conf_mount_rw(); - - $tmp = "\\n\";\n"; - $tmp .= " } else {\n"; - $tmp .= " fwrite(\$fp, \$syslogmsg);\n"; - $tmp .= " fclose(\$fp);\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= "}\n"; - $tmp .= "\n"; - $tmp .= "\n"; - $tmp .= "//\$msg = \"1.begin loop. \".date('r').\"\\n\";\n"; - $tmp .= "//\$fp = fopen('/tmp/phpmonitor.txt', 'a');\n"; - $tmp .= "//fwrite(\$fp, \$msg.\"\\n\");\n"; - $tmp .= "//fclose(\$fp);\n"; - $tmp .= "\n"; - $tmp .= "\$x = 0;\n"; - $tmp .= "while(\$x == 0) {\n"; - $tmp .= "\n"; - $tmp .= "\n"; - $tmp .= " if(!file_exists('/tmp/phpmonitor.pid')) {\n"; - $tmp .= " //if the file does not exist then close the program.\n"; - $tmp .= " echo \"program closing\\n\";\n"; - $tmp .= " return;\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= "\n"; - $tmp .= "\n"; - - foreach($config['installedpackages']['phpservice']['config'] as $rowhelper) { + +EOF; + + foreach ($config['installedpackages']['phpservice']['config'] as $rowhelper) { if ($rowhelper['enabled'] != "false") { $tmp_php = base64_decode($rowhelper['php']); if (strlen($tmp_php) > 0) { $tmp .= "// name: ".$rowhelper['name']." \n"; - $tmp .= "// description: ".$rowhelper['description']." \n\n"; + $tmp .= "// description: ".$rowhelper['description']." \n\n"; $tmp .= base64_decode($rowhelper['php']); $tmp .= "\n"; } } - } - - $tmp .= "\n"; - $tmp .= "\n"; - $tmp .= " //usleep(100000); //micro seconds //2 seconds 2000000\n"; - $tmp .= " sleep(1); //in seconds\n"; - $tmp .= " //if (\$x > 60){ exit; } //exit after 60 seconds for testing\n"; - $tmp .= "} //emd while\n"; - $tmp .= "\n"; - $tmp .= "\n"; - $tmp .= "?>"; - - $fout = fopen("/usr/local/pkg/phpservice.php","w"); - fwrite($fout, $tmp); - unset($tmp); - fclose($fout); - - conf_mount_ro(); - - } -} + $tmp .= <<< EOF -function phpservice_sync_package() -{ - - global $config; - phpservice_sync_package_php(); +sleep(1); } - +?> -function phpservice_install_command() -{ +EOF; - global $config; - conf_mount_rw(); + $fout = fopen("/usr/local/pkg/phpservice.php", "w"); + fwrite($fout, $tmp); + unset($tmp); + fclose($fout); - if (!is_dir('/usr/local/www/packages/')) { - exec("mkdir /usr/local/www/packages/"); - } - - if (!is_dir('/usr/local/www/packages/phpservice/')) { - exec("mkdir /usr/local/www/packages/phpservice/"); + restart_service("phpservice"); + conf_mount_ro(); + } else { + stop_service("phpservice"); } +} - - //rename PHP files from .tmp to .php - exec("cp /tmp/phpservice_php.tmp /usr/local/www/packages/phpservice/phpservice_php.php"); - unlink_if_exists("/tmp/phpservice_php.tmp"); - - exec("cp /tmp/phpservice_php_edit.tmp /usr/local/www/packages/phpservice/phpservice_php_edit.php"); - unlink_if_exists("/tmp/phpservice_php_edit.tmp"); - - //write_config(); - +function phpservice_install_command() { + conf_mount_rw(); write_rcfile(array( "file" => "phpservice.sh", "start" => "/usr/local/bin/php /usr/local/pkg/phpservice.php >> /var/log/phpservice.log &", - "stop" => "rm /tmp/phpmonitor.pid" + "stop" => "/bin/rm -f /tmp/phpmonitor.pid; sleep 3" ) ); - phpservice_sync_package(); - //$handle = popen("/usr/local/etc/rc.d/phpservice.sh start", "r"); - //pclose($handle); - - //if (pkg_is_service_running('phpservice')) { - //documentation purposes - //} - conf_mount_ro(); - } -function phpservice_deinstall_command() -{ - +function phpservice_deinstall_command() { conf_mount_rw(); - $handle = popen("/usr/local/etc/rc.d/phpservice.sh stop", "r"); - unlink_if_exists("/usr/local/pkg/phpservice.xml"); - unlink_if_exists("/usr/local/pkg/phpservice.inc"); - unlink_if_exists("/usr/local/www/phpservice.inc"); + stop_service("phpservice"); unlink_if_exists("/usr/local/etc/rc.d/phpservice.sh"); conf_mount_ro(); - } ?> -- cgit v1.2.3 From f0b4bbdb4e8aa706995723fb0b2125ab89caa3b9 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 16 Aug 2015 01:49:31 +0200 Subject: phpservice - rewrite garbage package --- config/phpservice/phpservice_php.php | 205 ++++++++++++++--------------------- 1 file changed, 82 insertions(+), 123 deletions(-) diff --git a/config/phpservice/phpservice_php.php b/config/phpservice/phpservice_php.php index 55de1ae8..582d2f41 100644 --- a/config/phpservice/phpservice_php.php +++ b/config/phpservice/phpservice_php.php @@ -1,8 +1,9 @@ @@ -51,7 +51,6 @@ include("head.inc"); -

PHP Service:

@@ -67,126 +66,86 @@ include("head.inc");
- - - - - - - - - - - - - - - - - - - -
- -
+
+ "; -//print_info_box_np("This is an info box."); -//echo"
"; -//endif; - ?> - - - - -

- Is command line PHP designed to run PHP as a Service. The custom PHP code that is defined below is run over and over again inside a continuous loop. There are many possible uses such as monitoring CPU, Memory, File System Space, interacting with Snort, and many others uses that are yet to be discovered. - It can send events to the sylog that will can be viewed from the system log or remote syslog server. example: exec("logger This is a test"); -

- For more information see: https://doc.pfsense.org/index.php/PHPService -

-
- - - - - - - +
NameEnabledDescription - - - - - - -
- -
+ +
+
+ The custom PHP code that is defined below is run over and over again inside a continuous loop. There are many possible uses such as monitoring CPU, Memory, File System Space, interacting with Snort, and many others uses that are yet to be discovered.
+ It can send events to the sylog that will can be viewed from the system log or remote syslog server. Example: exec("logger This is a test");

+ For more information see: https://doc.pfsense.org/index.php/PHPService +
+
+
+ + + + + + + + 0) { + foreach ($a_phpservice as $ent) { + ?> + + + + + + + + + + + + + + + + +
NameEnabledDescription + + + + + +
+
    + + + + + +
+
+ + + + + +
+
+ +
- 0) { - - foreach ($a_phpservice as $ent) { - - ?> -
-   - -   - -   - - - - - - -
-
- - - - - -
-
- - - - -
-
-
-
-
-
-
-
- - - + -
- -- cgit v1.2.3 From 7e3d83aa4cd60a66a9b17bdb4761b6f135d29339 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 16 Aug 2015 02:12:37 +0200 Subject: phpservice - rewrite garbage package --- config/phpservice/phpservice_php_edit.php | 207 ++++++++++++------------------ 1 file changed, 81 insertions(+), 126 deletions(-) diff --git a/config/phpservice/phpservice_php_edit.php b/config/phpservice/phpservice_php_edit.php index 20a9998a..9727add6 100644 --- a/config/phpservice/phpservice_php_edit.php +++ b/config/phpservice/phpservice_php_edit.php @@ -1,21 +1,21 @@ - - - - -

PHP Service: Edit

- - -
+ - - + + + + + + + + + +
- - -
- -
- - - - - - - - - - - - - - - -
Name - -
PHP - ".htmlspecialchars($pconfig['php'])."\n"; - ?> - -
Enabled - \n"; - echo " \n"; +

+ + + + + + + + + + + + + - - - - - - - - - - -
Name
PHP + " . htmlspecialchars($pconfig['php']) . "\n"; + ?> +
Enabled + \n"; + echo "\t\t\t\n"; switch (htmlspecialchars($pconfig['enabled'])) { - case "true": - echo " \n"; - echo " \n"; - break; - case "false": - echo " \n"; - echo " \n"; - - break; - default: - echo " \n"; - echo " \n"; - } - echo " \n"; - ?> -
Description - -
Enter the description here.
-
  - - - - -
- - -
-
-
-
-
-
- -
+ case "true": + echo "\t\t\t\n"; + echo "\t\t\t\n"; + break; + case "false": + echo "\t\t\t\n"; + echo "\t\t\t\n"; + break; + default: + echo "\t\t\t\n"; + echo "\t\t\t\n"; + } + echo "\t\t\n"; + ?> +
Description + +
Enter the description here.
+
  +   + +
+ +
+ +
-- cgit v1.2.3 From 05d6da632de56675d49badaf507824650bf2d04b Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 16 Aug 2015 02:13:33 +0200 Subject: Bump phpservice package version --- pkg_config.10.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg_config.10.xml b/pkg_config.10.xml index c66d2b96..919bf9ef 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -337,7 +337,7 @@ Services https://doc.pfsense.org/index.php/PHPService https://packages.pfsense.org/packages/config/phpservice/phpservice.xml - 0.4.2 + 0.5.0 Beta 2.2 markjcrane@gmail.com -- cgit v1.2.3