Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic PHP Interface


  • Please log in to reply
9 replies to this topic

#1 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 15 October 2016 - 11:58 PM

I have several Bash script projects that I share on here. One of the biggest pains developing them is that whilst they all share the same interface code, because it's integrated into each project, if I make changes to it in one project, it takes a while to go through and pass those changes on to all of the others. It's a real time waster, and gets a bit confusing.

To solve this I've created this project, which is a generic set of interfaces. The idea being that I will no longer integrate the interfaces into projects when possible, which should be the case for most of my projects. Instead I dump the generic interfaces into a project I'm working on, and configure it for the project by altering/creating some config files. This will make it sooo much easier to syncronize interface changes across all projects :). Best of all, this will make it easier for other people to use my interfaces in their projects.

That being said, instead of writing these generic interfaces in Bash, I decided to port the project to PHP. I'm using PHP as I was using Bash, so releases will have additional dependencies (same as a Bash script could). I've been wanting to add a web-gui interface to some projects. While most of my projects don't need a GUI, I think one or two would benefit from it. I figured it would be easier for me to do this entire project in PHP rather than to write half the project in PHP and the other half in Bash, so that's why this project is written in PHP.

This project is a set of PHP scripts that offer commandline usage (interactive, and non-interactive), and a web-gui. Not all tools making use of this project will necessarily make use of all three interfaces. Despite being written in PHP this project isn't cross-platform, Linux only.

While the project is currently functioning, there are a few bugs I still need to fix, the webgui isn't beautiful yet, and the project isn't as configurable as I'd like yet. So I don't have a release to post. I do however have a few screenshots to share to satisfy anyone curious.

Commandline Interface Screenshot
7TPGVHj.jpg

In this picture you can see the command I ran, and an output from the dummy test task I'm using while building the project. This dummy task just outputs the name of the user running the tool. It will not be included in the final project. It's just so that I can test the project while I build it.

Interactive Commandline Interface Screenshot
38Vaxp9.jpg

Again running the dummy task here.

Webgui Interface Screenshot
pRiImEw.jpg

I didn't bother to include a screenshot of the output from the webgui as presently it's just text. I haven't done any design on the webgui yet. I've just been focused on getting it functioning.

I'm still figuring out exactly what I want and need from the project. Most of my focus so far has gone into the non-interactive commandline interface, because that's the most important one. I'm also really trying to make the project as easy to configure as possible, because who wants to use something that's difficult :P.

Hopefully this project will allow me to create better tools, spend less time transitioning interface changes across projects, have fewer dependencies for my tools, and make it easier for other people to add interfaces to their projects.

I've been pretty busy lately, so I haven't been able to work on this project as much :(. I'm hoping to have a testing release soon, but it depends how much time I can find.



BC AdBot (Login to Remove)

 


#2 Al1000

Al1000

  • Global Moderator
  • 7,187 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland

Posted 19 October 2016 - 04:28 PM

Sounds like a great idea. :)

#3 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 23 October 2016 - 12:21 AM

I fixed the bugs I mentioned in my last post, and starting working on a new feature. I'm designing the interfaces to accept 2 different kinds of outputs. The first is termed "output" and is meant for commandline usage. The second is termed "weboutput" and is meant for webgui usage. That said, the user will be able to use either output or both outputs regardless of whether they are using a commandline interface, or the webgui interface.

The reason for doing this is that a standard text output is great for the commandline, but in the webgui it would be nice to be able to take advantage of web languages like HTML and CSS to make prettier, or more complex outputs.

I haven't passed this code into all 3 interfaces yet (I may actually do a PHP include so they can share the same file), but I do have it up and running in the webgui. In the screenshot below you can see a sample where I have the regular "output", and then I have a "weboutput" below that which is using CSS and HTML to make the text larger. This is a very simple example of what
the weboutput can be used to do. The point is to give more control over the output appearance to the tasks, and allow for a wider variety of tools to make use of the project.

 

ctjozk.JPG
 



#4 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 05 November 2016 - 11:35 PM

Generic PHP Interface 0.967 Testing:

fkewjp.JPG

 

