Skip to content

Commit 8d85c47

Browse files
committed
Init commit
1 parent 74b42b5 commit 8d85c47

File tree

8 files changed

+284
-0
lines changed

8 files changed

+284
-0
lines changed

src/IDM Trial Reset.au3

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#NoTrayIcon
2+
3+
#Region AutoIt3Wrapper directives section
4+
#AutoIt3Wrapper_Icon=IDM.ico
5+
#AutoIt3Wrapper_Compression=4
6+
#AutoIt3Wrapper_UseUpx=Y
7+
#EndRegion AutoIt3Wrapper directives section
8+
9+
#Region Includes
10+
#include <core.au3>
11+
#include <GUIConstantsEx.au3>
12+
#include <Misc.au3>
13+
#EndRegion Includes
14+
15+
_Singleton(@ScriptName)
16+
17+
#Region Options
18+
Opt('MustDeclareVars', 1)
19+
Opt('GUICloseOnESC', 0)
20+
Opt('TrayMenuMode', 1)
21+
#EndRegion Options
22+
23+
; Script Start - Add your code below here
24+
If $CmdLine[0] = 0 Then
25+
GUI()
26+
Else
27+
Switch $CmdLine[1]
28+
Case '/trial'
29+
TrialSilent()
30+
clearTemp()
31+
Case Else
32+
GUI()
33+
EndSwitch
34+
EndIf
35+
36+
Func GUI()
37+
#Region ### START Koda GUI section ###
38+
Local $GUI = GUICreate('IDM trial reset', 325, 112)
39+
Local $tabMain = GUICtrlCreateTab(1, 0, 325, 112)
40+
Local $tabTrialReset = GUICtrlCreateTabItem('Trial reset')
41+
Local $btReset = GUICtrlCreateButton('Reset the IDM trial now', 78, 40, 180, 35)
42+
GUICtrlSetCursor(-1, 0)
43+
Local $cbAutorun = GUICtrlCreateCheckbox('Automatically', 128, 80, 80, 20)
44+
Local $tabRegister = GUICtrlCreateTabItem('Register')
45+
Local $btReg = GUICtrlCreateButton('Register IDM now', 78, 40, 180, 35)
46+
GUICtrlSetCursor(-1, 0)
47+
Local $lbReg = GUICtrlCreateLabel('If IDM will be blocked then Register again or use Trial reset', 27, 80, 282, 17)
48+
Local $tabHelp = GUICtrlCreateTabItem('Help')
49+
GUICtrlSetState(-1, $GUI_SHOW)
50+
Local $lbHelp = GUICtrlCreateLabel('', 15, 35, 308, 50)
51+
GUICtrlSetData(-1, StringFormat('Trial reset ---> Reset the IDM trial, fix blocked, fake serial...\r\nRegister -----> Register IDM'))
52+
Local $btForum = GUICtrlCreateButton('Chat about this tool', 45, 73, 115, 25)
53+
GUICtrlSetCursor(-1, 0)
54+
Local $btUpdate = GUICtrlCreateButton('Check for update', 166, 73, 105, 25)
55+
GUICtrlSetCursor(-1, 0)
56+
GUICtrlCreateTabItem('')
57+
GUICtrlSetState($cbAutorun, $isAuto ? 1 : 4)
58+
GUISetState(@SW_SHOW)
59+
#EndRegion ### END Koda GUI section ###
60+
61+
While 1
62+
Local $nMsg = GUIGetMsg()
63+
Switch $nMsg
64+
Case $GUI_EVENT_CLOSE
65+
clearTemp()
66+
GUIDelete($GUI)
67+
Exit
68+
Case $btReset
69+
GUICtrlSetData($btReset, 'Please wait...')
70+
Trial()
71+
GUICtrlSetData($btReset, 'Reset the IDM trial now')
72+
MsgBox(262144, 'Reset IDM trial', 'You have 30 day trial now!')
73+
Case $cbAutorun
74+
If GUICtrlRead($cbAutorun) = 1 Then
75+
GUICtrlSetData($btReset, 'Please wait...')
76+
Trial()
77+
autorun('trial')
78+
GUICtrlSetData($btReset, 'Reset the IDM trial now')
79+
MsgBox(262144, 'Auto reset', 'The IDM trial will be reset automatically.')
80+
Else
81+
autorun('off')
82+
MsgBox(262144, 'Auto reset', 'The IDM trial will NOT be reset automatically.')
83+
EndIf
84+
Case $btReg
85+
Local $Name = InputBox('Register IDM', 'Type your name here: ', 'IDM trial reset', '', '', '130')
86+
If @error <> 1 Then
87+
If StringLen($Name) = 0 Then $Name = 'IDM trial reset'
88+
GUICtrlSetData($btReg, 'Please wait...')
89+
Register($Name)
90+
GUICtrlSetState($cbAutorun, 4)
91+
GUICtrlSetData($btReg, 'Register IDM now')
92+
MsgBox(262144, 'Register IDM', 'IDM is registered now!')
93+
EndIf
94+
Case $btForum
95+
ShellExecute($urlForum)
96+
Case $btUpdate
97+
GUICtrlSetData($btUpdate, 'Please wait...')
98+
If GotUpdate() Then
99+
Local $Download = (MsgBox(1, 'IDM trial reset', 'Update me now?') == 1)
100+
If $Download Then ShellExecute($urlDownload)
101+
Else
102+
MsgBox(262144, 'IDM trial reset', 'No update was found!')
103+
EndIf
104+
GUICtrlSetData($btUpdate, 'Check for update')
105+
EndSwitch
106+
WEnd
107+
EndFunc ;==>GUI

