├── .gitattributes ├── idapython ├── reset.py ├── loadlog_diff.py └── loadlog.py ├── IDAPinLogger.sln ├── README.md ├── .gitignore ├── makefile ├── IDAPinLogger.cpp └── IDAPinLogger.vcproj /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /idapython/reset.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pythong 2 | # modified by @_wirepair to 'white out' or diff two IDAPinLogger runs. 3 | import idaapi 4 | import idc 5 | import struct 6 | import colorsys 7 | 8 | def main(): 9 | ida_color = 0xFFFFFFFF 10 | start = FirstSeg() 11 | end = SegEnd(start) 12 | while(start != idc.BADADDR): 13 | 14 | for i in range(start, end): 15 | idc.SetColor(i, CIC_ITEM, ida_color); 16 | start = NextSeg(start) 17 | end = SegEnd(start) 18 | 19 | 20 | 21 | if __name__ == "__main__": 22 | main() 23 | -------------------------------------------------------------------------------- /idapython/loadlog_diff.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pythong 2 | # original author dereko (?) http://deroko.phearless.org/ 3 | # modified by @_wirepair to 'white out' or diff two IDAPinLogger runs. 4 | import idaapi 5 | import idc 6 | import struct 7 | import colorsys 8 | 9 | def main(): 10 | filepath = idaapi.askfile_c(False, "*.*", "Pin log file"); 11 | imagebase = idaapi.get_imagebase(); 12 | try: 13 | f = open(filepath, "rb"); 14 | except: 15 | print("Need log file to parse data..."); 16 | return; 17 | buff = f.read(); 18 | ida_color = 0xFFFFFFFF; 19 | for index in range(0, len(buff)): 20 | exec_count = ord(buff[index]); 21 | if exec_count == 0: 22 | continue; 23 | 24 | exec_count = exec_count / 10; 25 | if exec_count > 11: exec_count = 11; 26 | 27 | idc.SetColor(imagebase + index, CIC_ITEM, ida_color); 28 | 29 | 30 | if __name__ == "__main__": 31 | main(); 32 | -------------------------------------------------------------------------------- /IDAPinLogger.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IDAPinLogger", "IDAPinLogger.vcproj", "{639EF517-FCFC-408E-9500-71F0DC0458DB}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {639EF517-FCFC-408E-9500-71F0DC0458DB}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {639EF517-FCFC-408E-9500-71F0DC0458DB}.Debug|Win32.Build.0 = Debug|Win32 16 | {639EF517-FCFC-408E-9500-71F0DC0458DB}.Debug|x64.ActiveCfg = Debug|x64 17 | {639EF517-FCFC-408E-9500-71F0DC0458DB}.Debug|x64.Build.0 = Debug|x64 18 | {639EF517-FCFC-408E-9500-71F0DC0458DB}.Release|Win32.ActiveCfg = Release|Win32 19 | {639EF517-FCFC-408E-9500-71F0DC0458DB}.Release|Win32.Build.0 = Release|Win32 20 | {639EF517-FCFC-408E-9500-71F0DC0458DB}.Release|x64.ActiveCfg = Release|x64 21 | {639EF517-FCFC-408E-9500-71F0DC0458DB}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | IDAPinLogger: 2 | ================================ 3 | 4 | Author: @_wirepair / isaac.dawson{}gmail.com. 5 | 6 | Keeps a hit count for every instruction executed in a specified module. 7 | If no module is specified, we use the main executable image. 8 | After the program finishes running, we write the buffer of hits out to a file which 9 | then needs to be imported into IDA Pro using dereko's (?) loadlog.py IDAPython script. 10 | 11 | 12 | I feel this method is a bit more simpiler then his (and I was having problems with 13 | certain executables). But who knows maybe i'm doing something wrong :). 14 | 15 | Update: It is now possible to specify when logging should begin/end by giving an offset 16 | to an instruction where, after it is called logging should start. Also by specifying 17 | an end instruction, logging will stop. This makes it much easier to identify code paths 18 | that are taken after a certain point with in the applications life cycle. 19 | 20 | 21 | How to build: 22 | ------------------------- 23 | 24 | Copy this project into your pin source directory: 25 | %pin%\source\tools\IDAPinLogger 26 | Open Visual Studio (2008) and build. 27 | 28 | How to run: 29 | ------------------------- 30 | 31 | Log all hits in nc.exe module: 32 | 33 | c:\pin\pin.exe -t C:\pin\IDAPinLogger.dll -m nc.exe -- nc.exe -l -v -p 999 34 | 35 | or (main exe assumed) 36 | 37 | c:\pin\pin.exe -t C:\pin\IDAPinLogger.dll -- nc.exe -l -v -p 999 38 | 39 | Log all hits in supporting module (note case sensitive!): 40 | 41 | c:\pin\pin.exe -t C:\pin\IDAPinLogger.dll -m KERNEL32.DLL -- nc.exe -l -v -p 999 42 | 43 | Only start logging hits after instruction at base+0x991c is hit, stop logging after base+0x4242 is hit: 44 | c:\pin\pin.exe -t C:\pin\IDAPinLogger.dll -s 0x991c -e 0x4242 -- nc.exe -l -v -p 999 -------------------------------------------------------------------------------- /idapython/loadlog.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pythong 2 | #original author dereko (?) http://deroko.phearless.org/ 3 | import idaapi 4 | import idc 5 | import struct 6 | import colorsys 7 | 8 | def build_color_list(): 9 | clist = []; 10 | 11 | r = 0x00/255.0; 12 | g = 0x00/255.0; 13 | b = 0xff/255.0; 14 | 15 | (h,s,v) = colorsys.rgb_to_hsv(r,g,b); 16 | s -= 0.30; 17 | for x in range(0,12): 18 | (r,g,b) = colorsys.hsv_to_rgb(h,s,v); 19 | #it's BGR 20 | ida_color = (int(b*255) << 16) + (int(g*255)<<8) + int(r*255); 21 | clist.append(ida_color); 22 | s -= 0.05; 23 | clist.reverse(); 24 | return clist; 25 | 26 | def main(): 27 | clist = build_color_list(); 28 | 29 | filepath = idaapi.askfile_c(False, "*.*", "Pin log file"); 30 | imagebase = idaapi.get_imagebase(); 31 | try: 32 | f = open(filepath, "rb"); 33 | except: 34 | print("Need log file to parse data..."); 35 | return; 36 | buff = f.read(); 37 | functions = set() 38 | for index in range(0, len(buff)): 39 | exec_count = ord(buff[index]); 40 | if exec_count == 0: 41 | continue; 42 | 43 | exec_count = exec_count / 10; 44 | if exec_count > 11: exec_count = 11; 45 | 46 | ida_color = clist[exec_count]; 47 | if (not (idc.GetFunctionName(imagebase+index) in functions)): 48 | func = idc.GetFunctionName(imagebase+index) 49 | print "hit @ 0x%08x function %s"%(imagebase+index, func) 50 | functions.add(func) 51 | 52 | 53 | 54 | idc.SetColor(imagebase + index, CIC_ITEM, ida_color); 55 | 56 | 57 | if __name__ == "__main__": 58 | main(); 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | *_i.c 48 | *_p.c 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.vspscc 63 | .builds 64 | *.dotCover 65 | 66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 67 | #packages/ 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | 80 | # ReSharper is a .NET coding add-in 81 | _ReSharper* 82 | 83 | # Installshield output folder 84 | [Ee]xpress 85 | 86 | # DocProject is a documentation generator add-in 87 | DocProject/buildhelp/ 88 | DocProject/Help/*.HxT 89 | DocProject/Help/*.HxC 90 | DocProject/Help/*.hhc 91 | DocProject/Help/*.hhk 92 | DocProject/Help/*.hhp 93 | DocProject/Help/Html2 94 | DocProject/Help/html 95 | 96 | # Click-Once directory 97 | publish 98 | 99 | # Others 100 | [Bb]in 101 | [Oo]bj 102 | sql 103 | TestResults 104 | *.Cache 105 | ClientBin 106 | stylecop.* 107 | ~$* 108 | *.dbmdl 109 | Generated_Code #added for RIA/Silverlight projects 110 | 111 | # Backup & report files from converting an old project file to a newer 112 | # Visual Studio version. Backup files are not needed, because we have git ;-) 113 | _UpgradeReport_Files/ 114 | Backup*/ 115 | UpgradeLog*.XML 116 | 117 | 118 | 119 | ############ 120 | ## Windows 121 | ############ 122 | 123 | # Windows image file caches 124 | Thumbs.db 125 | 126 | # Folder config file 127 | Desktop.ini 128 | 129 | 130 | ############# 131 | ## Python 132 | ############# 133 | 134 | *.py[co] 135 | 136 | # Packages 137 | *.egg 138 | *.egg-info 139 | dist 140 | build 141 | eggs 142 | parts 143 | bin 144 | var 145 | sdist 146 | develop-eggs 147 | .installed.cfg 148 | 149 | # Installer logs 150 | pip-log.txt 151 | 152 | # Unit test / coverage reports 153 | .coverage 154 | .tox 155 | 156 | #Translations 157 | *.mo 158 | 159 | #Mr Developer 160 | .mr.developer.cfg 161 | 162 | # Mac crap 163 | .DS_Store 164 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## This is a sample makefile for building Pin tools outside 3 | ## of the Pin environment. This makefile is suitable for 4 | ## building with the Pin kit, not a Pin source development tree. 5 | ## 6 | ## To build the tool, execute the make command: 7 | ## 8 | ## make 9 | ## or 10 | ## make PIN_HOME= 11 | ## 12 | ## After building your tool, you would invoke Pin like this: 13 | ## 14 | ## $PIN_HOME/pin -t IDAPinLogger -- /bin/ls 15 | ## 16 | ############################################################## 17 | # 18 | # User-specific configuration 19 | # 20 | ############################################################## 21 | 22 | # 23 | # 1. Change PIN_HOME to point to the top-level directory where 24 | # Pin was installed. This can also be set on the command line, 25 | # or as an environment variable. 26 | # 27 | PIN_HOME ?= ../../.. 28 | 29 | 30 | ############################################################## 31 | # 32 | # set up and include *.config files 33 | # 34 | ############################################################## 35 | 36 | PIN_KIT=$(PIN_HOME) 37 | KIT=1 38 | TESTAPP=$(OBJDIR)cp-pin.exe 39 | 40 | TARGET_COMPILER?=gnu 41 | ifdef OS 42 | ifeq (${OS},Windows_NT) 43 | TARGET_COMPILER=ms 44 | endif 45 | endif 46 | 47 | ifeq ($(TARGET_COMPILER),gnu) 48 | include $(PIN_HOME)/source/tools/makefile.gnu.config 49 | CXXFLAGS ?= -Wall -Werror -Wno-unknown-pragmas $(DBG) $(OPT) 50 | PIN=$(PIN_HOME)/pin 51 | endif 52 | 53 | ifeq ($(TARGET_COMPILER),ms) 54 | include $(PIN_HOME)/source/tools/makefile.ms.config 55 | DBG?= 56 | PIN=$(PIN_HOME)/pin.bat 57 | endif 58 | 59 | 60 | ############################################################## 61 | # 62 | # Tools - you may wish to add your tool name to TOOL_ROOTS 63 | # 64 | ############################################################## 65 | 66 | 67 | TOOL_ROOTS = IDAPinLogger 68 | 69 | TOOLS = $(TOOL_ROOTS:%=$(OBJDIR)%$(PINTOOL_SUFFIX)) 70 | 71 | 72 | ############################################################## 73 | # 74 | # build rules 75 | # 76 | ############################################################## 77 | 78 | all: tools 79 | tools: $(OBJDIR) $(TOOLS) $(OBJDIR)cp-pin.exe 80 | test: $(OBJDIR) $(TOOL_ROOTS:%=%.test) 81 | 82 | IDAPinLogger.test: $(OBJDIR)cp-pin.exe 83 | $(MAKE) -k PIN_HOME=$(PIN_HOME) 84 | 85 | $(OBJDIR)cp-pin.exe: 86 | $(CXX) $(PIN_HOME)/source/tools/Tests/cp-pin.cpp $(APP_CXXFLAGS) -o $(OBJDIR)cp-pin.exe 87 | 88 | $(OBJDIR): 89 | mkdir -p $(OBJDIR) 90 | 91 | $(OBJDIR)%.o : %.cpp 92 | $(CXX) -c $(CXXFLAGS) $(PIN_CXXFLAGS) ${OUTOPT}$@ $< 93 | 94 | $(TOOLS): $(PIN_LIBNAMES) 95 | 96 | $(TOOLS): %$(PINTOOL_SUFFIX) : %.o 97 | ${PIN_LD} $(PIN_LDFLAGS) $(LINK_DEBUG) ${LINK_OUT}$@ $< ${PIN_LPATHS} $(PIN_LIBS) $(DBG) 98 | 99 | 100 | ## cleaning 101 | clean: 102 | -rm -rf $(OBJDIR) *.out *.tested *.failed makefile.copy 103 | -------------------------------------------------------------------------------- /IDAPinLogger.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | IDAPinLogger: 3 | Author: @_wirepair / isaac.dawson{}gmail.com. 4 | Keeps a hit count for every instruction executed in a specified module. 5 | If no module is specified, we use the main executable image. 6 | After the program finishes running, we write the buffer of hits out to a file which 7 | then needs to be imported into IDA Pro using dereko's (?) loadlog.py IDAPython sript. 8 | 9 | I feel this method is a bit more simpiler then his (and I was having problems with 10 | certain executables). But who knows maybe I'm doing something wrong :). 11 | 12 | How to build: 13 | Copy this project into your pin source directory: 14 | %pin%\source\tools\IDAPinLogger 15 | Open Visual Studio (2008) and build or run the makefile. 16 | 17 | How to run: 18 | Log all hits in nc.exe module: 19 | c:\pin\pin.exe -t C:\pin\IDAPinLogger.dll -m nc.exe -- nc.exe -l -v -p 999 20 | or (main exe assumed) 21 | c:\pin\pin.exe -t C:\pin\IDAPinLogger.dll -- nc.exe -l -v -p 999 22 | 23 | Log all hits in supporting module (note case sensitive!): 24 | c:\pin\pin.exe -t C:\pin\IDAPinLogger.dll -m KERNEL32.DLL -- nc.exe -l -v -p 999 25 | 26 | Only start logging hits after instruction at base+0x991c is hit, stop logging after base+0x4242 is hit: 27 | c:\pin\pin.exe -t C:\pin\IDAPinLogger.dll -s 0x991c -e 0x4242 -- nc.exe -l -v -p 999 28 | 29 | 30 | */ 31 | #include "pin.H" 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace WINDOWS { 38 | #include "Windows.h" 39 | } 40 | /* ================================================================== */ 41 | // Global variables 42 | /* ================================================================== */ 43 | 44 | std::ostream * out = &cerr; 45 | // Module Info 46 | ADDRINT moduleStart = 0; 47 | ADDRINT moduleEnd = 0; 48 | unsigned int moduleSize = 0; 49 | // Hit Count Variables. 50 | FILE *IDAInsLogFile; 51 | WINDOWS::BYTE *logBuffer; 52 | //Log start/stop variables 53 | ADDRINT gLogStart = -1; 54 | ADDRINT gLogStop = -1; 55 | bool gLogging = true; 56 | /* ===================================================================== */ 57 | // Command line switches 58 | /* ===================================================================== */ 59 | KNOB KnobOutputFile(KNOB_MODE_WRITEONCE, "pintool", 60 | "o", "", "specify file name for IDAPinLogger output"); 61 | KNOB KnobModuleToLog(KNOB_MODE_WRITEONCE, "pintool", 62 | "m", "", "specify the module to record instruction visits."); 63 | KNOB KnobLogStart(KNOB_MODE_WRITEONCE, "pintool", 64 | "s", "", "specify instruction offset (will be auto added to base) that will start logging."); 65 | KNOB KnobLogStop(KNOB_MODE_WRITEONCE, "pintool", 66 | "e", "", "specify instruction offset (will be auto added to base) that will stop logging."); 67 | 68 | 69 | INT32 Usage() 70 | { 71 | cerr << "This tool writes the number of times an instruction is called to a map file " << endl << 72 | "that can then be fed into IDA Pro to highlight which instructions were executed." << endl << endl; 73 | cerr << KNOB_BASE::StringKnobSummary() << endl; 74 | return -1; 75 | } 76 | 77 | /* ===================================================================== */ 78 | // Analysis routines 79 | /* ===================================================================== */ 80 | VOID StartLogging(UINT32 eip) 81 | { 82 | gLogging = true; 83 | std::cerr << "Logging Started due to log start instruction hit." << endl; 84 | } 85 | 86 | VOID StopLogging(UINT32 eip) 87 | { 88 | gLogging = false; 89 | std::cerr << "Logging Stopped due to log stop instruction hit." << endl; 90 | } 91 | 92 | VOID IncrementCount(UINT32 eip) 93 | { 94 | unsigned int idx = eip - moduleStart; 95 | if (gLogging == false) 96 | { 97 | return; 98 | } 99 | // if we get called more than 255 times, well, stop. 100 | if (logBuffer[idx] >= 255) 101 | { 102 | return; 103 | } 104 | logBuffer[idx] += 1; 105 | } 106 | 107 | /* ===================================================================== */ 108 | // Instrumentation callbacks 109 | /* ===================================================================== */ 110 | VOID ImageLoad(IMG img, VOID *v) 111 | { 112 | std::cerr << "Loading " << IMG_Name(img).c_str() << " Start " << hex << IMG_LowAddress(img) << " End " << IMG_HighAddress(img) << endl; 113 | // if no module passed, just use the main executable 114 | string module = KnobModuleToLog.Value(); 115 | if (module.empty() && IMG_IsMainExecutable( img ) ) 116 | { 117 | module = IMG_Name(img); 118 | } 119 | // keep in mind this is case sensitive... 120 | if (module.empty() || IMG_Name( img ).rfind( module.c_str() ) == string::npos) 121 | { 122 | return; 123 | } 124 | moduleStart = IMG_LowAddress(img); 125 | moduleEnd = IMG_HighAddress(img); 126 | moduleSize = moduleEnd - moduleStart; 127 | if (gLogStart != -1) 128 | { 129 | gLogStart += moduleStart; 130 | } 131 | 132 | if (gLogStop != -1) 133 | { 134 | gLogStop += moduleStart; 135 | } 136 | 137 | std::cerr << "Module size is: " << moduleSize << endl; 138 | logBuffer = (WINDOWS::BYTE *)calloc(moduleSize,sizeof(WINDOWS::BYTE)); 139 | if (logBuffer == NULL) 140 | { 141 | std::cerr << "Unable to allocate enough heapspace, how friggen big is this module?" << endl; 142 | return; 143 | } 144 | std::cerr << "Creating hit count for instructions in module: " << IMG_Name(img).c_str() << endl; 145 | 146 | } 147 | 148 | VOID Instruction(INS ins, VOID *v) 149 | { 150 | ADDRINT loc = INS_Address(ins); 151 | if (gLogStart != -1 && loc == gLogStart) 152 | { 153 | INS_InsertCall(ins, 154 | IPOINT_BEFORE, 155 | (AFUNPTR)StartLogging, 156 | IARG_INST_PTR, 157 | IARG_END); 158 | } 159 | 160 | if (gLogStop != -1 && loc == gLogStop) 161 | { 162 | INS_InsertCall(ins, 163 | IPOINT_BEFORE, 164 | (AFUNPTR)StopLogging, 165 | IARG_INST_PTR, 166 | IARG_END); 167 | } 168 | 169 | if (loc >= moduleStart && loc <= moduleEnd) 170 | { 171 | INS_InsertCall(ins, 172 | IPOINT_BEFORE, 173 | (AFUNPTR)IncrementCount, 174 | IARG_INST_PTR, 175 | IARG_END); 176 | } 177 | } 178 | 179 | 180 | VOID Fini(INT32 code, VOID *v) 181 | { 182 | std::cerr << "Writing instruction hits to disk." << endl; 183 | fwrite(logBuffer, sizeof(WINDOWS::BYTE), moduleSize, IDAInsLogFile); 184 | 185 | fflush(IDAInsLogFile); 186 | fclose(IDAInsLogFile); 187 | free(logBuffer); 188 | } 189 | 190 | int main(int argc, char *argv[]) 191 | { 192 | if( PIN_Init(argc,argv) ) 193 | { 194 | return Usage(); 195 | } 196 | 197 | string fileName = KnobOutputFile.Value(); 198 | if (!fileName.empty()) 199 | { 200 | IDAInsLogFile = fopen(fileName.c_str(), "wb+"); 201 | } 202 | else 203 | { 204 | std::cerr << "Need an outfile file dingus." << endl; 205 | return -1; 206 | } 207 | 208 | if (!KnobLogStart.Value().empty()) 209 | { 210 | stringstream converter(KnobLogStart.Value()); 211 | converter >> hex >> gLogStart; 212 | gLogging = false; 213 | } 214 | 215 | if (!KnobLogStop.Value().empty()) 216 | { 217 | stringstream converter(KnobLogStop.Value()); 218 | converter >> hex >> gLogStop; 219 | } 220 | 221 | IMG_AddInstrumentFunction(ImageLoad, 0); 222 | INS_AddInstrumentFunction(Instruction, 0); 223 | PIN_AddFiniFunction(Fini, 0); 224 | // Start the program, never returns 225 | PIN_StartProgram(); 226 | 227 | return 0; 228 | } 229 | 230 | /* ===================================================================== */ 231 | /* eof */ 232 | /* ===================================================================== */ 233 | -------------------------------------------------------------------------------- /IDAPinLogger.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 18 | 19 | 20 | 21 | 22 | 29 | 32 | 35 | 38 | 41 | 44 | 65 | 68 | 71 | 74 | 94 | 97 | 100 | 103 | 106 | 109 | 112 | 116 | 117 | 124 | 127 | 130 | 133 | 136 | 140 | 160 | 163 | 166 | 169 | 189 | 192 | 195 | 198 | 201 | 204 | 207 | 210 | 211 | 219 | 222 | 225 | 228 | 231 | 234 | 256 | 259 | 262 | 265 | 286 | 289 | 292 | 295 | 298 | 301 | 304 | 307 | 308 | 316 | 319 | 322 | 325 | 328 | 332 | 353 | 356 | 359 | 362 | 383 | 386 | 389 | 392 | 395 | 398 | 401 | 404 | 405 | 406 | 407 | 408 | 409 | 414 | 417 | 418 | 419 | 424 | 425 | 429 | 430 | 431 | 432 | 433 | 434 | --------------------------------------------------------------------------------