ida+qira 記錄

安裝qira:

1.http://qira.me/
按照以上完賬安裝步驟安裝:即可
qira1.2年代久遠(yuǎn)
使用本人github下載:
2.使用 geohot的git網(wǎng)站進(jìn)行安裝:
https://github.com/BinaryAnalysisPlatform/qira

可能存在的錯誤:

1.Flask-SocketIO 2.9.2 存在錯誤 降低版本即可解決 如下圖所示:


圖片.png

Flask-SocketIO got an update (to 2.9.2) which obviously broke qira. You can simply downgrade this module.
Here is how I did it:

source <qira-dir>/venv/bin/activate
pip uninstall Flask-SocketIO
pip install Flask-SocketIO==2.9.1
deactivate

參考網(wǎng)站:
https://github.com/miguelgrinberg/Flask-SocketIO/blob/v1.0/README.md

windows安裝沒有成功:
存在錯誤:

  1. Cannot open include file: 'inttypes.h': No such file or directory
    2.如圖所示:


    錯誤1
C:\Users\>C:\Python27\python.exe middleware/qira.py -s ./stack1
C:\Users\\qira_webserver.py:41: ExtDeprecationWarning: Importing flask.ext.socketio is deprecated, use flask_socketio instead.
  from flask.ext.socketio import SocketIO, emit
*** program is C:\Users\qira\stack1 with hash 81d1adbda5c66b08eb76d3c1a43960f529337028
Traceback (most recent call last):
  File "middleware/qira.py", line 83, in <module>
    program = qira_program.Program(args.binary, args.args, qemu_args)
  File "C:\Users\middleware\qira_program.py", line 56, in __init__
    self.static = static2.Static(self.program)
  File "C:\Usersqira/static2\static2.py", line 108, in __init__
    loader.load_binary(self)
  File "C:\Users\qira\static2\builtin\loader.py", line 84, in load_binary
    for nsym, symbol in enumerate(section.iter_symbols()):
  File "C:\Python27\lib\site-packages\elftools\elf\sections.py", line 124, in iter_symbols
    yield self.get_symbol(i)
  File "C:\Python27\lib\site-packages\elftools\elf\sections.py", line 101, in get_symbol
    stream_pos=entry_offset)
  File "C:\Python27\lib\site-packages\elftools\common\utils.py", line 34, in struct_parse
    raise ELFParseError(str(e))
elftools.common.exceptions.ELFParseError: expected 4, found 0

3.error C2011: 'addrinfo' : 'struct' type redefinition
4. from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'

一定不要更新到最新版 否則,你去找解決辦法都沒有地方。這里python不能跟新到3.5版本.
此問題參考網(wǎng)站:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852163
https://askubuntu.com/questions/907035/importerror-cannot-import-name-remove-dead-weakref
https://github.com/pyinstaller/pyinstaller/issues/2942

Traceback (most recent call last):
  File "/usr/lib/python3.5/py_compile.py", line 6, in <module>
    import importlib._bootstrap_external
  File "/usr/lib/python3.5/importlib/__init__.py", line 57, in <module>
    import types
  File "/usr/lib/python3.5/types.py", line 166, in <module>
    import functools as _functools
  File "/usr/lib/python3.5/functools.py", line 23, in <module>
    from weakref import WeakKeyDictionary
  File "/usr/lib/python3.5/weakref.py", line 12, in <module>
    from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'

解決辦法:https://www.questarter.com/q/how-to-install-pip-on-debian-with-python-2-7-27_46560951.html(但是沒有什么卵用)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
本來是想嘗試在Linux下裝ida,目的是現(xiàn)在同一個系統(tǒng)平臺下,將ida和qira最大限度的一起使用。
說下本人的安裝過程和問題:
1.ida的Linux版本很少,我在網(wǎng)上只找到了ida6.4版本,這里面的qira_linux版本插件不能使用。

錯誤信息

插件

這里我猜測:如果找到ida6.6以上的版本,可能能夠使用。

其它:

示例

