I want to know if anyone knows how to get text or strings from the browser example, I want to make a program in ASM to act like a CGI program a EXE type CGI does anyone now how to catpture STDIN from browser? Thanks in advance... Zcoder.....
Posted on 2001-06-17 02:13:00 by Zcoder

;
; Super Simple example of CGI coding in win32 assembly language.
; (c)1999 by Jeremy Collake
; http://webpages.charter.net
; collake@charter.net
; ---------------------------------------------------------------
; 
; This little program demonstrates CGI implementation in win32asm.
; It simply dumps the value of all filled CGI environment variables 
; to the requesting agent.
; 
;
extrn 	ExitProcess:PROC
extrn   WriteConsoleA:PROC
extrn   GetStdHandle:PROC
extrn	WriteFile:PROC
extrn	ExpandEnvironmentStringsA:PROC
extrn	lstrcmp:PROC
extrn	lstrlen:PROC
extrn	GlobalAlloc:PROC
extrn	GlobalFree:PROC
.486p
locals
jumps
.model flat,STDCALL
.data
cr equ 0dh
lf equ 0ah
hstdo dd 0
hMem dd 0
byteswrote dd 0
htmlstart db 'Content-Type: text/html', cr,lf,cr,lf
html_pre  db 'Jeremy''s CGI Environment Variable Dumper
',0 Separator db ' = ',0 Post db '
',0 htmlends db '
',0 EnvVariablePointers: dd offset e1 dd offset e2 dd offset e3 dd offset e4 dd offset e5 dd offset e6 dd offset e7 dd offset e8 dd offset e9 dd offset ea dd offset eb dd offset ec dd offset ed dd offset ee dd offset ef dd offset e10 dd offset e11 dd offset e12 dd offset e13 dd 0 EnvVariables: e1 db '%SERVER_SOFTWARE%',0 e2 db '%SERVER_NAME%',0 e3 db '%GATEWAY_INTERFACE%',0 e4 db '%SERVER_PROTOCOL%',0 e5 db '%SERVER_PORT%',0 e6 db '%REQUEST_METHOD%',0 e7 db '%PATH_INFO%',0 e8 db '%PATH_TRANSLATED%',0 e9 db '%SCRIPT_NAME%',0 ea db '%QUERY_STRING%',0 eb db '%REMOTE_HOST%',0 ec db '%REMOTE_ADDR%',0 ed db '%AUTH_TYPE%',0 ee db '%REMOTE_USER%',0 ef db '%REMOTE_IDENT%',0 e10 db '%CONTENT_TYPE%',0 e11 db '%CONTENT_LENGTH%',0 e12 db '%HTTP_ACCEPT%',0 e13 db '%HTTP_USER_AGENT%',0 .code start: call GetStdHandle,-11 mov hstdo,eax call WriteString,offset htmlstart lea esi,EnvVariablePointers jmp mEnvLoop EnvLoop: call GlobalFree,hMem mEnvLoop: lodsd or eax,eax jz EnvLoopEnds mov edi,eax call GlobalAlloc,64,101h mov hMem,eax call ExpandEnvironmentStringsA, edi, eax, 100h call lstrcmp,hMem,dword ptr jz EnvLoop call WriteString,dword ptr call WriteString,offset Separator call WriteString,hMem call WriteString,offset Post jmp EnvLoop EnvLoopEnds: call WriteString,offset htmlends call ExitProcess,0 GetSHandle proc ret GetSHandle endp WriteString proc pString:DWORD call lstrlen,pString call WriteFile,hstdo,pString,eax,offset byteswrote,0 ret WriteString endp end start ends
Hope this help forge
Posted on 2001-06-17 03:06:00 by forge