Jump to content

Recommended Posts

Posted

Hi all,

Familiar Scenario:

Your password shows as a saved password in Internet explorer web page but you've forgotton it :lmao:

This script (needs beta version) will scan all open Internet explorer windows. And if it detects a password box filled in, it will show it in a message box.

Ever wondered what is the default password in Autoit Forums before you log in?

Posted Image

;) Enjoy!

Opt("MustDeclareVars", 1)

Dim $oShell, $oShellWindows, $oWindow, $oIEDocument, $oCOMError
Dim $sTitle, $sPasswords

$oCOMError = ObjEvent("AutoIt.Error","IEPwdRevealer_Errorhandler"); Install a error handler 

$oShell = ObjCreate("Shell.Application")
$oShellWindows = $oShell.Windows (); collection of all ShellWindows (IE and File Explorer)

For $oWindow In $oShellWindows
    If (ObjName($owindow.document) = "DispHTMLDocument") Then
        $oIEDocument = $owindow.document
    ; Save the current title displayed along with password, if a password box is found
        $sTitle = $oIEdocument.Title
    ; Search for password boxes in document, including all frames in document
        $sPasswords = GetPasswordsInDoc($oIEDocument)
        If $sPasswords <> "" Then
            MsgBox(0, "IE Password Revealer", "IE Window Title: " & $sTitle & @CRLF & _
                    "Password(s): " & $sPasswords)
        EndIf
    EndIf
Next

Func GetPasswordsInDoc($oIEDocument)
    Local $iElements, $sPasswords, $iFrames
    
    $iElements = $oIEdocument.All.Length
; Enumerate all elements in document to find the password elements
    For $i = 0 to $iElements - 1
    ; Try to execute $oIEdocument.All.Item($i).getAttribute
        $oIEdocument.All.Item($i).getAttribute("Type")
        If @error Then
            ConsoleWrite($i & @CR)
        Else
            If StringLower($oIEdocument.All.Item($i).getAttribute("Type")) = "password" Then
            ; A password box is found, read the password
                If $oIEdocument.All.Item($i).getAttribute("Value") <> "" Then
                    $sPasswords = $sPasswords & $oIEdocument.All.Item($i).getAttribute("Value") & @CRLF
                EndIf
            EndIf
        EndIf
    Next
        
; Find no. of frames in document
    $iFrames = $oIEdocument.frames.length
    
   ; Enumerates all frames in document
    For $i = 0 To $iFrames - 1
       ; If the document contains one or more frames, call the function recursively to search for a password also in them
        
    ; Try to execute $oIEdocument.frames.Item($i).document
        $oIEdocument.frames.Item($i).document.document
        If Not(@error) Then
            $sPasswords = $sPasswords & GetPasswordsInDoc($oIEdocument.frames.Item($i).document) & @CRLF
        EndIf
    Next
    
    
    If $sPasswords <> "" Then
        Return $sPasswords
    Else
        SetError(1); No passwords found in document
    EndIf
EndFunc

Func IEPwdRevealer_Errorhandler()
; Errors may occur executing $oElement.getAttribute("Type") and $oIEdocument.frames.Item($i).document
; Do nothing
    
    Select
    
    Case $oCOMError.number = -2147024891; Access is denied
        SetError(1)
        Return
    Case $oCOMError.number = -2147352567; Access is denied
        SetError(2)
        Return
    Case $oCOMError.number = -2147352570; Unknown name
        SetError(2)
        Return
    EndSelect
    
    MsgBox(8240, "IE Passwords Reveler", "Unhandled COM Automation Error." & @CRLF & @CRLF & _
                "This operation resulted in an unhandled error." & @CRLF & @CRLF & _
                "Technical Information: " & @CRLF & _
                "Error Number: " & $oCOMError.number & @CRLF & _
                "Error Description: " & $oCOMError.windescription & @CRLF & _
                "Line Number: " & $oCOMError.scriptline)
    Exit
EndFunc
Posted

Works fine for me ;)

And by the way, if you wanted to know the default password in the AutoIt forums you could just look at the html code :lmao:

Posted (edited)

Good idea... tone

i use firefox... and it seems to store differently

does this work on IE ???

; Get Autoit Password
; Author - Valuater
Dim $Pword
#include <INet.au3>
#include <File.au3>
$Sword = _INetGetSource('http://www.autoitscript.com/forum/index.php?')
FileWrite(@TempDir &'\ptxt.txt', $Sword)
_FileReadToArray(@TempDir &'\ptxt.txt', $Pword)
For $x = 1 to $Pword[0]
    If StringInStr( $Pword[$x], '<input type="password" size="20" name="PassWord" onfocus="this.value=') Then
        MsgBox(262208,"Password", StringTrimLeft(_StringBetween( $Pword[$x], '"PassWord" onfocus="this.value=''" value="', ' />'), 37))
        ExitLoop
    EndIf
Next
Func _StringBetween($s_String, $s_Start, $s_End = 0)
    $s_Start = StringInStr($s_String, $s_Start)+StringLen($s_Start)
    return StringMid($s_String, $s_Start, StringInStr($s_String, $s_End)-$s_Start)
EndFunc
MsgBox(262208, "Password Error", "No Password Found.   ", 5)

8)

Edited by Valuater

NEWHeader1.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...