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

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

?? python.cpp

?? The sources of IDAPython, a plugin for IDA for using python for scripting in IDA, instead of IDC.
?? CPP
字號:
//------------------------------------------------------------
// IDAPython - Python plugin for Interactive Disassembler Pro
//
// Copyright (c) 2004-2008 Gergely Erdelyi <dyce@d-dome.net> 
//
// All rights reserved.
//
// For detailed copyright information see the file COPYING in
// the root of the distribution archive.
//------------------------------------------------------------
// python.cpp - Main plugin code
//------------------------------------------------------------
#include <Python.h>

/* This define fixes the redefinition of ssize_t */
#ifdef HAVE_SSIZE_T
#define _SSIZE_T_DEFINED 1
#endif

#include <stdio.h>
#include <string.h>
#include <ida.hpp>
#include <idp.hpp>
#include <bytes.hpp>
#include <diskio.hpp>
#include <expr.hpp>
#include <loader.hpp>
#include <kernwin.hpp>
#include <netnode.hpp>

#ifdef __cplusplus
extern "C"
#endif

/* Python-style version tuple comes from the makefile */
/* Only the serial and status is set here */
#define VER_SERIAL 0
#define VER_STATUS "final"

#define IDAPYTHON_RUNFILE      0
#define IDAPYTHON_RUNSTATEMENT 1
#define IDAPYTHON_SCRIPTBOX    2

#define IDAPYTHON_DATA_STATEMENT 0


void init_idaapi(void);
void idaapi run(int arg);

static int initialized = 0;


/* This is a simple tracing code for debugging purposes. */
/* It might evolve into a tracing facility for user scripts. */
/* #define ENABLE_PYTHON_PROFILING */

#ifdef ENABLE_PYTHON_PROFILING
#include "compile.h"
#include "frameobject.h"

int tracefunc(PyObject *obj, _frame *frame, int what, PyObject *arg)
{
	PyObject *str;

	/* Catch line change events. */
	/* Print the filename and line number */	
	if (what == PyTrace_LINE)
	{
		str = PyObject_Str(frame->f_code->co_filename);
		if (str)
		{
			msg("PROFILING: %s:%d\n", PyString_AsString(str), frame->f_lineno);
			Py_DECREF(str);
		}
	}
	return 0;
}
#endif

/* Simple Python statement runner function for IDC */
static const char idc_runpythonstatement_args[] = { VT_STR, 0 };
static error_t idaapi idc_runpythonstatement(value_t *argv, value_t *res)
{
	res->num = PyRun_SimpleString(argv[0].str);
	return eOk;
}


/* QuickFix for the FILE* incompatibility problem */
int ExecFile(char *FileName)
{
	PyObject* PyFileObject = PyFile_FromString(FileName, "r");

	if (!PyFileObject) 
	{
		return 0;
	}

	if (PyRun_SimpleFile(PyFile_AsFile(PyFileObject), FileName) == 0)
 	{
		Py_DECREF(PyFileObject);
		return 1;
	}
	else
	{
		Py_DECREF(PyFileObject);
		return 0;
	}
}

/* Check for the presence of a file in IDADIR/python */
bool CheckFile(char *filename)
{
	char filepath[MAXSTR+1];

#if IDP_INTERFACE_VERSION >= 75
	qmakepath(filepath, MAXSTR, idadir(NULL), "python", filename, NULL);
#elif IDP_INTERFACE_VERSION >= 69
	qmakepath(filepath, idadir(NULL), "python", filename, NULL);
#else
	qmakepath(filepath, idadir(), "python", filename, NULL);
#endif	

	if (!qfileexist(filepath))
	{
		warning("IDAPython: Missing required file %s", filename);
		return false;
	}

	return true;
}

/* Execute the Python script from the plugin */
/* Default hotkey: Alt-9 */
void IDAPython_RunScript(char *script)
{
	char statement[MAXSTR+32];
	char slashpath[MAXSTR+1];
	char *scriptpath;

	int i;

	if (script)
	{
		scriptpath = script;
	}
	else
	{
		scriptpath = askfile_c(0, "*.py", "Python file to run");

		if (!scriptpath)
		{
			return;
		}
	}

	/* Make a copy of the path with '\\' => '/' */
	for (i=0; scriptpath[i]; i++)
	{
		if (scriptpath[i] == '\\')
		{
			slashpath[i] = '/';
		}
		else
		{
			slashpath[i] = scriptpath[i];
		}
	}
	
	slashpath[i] = '\0';

	/* Add the script't path to sys.path */	
	snprintf(statement, sizeof(statement), "runscript(\"%s\")", slashpath);
	PyRun_SimpleString(statement);

	/* Error handling */
	if (PyErr_Occurred())
	{
		PyErr_Print();
	}

}


