flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
sina
does any one have an example code of http downloader ?
for example i want the file somefile.htm from http://www.somename.com/somefile.htm then i will get the values from that file and print some out to screen |
|||
![]() |
|
coconut
i believe mad wizard goes over that in his winsock tutorial, the link is around here somewhere
|
|||
![]() |
|
roticv
HTTP File Transfer v1.0 found @ http://www.madwizard.org/view.php?page=downloads
|
|||
![]() |
|
sina
thanks ppl
|
|||
![]() |
|
sina
hmm victor the madwizards program is http send
![]() thanks anyway |
|||
![]() |
|
Dr.X
VeSCeRa,
Get the tutorial about sockets from this page. http://www.madwizard.org/view.php?page=tutorials.contents In that tutorial there is an example of retrieving a file from a website. hth Dr.X PS: or copy and paste this into a DOS window: ![]() Code: telnet google.com 80 GET /index.html HTTP/1.1 Host: www.google.com User-agent: TelnetBrowser Connection: close REM the two lines above are actually the enter key. |
|||
![]() |
|
sina
hmm golden replies thanks
|
|||
![]() |
|
sina
hmm then what do u suggest for searching for a string in that filebuffer?
for example if the buffer is "some text in the buffer" and i want to get the "text" |
|||
![]() |
|
Madis731
The robust way is to search all buffer for "t" and if found, try if the next character is "e" and so on. If not, you'll fall through and continue searching for "t" until you find a "text" string or reach the end of your buffer. You can even spare time by stopping n charachters (n=len(string)) from the end when there is no way you can find any instances.
Xmpl. "Some kind of string" There is no possibility you can come to a "text" when you have reached to "r" char in "stRing". Hope you get the point ![]() |
|||
![]() |
|
sina
so how to do this
The robust way is to search all buffer for "t" and if found, try if the next character is "e" and so on |
|||
![]() |
|
Madis731
When buf is your buffer and len is length:
Code: mov eax,buf mov ebx,len Loop: cmp [eax],"t" jne Next add eax,1 cmp [eax],"e" jne Next add eax,1 cmp [eax],"x" jne Next add eax,1 cmp [eax],"t" je FoundIt Next: add eax,1 sub ebx,1 jnz Loop jmp DidntFindIt ;obviously when we reach the end, we don't have our string FoundIt: ;Decide what are you going to do with it ... |
|||
![]() |
|
roticv
Not coded for speed and no error handlign, may crash if text not found
Code: mov eax, buf dec eax @@: inc eax cmp [eax], "test" jnz @B |
|||
![]() |
|
sina
ok what if i have some buffer like
"some text and 19/10" the numbers 19 and 10 will be changing and i want to get them so i will search for "/" in the buffer and get the chars around it with +2 and -2 into strings any suggestions? |
|||
![]() |
|
decard
what about this? It searches string at [edi] for the first occurrence of the pattern at [esi].
Code: StrPos: stdcall StrLen, edi mov ebx,eax ; now ebx holds lenght of the string to search stdcall StrLen, esi mov edx,eax ; now edx holds length of the pattern string lodsb ; load first character of the pattern mov ecx,ebx ; mov ebx,edx ; put str_len(pattern)-1 in ebx dec ebx ; .search: repne scasb jne .not_found cmp ecx,ebx jb .not_found push edi esi ecx or ebx,ebx ; ebx==0 means that we were searching for one jz .got_it ; character. We found it, so we stop. mov ecx,ebx repe cmpsb jne .not_match .got_it: pop ecx esi edi dec edi mov eax,edi .ret: pop edi esi edx ecx ebx ret 8 .not_match: pop ecx esi edi jmp .search .not_found: xor eax,eax jmp .ret |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.