News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

InString

Started by Grincheux, December 24, 2015, 06:43:38 PM

Previous topic - Next topic

guga

Hi Yves...Maybe this can help

Can you be able to read the contents of the php, right ?

On Firefox, for example, the contents of this page is:

<html><head><meta content="width=device-width; height=device-height;" name="viewport"><link href="resource://gre/res/ImageDocument.css" rel="stylesheet"><link href="resource://gre/res/TopLevelImageDocument.css" rel="stylesheet"><link href="chrome://global/skin/media/TopLevelImageDocument.css" rel="stylesheet"><title>avatar_1133_1344617402.gif (GIF Image, 98&nbsp;×&nbsp;83 pixels)</title></head><body><img alt="http://masm32.com/board/index.php?action=dlattach;attach=407;type=avatar" src="http://masm32.com/board/index.php?action=dlattach;attach=407;type=avatar"></body></html>

Note, that on this case, the name of the image is inside the title tag of the html code.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

Grincheux

Quotethe problem is to give a valid file name to:
index.php?PHPSESSID=8b66972e915875a2a5ed239bbb76b96b&amp;action=dlattach;attach=407;type=avatar

Replace any symbol less than 32 with '_'
Ensure the new name is less than MAX_PATH
Append any extension

Here is what I do
Quote
.Data
szFmtWebImage   Byte   "%s\Grumpy-%8.8d.%s",0
.Code
                     mov      _dwCount,0

                     push   edi
                     INVOKE   PathFindExtension,_lpszFileName
                     add      eax,1
                     mov      edi,eax

@LoopCount :

                     add      _dwCount,1

                     INVOKE   wsprintf,_lpszWebImageFile,ADDR szFmtWebImage,ADDR szWrkDirectory,_dwCount,edi
                     INVOKE   PathFileExists,_lpszWebImageFile

                     test   eax,eax
                     jnz      @LoopCount

Grincheux

An internet file name can be more than 2880 bytes long and MAX_PATH is 260.

Siekmanski

Hi ToutEnMasm,

Just skip "PHPSESSID=8b66972e915875a2a5ed239bbb76b96b&amp;" no cookies needed to download the avatar.

To know the kind of image-format, you could check the file by reading the first 10 bytes and check those and then write the correct file-extension.

BMP = BM at offset 0
GIF = GIF87a or GIF89a at offset 0
JPG = JFIF at offset 6
PNG = PNG at offset 1

If you download the second html-page of Topic InString = http://masm32.com/board/index.php?topic=4946.15

Then search for "avatar" src=" you'll find 5 different avatars

http://masm32.com/board/index.php?action=dlattach;attach=2;type=avatar     hutch
http://masm32.com/board/index.php?action=dlattach;attach=4892;type=avatar  Grincheux
http://masm32.com/board/index.php?action=dlattach;attach=164;type=avatar   Siekmanski
http://masm32.com/board/index.php?action=dlattach;attach=407;type=avatar   ToutEnMasm
http://masm32.com/board/index.php?action=dlattach;attach=6;type=avatar     jj2007
Creative coders use backward thinking techniques as a strategy.

Grincheux

Each time I dowload a file I add one to the counter then I call InvalidateRect but it is updated when all is finished.
How could I do?

Grincheux

New version availabale Here
Changed the backgound image.
Problem with GdipCreateHBITMAPFromBitmap resolved. In fact GDI+ was not initialized!
Now it draws the last downloaded image.
I would like to draw each images when they are downloaded but I don't know how.
I made a thread because I thought it resolves the problem, but it is false.
Help me please.

PS : Download $CatchWebImages.exe and launch it to uncompress all the files it contains. Run CatchWebImages.exe to see the program running.

My archives files always beguins with a '$'

Have fun! :eusa_dance:

TouEnMasm

#36
This one download the avatar. follow the link,source codes are included
explain:
The URLDownloadToFile function put the following file in a temporary file
index.php?PHPSESSID=ed5e68d87494a206f290a7e5e4ec6a01&amp;action=dlattach;attach=2;type=avatar
When done:
FindMimeFromData search the extension of the file in the data
movefile rename the temp file giving it the correct extension
http://masm32.com/board/index.php?topic=4946.msg53311#msg53311
Fa is a musical note to play with CL

Grincheux



This is the latest version

I have added a listbox which displays the images. :eusa_clap: :eusa_clap: :eusa_clap: :eusa_clap: :eusa_clap:

Siekmanski

Cool  8)

Works OK here with Windows 8.1
Creative coders use backward thinking techniques as a strategy.

Grincheux

New version available : Binary and source codes
New version available : Binary only

Corrected a small bug when an url was HTTPS:.
Added an other possible of detecting images under java.
Each file as temporary name but with the good image extension.
Added the base web page name, for example it it beguins by img/ccccccccc I forgot to specify http://www.bidule.com/
Removed dead code

Happy new year everybody, black, white, yellow, red...