GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — linuxKernelRoot/ida_patch_cmd_creator/IDAPythonScripHelper.h at master · ptr-ptr/linuxKernelRoot Expand file tree/ Copy pathIDAPythonScripHelper.hMore file actions 60 lines (52 loc) · 1.44 KB / Copy pathIDAPythonScripHelper.hFile metadata and controls60 lines (52 loc) · 1.44 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 #ifndef IDA_PYTHON_SCRIPT_HELPER_H_ #define IDA_PYTHON_SCRIPT_HELPER_H_ #include <string> #include <windows.h> #include <fstream> #include <sstream> inline std::string& replace_all_distinct(std::string& str, const std::string& old_value, const std::string& new_value) { for (std::string::size_type pos(0); pos != std::string::npos; pos += new_value.length()) { if ((pos = str.find(old_value, pos)) != std::string::npos) { str.replace(pos, old_value.length(), new_value); } else { break; } } return str; } std::string GetFormatAsmBytes(const std::string & strAsmBytesLine) { if (strAsmBytesLine.length() % 2) { return std::string(); } std::stringstream ssFormatBytesTxt; int n = 0; for (size_t i = 0; i < strAsmBytesLine.length(); i++) { ssFormatBytesTxt << strAsmBytesLine[i]; n++; if (n == 2 && i != strAsmBytesLine.length() - 1) { ssFormatBytesTxt << " "; n = 0; } } return ssFormatBytesTxt.str(); } std::string GetIdaAsmScript(const std::string & strBytes, size_t writeAddr) { std::string formatBytes = GetFormatAsmBytes(strBytes); std::stringstream ssScript; ssScript << "buf = [0x" << replace_all_distinct(formatBytes, " ", ", 0x") << "]" << std::endl << "for index in range(len(buf)) :" << std::endl << "\t" << "patch_byte(0x" << std::hex << writeAddr << " + index, buf[index]);"; return ssScript.str(); } #endif /* IDA_PYTHON_SCRIPT_HELPER_H_ */ |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |