如何破解Excel VBA密码

如何破解Excel VBA密码,第1张

1,打开需要破解的文件,并点开需要输入密码的界面。

2,使用EXCELEXE重新打开一个工作簿。打开新工作簿的VBA代码区域,并插入一个模块。

3,插入如下代码

Sub test()

Dim st, nd, th3, th4, th5, th6, th7, th8 As Variant

Dim ii, jj, kk, ll, mm, nn, oo, pp, qq As Integer

Dim PADN, PD, IJ, JK, PADNO, speed

speed = 0005

st = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

nd = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

th3 = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

th4 = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

th5 = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

th6 = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

th7 = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

th8 = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

PADN = InputBox("How long the password is", "Guilin Hu", 4)

PADNO = CInt(PADN)

For IJ = 1 To 100

If Sheet1Cells(IJ, 1) = "" Then

Sheet1Cells(IJ, 1) = Now

Exit For

Else

End If

Next IJ

  PauseTime = 2

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

Select Case (PADNO)

Case 1

  For ii = 0 To 61

PD = st(ii)

SendKeys PD

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

Next ii

Case 2

  For ii = 0 To 61

For jj = 0 To 61

PD = st(ii) & nd(jj)

SendKeys PD

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

Next jj

Next ii

Case 3

  For ii = 0 To 61

For jj = 0 To 61

For kk = 0 To 61

PD = st(ii) & nd(jj) & th3(kk)

SendKeys PD

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

Next kk

Next jj

Next ii

Case 4

  For ii = 0 To 61

For jj = 0 To 61

For kk = 0 To 61

For ll = 0 To 61

PD = st(ii) & nd(jj) & th3(kk) & th4(ll)

SendKeys PD

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

Next ll

Next kk

Next jj

Next ii

Case 5

  For ii = 0 To 61

For jj = 0 To 61

For kk = 0 To 61

For ll = 0 To 61

For mm = 0 To 61

PD = st(ii) & nd(jj) & th3(kk) & th4(ll) & th5(mm)

SendKeys PD

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

Next mm

Next ll

Next kk

Next jj

Next ii

Case 6

  For ii = 0 To 61

For jj = 0 To 61

For kk = 0 To 61

For ll = 0 To 61

For mm = 0 To 61

For nn = 0 To 61

PD = st(ii) & nd(jj) & th3(kk) & th4(ll) & th5(mm) & th6(nn)

SendKeys PD

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

Next nn

Next mm

Next ll

Next kk

Next jj

Next ii

Case 7

  For ii = 0 To 61

For jj = 0 To 61

For kk = 0 To 61

For ll = 0 To 61

For mm = 0 To 61

For nn = 0 To 61

For oo = 0 To 61

PD = st(ii) & nd(jj) & th3(kk) & th4(ll) & th5(mm) & th6(nn) & th7(oo)

SendKeys PD

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

Next oo

Next nn

Next mm

Next ll

Next kk

Next jj

Next ii

Case 8

  For ii = 0 To 61

For jj = 0 To 61

For kk = 0 To 61

For ll = 0 To 61

For mm = 0 To 61

For nn = 0 To 61

For oo = 0 To 61

For pp = 0 To 61

PD = st(ii) & nd(jj) & th3(kk) & th4(ll) & th5(mm) & th6(nn) & th7(oo) & th8(pp)

SendKeys PD

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

  PauseTime = speed

  Start = Timer

  Do While Timer < Start + PauseTime

      DoEvents

  Loop

  Finish = Timer

SendKeys "{enter}"

Next pp

Next oo

Next nn

Next mm

Next ll

Next kk

Next jj

Next ii

End Select

For JK = 1 To 100

If Sheet1Cells(JK, 2) = "" Then

Sheet1Cells(JK, 2) = Now

Exit For

Else

End If

Next JK

End Sub

4,按F5执行代码,输入密码长度。如果不知道密码的长度,就猜,第一次输1,第二次输2。。。依次试。

5,输入密码长度后,点击确定。并在2s内将鼠标的焦点点在最开始要破解文件的密码输入框里边。

'如果是将text1中每个字符的asc码值转化为16进制实现加密解密可以这样:复制粘贴下段代码

'加密数据

Private Sub Command1_Click()

Text2Tag = "" '清空text2tag用来存储加密后数据

Text2Text = "" '清空text2用来显示加密后数据

For i = 1 To Len(Text1Text) '将text1中每个字符的asc码值转化为十六进制以软回车chr(13)分隔并存储在text2tag中

Text2Tag = Text2Tag & Hex(Asc(Mid(Text1Text, i, 1))) & Chr(13) '

Next

Text2Text = Text2Tag '显示加密后数据

End Sub

'解密数据

Private Sub Command2_Click()

Text1Tag = ""

Text1Text = ""

Dim b() As String '定义数组用来存储由text1中每个字符转化来的十六进制数

b = Split(Text2Text, Chr(13)) '以软回车符chr(13)分隔text2中文本并存储在数组b中

For i = 0 To UBound(b) '将text2中每个十六进制数转化为十进制的asc码值后转化为字符

Text1Tag = Text1Tag & Chr(Val("&h" & b(i)))

Next

Text1Text = Text1Tag '显示原始数据

End Sub

题主的问题跟昵称真对应“计算机新手”,呵呵。

题主只需要略懂些反汇编(别想着什么反编译了,一旦高级语言源代码编译成机器语言后是不可能再反编译回高级语言,网上所谓的“反编译”就是反汇编。另注:Java 能较完美的反编译是因为它是在虚拟机上的)的基本原理,就知道这是不可能实现的了。

注意,这是计算机编译原理(题主大学不是学计算机专业的吧?这门课程可是计算机的专业课哟~)所决定的,不是软件层面上能做到的事情。

用某些工具可以查看出未加壳的程序的界面图像或者封装了哪些API、调用了哪些DLL,因为这些信息往往封装在头文件中,但是得到源代码?还“只要能得到源代码就可以了”?我只能说呵呵。

以上就是关于如何破解Excel VBA密码全部的内容,包括:如何破解Excel VBA密码、VB 实现字符串加密 解密、怎么才能破解vb的程序 只要能得到破解这个程序的源代码就可以了。等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/10178039.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-06
下一篇 2023-05-06

发表评论

登录后才能评论

评论列表(0条)

保存