Hallo,
ich arbeite an einem neuen scriptchen, dass den windows key auslesen soll.
alle vorarbeiten habe ich abgeschlossen, jedoch habe ich noch das ein oder andere prob.
Prob 1:
ich habe über das ganze GUI ein bild gelegt. darüber die inputboxen und buttons, die auch alle sichtbar sind, jedoch funktionieren die buttons nicht (da das bild anscheinend darüber liegt). wie kann ich es machen, dass ich die buttons doch nutzen kann?
Prob 2:
da ich prob 1 nicht lösen konnte, habe ich das script ein wenig modifiziert, dass ich 3 verschiedene versionen aufrufen kann (flag 0, 1 und 2).
möglichkeit 0 soll die finale version sein, wo die buttons aber zZ nicht funktionieren, die tastenkombo geht jedoch)
möglichkeit 1 wird ohne bild gestartet, buttons und tastenkombo funktionieren.
möglichkeit 2 zeit das bild an, versteckt aber die buttons und zeigt dafür ein menü an. tastenkombo geht, aber das menü leider nicht. ich kann auch zZ keinen fehler mehr finden ... kann mal wer drüber gucken?
Prob 3:
der key liegt natürlich verschlüssel in der reg vor ... ich habe ein programm ausfindig machen können, was wie mein tool, den key ausliest, entschlüsselt und anzeigt. jedoch ist es in c/c++ oder c# geschrieben ... leider fühle ich mich nicht in der lage, den code auf autoit umzuschreiben, da ich in den sprachen leider null peil habe. wüsste jmd wie man das an autoit, in mein script, anpassen kann?
Spoiler anzeigen
using System;
using System.Collections;
using Microsoft.Win32;
namespace WindowsApplication1
{
class MSKeyDecrypt
{
// Enumeration for comfortable use the function GetKey
public enum Product
{
XP,
Office10,
Office11
};
// dirty registry trails/keys ...
private static string XP = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
private static string Office10 = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
private static string Office11 = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
private static string RegKey = "DigitalProductId";
public static string GetKey(Product product)
{
byte[] byteProductId = null;
switch (product) {
case Product.XP:
byteProductId = MyReg.readRegistry2(XP, RegKey);
break;
case Product.Office10:
byteProductId = MyReg.readRegistry2(Office10, RegKey);
break;
case Product.Office11:
byteProductId = MyReg.readRegistry2(Office11, RegKey);
break;
}
return DecodeProductKey(byteProductId);
}
private static string DecodeProductKey(byte[] digitalProductId)
{
// Offset of first byte of encoded product key in
// 'DigitalProductIdxxx" REG_BINARY value. Offset = 34H.
const int keyStartIndex = 52;
// Offset of last byte of encoded product key in
// 'DigitalProductIdxxx" REG_BINARY value. Offset = 43H.
const int keyEndIndex = keyStartIndex + 15;
// alpha numeric characters that happen into product key
char[] digits = new char[]
{
'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'M', 'P', 'Q', 'R',
'T', 'V', 'W', 'X', 'Y', '2', '3', '4', '6', '7', '8', '9',
};
// Length of decoded product key
const int decodeLength = 29;
// Length of decoded product key in byte-form.
// Each byte represents 2 chars.
const int decodeStringLength = 15;
// Array of containing the decoded product key.
char[] decodedChars = new char[decodeLength];
// Extract byte 52 to 67 inclusive.
ArrayList hexPid = new ArrayList();
for (int i = keyStartIndex; i <= keyEndIndex; i++)
{
hexPid.Add(digitalProductId[i]);
}
for (int i = decodeLength - 1; i >= 0; i--)
{
// Every sixth char is a separator.
if ((i + 1) % 6 == 0)
{
decodedChars[i] = '-';
}
else
{
// Do the actual decoding.
int digitMapIndex = 0;
for (int j = decodeStringLength - 1; j >= 0; j--)
{
int byteValue = (digitMapIndex << 8) | (byte)hexPid[j];
hexPid[j] = (byte)(byteValue / 24);
digitMapIndex = byteValue % 24;
decodedChars[i] = digits[digitMapIndex];
}
}
}
return new string(decodedChars);
}
}
}
Alles anzeigen
und hier ist das script
Spoiler anzeigen
;
; WinGetKey
;
; © sc4ry
#include <guiconstants.au3>
#include <string.au3>
Opt("TrayMenuMode",1)
TraySetToolTip("sc4ry´s " & @ScriptName & @CRLF & @UserName & " \\ " & @ComputerName & @CRLF & @OSVersion & " " & @OSServicePack & " \\ " & @OSBuild & @CRLF & @IPAddress1)
$flag = 2
Global $menu, $copyid, $copykey
$ID = RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion", "ProductId")
$Key = RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion", "DigitalProductId")
If $flag = 0 Then GUICreate("WinGetKey", 300, 120, -1, -1, $WS_POPUP + $WS_DLGFRAME, $WS_EX_TOPMOST) ;normal(bild + buttons, kein menu)
If $flag = 1 Then GUICreate("WinGetKey", 300, 120, -1, -1, $WS_POPUP + $WS_DLGFRAME, $WS_EX_TOPMOST) ;picless(ohne bild + menu, mit buttons)
If $flag = 2 Then GUICreate("WinGetKey", 260, 140, -1, -1, $WS_POPUP + $WS_DLGFRAME, $WS_EX_TOPMOST) ;buttonless (mit bild + menu, ohne buttons)
If $flag <> 1 Then GUICtrlCreatePic("C:\Dokumente und Einstellungen\Administrator\Lokale Einstellungen\Anwendungsdaten\Microsoft\Wallpaper1.bmp", 0, 0, 370, 190)
If $flag = 2 Then $menu = GUICtrlCreateMenu("copy...")
If $flag = 2 Then $copyid = GUICtrlCreateMenuItem("ID (ALT+I)", $menu)
If $flag = 2 Then $copykey = GUICtrlCreateMenuItem("Key (ALT+K)", $menu)
$copyid = GUICtrlCreateButton("copy &ID", 245, 30, 50, 20)
If $flag = 2 Then GUICtrlSetState($copyid, $gui_hide)
$copykey = GUICtrlCreateButton("copy &Key", 245, 80, 50, 20)
If $flag = 2 Then GUICtrlSetState($copykey, $gui_hide)
GUICtrlCreateLabel("Product ID", 10, 10, 53, 15)
GUICtrlCreateLabel("Product Key", 10, 60, 60, 15)
$IID = GUICtrlCreateInput("", 10, 30, 230, 20, $ES_READONLY)
GUICtrlSetData($IID, $ID)
$IKey = GUICtrlCreateInput("", 10, 80, 230, 20, $ES_READONLY)
GUICtrlSetData($IKey, $Key)
GUISetState(@sw_show)
While 1
$msg = GUIGetMsg()
Select
case $msg = $gui_event_close
Exit
case $msg = $copyid
ClipPut("")
ClipPut(guictrlread($IID))
case $msg = $copykey
ClipPut("")
ClipPut(guictrlread($IKey))
EndSelect
WEnd