<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7454626512109390647</id><updated>2011-11-27T16:04:44.522-08:00</updated><category term='Python'/><category term='MSSQL'/><category term='Research'/><category term='Microsoft'/><category term='reverser engineering'/><category term='debugging'/><category term='cheats'/><category term='SQL Server'/><category term='Idle'/><category term='NativDebugging'/><category term='puzzle'/><category term='memory'/><category term='Minesweeper'/><category term='Security'/><category term='Passwordaizer'/><category term='reinteract'/><category term='Idlespoon'/><category term='interpreter'/><category term='Map-Hack'/><category term='hooking'/><category term='detour'/><category term='Idlefork'/><category term='cheating'/><category term='Data bases'/><category term='analysis'/><category term='DB'/><category term='Bejeweled'/><category term='pyscripter'/><category term='Sentrigo'/><category term='patching'/><category term='Hardware'/><category term='code'/><category term='mint'/><category term='LED'/><category term='Warcraft'/><category term='candy'/><category term='Facebook'/><title type='text'>Assaf Nativ's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-8769654910408090</id><published>2011-11-15T13:33:00.001-08:00</published><updated>2011-11-18T05:36:25.328-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reverser engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='Warcraft'/><category scheme='http://www.blogger.com/atom/ns#' term='cheating'/><category scheme='http://www.blogger.com/atom/ns#' term='cheats'/><category scheme='http://www.blogger.com/atom/ns#' term='Map-Hack'/><category scheme='http://www.blogger.com/atom/ns#' term='NativDebugging'/><category scheme='http://www.blogger.com/atom/ns#' term='memory'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='Minesweeper'/><title type='text'>Map-Hack Tutorial</title><content type='html'>&lt;script language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/lang-css.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;function addLoadEvent(func) {  var oldonload = window.onload;  if (typeof window.onload != 'function') {    window.onload = func;  } else {    window.onload = function() {      if (oldonload) {        oldonload();      }      func();    }  }}addLoadEvent(prettyPrint);&lt;/script&gt;&lt;style type="text/css"&gt;/* Pretty printing styles. Used with prettify.js. */.str { color: #080; }.kwd { color: #008; }.com { color: #800; }.typ { color: #606; }.lit { color: #066; }.pun { color: #660; }.pln { color: #000; }.tag { color: #008; }.atn { color: #606; }.atv { color: #080; }.dec { color: #606; }pre.prettyprint { padding: 2px; border: 1px solid #888; }@media print {  .str { color: #060; }  .kwd { color: #006; font-weight: bold; }  .com { color: #600; font-style: italic; }  .typ { color: #404; font-weight: bold; }  .lit { color: #044; }  .pun { color: #440; }  .pln { color: #000; }  .tag { color: #006; font-weight: bold; }  .atn { color: #404; }  .atv { color: #060; }}&lt;/style&gt;&lt;br /&gt;Map-Hack is a cheat for strategy games such as Warcraft or Starcraft, Dice n’ Slice games like Diablo or 3d shooters games like modern warfare. The cheat as most cheats is done in order to give an unfair advantage to the player who uses it. In case of Warcraft a map that&amp;nbsp;usually&amp;nbsp;looks like the one in the top left corner:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-rrNcfV-xwK4/TsLRmH8SNnI/AAAAAAABVaI/Jsvo9sefh2E/s1600/0010.WarCraft.png"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-rrNcfV-xwK4/TsLRmH8SNnI/AAAAAAABVaI/Jsvo9sefh2E/s640/0010.WarCraft.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;under cheating condition, would look like this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-g7DowaqgrZA/TsLRyHJYJwI/AAAAAAABVaQ/-HyBdI7FhYM/s1600/0020.WarCraftII.map_cheat.png"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-g7DowaqgrZA/TsLRyHJYJwI/AAAAAAABVaQ/-HyBdI7FhYM/s640/0020.WarCraftII.map_cheat.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;or even better, like this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-E3wQH4FstrE/TsLSBCriVbI/AAAAAAABVaY/zlHuz3N0JMs/s1600/0030.WarCraftII.map_cheat.png"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-E3wQH4FstrE/TsLSBCriVbI/AAAAAAABVaY/zlHuz3N0JMs/s640/0030.WarCraftII.map_cheat.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Zoomed in:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-qqgTaIgS2l8/TsLSM_koajI/AAAAAAABVag/LhwFmxuRu_U/s1600/0040.WarcraftII_minimap_with_extra_info.png"&gt;&lt;img border="0" height="353" src="http://1.bp.blogspot.com/-qqgTaIgS2l8/TsLSM_koajI/AAAAAAABVag/LhwFmxuRu_U/s400/0040.WarcraftII_minimap_with_extra_info.png" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The idea behind it, is to give more information on the map than what is found in the regular game play. Information like which gold mines are wealthier, and which enemy creatures are deadlier.&lt;br /&gt;To create this kind of cheat one would have to go through two phases:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Research, in which you need to figure out how and where the map data is stored in memory, and how to find where it is stored every time the game restarts.&lt;/li&gt;&lt;li&gt;Developing, in which you write a code or a script to change the map data in real time.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;In this tutorial I would only display the research phase up to the point of proof of concept.&lt;br /&gt;To perform this research I need an Interactive Python Interpreter. This would bring up the question of which version of Python should I use.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-Gme75V0PDto/TsLWANymb8I/AAAAAAABVao/tK9BeuU41DY/s1600/0050.python_icon.png"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-Gme75V0PDto/TsLWANymb8I/AAAAAAABVao/tK9BeuU41DY/s200/0050.python_icon.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Games are for Windows. So I'm gonna use Python for Windows (Better use the one from &lt;a href="http://python.org/"&gt;Python.org&lt;/a&gt; than Active-State Python).&lt;/li&gt;&lt;li&gt;I'm about to research a 32bit process so it is better, although not a must, to use  32bit Python.&lt;/li&gt;&lt;li&gt;The tool-chain I wrote is not ported to Python 3.x just yet, because I'm lazy, so Python 2.7 or 2.6 would have to serve me this time.&lt;/li&gt;&lt;li&gt;As for the Interactive Interpreter, I prefer the &lt;a href="http://dreampie.sourceforge.net/"&gt;Dreampie&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;The tool-chain is an external module, which helps in the task of memory research. The module is called NativDebugging, and is freely&amp;nbsp;available&amp;nbsp;at the following SVN:&amp;nbsp;&lt;a href="http://dreampie.sourceforge.net/"&gt;http://dreampie.sourceforge.net/&lt;/a&gt;. But, as I mentioned before, I'm lazy so no installer, just use:&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;python setup.py install&lt;/pre&gt;&lt;br /&gt;My NativDebugging module can be used as is, but it has extra GUI features if the PyQT module is found, so download it from:&lt;br /&gt;&lt;a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt"&gt;http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt&lt;/a&gt;&lt;br /&gt;and double click to install.&lt;br /&gt;&lt;br /&gt;Now that I have got the entire environment set, let's get the party started. Let's start with something easy that everyone likes: Minesweeper (AKA: Winmine).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-ARy_uV6s61U/TsLYxWqZRsI/AAAAAAABVaw/YZ8UkVkGk-c/s1600/0170.WinMineOld.png"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-ARy_uV6s61U/TsLYxWqZRsI/AAAAAAABVaw/YZ8UkVkGk-c/s400/0170.WinMineOld.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Important note: Use the old version of the minesweeper as many internal structures are different in the new Windows Vista version that looks like this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-YGewmeZbU-Y/TsLZQqEJEfI/AAAAAAABVa4/gT95ZBO2Boc/s1600/0160.WinMineNew.png"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-YGewmeZbU-Y/TsLZQqEJEfI/AAAAAAABVa4/gT95ZBO2Boc/s400/0160.WinMineNew.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I start by launching the game, and getting its' process id. There are many ways to get the process id, either to use the task manager or with the following command line:&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;tasklist /Fi "IMAGENAME eq winmine*"&lt;/pre&gt;&lt;br /&gt;Or from Python using the NativDebugging module.&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;&amp;gt;&amp;gt;&amp;gt; from NativDebugging.Win32.MemoryReader import *&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; findProcessId('winmine')&lt;br /&gt;[('winmine.exe', 376L)]&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/pre&gt;&lt;br /&gt;Next I want to tell the NativDebugging module what is the target.&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;&amp;gt;&amp;gt;&amp;gt; m = attach(376)&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/pre&gt;&lt;br /&gt;I need to get details about where in the 4GB virtual address space memory is allocated. The   m.getMemoryMapByQuery method suits for the job. &lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;&amp;gt;&amp;gt;&amp;gt; memMap = m.getMemoryMapByQuery ()&lt;/pre&gt;&lt;br /&gt;This operation might take some time, depending on how much memory is really used by the target process.&lt;br /&gt;I start the search of the place in memory where the board of the game is set, using the technique called differential search. Differential search is a search in which one starts with a picture of all the memory, and slowly filters out things that are not what he is looking for, until he is left with a single result. In this example I'm looking for the top left square of the board. Setting up a new search is done as following:&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;&amp;gt;&amp;gt;&amp;gt; from NativDebugging.Win32.DifferentialSearch import *&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; ds = DifferentialSearch(memMap, m)&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/pre&gt;&lt;br /&gt;Now I simply, change the value of the square by uncovering it&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-rn2DP6Xnpek/TsYxMLqRlXI/AAAAAAABVbQ/-rsNqc4w_3A/s1600/01700.WinmineStart.PNG"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-rn2DP6Xnpek/TsYxMLqRlXI/AAAAAAABVbQ/-rsNqc4w_3A/s1600/01700.WinmineStart.PNG" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-OGVXOCLkHS8/TsYxqqSvnPI/AAAAAAABVbg/b64D0Zazmsc/s1600/01705.Arrow.png"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-OGVXOCLkHS8/TsYxqqSvnPI/AAAAAAABVbg/b64D0Zazmsc/s320/01705.Arrow.png" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-8lJdVvSAK6g/TsYxR-VZ_EI/AAAAAAABVbY/kdGfGqQkqrc/s1600/01710.WinmineClicked.PNG"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-8lJdVvSAK6g/TsYxR-VZ_EI/AAAAAAABVbY/kdGfGqQkqrc/s1600/01710.WinmineClicked.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Next I&amp;nbsp;filter&amp;nbsp;out any memory address that &amp;nbsp;has not been changed:&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;&amp;gt;&amp;gt;&amp;gt; ds.removeUnchangedMemory()&lt;/pre&gt;&lt;br /&gt;The first filter can take up to few minutes, again depends on how much memory is used by the target process. If I wait for a little while, some of the memory would change by itself, so I can&amp;nbsp;remove any memory that changed:&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;&amp;gt;&amp;gt;&amp;gt; ds.removeChangedMemory()&lt;/pre&gt;&lt;br /&gt;I continue by&amp;nbsp;causing&amp;nbsp;more changes to the first square and invoking the removeUnchangedMemory method.&lt;br /&gt;To check how many potential memory addresses are left the "len" method on the DifferentialSearch object can be used. Filtering&amp;nbsp;process is repeated until only one or two places in memory are left.&lt;br /&gt;If you are following the process to this point, and all was done correctly your Python Interpreter should now look something like this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-h8iX9oXgdrE/TsY2XuaaSQI/AAAAAAABVbo/7ETAa3JQ_bQ/s1600/01720.WinmineTargetFound.PNG"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-h8iX9oXgdrE/TsY2XuaaSQI/AAAAAAABVbo/7ETAa3JQ_bQ/s640/01720.WinmineTargetFound.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;(Click on the picture to enlarge it)&lt;br /&gt;&lt;br /&gt;Now I can get the address that was found simply by looking at the DifferentialSearch object or by retrieving its' data in index 0.&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;&amp;gt;&amp;gt;&amp;gt; ds&lt;br /&gt;0: 0x01005360: 10404040&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; ds[0]&lt;br /&gt;16798560L&lt;/pre&gt;&lt;br /&gt;I save the address that was found in a new var to be used latter:&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;&amp;gt;&amp;gt;&amp;gt; board = ds[0]&lt;/pre&gt;&lt;br /&gt;The memory can be&amp;nbsp;examined&amp;nbsp;in various ways, here are few examples:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-nEXvpKtg6VA/TsY4CHqqDMI/AAAAAAABVb4/hzJoSKTWaaU/s1600/01730.WinmineDisplayMemory.PNG"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-nEXvpKtg6VA/TsY4CHqqDMI/AAAAAAABVb4/hzJoSKTWaaU/s640/01730.WinmineDisplayMemory.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One can also try to write over the memory to see how the game behavior is changing.&lt;br /&gt;The most useful way to look at memory dumps of maps is using the mapDisplay method, which&amp;nbsp;hopefully, would show up in a new QT window as following:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-7w0sn3n7oQE/TsY4-0i9EII/AAAAAAABVcA/T4_oPb_fW4Y/s1600/01800.WinmineMapDisplay.PNG"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-7w0sn3n7oQE/TsY4-0i9EII/AAAAAAABVcA/T4_oPb_fW4Y/s640/01800.WinmineMapDisplay.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;All of the display parameters are accessible from both the GUI and the python object that was created with the creation of the display. I now play with the line size until the following result is reached:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-aEI2gxJVV_k/TsY5baRYfFI/AAAAAAABVcI/oy6R6ZGq4Cc/s1600/01810.WinmineMapDisplayLineSizeSet.PNG"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-aEI2gxJVV_k/TsY5baRYfFI/AAAAAAABVcI/oy6R6ZGq4Cc/s640/01810.WinmineMapDisplayLineSizeSet.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Can you tell where all the mines are placed?&lt;br /&gt;&lt;br /&gt;The interesting part in case of minesweeper is that, the map is always found in the same place in memory, so if I start a new game, and update the data (using w.updateData()), I might get something like:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-oNys3sD7f_M/TsY6T3dOe9I/AAAAAAABVcQ/agXJRhe9Ips/s1600/01820.WinmineAllInOnePicture.PNG"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-oNys3sD7f_M/TsY6T3dOe9I/AAAAAAABVcQ/agXJRhe9Ips/s640/01820.WinmineAllInOnePicture.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In real games, the principle is quite the same, though it takes more time. The main&amp;nbsp;difference&amp;nbsp;is that the map is&amp;nbsp;usually&amp;nbsp;allocated&amp;nbsp;dynamically&amp;nbsp;so one would also have to find a global pointer to it, to be able to locate the map in memory quickly. I have an example of the same process done on the WarCraft II strategy game, but this blog post is long enough as it is. So maybe next time.&lt;br /&gt;&lt;br /&gt;Future TODOs:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;I&amp;nbsp;believe&amp;nbsp;that the search function could be much faster, I would love to have some help in optimizing the code.&lt;/li&gt;&lt;li&gt;The GUI has lots of room for&amp;nbsp;improvements.&lt;/li&gt;&lt;li&gt;I need to write an installer, and to create a Python 3.x branch.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Cheers,&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Assaf&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-8769654910408090?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/8769654910408090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2011/11/map-hack-tutorial_15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/8769654910408090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/8769654910408090'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2011/11/map-hack-tutorial_15.html' title='Map-Hack Tutorial'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-rrNcfV-xwK4/TsLRmH8SNnI/AAAAAAABVaI/Jsvo9sefh2E/s72-c/0010.WarCraft.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-7018255408760424009</id><published>2011-09-17T05:59:00.000-07:00</published><updated>2011-09-17T05:59:57.747-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='cheats'/><category scheme='http://www.blogger.com/atom/ns#' term='Bejeweled'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Bejeweled autopilot</title><content type='html'>The idea behind the &lt;a href="http://apps.facebook.com/bejeweledblitz"&gt;Bejeweled&lt;/a&gt;&amp;nbsp;game is as following:&lt;br /&gt;An average game status looks like this:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-uaHtgCMqk0I/TnSY2owtJAI/AAAAAAABU8Y/2H02Q82qU1A/s1600/game.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="310" src="http://2.bp.blogspot.com/-uaHtgCMqk0I/TnSY2owtJAI/AAAAAAABU8Y/2H02Q82qU1A/s400/game.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The player is allowed to switch between any two neighboring gems in order to create a series of three or more gems of the same color. If the player does so, the gems are destroyed, points are given, gems are falling down to fill the empty spaces, and new gems are coming from the top to fill the vacuum. The problem is that the player has just about one minute to destroy as many gems as possible, and it’s hard to find series of gems that quick.&lt;br /&gt;What I did to solve this problem was to write a small Python script to capture the screen, find the best next move and simulate mouse clicks to execute it. One of the problems I faced while writing the script was identifying the kinds of gems, while the bustards kept on moving, rotating n’ glowing in different kinds of effects that usually inform the player about special bonuses. I tried to scan a 4x4 pixels square in the middle of any square, to get a color value out of this small square, and to compare it against a table I made manually in order to decide which gem it is.&lt;br /&gt;I found out, that in many cases bots scripts alter the game to change all the graphics to something more &lt;a href="http://en.wikipedia.org/wiki/Optical_character_recognition"&gt;OCR&lt;/a&gt; friendly. But I didn’t want to do that, as I’m trying to perfect the technique of writing a bot, and not to mix the two game cheating vectors. Therefore, I didn’t want to put any patches on the game, just writing a bot.&lt;br /&gt;The next problem I faced was Python itself, as I found out that it’s quite slow to scan an image or to compare two images with the &lt;a href="http://www.pythonware.com/products/pil/"&gt;Python Image Library (PIL)&lt;/a&gt;. Though, it is possible that I’m miss-using the library. Please, I would like to hear any ideas on how this part could be done better from Python, without extending Python with a custom C library.&lt;br /&gt;One lessen I learnt the hard way during writing of this very script, was that it’s very important to find the time to write a code for finding the location of the game on the screen, so in case I scroll the page down a little, or just open the bookmarks tools bar, it won’t be using the hard coded position of the game and miss figure where the gems are.&lt;br /&gt;Even thought, I successfully set myself on the top score among all of my friends, but not world wide best just yet. I found out that many fine tunings on the scripts, such as what strategy to prefer, weather to aim for bonuses first, try to destroy a longest chain of gems at once, or save bonuses for later, have immense effects on scoring. Please, I would love to hear from the readers of this blog about any ideas on how to improve the script, or how you would write one in case you had to.&lt;br /&gt;&lt;br /&gt;The script is aviable on my SVN at &lt;a href="https://xp-dev.com/svn/Cheats"&gt;https://xp-dev.com/svn/Cheats&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Cheers,&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Assaf&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-7018255408760424009?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/7018255408760424009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2011/09/bejeweled-autopilot.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/7018255408760424009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/7018255408760424009'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2011/09/bejeweled-autopilot.html' title='Bejeweled autopilot'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-uaHtgCMqk0I/TnSY2owtJAI/AAAAAAABU8Y/2H02Q82qU1A/s72-c/game.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-2725011938754295635</id><published>2011-09-02T03:47:00.000-07:00</published><updated>2011-09-17T06:02:16.720-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reverser engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='Research'/><category scheme='http://www.blogger.com/atom/ns#' term='cheats'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Wonder Cheat 3</title><content type='html'>Recently I had a major nostalgic emotional burst which took me all the way to the Sega Master System ™ I had in my childhood. One of the games I remember the most from this 22 years old console is the Wonder Boy III, the Dragon’s Curse. So I fired up the Meka emulator and downloaded the ROM, and sat down for few hours of unlimited fun.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-aHPg8F4128E/TmCyX5JbcmI/AAAAAAABTdc/A62nLeSYlRc/s1600/Wonder%2BBoy%2B3%2BThe%2BDragon%2527s%2BTrap%2BUE-06.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://1.bp.blogspot.com/-aHPg8F4128E/TmCyX5JbcmI/AAAAAAABTdc/A62nLeSYlRc/s400/Wonder%2BBoy%2B3%2BThe%2BDragon%2527s%2BTrap%2BUE-06.png" width="248" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;During the search for the ROM I found out that there was another version of the game with slightly better graphics for the TurboGrafx-16 console (AKA PC-Engine) which is called the Dragon’s Curse.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-HGKaY2NWVMw/TmCyzkltZXI/AAAAAAABTdk/UT3XKBy-M10/s1600/Dragon%2527s+Curse+%2528U%2529+%255Bb4%255D_001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-HGKaY2NWVMw/TmCyzkltZXI/AAAAAAABTdk/UT3XKBy-M10/s1600/Dragon%2527s+Curse+%2528U%2529+%255Bb4%255D_001.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;For the readers who never heard of WB3 or the Sega Master System, I shall explain, in short, the game’s look n’ feel. The game is some kind of a combination of RPG with a platforming action game. You need to get different kinds of swords, shields and armors by either finding them in treasure chests throughout the game, or buying them in shops found in the city. Besides the gear, the player has to collect gold, potions, magics and power ups. The game has about 6 levels that the player has to finish, while at the end of each one there is a boss that has to be destroyed. When a boss is beaten, the character in the game transforms into some kind of a new animal-human creature that possesses a special ability that helps him get to the next level. The characters are Hu-man, Lizard-man (Can shoot fire), Mouse-man (Very short, and able to climb some walls), Piranha-man (Can swim), Lion-man (Can punch up), Hawk-man (Can fly).&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-hrbtXMFLHdY/TmCy8CYVYHI/AAAAAAABTdo/MbmaGLcKkZg/s1600/WB3CHAR.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="69" src="http://1.bp.blogspot.com/-hrbtXMFLHdY/TmCy8CYVYHI/AAAAAAABTdo/MbmaGLcKkZg/s320/WB3CHAR.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Bosses:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-5GWrytnd0HA/TmCy_CiVWVI/AAAAAAABTds/4QYYwghtk40/s1600/DRAGONS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="228" src="http://3.bp.blogspot.com/-5GWrytnd0HA/TmCy_CiVWVI/AAAAAAABTds/4QYYwghtk40/s320/DRAGONS.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The part that I find interesting about this game is the way save games were implemented in time before Flash memory. During the game there was a place in town where the player could get a 14 characters long code that if entered in the main menu, would take him back to the same status as he was in the time of getting the code. &lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Tt0eD5ryHRU/TmCzELVwOJI/AAAAAAABTdw/TFU2aga7ozU/s1600/Wonder+Boy+3+The+Dragon%2527s+Trap+UE-04.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-Tt0eD5ryHRU/TmCzELVwOJI/AAAAAAABTdw/TFU2aga7ozU/s1600/Wonder+Boy+3+The+Dragon%2527s+Trap+UE-04.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-UmCU1DSKkw0/TmCzIk9wIBI/AAAAAAABTd0/1gHq8bh9fQU/s1600/Wonder+Boy+3+The+Dragon%2527s+Trap+UE-05.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-UmCU1DSKkw0/TmCzIk9wIBI/AAAAAAABTd0/1gHq8bh9fQU/s1600/Wonder+Boy+3+The+Dragon%2527s+Trap+UE-05.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Meaning these 14 characters encode the full status of the game, including amount of Gold, Lives, Potions, Gear and more. The characters are either numbers 0 to 9, or capital ABC, excluding few characters such as I, O &amp;amp; Q, for the reason that they look too much like 1 and O, which could be quite confusing. Besides that, not every combination of characters is valid, meaning there must be some kind of a checksum. I remember that many years ago, every time I got bored playing the game I was trying to brute-force codes, with very little success. I was always very curious about this mechanism, and I had a belief that somewhere, there is some kind of a very special code that would turn the game upside down.&lt;br /&gt;During the last week I decided to finally cope with this old craving, and finally reverse engineer the secret behind this coding system. First I had to find out which CPU is used by the Sega Master System to know how to load the game in IDA. Wikipedia mentioned, rightfully, that the Z80 is the main CPU of the console, and loading the ROM file into address zero seemed to work just fine. Second, I had to find the relevant code, so I searched the Internet for some special codes that might lead me to the right place. I found out that there is one very special code that is WE5T 0NE 0000 000, which is the name of the company who made the game. This special code could not possible encode a game status, so it must get a special treatment in the code. Searching for the string (without the spaces) through the entire file took me to the following code:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-bUShyRvZiN8/TmCzO5On3DI/AAAAAAABTd4/RZeRNgS861c/s1600/IDA1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://1.bp.blogspot.com/-bUShyRvZiN8/TmCzO5On3DI/AAAAAAABTd4/RZeRNgS861c/s640/IDA1.png" width="540" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Xrefs took me to:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-IthwpbHRbJE/TmCzd73FQ5I/AAAAAAABTd8/apNxoLq9mUE/s1600/IDA2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="540" src="http://1.bp.blogspot.com/-IthwpbHRbJE/TmCzd73FQ5I/AAAAAAABTd8/apNxoLq9mUE/s640/IDA2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;From reversing I found that every character tributes exactly five bits to the data, that comes to be total of 70 bits (5 * 14)  which turn into total of 9 bytes of data. Two bits of the 9 bytes are index to a xoring table that is then xored to the 9 bytes. After the xoring, all the bytes are added together to form a checksum that is compared to the first 7 bits (which are not used in the addition). If the first 7 bits match, the code is valid and is passed to another function that sets the game state.&lt;br /&gt;I’ve written a full functional code decoder / encoder in Python, and is available for download from the following link:&lt;br /&gt;&lt;a href="http://xp-dev.com/svn/Cheats/"&gt;http://xp-dev.com/svn/Cheats/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Links:&lt;br /&gt;For more information about Wonder Boy III and The Draogon’s Curse follow the links below.&lt;br /&gt;&lt;a href="http://www.geocities.jp/monsterworld2/Wonderboy_Land.htm"&gt;http://www.geocities.jp/monsterworld2/Wonderboy_Land.htm&lt;/a&gt;&lt;br /&gt;&lt;a href="http://hg101.kontek.net/wonderboy/wonderboy.htm"&gt;http://hg101.kontek.net/wonderboy/wonderboy.htm&lt;/a&gt;&lt;br /&gt;&lt;a href="http://retro.ign.com/articles/930/930245p3.html"&gt;http://retro.ign.com/articles/930/930245p3.html&lt;/a&gt;&lt;br /&gt;I would like to thank them for the pictures I took from these sites without asking for permission, hope it’s ok.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Cheers,&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Assaf.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;P.S.&lt;br /&gt;The Dragon’s Curse has something different in the coding system, I would have to reverse it too. Does anyone know how to reverse the PC-Engine’s ROMs?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-2725011938754295635?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/2725011938754295635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2011/09/wonder-cheat-3.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/2725011938754295635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/2725011938754295635'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2011/09/wonder-cheat-3.html' title='Wonder Cheat 3'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-aHPg8F4128E/TmCyX5JbcmI/AAAAAAABTdc/A62nLeSYlRc/s72-c/Wonder%2BBoy%2B3%2BThe%2BDragon%2527s%2BTrap%2BUE-06.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-6267143011564410050</id><published>2011-06-22T07:06:00.000-07:00</published><updated>2011-10-01T13:07:02.016-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reverser engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='patching'/><category scheme='http://www.blogger.com/atom/ns#' term='debugging'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='hooking'/><category scheme='http://www.blogger.com/atom/ns#' term='detour'/><title type='text'>The way to hook</title><content type='html'>The following post is a bit more technical then usual, so my apologies for my none-pirate friends. Hooking is the art of altering code in memory to introduce new functionality to an existing program. I won’t be discussing all the uses that might be found for hooking, but rather the different techniques for doing so. In general there are four common ways to implement a hook function under Windows platforms.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;Windows standard hooking API.&amp;nbsp;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Detours technique&amp;nbsp;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;AIT hooks, AKA Rechter’s hooks&amp;nbsp;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Dll proxy&amp;nbsp;&lt;/b&gt;&lt;/li&gt;&lt;/ol&gt;I’ll cover these briefly in this post. After that I’ll tell the reader about my small and insignificant addition to method number three. All of the methods are well covered in Ivo Ivanov’s codeproject page &lt;a href="http://www.codeproject.com/KB/system/hooksys.aspx"&gt;http://www.codeproject.com/KB/system/hooksys.aspx&lt;/a&gt;&lt;br /&gt;The more general principle of what hooking really is, is covered in Wikipedia &lt;a href="http://en.wikipedia.org/wiki/Hooking"&gt;http://en.wikipedia.org/wiki/Hooking&lt;/a&gt;&lt;br /&gt;So I won’t dive into details, as it would take much more than a single blog post to cover just the simplest of the four.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;#1&lt;/b&gt;&lt;br /&gt;The windows standard hooking is the somewhat official way to write hooks, and is part of the Win32 APIs. The main functions to look for in the MSDN is SetWindowsHookEx, and it’s all well covered in the following MSDN link:&lt;br /&gt;(&lt;a href="http://msdn.microsoft.com/en-us/library/ms644959%28v=vs.85%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms644959%28v=vs.85%29.aspx&lt;/a&gt;).&lt;br /&gt;If you are looking for a way to hook Windows Messages or Intercept those, this might be your way to go.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;#2&lt;/b&gt;&lt;br /&gt;Detours are the idea of injecting a small piece of code to the beginning of a function to jump to other place in memory and execute the code from there, before going back and executing the original function. The main problem with this method, is that in the injection process we have to overwrite a small part of the original function, and then we have to recover it in the “detour” function.&lt;br /&gt;Microsoft provides us with a nice library to automate the detours injection, and recovering of the deleted code with their Detours library &lt;a href="http://research.microsoft.com/en-us/projects/detours/"&gt;http://research.microsoft.com/en-us/projects/detours/&lt;/a&gt;&lt;br /&gt;Other detours projects:&lt;br /&gt;Easyhook:&lt;br /&gt;A. &lt;a href="http://easyhook.codeplex.com/"&gt;http://easyhook.codeplex.com/&lt;/a&gt;&lt;br /&gt;B. &lt;a href="http://code.google.com/p/easyhook-continuing-detours/"&gt;http://code.google.com/p/easyhook-continuing-detours/&lt;/a&gt;&lt;br /&gt;This method is also good for performance testing and other debugging issues.&lt;br /&gt;&lt;i&gt;BTW: Microsoft like this method so much that they introduced a compiler flag that makes sure we would have a room for injecting our detour. If the flag is set, the compiler would add the “mov edi, edi” opcode to the beginning of every function, and some extra free space between every two functions. Detouring becomes very easy when working on a program that has been compiled with the flag.&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;#3&lt;/b&gt;&lt;br /&gt;First introduced by the great Jeffrey Richter, and well documented with simple source code in his book “Windows via C/C++” &lt;a href="http://www.wintellect.com/cs/blogs/jeffreyr/archive/2008/03/14/windows-via-c-c-table-of-contents.aspx"&gt;http://www.wintellect.com/cs/blogs/jeffreyr/archive/2008/03/14/windows-via-c-c-table-of-contents.aspx&lt;/a&gt;. The principle behind this method is changing the Import Address Table (IAT) of a DLL / EXE, to prefer different functions from the ones it’s supposed to. The code samples from Jeffrey’s book are available at &lt;a href="http://wintellect.com/Books.aspx"&gt;http://wintellect.com/Books.aspx&lt;/a&gt;.&amp;nbsp;This technique is very strong for hooking at run-time. Best combined with DLL preload (AppInit_DLLs). A good usage example is presented in the following blog post:&amp;nbsp;&lt;a href="http://www.the-interweb.com/serendipity/index.php?/archives/2-Skinmine-Elaborating-on-Jeffrey-Richters-Trojan-DLL-method-for-API-hooking.html"&gt;http://www.the-interweb.com/serendipity/index.php?/archives/2-Skinmine-Elaborating-on-Jeffrey-Richters-Trojan-DLL-method-for-API-hooking.html&lt;/a&gt;&lt;br /&gt;&lt;i&gt;Note: There is a very similar method on most *nix platforms called LD_PRELOAD.&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;#4&lt;/b&gt;&lt;br /&gt;Create a DLL with the same name as the DLL containing the function we want to hook. The new DLL should contain stab functions for all the functions that we don’t want to hook, meaning a small function that just calls the original function from the original DLL, and a hook function for all the functions that we do want to hook. There are many good tutorials on this subject, and they can be easily found using Bing Google. I’ll have to recommend the ones from codeproject.com:&amp;nbsp;&lt;a href="http://www.codeproject.com/KB/DLL/CreateYourProxyDLLs.aspx"&gt;http://www.codeproject.com/KB/DLL/CreateYourProxyDLLs.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.codeproject.com/KB/DLL/Creating_a_Proxy_DLL.aspx"&gt;http://www.codeproject.com/KB/DLL/Creating_a_Proxy_DLL.aspx&lt;/a&gt;&lt;br /&gt;If you are looking for a good way to create persistent hooks, that are not injected at run-time, this might be your choice.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Now for my small original contribution:&lt;br /&gt;I've&amp;nbsp;started working on a Python C++ code generator (That's a Python script to generate C++ code) for hooks of type 3. The idea is to make life easier for writing many hooks. I’ll be taking advantage of this new code generator on Thursday at the DC9723 Hacktahon (&lt;a href="http://dc9723.org/Hackathon"&gt;http://dc9723.org/Hackathon&lt;/a&gt;), for creating a module to alter OpenGL / DirectX behavior in real-time.&amp;nbsp;The project is Open Source and anyone can browse it at: &lt;a href="https://xp-dev.com/svn/DirectHook/trunk/"&gt;https://xp-dev.com/svn/DirectHook/trunk/&lt;/a&gt;&amp;nbsp;Or SVN to it at: &lt;a href="http://xp-dev.com/svn/DirectHook/"&gt;http://xp-dev.com/svn/DirectHook/&lt;/a&gt;&amp;nbsp;Please contact me to commit changes, or to join me in developing.&amp;nbsp;Hopefully, this module would allow a user to alter 3d games by changing camera Angles, changing the light conditions, modifying textures or just seeing throw walls. One of the targets is to get to something like this:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-bUEAyJM0v7A/TgH10TN3vAI/AAAAAAABOdo/rJWqd_GX-eY/s1600/Mathack.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-bUEAyJM0v7A/TgH10TN3vAI/AAAAAAABOdo/rJWqd_GX-eY/s400/Mathack.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;(Stolen from wikipeida &lt;a href="http://en.wikipedia.org/wiki/Valve_Anti-Cheat"&gt;http://en.wikipedia.org/wiki/Valve_Anti-Cheat&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Happy hooking,&lt;br /&gt;&lt;i&gt;Assaf.&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;Update:&lt;br /&gt;It was lots of fun working at the Hackton, thanks to all the Ninjas who helped with the coding. I found the problem that caused the demo to run very slow. It seems like opengl32.dll calls LoadLibrary about every time a OpenGL API is getting invoked. What makes the hooking method we used quite problematic, as it adds a small overhead to the LoadLibrary calls. The small overhead got very big, thanks to the extended use. I would refactor the code to use proxy dll next time I’ll have a few hours to spare.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Assaf.&lt;br /&gt;&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-6267143011564410050?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/6267143011564410050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2011/06/way-to-hook.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/6267143011564410050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/6267143011564410050'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2011/06/way-to-hook.html' title='The way to hook'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-bUEAyJM0v7A/TgH10TN3vAI/AAAAAAABOdo/rJWqd_GX-eY/s72-c/Mathack.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-6159211982195839832</id><published>2011-05-05T11:22:00.000-07:00</published><updated>2011-11-18T03:43:09.175-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='puzzle'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Snaky Cube</title><content type='html'>&lt;script type="text/javascript" language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/lang-css.js"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;function addLoadEvent(func) {  var oldonload = window.onload;  if (typeof window.onload != 'function') {    window.onload = func;  } else {    window.onload = function() {      if (oldonload) {        oldonload();      }      func();    }  }}addLoadEvent(prettyPrint);&lt;/script&gt;&lt;style type="text/css"&gt;/* Pretty printing styles. Used with prettify.js. */.str { color: #080; }.kwd { color: #008; }.com { color: #800; }.typ { color: #606; }.lit { color: #066; }.pun { color: #660; }.pln { color: #000; }.tag { color: #008; }.atn { color: #606; }.atv { color: #080; }.dec { color: #606; }pre.prettyprint { padding: 2px; border: 1px solid #888; }@media print {  .str { color: #060; }  .kwd { color: #006; font-weight: bold; }  .com { color: #600; font-style: italic; }  .typ { color: #404; font-weight: bold; }  .lit { color: #044; }  .pun { color: #440; }  .pln { color: #000; }  .tag { color: #006; font-weight: bold; }  .atn { color: #404; }  .atv { color: #060; }}&lt;/style&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;The following is a puzzle that I’ve encountered at the Kubiot (Cubes) restaurant in Tel-Aviv.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-C1VHpRck_P4/TbBn2KgvqjI/AAAAAAABKsw/vF8620iDAiY/s1600/IMG_20110130_224030.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="482" src="http://3.bp.blogspot.com/-C1VHpRck_P4/TbBn2KgvqjI/AAAAAAABKsw/vF8620iDAiY/s640/IMG_20110130_224030.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;The target of the puzzle is to make a 4x4x4 cube out of this snake like shape. The small cubes are connected to each other with a cord so it’s only possible to rotate them, but not to change their position. This puzzle is a larger version of a similar puzzle that makes a 3x3x3 cube.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-keJnsq8ZN3E/TbBn1bmvG1I/AAAAAAABKsg/gA_oePlhMTk/s1600/IMG_1592.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="276" src="http://4.bp.blogspot.com/-keJnsq8ZN3E/TbBn1bmvG1I/AAAAAAABKsg/gA_oePlhMTk/s400/IMG_1592.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;Where the target is to get to this:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/--x7Du050_1M/TbBn1_s6IYI/AAAAAAABKso/U5XzjSrL0FY/s1600/IMG_1593.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="292" src="http://1.bp.blogspot.com/--x7Du050_1M/TbBn1_s6IYI/AAAAAAABKso/U5XzjSrL0FY/s400/IMG_1593.JPG" width="400" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;The guy at the restaurant said that he would give a free meal to anyone who solves it on the spot. Don’t be fooled by the 3x3x3 version of the puzzle, this one is a hard task indeed, given the fact that for a guy who knew the solution beforehand, it took about 15 minuets to set it right. So I decided to go “pirate” on this one, and take the picture that you saw at the top.&lt;br /&gt;My mile stones are:&lt;br /&gt;&lt;ol style="text-align: left;"&gt;&lt;li&gt;Writing a script to solve it at home.&lt;/li&gt;&lt;li&gt;Memorizing the solution.&lt;/li&gt;&lt;li&gt;Collecting my ~10$ prize.&lt;/li&gt;&lt;/ol&gt;&amp;nbsp;1. Brute-forcing to solution.&lt;br /&gt;Python to the rescue.&lt;br /&gt;I entered all the information about the puzzle has lengths of straight lines that could not be rotated.:&lt;br /&gt;&lt;pre name="prettyprint"&gt;data = [3,1,2,1,1,3,1,2,1,2,1,2,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,2,3,1,1,1,3,1,2,1,1,1,1,1,1,1,1,1,3,1]&lt;/pre&gt;My approach is to build a 4x4x4 array of zeros and try to fill it with squares. I defined a Point3D class for the millionth time. And set-up the cube.&lt;br /&gt;Two small questions that came up during the writing:&lt;br /&gt;1. Does anyone know about a simple implementation of Point3D in Python, so I won’t have to write it again.&lt;br /&gt;2. Does anyone know about a simpler way to define the 4x4x4 cube other then:&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;cube = []&lt;br /&gt;for x in xrange(4):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ll = []&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for y in xrange(4):&lt;br /&gt;&amp;nbsp;&amp;nbsp;      l = []&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for z in xrange(4):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l.append(0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ll.append(l)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cube.append(ll)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now I define all the valid moves in the puzzle, and include recursively the next valid moves, as it depends on the last move.&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;XDirectionP = (Point3D( 1,&amp;nbsp; 0,&amp;nbsp; 0), [])&lt;br /&gt;XDirectionM = (Point3D(-1,&amp;nbsp; 0,&amp;nbsp; 0), [])&lt;br /&gt;YDirectionP = (Point3D( 0,&amp;nbsp; 1,&amp;nbsp; 0), [])&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;&lt;br /&gt;XDirectionP[1].append(YDirectionP)&lt;br /&gt;XDirectionP[1].append(YDirectionM)&lt;br /&gt;XDirectionP[1].append(ZDirectionP)&lt;br /&gt;XDirectionP[1].append(ZDirectionM)&lt;br /&gt;YDirectionP[1].append(XDirectionP)&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The main recursion is as following:&lt;br /&gt;&lt;br /&gt;&lt;pre name="prettyprint"&gt;def nextMove(pos, dataLeft, currentDirections):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; global cube&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; global highestLevel&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if 0 == len(dataLeft):&lt;br /&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp; return True&lt;/pre&gt;&lt;pre name="prettyprint"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length = dataLeft[0]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for move in currentDirections:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newPos = pos + (move[0] * length)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if isValidLocation(newPos):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if tryToSetCubes(pos, move[0], length, len(dataLeft)):&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;&amp;nbsp;&amp;nbsp; if nextMove(newPos, dataLeft[1:], move[1]):&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return True&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;&amp;nbsp;&amp;nbsp; clearCubes(pos, move[0], length)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return False&lt;/pre&gt;&lt;br /&gt;Apparently this solution, is good enough it took %d seconds to solve it, no extra improvements were required... That’s sad, I kinda’ hoped for something more advanced.&lt;br /&gt;&lt;br /&gt;2.&lt;br /&gt;I’ve translated the result into a string of first letters of the valid moves (Left, Right, Up, Down, In, Out), just to get the 46 letters string “RULODRIULOLILURORIRODLOLUIUODIROUIRDODILDROLUR”.&lt;br /&gt;Next I called my good friend Werner, to manifest a sentence out of the string so it would be easier to memorize. The genius came up with the following:&lt;br /&gt;“Recently, upon learning of dental recovery, Ian Underwood laughed out loud. In laughing, underwood remarked, optimal recovery is realized. ordinarily, during laughing out loud, universal imagery unfolds. Or does it? Regardless of universal imagery, rarely do old dying imbeciles laugh. Don't ruin our laughter, Underwood remarked.”&lt;br /&gt;&lt;br /&gt;3.&lt;br /&gt;Here I returned to the restaurant with two of my good friends who helped me with acting like I’m going trail n’ error to solution, and it’s doing very well, but have no clue of what am I doing. On setting the very last move to the solution, a crack sound has echoed the place, leaving me with a baffled look at what had happened.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-ij_GILWCooM/TaS8XUEEY2I/AAAAAAABKnY/OBQWGnApWfs/s1600/IMG_20110411_213919.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://4.bp.blogspot.com/-ij_GILWCooM/TaS8XUEEY2I/AAAAAAABKnY/OBQWGnApWfs/s400/IMG_20110411_213919.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Alas!!!, I shouted out loud, realizing that not only am I not going to get a free meal, but I will probably have to buy them a new puzzle. Fortunately, they told me not to worry, and that it happens all the time, they would replace the cord by next week, so I could try again then.&lt;br /&gt;&lt;br /&gt;Now three weeks later and they still didn’t fix it! I started to look-up this puzzle to check where they bought it, and I found the following web site:&lt;br /&gt;&lt;a href="http://www.gaya-game.co.il/"&gt;http://www.gaya-game.co.il/&lt;/a&gt;&lt;br /&gt;Or more specifically:&lt;br /&gt;&lt;a href="http://www.gaya-game.co.il/?categoryId=31183&amp;amp;itemId=60119"&gt;http://www.gaya-game.co.il/?categoryId=31183&amp;amp;itemId=60119&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-6159211982195839832?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/6159211982195839832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2011/05/snaky-cube.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/6159211982195839832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/6159211982195839832'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2011/05/snaky-cube.html' title='Snaky Cube'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-C1VHpRck_P4/TbBn2KgvqjI/AAAAAAABKsw/vF8620iDAiY/s72-c/IMG_20110130_224030.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-7568437239191648136</id><published>2011-03-31T07:33:00.000-07:00</published><updated>2011-09-20T13:08:04.625-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LED'/><category scheme='http://www.blogger.com/atom/ns#' term='Hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='Sentrigo'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>CruiseControl Reporting, Attention &amp; Posting (CRAP)</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span id="internal-source-marker_0.24514090971135793" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;Few posts ago, I told the readers of this very blog about a device I bought from Dealextreme (&lt;/span&gt;&lt;a href="http://www.dealextreme.com/p/usb-webmail-notifier-for-pc-laptop-1m-cable-39949"&gt;&lt;span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;"&gt;1&lt;/span&gt;&lt;/a&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;, &lt;/span&gt;&lt;a href="http://www.dealextreme.com/p/usb-universal-e-mail-webmail-im-notifier-gmail-outlook-outlook-express-pop3-27062"&gt;&lt;span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;"&gt;2&lt;/span&gt;&lt;/a&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;)  for notifying about incoming E-Mails, and how I patched the program that  came with it. To freshen your memory, the USB device is a envelop shaped  box, that can glow in eight different colors. The device is identified by  Windows as a regular HID device, which means that no drivers are  required for most OSs. The colors are generated by an RGB LED, that  probably supports many other color variations (Requires hardware  modifications).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-JLO8hXnq_dE/TZNmkolYVqI/AAAAAAABKiI/_seVeFNpqdE/s1600/IMG_1541.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-JLO8hXnq_dE/TZNmkolYVqI/AAAAAAABKiI/_seVeFNpqdE/s320/IMG_1541.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;Since then I’ve made a small &lt;/span&gt;&lt;a href="http://svn3.xp-dev.com/svn/USBEmailNotifier/"&gt;&lt;span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;"&gt;open source Python project&lt;/span&gt;&lt;/a&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt; for controlling this device and making it useful.&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;Someone  told me he used this device as a good start for his project in computer  control of many electricity gadgets at his house. As a public service, I  attach here some images of the device from within.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-frBs_Lwi7Yg/TZNmlYOYiTI/AAAAAAABKig/E0GmykG3L_U/s1600/IMG_1543.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-frBs_Lwi7Yg/TZNmlYOYiTI/AAAAAAABKig/E0GmykG3L_U/s320/IMG_1543.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-O6DxRmpyJYo/TZNmllL_T_I/AAAAAAABKis/Hn6zZ4XhkUI/s1600/IMG_1544.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/-O6DxRmpyJYo/TZNmllL_T_I/AAAAAAABKis/Hn6zZ4XhkUI/s400/IMG_1544.JPG" width="300" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-mY5m4H4UrOs/TZNmmBcNiEI/AAAAAAABKi4/fy0KNBpqKVY/s1600/IMG_1545.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-mY5m4H4UrOs/TZNmmBcNiEI/AAAAAAABKi4/fy0KNBpqKVY/s320/IMG_1545.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;It seems like, there is some room on this board to add more LEDs or something, please tell me if you manage to figure out more details about it. If you want to use this board to connect it to some external device, you can remove the LED (it's the white square at the middle), and weld something else instead. I couldn't figure out what kind of a chip the black one is, and whether it's possible to reprogram it. I would open another device next week, hopefully to answer few of these questions. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;These  days I’ve made a compiling / building notification system at my work  place, so I would know whom to feed to the sharks, when the build fails.  Here’s a picture of the system.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-38WbVSaU7Vk/TZNmnSOs-zI/AAAAAAABKkc/tMjnBnDmLd8/s1600/IMG_1548.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://4.bp.blogspot.com/-38WbVSaU7Vk/TZNmnSOs-zI/AAAAAAABKkc/tMjnBnDmLd8/s640/IMG_1548.JPG" width="513" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;I’ve added the source for this system (Everything but the CuriseControl password ;) under the XP-Dev SVN project (&lt;/span&gt;&lt;a href="http://svn3.xp-dev.com/svn/USBEmailNotifier/CControlLED.py"&gt;&lt;span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;"&gt;CControlLED.py&lt;/span&gt;&lt;/a&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;).&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;Please feel free to use it, and share your own projects.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;Few updates:&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;I've got two other devices, and added support for them:&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-KFANHRWooTc/TckDa-27tQI/AAAAAAABLhA/9UVPZWqE9ag/s1600/IMG_1739.JPG" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-KFANHRWooTc/TckDa-27tQI/AAAAAAABLhA/9UVPZWqE9ag/s320/IMG_1739.JPG" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-7X7eK_wG98U/TckDbkhg3DI/AAAAAAABLhI/xVnmU7I8vsg/s1600/IMG_1741.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-7X7eK_wG98U/TckDbkhg3DI/AAAAAAABLhI/xVnmU7I8vsg/s320/IMG_1741.JPG" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-KpoaEItxogw/TckDdKspdsI/AAAAAAABLhc/LeiwyWbT-YU/s1600/IMG_1746.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-KpoaEItxogw/TckDdKspdsI/AAAAAAABLhc/LeiwyWbT-YU/s320/IMG_1746.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Yyojrx0QjMY/TckDdvG60KI/AAAAAAABLhk/TrURdqP_OS8/s1600/IMG_1748.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://4.bp.blogspot.com/-Yyojrx0QjMY/TckDdvG60KI/AAAAAAABLhk/TrURdqP_OS8/s320/IMG_1748.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ZiypidYbs9s/TckDdxLDoUI/AAAAAAABLho/v8VGTHqqX4w/s1600/IMG_1749.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-ZiypidYbs9s/TckDdxLDoUI/AAAAAAABLho/v8VGTHqqX4w/s320/IMG_1749.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-KFANHRWooTc/TckDa-27tQI/AAAAAAABLhA/9UVPZWqE9ag/s1600/IMG_1739.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;And I also found the type of the chip:&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ZJbSlxeAV4U/TckDcxzWRcI/AAAAAAABLhY/rgQiJvsVjc0/s1600/IMG_1745.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-ZJbSlxeAV4U/TckDcxzWRcI/AAAAAAABLhY/rgQiJvsVjc0/s320/IMG_1745.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"&gt;Which is most probably: &lt;a href="http://www.sonix.com.tw/sonix/product.do?p=SN8P2212"&gt;http://www.sonix.com.tw/sonix/product.do?p=SN8P2212&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-7568437239191648136?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/7568437239191648136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2011/03/cruisecontrol-reporting-attention.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/7568437239191648136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/7568437239191648136'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2011/03/cruisecontrol-reporting-attention.html' title='CruiseControl Reporting, Attention &amp; Posting (CRAP)'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-JLO8hXnq_dE/TZNmkolYVqI/AAAAAAABKiI/_seVeFNpqdE/s72-c/IMG_1541.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-1552554654993022880</id><published>2011-03-04T23:55:00.000-08:00</published><updated>2011-05-06T04:03:17.743-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='reverser engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='mint'/><category scheme='http://www.blogger.com/atom/ns#' term='memory'/><category scheme='http://www.blogger.com/atom/ns#' term='candy'/><title type='text'>Looking Into the Eye of the Bits</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;During the past four years I've been developing tools for research and implementation of a new type of software analysis. I've discussed these tools on a various occasions such as RECon2010, Nullcon2011 and DC9723.&lt;br /&gt;The purpose of these tools is to recover internal implementation details using only passive memory analysis, and without requiring any disassembly. &lt;br /&gt;These tools are now available under GPL license on the following links:&lt;br /&gt;&lt;a href="http://code.google.com/p/pymint/%20"&gt;http://code.google.com/p/pymint/ &lt;/a&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/pycandy/"&gt;http://code.google.com/p/pycandy/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The latest version of the presentation + WP is available in the SVN of pymint:&lt;br /&gt;&lt;a href="http://code.google.com/p/pymint/source/browse/Docs/"&gt;http://code.google.com/p/pymint/source/browse/Docs/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For more details on the subject you are more than welcome to visit the websites of the kind conferences which gave me the place to mumble about my work:&lt;br /&gt;&lt;a href="http://nullcon.net/speakers/bakkar/"&gt;http://nullcon.net/speakers/bakkar/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://recon.cx/2010/speakers.html#memory"&gt;http://recon.cx/2010/speakers.html#memory&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.dc9723.org/wiki/Meetings"&gt;http://wiki.dc9723.org/wiki/Meetings&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm currently looking for more places to spread my word, if you know of such, please contact me. &lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-1552554654993022880?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/1552554654993022880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2011/03/looking-into-eye-of-bits.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/1552554654993022880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/1552554654993022880'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2011/03/looking-into-eye-of-bits.html' title='Looking Into the Eye of the Bits'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-8922529617879359062</id><published>2010-11-26T08:21:00.000-08:00</published><updated>2010-11-26T08:21:56.028-08:00</updated><title type='text'>He must be very proud of himself...</title><content type='html'>He must be very proud of himself, the engineer who designed the stereo system in my car.&lt;br /&gt;Look at it.&lt;br /&gt;&lt;img height="480px;" id="internal-source-marker_0.6889308609603606" src="https://lh6.googleusercontent.com/NDCaH7C7xvqbM5lRjgqMls3ncm_TKzm2zVUzy0GmG0HIIDrZivVX2i2Ec-ue0FC1xn9lfoc8pdLPtqiFPPLUCmF5907GahZf_cNoQcBXh1suHkGX8w" width="640px;" /&gt;&lt;br /&gt;Just look at it...&lt;br /&gt;&lt;img height="480px;" id="internal-source-marker_0.6889308609603606" src="https://lh5.googleusercontent.com/yS4e6i9G2Mnvw-MT8tzt-YzMwYQc9oI-ILWzClrx2XjcrQR8vbc8y_R4rwX3P8gi6jY32wcbXzQuf76uzdKYHKtSMwjZtOXN6GkVk_I5ceMU_pZBeQ" width="640px;" /&gt;&lt;br /&gt;You see the round button in middle, well, don’t be fooled that's no ordinary button.&lt;br /&gt;This witch crafted button, can be rotated both directions, can be pushed in, can be pushed up, down, left, right and all the corners as well. And it’s surrounded by smaller buttons all around it.&lt;br /&gt;This small, yet special in it’s own way button, is the control for the entire system, and maybe the entire universe (but I couldn’t find the menu for that, just yet). At the beginning I thought that this marvelous system got no memory for radio stations, but I couldn't be more wrong. It’s got hand full of memory, only it’s very near by impossible to set it up. I think the guys from Pioneer saw the Onion &lt;a href="http://www.youtube.com/watch?v=8AyVh1_vWYQ"&gt;http://www.youtube.com/watch?v=8AyVh1_vWYQ&lt;/a&gt; about Sony new piece of shit, and thought they must have one of their own, to show those bastards at Sony who can make a bigger piece of shit. One might say that I’m just an incapable user, and I’m not a good example, and one won’t be so far from the truth in most cases, but not on this one. To prove my point I called my good hearty, Mr. Werner, to try to program the channels on this thing, during an hour drive, Mr. Werner, which is a certified genius, has taken about 20 minutes to figure out how to perform the task, and then saying “No way, it’s that painfull”. I have him explain the process here:&lt;br /&gt;&lt;div style="color: #666666;"&gt;“Do you mind leaving me alone, please. I don’t care about your dumb blog, OK?!”&lt;/div&gt;&lt;br /&gt;I’ve done this test with other smart guys, one of them my brother who is an electronics engineer, and quite smart indeed, has taken about 20 minutes to figure it out, with just small help from me (that’s a good record, trust me), but refused to go through the pain of actually setting a stations.&lt;br /&gt;Besides that, it’s a great system with features such as AUX in jacket, A USB stick reader, MP3, WMA and many other formats support, nice blue-tooth integration, and so on, and so on...&lt;br /&gt;&lt;br /&gt;P.S.&lt;br /&gt;Watch the following music video &lt;a href="http://www.youtube.com/watch?v=7Hwe-Pt7Fe0"&gt;http://www.youtube.com/watch?v=7Hwe-Pt7Fe0&lt;/a&gt;, and click the like button, will ya?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-8922529617879359062?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/8922529617879359062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2010/11/he-must-be-very-proud-of-himself.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/8922529617879359062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/8922529617879359062'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2010/11/he-must-be-very-proud-of-himself.html' title='He must be very proud of himself...'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-8769975250048474217</id><published>2010-08-06T07:15:00.000-07:00</published><updated>2011-04-21T11:09:43.021-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reinteract'/><category scheme='http://www.blogger.com/atom/ns#' term='Idlespoon'/><category scheme='http://www.blogger.com/atom/ns#' term='Research'/><category scheme='http://www.blogger.com/atom/ns#' term='Idlefork'/><category scheme='http://www.blogger.com/atom/ns#' term='pyscripter'/><category scheme='http://www.blogger.com/atom/ns#' term='interpreter'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='Idle'/><title type='text'>Python as a Research Tool</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I love the Python programming language. It amazes me how when someone writes pseudo code to describe some algorithms, it tends to be a valid or almost valid Python code, even if the person who wrote it has no idea what Python is. Python is just the most natural way for humans to describe code.&lt;br /&gt;Today I would like to discus the uses of Python as a research tool. I tend to believe that many different researches could benefit from this tool. I use Python for any kind of research I perform. Let’s take a look at my Python usage during the day:&lt;br /&gt;First for any calculation I need to do, I use Python instead of calc.exe. This way I’ve got a log of all the operations I’ve been doing, I can play with the numbers in various ways, and see how everything changes if I just change a value in any of the steps of my calculation. I find the Python Reinteract interpreter, to be the best environment for the task. For those of you who are not familiar with Python Reinteract, it’s an interpreter in which you can go back to any executed line and change it, and see all the results reevaluated in cascade. A little bit like a Soviet encyclopedia, because it’s possible to rewrite the history.&lt;br /&gt;This tool bring us to my college studies, in which I use Python to solve Linear Algebra and Calculus questions. The math modules that comes with Python and the Linear Algebra modules that comes with the Reinteract environment are perfect to solve, test, visualize, check guesses and gain better understanding of the studies.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_Y_ahNBaJj0I/TFwdbP1f7QI/AAAAAAABBQs/lVDyqpZXQSY/s1600/Reinteract1.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" height="586" id="BLOGGER_PHOTO_ID_5502305198684499202" src="http://2.bp.blogspot.com/_Y_ahNBaJj0I/TFwdbP1f7QI/AAAAAAABBQs/lVDyqpZXQSY/s640/Reinteract1.png" style="display: block; margin: 0px auto 10px; text-align: center;" width="640" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_Y_ahNBaJj0I/TFwdf56rY6I/AAAAAAABBRI/tf2MG0-9mqQ/s1600/Reinteract2.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" height="586" id="BLOGGER_PHOTO_ID_5502305278699987874" src="http://1.bp.blogspot.com/_Y_ahNBaJj0I/TFwdf56rY6I/AAAAAAABBRI/tf2MG0-9mqQ/s640/Reinteract2.png" style="display: block; margin: 0px auto 10px; text-align: center;" width="640" /&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/_Y_ahNBaJj0I/TFwczbV3JPI/AAAAAAABBOU/vc1NFCjznIc/s1600/merge.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt; &lt;/a&gt;&lt;a href="http://1.bp.blogspot.com/_Y_ahNBaJj0I/TFwdkLWiQJI/AAAAAAABBRQ/VVB9DUACp5M/s1600/Reinteract3.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" height="586" id="BLOGGER_PHOTO_ID_5502305352099709074" src="http://1.bp.blogspot.com/_Y_ahNBaJj0I/TFwdkLWiQJI/AAAAAAABBRQ/VVB9DUACp5M/s640/Reinteract3.png" style="display: block; margin: 0px auto 10px; text-align: center;" width="640" /&gt;&amp;nbsp;&lt;/a&gt; &lt;a href="http://3.bp.blogspot.com/_Y_ahNBaJj0I/TFwczbV3JPI/AAAAAAABBOU/vc1NFCjznIc/s1600/merge.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;But my true love is Idle-spoon, a simple variation of the well known idle-fork. The things that where added to the idle-fork in the idle-spoon version are better navigation, a Squeezer (shown in the pictures below) and enabling of more then one instance. When I preform research, the current status of the interrupter holds my current knowledge of the inspected target. I can access any piece of information, because it is all stored in global variables. This allows me to play with the data to try to make some sense of it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_Y_ahNBaJj0I/TFwdqngzyhI/AAAAAAABBRs/5JBRWtHVobM/s1600/mint_sample1.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" height="439" id="BLOGGER_PHOTO_ID_5502305462738209298" src="http://4.bp.blogspot.com/_Y_ahNBaJj0I/TFwdqngzyhI/AAAAAAABBRs/5JBRWtHVobM/s640/mint_sample1.png" style="display: block; margin: 0px auto 10px; text-align: center;" width="640" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_Y_ahNBaJj0I/TFweTzOblFI/AAAAAAABBUM/CMlNFTm68ng/s1600/mint_sample2.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" height="439" id="BLOGGER_PHOTO_ID_5502306170256987218" src="http://1.bp.blogspot.com/_Y_ahNBaJj0I/TFweTzOblFI/AAAAAAABBUM/CMlNFTm68ng/s640/mint_sample2.png" style="display: block; margin: 0px auto 10px; text-align: center;" width="640" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_Y_ahNBaJj0I/TFweYnJtmjI/AAAAAAABBUU/0fhgZxhubUc/s1600/mint_sample3.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" height="401" id="BLOGGER_PHOTO_ID_5502306252915317298" src="http://2.bp.blogspot.com/_Y_ahNBaJj0I/TFweYnJtmjI/AAAAAAABBUU/0fhgZxhubUc/s640/mint_sample3.png" style="display: block; margin: 0px auto 10px; text-align: center;" width="640" /&gt;&lt;/a&gt;&lt;br /&gt;The only thing I feel the lack of is a good assembly debugger to work inside the Python interpreter. As for PDB, I see no use for it due to the GDB syndrome it shows. GDB is a command line debugger that can make a good platform for writing debugging tools. But using the GDB directly is something that tends to be quite slow, ineffective, and limiting of expressiveness.&lt;br /&gt;I’m currently checking the PyScripter, to see if it is any good, for now I can just say that it looks like there are still some functions missing or incomplete.&lt;br /&gt;&lt;br /&gt;Other than the variants above (all built upon cPython), I found that there are more variants, such as iPython which doesn’t have any GUI based environment, and therefore I find it to be just a bit less comfort to work with. I love vim, and I sometimes use gvim to write big scripts. I once read in a book that there is a good eclipse plugin for developing Python, but it has no instant interpreter, and therefore should not be considered for research. And for last and least, the Iron Python / Jython, which should both be considered blasphemy. The implementation of the Python VM inside of the Java VM or any other VM, is something that makes no sense to me. It usually suffers from the lack of many modules that I’m used to work with, if it works at all.&lt;br /&gt;&lt;br /&gt;Links:&lt;br /&gt;&lt;a href="http://www.reinteract.org/trac/"&gt;http://www.reinteract.org/trac/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://idlespoon.python-hosting.com/"&gt;http://idlespoon.python-hosting.com/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/pyscripter/"&gt;http://code.google.com/p/pyscripter/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Big thanks to the Fox for helping on the making of this blog post.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-8769975250048474217?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/8769975250048474217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2010/08/python-as-research-tool.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/8769975250048474217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/8769975250048474217'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2010/08/python-as-research-tool.html' title='Python as a Research Tool'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Y_ahNBaJj0I/TFwdbP1f7QI/AAAAAAABBQs/lVDyqpZXQSY/s72-c/Reinteract1.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-127365785461933624</id><published>2010-03-26T11:52:00.000-07:00</published><updated>2010-03-26T11:55:00.152-07:00</updated><title type='text'>Cellphones Party</title><content type='html'>A cellphone is actually a computer with a microphone and an amplifier.&lt;br /&gt;We  used to think that its speakers are quite lousy, and rightfully so,  because they've got no sound box which is a crucial part in creating a  good natural sound. Nonetheless our judgment is based mostly on phone  calls' quality which is pretty bad because of the GSM encoding the voice  go through when going over the cellular network.&lt;br /&gt;Current phone  technology though, with smart phones such as the iPhone, the N95 and  Android based phones got better sound quality than ever before. These  phones became quite popular recently, striking me with the idea of  putting a bunch of those phones together to play music. The quantity of  phones might just prove enough to compensate for the quality.&lt;br /&gt;&lt;br /&gt;My  idea is to write an application for smart phones, to find all the phones  running the application that are located in the same room (or  preselected phones). The application will synchronize the phones by  locating the distance and direction from each other, and then play some  music as best as possible. Finding the direction and distance might be  as easy as playing a short tone, and waiting for a reply from the other  phones over Bluetooth or similar means. By measuring the reply time of  about three or four phones, it's possible to calculate the direction and  distance.&lt;br /&gt;&lt;br /&gt;Although the phones won't produce the best music  quality, it could be fun to play with. For instance:&lt;br /&gt;1. Playing  perfect surround sound, which means making sound as if it is coming from  different parts of the room, even from places with no phones.&lt;br /&gt;2.  Creating Active Noise Control, or an interference sound wave. This can  create better sound, cancel out noises or even create a sound that only a  certain person or a group of people in the room could hear. As far as I  understand, it is a bit out the plausible range of the speakers and the  computational power of the CPU, but I would love to hear more of the  subject from anyone whose got a better understanding.&lt;br /&gt;3. Creating a  sonar, to create a 3d map of the room and the objects it contains.  Again, my lack of understanding forbids me from knowing the plausibility  of the challenge.&lt;br /&gt;&lt;br /&gt;On a different but related subject, I like the  idea that everyone in a party would have the ability to vote for the  next song on the play list. It is already common to find in restaurants  songs menu which you can choose song from by sending SMS, but still  putting it as an extra interaction of the parties with the DJ has some  added value to the concept. Allowing people to watch the play list of the  party, voting for songs, and sending insulting messages to all the  people who vote for U2 songs is a must for every successful party.&lt;br /&gt;&lt;br /&gt;P.S.&lt;br /&gt;I  forgot to thanks Werner for helping me on the last post. Big thanks  goes to Omer for this one, check out his new awesome fun web-game @ &lt;a href="http://www.knowthesong.com/app/" id="vgba" title="http://www.knowthesong.com/app/"&gt;http://www.knowthesong.com/app/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-127365785461933624?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/127365785461933624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2010/03/cellphones-party.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/127365785461933624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/127365785461933624'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2010/03/cellphones-party.html' title='Cellphones Party'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-753532286807229794</id><published>2010-03-18T10:04:00.001-07:00</published><updated>2010-05-08T02:09:11.277-07:00</updated><title type='text'>Patch like there's no tommorow</title><content type='html'>On this post I would like to tell the story of three little binary  patches I've done recently. I find patching to be the highest form of  hacking, it requires decent reverse engineering skills combined with  good OS understanding. Every Pirate must have its own eye patch.&lt;br /&gt;&lt;br /&gt;1.  Gmail Notifier:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Y_ahNBaJj0I/S-UqKtyAB1I/AAAAAAAAAIo/5t7WAlwfFO4/s1600/GmailNotifier.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 258px;" src="http://2.bp.blogspot.com/_Y_ahNBaJj0I/S-UqKtyAB1I/AAAAAAAAAIo/5t7WAlwfFO4/s400/GmailNotifier.jpg" alt="" id="BLOGGER_PHOTO_ID_5468823686087706450" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Not long ago I bought a USB mail notifier, which is a  small LED lamp in the shape of an envelope, that glitters every time I  get a new email. About 8 USDs on DealExtreme (&lt;a href="http://www.dealextreme.com/details.dx/sku.27062" id="ao5." title="http://www.dealextreme.com/details.dx/sku.27062"&gt;http://www.dealextreme.com/details.dx/sku.27062&lt;/a&gt;).  I didn't quite like the software it came with, so I decided I would add  the ability of turning the LED on n' off to some better mail notifier.  I've spent some time figuring out how to control it using a C++ tool  that I wrote, that did not work whatsoever. After some frustrating long  hours of reading on the MSDN, I turned to reverse engineer the C#  software that came with the device combing some USB port monitoring.  After failing again to turn on this stupid LED, I called Python to the  rescue. I found out that there is an HID USB module for Python that  makes life so much easier. I must say that the Python module was so good  at explaining everything, that after two minutes of playing with it, I  instantly got the freaking device on, I understood what was wrong with  my C++ code and I gained a better understanding of the entire HID  mechanism. And my message for everyone who reads this post is, don't  work hard, use Python. Anyhow, now I got a small script that sets the  USB device to whatever color I choose. I installed the Gmail notifier  that is written by Google, set it up, and almost instinctively loaded it  to IDA. Strings like "%d unread mails" or "No new mails" were easy to  find, so it became quite clear where the patch should go. Using Ollydbg,  I wrote the patch down. Ollydbg has a good assembling option, where one  can enter assembly code easily, check the encoding and later copy it  into the original EXE file. Easy as one, two, three. If anyone has ideas  on ways to improve this process, please do tell.&lt;br /&gt;&lt;br /&gt;2. SWF32.dll.  I've written before about my Flash games cheating experience. One of the  problems I was telling you about was patching an Action Script byte  code at real time, because after the Flash VM loads the code it changes  it and optimizes it, and makes it hard for me to find the relevant code  in the memory. So I wanted to add an option to patch an SWF file just  after the browser is done loading it, but a second before it's loaded by  the VM. The SWF file format supports ZLib compression, and most of the  games out there take advantage of it. So I thought a good place to patch  would be after the file is inflated. On this attempt I wanted to write  down a patch that is a bit more complicated; a patch that would load a  set of binary alterings for the SWF file from some text file, check that  the original bytes match the target (To avoid oopsies) and apply. So  for this patch I used the Microsoft Detours Library, published for free,  examples included, on the MSDN. I found the detour library to be very  intuitive and useful.&lt;br /&gt;&lt;br /&gt;3. The Matrix. I found the bug on the  Matrix that allows Neo to jump over buildings, I fixed it and banned the  user... Ok, I had another real patch, but I think I'll save it for  another time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-753532286807229794?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/753532286807229794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2010/03/patch-like-theres-no-tommorow.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/753532286807229794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/753532286807229794'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2010/03/patch-like-theres-no-tommorow.html' title='Patch like there&apos;s no tommorow'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Y_ahNBaJj0I/S-UqKtyAB1I/AAAAAAAAAIo/5t7WAlwfFO4/s72-c/GmailNotifier.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-4227131180304171706</id><published>2009-11-27T13:12:00.000-08:00</published><updated>2009-12-02T10:08:23.984-08:00</updated><title type='text'>Generic Game</title><content type='html'>&lt;p class="MsoNormal"&gt;I like playing card games, and lucky me, there is a huge variety of card games to choose from.&lt;br /&gt;Some of the games I like to play got a PC version as well, Solitary, Harts or even Taki are all very common casual games to play on the computer. I tried to figure out the reason, why it is that all the PC version of the games are so doll, poorly implemented, and generally very limited. For example, there is a local law in the realty version of Taki that if someone is left with only one card in hand he must declare "Last card", or else he have to take another seven new cards. Now the problem with Taki PC implementations is that it does not aware of this law, and there is no way for players to add it to the game. Another example would be the luck of undo in the windows solitary game.&lt;br /&gt;&lt;br /&gt;Now it's one thing to say, "Oh, look at all these crappy games", and another to show that it's possible to implement it fairly better with less effort. So, let me explain, what could be done better.&lt;br /&gt;When some people are gathered around for a good game of Munchkin, the only thing that supervise the game, and make sure that everyone are playing by the rules, is the players themselves, and none but them. I suggest the creating of a new gaming system that would replace all other PC card games whatsoever. The new system would have no rules programed into it. That's right no rules. Living back the need for rules would make it much essayer to program. Rules are taking the most time and effort to program, one can compared it to a big state machine, which none likes to write down, and none should. Furthermore, the more options that the game has, such as the "Last card" rule in Taki, the more pain in the ass it is to program it, and the poor developers are doomed to always forget some rules that are found in the real world game. It's time to give the players back the control over the game, and untie the bondage. All we need is a system that supplies a full discloser on what’s going on in the game. In this new kind of system, none would be able to perform a move in the game without everyone else to know about it, but nothing would stop him from performing it. I believe it's cryptographically possible to create such an environment using basic concepts of modern cryptography. Moreover, it would be possible to prove that someone took a random card from a virtual deck of cards, but none would have the information on which card it is, but the player who got it.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Of course, we are still left with the problem of two players join forces to win the game together, but that is a none virtual world problem as well.&lt;br /&gt;&lt;br /&gt;I say it's time for us to have a descent card games system, made specifically for card games, but not any one in specific. The platform would allow anyone to load any kind of cards he or she likes as long as that person got the cards pictures in his / her arsenal of cards. It would be possible to take a card and put it on a virtual game table, or to hold it in virtual hand. Any player would be able to see what’s going on the table and to count the number of cards the other players are holding in their hands. Many games got different common move, such as putting a card from your hand on the table sides up in one game and sides down in another, therefor configurability is highly important.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;So who wants to write it down with me?&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-4227131180304171706?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/4227131180304171706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2009/11/generuc-game.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/4227131180304171706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/4227131180304171706'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2009/11/generuc-game.html' title='Generic Game'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-4406765004086568929</id><published>2009-10-23T07:39:00.000-07:00</published><updated>2009-10-23T07:42:05.552-07:00</updated><title type='text'>Call waiting the feature that can't</title><content type='html'>I'm not so sure if this thing is the same all over the would, but what I'm gonna describe here is the horrors of call waiting in Israel.&lt;br /&gt;From the old times in which we used to share the booties over BBSs, the times when we used to play duke3d / c&amp;amp;c over modem connection, and the times of the very first steps we stumbled in the new born technology that is the Internet, the call waiting was a nothing but a big pain in the $%*. I remember how everybody just looked for a way to disable this new awful feature. Today, the feature turned to be, rightfully, a great deal of laughter material for many sitcoms.&lt;br /&gt;Once one chooses to use it, he can never be sure about who would show up on the other side after clicking the green button. The situation I found the most annoying is getting a call waiting while listing to the recorded messages. Not only that it's impossible Ignore the call waiting due to the fact that all the buttons on your phone are now used only for the purpose of answering the call, but if you choose to take the incoming call, you are ought to lose the last message for ever, with no chance to ever recover it. Just say "NO" to call waiting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-4406765004086568929?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/4406765004086568929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2009/10/call-waiting-feature-that-cant.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/4406765004086568929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/4406765004086568929'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2009/10/call-waiting-feature-that-cant.html' title='Call waiting the feature that can&apos;t'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-968800867229480755</id><published>2009-09-02T10:09:00.000-07:00</published><updated>2011-11-18T03:46:11.468-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DB'/><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='reverser engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='Data bases'/><category scheme='http://www.blogger.com/atom/ns#' term='Sentrigo'/><category scheme='http://www.blogger.com/atom/ns#' term='Research'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Passwordaizer'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><category scheme='http://www.blogger.com/atom/ns#' term='MSSQL'/><title type='text'>Sentrigo Passwordizer</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="MsoNormal" style="direction: ltr; text-align: left;"&gt;I haven't posted for quite some time as my recent fun project failed to produce any worthwhile results. I hope to find the time to polish it, to be able to publish something.&lt;br /&gt;&lt;br /&gt;Meanwhile some interesting stuff has happened at my work which is worth writing about.&lt;br /&gt;I have found some security flaw in the all mighty SQL Server database, all versions included.&lt;br /&gt;My company, Sentrigo, has asked me to write a Proof Of Concept which later we decided to make into a tool which mitigates the problem. We published the tool for free download on our web site &lt;a href="http://www.sentrigo.com/passwords" id="luev" title="http://www.sentrigo.com/passwords"&gt;http://www.sentrigo.com/passwords&lt;/a&gt;.&lt;br /&gt;The tool created some buzz &lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;span style="color: white;"&gt;(We call it &lt;/span&gt;&lt;span style="color: white;"&gt;buzzwordizer&lt;/span&gt;&lt;span style="color: white;"&gt;)&lt;/span&gt;&lt;/span&gt;, so I decided to write down what exactly stands behind it.&lt;br /&gt;&lt;br /&gt;It appears that SQL Server is saving in memory all plain text passwords of any user that is currently logged in with a specific kind of authentication called native SQL authentication (enabled only in mixed mode). The passwords are saved intentionally in an internal data structure containing log-in information. That data structure is kept allocated in memory, it's not just some memory left-overs wandering around the free blocks in the heap. I know this for sure, because I have succeeded in writing a tool to jump through some pointers in constant offsets in memory, to get from the global sessions table to all passwords. Needless to say, I have never seen these passwords vanish from memory for as long as the user is still logged in. &lt;/div&gt;&lt;div class="MsoNormal" style="direction: ltr; text-align: left;"&gt;&lt;br /&gt;There are only two ways to log in to SQL Server. One is this method and the other is Windows authentication, which lets Windows perform the entire process of logging in. The latter method is not flawed. Microsoft suggest that you use the Windows authentication method, and even refers to the other one as deprecated in some cases. Despite that, Sentrigo has learned that many users still use the less recommended method, because it is easier to configure.&lt;/div&gt;&lt;div class="MsoNormal" style="direction: ltr; text-align: left;"&gt;&lt;br /&gt;Now, one may ask what is so wrong in saving plain passwords in memory? Every trained Ninja knows that a highly privileged log-in is required to gain access to process memory. And once such log-in is obtained, the sky is the limit for what the user can do with it. On the other hand, up until SQL Server 2008 there had been a SQL command called DBCC BYTES that allowed a privileged user to read the local process memory remotely. Notice that being a database privileged user does not necessary mean being a local machine administrator, on the contrary - some organizations separate the two for security reasons, which is violated by this flaw.&lt;br /&gt;Furthermore, the flaw could be combined with some other flaw which provides only memory leaking, to create a remote passwords dumper, although I'm not familiar with any such flaws at the moment.&lt;/div&gt;&lt;div class="MsoNormal" style="direction: ltr; text-align: left;"&gt;&lt;br /&gt;To summarize it I would like to quote my CTO Slavik Markovich, from one of the posts published about this bug:&lt;br /&gt;&lt;i&gt;"Developers go to great lengths to ensure passwords are not even transmitted in clear text (for example at the time of login), let alone stored in a readable form.  Users have come to expect that their personal passwords, are exactly that –personal – and that not even administrators can see them. Exploiting this vulnerability, an administrator will be able to see the passwords of users and applications that have connected to SQL Server, all the way back to the last restart. We respectfully disagree with Microsoft’s view that  since it requires administrative privileges, the risk is mitigated.  Even if you trust your admins, there are plenty of hackers capable of gaining escalated privileges, who could now easily access other systems across the network using these passwords."&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;After all, I would not consider this as major security problem as remote code exploitation, but it does indicates low security considerations, and could lead to bigger problems.&lt;br /&gt;&lt;br /&gt;The thing I have found the most amazing about it is the way the Microsoft Security Response Team downplayed it. I have met more than one guy from the team in the past, and I must say that the team includes some well trained Ninjas that really should be adored for their good understanding of technical and low level details. They are all well familiar with every security aspects, and they have done some miraculous work in the past. On the other hand, from my point of view, they got a big fail on bureaucracy. They were quoting stuff from their books about how you should always trust your Administrators, and by that, they have failed to address this bug in the correct manner. And last and not least, the bug is still there. &lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;span style="color: white;"&gt;Bruce,&lt;/span&gt; &lt;span style="color: white;"&gt;to me you are still a phenomenal Ninja. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;Relevant  links:&lt;br /&gt;&lt;a href="http://www.sentrigo.com/" id="f0xe" title="http://www.sentrigo.com/"&gt;http://www.sentrigo.com/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.sentrigo.com/passwords" id="d1r3" title="http://www.sentrigo.com/passwords"&gt;http://www.sentrigo.com/passwords&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.slaviks-blog.com/" id="glga" title="http://www.slaviks-blog.com/"&gt;http://www.slaviks-blog.com/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.businesswire.com/portal/site/google/?ndmViewId=news_view&amp;amp;newsId=20090902005149&amp;amp;newsLang=en" id="pf4r" title="http://www.businesswire.com/portal/site/google/?ndmViewId=news_view&amp;amp;newsId=20090902005149&amp;amp;newsLang=en"&gt;http://www.businesswire.com/portal/site/google/?ndmViewId=news_view&amp;amp;newsId=20090902005149&amp;amp;newsLang=en&lt;/a&gt;&lt;br /&gt;&lt;a href="http://searchsecurity.techtarget.com/loginMembersOnly/1,289498,sid14_gci1366853,00.html" id="y1ey" title="http://searchsecurity.techtarget.com/loginMembersOnly/1,289498,sid14_gci1366853,00.html"&gt;http://searchsecurity.techtarget.com/loginMembersOnly/1,289498,sid14_gci1366853,00.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.securitypronews.com/insiderreports/insider/spn-49-20090902PasswordFlawFoundInMicrosoftSQLServer.html" id="zuts" title="http://www.securitypronews.com/insiderreports/insider/spn-49-20090902PasswordFlawFoundInMicrosoftSQLServer.html"&gt;http://www.securitypronews.com/insiderreports/insider/spn-49-20090902PasswordFlawFoundInMicrosoftSQLServer.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.eweek.com/c/a/Security/Microsoft-Downplays-SQL-Server-Database-Vulnerability-893487/" id="jqmo" title="http://www.eweek.com/c/a/Security/Microsoft-Downplays-SQL-Server-Database-Vulnerability-893487/"&gt;http://www.eweek.com/c/a/Security/Microsoft-Downplays-SQL-Server-Database-Vulnerability-893487/&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-968800867229480755?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/968800867229480755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2009/09/sentrigo-passwordizer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/968800867229480755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/968800867229480755'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2009/09/sentrigo-passwordizer.html' title='Sentrigo Passwordizer'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-5892449761464515628</id><published>2009-08-07T02:42:00.000-07:00</published><updated>2009-08-07T02:50:13.693-07:00</updated><title type='text'>Anti Theft</title><content type='html'>&lt;div&gt;&lt;div&gt;               &lt;br /&gt;Welcome to my 2nd post, and for this post I already would like to introduce a guest, so please welcome him with cheers and rise your cups of Grog for The Raven Shkol.&lt;br /&gt;All Ideas and stories for this entry are credited to both me and Shkol all the same.&lt;br /&gt;&lt;br /&gt;So, it all started not so long ago, when I got to become a victim to a crime activity. Someone broken to my apartment, while I was away, and stole my work's laptop. Actually he also took my lock-picking kit (Look at the Irony, my lock-picking kit got stolen)&lt;br /&gt;Luckily me, I had backups of everything, and the laptop was not an expensive piece of hardware.&lt;br /&gt;But, this incidence got me thinking on what could I do better to make sure this would never happen again.&lt;br /&gt;Soon enough I called Shkol to the rescue, because he got quite a wide experience in getting robbed, mugged or strangled to death.&lt;br /&gt;We found out that there are many really cheap and simple solutions, to make it much harder for someone to break to your flat.&lt;br /&gt;But, this is not what we would like to discuss here. What we really would like to go over is the ideas we had gathered for protecting either computers or the information on them form physical thefts.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Some of the ideas we got were simple and wired at the same time such as:&lt;br /&gt;Example (For desktop computers only) Buying heavy weights at the local sports store, I got me about 10kg. Put the weights inside the computer case. Make sure the weights are well tied to the case and invisible from out side. Hope, no one would be determined enough to steal such a heavy piece of metal.&lt;br /&gt;&lt;br /&gt;While other ideas were as trivial as locking the computer to something with a chain or so, for most computers cases got a place to put a lock on. Although, these locks are so easy to overcome for the trained ninja, in my case a burglar would find the lock-picking tools in the drawer next to the computer (and if that is not enough, there is a beginners lock picking guide next to it).&lt;br /&gt;&lt;br /&gt;Some solutions were involving software solutions to make sure no one can access your information even if he get to put his hands on your precious hardware.&lt;br /&gt;Either by encryption, Yes, I know it's quite a dull one. Anyway here are some links to good implementations we found:&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt; &lt;a title="http://www.microsoft.com/windows/windows-vista/features/bitlocker.aspx" href="http://www.microsoft.com/windows/windows-vista/features/bitlocker.aspx" id="sonw"&gt;http://www.microsoft.com/windows/windows-vista/features/bitlocker.aspx&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a title="http://www.truecrypt.org/" href="http://www.truecrypt.org/" id="a_4x"&gt;http://www.truecrypt.org/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;Another approach to the problem would be using a data bomb. Its seems like there are programs to erase all the information on the disk once someone is giving a wrong password 3 times or so.&lt;br /&gt;Or a better way to get the same effect would be to change your login account to be hidden, and create a "honey-pot" user with no passwords and a startup script which makes a fresh new brick out of your box.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;The clothing store solution; using a two small devices that starts an alarm once the distance between the two is more then an apartment length (which is very small, in my case). I would recommend putting one of the devices inside the computer case and the other buried under the tiles. Very good and cheap such devices could be bought from DealExtreme:&lt;ul&gt;&lt;li&gt;&lt;a title="http://www.dealextreme.com/details.dx/sku.3407" href="http://www.dealextreme.com/details.dx/sku.3407" id="kd.7"&gt;http://www.dealextreme.com/details.dx/sku.3407&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a title="http://www.dealextreme.com/details.dx/sku.23633" href="http://www.dealextreme.com/details.dx/sku.23633" id="u9.-"&gt;http://www.dealextreme.com/details.dx/sku.23633&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;If we are looking for some sensors to monitor any move of the computer, one common device that is packed with sensors would be a cell phone. Even the simplest phone with camera has an accelerometer in it. The accelerometer could be used to identifying the computer is pulled up. And once the situation is recognized sending an SMS or performing a call to 911 with pre-recorded message could be nice (But try not calling 911 on false positives, ok).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;But, lets just say that we deal with quite a determined scum, which was able to pass all of our defense systems (And was strong enough to carry 15kg computer, down the road). Is there a way now, to find the new location of our precious? Well in case you thought about it in advance, there are some. One can buy some kind of a GPS device to send in a Beacon once in a while, just hope the signal would be strong enough, and that it wont be pointing to location in the middle of the ocean.&lt;br /&gt;I tend to think that a solution using an IPhone with the "&lt;a title="Find My IPhone" href="http://www.apple.com/mobileme/whats-new/" id="agqy"&gt;Find My IPhone&lt;/a&gt;" app could give out good results, quick and simple.&lt;br /&gt;The thing is that these days I tend to think it's possible to achieve same results using just WiFi. Cell phones with WiFi and GPS became very popular lately, and if someone would establish a project for volunteers to map the locations of most WiFi hotspots / home routers, it would be possible to identify the location of devices with just identifying which WiFis are around it. Unfortunately, someone told me http://www.wefi.com/ thought about it before me.&lt;br /&gt;&lt;br /&gt;And now for a bit less practical solutions:&lt;br /&gt;A really awsome project could be, to write a new BIOS firmware to hold a true password protection, one that is not as simple to overcome as removing the battery from the mother-board. Most of the complicated work has already done in projects such as &lt;a title="OpenBios" href="http://www.openfirmware.info/Welcome_to_OpenBIOS" id="lvex"&gt;OpenBios&lt;/a&gt;, and this could be really nice extra feature to add to it. Of course, it won't protect the information found on the disk (unless you add some kind of encryption to it), but it sure could make an untrained ninja to think he just stole a 10+ kg brick.&lt;br /&gt;&lt;br /&gt;You can train your computer to remember which WiFis are found around it, and to ask for password to approve any work in a new WiFis environment.&lt;br /&gt;&lt;br /&gt;Finnaly, here are some links to relevant websites, that are worth a better page rank:&lt;br /&gt;&lt;a title="http://www.bzeek.com/" href="http://www.bzeek.com/static/index.html" id="ixrc"&gt;http://www.bzeek.com/&lt;/a&gt;&lt;br /&gt;&lt;a title="http://www.loki.com/" href="http://www.loki.com/" id="h-.."&gt;http://www.loki.com/&lt;/a&gt;&lt;br /&gt;&lt;a title="http://www.wigle.net/" href="http://www.wigle.net/" id="kn2b"&gt;http://www.wigle.net/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So, that's what we had to say on the subject, I would love to hear any new solutions to the problem, so feel free to drop me a message.&lt;br /&gt;Assaf Nativ&lt;br /&gt;(and The Raven Shkol)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-5892449761464515628?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/5892449761464515628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2009/08/anti-theft.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/5892449761464515628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/5892449761464515628'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2009/08/anti-theft.html' title='Anti Theft'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7454626512109390647.post-6166931854211637539</id><published>2009-07-18T01:49:00.000-07:00</published><updated>2010-05-07T08:19:03.398-07:00</updated><title type='text'>Flash games cheating on Facebook</title><content type='html'>Some time ago I told a friend of mine, that I can easily beat his score in Jet Man the Facebook game, by using the well known technique of cheating.&lt;br /&gt;&lt;div dir="ltr" style="text-align: left;"&gt;The guy said he does not believe me, because if I could do so, then other people could do so and then there should have been many better high scores on the world wide table.&lt;br /&gt;Little did he know that I'm a well trained Ninja (Or pirate, I have this identity crises right now).&lt;br /&gt;I was sure it is possible and very easy to achieve, though I hadn't done anything like it, just yet.&lt;br /&gt;I was very enthusiastic about it, and about a year later I started working on it. By that time I had found out that there are many people who cheat on Facebook games, so I thought that now I have to prove my superior mind.&lt;br /&gt;From small research on Google, I found that the subject is more common than what I thought at first. The potential of the matter can be described in the ad found on one of the top google results:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Y_ahNBaJj0I/S-Qs0q1mrDI/AAAAAAAAAIA/gf4pB1fUYuI/s1600/Money.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 391px; height: 251px;" src="http://3.bp.blogspot.com/_Y_ahNBaJj0I/S-Qs0q1mrDI/AAAAAAAAAIA/gf4pB1fUYuI/s320/Money.png" alt="" id="BLOGGER_PHOTO_ID_5468545130898566194" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Quickly I discovered that all of these games are written in Flash with some help of Facebook lib or so.&lt;br /&gt;I went through about 5 different ways of cheating before I found the one that fits, and I'm going to describe the entire learning process I went through for other people to learn from my mistakes and maybe give me some new techniques and ideas, because I'm really out of new ones by now.&lt;br /&gt;My first target was How Big Is Your Brain, which would help me prove the fact that mine is the biggest.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Y_ahNBaJj0I/S-QvTX_vicI/AAAAAAAAAIg/oRVSimxxU-o/s1600/whohasthebiggestbrain.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 369px; height: 400px;" src="http://3.bp.blogspot.com/_Y_ahNBaJj0I/S-QvTX_vicI/AAAAAAAAAIg/oRVSimxxU-o/s400/whohasthebiggestbrain.jpg" alt="" id="BLOGGER_PHOTO_ID_5468547857440016834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;u&gt;&lt;span class="hw"&gt;Without further ado&lt;/span&gt;, my first attempt&lt;/u&gt;&lt;br /&gt;&lt;b&gt;Memory scanning&lt;/b&gt;. As old time cheats I thought this must be the easiest and the most nostalgic way to overcome the problem.&lt;br /&gt;The concept is simple, just do as following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Accumulate some points, search the number in the FireFox process memory. You would probably find more then one instances of the value.&lt;/li&gt;&lt;li&gt;Gain some more points.&lt;/li&gt;&lt;li&gt;Search for the new value among the addresses you got from the last step.&lt;/li&gt;&lt;li&gt;Repeat the process until you are left with one address containing the value of your current score.&lt;/li&gt;&lt;li&gt;Set the value to a big big number.&lt;/li&gt;&lt;li&gt;Enjoy the results.&lt;/li&gt;&lt;li&gt;Eat some pancakes, which is what every ninja do after a long day of games hacking.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;  One can use program like "Cheat Engine 5.4" which could be freely downloaded from &lt;a href="http://www.cheatengine.org/" id="mtz8" title="http://www.cheatengine.org/"&gt;http://www.cheatengine.org/&lt;/a&gt; or a python win32 debugging module.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Y_ahNBaJj0I/S-QtpgOLB2I/AAAAAAAAAII/9SqKpHopr5M/s1600/CheatEngine.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 449px; height: 475px;" src="http://4.bp.blogspot.com/_Y_ahNBaJj0I/S-QtpgOLB2I/AAAAAAAAAII/9SqKpHopr5M/s320/CheatEngine.png" alt="" id="BLOGGER_PHOTO_ID_5468546038581888866" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This method fails miserably due the fact that the Flash engine saves all values in memory encoded in some way.&lt;br /&gt;Google suggested that the encoding method used to be the value multiplied by eight. The encoding has changed since, and no one has yet to reveal and publish what it is (you laze ninjas).&lt;br /&gt;Beside that, all strings are encrypted, no one yet to publish how (You laze pirates).&lt;br /&gt;I started reverse engineering the engine, but lacked the time to complete the task (laze me).&lt;br /&gt;If anyone is interested on hearing more about that, just contact me by email or so.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Method number two, using &lt;b&gt;r4zcheat&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;While researching the solution for the last problem, I stumbled upon an application called r4zcheat.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Y_ahNBaJj0I/S-QuFYSp3bI/AAAAAAAAAIQ/WLoncLl5rWo/s1600/r4zcheat.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 505px; height: 373px;" src="http://1.bp.blogspot.com/_Y_ahNBaJj0I/S-QuFYSp3bI/AAAAAAAAAIQ/WLoncLl5rWo/s400/r4zcheat.jpg" alt="" id="BLOGGER_PHOTO_ID_5468546517489540530" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This neat tool, allows you to load a Flash applet and explore all the variables, their names and values and change whatever you like at real time. Isn't that awesome?!&lt;br /&gt;The only problem with that is the fact that it loads the SWF file outside the browser environment, while all the Facebook games requires the browser to handle everything in communicating with Facebook.&lt;br /&gt;I was not to give up just yet!&lt;br /&gt;First I've asked the guy who wrote the r4zcheat to send me the source code, &lt;strike&gt;but till the time of writing these words, I yet to get any answer from him.&lt;/strike&gt; For my good luck, the guy happened to be a true hard core pirate, so after I dulled him to death he was glad to send it to me.&lt;br /&gt;Reading the code, I found out that it's only taking advantage of the well documented Flash API, mainly with the function GetVariable, which is called from the ShockwaveFlash object (Some kind of all in one object that is used for all the control over the Flash engine instance). The flash application does not work inside a browser because it needs to create the Flash instance to have a reference to it and to invoke its' functions. I have tried for a little while to hook the iExplorer process, and look for the Flash instance address in memory using some pattern searching, then call these functions from an injected thread, but it took me too much time, so I decided to try another approach.&lt;br /&gt;Btw, I used iExplorer and not Firefox on this attempt because there are some differences on the use of Flash between the browsers, it seems like iExplorer is using the FlashXX.ocx file while Firefox is using NPSWF32.dll. I am not so sure what is the big difference, and why there are two kinds of ways to use the embedded flash engine.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;And that would bring me to the 3rd attempt&lt;/u&gt;&lt;br /&gt;Fooling around with &lt;b&gt;pseudo random numbers generator&lt;/b&gt;.&lt;br /&gt;Well I thought that If I'll just patch the flash random function to always return the same numbers, I would always get the same questions in the game, right?&lt;br /&gt;This would allow me to just remember the answers to get a very nice high score (but still in the reasonable range), after all "practice makes perfect".&lt;br /&gt;So back to disassembling the Flash engine. Without getting too much into boring details on how disassembling is done, I would say that I needed to find the code that is relevant to the random function, within the entire binary file.&lt;br /&gt;First I dived into documentations reading about the Flash programming language which is called Action Script (the phase I like to call RTFM).&lt;br /&gt;I found out that there are many versions for the language each supports a new set of opcodes, while fully backward compatible with the old ones.&lt;br /&gt;By disassembling I easily found the main processing loop that reads the next instruction and execute it. The function, of course, is mostly made of a huge "Switch" like code that operate on every different opcode (I found that there are many ways to improve the code for Flash to make it run faster, but that's a different story).&lt;br /&gt;I've investigated the function that handles the RANDOM opcode (0x30) to find out exactly were does it spit out the new magic figure.&lt;br /&gt;Luckily I found an inner function that handles all the random functionality. This function was not aware of anything like the Flash stack or so, but just returned a value using the EAX register.&lt;br /&gt;I've encoded a small patch in pure assembly (Arrr) to read the values from file, instead of using the random function.&lt;br /&gt;Then I made a backup of the NPSWF32.dll file and applied the patch to it.&lt;br /&gt;I'm not so sure about what have I done wrong on this attempt, I'm just sure it did not worked as I expected.&lt;br /&gt;It appears that &lt;a href="http://www.playfish.com/" id="o2:j" title="Playfish"&gt;Playfish&lt;/a&gt; (The company which made the "How Big Is Your Brain" game) has implemented their own random function in Action Script that uses the time as seed and some extra stuff.&lt;br /&gt;I tried to make some workarounds for this, but I failed.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;What would bring me straight to my 4th attempt&lt;/u&gt;&lt;br /&gt;&lt;b&gt;Slowing everything down&lt;/b&gt;. It seems like that all the questions in the game are very easy, it's just the time limit that makes it hard, so I've decided to try to fix this problem once and for all.&lt;br /&gt;I thought about it for a while, and realized that the Flash engine must use the Windows APIs to read the local machine time to implement timers (Actually there is another way using the RDTSC opcode to read the timer, but I had some hope that they don't do that because that would have required a solution in the form of a driver, which is a great pain in the ass).&lt;br /&gt;The general principle behind this method is to hook the Windows API functions.&lt;br /&gt;This task is very easily done using the the Microsoft Detour library (&lt;a href="http://research.microsoft.com/en-us/projects/detours/" id="chjq" title="http://research.microsoft.com/en-us/projects/detours/"&gt;http://research.microsoft.com/en-us/projects/detours/&lt;/a&gt;).&lt;br /&gt;The functions we would like to hook are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; GetSystemTime kernel32.dll (&lt;a href="http://msdn.microsoft.com/en-us/library/ms724390%28VS.85%29.aspx" id="cumk" title="http://msdn.microsoft.com/en-us/library/ms724390(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms724390(VS.85).aspx&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;GetTickCount kernel32.dll (&lt;a href="http://msdn.microsoft.com/en-us/library/ms724390%28VS.85%29.aspx" id="s-8j" title="http://msdn.microsoft.com/en-us/library/ms724390(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms724390(VS.85).aspx&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;SetTimer from user32.dll (&lt;a href="http://msdn.microsoft.com/en-us/library/ms644906%28VS.85%29.aspx" id="otj6" title="http://msdn.microsoft.com/en-us/library/ms644906(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms644906(VS.85).aspx&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;timeGetTime from winmm.dll (&lt;a href="http://msdn.microsoft.com/en-us/library/ms713418%28VS.85%29.aspx" id="qxhs" title="http://msdn.microsoft.com/en-us/library/ms713418(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms713418(VS.85).aspx&lt;/a&gt;)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; There are more APIs made up for this purpose, but I've checked the NPSWF32.dll's import table, to make sure they are not in use.&lt;br /&gt;Hooking those functions is something that takes some programming time, lucky for me at this point of the project my girlfriend dumped me, which left me much more time to work on a solution. &lt;span style="color: rgb(255, 255, 255);"&gt;(though it probably wasn't the best idea to ask her to proof this article...)&lt;/span&gt;&lt;br /&gt;For a better understanding of the detour library, I would recommend the help file that comes with it, and many other tutorials living out there on the net, waiting for someone to read them.&lt;br /&gt;I just hooked the SetTimer to set the user input to be twice the real input.&lt;br /&gt;For the GetSystemTime, GetTickCount and timeGetTime APIs I've saved the first read.&lt;br /&gt;Calculated the delta from each new call to the first one.&lt;br /&gt;Set the result to be the first value plus delta / 2.&lt;br /&gt;This approach has got me some good results, the game was about four times slower, and I was able to get myself a very good high score.&lt;br /&gt;Only until I got to the end of the game to see a message that my score was not accepted for some reason.&lt;br /&gt;Bummer server timeout or something.&lt;br /&gt;I guess I could have sniffed all the packets sent from my game to the server and replay those in the right times, and hope they do not conceal any time stamps.&lt;br /&gt;But I found this solution to be very dull, so I moved to the next attempt.&lt;br /&gt;BTW, this approach has slowed FireFox down as well, creating some very kewl effects on some websites.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Number five, and final, &lt;b&gt;disassemling Action Script&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;This solution is going through the following steps:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Get the SWF file of the game.&lt;/li&gt;&lt;li&gt;Learning Active Script assembly.&lt;/li&gt;&lt;li&gt;Finding a good flash disassembler.&lt;/li&gt;&lt;li&gt;Making a real time patches to the game.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; The first part was easy, I used CacheViewer FireFox plug-in to get the SWF file.&lt;br /&gt;But, 2nd part was not as easy as it might sound. It took me a while to find a good PDF file on the subject. The only thing I was able to find was the "Action Script 2 Virtual Machine overview" PDF file (&lt;a href="http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf" id="wf0t" title="http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf"&gt;http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf&lt;/a&gt;), which was quite good, but the game was using mostly Action Script 3 opcodes.&lt;br /&gt;The second best thing I found was the source code of Flasm, which is an open source Flash files disassembler (&lt;a href="http://www.nowrap.de/flasm.html" id="o9xd" title="http://www.nowrap.de/flasm.html"&gt;http://www.nowrap.de/flasm.html&lt;/a&gt;). However the Flasm is currently missing some parts as well. So, currently I settled for these , but I'm still looking for better papers on the subject, so if anyone of you pirates out there got anything better, please, do share.&lt;br /&gt;Finally I've stumbled upon the commercial &lt;a href="http://www.sothink.com/product/flashdecompiler/?gclid=CPD_n5iQy5sCFQcTzAodc3HlKA" id="ocaa" title="Sothink SWF Decompiler"&gt;Sothink SWF Decompiler&lt;/a&gt; program that had a free trail version, which happened to be very good.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Y_ahNBaJj0I/S-QuZeOHq1I/AAAAAAAAAIY/F7VAB5Zwoa8/s1600/Sothink-SWF-Decompiler.gif"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 557px; height: 469px;" src="http://3.bp.blogspot.com/_Y_ahNBaJj0I/S-QuZeOHq1I/AAAAAAAAAIY/F7VAB5Zwoa8/s400/Sothink-SWF-Decompiler.gif" alt="" id="BLOGGER_PHOTO_ID_5468546862678518610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The program had a decompiler option that gave out a very readable Action Script code. Thanks to the great extra feature of ASM view, it was very easy to locate the right point for patching.&lt;br /&gt;By this method I was able to patch any code of the program but not the values nor the defaults of anything.&lt;br /&gt;Further problems with this methods are:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;I can't insert code I can only patch ASM with equal amount of bytes.&lt;/li&gt;&lt;li&gt;I should be very careful not to fuck up the stack.&lt;/li&gt;&lt;li&gt;I had to either find a way to make FireFox load my patched SWF file or patch at run time by searching the bytes I want to patch with some memory trainer such as Cheat Engine.&lt;/li&gt;&lt;li&gt;If I choose to patch at run-time, I had to do it when the code is already loaded, but not yet executed, or it would get optimized and harder to find in memory.&lt;/li&gt;&lt;li&gt;Programming in Action Script assembly is hard, though, lots of fun.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;  To conclude, I would say that only my 5th attempt went by with good results, although, I do believe that with a little bit of an extra effort I could have make all the other attempts work as well.&lt;br /&gt;I found out that many people are developing automated scripts to play the games for them, using many &lt;a href="http://en.wikipedia.org/wiki/Optical_character_recognition" id="qcc7" title="OCRs"&gt;OCRs&lt;/a&gt; and other kinds of methods, this is a very vast and interesting technique that I might write about in a future post, because now I have lots to say on the subject, and little time to do so.&lt;br /&gt;One might ask why Flash games and not something more interesting such as World Of Warcraft, and my answer would be using a picture from the outstanding web-comic &lt;a href="http://www.xkcd.com/" id="r3-f" title="XKCD"&gt;XKCD&lt;/a&gt;:&lt;br /&gt;&lt;div id="be9g" style="text-align: left;"&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://imgs.xkcd.com/comics/flash_games.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 576px; height: 322px;" src="http://imgs.xkcd.com/comics/flash_games.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;That's it for now. Hope you enjoyed reading this post, and got a bit of inspiration on developing ninja skills.&lt;br /&gt;&lt;br /&gt;And remember, it's only cheating if you get caught (&lt;a href="http://en.wikipedia.org/wiki/Al_Bundy" id="l2v7" title="Al Bundy"&gt;Al Bundy&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;Cheers,&lt;br /&gt;Assaf.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Many thanks to Omer Enbar and Avital Zipori for reviewing and proofing my English.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7454626512109390647-6166931854211637539?l=nativassaf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nativassaf.blogspot.com/feeds/6166931854211637539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://nativassaf.blogspot.com/2009/07/flash-games-cheating-on-facebook.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/6166931854211637539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7454626512109390647/posts/default/6166931854211637539'/><link rel='alternate' type='text/html' href='http://nativassaf.blogspot.com/2009/07/flash-games-cheating-on-facebook.html' title='Flash games cheating on Facebook'/><author><name>printf</name><uri>http://www.blogger.com/profile/04228158907360222445</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/-qGjB_-fCzxg/TbBuovxp43I/AAAAAAABK1g/3iYPegLIR7w/s220/IMG_0188.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Y_ahNBaJj0I/S-Qs0q1mrDI/AAAAAAAAAIA/gf4pB1fUYuI/s72-c/Money.png' height='72' width='72'/><thr:total>8</thr:total></entry></feed>