src/IDM.ico

14.7 KB
Binary file not shown.

src/SetACLx32.exe

443 KB
Binary file not shown.

src/SetACLx64.exe

546 KB
Binary file not shown.

src/core.au3

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#RequireAdmin
2+
3+
#include <Date.au3>
4+
#include <String.au3>
5+
6+
FileInstall('idm_reset.reg', @TempDir & '\idm_reset.reg', 1)
7+
FileInstall('idm_trial.reg', @TempDir & '\idm_trial.reg', 1)
8+
FileInstall('idm_reg.reg', @TempDir & '\idm_reg.reg', 1)
9+
FileInstall('SetACLx32.exe', @TempDir & '\SetACLx32.exe', 1)
10+
FileInstall('SetACLx64.exe', @TempDir & '\SetACLx64.exe', 1)
11+
12+
Global $setacl = (@OSArch = 'X86') ? '"' & @TempDir & "\SetACLx32.exe" & '"' : '"' & @TempDir & "\SetACLx64.exe" & '"'
13+
14+
Global Const $version = 21
15+
Global Const $urlForum = "http://bit.ly/IDMresetTrialForum"
16+
Global Const $urlDownload = "http://bit.ly/IDMresetTrial"
17+
18+
Global $isAuto = isAuto()
19+
20+
Global $allkey[6]
21+
$allkey[0] = '{6DDF00DB-1234-46EC-8356-27E7B2051192}'
22+
$allkey[1] = '{7B8E9164-324D-4A2E-A46D-0165FB2000EC}'
23+
$allkey[2] = '{D5B91409-A8CA-4973-9A0B-59F713D25671}'
24+
$allkey[3] = '{5ED60779-4DE2-4E07-B862-974CA4FF2E9C}'
25+
$allkey[4] = ''
26+
$allkey[5] = '{07999AC3-058B-40BF-984F-69EB1E554CA7}'
27+
28+
Func SetOwner($owner)
29+
; $owner : everyone or nobody
30+
Switch $owner
31+
Case 'everyone'
32+
$owner = 'S-1-1-0'
33+
Case 'nobody'
34+
$owner = 'S-1-0-0'
35+
EndSwitch
36+
37+
For $i = 0 To UBound($allkey) - 1 Step 1
38+
If $allkey[$i] <> '' Then
39+
RunWait($setacl & ' -on HKCU\Software\Classes\CLSID\' & $allkey[$i] & ' -ot reg -actn setowner -ownr "n:' & $owner & '" -silent', "", @SW_HIDE)
40+
RunWait($setacl & ' -on HKCU\Software\Classes\Wow6432Node\CLSID\' & $allkey[$i] & ' -ot reg -actn setowner -ownr "n:' & $owner & '" -silent', "", @SW_HIDE)
41+
RunWait($setacl & ' -on HKLM\Software\Classes\CLSID\' & $allkey[$i] & ' -ot reg -actn setowner -ownr "n:' & $owner & '" -silent', "", @SW_HIDE)
42+
RunWait($setacl & ' -on HKLM\Software\Classes\Wow6432Node\CLSID\' & $allkey[$i] & ' -ot reg -actn setowner -ownr "n:' & $owner & '" -silent', "", @SW_HIDE)
43+
EndIf
44+
Next
45+
EndFunc ;==>SetOwner
46+
47+
Func SetPermission($permission)
48+
; $permission : read or full
49+
For $i = 0 To UBound($allkey) - 1 Step 1
50+
If $allkey[$i] <> '' Then
51+
RunWait($setacl & ' -on HKCU\Software\Classes\CLSID\' & $allkey[$i] & ' -ot reg -actn ace -ace "n:everyone;p:' & $permission & '" -actn setprot -op "dacl:p_nc;sacl:p_nc" -silent', "", @SW_HIDE)
52+
RunWait($setacl & ' -on HKCU\Software\Classes\Wow6432Node\CLSID\' & $allkey[$i] & ' -ot reg -actn ace -ace "n:everyone;p:' & $permission & '" -actn setprot -op "dacl:p_nc;sacl:p_nc" -silent', "", @SW_HIDE)
53+
RunWait($setacl & ' -on HKLM\Software\Classes\CLSID\' & $allkey[$i] & ' -ot reg -actn ace -ace "n:everyone;p:' & $permission & '" -actn setprot -op "dacl:p_nc;sacl:p_nc" -silent', "", @SW_HIDE)
54+
RunWait($setacl & ' -on HKLM\Software\Classes\Wow6432Node\CLSID\' & $allkey[$i] & ' -ot reg -actn ace -ace "n:everyone;p:' & $permission & '" -actn setprot -op "dacl:p_nc;sacl:p_nc" -silent', "", @SW_HIDE)
55+
EndIf
56+
Next
57+
EndFunc ;==>SetPermission
58+
59+
Func Reset()
60+
$allkey[4] = RegSearch('cDTvBFquXk0')
61+
62+
SetOwner('everyone')
63+
SetPermission('full')
64+
65+
; reset everything
66+
RunWait('reg import "' & @TempDir & "\idm_reset.reg" & '"', "", @SW_HIDE)
67+
If $allkey[4] <> '' Then
68+
RegDelete("HKEY_CURRENT_USER\Software\Classes\CLSID\" & $allkey[4])
69+
RegDelete("HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\" & $allkey[4])
70+
RegDelete("HKEY_LOCAL_MACHINE\Software\Classes\CLSID\" & $allkey[4])
71+
RegDelete("HKEY_LOCAL_MACHINE\Software\Classes\Wow6432Node\CLSID\" & $allkey[4])
72+
EndIf
73+
EndFunc ;==>Reset
74+
75+
Func autorun($s)
76+
Switch $s
77+
; Disable autorun
78+
Case 'off'
79+
RunWait('reg delete "HKCU\Software\DownloadManager" /v "auto_reset_trial" /f', "", @SW_HIDE)
80+
RunWait('reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "IDM trial reset" /f', "", @SW_HIDE)
81+
; Enable autorun
82+
Case 'trial'
83+
RunWait('reg add "HKCU\Software\DownloadManager" /v "auto_reset_trial" /t "REG_SZ" /d "' & _DateAdd("D", 15, @YEAR & "/" & @MON & "/" & @MDAY) & '" /f', "", @SW_HIDE)
84+
RunWait('reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "IDM trial reset" /t "REG_SZ" /d "\"' & @ScriptFullPath & '\" /trial" /f', "", @SW_HIDE)
85+
EndSwitch
86+
EndFunc ;==>autorun
87+
88+
Func Trial()
89+
Reset()
90+
RunWait('reg import "' & @TempDir & "\idm_trial.reg" & '"', "", @SW_HIDE)
91+
SetPermission('read')
92+
SetOwner('nobody')
93+
EndFunc ;==>Trial
94+
95+
Func TrialSilent()
96+
Local $auto_reset_trial = RegRead("HKCU\Software\DownloadManager", "auto_reset_trial")
97+
Local $day_to_reset = _DateDiff("D", @YEAR & "/" & @MON & "/" & @MDAY, $auto_reset_trial)
98+
If $day_to_reset <= 0 Then
99+
Trial()
100+
autorun('trial')
101+
If GotUpdate() Then
102+
Local $Download = (MsgBox(1, "IDM trial reset", "Update me now?") == 1)
103+
If $Download Then ShellExecute($urlDownload)
104+
EndIf
105+
EndIf
106+
EndFunc ;==>TrialSilent
107+
108+
Func Register($FName = "IDM trial reset")
109+
Reset()
110+
autorun('off')
111+
RunWait('reg import "' & @TempDir & "\idm_reg.reg" & '"', "", @SW_HIDE)
112+
113+
If $allkey[4] <> '' Then
114+
RegWrite("HKEY_CURRENT_USER\Software\Classes\CLSID\" & $allkey[4])
115+
RegWrite("HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\" & $allkey[4])
116+
RegWrite("HKEY_LOCAL_MACHINE\Software\Classes\CLSID\" & $allkey[4])
117+
RegWrite("HKEY_LOCAL_MACHINE\Software\Classes\Wow6432Node\CLSID\" & $allkey[4])
118+
EndIf
119+
120+
RunWait('reg add "HKCU\Software\DownloadManager" /v "FName" /t "REG_SZ" /d "' & $FName & '" /f', "", @SW_HIDE)
121+
SetPermission('read')
122+
SetOwner('nobody')
123+
EndFunc ;==>Register
124+
125+
Func GotUpdate()
126+
Local $info = InetRead('http://pastebin.com/raw/uYr0cstV', 1)
127+
If $info <> '' Then
128+
Local $latest = _StringBetween(BinaryToString($info), "<version>", "</version>")[0]
129+
Return ($latest > $version)
130+
EndIf
131+
132+
Return 0
133+
EndFunc ;==>GotUpdate
134+
135+
Func isAuto()
136+
Local $checkTime = _DateIsValid(RegRead("HKCU\Software\DownloadManager", "auto_reset_trial"))
137+
Local $Autorun = FileExists("""" & _StringBetween("" & RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "IDM trial reset"), """", """") & """")
138+
Return $Autorun * $checkTime
139+
EndFunc ;==>isAuto
140+
141+
Func clearTemp()
142+
; Delete temp files
143+
FileDelete(@TempDir & "\idm_reset.reg")
144+
FileDelete(@TempDir & "\idm_trial.reg")
145+
FileDelete(@TempDir & "\idm_reg.reg")
146+
FileDelete(@TempDir & "\SetACLx32.exe")
147+
FileDelete(@TempDir & "\SetACLx64.exe")
148+
FileDelete(@TempDir & "\reg_query.tmp")
149+
EndFunc ;==>clearTemp
150+
151+
Func RegSearch($value = '')
152+
153+
Local $key = ''
154+
155+
Local $DOS = RunWait(@ComSpec & " /c reg query hkcr\clsid /s > " & @TempDir & "\reg_query.tmp", "", @SW_HIDE, 0x10000)
156+
157+
Local $find = StringSplit(_getDOSOutput('findstr /N /I ' & $value & ' ' & @TempDir & "\reg_query.tmp"), ':')[1]
158+
$find = Number($find) - 1
159+
$find = _getDOSOutput('findstr /N . ' & @TempDir & "\reg_query.tmp" & ' | findstr /b ' & $find & ':')
160+
161+
If StringInStr($find, "{") And StringInStr($find, "}") Then
162+
$key = "{" & _StringBetween($find, "{", "}")[0] & "}"
163+
EndIf
164+
165+
Return $key
166+
167+
EndFunc ;==>RegSearch
168+
169+
Func _getDOSOutput($command)
170+
Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
171+
While 1
172+
$text &= StdoutRead($Pid, False, False)
173+
If @error Then ExitLoop
174+
Sleep(10)
175+
WEnd
176+
Return StringStripWS($text, 7)
177+
EndFunc ;==>_getDOSOutput

src/idm_reg.reg

10.2 KB
Binary file not shown.

src/idm_reset.reg

4.24 KB
Binary file not shown.

src/idm_trial.reg

2.71 KB
Binary file not shown.

0 commit comments

Comments
 (0)