1:表示分支(每執(zhí)行一次就可以產(chǎn)生一個分支,方便運算)
2:內(nèi)存布局(類似于ida的概況導(dǎo)航欄)
3:控制窗口吧。(你可以在這里輸入你想找的任何地址。)
4:反匯編窗口
5:寄存器窗口
6:change list(這個不知道怎么解釋,猜測:指令執(zhí)行的變化狀態(tài))
7:strace
8:內(nèi)存映射
藍(lán)色:change list的標(biāo)號
灰色:表示分支變化的數(shù)字
紅色:表示指令地址(iaddr)
暗黃色:表示數(shù)據(jù)存儲的地址(daddr)
在分支窗口上:顏色越深表示函數(shù)的深度(表示第幾層的函數(shù))
移動藍(lán)色的指令,在分支視圖中,你能夠看到藍(lán)色點。
紅色是通過iaddr的點?????(你在調(diào)試的時候,來回已經(jīng)翻動過的紅色代碼)
亮黃色是寫入daddr里的點????
暗黃色是讀取daddr的點????
內(nèi)存映射區(qū)的藍(lán)色光標(biāo):表示棧基址
內(nèi)存映射區(qū)的紅色光標(biāo):表示棧頂指針

qira 介紹:
1.被稱為永恒的調(diào)試器,沒有時間限制。
2.qira使用動態(tài)調(diào)試的方法,但是他可以像靜態(tài)調(diào)試一樣,任意查看上下文代碼。
3.qira可以記錄整個運行的的過程,這使的我們調(diào)試過程變得更加簡單。
qira的作用:

  1. 進(jìn)行正常調(diào)試
  2. 調(diào)試時如果發(fā)現(xiàn)內(nèi)存不如所料,可以返回到之前的狀態(tài)進(jìn)行內(nèi)存狀態(tài)查看
    這一點使得我們可以避免很多反復(fù)啟動的工作,使得開發(fā)expoit更加簡單
$ ./qira --help
usage: qira.py [-h] [-s] [-t] [--gate-trace ADDRESS] [--flush-cache] [--pin]
               [--host HOST] [--web-port PORT] [--socat-port PORT] [-S]
               [--engine ENGINE]
               binary [args [args ...]]

Analyze binary. Like "qira /bin/ls /"

positional arguments:
  binary                path to the binary
  args                  arguments to the binary

optional arguments:
  -h, --help            show this help message and exit
  -s, --server          bind on port 4000. like socat
  -t, --tracelibraries  trace into all libraries
  --gate-trace ADDRESS  don't start tracing until this address is hit #直到命中他的地址在跟蹤
  --flush-cache         flush all QIRA caches #刷新緩存
  --pin                 use pin as the backend, requires ./pin_build.sh
  --host HOST           listen address for web interface and socat. 0.0.0.0 by
                        default
  --web-port PORT       listen port for web interface. 3002 by default
  --socat-port PORT     listen port for socat. 4000 by default
  -S, --static          enable static2
  --engine ENGINE       static engine to use with static2 (builtin or r2)#這個沒理解

兩個插件:

./fetchlibs.sh will fetch the libraries for i386, armhf, armel, aarch64, mips, mipsel, and ppc

./tracers/pin_build.sh will install the QIRA PIN plugin, allowing --pin to work

在kali下安裝 pin_build.sh ,報如下錯誤:


無法定位軟件包g++-4.9

采用的解決辦法是:

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

先注釋掉原來的kali源,找到一個Ubuntu16.04 的清華源,進(jìn)行更新。
`

sudo apt-get update

最后執(zhí)行:
sudo ./pin_build.sh

`
安裝成功。

  • 若報以下錯誤:


    路徑問題

    然后使用如下命令:

 ./tracers/pin_build.sh 

注意這里不要使用:
sudo ./pin_build.sh

pin成功

快捷鍵:

j -- next invocation of instruction#下一條調(diào)用的指令(你選中的指令,下一條出現(xiàn)的地方)
k -- prev invocation of instruction#下一條調(diào)用的指令

shift-j -- next toucher of data (下一個觸發(fā)的數(shù)據(jù))(你所選中的下一跳出現(xiàn)的數(shù)據(jù))
shift-k -- prev toucher of data( 前一個觸發(fā)的數(shù)據(jù))

m -- go to return from current function#到調(diào)用函數(shù)的返回位置
, -- go to start of current function#到#到函數(shù)的開始的位置

z -- zoom out max on vtimeline

