<?xml version="1.0"?>
<rss version="2.0">
    <channel>
        <title>OpenRCE: Blog</title>
        <link>http://www.openrce.org/rss/feeds/blog</link>
        <description>OpenRCE: The Open Reverse Code Engineering Community</description>
                <item>
            <title>The Greatness of PyDbg</title>
                            <pubDate>Tue, 06 Feb 2007 01:14:20 -0600</pubDate>
                                        <link>https://www.openrce.org/blog/view/598/The_Greatness_of_PyDbg</link>
                                        <author>drew &lt;email-suppressed@example.com&gt;</author>
                                                    <description>For the past few years I've been using a debugger I wrote in C#.&amp;nbsp;&amp;nbsp;Recently I gave Pedram's &lt;a href=&quot;http://pedram.redhive.com/PaiMei/docs/#pydbg&quot;&gt;PyDbg&lt;/a&gt;, a part of PaiMei, a spin.&amp;nbsp;&amp;nbsp;PyDbg did exactly what I wanted!&amp;nbsp;&amp;nbsp;Even though I'm not particularly fond of Python, it looks like I'll have to use PyDbg more and probably learn a bit of Python along the way.&amp;nbsp;&amp;nbsp;You can download PyDbg as a part of PaiMei &lt;a href=&quot;http://www.openrce.org/downloads/details/208/PaiMei&quot;&gt;from our download section&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
One function that I stole from &lt;a href=&quot;http://www.openrce.org/profile/view/igorsk&quot;&gt;Igor Skochinsky&lt;/a&gt;'s &lt;a href=&quot;http://hymn-project.org/forums/viewtopic.php?t=1553&quot;&gt;QTFairUse &lt;/a&gt; is find_pid.&amp;nbsp;&amp;nbsp;It takes in a process name and returns the process id.&amp;nbsp;&amp;nbsp;Simple enough, but useful. :)&amp;nbsp;&amp;nbsp;Here's a dump of the code:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
def find_pid(dbg, name):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;namel = name.lower()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;found_target = False&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (pid, proc_name) in dbg.enumerate_processes():&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if proc_name.lower() == namel:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return pid&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return -1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#and a simple use example:&lt;br /&gt;
&lt;br /&gt;
dbg = pydbg()&lt;br /&gt;
&lt;br /&gt;
pid = find_pid(dbg, &amp;quot;notepad.exe&amp;quot;)&lt;br /&gt;
if pid!=-1:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print (&amp;quot;Attaching to %d&amp;quot;) % (pid)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dbg.attach(pid)&lt;br /&gt;
else:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error(&amp;quot;process not found.&amp;quot;)&lt;br /&gt;
&lt;/code&gt;</description>
                    </item>
                <item>
            <title>Introduction to File Format RE</title>
                            <pubDate>Fri, 22 Dec 2006 21:20:06 -0600</pubDate>
                                        <link>https://www.openrce.org/blog/view/544/Introduction_to_File_Format_RE</link>
                                        <author>drew &lt;email-suppressed@example.com&gt;</author>
                                                    <description>Igor pasted a link to a blog with a good introduction to file format reverse engineering.&amp;nbsp;&amp;nbsp;The author, Edward Keyes, is involved with translating 3rd party games in to different languages, such as English, Japanese, etc.&amp;nbsp;&amp;nbsp;So far he has a good introduction to file format RE:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://sekai.insani.org/archives/8&quot;&gt;Part II: The Hex Editor&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://sekai.insani.org/archives/18&quot;&gt;Part III: Code Prototyping&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://sekai.insani.org/archives/24&quot;&gt;Part IV: Compression Formats&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In future installments he'll discuss typical image formats.&amp;nbsp;&amp;nbsp;For non-beginners, the compression format post has some useful information.</description>
                    </item>
                <item>
            <title>Here's a quick IDA IDC function to return the next empty Mark slot</title>
                            <pubDate>Tue, 13 Jun 2006 19:41:48 -0500</pubDate>
                                        <link>https://www.openrce.org/blog/view/324/Here's_a_quick_IDA_IDC_function_to_return_the_next_empty_Mark_slot</link>
                                        <author>drew &lt;email-suppressed@example.com&gt;</author>
                                                    <description>&lt;a href=&quot;http://www.openrce.org/repositories/users/drew/GetMarkedNext.idc&quot;&gt;http://www.openrce.org/repositories/users/drew/GetMarkedNext.idc&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here's a quick IDA IDC function to return the next empty Mark slot for use with &lt;a href=&quot;http://www.openida.org/idadoc/382.htm&quot;&gt;MarkPosition&lt;/a&gt;.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
