Idm Script
Idm Script
@echo off
set name=Inhuman
if exist %SystemRoot%\Sysnative\cmd.exe (
set "_cmdf=%~f0"
setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %*"
exit /b
)
set "SysPath=%SystemRoot%\System32"
set "Path=%SysPath%;%SystemRoot%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\"
::=================================================================================
=======================================================
cls
color 07
set _args=
set _elev=
set reset=
set Silent=
set activate=
set _args=%*
if defined _args set _args=%_args:"=%
if defined _args (
for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1
if /i "%%A"=="/res" set Unattended=1&set activate=&set reset=1
if /i "%%A"=="/act" set Unattended=1&set activate=1&set reset=
if /i "%%A"=="/s" set Unattended=1&set Silent=1
)
)
::=================================================================================
=======================================================
:begin
::=================================================================================
=======================================================
set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0"
set "_batp=%_batf:'=''%"
set "_appdata=%appdata%"
for /f "tokens=2*" %%a in ('reg query "HKCU\Software\DownloadManager" /v ExePath
2^>nul') do call set "IDMan=%%b"
setlocal EnableDelayedExpansion
if "%arch%"=="x86" (
set "CLSID=HKCU\Software\Classes\CLSID"
set "HKLM=HKLM\Software\Internet Download Manager"
set "_tok=5"
) else (
set "CLSID=HKCU\Software\Classes\Wow6432Node\CLSID"
set "HKLM=HKLM\SOFTWARE\Wow6432Node\Internet Download Manager"
set "_tok=6"
)
set _temp=%SystemRoot%\Temp
set regdata=%SystemRoot%\Temp\regdata.txt
set "idmcheck=tasklist /fi "imagename eq idman.exe" | findstr /i "idman.exe" >nul"
::=================================================================================
=======================================================
if defined Unattended (
if defined reset goto _reset
if defined activate goto _activate
)
:MainMenu
cls
title Inhuman ^(@inhumantt^)
mode 65, 25
set /a _ena=0
set /a _dis=0
for %%# in (DomainProfile PublicProfile StandardProfile) do (
for /f "skip=2 tokens=2*" %%a in ('reg query HKLM\SYSTEM\CurrentControlSet\
Services\SharedAccess\Parameters\FirewallPolicy\%%# /v EnableFirewall 2^>nul') do (
if /i %%b equ 0x1 (set /a _ena+=1) else (set /a _dis+=1)
)
)
if %_ena%==3 (
set _status=Enabled
set _col=%_Green%
)
if %_dis%==3 (
set _status=Disabled
set _col=%_Red%
)
echo:
echo:
echo:
echo:
echo: ___________________________________________________
echo:
echo: [1] Activate IDM
echo: [2] Reset IDM Activation / Trial in Registry
echo: _____________________________________________
echo:
call :_color2 %_White% " [3] Toggle Windows Firewall " %_col% "[%_status
%]"
echo: _____________________________________________
echo:
echo: [4] ReadMe
echo: [5] Homepage
echo: [6] Exit
echo: ___________________________________________________
echo:
call :_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard
[1,2,3,4,5,6]"
choice /C:123456 /N
set _erl=%errorlevel%
if %_erl%==6 exit /b
if %_erl%==5 goto homepage
if %_erl%==4 call :readme&goto MainMenu
if %_erl%==3 call :_tog_Firewall&goto MainMenu
if %_erl%==2 goto _reset
if %_erl%==1 goto _activate
goto :MainMenu
::=================================================================================
=======================================================
:_tog_Firewall
if %_status%==Enabled (
netsh AdvFirewall Set AllProfiles State Off >nul
) else (
netsh AdvFirewall Set AllProfiles State On >nul
)
exit /b
::=================================================================================
=======================================================
:readme
set "_ReadMe=%SystemRoot%\Temp\ReadMe.txt"
if exist "%_ReadMe%" del /f /q "%_ReadMe%" %nul%
call :export txt "%_ReadMe%"
start notepad "%_ReadMe%"
timeout /t 2 %nul%
del /f /q "%_ReadMe%"
exit /b
:export
%nul% %_psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\";
[io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::ASCII);"
exit/b
::=================================================================================
=======================================================
:_reset
echo:
set _error=
echo:
echo %line%
echo:
if not defined _error (
call :_color %Green% "IDM Activation - Trial is successfully reset in the
registry."
) else (
call :_color %Red% "Failed to completely reset IDM Activation - Trial."
)
goto done
::=================================================================================
=======================================================
:_activate
echo:
set _error=
if not [%errorlevel%]==[0] (
call :_color %Red% "Unable to connect internetdownloadmanager.com, aborting..."
goto done
)
echo:
if defined _derror call :f_reset & goto done
set lockedkeys=
set "_action=call :lock_key"
echo Locking registry keys...
echo:
call :action
call :f_reset
::=================================================================================
=======================================================
:done
echo %line%
echo:
echo:
if defined Unattended (
timeout /t 3
exit /b
)
:done2
if defined Unattended (
timeout /t 3
exit /b
)
::=================================================================================
=======================================================
:homepage
cls
echo:
echo:
echo Login is required.
echo:
echo:
timeout /t 3
start https://www.nsaneforums.com/topic/371047--/?do=findComment^&comment=1578647
goto MainMenu
::=================================================================================
=======================================================
:f_reset
echo:
echo %line%
echo:
call :_color %Red% "Error found, resetting IDM activation..."
set "_action=call :delete_key"
call :reset
echo:
echo %line%
echo:
call :_color %Red% "Failed to activate IDM."
exit /b
::=================================================================================
=======================================================
:reset
set take_permission=
call :delete_queue
set take_permission=1
call :action
call :add_key
exit /b
::=================================================================================
=======================================================
:_rcont
:register_IDM
echo:
echo Applying registration details...
echo:
echo:
echo Triggering a few downloads to create certain registry keys, please wait...
set "file=%_temp%\temp.png"
set _fileexist=
set _derror=
set link=https://www.internetdownloadmanager.com/images/idm_box_min.png
call :download
set link=https://www.internetdownloadmanager.com/register/IDMlib/images/
idman_logos.png
call :download
set foundkeys=
call :action
if [%foundkeys%] GEQ [7] goto _skip
set link=https://www.internetdownloadmanager.com/pictures/idm_about.png
call :download
set link=https://www.internetdownloadmanager.com/languages/indian.png
call :download
timeout /t 3 >nul
set foundkeys=
call :action
if not [%foundkeys%] GEQ [7] set _derror=1
:_skip
echo:
if not defined _derror (
echo Required registry keys were created successfully.
) else (
if not defined _fileexist call :_color %Red% "Unable to download files with IDM."
call :_color %Red% "Failed to create required registry keys."
call :_color %Magenta% "Try again - disable Windows firewall with script options -
check Read Me."
)
echo:
%idmcheck% && taskkill /f /im idman.exe
if exist "%file%" del /f /q "%file%"
exit /b
:download
set /a attempt=0
if exist "%file%" del /f /q "%file%"
start "" /B "!IDMan!" /n /d "%link%" /p "%_temp%" /f temp.png
:check_file
timeout /t 1 >nul
set /a attempt+=1
if exist "%file%" set _fileexist=1&exit /b
if %attempt% GEQ 20 exit /b
goto :Check_file
::=================================================================================
=======================================================
:delete_queue
echo:
echo Deleting registry keys...
echo:
for %%# in (
""HKCU\Software\DownloadManager" "/v" "FName""
""HKCU\Software\DownloadManager" "/v" "LName""
""HKCU\Software\DownloadManager" "/v" "Email""
""HKCU\Software\DownloadManager" "/v" "Serial""
""HKCU\Software\DownloadManager" "/v" "scansk""
""HKCU\Software\DownloadManager" "/v" "tvfrdt""
""HKCU\Software\DownloadManager" "/v" "radxcnt""
""HKCU\Software\DownloadManager" "/v" "LstCheck""
""HKCU\Software\DownloadManager" "/v" "ptrk_scdt""
""HKCU\Software\DownloadManager" "/v" "LastCheckQU""
"%HKLM%"
) do for /f "tokens=* delims=" %%A in ("%%~#") do (
set "reg="%%~A"" ® query !reg! %nul% && call :delete_key
)
exit /b
::=================================================================================
=======================================================
:add_key
echo:
echo Adding registry key...
echo:
:_add_key
if [%errorlevel%]==[0] (
set "reg=%reg:"=%"
echo Added - !reg!
) else (
set _error=1
set "reg=%reg:"=%"
%_psc% write-host 'Failed' -fore 'white' -back 'DarkRed' -NoNewline&echo - !reg!
)
exit /b
::=================================================================================
=======================================================
:action
exit /b
::=================================================================================
=======================================================
:scan_key
for /f "skip=2 tokens=*" %%a in ('reg query %reg% /ve 2^>nul') do echo %%a|
findstr /r /e "[^0-9]" >nul || (
%_action%
exit /b
)
for /f "skip=2 tokens=3" %%a in ('reg query %reg%\Version /ve 2^>nul') do echo %%a|
findstr /r "[^0-9]" >nul || (
%_action%
exit /b
)
for /f "skip=2 tokens=1" %%a in ('reg query %reg% 2^>nul') do echo %%a| findstr /i
"MData Model scansk Therad" >nul && (
%_action%
exit /b
)
for /f "skip=2 tokens=*" %%a in ('reg query %reg% /ve 2^>nul') do echo %%a| find /i
"+" >nul && (
%_action%
exit /b
)
exit/b
::=================================================================================
=======================================================
:delete_key
if [%errorlevel%]==[0] (
set "reg=%reg:"=%"
echo Deleted - !reg!
) else (
set "reg=%reg:"=%"
set _error=1
%_psc% write-host 'Failed' -fore 'white' -back 'DarkRed' -NoNewline & echo - !
reg!
)
exit /b
::=================================================================================
=======================================================
:lock_key
if not [%errorlevel%]==[0] (
set "reg=%reg:"=%"
echo Locked - !reg!
set /a lockedkeys+=1
) else (
set _error=1
set "reg=%reg:"=%"
%_psc% write-host 'Failed' -fore 'white' -back 'DarkRed' -NoNewline&echo - !reg!
)
exit /b
::=================================================================================
=======================================================
:count_key
set /a foundkeys+=1
exit /b
:reg_own
%_psc% $A='%~1','%~2','%~3','%~4','%~5','%~6';iex(([io.file]::ReadAllText('!
_batp!')-split':Own1\:.*')[1])&exit/b:Own1:
$D1=[uri].module.gettype('System.Diagnostics.Process')."GetM`ethods"(42) |where
{$_.Name -eq 'SetPrivilege'} #`:no-ev-warn
'SeSecurityPrivilege','SeTakeOwnershipPrivilege','SeBackupPrivilege','SeRestorePriv
ilege'|foreach {$D1.Invoke($null, @("$_",2))}
$path=$A[0]; $rk=$path-split'\\',2; $HK=gi -lit Registry::$($rk[0]) -fo; $s=$A[1];
$sps=[Security.Principal.SecurityIdentifier]
$u=($A[2],'S-1-5-32-544')[!$A[2]];$o=($A[3],$u)[!$A[3]];$w=$u,$o |% {new-object
$sps($_)}; $old=!$A[3];$own=!$old; $y=$s-eq'all'
$rar=new-object Security.AccessControl.RegistryAccessRule( $w[0],
($A[5],'FullControl')[!$A[5]], 1, 0, ($A[4],'Allow')[!$A[4]] )
$x=$s-eq'none';function Own1($k){$t=$HK.OpenSubKey($k,2,'TakeOwnership');if($t)
{0,4|%{try{$o=$t.GetAccessControl($_)}catch{$old=0}
};if($old){$own=1;$w[1]=$o.GetOwner($sps)};$o.SetOwner($w[0]);
$t.SetAccessControl($o); $c=$HK.OpenSubKey($k,2,'ChangePermissions')
$p=$c.GetAccessControl(2);if($y){$p.SetAccessRuleProtection(1,1)};
$p.ResetAccessRule($rar);if($x){$p.RemoveAccessRuleAll($rar)}
$c.SetAccessControl($p);if($own){$o.SetOwner($w[1]);$t.SetAccessControl($o)};if($s)
{$subkeys=$HK.OpenSubKey($k).GetSubKeyNames()
foreach($n in $subkeys){Own1 "$k\$n"}}}};Own1 $rk[1];if($env:VO){get-acl Registry::
$path|fl} #:Own1: lean & mean snippet by AveYo
::=================================================================================
=======================================================
:_color
:batcol
pushd %_coltemp%
if not exist "'" (<nul >"'" set /p "=.")
setlocal
set "s=%~2"
set "t=%~4"
call :_batcol %1 s %3 t
del /f /q "'"
del /f /q "`.txt"
popd
exit /b
:_batcol
setlocal EnableDelayedExpansion
set "s=!%~2!"
set "t=!%~4!"
for /f delims^=^ eol^= %%i in ("!s!") do (
if "!" equ "" setlocal DisableDelayedExpansion
>`.txt (echo %%i\..\')
findstr /a:%~1 /f:`.txt "."
<nul set /p "=%_BS%%_BS%%_BS%%_BS%%_BS%%_BS%%_BS%"
)
if "%~4"=="" echo(&exit /b
setlocal EnableDelayedExpansion
for /f delims^=^ eol^= %%i in ("!t!") do (
if "!" equ "" setlocal DisableDelayedExpansion
>`.txt (echo %%i\..\')
findstr /a:%~3 /f:`.txt "."
<nul set /p "=%_BS%%_BS%%_BS%%_BS%%_BS%%_BS%%_BS%"
)
echo(
exit /b
::=======================================
:_colorprep
set "Red="41;97m""
set "Gray="100;97m""
set "Black="30m""
set "Green="42;97m""
set "Blue="44;97m""
set "Yellow="43;97m""
set "Magenta="45;97m""
set "_Red="40;91m""
set "_Green="40;92m""
set "_Blue="40;94m""
set "_White="40;37m""
set "_Yellow="40;93m""
exit /b
)
if not defined _BS for /f %%A in ('"prompt $H&for %%B in (1) do rem"') do set "_BS=
%%A %%A"
set "_coltemp=%SystemRoot%\Temp"
set "Red="CF""
set "Gray="8F""
set "Black="00""
set "Green="2F""
set "Blue="1F""
set "Yellow="6F""
set "Magenta="5F""
set "_Red="0C""
set "_Green="0A""
set "_Blue="09""
set "_White="07""
set "_Yellow="0E""
exit /b