473,703 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Decoding base64 data and extracting images

Hello all,

We have a problem on a webpage. That page is sent some email data in
base64 format. what we need to do is, decode the base64 data back to
original shape and extract attached image from it.

Any help will be highly appriciated.

Thanks

Rizwan

Sep 20 '05 #1
27 15036
I forgot to mention, we are using ASP.

Thanks again,

Rizwan

Sep 20 '05 #2
<gR*****@gmail. com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hello all,

We have a problem on a webpage. That page is sent some email data in
base64 format. what we need to do is, decode the base64 data back to
original shape and extract attached image from it.

Any help will be highly appriciated.

Thanks

Rizwan


Below is a VBScript that does what you want but requires "base64.exe "
from http://www.fourmilab.ch/webtools/base64/

You copy-and-paste the base63 (endoded) data into the textarea then click
the Decode button which saves it to disk (as "base64.enc ") then decodes it
(as "base64.dec "). After which you can rename it to a filename with the
correct extension.

I use a variation of this to look at the base64 text included in SPAM. I
use a text editor to view the decoded data to see it it might be harmful.
<html>
<head>
<title>base64.h ta</title>
<script type="text/vbscript">
Option Explicit
Sub Decode()
'*
'* Declare Constants
'*
Const cHTA = "base64.hta "
Const cDEC = "base64.dec "
Const cENC = "base64.enc "
Const cWSS = "%comspec% /C base64.exe -d $1 $2"
'*
'* Encoded File Save
'*
Dim strENC
strENC = document.getEle mentById("encod ed").value
Dim objFSO
Set objFSO = CreateObject("S cripting.FileSy stemObject")
Dim objCTF
Set objCTF = objFSO.CreateTe xtFile(cENC,Tru e)
objCTF.Write(st rENC)
Set objCTF = Nothing
Set objFSO = Nothing
'*
'* Decoded File Make
'*
Dim strWSS
strWSS = Replace(cWSS,"$ 1",cENC)
strWSS = Replace(strWSS, "$2",cDEC)
'Alert(strWSS)
Dim objWSS
Set objWSS = CreateObject("W Script.Shell")
objWSS.Run strWSS, 7, True
Set objWSS = Nothing
End Sub
</script>
<head>
<body>
<form>
<b>Copy-and-paste encoded data below then click Decode.</b>
<br>
<textarea name="encoded" id="encoded" cols="80" rows="20">
</textarea>
<br>
<input type="button" value="Decode" onclick="Decode ()">
</form>
</body>
</html>

Pure VBScript solutions may exist; try Google.
Sep 20 '05 #3

"McKirahan" <Ne**@McKirahan .com> wrote in message
news:Vc******** ************@co mcast.com...
<gR*****@gmail. com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hello all,

We have a problem on a webpage. That page is sent some email data in
base64 format. what we need to do is, decode the base64 data back to
original shape and extract attached image from it.

Any help will be highly appriciated.
[snip] Pure VBScript solutions may exist; try Google.


Here's a pure VBS solution:
http://www.pstruh.cz/tips/detpg_Base64/
Sep 20 '05 #4
Thanks for your reply McKirahan,

Infact we need some script which do this decoding for us in ASP page.
Exe will not help us.

Rizwan

Sep 20 '05 #5
Thanks for your reply Chris Hohmann,

Yes last nite after a lots of search i found same link you mentioned.
It looks working, will see in detail later.

But the second part of the question is still there. i.e. Extract
attached Images/Files from that email, which was encoded in base64.
Let's suppose, we have decoded data from base64 to original shape, Now
how will we extract attachments from that email in ASP?

Thanks again

Sep 20 '05 #6
<gR*****@gmail. com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Thanks for your reply Chris Hohmann,

Yes last nite after a lots of search i found same link you mentioned.
It looks working, will see in detail later.

But the second part of the question is still there. i.e. Extract
attached Images/Files from that email, which was encoded in base64.
Let's suppose, we have decoded data from base64 to original shape, Now
how will we extract attachments from that email in ASP?

Thanks again


How is the "page is sent some email data"?