left  -- -1 fork 有多個調(diào)試程序的分支(可以左右移動對比分支)
right -- +1 fork(對比分支想右移動)
up    -- -1 clnum(向上移動指令)---移動的是藍(lán)色的數(shù)字序列號
down  -- +1 clnum(向下移動指令)

esc -- back(返回)

shift-c -- clear all forks(清除所有的分支)

n -- rename instruction(給指令重命名)
shift-n -- rename data(給數(shù)據(jù)重命名)---這個的功能包含了上一條,剛覺沒什么用。
: -- add comment at instruction(直接跳轉(zhuǎn)到你想要的命令)
shift-: -- add comment at data

g -- go to change, address, or name
space -- toggle flat/function view

p -- analyze function at iaddr (使用-Ss 左下角的框里.用來分析16進(jìn)制字符結(jié)構(gòu)體,具體實現(xiàn)的什么功能)
c -- make code at iaddr, one instruction(分析16進(jìn)制字符結(jié)構(gòu)體,看看它實現(xiàn)的是什么指令)
a -- make ascii at iaddr (把一個 iaddr內(nèi)容變成 ascii (這個不知道是干什么))
d -- make data at iaddr(把 iaddr內(nèi)容換成數(shù)據(jù))(變換只有使用-Ss 左下角的框里才能看見)
u -- make undefined at iaddr(把 iaddr內(nèi)容換成為未定義的數(shù)字,同樣也只能在左下角的框里能看見)

Session state

clnum -- selected changelist number
forknum -- selected fork number
iaddr -- selected instruction address
daddr -- selected data address

cview -- viewed changelists in the vtimeline
dview -- viewed window into data in the hexeditor
iview -- viewed address in the static view

max_clnum -- max changelist number for each fork
dirtyiaddr -- whether we should update the clnum based on the iaddr or not
flat -- if we are in flat view

qira+ida:
qira沒有靜態(tài)調(diào)試,但是我們使用ida的插件,就對靜態(tài)分析有一個很好的補充。也可以說是互相補充。

在qira的插件里有以下兩個文件:

插件).png

我們將(qira_ida66_windows.p64,qira_ida66_windows.plw)放入ida的插件文件夾里。

ida +qira

注意:我們啟動qira的時候,同時讓ida加載所調(diào)試的程序,這樣我們就能同時,并且聯(lián)動的調(diào)試程序。

2014年的CTF上Geohot搭配使用Qira,在45分鐘內(nèi)解決了HITCON團隊在3天都破解不了的難題。資安專家Husky表示,Qira的目的為加速除錯程序,因為傳統(tǒng)的工具如GDB,雖然亦可以用於CTF競賽,但是在速度上卻不及Qira

相關(guān)為解決問題:

pin問題

鏈接問題:https://github.com/geohot/qira/pull/23

差異問題

鏈接:https://github.com/geohot/qira/commit/0c584f7fbbc9c7db360a8095f606368810eedd1a

????????????????????????????????????????????????????????????
這個網(wǎng)站很有意思(學(xué)習(xí)用):
http://www.voidcn.com/article/p-sjicdsjy-wy.html

qira 安裝:https://www.techbliss.org/threads/qira.547/
https://libraries.io/github/UNwS/qira
qira交流網(wǎng)站:
https://gitter.im/BinaryAnalysisPlatform/qira/
另外一個qira開發(fā)網(wǎng)站:
https://github.com/Escapingbug/qira/
qira相關(guān)問題交流解決網(wǎng)站:
https://github.com/BinaryAnalysisPlatform/qira/issues
https://news.ycombinator.com/item?id=11000312

用IDA Pro處理Qira(韓國人寫的):
http://namdaehyeon.tistory.com/111
(日本人寫的)
http://inaz2.hatenablog.com/entry/2016/03/17/230906
qira簡介(做ppt可以用到):
http://gnu-cse.tistory.com/20
http://tribal1012.tistory.com/85

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Ubuntu安裝ida pro:
http://blog.csdn.net/pl19920614/article/details/56282996
http://www.cnblogs.com/ryuasuka/p/5493371.html
ida下載網(wǎng)站:
https://down.52pojie.cn/Tools/Disassemblers/
逆向所使用的工具:
https://www.52pojie.cn/forum.php?mod=forumdisplay&fid=4&filter=typeid&typeid=123

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容