<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.