Date: prev next · Thread: first prev next last
2021 Archives by date, by thread · List index


Am 04.12.2021 um 13:05:56 schrieb GMX-Foren Achim:

Habe ich eine Chance die Formeln aus meinen geschützen Tabellen irgendwie
wieder auszulesen, die ich damals (vor gefühlt 100 Jahren) mit einem Passwort
geschützt habe?

Du kannst eine BruteForceAttacke fahren.

Ich habe irgendwo mal ein Makro geklaut, welches mit Passwort geschützte
Dokumente immer wieder mit einem Passwort aus einem selbst generierten
Pool zu öffnen. Du müsstest nur anstatt ein Dokument zu öffnen die
entsprechende Funktion aufrufen, die den Schutz der Tabelle aufhebt.

Das geht nicht unbedingt schnell und effizient - ist halt ein Makro -
aber wenn das Passwort nicht lang ist und die verwendeten Zeichen
halbwegs bekannt, kann das funktionieren.

Na Warte mal...

Ich hängs unten mal ran. Kann sein, dass ein paar Zeilenumbrüche
reinkommen, die da nicht hingehören.

Viel Erfolg!
    Norbert

---------------------------------------------------------------------
'Andrew Pitonyak
'My Document: http://www.pitonyak.org/AndrewMacro.odt
'Free Info: http://www.pitonyak.org/oo.php
'
'Here is my final "brute force" code
'
'The revised code is much faster than the old while generating the
passwords.
'I can now generate around 8300 passwords a second on a 3.19Ghz Pentium.
'Just comment out "LoadComponentFromURL" to see this speed.
'The real speed killer, however, is attempting to load the document from
the URL.
'I can only check approximately 16.8 passwords a second. If I really
need to crack
'a document, I would need to use a different method for evaluating the
password for
'a match.

Sub Main
  Dim sChars(0 To 3) As String
  Dim i%
  Dim sURL$
  Dim Zeichenvorrat(0 To 3) As String

  For i=0 To UBound(sChars())
    If (i < 26) Then
      sChars(i) = CHR$(97 + i)
    ElseIf (i < 52) Then
      sChars(i) = CHR$(65 + i - 26)
    End If
    'sChars(i+26) = CHR$(97 + i)
  Next
  sURL = "file:///c:/temp/Kassenbuch (2).ods"
  Zeichenvorrat(0) = "lLoOeEwW2830()tTaAiImMbBcChH"
'  Print sChars(0)
  Print Zeichenvorrat(0)
'  Print CrackIt(sChars(), 1, 5, sURL)
  Print CrackIt(Zeichenvorrat(), 10, 10, sURL)
End Sub

Function CrackIt(chars() As String, nMinChars%, nMaxChars%, sURL$) As
Variant
  Dim s$        ' Holds the password string.
  Dim sLB$      ' The first character.
  Dim i%        ' General index variable.
  Dim nTemp%    ' Temporary integer used to increment the password.
  Dim nLB%      ' Lower bound of the character array.
  Dim nUB%      ' Upper bound of the character array.
  Dim n As Long ' Total number of passwords checked.
  Dim tStart    ' Starting ticks.
  Dim tEnd      ' Total elapsed ticks
  Dim oDoc As Object ' If I leave this as an Object then it defaults to
NULL
  Dim oArgs(1) As New com.sun.star.beans.PropertyValue
  Dim nCharIdx(1 To nMaxChars) As Integer

  REM Set the actual password just before testing
  oArgs(0).Name = "Password"
  oArgs(1).Name = "Hidden"
  oArgs(1).Value = True

  REM Some initial values
  nLB = LBound(chars())
  nUB = UBound(chars())
  sLB = chars(nLB)

  REM Set the initial password in s.
  REM nCharIdx holds the index into chars() for the corresponding
character.
  s = ""
  For i=1 To nMinChars
    nCharIdx(i) = nLB
    s = s & sLB
  Next

  REM Initialize to one before the first character.
  REM When the previous charcter rolls into this character,
  REM the value will be incremented to nLB, which is the first
  REM character.
  For i=nMinChars + 1 To nMaxChars
    nCharIdx(i) = nLB - 1
  Next

  REM Get ready to start!
  n = 0
  tStart = GetSystemTicks()
  Do While True
    n = n + 1
    'Print s
    'if ((n MOD 50) = 0) Then Print "n = " & n & " s = " & s
    oArgs(0).Value = s
    REM If I use "_blank", then a new frame opens even if the load fails.
    oDoc = StarDesktop.loadComponentFromURL(sURL, "_default", 0, oArgs())
    If IsNull(oDoc) Then
      REM The last password was NOT valid
      REM try a new one!
      For i = 1 To nMaxChars
        nTemp = nCharIdx(i) + 1
        If nTemp <= nUB Then
          nCharIdx(i) = nTemp
          Mid(s, i, 1, chars(nTemp))
          Exit For
        Else
          nCharIdx(i) = nLB
          Mid(s, i, 1, sLB)
          If i = nMaxChars Then Exit Do
        End If
      Next
    Else
      oDoc.close(True)
      CrackIt = s
      tEnd = GetSystemTicks() - tStart
      MsgBox "Total ticks = " & tEnd & CHR$(10) & _
             "Iterations = " & n & CHR$(10) & _
             "Iterations / tick = " &  (n / tEnd) & CHR$(10) & _
             "ticks / Iteration = " &  (tEnd / n) & CHR$(10) & _
             "Iterations / second = " &  (n / tEnd * 1000)
      Exit Function
    End If
  Loop
  tEnd = GetSystemTicks() - tStart
  MsgBox "Total ticks = " & tEnd & CHR$(10) & _
         "Iterations = " & n & CHR$(10) & _
         "Iterations / tick = " &  (n / tEnd) & CHR$(10) & _
         "ticks / Iteration = " &  (tEnd / n) & CHR$(10) & _
         "Iterations / second = " &  (n / tEnd * 1000)

  CrackIt = "Not Found:" & s
End Function
---------------------------------------------------------------------

--
Liste abmelden mit E-Mail an: users+unsubscribe@de.libreoffice.org
Probleme? https://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/
Tipps zu Listenmails: https://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: https://listarchives.libreoffice.org/de/users/
Datenschutzerklärung: https://www.documentfoundation.org/privacy

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.