Omnimaga

General Discussion => Technology and Development => Computer Projects and Ideas => Topic started by: Juju on April 05, 2012, 03:21:51 pm

Title: phpsh.php, a simple php shell written in php
Post by: Juju on April 05, 2012, 03:21:51 pm
I wrote this thing in my free time. There was already a phpsh written in python made by Facebook, but this one is written in PHP. Features basic auto-completion!

Download link (http://files.julosoft.net/phpsh.phps).
Title: Re: phpsh.php, a simple php shell written in php
Post by: Deep Toaster on April 05, 2012, 08:59:26 pm
Is that the one you use on julosoft.net? I like it, though Backspace doesn't work :/
Title: Re: phpsh.php, a simple php shell written in php
Post by: Juju on April 05, 2012, 09:09:35 pm
No, it's a completely different one and it runs in command line, not in a browser.
Title: Re: phpsh.php, a simple php shell written in php
Post by: DJ Omnimaga on April 05, 2012, 10:41:04 pm
By auto completion do you mean how Facebook automatically suggest friend names when you start typing them? Maybe a demo showcasing how it works (for visual people) is in  order?

Also at first I was scared because I misread the title as PWSPHP, and thought a member decided to start making a site using that very outdated and insecure portal. :P
Title: Re: phpsh.php, a simple php shell written in php
Post by: Juju on April 05, 2012, 10:49:43 pm
Well, how this works, you type a line of PHP code in a prompt and it executes it and when you press tab it complete the function or variable name you were typing, much like Facebook with friend names or bash, the Linux shell. Actually it's exactly like bash. But with PHP.
Title: Re: phpsh.php, a simple php shell written in php
Post by: DJ Omnimaga on April 05, 2012, 11:08:49 pm
Hmm I see, so it's a bit more like how in some softwares when you type code, it auto completes the command?
Title: Re: phpsh.php, a simple php shell written in php
Post by: Juju on April 05, 2012, 11:09:44 pm
Pretty much, yeah.
Title: Re: phpsh.php, a simple php shell written in php
Post by: Deep Toaster on April 07, 2012, 10:50:07 am
Oh, I see, it's a terminal for PHP commands :D

I'll try that later.
Title: Re: phpsh.php, a simple php shell written in php
Post by: alberthrocks on April 07, 2012, 03:05:13 pm
Heh, I struggled to get this to work until I realized that your link prints the source of that program, NOT actually let you download it... :P

Anyway, went and compiled PHP 5.4.0 to get readline support (apparently Ubuntu/Debian disables it by default.. :P), which also happens to have some improvements to its own shell (php -a).
(See blog post from its dev: http://schlueters.de/blog/archives/133-Now-in-trunk-Improved-interactive-shell.html)

I've set up an online terminal for you guys to play with:
http://withg.us.to:4200/phpsh/ (Juju's PHP Shell)
http://withg.us.to:4200/phpsh_native/ (PHP's native shell)

As always, do no evil, do no evil, and do no evil :P
Title: Re: phpsh.php, a simple php shell written in php
Post by: Deep Toaster on April 07, 2012, 04:22:59 pm
Heh, I struggled to get this to work until I realized that your link prints the source of that program, NOT actually let you download it... :P
I think I accidentally the same thing, downloading the HTML page and attempting to run it as a PHP file :P
Title: Re: phpsh.php, a simple php shell written in php
Post by: Munchor on April 08, 2012, 06:42:19 am
I tried "echo hey", and it didn't add a newline. On bash, I'm pretty sure echo adds a newline, doesn't the same happen on PHP?

Good work Juju!
Title: Re: phpsh.php, a simple php shell written in php
Post by: alberthrocks on April 08, 2012, 11:33:11 am
I tried "echo hey", and it didn't add a newline. On bash, I'm pretty sure echo adds a newline, doesn't the same happen on PHP?

Good work Juju!
PHP does not add newlines for echo. You must do echo "hey\n" instead.