TechKnow

Author Topic: [BAT] Extended registry setup example for e.g. gamerips  (Read 732 times)

0 Members and 1 Guest are viewing this topic.

Offline HcH

  • TechKnow Owner, Ethical Hacker
  • Administrator
  • Uber Member
  • *****
  • Posts: 9936
  • Karma: +2284/-111
[BAT] Extended registry setup example for e.g. gamerips
« on: January 13, 2016, 08:13:57 PM »
Hello TechKnow members and visitors,

Here's a nice extended script that may help you create registry patches. This is ideal for gamerips for example.

Features:

* %CD% to REGPATH conversion (with double backslashes "\\")
* %CD% to HEX REGPATH
* Standalone path tho HEX converter, launch "REGSETUP.bat %CD%" for example, output is set to %STRING%
* WARNiNG!: Save this script as REGSETUP.bat, if you change the filename, be sure to change it inside the code
* WARNiNG!: Hex conversion table is delimited with TABS, if you copy the script, ensure it's still TAB DELIMITED

Code: (REGSETUP.bat) [Select]
@echo off
color 0a
SETLOCAL ENABLEDELAYEDEXPANSION
set regfile=GAME.REG
set line=%CD%
set find=\
set replace=\\
set newline=!line:%find%=%replace%!
set DEBUG=0
set string=
if "%1"=="" set input=%CD%
if not "%1"=="" set input=%1
set input=%INPUT%]

:EXTRACT
REM Extract the first characters
set i=%input:~0,1%

REM GET ASCII VALUE
for /F "tokens=1,2,3,4,5,6 delims= " %%a in (REGSETUP.bat) do if "%%a %%d"=="R %i%" set HEX=%%b
if %DEBUG%==1 echo hex=%HEX%
if %DEBUG%==1 echo string1=%STRING%
set STRING=%STRING%%HEX%,00,
if %DEBUG%==1 echo string2=%STRING%
REM Remove first characters from input
set input=%input:~1%

REM End MSG Termination
if "%input%"=="]" goto :DONE

goto :EXTRACT

:DONE
cls
REM Remove the final trailing "," from STRING
set STRING=%STRING:~0,-1%

REM If this script is called from a prompt with arguments:
if not "%1"=="" echo Decoded: %STRING%, set to %%STRING%% && goto :EOF

cls
echo.
echo HcH'z REGSETUP BATCHCODE
echo.
echo Featuring:
echo * path to registry value conversion
echo * path to 16bit hex conversion
echo.
echo CURPATH=%CD%
echo REGPATH=%NEWLINE%
echo 16BITREGPATH=%STRING%
echo.
echo Windows Registry Editor Version 5.00 >%REGFILE%
echo. >>%REGFILE%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Electronic Farts\Game\GameLocation]>>%REGFILE%
echo "gameLocation"=hex(2):%STRING%>>%REGFILE%
echo.>>%REGFILE%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Electronic Farts\Game\info]>>%REGFILE%
echo "gameDir"="%NEWLINE%\\game.exe">>%REGFILE%
REGEDIT %REGFILE%
goto :EOF
Hex Binary ASCII
R 00 00000000
R 20 00100000 _
R 21 00100001 !
R 22 00100010 "
R 23 00100011 #
R 24 00100100 $
R 25 00100101 %
R 26 00100110 &
R 27 00100111 '
R 28 00101000 (
R 29 00101001 )
R 2B 00101011 +
R 2C 00101100 ,
R 2D 00101101 -
R 2E 00101110 .
R 2F 00101111 /
R 30 00110000 0
R 31 00110001 1
R 32 00110010 2
R 33 00110011 3
R 34 00110100 4
R 35 00110101 5
R 36 00110110 6
R 37 00110111 7
R 38 00111000 8
R 39 00111001 9
R 3A 00111010 :
R 3B 00111011 ;
R 40 01000000 @
R 41 01000001 A
R 42 01000010 B
R 43 01000011 C
R 44 01000100 D
R 45 01000101 E
R 46 01000110 F
R 47 01000111 G
R 48 01001000 H
R 49 01001001 I
R 4A 01001010 J
R 4B 01001011 K
R 4C 01001100 L
R 4D 01001101 M
R 4E 01001110 N
R 4F 01001111 O
R 50 01010000 P
R 51 01010001 Q
R 52 01010010 R
R 53 01010011 S
R 54 01010100 T
R 55 01010101 U
R 56 01010110 V
R 57 01010111 W
R 58 01011000 X
R 59 01011001 Y
R 5A 01011010 Z
R 5B 01011011 [
R 5C 01011100 \
R 5D 01011101 ]
R 5F 01011111 _
R 61 01100001 a
R 62 01100010 b
R 63 01100011 c
R 64 01100100 d
R 65 01100101 e
R 66 01100110 f
R 67 01100111 g
R 68 01101000 h
R 69 01101001 i
R 6A 01101010 j
R 6B 01101011 k
R 6C 01101100 l
R 6D 01101101 m
R 6E 01101110 n
R 6F 01101111 o
R 70 01110000 p
R 71 01110001 q
R 72 01110010 r
R 73 01110011 s
R 74 01110100 t
R 75 01110101 u
R 76 01110110 v
R 77 01110111 w
R 78 01111000 x
R 79 01111001 y
R 7A 01111010 z
R 7B 01111011 {
R 7D 01111101 }
R 7E 01111110 ~
:EOF
exit

Enjoy this handy script ;)

Cheers,

HcH
« Last Edit: January 13, 2016, 08:16:30 PM by HardcoreHacker »