To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=44304
                  Issue #:|44304
                  Summary:|Password recovery
                Component:|utilities
                  Version:|OOo 1.1.2
                 Platform:|All
                      URL:|
               OS/Version:|Linux
                   Status:|UNCONFIRMED
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|FEATURE
                 Priority:|P5
             Subcomponent:|code
              Assigned to:|hro
              Reported by:|mvandenhoeke





------- Additional comments from [EMAIL PROTECTED] Mon Mar  7 01:13:05 -0800 
2005 -------
I have written a macro to recover a password of an OpenOffice writer document. 
This exercice has been made to take the attention to people, that it is possible
to recover a password.  So people can leveling the numbers of characters compose
with 'letters and numbers' of a password to avoid the recovery of a password if
it is an important document. For example, if it is not an important document 5
letters will be enough, and if it is an important document a password with 6
characters compose by a combination of 'lettres and numbers' will be necessary.
The conclusion of this exercice is that the OOo team have well worked, because
it is may be impossible to recover an long and complex password.

To the attention of the OOo team, could you publish this code on your site.
This exercice was made in the spirit of the FLOSS community, and I hope it will
serve it.

The code behind is released under terms of the GPL licence.  But you must only
use this code on your personal document !

This code was written for a document that have a password with the length of 6
characters only compose by letters.  It take about 17 password per seconds. 
This is very slow because, it will take approximatively 200 days of intensive
calculation to recover the password !

Sub OpenUNO
        Dim oDesktop
        Dim oDoc
        Dim args(2) As New com.sun.star.beans.PropertyValue
        Dim DstFile as string
        Dim intCounter1 as integer
        Dim intCounter2 as integer
        Dim intCounter3 as integer
        Dim intCounter4 as integer
        Dim intCounter5 as integer
        Dim intCounter6 as integer
        Dim strPassword1 as string
        Dim strPassword2 as string
        Dim strPassword3 as string
        Dim strPassword4 as string
        Dim strPassword5 as string
        Dim strPassword6 as string
        Dim strDocLog as string
        Dim strDocLogText as string
        
        strDocLog="/home/temp/doclog.txt"
        
        oDeskTop=CreateUnoService("com.sun.star.frame.Desktop")
        DstFile = ConvertToURL("/home/temp/docpassword.sxw")
        args(0).name="ReadOnly"
        args(0).value=True
        args(1).name="Password"
        args(2).name="Hidden"
        args(2).value=True

        fileAccessService = 
createUnoService("com.sun.star.ucb.SimpleFileAccess")
        textOutputStream = createUnoService("com.sun.star.io.TextOutputStream")
        If fileAccessService.exists(strDocLog) Then
                If fileAccessService.isReadOnly(strDocLog) Then
                        MsgBox "Could not write to file: " & strDocLog
                        Exit sub
                End If
        End If
        outputStream = fileAccessService.openFileWrite(strDocLog)               
        outputStream.truncate()
        textOutputStream.setOutputStream(outputStream)

        for intCounter1 = 1 to 26
                strPassword1 = Lettre(intCounter1)
                for intCounter2 = 1 to 26
                        strPassword2 = strPassword1 & Lettre(intCounter2)
                        for intCounter3 = 1 to 26
                                strPassword3 = strPassword2 & 
Lettre(intCounter3)
                                strDocLogText = now() & " " & DstFile & " : 
strPassword3 = " & strPassword3
& chr(13)
                                textOutputStream.writeString(strDocLogText)
                                for intCounter4 = 1 to 26
                                        strPassword4 = strPassword3 & 
Lettre(intCounter4)
                                        for intCounter5 = 1 to 26
                                                strPassword5 = strPassword4 & 
Lettre(intCounter5)
                                                for intCounter6 = 1 to 26
                                                        args(1).value = 
strPassword5 & Lettre(intCounter6)
                                                        
oDoc=oDeskTop.LoadComponentFromURL(DstFile, "_blank", 0, args())
                                                        If IsNull(oDoc) OR 
IsEmpty(oDoc) Then
                                                        'MsgBox "Password " & 
args(1).value & " incorrect.",16,"Password
Documents"  
                                                    else 
                                                                
strDocLogText=now() & " " & DstFile & " : strPassword6 = " &
args(1).value & chr(13)
                                                                
textOutputStream.writeString(strDocLogText)
                                                                
textOutputStream.closeOutput()
                                                                if 
HasUnoInterfaces(oDoc,"com.sun.star.uti.XCloseable") then
                                                                oDoc.close(true)
                                                            else
                                                                oDoc.dispose()
                                                            end if
                                                        exit sub
                                                        End If
                                                next
                                        next    
                                next    
                        next    
                next    
        next    
        textOutputStream.closeOutput()
End Sub


Function Lettre(iNumLettre as integer) as string
        Select Case iNumLettre
        Case 1
                Lettre="a"
        Case 2
                Lettre="b"
        Case 3
                Lettre="c"
        Case 4
                Lettre="d"
        Case 5
                Lettre="e"
        Case 6
                Lettre="f"
        Case 7
                Lettre="g"
        Case 8
                Lettre="h"
        Case 9
                Lettre="i"
        Case 10
                Lettre="j"
        Case 11
                Lettre="k"
        Case 12
                Lettre="l"
        Case 13
                Lettre="m"
        Case 14
                Lettre="n"
        Case 15
                Lettre="o"
        Case 16
                Lettre="p"
        Case 17
                Lettre="q"
        Case 18
                Lettre="r"
        Case 19
                Lettre="s"
        Case 20
                Lettre="t"
        Case 21
                Lettre="u"
        Case 22
                Lettre="v"
        Case 23
                Lettre="w"
        Case 24
                Lettre="x"
        Case 25
                Lettre="y"
        Case 26
                Lettre="z"
        End Select
end Function

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to