/* Execute Python statement(s) from an editor window */
/* Default hotkey: Alt-8 */
void IDAPython_RunStatement(void)
{
	char statement[4096];
	netnode history;

	/* Get the existing or create a new netnode in the database */
	history.create("IDAPython_Data");

	/* Fetch the previous statement */
	if (history.supval(IDAPYTHON_DATA_STATEMENT, statement, sizeof(statement)) == -1)
	{
		statement[0] = '\0';
	}

	if (asktext(sizeof(statement), statement, statement, "Enter Python expressions"))
	{
		PyRun_SimpleString(statement);
		/* Store the statement to the database */
		history.supset(IDAPYTHON_DATA_STATEMENT, statement);
	}
}

/* History of previously executed scripts */
/* Default hotkey: Alt-7 */
void IDAPython_ScriptBox(void)
{
	PyObject *module;
	PyObject *dict;
	PyObject *scriptbox;
	PyObject *pystr;

	/* Get globals() */
	/* These two should never fail */
	module = PyImport_AddModule("__main__");
	dict = PyModule_GetDict(module);

	scriptbox = PyDict_GetItemString(dict, "ScriptBox_instance");

	if (!scriptbox)
	{
		warning("INTERNAL ERROR: ScriptBox_instance missing! Broken init.py?");
		return;
	}

	pystr = PyObject_CallMethod(scriptbox, "run", "");

	if (pystr)
	{
		/* If the return value is string use it as path */
		if (PyObject_TypeCheck(pystr, &PyString_Type))
		{
			ExecFile(PyString_AsString(pystr));
		}
		Py_DECREF(pystr);
	}
	else
	{
		/* Print the exception info */
		if (PyErr_Occurred())
		{
			PyErr_Print();
		}
	}
}	

bool idaapi IDAPython_Menu_Callback(void *ud)
{
	run((int)ud);
	return true;
}


/* Initialize the Python environment */
bool IDAPython_Init(void)
{
	char *options;
	char tmp[MAXSTR+64];
	char *initpath;
	bool result = 1;
	
	/* Already initialized? */
	if (initialized == 1)
	{
		return true;
	}

	/* Check for the presence of essential files */
	initialized = 0;

	result &= CheckFile("idc.py");
	result &= CheckFile("init.py");
	result &= CheckFile("idaapi.py");
	result &= CheckFile("idautils.py");

	if (!result)
	{
		return false;
	}
	
	/* Start the interpreter */
	Py_Initialize();

	if (!Py_IsInitialized())
	{
		warning("IDAPython: Py_Initialize() failed");
		return false;
	}

	/* Init the SWIG wrapper */
	init_idaapi();

	sprintf(tmp, "IDAPYTHON_VERSION=(%d, %d, %d, '%s', %d)", \
			VER_MAJOR,
			VER_MINOR,
			VER_PATCH,
			VER_STATUS,
			VER_SERIAL);

	PyRun_SimpleString(tmp);

#if IDP_INTERFACE_VERSION >= 75
	qmakepath(tmp, MAXSTR, idadir("python"), "init.py", NULL);
#elif IDP_INTERFACE_VERSION >= 69
	qmakepath(tmp, idadir("python"), "init.py", NULL);
#else
	qmakepath(tmp, idadir(), "python", "init.py", NULL);
#endif

	/* Pull in the Python side of init */
	if (!ExecFile(tmp))
	{
		warning("IDAPython: error executing init.py");
		return false;
	}

#ifdef ENABLE_PYTHON_PROFILING
	PyEval_SetTrace(tracefunc, NULL);
#endif

	/* Batch-mode operation: */
	/* A script specified on the command line is run */
	options = (char *)get_plugin_options("IDAPython");

	if (options)
	{
		IDAPython_RunScript(options);
	}

	/* Add menu items for all the functions */
	/* Different paths are used for the GUI version */
	result = add_menu_item("File/IDC command...", "P~y~thon command...", 
					"Alt-8", SETMENU_APP, 
					(menu_item_callback_t *)IDAPython_Menu_Callback, 
					(void *)IDAPYTHON_RUNSTATEMENT);

	result = add_menu_item("File/Load file/IDC file...", "P~y~thon file...", 
					"Alt-9", SETMENU_APP, 
					(menu_item_callback_t *)IDAPython_Menu_Callback, 
					(void *)IDAPYTHON_RUNFILE); 
	
	if (!result)
	{
		add_menu_item("File/IDC command...", "P~y~thon file...", 
					"Alt-9", SETMENU_APP, 
					(menu_item_callback_t *)IDAPython_Menu_Callback, 
					(void *)IDAPYTHON_RUNFILE); 
	}

	result = add_menu_item("View/Open subviews/Show strings", "Python S~c~ripts", 
					"Alt-7", SETMENU_APP, 
					(menu_item_callback_t *)IDAPython_Menu_Callback, 
					(void *)IDAPYTHON_SCRIPTBOX); 
	
	if (!result) 
	{
		add_menu_item("View/Open subviews/Problems", "Python S~c~ripts", 
						"Alt-7", SETMENU_APP, 
						(menu_item_callback_t *)IDAPython_Menu_Callback, 
						(void *)IDAPYTHON_SCRIPTBOX); 
	}

	/* Register a RunPythonStatement() function for IDC */
	set_idc_func("RunPythonStatement", idc_runpythonstatement, idc_runpythonstatement_args);
	
	initialized = 1;

	return true;
}