// return the next empty Mark slot for use with MarkPosition&lt;br /&gt;
static GetMarkedNext()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;auto slot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;slot = 1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//loop until we find an empty slot&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while( -1 != GetMarkedPos(slot) )&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {slot++;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return slot;&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
IDA 5.0's valid range for mark slots is 1..1023.&amp;nbsp;&amp;nbsp;However, MAX_MARK_SLOT does not seem to be available to IDC.&amp;nbsp;&amp;nbsp;MAX_MARK_SLOT on IDA 5.0 is actually set to 1024. This means that Ilfak's &lt;a href=&quot;http://www.hexblog.com/2006/01/findcrypt.html&quot;&gt;findcrypt.cpp plugin&lt;/a&gt; has a slight bug in it:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;for ( i=1; i &amp;lt;= MAX_MARK_SLOT; i++ )&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
The comparison should actually be &lt;code&gt;i &amp;lt; MAX_MARK_SLOT&lt;/code&gt;.&amp;nbsp;&amp;nbsp;But I can't blame him because the comments in sdk\include\moves.hpp say that 1..MAX_MARK_SLOT are valid slots. ;)&lt;br /&gt;
&lt;br /&gt;
Earlier versions of IDA, such as 4.6sp1, have a mark slot limit somewhere near 32.</description>
                    </item>
                <item>
            <title>IDACompare pre-compiled for IDA 4.6sp1</title>
                            <pubDate>Fri, 19 May 2006 19:47:29 -0500</pubDate>
                                        <link>https://www.openrce.org/blog/view/300/IDACompare_pre-compiled_for_IDA_4.6sp1</link>
                                        <author>drew &lt;email-suppressed@example.com&gt;</author>
                                                    <description>&lt;a href=&quot;http://www.openrce.org/repositories/users/drew/IDA_Compare.plw&quot;&gt;http://www.openrce.org/repositories/users/drew/IDA_Compare.plw&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Above is a link to a pre-compiled IDACompare plugin for IDA 4.6sp1.&amp;nbsp;&amp;nbsp;The only change required for the compile was removing the last arg from generate_disasm_line in idacompare.cpp line 285.&amp;nbsp;&amp;nbsp;It was compiled from the 12.16.05 release from &lt;a href=&quot;http://labs.idefense.com/labs-software.php?show=16&quot;&gt;http://labs.idefense.com/labs-software.php?show=16&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I'm posting this so that it'll make it into google.&amp;nbsp;&amp;nbsp;User repositories don't appear to be browsable unless you're logged in.</description>
                    </item>
                <item>
            <title>How to add custom symbolic constants in IDA</title>
                            <pubDate>Fri, 19 May 2006 19:22:26 -0500</pubDate>
                                        <link>https://www.openrce.org/blog/view/299/How_to_add_custom_symbolic_constants_in_IDA</link>
                                        <author>drew &lt;email-suppressed@example.com&gt;</author>
                                                    <description>Quick Answer: use an Enum&lt;br /&gt;
&lt;br /&gt;
Explanation and long answer:&lt;br /&gt;
&lt;br /&gt;
Let's say that you're using IDA, run across a numerical constant, and want to replace the numerical constant with a symbolic constant.&amp;nbsp;&amp;nbsp;IDA has a great pre-built database of common symbolic constants.&amp;nbsp;&amp;nbsp;To access this, right-click on the constant in question, select Symbolic Constant, Use standard symbolic constant.&amp;nbsp;&amp;nbsp;However if you want to add your own custom symbolic constant, you'll want to add an enum.&amp;nbsp;&amp;nbsp;The process isn't advanced, but I've run into a couple IDA users that weren't familiar with it.&lt;br /&gt;
&lt;br /&gt;
Let's use the following code from notepad.exe as an example:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;push&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;20019h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; samDesired&lt;br /&gt;
xor&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esi, esi&lt;br /&gt;
push&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;esi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; ulOptions&lt;br /&gt;
push&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;offset aClsidAdb880a6D ; lpSubKey&lt;br /&gt;
push&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80000000h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; hKey&lt;br /&gt;
call&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ds:RegOpenKeyExA&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
In order to add a custom symbolic constant, open the Enumerations subview (shift+F10).&amp;nbsp;&amp;nbsp;Press the Insert key to add a new enumeration type.&amp;nbsp;&amp;nbsp;Ignore all the settings for now and just hit Ok.&amp;nbsp;&amp;nbsp;Now that you have a new enumeration type, press N to create a new symbolic constant.&amp;nbsp;&amp;nbsp;Put your new name, for example mySAM, as the name, and the value for the constant, for example 0x20019.&amp;nbsp;&amp;nbsp;Please note that you'll have to precede hex values with &amp;quot;0x&amp;quot;.&amp;nbsp;&amp;nbsp;Now go back to your disassembly subview, right click on the numeric constant, select Symbolic constant, and your newly created symbolic constant should appear just like the following:&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&quot;http://www.openrce.org/repositories/users/drew/blog_enumForSymbolicConstant.JPG&quot; border=0 align=&quot;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
Side note: Some readers might notice that the correct symbolic constant for this 20019h is already included in IDA's standard symbolic constant list.</description>
                    </item>
            </channel>
</rss>
