Jump to content

d0rkye

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • WWW
    http://www.zsenialis.com

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

d0rkye's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. This is what i'm using it works with xp and 7, 8 . Hope it will help someone. Tested with MSE, Avira, Avast. Global $state If @OSVersion = "WIN_XP" Then $oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter") $colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct") For $objAntiVirusProduct In $colItems $state = $objAntiVirusProduct.onAccessScanningEnabled Next if $state = True Then MsgBox(0,"Info","AV Enabled") Else MsgBox(0,"Info","AV Disabled") EndIf Else $oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter2") $colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct") For $objAntiVirusProduct In $colItems $state = $objAntiVirusProduct.productstate Next Dim $AvStatus = Hex($state) If StringMid($AvStatus, 5, 2) = "10" Or StringMid($AvStatus, 5, 2) = "11" Then MsgBox(0, "Info", "AV Enabled") ElseIf StringMid($AvStatus, 5, 2) = "00" Or StringMid($AvStatus, 5, 2) = "01" Then MsgBox(0, "Info", "AV Disabled") EndIf EndIf
  2. Do you mean something like this. It uses an external program http://users.ugent.be/~bpuype/wget/ because sometimes i had no luck with inetget. #include ProgressOn("Regular Download", "Downloading : Chrome") _Regulardownload("http://dl.google.com/edgedl/chrome/install/GoogleChromeStandaloneEnterprise.msi", "GoogleChromeStandaloneEnterprise.msi") ProgressOff() Func _DownloadProgress($Percentage) ProgressSet($Percentage, $Percentage & "%") Return True EndFunc Func _Regulardownload($command, $dest) $Pid = Run('"' & @ComSpec & '" /c ' & @ScriptDir & "\wget.exe " & "-O " & @ScriptDir & "\install\" & $dest & " " & $command, '', @SW_HIDE, 2 + 4) MsgBox(1,"teszt", @ScriptDir & "\wget.exe ") While 1 $text = StderrRead($Pid, False, False) If @error Then ExitLoop Sleep(10) Local $tmp = _StringBetween($text, ".....", '%') If @error <> 1 Then $percent = StringReplace($tmp[0], ".", ""); $percent = StringStripWS($percent, "7"); _DownloadProgress($percent) EndIf WEnd EndFunc
  3. I made this for my project it returns the antivirus name if it's present or "not Installed" if its not. Func _AV() Local $avname If @OSVersion = "WIN_XP" Then $oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter") Else $oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter2") EndIf $colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct") For $objAntiVirusProduct In $colItems $avname = $objAntiVirusProduct.displayName Next If $avname = False Then Return "Not Installed" Else Return $avname EndIf EndFunc Hope it will help if you didn't find the solution already.
  4. So the script is ready at-least i tested it on my pc and it worked. Please if you see anything that cold be made better tel me. I put in some error management #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #requireadmin If @OSVersion <> "WIN_7" Then Msgbox(0, "Os Missmach", "Tis program is for windows 7") Exit EndIf $Form1_1 = GUICreate("Token Tool", 272, 236, 343, 259) $backup = GUICtrlCreateButton("Backup", 8, 200, 75, 25) $Button1 = GUICtrlCreateButton("Restore", 184, 200, 75, 25) $browse = GUICtrlCreateButton("Browse", 168, 8, 83, 17) $input = GUICtrlCreateInput(@ScriptDir & "\", 8, 8, 153, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Label1 = GUICtrlCreateLabel("Are the tokens present: ", 8, 32, 117, 17) $present1 = GUICtrlCreateLabel("", 180, 56, 84, 20) $present2 = GUICtrlCreateLabel("", 180, 86, 84, 20) $Label2 = GUICtrlCreateLabel("pkeyconfig.xrm-ms -->", 8, 56, 106, 17) $Label3 = GUICtrlCreateLabel("tokens.dat -->", 8, 88, 69, 17) $Check = GUICtrlCreateButton("Check", 128, 32, 91, 17) $Group1 = GUICtrlCreateGroup("Status", 8, 152, 257, 41) $status = GUICtrlCreateLabel("Idle", 24, 168, 229, 17, $SS_CENTER) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label4 = GUICtrlCreateLabel("Win Key:", 8, 122, 47, 17) $key = GUICtrlCreateInput("XXXXX-XXXXX-XXXXX-XXXXX-XXXXX", 56, 120, 209, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) $about = GUICtrlCreateButton("About", 96, 200, 75, 25) GUISetState(@SW_SHOW) local $Destination local $changeling While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $browse _BackupDestination() Case $backup _BackupToken() Case $Button1 _Key() _restore() Case $Check _CheckToken() Case $about ShellExecute("http://www.zsenialis.com") EndSwitch WEnd func _Key() If GUICtrlRead($key) = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Then $msg = MsgBox(0, "Error", "Enter a valid product key") if $msg = 1 Then EndIf EndIf EndFunc ;==>_Key Func _restore() if GUICtrlRead($key) <> "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" and FileExists(GUICtrlRead($input) & "\pkeyconfig.xrm-ms") = 1 and FileExists(GUICtrlRead($input) & "\tokens.dat") = 1 Then $changeling = 'net stop sppsvc /y' GuiCtrlSetData($status, "Stoping sppsvc") _RestoreToken() $changeling = 'takeown /f "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms' _RestoreToken() $changeling = 'cacls "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" /e /g everyone:f' _RestoreToken() $changeling = 'cacls "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" /e /g everyone:f' _RestoreToken() $changeling = 'ren "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" "tokens.bak"' _RestoreToken() $changeling = 'ren "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" "pkeyconfig.bak"' _RestoreToken() $changeling = 'copy ' & $Destination & 'tokens.dat "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\" ' _RestoreToken() $changeling = 'copy ' & $Destination & 'pkeyconfig.xrm-ms "%WinDir%\System32\spp\tokens\pkeyconfig\" ' _RestoreToken() $changeling = 'del "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens .bak"' _RestoreToken() $changeling = 'del "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.bak"' GuiCtrlSetData($status, "Starting sppsvc") _RestoreToken() $changeling = 'net start sppsvc' GuiCtrlSetData($status, "Installing new key") _RestoreToken() $changeling = 'cscript %windir%\system32\slmgr.vbs -ipk ' & $key & '' GuiCtrlSetData($status, "Activating") _RestoreToken() $changeling = 'cscript %windir%\system32\slmgr.vbs -ato' GuiCtrlSetData($status, "Idle") _Complete() EndIf if not FileExists(GUICtrlRead($input) & "\pkeyconfig.xrm-ms") Then MsgBox(0, "Error", "Token file missing : pkeyconfig.xrm-ms ") EndIf If Not FileExists(GUICtrlRead($input) & "\tokens.dat") Then MsgBox(0, "Error", "Token file missing : Token.dat") EndIf EndFunc ;==>_restore Func _BackupDestination() $Destination = FileSelectFolder("Select backup destination", "", 7) GUICtrlSetData($input, $Destination) EndFunc ;==>_BackupDestination Func _BackupToken() FileCopy(@SystemDir & "\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms", $Destination & "\pkeyconfig.xrm-ms") FileCopy(@WindowsDir & "\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat", $Destination & "\tokens.dat") EndFunc ;==>_BackupToken Func _RestoreToken() RunWait(@ComSpec & " /c " & $changeling, @SystemDir, @SW_HIDE) EndFunc ;==>_RestoreToken Func _CheckToken() If FileExists(@SystemDir & "\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms") Then GUICtrlSetData($present1, "YES") Else GUICtrlSetData($present1, "NO") EndIf If FileExists(@WindowsDir & "\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat") Then GUICtrlSetData($present2, "YES") Else GUICtrlSetData($present2, "NO") EndIf EndFunc ;==>_CheckToken Func _Complete() MsgBox(0, "Complete", "Restore complete. Save your data WINDOWS WILL NOW RESTART") Shutdown(2) EndFunc ;==>_Complete
  5. I just started laying around with autoit and this is the first program i'm trying to make. I know the code is a bit messy but i'm still posting it so that i can get some feedback from you guys. The goal of tis program is tho backup your windows 7 activation data so that you can activate it after reinstalling your system, even if you are offline. YOU WILL NEED A LEGITIMATE WINDOWS 7 COPY I wouldn't recommend using it just yet because it needs some error handling and stuff. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1_1 = GUICreate("Token Tool", 272, 236, 343, 259) $backup = GUICtrlCreateButton("Backup", 8, 200, 75, 25) $Button1 = GUICtrlCreateButton("Restore", 184, 200, 75, 25) $browse = GUICtrlCreateButton("Browse", 168, 8, 83, 17) $input = GUICtrlCreateInput(@ScriptDir & "/", 8, 8, 153, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Label1 = GUICtrlCreateLabel("Are the tokens present: ", 8, 32, 117, 17) $present1 = GUICtrlCreateLabel("", 180, 56, 84, 20) $present2 = GUICtrlCreateLabel("", 180, 86, 84, 20) $Label2 = GUICtrlCreateLabel("pkeyconfig.xrm-ms -->", 8, 56, 106, 17) $Label3 = GUICtrlCreateLabel("tokens.dat -->", 8, 88, 69, 17) $Check = GUICtrlCreateButton("Check", 128, 32, 91, 17) $Group1 = GUICtrlCreateGroup("Status", 8, 152, 257, 41) $status = GUICtrlCreateLabel("Idle", 24, 168, 229, 17, $SS_CENTER) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label4 = GUICtrlCreateLabel("Win Key:", 8, 122, 47, 17) $key = GUICtrlCreateInput("XXXXX-XXXXX-XXXXX-XXXXX-XXXXX", 56, 120, 209, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $about = GUICtrlCreateButton("About", 96, 200, 75, 25) GUISetState(@SW_SHOW) #requireadmin local $Destination While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $browse _BackupDestination() Case $backup _BackupToken() Case $Button1 _chekkey() $changeling = 'net stop sppsvc /y' GuiCtrlSetData($status, "Stoping sppsvc") _RestoreToken() $changeling = 'takeown /f "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms' _RestoreToken() $changeling = 'cacls "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" /e /g everyone:f' _RestoreToken() $changeling = 'cacls "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" /e /g everyone:f' _RestoreToken() $changeling = 'ren "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" "tokens.bak"' _RestoreToken() $changeling = 'ren "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" "pkeyconfig.bak"' _RestoreToken() $changeling = 'copy ' & $Destination & 'tokens.dat "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\" & pause' _RestoreToken() $changeling = 'copy ' & $Destination & 'pkeyconfig.xrm-ms "%WinDir%\System32\spp\tokens\pkeyconfig\" & pause' _RestoreToken() $changeling = 'del "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens .bak"' _RestoreToken() $changeling = 'del "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.bak"' _RestoreToken() $changeling = 'net start sppsvc' GuiCtrlSetData($status, "Stopping sppsvc") _RestoreToken() $changeling = 'cscript %windir%\system32\slmgr.vbs -ipk ' & $key & '' GuiCtrlSetData($status, "Installing new key") _RestoreToken() $changeling = 'cscript %windir%\system32\slmgr.vbs -ato' GuiCtrlSetData($status, "Activating") _RestoreToken() _Complete() Case $Check _CheckToken() Case $about ShellExecute("http://www.zsenialis.com") EndSwitch WEnd Func _chekkey() if GUICtrlRead($key) = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Then MsgBox(0, "Error", "Please enter a valid key. Stopping Program :)") Exit EndIf EndFunc ;==>_chekkey Func _BackupDestination() $Destination = FileSelectFolder("Select backup destination", "", 7) GUICtrlSetData($input, $Destination) EndFunc ;==>_BackupDestination Func _BackupToken() FileCopy(@SystemDir & "\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms", $Destination & "\pkeyconfig.xrm-ms") FileCopy(@WindowsDir & "\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat", $Destination & "\tokens.dat") EndFunc ;==>_BackupToken Func _RestoreToken() RunWait(@ComSpec & " /c " & $changeling, @SystemDir, @SW_HIDE) EndFunc ;==>_RestoreToken Func _CheckToken() If FileExists(@SystemDir & "\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms") Then GUICtrlSetData($present1, "YES") Else GUICtrlSetData($present1, "NO") EndIf If FileExists(@WindowsDir & "\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat") Then GUICtrlSetData($present2, "YES") Else GUICtrlSetData($present2, "NO") EndIf EndFunc ;==>_CheckToken Func _Complete() MsgBox(0, "Complete", "Restore complete. Save your data WINDOWS WILL NOW RESTART") Shutdown(2) EndFunc ;==>_Complete Any suggestions are welcome .
×
×
  • Create New...