Decoding base64 data and extracting images

M

McKirahan

there software automatically converts to this thing. so we'll have to
play with this.
Don't you think this decoding algorithm might be faulty?

Nope.

There's not enough encoded data to represent an image.

Below is the encoded data for a 43 byte GIF image:

R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==
 
G

gRizwan

Thanks for your reply Evertjan, do u think above decoded data is
incorrect? so that we go for some other decoding algo.

If No, then how to extract images from that decoded data?
 
E

Evertjan.

wrote on 21 sep 2005 in microsoft.public.inetserver.asp.general:
Thanks for your reply Evertjan, do u think above decoded data is
incorrect? so that we go for some other decoding algo.

Above?

On usenet please always quote, this is not email.

If with Google groups this is difficult, please use a real News-reader.
Most are free.
 
G

gRizwan

Sorry Evertjan didn't realise that :(
You can see encoded data in a XML file's MMS tag at
http://www.pakitfriends.com/mms.xml
Here is the decoded data by a base64 decoding algorithm from encoded
data.
We need to extract image attachments from this message.
How can we do that?

********** Decoded Data ***********
MIME-Version: 1.0
Subject:
From: +447796170669
To: +447719336699
Mxtelecom-Id: 15881964
Date: 2004-06-18 21:28:13
Content-Transfer-Encoding: binary
Content-Type: multipart/related;
boundary="F3X/kupo3+S3vrIYnnksMQAAAAM="; start="<mms.smil>";
type="application/smil"


--F3X/kupo3+S3vrIYnnksMQAAAAM=
Content-Type: application/smil; name=mms.smil
Content-Id: <mms.smil>
Content-Transfer-Encoding: 7bit


<smil>
<body>
<par dur="5s">
<ref src="t0" />
</par>
<par dur="5s">
<text src="t1%3At1.txt" />
</par>
<par dur="5s">
<img src="i1%3ATeifi.jpg" />
</par>
</body>
</smil>


--F3X/kupo3+S3vrIYnnksMQAAAAM=
Content-Type: application/smil; name=t0
Content-Transfer-Encoding: binary
Content-Id: <t0>


<smil>
<head>
<layout>
<root-layout height="127" width="111"/>
<region id="Image" top="50%" left="0%" height="50%" width="100%"/>
<region id="Text" top="0%" left="0%" height="50%" width="100%"/>
</layout>
</head>
<body>
<par dur="60000ms">
<text src="cid:t1:t1.txt" region="Text"/>
<img src="cid:i1:Teifi.jpg" region="Image"/>
</par>
</body>
</smil>


--F3X/kupo3+S3vrIYnnksMQAAAAM=
Content-Type: text/plain; name=t1%3At1.txt
Content-Location: t1%3At1.txt


Apicheck
--F3X/kupo3+S3vrIYnnksMQAAAAM=
Content-Type: image/jpeg; name=i1%3ATeifi.jpg
Content-Transfer-Encoding: binary
Content-Location: i1%3ATeifi.jpg


ÿØÿáExif
*****************************
 
E

Evertjan.

wrote on 22 sep 2005 in microsoft.public.inetserver.asp.general:
Sorry Evertjan didn't realise that :(

[ again: please quote,
there are more readers than me alone on usenet,
otherwise it would be email,
netiquette is important on usenet ]
You can see encoded data in a XML file's MMS tag at
http://www.pakitfriends.com/mms.xml

The mms line can be easily decoded by:

document.write(base64Decode(str).replace(/</g,'&lt;'));

[see the link I gave for the content of the base64Decode() function]

Here is the decoded data by a base64 decoding algorithm from encoded
data.
We need to extract image attachments from this message.
How can we do that?

********** Decoded Data ***********
MIME-Version: 1.0
Subject:
From: +447796170669
To: +447719336699
Mxtelecom-Id: 15881964
Date: 2004-06-18 21:28:13
Content-Transfer-Encoding: binary
Content-Type: multipart/related;
boundary="F3X/kupo3+S3vrIYnnksMQAAAAM="; start="<mms.smil>";
type="application/smil"


--F3X/kupo3+S3vrIYnnksMQAAAAMContent-Type: application/smil;
name=mms.smil Content-Id: <mms.smil>
Content-Transfer-Encoding: 7bit


<smil>
<body>
<par dur="5s">
<ref src="t0" />
</par>
<par dur="5s">
<text src="t1%3At1.txt" />
</par>
<par dur="5s">
<img src="i1%3ATeifi.jpg" />
</par>
</body>
</smil>


--F3X/kupo3+S3vrIYnnksMQAAAAMContent-Type: application/smil; name=t0
Content-Transfer-Encoding: binary
Content-Id: <t0>


<smil>
<head>
<layout>
<root-layout height="127" width="111"/>
<region id="Image" top="50%" left="0%" height="50%" width="100%"/>
<region id="Text" top="0%" left="0%" height="50%" width="100%"/>
</layout>
</head>
<body>
<par dur="60000ms">
<text src="cid:t1:t1.txt" region="Text"/>
<img src="cid:i1:Teifi.jpg" region="Image"/>
</par>
</body>
</smil>


--F3X/kupo3+S3vrIYnnksMQAAAAMContent-Type: text/plain;
name=t1%3At1.txt Content-Location: t1%3At1.txt


Apicheck
--F3X/kupo3+S3vrIYnnksMQAAAAMContent-Type: image/jpeg;
name=i1%3ATeifi.jpg Content-Transfer-Encoding: binary
Content-Location: i1%3ATeifi.jpg


ÿØÿáExif
*****************************

You cannot, they are not there.

Perhaps in seperate files or seperate mail?

These seems to be a strange mixup in wording of protocol:

- attachments are not attached.

- attachted attachments are called enclosures.
 
G

gRizwan

The mms line can be easily decoded by:
document.write(base64Decode(str).replace(/</g,'&lt;'));
[see the link I gave for the content of the base64Decode() function]
You cannot, they are not there.
Perhaps in seperate files or seperate mail?
These seems to be a strange mixup in wording of protocol:
- attachments are not attached.
- attachted attachments are called enclosures.

Evertjan. this is just a sample i am given, there might be few more
available once we develop the code, but suppose attachements are there,
how can we extrat (specially attached images) those in ASP?
 
E

Evertjan.

wrote on 22 sep 2005 in microsoft.public.inetserver.asp.general:
Evertjan. this is just a sample i am given, there might be few more
available once we develop the code, but suppose attachements are there,
how can we extrat (specially attached images) those in ASP?


If you have the total email string as the value of a variable in ASP,
you will have to select the base64coded part by old Basic functions
[left, mid, right] or regular expressions if you want to code in VBscript,
or if you code in Jscript in the similar functions, like .substr() or
substring(), or also regex. [If you cannot do that, I suggest you hire a
professional or learn more VBS and/or JS]

and then use

decodedString = base64decode(codedString)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,147
Messages
2,570,835
Members
47,382
Latest member
MichaleStr

Latest Threads

Top