亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? memoryregions.cpp

?? EDB (Evan s Debugger) is a QT4 based binary mode debugger with the goal of having usability on par w
?? CPP
字號:
/*Copyright (C) 2006 Evan Teran                   eteran@alum.rit.eduThis program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.*/#include "MemoryRegions.h"#include "SymbolManager.h"#include "DebuggerCoreInterface.h"#include "Debugger.h"#include "Util.h"#include "State.h"#include <sstream>#include <iostream>#include <string>#include <asm/unistd.h>#include <sys/mman.h>#include <QApplication>#include <QFile>#include <QTextStream>#include <QMessageBox>const unsigned int MemoryRegions::Region::READ	= PROT_READ;const unsigned int MemoryRegions::Region::WRITE	= PROT_WRITE;const unsigned int MemoryRegions::Region::EXEC	= PROT_EXEC;struct BackupInfo {	char 						*buffer;	std::size_t					size;	BaseTypes::address_t		tempAddress;	uint32_t					perms;	State						state;	DebugEventHandlerInterface	*eventhandler;};//------------------------------------------------------------------------------// Name: MemoryRegions(BaseTypes::pid_t pid)// Desc: constructor//------------------------------------------------------------------------------MemoryRegions::MemoryRegions(BaseTypes::pid_t pid) : m_PID(pid) {	sync();}//------------------------------------------------------------------------------// Name: proccessMapLine(QString &line)// Desc: parses the data from a line of a memory map file//------------------------------------------------------------------------------void MemoryRegions::proccessMapLine(QString &line) {	// TODO: use QT's way of doing this	std::istringstream ss(qPrintable(line));	std::string perms;	Region region;	// read the starting address in hex	if(ss >> std::hex >> region.start) {			// skip the dash		if(ss.ignore(1)) {					// read the ending address and then the permissions			if(ss >> std::hex >> region.end >> perms) {				std::string temp[2];				std::string name;								// read in the region base, then skip the next two fields				if(ss >> region.base >> temp[0] >> temp[1]) {									// read in the name, we dont check for success because it's					// allowed to not be there (and would therefore be the 					// empty string)					ss >> name;					// create a bitmask for the permissions					region.permissions = 0;					if(perms[0] == 'r') region.permissions |= Region::READ;					if(perms[1] == 'w') region.permissions |= Region::WRITE;					if(perms[2] == 'x') region.permissions |= Region::EXEC;					region.name = name.c_str();					m_Regions.push_back(region);					// TODO: make this happen less often!					if(!region.name.isEmpty()) {						if(region.base == 0x00000000) {							if(region.executable()) {								if(Debugger::symbolManager != 0) {									Debugger::symbolManager->loadSymbolFile(region.name, region.start);								}							}						}					}				}			}		}	}}//------------------------------------------------------------------------------// Name: sync()// Desc: reads a memory map file line by line//------------------------------------------------------------------------------void MemoryRegions::sync() {	m_Regions.clear();	if(m_PID != 0) {		const QString mapFile(QString().sprintf("/proc/%d/maps", m_PID));				QFile file(mapFile);        if(file.open(QIODevice::ReadOnly | QIODevice::Text)) {					QTextStream in(&file);			QString line = in.readLine();					while (!line.isNull()) {				proccessMapLine(line);				line = in.readLine();			}		}	}}//------------------------------------------------------------------------------// Name: operator==(const Region &o)// Desc: compares two regions for equality//------------------------------------------------------------------------------bool MemoryRegions::Region::operator==(const Region &o) {	return start == o.start && 		end == o.end && 		permissions == o.permissions && 		name == o.name &&		base == o.base;}//------------------------------------------------------------------------------// Name: handleEvent(DebugEvent event)// Desc: //------------------------------------------------------------------------------void MemoryRegions::Region::handleEvent(DebugEvent event) {	Q_UNUSED(event);		// TODO: check that the event was caused by a hlt in our shellcode		if(backupInfo != 0) {			// restore the original code and register state		Debugger::debuggerBase->writeBytes(backupInfo->tempAddress, backupInfo->buffer, backupInfo->size);		Debugger::debuggerBase->setState(backupInfo->state);		// update permissions mask		permissions = backupInfo->perms;		// restore the event handler		Debugger::setDebugEventHandler(backupInfo->eventhandler);		safeDeleteArray(backupInfo->buffer);		safeDelete(backupInfo);	}		lock = 0;}//------------------------------------------------------------------------------// Name: ~Region()// Desc: //------------------------------------------------------------------------------MemoryRegions::Region::~Region() {	if(backupInfo != 0) {				safeDeleteArray(backupInfo->buffer);		safeDelete(backupInfo);	}}//------------------------------------------------------------------------------// Name: setPermissions(bool read, bool write, bool execute)// Desc: attempts to change the permissions of a given region by injecting//       shellcode into the debugged process, and executing a mprotect syscall//       we probably need to ensure that the debug event server thread is not//       waiting for an event at this moment because we need to catch the "hlt"//       instruction we injected in order to restore the original code//       we also probably need this code to work perfectly in order to implement//       memory access breakpoints//------------------------------------------------------------------------------void MemoryRegions::Region::setPermissions(bool read, bool write, bool execute, BaseTypes::address_t tempAddress) {#ifdef Q_OS_LINUX	uint32_t perms = 0;	const uint32_t len = size();	const uint32_t addr = start;	const uint32_t syscallnum = __NR_mprotect;		if(read)	perms |= READ;	if(write)	perms |= WRITE;	if(execute)	perms |= EXEC;		// start nowhere near portable code	#define LEN_OFFSET		1	#define ADDR_OFFSET		6	#define PERM_OFFSET		11	#define SYSCALL_OFFSET	16		// TODO: only compile this code on x86	char shellcode[] = {		"\xb9\x00\x10\x00\x00"	// mov    $0x00001000,%ecx		"\xbb\x00\x40\x00\x00"	// mov    $0x00004000,%ebx		"\xba\x07\x00\x00\x00"	// mov    $0x00000007,%edx		"\xb8\x7d\x00\x00\x00"	// mov    $0x7d,%eax		"\xcd\x80"				// int    $0x80		"\xf4"					// hlt	};				// put the data in the right part of the shellcode	std::memcpy(&shellcode[LEN_OFFSET], &len, sizeof(len));	std::memcpy(&shellcode[ADDR_OFFSET], &addr, sizeof(addr));	std::memcpy(&shellcode[PERM_OFFSET], &perms, sizeof(perms));	std::memcpy(&shellcode[SYSCALL_OFFSET], &syscallnum, sizeof(syscallnum));		#undef LEN_OFFSET	#undef ADDR_OFFSET	#undef PERM_OFFSET	#undef SYSCALL_OFFSET	// end nowhere near portable code		backupInfo				= new BackupInfo;	backupInfo->buffer		= new char[sizeof(shellcode)];	backupInfo->size		= sizeof(shellcode);	backupInfo->tempAddress	= tempAddress;	backupInfo->perms		= perms;		// get the current register state of the process	Debugger::debuggerBase->getState(backupInfo->state);		// backup the bytes currently at our temp address	if(Debugger::debuggerBase->readBytes(tempAddress, backupInfo->buffer, backupInfo->size)) {			// write out our shellcode		if(Debugger::debuggerBase->writeBytes(tempAddress, shellcode, sizeof(shellcode))) {			// set eip in the state to out temp address			const uint32_t orig_eip = backupInfo->state.eip;			backupInfo->state.eip = tempAddress;			Debugger::debuggerBase->setState(backupInfo->state);			backupInfo->state.eip = orig_eip;			lock = 1;			backupInfo->eventhandler = Debugger::setDebugEventHandler(this);			// run and wait for the "crash" caused by the hlt instruction			// should be a SIGSEGV on Linux			Debugger::debuggerBase->resume(0);			// this is a crappy solution but it works good enough for now					while(lock) {				QApplication::processEvents();			}			return;		}	}			// we only get here if something was not successful, start cleaning up		if(backupInfo != 0) {		safeDeleteArray(backupInfo->buffer);		safeDelete(backupInfo);	}#else	#error "Unsupported Platform"#endif}//------------------------------------------------------------------------------// Name: setPermissions(bool read, bool write, bool execute)// Desc: wrapper around normal set permissions//------------------------------------------------------------------------------void MemoryRegions::Region::setPermissions(bool read, bool write, bool execute) {	BaseTypes::address_t tempAddress = 0x00000000;	int count = 0;	int ret = QMessageBox::Yes;	const QVector<Region> regions = Debugger::memoryRegions->regions();		// search for an executable region to run our shell code	foreach(Region region, regions) {		if(region.executable()) {			if(tempAddress == 0x00000000) {				tempAddress = region.start;			}			++count;		}	}		if(count == 1 && !execute) {		ret = QMessageBox::question(Debugger::debuggerGUI, "Removing Execute Permissions On Last Executable Region",			"You are about to remove execute permissions from the last executable region. Because of the need "			"to run code in the process to change permissions, there will be no way to undo this. In addition, "			"the process will no longer be able to run as it will have no execute permissions in any regions. "			"Odds are this is not what you want to do."			"Are you sure you want to remove execute permissions from this region?",			QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);	}		if(ret == QMessageBox::Yes) {		if(tempAddress != 0x00000000) {			setPermissions(read, write, execute, tempAddress);		} else {			QMessageBox::information(Debugger::debuggerGUI, "No Suitable Address Found", "This feature relies on running shellcode in the debugged process, no executable memory region was found. Unfortunately, this means that no more region permission changes can be made (it also means that there is nothing the process can continue to do since it cannot execute at all).");		}	}}//------------------------------------------------------------------------------// Name: findBaseAddress(const QString &name, bool *ok) const// Desc: //------------------------------------------------------------------------------BaseTypes::address_t MemoryRegions::findBaseAddress(const QString &name, bool *ok) const {		setBool(ok, false);		QVector<Region> r = regions();	foreach(Region region, r) {		if(region.base == 0x00000000) {			if(region.name.endsWith(name)) {				setBool(ok, true);				return region.start;			}		}	}	return 0x00000000;}//------------------------------------------------------------------------------// Name: findRegion(BaseTypes::address_t address) const// Desc: //------------------------------------------------------------------------------bool MemoryRegions::findRegion(BaseTypes::address_t address) const {	QVector<Region> r = regions();	foreach(Region i, r) {		if(address >= i.start && address < i.end) {			return true;		}	}	return false;}//------------------------------------------------------------------------------// Name: findRegion(BaseTypes::address_t address, MemoryRegions::Region &region) const// Desc: //------------------------------------------------------------------------------bool MemoryRegions::findRegion(BaseTypes::address_t address, MemoryRegions::Region &region) const {	QVector<Region> r = regions();	foreach(Region i, r) {		if(address >= i.start && address < i.end) {			region = i;			return true;		}	}	return false;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久网| 国产精品久久久久久久久晋中| 这里只有精品99re| 欧美va亚洲va| 亚洲一线二线三线久久久| 国产高清不卡二三区| 欧美日韩国产免费一区二区| 欧美国产国产综合| 天天色图综合网| 色综合天天狠狠| 国产午夜亚洲精品羞羞网站| 五月开心婷婷久久| 色综合一区二区| 亚洲国产电影在线观看| 六月丁香综合在线视频| 精品视频在线免费| 亚洲精品伦理在线| 99久久国产综合精品色伊| 亚洲精品成人在线| 成人国产免费视频| 久久久五月婷婷| 另类欧美日韩国产在线| 国产亚洲成年网址在线观看| 日韩精品1区2区3区| 色偷偷久久人人79超碰人人澡| 中文字幕国产一区二区| 国产成人免费在线观看| 亚洲精品在线观| 国产精品综合一区二区| 亚洲精品在线电影| 国产一区视频在线看| www成人在线观看| 韩国精品在线观看| 久久久久久久综合日本| 国产一区二区毛片| 国产日本欧美一区二区| 成人激情开心网| 成人欧美一区二区三区小说 | 国产精品乱码妇女bbbb| 国产剧情av麻豆香蕉精品| 久久亚洲综合色一区二区三区 | 成人av网站免费观看| 欧美成人精品3d动漫h| 日日夜夜精品视频天天综合网| 欧美精选午夜久久久乱码6080| 午夜激情综合网| 日韩三级免费观看| 国产一区二区免费视频| 国产精品蜜臀av| 在线观看av一区二区| 午夜精品久久久久久| 日韩视频在线观看一区二区| 国产精品自拍毛片| 中文字幕一区二区三区四区| 欧美影片第一页| 美女被吸乳得到大胸91| 国产亚洲欧美一区在线观看| www.一区二区| 日韩av不卡一区二区| 2019国产精品| 91丨九色丨国产丨porny| 亚洲成人三级小说| 久久久久久久电影| 91极品视觉盛宴| 久久99精品一区二区三区| 国产精品视频免费| 欧美日韩和欧美的一区二区| 国产精品一区专区| 亚洲一区二区四区蜜桃| 精品伦理精品一区| 色哟哟亚洲精品| 精品一区二区免费| 亚洲综合激情网| 久久亚洲二区三区| 欧美色精品在线视频| 国产老妇另类xxxxx| 亚洲高清在线视频| 国产精品国产三级国产专播品爱网| 欧美人成免费网站| av电影在线观看完整版一区二区 | 中文字幕欧美激情| 欧美精品777| 99久久99久久精品免费观看| 免费成人小视频| 亚洲综合色视频| 国产精品天美传媒| 精品国产免费一区二区三区香蕉| 91老师国产黑色丝袜在线| 国产在线播精品第三| 亚洲不卡av一区二区三区| 国产精品成人一区二区艾草| 337p粉嫩大胆噜噜噜噜噜91av | 国产一区二区女| 视频一区中文字幕| 亚洲卡通动漫在线| 国产日产欧美精品一区二区三区| 欧美一区二区三区精品| 91成人在线观看喷潮| 成人激情综合网站| 国产精品资源网站| 国产一区激情在线| 老司机一区二区| 麻豆成人久久精品二区三区红| 亚洲日本va在线观看| 欧美日韩成人综合天天影院| 99视频精品在线| 成人高清免费观看| 懂色av一区二区夜夜嗨| 国产精品一区久久久久| 精品亚洲免费视频| 久久国产精品免费| 久久99热狠狠色一区二区| 日韩精品成人一区二区在线| 亚洲chinese男男1069| 亚洲午夜久久久久久久久电影院 | 欧美在线观看视频一区二区三区| www.亚洲激情.com| 成人av免费在线播放| av日韩在线网站| 色婷婷av一区二区三区软件| 一本一道久久a久久精品| 91在线视频播放地址| 欧美日韩高清影院| 成人国产精品视频| 成人激情免费视频| 不卡电影一区二区三区| 91原创在线视频| 99riav一区二区三区| 99久久久国产精品免费蜜臀| 不卡av在线网| 在线观看免费成人| 欧美三级欧美一级| 日韩一区二区电影在线| 精品国产一二三| 国产精品理论片在线观看| 中文字幕视频一区| 偷拍自拍另类欧美| 麻豆91免费观看| 成人免费观看av| 色8久久精品久久久久久蜜| 欧美日韩国产经典色站一区二区三区| 欧美日本在线看| 欧美精品一区二区久久婷婷| 久久亚洲一区二区三区明星换脸 | 蜜桃av一区二区| 高清国产一区二区三区| 一本大道久久精品懂色aⅴ| 7777精品久久久大香线蕉| 2欧美一区二区三区在线观看视频| 国产精品看片你懂得| 亚洲大片一区二区三区| 国产精品一品二品| 欧美四级电影在线观看| 久久久精品免费免费| 亚洲亚洲人成综合网络| 国产精品99久久久久久久vr| 在线看不卡av| 精品国产成人在线影院| 一区二区三区四区中文字幕| 蜜臀久久99精品久久久久宅男| 丁香六月久久综合狠狠色| 欧美福利视频导航| 国产精品剧情在线亚洲| 免费在线观看日韩欧美| 91日韩一区二区三区| 久久午夜电影网| 成人精品在线视频观看| 欧美日本一道本在线视频| 国产精品丝袜一区| 精品一区二区综合| 欧美视频中文字幕| 国产精品初高中害羞小美女文| 欧美aaa在线| 欧洲亚洲国产日韩| 中文一区一区三区高中清不卡| 亚洲成av人**亚洲成av**| 99国产麻豆精品| 国产欧美一区二区精品性色 | 国产精品久久久久国产精品日日| 日韩国产欧美在线视频| 色婷婷综合视频在线观看| 国产亚洲精久久久久久| 麻豆精品视频在线观看| 欧美日韩成人在线一区| 亚洲另类色综合网站| 精品一区二区三区在线播放视频| 亚洲一区在线观看视频| 国产成人午夜片在线观看高清观看| 欧美综合一区二区| 1区2区3区欧美| 成人午夜精品一区二区三区| 精品国产不卡一区二区三区| 日本不卡一二三| 制服.丝袜.亚洲.另类.中文 | 亚洲精品一区二区三区四区高清 | 日本欧美一区二区在线观看| 欧美色中文字幕| 亚洲一卡二卡三卡四卡无卡久久 | 国产精品系列在线播放| 2023国产精品视频|