MIPS cross platform break point detection memory scanning

A place to submit all custom code, scripts, and programs.
Forum rules
Do NOT post malicious code or programs. Please review all code posted in this forum before downloading or running any of the code or programs here.

MIPS cross platform break point detection memory scanning

Post by MadM0use on Sun Feb 01, 2015 2:34 am
([msg=86529]see MIPS cross platform break point detection memory scanning[/msg])

Code: Select all
/*
#############################
# MIPS breakpoint detection #
#############################

.text
.abicalls
.global scan   

# bool scan(void* code, unsigned int size);
scan:
        li $t0, 0x5000D                 # breakpoint constant
loop:
        lw $t3, ($a0)                   # load bytecode
        beq $t3, $t0, fuck              # if this is a breakpoint fucked
        beq $t3, 0, safe                # if the counter is 0we are safe
        subu $a1, 1                     # decrement counter
        addu $a0, 1                     # increment our pointer
        j loop                          # if we are looping loop

safe:
        li $v0, 0x0     # return false
        li $v1, 0x0
        jr $ra

fuck:
        li $v0, 0x1     # return true
        li $v1, 0x0
        jr $ra

*/


bool scan(void (*fun), unsigned int depth)   /// scans a function for break points
{
   int i;
   long unsigned int inst;
   for(i=0;i<=depth;i+=sizeof(inst))   /// count from offset start to depth
   {
      inst = (*(volatile long unsigned int *)((long unsigned int)fun + i));
      if (inst == 0x5000D)   /// if this is a break point
         return true;   /// return true
   }
   return false;
}
const char main[]="\xeb\xfe -> A fully functional program in C";

<@MadMouse> i am forgot what i was doing today but i had motivation and a distinct plan when i woke up stoned right now

http://pastebin.com/FnwUG5KS
Books:
http://goo.gl/muPm3d
User avatar
MadM0use
Experienced User
Experienced User
 
Posts: 70
Joined: Thu Sep 11, 2014 10:30 pm
Blog: View Blog (0)


Re: MIPS cross platform break point detection memory scanning

Post by cyberdrain on Sun Feb 01, 2015 7:34 pm
([msg=86544]see Re: MIPS cross platform break point detection memory scanning[/msg])

Wow, MIPS mnemonics are very different from most other assembly code. :O
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: MIPS cross platform break point detection memory scanning

Post by MadM0use on Sun Feb 01, 2015 7:56 pm
([msg=86549]see Re: MIPS cross platform break point detection memory scanning[/msg])

cyberdrain wrote:Wow, MIPS mnemonics are very different from most other assembly code. :O

ID SAY, but its beautiful isn't it? :D
const char main[]="\xeb\xfe -> A fully functional program in C";

<@MadMouse> i am forgot what i was doing today but i had motivation and a distinct plan when i woke up stoned right now

http://pastebin.com/FnwUG5KS
Books:
http://goo.gl/muPm3d
User avatar
MadM0use
Experienced User
Experienced User
 
Posts: 70
Joined: Thu Sep 11, 2014 10:30 pm
Blog: View Blog (0)


Re: MIPS cross platform break point detection memory scanning

Post by cyberdrain on Sun Feb 01, 2015 8:32 pm
([msg=86555]see Re: MIPS cross platform break point detection memory scanning[/msg])

MadM0use wrote:ID SAY, but its beautiful isn't it? :D

Yup, if only I knew what the abbrevations meant, it would probably be clearer than most x86/x64 syntax.
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: MIPS cross platform break point detection memory scanning

Post by MadM0use on Sun Feb 01, 2015 10:19 pm
([msg=86558]see Re: MIPS cross platform break point detection memory scanning[/msg])

cyberdrain wrote:
MadM0use wrote:ID SAY, but its beautiful isn't it? :D

Yup, if only I knew what the abbrevations meant, it would probably be clearer than most x86/x64 syntax.


its so close to the bare nuts of the processor its REDICULOUS while still maintaining usability, let me link you to some documentation.

http://www.tik.ee.ethz.ch/education/lectures/TI1/materials/assemblylanguageprogdoc.pdf

http://www.cs.cornell.edu/courses/cs3410/2015sp/MIPS_Vol2.pdf
const char main[]="\xeb\xfe -> A fully functional program in C";

<@MadMouse> i am forgot what i was doing today but i had motivation and a distinct plan when i woke up stoned right now

http://pastebin.com/FnwUG5KS
Books:
http://goo.gl/muPm3d
User avatar
MadM0use
Experienced User
Experienced User
 
Posts: 70
Joined: Thu Sep 11, 2014 10:30 pm
Blog: View Blog (0)


Re: MIPS cross platform break point detection memory scanning

Post by cyberdrain on Mon Feb 02, 2015 8:54 am
([msg=86565]see Re: MIPS cross platform break point detection memory scanning[/msg])

Thanks! :D
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)



Return to Custom Code

Who is online

Users browsing this forum: No registered users and 0 guests