Saturday, March 28, 2015

mips assembly


Instructions
all instruction are 32 bit long
instruction fall into three categories:
R-type: register type instructions
I-type: immediate 
J-type: jump instructions

jump

There are the list of instructions we'll look at.
  • beq Branches if the quantities of two registers are equal.
  • bne Branches if the quantities of two registers are NOT equal.
  • bgtz Branches if a quantity in a register is greater than zero (quantity is 32 bit, 2C).
  • bgez Branches if a quantity in a register is greater than or equal to zero (quantity is 32 bit, 2C).
  • bltz Branches if a quantity in a register is less than zero (quantity is 32 bit, 2C).
  • blez Branches if a quantity in a register is less than or equal to zero (quantity is 32 bit, 2C).
  • j Jump to an address
  • jr Jump to an address stored in a register
  • jal Jump to an address, and store the return address in a register.
  • jalr Jump to an address stored in a register, and store the return address in another register.




http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/

Friday, March 27, 2015

IDA Python




debug


pycharm pro
  • copy pycharm-debug.egg from /path/to/pycharm/debug-eggs to remote computer if nessery
  • add code to IDA python script

import sys
import os
current_path = os.path.dirname(__file__)
egg_loc = os.path.join(current_path, "pycharm-debug.egg")
sys.path.append(egg_loc)
print egg_loc
import pydevd
pydevd.settrace("host ip/name", port=12345, stdoutToServer=True, stderrToServer=True)


  • config pycharm (Run/Debug Configuration)

add Python Remote Debug



  • Run Debug server




References

https://www.hex-rays.com/products/ida/support/idapython_docs/
http://www.slideshare.net/geeksec80/introduction-to-ida-python
http://reverseengineering.stackexchange.com/questions/2190/how-to-debug-an-idapython-script-from-within-ida/2885#2885
http://www.offensivecomputing.net/papers/IDAPythonIntro.pdf

http://www.slideshare.net/geeksec80/python-arsenal-for-re-1?related=1

PyCharm remote debug

PyCharm Professional only (community with remote server)


1)
Run/Debug Configuration

config server address and port listen

2)
copy debug-eggs to remote computer
locate /path/to/pycharm/debug-eggs

3)
add attach code to code under debug

4)run server


Monday, March 16, 2015

Buildroot "output" directory for multiple targets

mkdir device
cd device
make -C "/path/to/buildroot" O="`pwd`" menuconfig
make