/* Cleaning up Python */
void IDAPython_Term(void)
{
	/* Remove the menu items before termination */
	del_menu_item("File/Load file/Python file...");
	del_menu_item("File/Python file...");
	del_menu_item("File/Python command...");
	del_menu_item("View/Open subviews/Python Scripts");
	
	/* Shut the interpreter down */
	Py_Finalize();

	initialized = 0;
}

/* Plugin init routine */
int idaapi init(void)
{
	if (IDAPython_Init())
	{
		return PLUGIN_KEEP;
	}
	else
	{
		return PLUGIN_SKIP;
	}
}

/* Plugin term routine */
void idaapi term(void)
{
	IDAPython_Term();
}

/* Plugin hotkey entry point */
void idaapi run(int arg)
{
	try
	{
		switch (arg)
		{
			case 0:
				IDAPython_RunScript(NULL);
				break;
				;;
			case 1:
				IDAPython_RunStatement();
				break;
				;;
			case 2:
				IDAPython_ScriptBox();
				break;
				;;
			default:
				warning("IDAPython: unknown plugin argument %d", arg);
				break;
				;;
		}
	}
	catch(...)
	{
		warning("Exception in Python interpreter. Reloading...");
		IDAPython_Term();
		IDAPython_Init();
	}
}

//--------------------------------------------------------------------------
// PLUGIN DESCRIPTION BLOCK
//--------------------------------------------------------------------------
char comment[]       = "IDAPython";
char help[]          = "IDA Python Plugin\n";
char wanted_name[]   = "IDAPython";
char wanted_hotkey[] = "Alt-9";

