[snippet]remove digits

shanker

Well-Known Member
Joined
Sep 18, 2016
Messages
238
Likes
2
Points
33
Location
Romania
#1
[shcode=cpp]
[email protected] = 0x29
repeat
    wait 0
    [email protected] += 0x01
    if 0C2A: [email protected] = strchr [email protected] char [email protected]
    then
        repeat
            wait 0
            0A8C: write_memory [email protected] size 1 value 0x90 virtual_protect 0
        until 8C2A: [email protected] = strchr [email protected] char [email protected]
    end
until [email protected] == 0x39 
[/shcode]

[email protected] - text
 

Opcode.eXe

Well-Known Member
Joined
Feb 18, 2013
Messages
1,278
Likes
27
Points
98
Location
( ͡° ͜ʖ ͡°)
Website
www.youtube.com
10
#4
It uses sampfuncs... kinda useless. Atleast try to make a version without sampfuncs.


Code:
0AC8: [email protected] = allocate_memory_size 1024
0AD3: [email protected] = format "This3 is one St54ring with n1mb3rs."
for [email protected] = 0 to 1024
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read current char
    if or
    [email protected] > 48 // Number 0
    [email protected] < 57 // Number 9
    then    
        0A8C: write_memory [email protected] size 1 value 32 virtual_protect 0
        // or just empty it:
        //0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0
    end
    [email protected] += 1 // next char
end
0AC9: free_allocated_memory [email protected]
not sure if it works but thats what i came up with without testing^^
 
OP
OP
shanker

shanker

Well-Known Member
Joined
Sep 18, 2016
Messages
238
Likes
2
Points
33
Location
Romania
#5
Opcode.eXe said:
It uses sampfuncs... kinda useless. Atleast try to make a version without sampfuncs.


Code:
0AC8: [email protected] = allocate_memory_size 1024
0AD3: [email protected] = format "This3 is one St54ring with n1mb3rs."
for [email protected] = 0 to 1024
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // read current char
    if or
    [email protected] > 48 // Number 0
    [email protected] < 57 // Number 9
    then    
        0A8C: write_memory [email protected] size 1 value 32 virtual_protect 0
        // or just empty it:
        //0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0
    end
    [email protected] += 1 // next char
end
0AC9: free_allocated_memory [email protected]
not sure if it works but thats what i came up with without testing^^
don't u need to check the size of the string to improve the speed?
60mem it's enough for your string :p
 

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
699
Likes
5
Points
23
Location
Lithuania
Website
ugbase.eu
#6
[shcode=cpp]
{
   call @RemoveDigitsFromString 1 stringPointer [email protected]
}
:RemoveDigitsFromString
0C17: [email protected] = strlen [email protected]
[email protected] -= 1
0085: [email protected] = [email protected] // copy base string pointer
005A: [email protected] += [email protected] //byte ending the string (0)
0085: [email protected] = [email protected] // copy of the base string pointer (needed for manipulation to rewrite the string without the digits, mayme [email protected] could be used for that but because It\'s used in the "for loop" I don\'t want to risk and cba to check whether manipulating it affects the loop)
  for [email protected] = [email protected] to [email protected] // [email protected] = pointer to each byte in the string
  0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 1
      if and // if is equal or higher than "0" in ascii, and if is equal or lower than "9" in ascii (http://www.asciitable.com/index/asciifull.gif)
      0029:   [email protected] >= 48
      002B:   57 >= [email protected]
      then
      //do nothing if it\'s a digit
      else
      0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 1  
      [email protected]++ //[email protected] increases only if it\'s not a digit, making sure digits won\'t be rewritten    
      end        
  end
  0A8C: write_memory [email protected] size 1 value 0 virtual_protect 1 //last byte set to 0 to end the string ([email protected] is already increased by 1 by the opcode within the loop)
//the remaining bytes (probably 3) could be set to 0 but let\'s live dangerously and leave them alone
ret 0 //not need to return the string because we didn\'t pass the string itself to a function (the pointer of it was passed meaning that the memory at its address was and will stay rewritten)
[/shcode]

Credits.:
@monday
 
Top