CGI scripts with busybox httpd

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#21 Post by goingnuts »

You can upload files - BUT BINARY FILES GET BROKEN IN THE UPLOAD ... Any fixes for that?!
cgic works quite good
As alternative server thttpd is small and swift.
I have attached bundle of both including some test scripts.

The approach to use cgi/html as configuration tool requires a web browser. Smallest CLI browser I know is retawq (305K static linked). Compared to pure dialog (233K static linked) you could argue that cgi/html ends up using more disk space if used for configuration interface only.
Edit 20200205: Added source for cgic as above link changed content. Added patch to get upload.cgi
Attachments
cgic-207.diff.gz
patch to get upload.cgi - apply to source before building
(2.55 KiB) Downloaded 62 times
cgic207.tar.gz
cgic-207 source - to build:
make
gcc test2cgi.c -o upload.cgi libcgic.a
(49.78 KiB) Downloaded 70 times
snap0003.png
(82.33 KiB) Downloaded 315 times
thttpd-2.26.pet
Bundle of thttpd and cgic
(115.49 KiB) Downloaded 126 times
Last edited by goingnuts on Wed 05 Feb 2020, 19:30, edited 1 time in total.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#22 Post by sc0ttman »

More tips:

Server side includes (SSI) with busybox httpd:

https://raw.githubusercontent.com/brgl/ ... ttpd_ssi.c

Compile it with:

Code: Select all

gcc -static httpd_ssi.c -o httpd_ssi
Then in your httpd.conf, put the following:

Code: Select all

*.html:/bin/httpd_ssi
*.htm:/bin/httpd_ssi
You can then use "Server side includes" (SSI) with your busybox httpd :)

To do so, add the server side includes into your HTML pages like so:

Code: Select all

<p>Some text here</p>

<!--#include file="some-file.html" -->

<p>Some more</p>
8)
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#23 Post by technosaurus »

You may want to goto archive.org for goingnuts most recent post .... did anyone archive the tarballs?
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#24 Post by nosystemdthanks »

ive done cgi scripting with a few languages, including bash.

i abandoned bash very quickly because i decided it was IMPOSSIBLE (or perhaps just far too much effort) to do cgi in bash without exposing the shell to the network (for the local network thats not great, but for a public server thats terrible.)

let me know if you find a way to do bash cgi safely. ill tell you if i can find a way to break it.
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#25 Post by rockedge »

nosystemdthank

is that a challenge? When I win what is in it for me?

I've written cgi scripts in several languages since ARPANET....I can't recall an incident but I'm willing to let you give it a shot.....with some kind of consequence attached for when you fail.

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#26 Post by nosystemdthanks »

rockedge wrote:nosystemdthank

is that a challenge? When I win what is in it for me?

I've written cgi scripts in several languages since ARPANET....I can't recall an incident but I'm willing to let you give it a shot.....with some kind of consequence attached for when you fail.
obviously if you want to do it that way, we would have to discuss terms beforehand. feel free to pm me of course. if we agree then we can announce terms publicly.

its the way bash does command lines by default and strings as an exception that is the problem here. i really dont think you can make a secure cgi script in only bash-- ive already written a cgi script in bash, you know. id really love to be wrong though.
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: CGI scripts with busybox httpd

#27 Post by Moose On The Loose »

sc0ttman wrote:I've been playing with shell based CGI scripts..
[....]
"<br>========================================================<br>"
[..]
You can use <HR> to get a better looking result.

Also:
Within HTML you can:
1) Use base64 to place a small xxx.png or the like in the page
2) Use SVG graphics to make a line drawing
3) Validate form entries with JavaScript
4) Name form entries to make the parse at receiving simpler
5) Use "hidden form entries" to remember state

Post Reply