Jump to content
Sign in to follow this  

trying to encrypt a web page

Recommended Posts


I want to change all the text in a web page according to a given encryption algorithm. I couldn't find a _IEBodyWriteText function in my version of AutoIt (v3.2.2.0), so I built one based on _IEBodyReadText and _IEBodyWriteHTML. But instead of just replacing the text with its encrypted equivalent, the script makes a page that's just the encrypted text, without any links, graphics, etc. This isn't what I want; I want to preserve the formatting of the page and just change the words. Here's the code:

#include <ie.au3>
#include <string.au3>

$url=inputbox($title,"Enter URL:")


func encrypt($text)
    for $c=1 to $len
    return $newtext

func cipher($char)
    if stringisalpha($char) Then
        return $newchar

Func _IEBodyWriteText(ByRef $o_object, $s_text)
    If Not IsObj($o_object) Then
        __IEErrorNotify("Error", "_IEBodyWriteHTML", "$_IEStatus_InvalidDataType")
        SetError($_IEStatus_InvalidDataType, 1)
        Return 0
    $o_object.document.body.innerText = $s_text
    Local $oTemp = $o_object.document
    Return -1

For various IT-security related reasons, I don't have administrative rights to install the newest AutoIt release, so a solution like "just use the _IEBodyWriteText function in the latest release" isn't feasible. However, a link to a UDF library that has a _IEBodyWriteText function will help.

Share this post

Link to post
Share on other sites

Download the zip version and use that. It doesn't require admin privs.

Share this post

Link to post
Share on other sites

When you say you want to encrypt the text, what exactly do you mean? Do you mean text in certain regions or all text including labels and buttons etc.?

Something like this comes to mind:

$oBody = _IETagnameGetCollection($oIE, "body", 0)
$oElements = _IETagnameAllGetCollection($oBody)
For $oElement in $oElements
    $sText = _IEPropertyGet($oElement, "innertext")
    _IEPropertySet($oElement, "innertext", encrypt($sText))

Not tested. Could break things.


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this