Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: Skim0 en 31 Mayo 2017, 22:34 pm



Título: Modificar .vbs
Publicado por: Skim0 en 31 Mayo 2017, 22:34 pm
Hola buenas,

Necesitaba hacer que este .vbs me creara el txt si preguntar, no tengo ni idea de .vbs. Intente modificar un par de cosas pero me da errores. El .vbs sirve para obtener el cd-key de windows.  Espero que me podais ayudar. Muchas gracias.


Código
  1. Set WshShell = CreateObject("WScript.Shell")
  2. Key = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
  3. DigitalID = WshShell.RegRead(key & "DigitalProductId")
  4.  
  5. ProductName = "Product Name: " & WshShell.RegRead(Key & "ProductName") & vbNewLine
  6. ProductID = "Product ID: " & WshShell.RegRead(Key & "ProductID") & vbNewLine
  7. ProductKey = "Installed Key: " & ConvertToKey(DigitalID)
  8. ProductID = ProductName & ProductID & ProductKey
  9.  
  10. If vbYes = MsgBox(ProductId & vblf & vblf & "Save to a file?", vbYesNo + vbQuestion, "Windows Key Information") then
  11.   Save ProductID
  12. End if
  13.  
  14. Function ConvertToKey(Key)
  15.    Const KeyOffset = 52
  16.    isWin8 = (Key(66) \ 6) And 1
  17.    Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4)
  18.    i = 24
  19.    Chars = "BCDFGHJKMPQRTVWXY2346789"
  20.    Do
  21.        Cur = 0
  22.        X = 14
  23.        Do
  24.            Cur = Cur * 256
  25.            Cur = Key(X + KeyOffset) + Cur
  26.            Key(X + KeyOffset) = (Cur \ 24)
  27.            Cur = Cur Mod 24
  28.            X = X -1
  29.        Loop While X >= 0
  30.        i = i -1
  31.        KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
  32.        Last = Cur
  33.    Loop While i >= 0
  34.    If (isWin8 = 1) Then
  35.        keypart1 = Mid(KeyOutput, 2, Last)
  36.        insert = "N"
  37.        KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
  38.        If Last = 0 Then KeyOutput = insert & KeyOutput
  39.    End If
  40.    a = Mid(KeyOutput, 1, 5)
  41.    b = Mid(KeyOutput, 6, 5)
  42.    c = Mid(KeyOutput, 11, 5)
  43.    d = Mid(KeyOutput, 16, 5)
  44.    e = Mid(KeyOutput, 21, 5)
  45.    ConvertToKey = a & "-" & b & "-" & c & "-" & d & "-" & e
  46. End Function
  47.  
  48. Function Save(Data)
  49.    Const ForWRITING = 2
  50.    Const asASCII = 0
  51.    Dim fso, f, fName, ts
  52.    fName = "Windows Key.txt"
  53.    Set fso = CreateObject("Scripting.FileSystemObject")
  54.    fso.CreateTextFile fName
  55.    Set f = fso.GetFile(fName)
  56.    Set f = f.OpenAsTextStream(ForWRITING, asASCII)
  57.    f.Writeline Data
  58.    f.Close
  59. End Function


Título: Re: Modificar .vbs
Publicado por: FurioMoltisanti en 31 Mayo 2017, 22:58 pm
Que es lo que has intentado? Pon lo que has modificado aunque contenga errores.


Título: Re: Modificar .vbs
Publicado por: tincopasan en 1 Junio 2017, 02:19 am
en teoría deberías editar:
Código
  1. If vbYes = MsgBox(ProductId & vblf & vblf & "Save to a file?", vbYesNo + vbQuestion, "Windows Key Information") then
  2.   Save ProductID
  3. End if
  4.  

por:
Código
  1. Save ProductID
  2.  


Título: Re: Modificar .vbs
Publicado por: Skim0 en 1 Junio 2017, 20:37 pm
Muchas gracias tincopasan, me ha funcionando perfectamente asi.  Gracias de nuevo.