mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2003
Posts: 11
D
d0h Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Oct 2003
Posts: 11
hello,

how could i download a php-generated image which regenerates each time the php file is refreshed... onto my harddisk by using sockets? i've been stuck with this problem for a while now... some help would be good laugh

i've tried some of the downloaders from mircscripts.org, but they turn up with errors..

thanks in advance

Joined: Feb 2003
Posts: 307
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
well does the image change its name?
if not you must put a downloader sending the right request to make the server generate the page and image, then, from the page source (to get the pic's name) and go get that image.
I imagine that you need to send a POST request first and i haven't seen no downloader doing this until now.
you can do this by upgrading the downloader you have.

good luck

Joined: Oct 2003
Posts: 11
D
d0h Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Oct 2003
Posts: 11
hi,
um.. theres no name for the image... i made an example here::

www.d-0h.com/ocr.php?string=asdfjk&submit=GO

i have the url of the page which generates the image... but theres no source and the image has no name :s

Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
you should send a content header... because opera doesn't see that as a picture...


If it ain't broken, don't fix it!
Joined: Jul 2003
Posts: 742
Hoopy frood
Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
firefox doesnt either


http://MTec89Net.com
irc.freenode.net #MTec89Net
Joined: Feb 2003
Posts: 307
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
wwhhoo never seen something like that...

what you can do is this, read from the socket whatever the server sent you and if is starts by ‰PNG you know it is a pic and put all that source in a file.png smile

you can see the complete source with mozilla

tontito

Joined: Feb 2004
Posts: 201
J
Jae Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2004
Posts: 201
IE loaded it fine wink
maybe the other browsers are dumb to the fact its got data that is a PNG? laugh

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
It's like requesting any other page, but this time you read the data into a binary variable and save it to a file:
  • alias getpic sockopen gp www.[/i]d-0h.com 80

    On *:sockopen:gp:{
    var %s = sockwrite -tn gp
    %s GET /ocr.php?string=whateva&submit=GO HTTP/1.0
    %s Host: www.[/i]d-0h.com
    %s Referer: www.[/i]d-0h.com
    %s
    write -c pic.png
    }

    On *:sockread:gp:{
    if $sock(gp).mark == data {
    sockread &data
    bwrite pic.png -1 &data
    }
    else {
    var %var
    sockread %var
    echo -s -> %var
    if !%var { sockmark gp data }
    }
    }

    On *:sockclose:gp: run pic.png

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
It already sends a Content-Type header, but a wrong one: text/html instead of image/png. Apparently IE is the only browser that disregards what the server says and guesses the file type by itself.

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
You call it dumb but I call it safe. Remember the britney.jpg exploit? Only IE executed the malicious HTML code inside the "picture" because of its habit of auto-identifying files.

Joined: Feb 2003
Posts: 307
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
true!

Joined: Feb 2004
Posts: 201
J
Jae Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2004
Posts: 201
Quote:
You call it dumb but I call it safe. Remember the britney.jpg exploit? Only IE executed the malicious HTML code inside the "picture" because of its habit of auto-identifying files.


so true. but non the less M$ took the abilities to far and shoulda stuck with only doign it is its going to put out a picture. not executeable code

Damn browser wars.


Cheers Col

Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
..Or maybe browsers should force the webmasters to follow the HTML standards at the first place. Otherwise, that'd be like telling mIRC to guess that a raw numeric 1234 is RPL_ENDOFNAMES just because it's sent by the server as ":server 1234 nick #channel :End of /NAMES list". :tongue:


* cold edits his posts 24/7
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
I agree, but even with the latest security pathes IE still does that. Try yourself: http://members.lycos.co.uk/onln/files/pic.jpg

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
good point :tongue:
Code:
<script language=javascript>
alert('I am a javascript hidden inside this picture...\nLook how IE interprets me...');
</script>


New username: hixxy

Link Copied to Clipboard