flat assembler
Message board for the users of flat assembler.

Index > Main > Cgi without C or Perl in ASM

Author
Thread Post new topic Reply to topic
Jaques



Joined: 07 Jun 2004
Posts: 79
Location: Everywhere
Jaques 21 Jun 2004, 01:26
Is it possible to acomplish CGI sucessfully in Asemmbly

_________________
- My ignorance is now your problem.
Post 21 Jun 2004, 01:26
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 21 Jun 2004, 01:58
yes
CGI is interface
executable can be made in any language
httpd would set environment variables such as "QUERY_STRING", etc, and whatever the program outputs to stdout will be used as cgi output

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 21 Jun 2004, 01:58
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 21 Jun 2004, 02:25
Post 21 Jun 2004, 02:25
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 21 Jun 2004, 16:45
This is also interesting: http://www.whizkidtech.redprince.net/cgi-bin/tutorial

Look it also an intersting way to fight spammers using cgi, proposed by the author.
Post 21 Jun 2004, 16:45
View user's profile Send private message Yahoo Messenger Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 21 Jun 2004, 19:44
interesting... can anybody present an example of CGI script in ELF format?
Post 21 Jun 2004, 19:44
View user's profile Send private message Visit poster's website Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 23 Jun 2004, 03:07
This is probably the simplest one:
Code:
format ELF executable
entry start

section readable writeable

html:
        db 'Content-type: text/html',0Ah,0Ah
        db '<html><head><title>Fasm Worldwide</title></head>',0Ah
        db '<center><body bgcolor=Black text=Green>',0Ah
        db '<font face="sans-serif" size="10">',0Ah
        db '<a href="http://flatassembler.net">fasm is everywhere</a>',0Ah
        db '</center></font></body></html>'
  .size = $ - html - 1

section readable executable

start:
        mov     eax,4
        mov     ebx,1
        mov     ecx,html
        mov     edx,html.size
        int     0x80

        mov     eax,1
        xor     ebx,ebx
        int     0x80    
Post 23 Jun 2004, 03:07
View user's profile Send private message Yahoo Messenger Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 23 Jun 2004, 04:32
Isn't it CRLF as opposed to single LF?

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 23 Jun 2004, 04:32
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 23 Jun 2004, 04:42
Unix style. All my hand-edited html files have LF only and works with any browser.

Is there a W3C instruction regarding CRLF?
Post 23 Jun 2004, 04:42
View user's profile Send private message Yahoo Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 23 Jun 2004, 05:46
It works for me. Take a look at:

http://asm32.hosters.uni.cc/cgi-bin/fasmcgi/

Regards.
Post 23 Jun 2004, 05:46
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 23 Jun 2004, 06:57
hmmm, and I can't make it work on my server... maybe I'm missing something? does it have to be in cgi-bin directory? Is it enough to rename it to "index.cgi"? I have newer been using CGI so I don't understand everything.... :/

[edit]it is working now... it was just the matter of setting permisions Smile what a fool... hehe http://www.decard.net/cgi-bin/fasm/index.cgi[/edit]
Post 23 Jun 2004, 06:57
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 04 Nov 2004, 21:14
Sorry, to bring this up again, but I haven't found ANY way to tell the server/browser to EXECUTE the exe, not download.

There was just ONE 16-bit Hello.exe, that didn't download, but outputted junk and I was glad Very Happy -at least something...

"All you have to do is put an exe in cgi-bin and write the address in your IE"
hmm... doesn't work that way
I tried Java and there you would have to make a File.cgi where you put something like this:
Code:
#!/bin/sh

# Kunstlik hingamine
CLASSPATH=`dirname $0`
export CLASSPATH

#echo "Content-type: text/plain"
#echo

exec java       -DREQUEST_METHOD="$REQUEST_METHOD" \
                -DQUERY_STRING="$QUERY_STRING" \
                Vorm       


Anyone? what did I miss
Post 04 Nov 2004, 21:14
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 05 Nov 2004, 12:46
Madis731,
1. is your cgi-bin directory in a linux server? (as you are using a bash shell script)
2. is your client a windows system? (as you are talking about IE)
Post 05 Nov 2004, 12:46
View user's profile Send private message Yahoo Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 05 Nov 2004, 16:09
Well, I don't know what server we have at school Sun? maybe...
it does not matter because I can run Java in any directory - there is no such *special* directory, that has cgi-bin as a name and CGI as an ONLY runnable interface in it.
I even made a Java guestbook in cgi, but I just can't do the same with exe.
Another interesting option I have found is that the file does not have to be *.exe so files like "c" are perfectly legal - but mystery remains - how does server know? header checking or what?

Yes, I have a Win2k machine and yes I have some rudiments of IE on that but I HATE it. Unfortunately Mozilla got beaten with that *one* 16-bit exe. Otherwise they act the same. And after I did some tricks in server (I can't remember what) over SSH, it ran on both: IE & Moz ...wierd...
Post 05 Nov 2004, 16:09
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 05 Nov 2004, 19:14
try to rename *.exe to *.cgi
also, i've failed to run MZ's & PE's on unix (free) hosting
Post 05 Nov 2004, 19:14
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 05 Nov 2004, 21:29
You can run an EXE on a web server ?
this is new for me, could someone explain?
Post 05 Nov 2004, 21:29
View user's profile Send private message Visit poster's website Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 05 Nov 2004, 22:08
CGI app is just an ordinary program (MZ, PE, ELF, etc.) which output is redirected to the user' browser. Nothing special for me. Look to pelaillo's post above with ELF example - you just need to compile it, rename to some_name.cgi and place to the *nix-based server. Then type its address in your browser and see something like this: http://mikedld.50free.org/_cgi/index3.cgi.
MZ & PE executables may be run on Windows-based server of course.
Post 05 Nov 2004, 22:08
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 06 Nov 2004, 15:26
cgi programs run on server so the native file must be able to run in the server system.
To run a PE exe in a *nix server, you need to instruct the server to run it through wine. If you don't have access to the server, there's nothing to do about.

If you want to test it locally, you need to have a server running on your computer and access it from browser as http://localhost/your_cgi_script and then it runs instead of download.
Post 06 Nov 2004, 15:26
View user's profile Send private message Yahoo Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 06 Nov 2004, 16:39
Thank you Smile
its cool Cool
Post 06 Nov 2004, 16:39
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 07 Nov 2004, 13:14
Oh, my bad, exe is a windows filetype and of course linux won't understand it by default:P I read from above that ELF is the way to go in these cases
Post 07 Nov 2004, 13:14
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.