CLEO Help How to Crypt/Decrypt my Клео

CLEO related
Status
Not open for further replies.

_C1ph3r_

Active member
Joined
Feb 5, 2017
Messages
91
Reaction score
3
Hi, it's C1ph3r !
I want to know how to Crypt or Decrypt my script ?
 

_C1ph3r_

Active member
Joined
Feb 5, 2017
Messages
91
Reaction score
3
0x32789 said:
search button, not so hard, isn't it?
http://ugbase.eu/Thread-C-CRYPTOR2-Invincible-CLEO-Cryptor-II-CS-to-ASI-Converter-TEST-PHASE
Yes, but i want do it myself... like don't use any software ? can we ?
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Xor method

Example of a mod encrypted by it:
next to the gta icon in sanny builder control panel there's a wheel, click on it and enable "IGNORE_UNKNOWN", then look at the source of this mod, at the begining of the script it jumps to the label at the end

Code:
goto @Noname_18292

The label at the end reads hexadecimal values and transforms each value using "xor" method.

Code:
0A8D: 3@ = read_memory 0@ size 1 virtual_protect 1 
0B12: 4@ = 3@ XOR 118 
0A8C: write_memory 5@ size 1 value 4@ virtual_protect 1


What happens next I'm not sure but I guess it jumps to the begining of the transformed memory (?)
Code:
0A9F: 0@ = current_thread_pointer 
0A8E: 1@ = 0@ + 16 // int 
0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1 
1@ += 4 
0A8C: write_memory 1@ size 4 value 2@ virtual_protect 1
Edit: It reads "Absolute Base Address" (I guess it's the begining of the cleo) and writes it to the "Absolute IP" (instruction pointer)

 http://gtaforums.com/topic/456691-memory-handling/#entry1060078040
Seemann said:
0x00  dword                     Next Pointer
  0x04  dword                     Previous Pointer
  0x08  char[8]                   Thread Name
  0x10  dword                     Absolute Base Address
  0x14  dword                     Absolute IP
  0x18  dword[8]                  Absolute Return Stack
  0x38  word                      Stack Pointer
  0x3A  byte[2]                   (Align)
  0x3C  dword[32]                 Local Variables
  0xBC  dword[2]                  Local Timers
  0xC4  byte                      (Unknown)
  0xC5  byte                      'if' statement result
  0xC6  byte                      (Unknown)
  0xC7  byte                      Is External Script
  0xC8  byte                      (Unknown)
  0xC9  byte                      (Unknown)
  0xCA  byte[2]                   (Align)
  0xCC  dword                     Wakeup Time
  0xD0  word                      'if' parameter
  0xD2  byte                      'not' flag
  0xD3  byte                      'wb_check' flag
  0xD4  byte[4]                   (Unknown)
  0xD8  dword                     Skip Scene Pos (opcode 0707)
  0xDC  byte                      Is Mission
  0xDD  byte[3]                   (Align)
  0xE0                            end

There's more complexity into it because it is stated how long is the memory to be transformed (1@) and the offset of the label is retrieved but I'm not sure how it was originally created because in the decompiled file there is no label "Noname_13"


Code:
0AC6: 0@ = label @Noname_13 offset 
1@ = 18274


My implementation (based on the mod above)
Mod to encrypt:

Code:
{$CLEO}
0000:

while true
wait 0
    if key_down 49
    then
    chatmsg "test" -1
    wait 1000
    end
end

Implementation:
Code:
{$CLEO}
0000:

wait 0

goto @decrypt_before_using

:script
hex
//00 00 01 00 04 00 D6 00 04 00 B0 0A 04 31 4D 00 01 DB FF FF FF F8 0A 0E 04 74 65 73 74 04 FF 00 01 00 05 E8 03 02 00 01 FE FF FF FF
4D 4D 4C 4D 49 4D 9B 4D 49 4D FD 47 49 7C 00 4D 4C 96 B2 B2 B2 B5 47 43 49 39 28 3E 39 49 B2 4D 4C 4D 48 A5 4E 4F 4D 4C B3 B2 B2 B2
end

:decrypt_before_using
wait 0
0AC6: 0@ = label @script offset 
1@ = 44
2@ = 0 
0085: 5@ = 0@ // (int) 
5@ -= 13
while 001D:   1@ > 2@   // (int)
wait 0
    0A8D: 3@ = read_memory 0@ size 1 virtual_protect 1 
    0B12: 4@ = 3@ XOR 77 
    // 4@ = 3@ // (int)
    0A8C: write_memory 5@ size 1 value 4@ virtual_protect 1 
    0@ += 1 
    2@ += 1 
    5@ += 1 
end

0A9F: 0@ = current_thread_pointer 
0A8E: 1@ = 0@ + 16 // int 
0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1 
1@ += 4 
0A8C: write_memory 1@ size 4 value 2@ virtual_protect 1

Used HxD to check the hexadecimal values (copied part was: from the start, to and including the value just before "VAR" )
Used python to transform values using xor method with a script like:
Code:
hex_values_list = "00 00 01 00 04 00 D6 00 04 00 B0 0A 04 31 4D 00 01 DB FF FF FF F8 0A 0E 04 74 65 73 74 04 FF 00 01 00 05 E8 03 02 00 01 FE FF FF FF".split(" ")
xored_str = ""
for v in hex_values_list:
    xored_value = str(hex(int(v, 16) ^ 77)).replace("0x","").upper()
    xored_str += ("0" + xored_value if len(xored_value) == 1 else xored_value)  + " "

print xored_str

_________________________________________

Another method

http://gtaforums.com/topic/516228-how-to-lock-a-cs-file/#entry1061463266
Bad.boy! said:
Something like this:
Code:
thread "lock"

:start
jump @code

hex
   BB 01 02
end

:CODE
// bla bla

oksa8 said:
Actually, I would encourage people NOT to lock their scripts, it allows others to take a look and learn from it. And even if you lock your script, it can still be stolen.

But, there's one simple way, and it's simple to by-pass. Just add new label somewhere, some random hex-code in there and compile. But remember, there should NOT be any jumps to that label, otherwise it'll crash.

Not some random hex, you have to fool Sanny Builder.

Here is an example:

Code:
{$CLEO .cs}

0000:

:START
jump @ACTUAL_CODE

hex
   A4 03 09 48 41 48 41 00
end

:ACTUAL_CODE
// Random opcodes to show the result
0003: shake_camera 40 
0007: 7@ = 0.0 
000D: $TEMPVAR_Z_COORD -= 0.5 
jump @START


It will decompile in this:

Code:
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP 
0002: jump @HAHA_17 
03A4: name_thread 'HAHA' 
0728: NOP 
0300: unsupported_in_sa 
0007: 0.0 = 512@(284@,6i) 
0000: NOP 
023F: unsupported_in_sa 
hex
00 01 FE FF FF FF


But the best thing to do is to report the mod stealers and keep your files open. Looking at examples can help people.

_______________________________________________

Other methods (not explained I guess)
http://blast.hk/threads/9799/
 
Status
Not open for further replies.
Top