extern "C"
{
plugin_t PLUGIN = {
  IDP_INTERFACE_VERSION,
  0,                    // plugin flags
  init,                 // initialize

  term,                 // terminate. this pointer may be NULL.

  run,                  // invoke plugin

  comment,              // long comment about the plugin
                        // it could appear in the status line
                        // or as a hint

  help,                 // multiline help about the plugin

  wanted_name,          // the preferred short name of the plugin
  wanted_hotkey         // the preferred hotkey to run the plugin
};
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久五月天| 亚洲1区2区3区4区| 午夜视黄欧洲亚洲| 丰满放荡岳乱妇91ww| 欧美色老头old∨ideo| 中文字幕欧美国产| 日韩电影在线免费看| 91浏览器入口在线观看| 久久九九影视网| 日本午夜一本久久久综合| 91高清在线观看| 一色桃子久久精品亚洲| 国产一区二区伦理| 欧美一区二区免费视频| 亚洲成年人影院| 在线视频你懂得一区二区三区| 国产亚洲成av人在线观看导航| 日本aⅴ精品一区二区三区| 欧美性色黄大片手机版| 亚洲色图色小说| 99久久久久免费精品国产 | 亚洲欧美国产77777| 久久99久久久久久久久久久| 欧美三区在线视频| 亚洲另类在线制服丝袜| 一本大道久久a久久精二百| 中文字幕视频一区二区三区久| 国精产品一区一区三区mba视频| 日韩一级二级三级| 喷白浆一区二区| 精品久久久久久最新网址| 蜜臀久久久99精品久久久久久| 91精品欧美福利在线观看| 日韩影视精彩在线| 国产女主播视频一区二区| 另类的小说在线视频另类成人小视频在线| 欧美日韩黄视频| 日韩国产高清影视| 日韩视频一区在线观看| 激情欧美日韩一区二区| 2023国产精品自拍| 成人禁用看黄a在线| 国产精品久久久久久久久免费相片 | 午夜成人免费电影| 欧美一区二区三区小说| 狠狠色狠狠色综合系列| 国产三级一区二区| www.日韩av| 午夜精品久久久久久久久久| 欧美一区二区国产| 国产一区二区三区免费观看| 国产精品久久久久久亚洲伦| 91欧美激情一区二区三区成人| 亚洲一区二区三区不卡国产欧美| 69精品人人人人| 国产精品影视在线| 亚洲影视在线观看| 欧美v日韩v国产v| 成人免费视频app| 午夜婷婷国产麻豆精品| 精品美女一区二区| 色天使色偷偷av一区二区| 男男视频亚洲欧美| 中文一区二区完整视频在线观看| 欧美在线免费播放| 国产麻豆成人传媒免费观看| 一区二区三区在线观看动漫| 日韩欧美不卡一区| 91在线观看视频| 麻豆91在线播放免费| 中文字幕制服丝袜成人av| 欧美日本视频在线| 岛国精品在线播放| 日本中文字幕不卡| 亚洲日本在线a| 2020国产精品久久精品美国| 在线中文字幕一区二区| 国产麻豆一精品一av一免费| 亚洲观看高清完整版在线观看 | 91精品国产欧美一区二区18| 国产99精品视频| 日本麻豆一区二区三区视频| 国产精品动漫网站| 精品国产一区二区三区四区四| 91麻豆国产精品久久| 国产一区二区在线免费观看| 视频在线观看一区| 一区二区三国产精华液| 国产精品免费aⅴ片在线观看| 日韩一级片在线播放| 欧美亚洲免费在线一区| 91在线观看下载| 国产成人免费高清| 国产自产高清不卡| 秋霞电影网一区二区| 亚洲国产一区二区三区青草影视| 国产精品久久午夜夜伦鲁鲁| 精品国产凹凸成av人导航| 欧美精品乱码久久久久久按摩| 精品国产一二三区| 制服丝袜av成人在线看| 欧美天天综合网| 91国偷自产一区二区三区观看| 成人精品国产一区二区4080| 国产成人精品www牛牛影视| 国精品**一区二区三区在线蜜桃| 美女网站视频久久| 久久精品免费观看| 日本不卡的三区四区五区| 无码av中文一区二区三区桃花岛| 亚洲国产精品视频| 亚洲va天堂va国产va久| 日欧美一区二区| 午夜精品久久久久影视| 视频一区二区国产| 蜜桃视频一区二区三区| 精品一区二区日韩| 国产乱码精品一区二区三区五月婷| 麻豆免费看一区二区三区| 捆绑变态av一区二区三区| 久久99久国产精品黄毛片色诱| 精久久久久久久久久久| 国产精品自拍在线| 成人激情免费视频| 色一区在线观看| 欧美日韩一区二区欧美激情| 7878成人国产在线观看| 日韩视频中午一区| 欧美xxxx在线观看| 中文字幕精品一区二区精品绿巨人 | 精品成人免费观看| 久久亚洲欧美国产精品乐播 | 2023国产精品| 国产精品久久久久久久久免费丝袜 | 国产综合色视频| 国产成人综合在线| 日本高清免费不卡视频| 欧美日韩免费观看一区二区三区| 欧美亚洲禁片免费| 欧美成人精品3d动漫h| 国产三级一区二区| 亚洲综合一区二区精品导航| 日本美女一区二区| 成人在线视频一区二区| 欧美性受xxxx| 精品国精品国产| 亚洲欧洲日产国码二区| 亚洲第四色夜色| 国产成人夜色高潮福利影视| 色婷婷精品久久二区二区蜜臀av| 4438x亚洲最大成人网| 国产亚洲成av人在线观看导航| 亚洲日本在线a| 久久99精品视频| 91国产成人在线| 国产日韩欧美精品电影三级在线| 一区二区三区中文字幕在线观看| 久久国产婷婷国产香蕉| 色哟哟一区二区在线观看| 欧美mv日韩mv亚洲| 亚洲高清不卡在线| 成人精品视频一区二区三区 | 国产剧情一区二区| 在线视频国内一区二区| 国产亚洲综合在线| 五月天一区二区三区| www.亚洲人| 久久婷婷成人综合色| 亚瑟在线精品视频| 精品卡一卡二卡三卡四在线| 亚洲午夜久久久久久久久电影院| 国产传媒久久文化传媒| 欧美岛国在线观看| 亚洲风情在线资源站| 91色porny| 亚洲国产精品99久久久久久久久| 日韩av一区二区在线影视| 一本到三区不卡视频| 国产亚洲欧美在线| 精品亚洲免费视频| 欧美精品色一区二区三区| 亚洲黄色免费网站| 一本一道综合狠狠老| 国产精品蜜臀在线观看| 国产福利不卡视频| wwwwww.欧美系列| 久久精品72免费观看| 91麻豆精品国产91久久久久| 一区二区三区免费| 色婷婷av一区二区| 一区二区在线观看不卡| 91麻豆swag| 亚洲精品视频自拍| 91黄色在线观看| 玉米视频成人免费看| 色哟哟国产精品| 亚洲午夜激情网页| 欧美丝袜第三区| 石原莉奈在线亚洲二区| 欧美另类变人与禽xxxxx|