Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: wokamon en 30 Septiembre 2019, 14:55 pm



Título: Script para sacar la licencia de windows
Publicado por: wokamon en 30 Septiembre 2019, 14:55 pm
Muy buenas,

He encontrado un script que te da la licencia de windows ejecutándolo, pero me gustaría que el documento que se genera al final, se pudiera enviar directamente a un correo, como lo podria haceR?

Código
  1. Option Explicit
  2.  
  3. Dim objshell,path,DigitalID, Result, strComputerName, strUserName
  4. Set objshell = CreateObject("WScript.Shell")
  5. strComputerName = objshell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
  6. strUserName = objshell.ExpandEnvironmentStrings( "%USERNAME%" )
  7. 'WScript.Echo "Computer Name: " & strComputerName
  8. 'Set registry key path
  9. Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
  10. 'Registry key value
  11. DigitalID = objshell.RegRead(Path & "DigitalProductId")
  12. Dim ProductName,ProductID,ProductKey,ProductData, ComputerName, USERNAME
  13. 'Get ProductName, ProductID, ProductKey
  14. USERNAME= "User Name: " & strUserName
  15. ComputerName= "Computer Name: " & strComputerName
  16. ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName")
  17. ProductID = "Product ID: " & objshell.RegRead(Path & "ProductID")
  18. ProductKey = "Installed Key: " & ConvertToKey(DigitalID)
  19. ProductData = ProductName  & vbNewLine & ProductID  & vbNewLine & ProductKey & vblf &  ComputerName & vblf & username
  20. 'Show messbox if save to a file
  21. If vbYes = MsgBox(ProductData & vblf & vblf & vblf &"Save to a file?", vbYesNo + vbQuestion, "BackUp Windows Key Information") then
  22.   Save ProductData
  23. End If
  24.  
  25.  
  26.  
  27. 'Convert binary to chars
  28. Function ConvertToKey(Key)
  29.    Const KeyOffset = 52
  30.    Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert
  31.    'Check if OS is Windows 8
  32.    isWin8 = (Key(66) \ 6) And 1
  33.    Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4)
  34.    i = 24
  35.    Maps = "BCDFGHJKMPQRTVWXY2346789"
  36.    Do
  37.       Current= 0
  38.        j = 14
  39.        Do
  40.           Current = Current* 256
  41.           Current = Key(j + KeyOffset) + Current
  42.           Key(j + KeyOffset) = (Current \ 24)
  43.           Current=Current Mod 24
  44.            j = j -1
  45.        Loop While j >= 0
  46.        i = i -1
  47.        KeyOutput = Mid(Maps,Current+ 1, 1) & KeyOutput
  48.        Last = Current
  49.    Loop While i >= 0
  50.    keypart1 = Mid(KeyOutput, 2, Last)
  51.    insert = "N"
  52.    KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
  53.    If Last = 0 Then KeyOutput = insert & KeyOutput
  54.    ConvertToKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5) & "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & Mid(KeyOutput, 21, 5)
  55.  
  56.  
  57. End Function
  58. 'Save data to a file
  59. Function Save(Data)
  60.    Dim fso, fName, txt,objshell,UserName
  61.    Set objshell = CreateObject("wscript.shell")
  62. 'Get current user name
  63.    UserName = objshell.ExpandEnvironmentStrings("%UserName%")
  64.    'Create a text file on desktop
  65.    fName = "C:\Users\" & UserName & "\Desktop\WindowsKeyInfo.txt"
  66.    Set fso = CreateObject("Scripting.FileSystemObject")
  67.    Set txt = fso.CreateTextFile(fName)
  68.    txt.Writeline Data
  69.    txt.Close
  70. End Function
  71.  
  72.  

Muchas GRacias


Título: Re: Script para sacar la licencia de windows
Publicado por: Monkeykiller_vb en 10 Octubre 2019, 03:43 am
Prueba subiendo el resultado por la URL de una página PHP, que envíe la info a un correo