📄 nc-opdis.c
字号:
/* fenris - program execution path analysis tool --------------------------------------------- Copyright (C) 2001, 2002 by Bindview Corporation Portions copyright (C) 2001, 2002 by their respective contributors Developed and maintained by Michal Zalewski <lcamtuf@coredump.cx> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. This code is taken from cxmon utility, http://www.uni-mainz.de/~bauec002/, written by Christian Bauer and Marc Hellwig. Most of their code was taken from GNU binutils libopcode for i386, which is probably authored mostly by Pace Willisson. I made several changes, changed the notation a bit and removed some code, but I'm not the one to take credit for the functionality of this code (or lack of thereof ;-).*/#include <stdarg.h>#include <ncurses.h>#include "nasm/disasm.h"#include "nasm/insns.h" // for pref cpuextern char* describe_address(unsigned int addr);int wdisass_x86(WINDOW * w, unsigned int adr) { char outbuf[256]; long lendis; char* x; lendis = disasm((unsigned char*) adr, outbuf, 32, adr, FALSE, IF_PENT); wprintw(w,"%08x",adr); x=describe_address(adr); if (strlen(x)) wprintw(w," [%s]",x); wprintw(w, ": \t%s\n", outbuf); return lendis;}void wdisass (const char* buf,unsigned int addr,unsigned int len,WINDOW *w) { int add=addr; while (add <= addr+len){ add+=wdisass_x86(w,add); }}int w1disass (const char* buf, unsigned int addr, WINDOW * w){ return wdisass_x86(w,addr);}int getopsize (const char* buf, unsigned int addr){ char outbuf[256]; long lendis; char* x; lendis = disasm((unsigned char*) addr, outbuf, 32, addr, FALSE, IF_PENT); return lendis;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -