CLEO Help Deleting characters from a string

CLEO related
Status
Not open for further replies.

Hackz0r

Active member
Joined
Oct 31, 2016
Messages
25
Reaction score
0
What is the simplest way to delete the first two characters from a string? I have both newOpcodes and SAMPFUNCS
PHP:
format 0@ "xxstring"
 
//how to cut "xx"?
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
_________________
This does similar to the last opcode. It gets the pointer, but this time it gets the pointer to a variable.
Code:
0AC7: 0@ = var 1@ offset
By doing this, we could use read_memory or write_memory to read/write the value in the variable, but this is particularly good for use with strings.
Let's say we wanted the second 2 characters of a 4-char string.
Code:
1@v = "ABCD"
0AC7: 0@ = var 1@ offset
0@ += 2  // skip the first 2 characters
0A8D: 1@ = read_memory 0@ size 2 virtual_protect 0  // read the next 2 characters
// 1@ now contains "CD"
_________________
Of course size in opcode 0a8d means the size of string you want to read so you could get the size of string first by using : 0C17: 1@ = strlen 0@, and then simply decrease it by 2
However, I have a feeling that this is not the shortest solution cuz I don't know about CLEO much, so I just used google and some time to help you

Source : https://sannybuilder.com/forums/viewtopic.php?id=882
 

Hackz0r

Active member
Joined
Oct 31, 2016
Messages
25
Reaction score
0
springfield said:
Pointer arithmetic.

[shcode=cpp]
0AC8: 0@ = 260
format 0@ "xxstring"

0@ += 2
0AD1: "%s" 100 0@
   
0AC9: 0@
[/shcode]

That makes a lot of sense to me now. Thanks kind sir
 
Status
Not open for further replies.
Top