This is the first public release of GPI (Generic PHP Interface). GPI is a set of interfaces, written in PHP, for GNU/Linux. It's open source, and published under the Comprehensible Open License. I started this project to make it easier for me to add interfaces to tools I create. I was inspired by Zenity (and similar), and my existing interface code. At the present time, GPI is working, but this is a testing release, and the project is still being shaped a bit. It is coming together nicely though :).


Caution! Please read for more information.

A word of caution. The webgui uses PHP's built in webserver to run a temporary local webserver. For anyone not familiar webservers, this means 2 things:

1. When a webgui session is active, other users on the computer, can access it, if they know the URL. So, it is not advisable to run the webgui on multi-user machines, unless you trust all users. Even then, this probably isn't what you want, because that webgui session is running under your user account.
2. If your system is not secured appropriately against external access (eg: you aren't blocking external access with your firewall), when a webgui session is active, depending on configuration, you could be allowing external visitors to access it. This is likely not what you want. As a side note, on many distros, a simple way to secure your machine from this type of external access is running UFW (a firewall application) with its default rules.

These security notes only apply to the webgui, and only when it's running. The other interfaces don't use the webserver. In future releases I may incorporate some security measures into the webgui (haven't decided yet), but this would not be meant as a replacement for a securily configured operating system, it would be meant as an additional layer of security.

 

Basic installation instructions, a list of dependencies, a copy of the license, and basic instructions for using GPI in your projects, are included in the download. If you create a project that uses GPI, consider posting a link in this thread to help people discover it. I would suggest using a stable release though.

Features:
- Non-interactive commandline interface
- Interactive commandline interface
- Webgui interface
- Custom variables by editing config file

Download Links:
- Mega.nz:https://mega.nz/#!olggRTgI!a-HHe30vUCqKkstb1S-GCdymWH19zy90F5rSsw4g_Xs

Checksums:
- SHA-512:f1ff8919da449af3f08a472c43dae34eea3d6a40cf6ef13588de56ec8c9239cbbf7dccac5a2b804540eaf35eadfebe80a6a66cbf1ef643065ca23addfb7ee5ea
- SHA-256:f2e1e8b51f59c94eb1404c0dc68f4422e0de55fc43e0f98151fbda9354c68ba0
- SHA-1:de2a793104be38650fe8faa5df358b590e0aa25f
- MD5:dede4c854a038cc07b4b081dabf435e3



#5 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 12 November 2016 - 07:27 PM

Generic PHP Interface 0.1109 Testing:
jkalqo.JPG
 
GPI is a set of interfaces, written in PHP/HTML/CSS, for GNU/Linux. It's open source, and published under the Comprehensible Open License. I started this project to make it easier for me to add interfaces to simple tools I make, but I figure it may be useful to other people too.

I would have had this release finished sooner, but I was fiddling with the possibility of adding displaying progress support to the webgui using AJAX. Ultimately, it was making things too complicated, so I deleted all of that. Don't worry, if a task makes use of it, you can still use the "displayprogressstatus" option to display progress in commandline tasks (same as in the last release). I didn't change that. This option is present in the webgui too, but progress outputs will be outputted all at once, when the page finishes loading. Which makes it rather pointless to use with the webgui, which brings us back to why I was experimenting with the possibility of adding better support to the webgui.

There are a bunch of changes in this release, but I didn't keep track of all of them. The most important change is that now, when using the webgui or the interactive CLI, you are only prompted for options that apply to the task you are doing. In the previous release you were prompted for all options, which was a bit inconvenient. Some information about the options is also provided such as whether they are optional, or required.

I think the project is almost at a point where I have everything I want implemented, aside from the lack of displaying progress in the webgui. :) Most of the things on my to do list at this point are little things, and the majority are behind the scenes things like cleaning up comments.


Caution! Please read for more information.

A word of caution. [b]The webgui uses PHP's built in webserver[/b] to run a temporary local webserver. For anyone not familiar webservers, [b]this means[/b] 2 things:

1. When a webgui session is active, [b]other users on the computer, can access it[/b], if they know the URL. So, it is not advisable to run the webgui on multi-user machines, unless you trust all users. Even then, this probably isn't what you want, because that webgui session is running under your user account.
2. [b]If your system is not secured appropriately[/b] against external access (eg: you aren't blocking external access with your firewall), when a webgui session is active, depending on configuration, [b]you could be allowing external visitors to access it[/b]. This is likely not what you want. As a side note, on many distros, a simple way to secure your machine from this type of external access is running UFW (a firewall application) with its default rules.

[b]These security notes only apply to the webgui, and only when it's running. [/b]The other interfaces don't use the webserver. In future releases I may incorporate some security measures into the webgui (haven't decided yet), but this would not be meant as a replacement for a securily configured operating system, it would be meant as an additional layer of security.


 
Basic installation instructions, a list of dependencies, a copy of the license, and basic instructions for using GPI in your projects, are included in the download. There is also a task template provided, but you don't need to follow it.

Features:
- Non-interactive commandline interface
- Interactive commandline interface
- Webgui interface
- Custom variables

Download Links:
- Mega.nz:https://mega.nz/#!98RiiQ4D!Btz65Di-Oy96APzAgMMHCuJL2hydYOStSZEjrULBBnA

Checksums:
- SHA-512:be938d409082397b1622508645b3bcd8fdcf79d6787fae3b19b586174fff4c1341f4dd8c74f6c606958b3f2043d9b7eb10bdfafb86b7f77a2e1ea842f8b46ea8



#6 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 16 November 2016 - 02:26 AM

Generic PHP Interface 0.1233 Testing:
ysdnml.JPG
 
GPI is a set of generic interfaces for PHP commandline scripts. It is written in PHP/HTML/CSS, for GNU/Linux, and it's open source (published under the Comprehensible Open License).

From a user perspective there aren't many changes in this release. The key ones would be request order of inputs, and displaying default input values in [ ]. From a builder perspective there are several changes, mostly configuration options for variables. From a code standpoint, there were a ton of changes in this release. Basically I went through, and cleaned/re-wrote alot of the code, and then added in some new features I thought of. I also did some more fiddling with the concept of displaying progress in the webgui, and have made progress (lolz), though have not yet implemented anything on that front.


Caution! Please read for more information.

A word of caution. [b]The webgui uses PHP's built in webserver[/b] to run a temporary local webserver. For anyone not familiar webservers, [b]this means[/b] 2 things:

1. When a webgui session is active, [b]other users on the computer, can access it[/b], if they know the URL. So, it is not advisable to run the webgui on multi-user machines, unless you trust all users. Even then, this probably isn't what you want, because that webgui session is running under your user account.
2. [b]If your system is not secured appropriately[/b] against external access (eg: you aren't blocking external access with your firewall), when a webgui session is active, depending on configuration, [b]you could be allowing external visitors to access it[/b]. This is likely not what you want. As a side note, on many distros, a simple way to secure your machine from this type of external access is running UFW (a firewall application) with its default rules.

[b]These security notes only apply to the webgui, and only when it's running.[/b]The other interfaces don't use the webserver. In future releases I may incorporate some security measures into the webgui (haven't decided yet), but this would not be meant as a replacement for a securily configured operating system, it would be meant as an additional layer of security.


 
Basic installation instructions, a list of dependencies, a copy of the license, and basic instructions for using GPI in your projects, are included in the download. There is also a task template provided, but you don't need to follow it.

Features:
- Non-interactive commandline interface
- Interactive commandline interface
- Web interface
- Supports custom variables

Changes:
- Webgui "index.php" now iframes "hardvariabes.php". This way when passing between pages, the addressbar url stays the same.
- Webgui now uses POST not GET. This doesn't have the same size restrictions as GET.
- Removed unnecessary unsets.
- Added "release" option to display contents of "info.config".
- Fixed issue with "help" option output having line endings replaced with "<br>" in the commandline interfaces.
- Location is autodetected in all interfaces, rather than inputted by the user. "defaultinstallpath.config" is no longer present either.
- Both interactive commandline interface, and the web interface display the application title.
- New input type "appendprependoverwrite".
- Removed checks from interfaces. There is now a seperate check module used by all interfaces. It checks that required variables are present, and that all present variables match the input type listed.
- "help" and "release" are now considered "special" variables. Meaning they perform an action, and if present overrule any other options specified.
- "varies" is a new type of importance to used to indicate that an option could be optional or required, depending on what is being done. Avoid using this when possible, because GPI has no way of knowing when it's required, and therefore will not do a required check.
- "location" is now a "corevariable".
- Dynamic handling of hardvariables.
- Webgui-switch is now the task "Manage Web-interface".
- Cleaned up comments and cleaned up code. Re-wrote a lot of code.
- Added "Visibility" (eg: "visible", "hidden") to variable configs. This has no effect on the CLI, but will determine whether user is prompted for a variable in the ICLI and WI.
- Added "Default Cli Value", "Default Icli Value", and "Default Cli Value" to variable configs. These set a default value for a variable, to be used if no user input is provided.
- Added "Forced Cli Value", "Forced Icli Value", and "Forced Cli Value" to variable configs. These set a value for a variable, to be used regardless of any user input, or default value.

Download Links:
- Mega.nz:https://mega.nz/#!90p0UCxC!oJSikbw7l3NDaV8CJNvzIK3G5RRc7dyJMUfiVTgcjtc

Checksums:
- SHA-512:494518f5478bd3ec738a3113063939330a2fc6cacf4e31b763a68d95e44677cb9f9ab8a3667957203078fcda0e60e650e1350c82c0b3f202c9a214b01916076b

#7 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 20 November 2016 - 04:13 PM

Generic PHP Interface 0.1300 Testing:
jvqbvg.JPG
 
GPI is an opensource set of generic interfaces for PHP commandline scripts. It is written in PHP/HTML/CSS/Javascript, for GNU/Linux.

I wasn't sure this release was even going to happen. I was trying, once again, to implement progress support in the web-interface, but kept running into dead ends. Finally, I figured out a way to get it working. Not sure if it will work for all browsers or not, but it's working in Firefox :). That's the main thing to report in this release. I updated the task template to demonstrate taking advantage of the webprogress vs regular progress. It displays # style loading bar for progress, but displays a blue loading bar for webprogress. If you plan to do something like that in your tasks, make sure to keep track of how many back-slashes you need to excape things. I was stuck for a while, because I didn't have quite enough back-slashes, and it took me a bit to realize that :P.

 

I also included some notes in the additional resources folder, on how to make a desktop entry file (menu entry in your desktop environment) that activates a web-interface, launches firefox to it, and disables the web-interface again when you close your browser.

 

jvtcid.JPG

 

I find this a bit more convenient than doing it by hand, but the downside is that you can only use it once at a time, otherwise you're trying to activate a session that is already active.


Caution! Please read for more information.

The web-interface uses PHP's built in webserver to run a temporary local webserver. For anyone not familiar webservers, this means 2 things:

1. When a web-interface session is active, other users on the computer, can access it, if they know the URL.
2. If your system is not secured appropriately against external access, when a web-interface session is active, depending on configuration, you could be allowing external visitors to access it. As a side note, on many distros, a simple way to secure your machine from this type of external access is running UFW (a firewall application) with its default rules.


 
Basic installation instructions, a list of dependencies, a copy of the license, basic instructions for using GPI in your projects, and some additional resources, are included in the download.

Features:
- Non-interactive commandline interface
- Interactive commandline interface
- Web interface
- Supports custom variables
- Configuring variables (eg: hide prompts, set default values)
- Displaying task progress, if the task provides it.

- Saving the output

Changes:
- Added displaywebprogressstatus option.
- Fixed progress support in web-interface.
- Added webprogress support. Keep in mind that, unlike progress, webprogress is not retained, so each output of it should be all inclusive, or designed to be replaced.
- Added some more "additional" resources to work with.
- Added additional softvariables for the web-interface management task to make the output more customizable.

Download Links:
- Mega.nz:https://mega.nz/#!UxYFjBYZ!9ch0tSk1Mc9SBlETDR8GCEp6zV1ecTye7Z85apH-SIU

Checksums:
- SHA-512:a6233ec65079ec386c3024b1af4e7b2593b2ff738528fd553c8af9903001b514a73c2d1d5f218be24070d0a83e166c98744b9913bb9a05b0fc0a0b1b2e9a9882



#8 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 23 November 2016 - 01:03 AM

Generic PHP Interface 0.1307 Testing:

GPI is an opensource set of PHP commandline script interfaces. It is written in PHP/HTML/CSS/Javascript, for GNU/Linux.

I figured working on another project which makes use of GPI would be a good way to find bugs I've missed, maybe even stimulate ideas for new features I hadn't thought of yet. So, I've been working on porting Ditto (another project of mine) to PHP, and setting it up to use GPI for as interfaces. Sure enough, I found a few bugs in GPI. This release was just about fixing these bugs :).


Caution! Please read for more information.

[b]The web-interface uses PHP's built in webserver[/b] to run a temporary local webserver. For anyone not familiar webservers,[b] this means[/b] 2 things:

1. When a web-interface session is active, [b]other users on the computer, can access it[/b], if they know the URL.
2. [b]If your system is not secured appropriately[/b] against external access, when a web-interface session is active, depending on configuration, [b]you could be allowing external visitors to access it[/b]. As a side note, on many distros, a simple way to secure your machine from this type of external access is running UFW (a firewall application) with its default rules.


 
Basic installation instructions, a list of dependencies, a copy of the license, basic instructions for using GPI in your projects, and some additional resources, are included in the download.

Features:
- Non-interactive commandline interface
- Interactive commandline interface
- Web interface
- Supports custom variables
- Configuring variables (eg: hide prompts, set default values)
- Displaying task progress, if the task provides it.
- Saving the output

Changes:
- Bugfix. The output modules now have the updated HELP/RELEASE code in them. Saved outputs/weboutputs larger than 1000 characters were incomplete before, because every 1000 characters, it would jump forward 1000 characters.
- Bugfix. Icli had issue, when weboutputstatus configured as hidden with a default wi value, where previous input was used as its input.
- Bugfix. Icli had issue with hidden variables triggering unset variable errors.

Download Links:
- Mega.nz:https://mega.nz/#!8wQ0layR!eEHGZxKfzmIM_CNEGANa5PsIesCUbZtShUyrGoFG5a4

Checksums:
- SHA-512:656ce3148e57e1f13fe7a0ac54ad8779cf9b25a8881768bdc2c83c5616d58a134db2e65e250a5978d1e1ca73413ad8509597a7ca3f0ec67cc9e229783f0ac8ee



#9 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 26 November 2016 - 03:44 PM

Generic PHP Interface 0.1310 Testing:

GPI is an open-source set of PHP commandline script interfaces. I built it for my projects, but it's been genericized to work for yours too :). It is written in PHP/HTML/CSS/Javascript, for GNU/Linux.

While there isn't much added in this release, the additions are quite useful, which is why I decided to make a release now, instead of waiting.


Caution! Please read for more information.

The web-interface uses PHP's built in webserver to run a temporary local webserver. For anyone not familiar webservers, this means 2 things:

1. When a web-interface session is active, other users on the computer, can access it, if they know the URL.
2. If your system is not secured appropriately against external access, when a web-interface session is active, depending on configuration, you could be allowing external visitors to access it. As a side note, on many distros, a simple way to secure your machine from this type of external access is running UFW (a firewall application) with its default rules.


 
Basic installation instructions, a list of dependencies, a copy of the license, basic instructions for using GPI in your projects, and some additional resources, are included in the download.

Features:
- Non-interactive commandline interface
- Interactive commandline interface
- Web interface
- Supports custom variables
- Configuring variables (eg: hide prompts, set default values)
- Displaying task progress, if the task provides it.
- Saving the output

Changes:
- Added code to prevent browser timeouts on very long tasks.
- Added spacing in webgui between output, weboutput, progress, and webprogress. It looks much nicer this way, I think.
- Updated task template to include time based webprogress update example code. Meaning, update webprogress if X time or more has passed since last update. This is useful if your task script has lots of micro-tasks that take very little time to complete, and you don't want to overwhelm the browser with webprogress updates.
- Updated desktop entry creation instructions to check if port is already in use. If it is, then the browser will be opened, but the interface will not be disabled afterwards, because the previous script instance should be handling that.

Download Links:
- Mega.nz:https://mega.nz/#!Y8hFyapD!qQY0BVz36v8vcES5CsPXkj7fCGa6HLcHM4ZwsFgPnS0

Checksums:
- SHA-512:94073c0c91f39b98b06c029d21243cfd90affd4d9f4d833605a80791ab3a3e4c73b480a67bfd5cfac0d6c3cf599b9d72aa290ed67be663f65a4bb477f3aa81e2



#10 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 12,392 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:05:27 PM

Posted 26 November 2016 - 04:34 PM

Sweet






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users