Could you post an URL that has a sample?
Sep 20 '05 #7
This is sample, what we get (i have truncated MMS data)

<bspostevent>
<field name="RemoteNet work" type = "string">vodafo ne-uk</field>
<field name="LastName" type = "string"></field>
<field name="MobileNet work" type = "string">vodafo ne-uk</field>
<field name="MMS" type =
"data">TUlNRS1W ZXJzaW9uOiAxLjA NClN1YmplY3Q6IA 0KRnJvbTog..... ......</field>
<field name="State" type = "string">1</field>
<field name="MobileNum ber" type = "string">+44779 6170669</field>
<field name="Text" type = "string"></field>
<field name="Now" type = "date">2004-06-18 20:28:07 +0000
</field>
</bspostevent>

Sep 20 '05 #8
There's a big "MMS" tag data in base64.
lets suppose we are able to decode the base64 to original shape. Then
it will be just like an email, with attachmenr(s) of image(s). We need
to extract those image(s).

if you need complete base64 data, i can mail you google not allowing to
paste here.

can you help?

Sep 20 '05 #9
<gR*****@gmail. com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
This is sample, what we get (i have truncated MMS data)

<bspostevent>
<field name="RemoteNet work" type = "string">vodafo ne-uk</field>
<field name="LastName" type = "string"></field>
<field name="MobileNet work" type = "string">vodafo ne-uk</field>
<field name="MMS" type =
"data">TUlNRS1W ZXJzaW9uOiAxLjA NClN1YmplY3Q6IA 0KRnJvbTog..... ......</field>
<field name="State" type = "string">1</field>
<field name="MobileNum ber" type = "string">+44779 6170669</field>
<field name="Text" type = "string"></field>
<field name="Now" type = "date">2004-06-18 20:28:07 +0000
</field>
</bspostevent>


How do you know that it's an image?
What would be the filename?
Are there multiple per page?
How, exactly, would you want the process to work?
Sep 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3469
by: Thomas Williams | last post by:
Hello everyone, my name is Tom W. And, I am new to the list, and have been using Python for about a year now. Anyway, I got a question! I am trying to decode MIME (base64) email from a POP3 server, but all I get is a corrupt file. I know that it good to begin with because I check it with another email client. This is what I am doing!
0
2413
by: Sridhar Anupindi | last post by:
Hi, I am using the following algorithm to decode the string into ASCII set of characters.. The function returns me the decoded string but the problem is that my string contains both normal characters and also the BASE64 Character set ( like this "<searchKeyword>&#xc3;&#xa7;&#xc3;&#xa3;&#xc3;&#xb1;</searchKeyword>"). Since I am passing the entire string to this function and I want this function to handle only the BASE64 Characters and...
3
2305
by: nly | last post by:
What's the purpose of "Base64 encoding and decoding"? Thanks in advance!
14
4344
by: BB | last post by:
Hello. i am trying to decode a block of (what i think is) base64 into text, and i have NO idea how to begin. I'm going to paste the whole string here, but i want to know the steps necessary to convert it to text. i've tried the usual binary/ascii techniques, but they just seem to loop back in to each other. what is the step by step to get from base64 to text? this is for an evil riddle i'm trying to solve. thanks. Becca. here's the...
10
6196
by: mistral | last post by:
I need help implement based64 decoding in javascript: a function to return a script that has been base64 encoded into a string (decoding in client side). For encode, online base64 encoder tool was used. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>JavaScript Base64 Decoder</title> <script type="text/javascript">
3
6840
by: ashu | last post by:
I am searching for Win32 (or WinMobile) API for converting ASCII string to Base64 and vice-versa can anyone help me out.... Thanks in advance...
1
5180
by: Bryan A | last post by:
I'm having a problem decoding an encrypted Base64 string (with a key). I am trying to encode and decode with a url friendly version. It works if I use them seperate but when I try to put them both in the same function it doesn't decrypt it right. function encrypt($string, $key) { $result = ”; for($i=0; $i<strlen($string); $i++) { $char = substr($string, $i, 1); $keychar = substr($key, ($i % strlen($key))-1, 1);
0
8669
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9251
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9121
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4432
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3123
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.