<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   
	 xmlns:podcast='http://ipodder.sourceforge.net/docs/podcast.html'
>
<channel>
    <title>БэФ블로그 - Code</title>
    <link>http://pentaphase.de/</link>
    <description>:wq</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.1 - http://www.s9y.org/</generator>
    <pubDate>Tue, 23 Mar 2010 16:38:01 GMT</pubDate>

    <image>
        <url>http://pentaphase.de/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: БэФ블로그 - Code - :wq</title>
        <link>http://pentaphase.de/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Asterisk and the Blink</title>
    <link>http://pentaphase.de/index.php?/archives/41-Asterisk-and-the-Blink.html</link>
            <category>Code</category>
            <category>eventphone (이밴트폰)</category>
    
    <comments>http://pentaphase.de/index.php?/archives/41-Asterisk-and-the-Blink.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=41</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=41</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    &lt;!-- s9ymdb:47 --&gt;&lt;img class=&quot;serendipity_image_right&quot; width=&quot;100&quot; height=&quot;100&quot;  src=&quot;http://pentaphase.de/uploads/blinkenarea-logo.serendipityThumb.png&quot;  alt=&quot;&quot; /&gt;&lt;br /&gt;
It&#039;s just one of those spring days where your may wonder how to control your friendly &lt;a href=&quot;http://www.youtube.com/watch?v=DhBTUNtxIbs&quot;&gt;BlinkenLights neighbourhood building&lt;/a&gt; with &lt;a href=&quot;http://asterisk.org&quot;&gt;Asterisk&lt;/a&gt;. Ordinarily the installation comes with a control program called BlinkenLights Chaos Control Center (BLCCC) which can be seen as a jukebox controller handling movies and games. The BLCCC expects incoming ISDN phone calls to be relayed by &lt;a href=&quot;http://wiki.blinkenarea.org/index.php/ExtendedBlinkenIsdnProtocol&quot;&gt;a UDP based protocol&lt;/a&gt;. A suitable Asterisk AGI application can now take over the role of a mediator between ISDN and BLCCC, thus transparently substitute a real ISDN line.&lt;br /&gt;
&lt;br /&gt;
The &lt;a href=&quot;http://www.eventphone.de&quot;&gt;PoC&lt;/a&gt; version of this mediator program is the newest extension to the &lt;a href=&quot;http://poc-apps.sf.net&quot;&gt;PoC Telephony Application Suite&lt;/a&gt;. 
    </content:encoded>

    <pubDate>Tue, 23 Mar 2010 17:38:01 +0100</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/41-guid.html</guid>
    <category>asterisk</category>
<category>blinkenarea</category>
<category>blinkenlights</category>
<category>code</category>
<category>eventphone (이밴트폰)</category>
<category>tcl</category>

</item>
<item>
    <title>Playing hide and seek in a flash</title>
    <link>http://pentaphase.de/index.php?/archives/36-Playing-hide-and-seek-in-a-flash.html</link>
            <category>Code</category>
            <category>Web2.0 (왭 이쩜영)</category>
    
    <comments>http://pentaphase.de/index.php?/archives/36-Playing-hide-and-seek-in-a-flash.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=36</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=36</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    Imagine a warm and bright Saturday afternoon the summer you were just eight years old. Can you remember playing hide and seek with other children from the neighbourhood or from school? Everybody likes to be the one hiding somewhere. You choose a seemingly hidden spot and wait. After a while it would become boring, if the spot is just too well concealed, so you declare a time-out and win the round. However once a hideout is known to any of the seekers, you will be found eventually. From the seeker&#039;s perspective, most likely hiding spots are being searched first, depending on where the seeker would hide if he were on the opposing team. Most likely, some even obvious spots will be missed during the first round, like right on top of you inside the trees. Seekers learn and will check there first in the next round. However the hiding party is learning as well, always coming up with tons of new hideouts and ideas to conceal themselves even better. But they will all be found eventually.&lt;br /&gt;
It is not surprising that discovering at least one person is rather easy if most of the group are hiding and few are seeking, so we&#039;ll assume the opposite: Many are searching, few are hiding.&lt;br /&gt;
&lt;br /&gt;
The same game may be applied to Flash/SWF. An attacker wants to execute fraudulent code on a victim&#039;s machine. In this case, it should be sufficient to execute arbitrary code inside someone&#039;s flash player. The &quot;seeker&#039;s&quot; objective is (1) to recognise an attack, preferably before execution, and (2) to know the threat in detail. Obviously, the attacker&#039;s role in this game consists of suitable counterparts: (1) Hide the existence of an attack, at least until the code is being executed without being found before and (2) obfuscate the code to discourage easy analysis. &lt;br /&gt;
&lt;br /&gt;
You may see certain similarities to the game, virus writers and the antivirus industry have been playing for some time now. The word &#039;virus&#039; in this context may stand for trojan horses, spyware, malware or any kind of unwanted software. The dominating virus detection technique - at least referring to static analysis - is a signature match against a dictionary of known viruses (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Antivirus_software&quot;&gt;antivirus software&lt;/a&gt;). Once a virus has been identified, a fingerprint of its program code or parts of the code results in a new signature for the dictionary. Round one for the hide and seek goes to the seekers. The natural response to avoid signature detection is a self-modifying code, otherwise known as polymorphic or metamorphic code (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Computer_virus#Methods_to_avoid_detection&quot;&gt;computer virus&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
Once again, applied to Flash, a signature approach seems appropriate. Flash code can not (easily) alter and strore itself. Even though Flash files are usually not stored locally for constant analysis by virus checkers, the static nature can be observed in the wild. But there is no reason, why a server should not be able to recreate a different version of the same SWF for each request, which is somewhat like an outsourced metamorphism. So, attackers score round two.&lt;br /&gt;
&lt;br /&gt;
For the analysis of non-static code with static function range, heuristic approaches come to mind. &lt;i&gt;[ Georgia Frantzeskou, Efstathios Stamatatos, and Stefanos Gritzalis - Suppοrting the Cybercrime Investigation Process: Effective Discrimination of Source Code Authors Based on Byte-Level Information - 2007]&lt;/i&gt; suggested a statistical classification method based on n-grams (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Ngram&quot;&gt;Ngram&lt;/a&gt;). The front row application for n-grams is language detection of written text. The occurrence of every N successive characters (including whitespace) of a text is counted and then compared relatively to a reference count of known language.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;serendipity_imageComment_left&quot; style=&quot;width: 110px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:43 --&gt;&lt;a href=&quot;http://pentaphase.de/uploads/ngram-abc.png&quot;&gt;&lt;img class=&quot;serendipity_image_left&quot; width=&quot;110&quot; height=&quot;67&quot;  src=&quot;http://pentaphase.de/uploads/ngram-abc.serendipityThumb.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;statistical classification - n-gram over bytecode ops&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
This classification method can be applied to Flash as well. Instead of N characters of a text, we&#039;ll take a sequence of N ABC OP-codes (aka. AVM2 bytecode). The figure shows a graph representation of several arbitrarily chosen SWF9/10 files and their distance based upon the n-gram analysis. (n=3, hidden edges by distance threshold).&lt;br /&gt;
&lt;br /&gt;
Three clusters become apparent: {9,10}, {17,16,12,15,20} and {3,13,19,11,18,5,21,7}. Clustering is an expression of similarity between the SWF&#039;s bytecode. N-gram profiles contain characteristics of the compiler or IDE, std. libraries and the code&#039;s author(s), each with different intensity. I&#039;d say, that&#039;s another point for the seekers.&lt;br /&gt;
&lt;br /&gt;
Now, in order to defy heuristics, two ways pop into consciousness. Either imitate another profile&#039;s appearance by adding NOPs and dead code, or hide the bytecode entirely. While imitation techniques can be matched up by even more advanced filtering and statistical methods, we are going to explore more hiding and obfuscation on the byte level. The AVM2 incorporates a byte loader, which can be used to load and evaluate ABC bytecode during runtime. Consider that we can hide our code anywhere inside the SWF or load seemingly unsuspicious data from external sources - e.g. a picture, sound file, timing data or even data encoded as fake dead code. The data would then be transformed back to our original payload and handed over to the byte loader. Of course, our transformation algorithm and the byte loader itself must undergo a procedure, too, in order to look as harmless as possible. Fortunately there are numerous everyday tasks to be solved by data conversion and loading algorithms, so that our few lines of code can be fingerprinted heuristically without arising any suspicion. &lt;br /&gt;
&lt;br /&gt;
With &lt;a href=&quot;http://labs.adobe.com/technologies/alchemy/&quot;&gt; alchemy&lt;/a&gt; Adobe hands out a toolkit for fast ByteArray manipulation free of charge, which happens to coincide with bytecode obfuscation/deobfuscation as described. Hence Adobe scores yet another point for the attackers - yay.&lt;br /&gt;
&lt;br /&gt;
All these elaborations are by no means only of theoretical nature. &lt;a href=&quot;http://code.google.com/p/erlswf/&quot;&gt;erlswf&lt;/a&gt; has been specifically designed to match the needs of SWF bytecode analysis up to this point in this train of thoughts.&lt;br /&gt;
&lt;br /&gt;
A few concluding remarks: The game of hide and seek goes on forever. If anyone wondered what our current state of the game was, my personal guess would put it somewhere near the end of round one. That means, there is more to look forward to and much more to come.&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Mon, 24 Nov 2008 19:48:00 +0100</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/36-guid.html</guid>
    <category>abc</category>
<category>analysis</category>
<category>avm2</category>
<category>bytecode</category>
<category>code</category>
<category>erlswf</category>
<category>flash</category>
<category>hide</category>
<category>seek</category>
<category>swf</category>
<category>web2.0 (왭 이쩜영)</category>

</item>
<item>
    <title>django &amp; CouchDB - a match made outside of heaven</title>
    <link>http://pentaphase.de/index.php?/archives/34-django-CouchDB-a-match-made-outside-of-heaven.html</link>
            <category>Code</category>
    
    <comments>http://pentaphase.de/index.php?/archives/34-django-CouchDB-a-match-made-outside-of-heaven.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=34</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=34</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    First of all, if you don&#039;t already know &lt;a href=&quot;http://www.djangoproject.com/documentation/&quot; title=&quot;django project&quot;&gt;django&lt;/a&gt; and &lt;a href=&quot;http://incubator.apache.org/couchdb/&quot; title=&quot;couchdb&quot;&gt;CouchDB&lt;/a&gt;, take a look at their websites. You might ask &quot;Why? Why this combination?&quot;. Both django as an application framework and CouchDB as a database engine are state of the art technologies. So, why not? While searching the net, numerous forums and websites propagate their user&#039;s silent wish to incorporate a CouchDB backend into django: &lt;a href=&quot;http://groups.google.com/group/couchdb/browse_thread/thread/e1eac1af681baae3&quot; title=&quot;Where does CouchDB fit into Frameworks like Django and Ruby on Rails&quot;&gt;1&lt;/a&gt; &lt;a href=&quot;http://eikke.com/filesystem-issues-and-django-couchdb-work/django-and-couchdb-first-shot-2/&quot; title=&quot;Django and CouchDB first shot&quot;&gt;2&lt;/a&gt; &lt;a href=&quot;http://djangopeople.net/skills/couchdb/&quot; title=&quot;N Django People mention this skill&quot;&gt;3&lt;/a&gt;&lt;br /&gt;
Let&#039;s take a closer look. django&#039;s backend engines are all SQL based and suitable for relational data organisation - oracle, mysql, postgres, sqlite. That means tables can be created according to a data description and have relationships, e.g. a group contains many users and a user can be in many groups; both users and groups have predefined attributes such as a name. CouchDB on the other hand is document based and schemafree. Each document can be structured differently. You just throw whichever data you have serialised as JSON object into the database. That&#039;s it. A document could be an address or details of a book in your personal library or any other data representable as JSON. As a bonus, each document may have any number of file attachments.&lt;br /&gt;
Now, in order to use django and CouchDB hand in hand there are two major strategies, both with it&#039;s catches:&lt;br /&gt;
One. Develop a proper and seamlessly integrating django model backend using CouchDB. Since most database queries in django use either django&#039;s query class django.db.models.sql.query.Query or plain SQL, a new django model must either be able to parse SQL or implement all functions of this query class. (You could also re-implement each save() function of all uses of a django model for starters, but that would be the opposite of an abstracted model component.)&lt;br /&gt;
Two. Completely ignore the existence of a model abstraction and implement data storage directly into django views -- who needs MVC anyway. PHP versions 1-3 have taught us to implement everything inside a single view anyway &lt;img src=&quot;http://pentaphase.de/templates/default/img/emoticons/normal.png&quot; alt=&quot;:-|&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; A nice example can be found &lt;a href=&quot;http://lethain.com/entry/2008/aug/18/an-introduction-to-using-couchdb-with-django/&quot; title=&quot;django and couchdb example&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
While you may already have thoughts about how easy it is to implement a SQL parser, map a relational model upon a document based model and stick it all together into a django model backend (which - by the way - is quite possible), I found that django rather emphasises the &quot;rapid&quot; in rapid development. So, we&#039;ll linger with option number two for the moment. Let&#039;s see, what we can use of the django world now:&lt;br /&gt;
- urlpatterns&lt;br /&gt;
- templates&lt;br /&gt;
- views&lt;br /&gt;
- the file upload handler&lt;br /&gt;
- sessions (with SESSION_ENGINE = &#039;django.contrib.sessions.backends.cache&#039;)&lt;br /&gt;
- caching (CACHE_BACKEND = &#039;locmem://&#039;)&lt;br /&gt;
- the authentication backend (hm?)&lt;br /&gt;
&lt;br /&gt;
In order to use the authentication backend without a django model backend, sessions and caching must already be configured as above, django.contrib.sites must be disabled, and a custom auth backend must be implemented as &lt;a href=&quot;http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend&quot; title=&quot;django docu on custom auth backends&quot;&gt;documented&lt;/a&gt;. Then, it is advisable to prevent anyone from calling &lt;tt&gt;save()&lt;/tt&gt; or &lt;tt&gt;get_and_delete_messages()&lt;/tt&gt; on a User object:&lt;br /&gt;
&lt;div class=&quot;python&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;class&lt;/span&gt; MyUser&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;django.&lt;span style=&quot;color: black;&quot;&gt;contrib&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;auth&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;models&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;User&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; save&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;pass&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;def&lt;/span&gt; get_and_delete_messages&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt; 
    </content:encoded>

    <pubDate>Thu, 04 Sep 2008 19:06:00 +0200</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/34-guid.html</guid>
    <category>code</category>
<category>couchdb</category>
<category>django</category>

</item>
<item>
    <title>나비 한글 입력기 &amp; DVORAK &amp; Linux</title>
    <link>http://pentaphase.de/index.php?/archives/32-DVORAK-Linux.html</link>
            <category>Code</category>
            <category>language</category>
    
    <comments>http://pentaphase.de/index.php?/archives/32-DVORAK-Linux.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=32</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=32</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    While being used to a comfortable keymap switching behaviour in MacOSX, my new eeepc had formerly lacked such functionality. The fairly common case to switch between &lt;a href=&quot;http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard&quot; title=&quot;dvorak keyboard on wikipedia&quot;&gt;DVORAK&lt;/a&gt; and 한글 input can be accomplished easily with a helper program such as &lt;a href=&quot;http://nabi.kldp.net/&quot; title=&quot;nabi&quot;&gt;나비&lt;/a&gt;, which incidentally happens to be aware of both input methods. In order to use special characters (punctuation, dash, ...) within the 한글 input method, however, these keys should be mapped back to the standard US (qwerty) keymap. &lt;a href=&quot;http://pentaphase.de/uploads/2dvorak&quot; title=&quot;2dvorak&quot; target=&quot;_blank&quot;&gt;This&lt;/a&gt; file placed under /usr/share/nabi/keyboard may be of special interest. 
    </content:encoded>

    <pubDate>Fri, 02 May 2008 16:16:00 +0200</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/32-guid.html</guid>
    <category>code</category>
<category>dvorak</category>
<category>hangeul</category>
<category>keymap</category>
<category>language</category>
<category>linux</category>

</item>
<item>
    <title>Pooling and Automated Code Distribution with Erlang</title>
    <link>http://pentaphase.de/index.php?/archives/30-Pooling-and-Automated-Code-Distribution-with-Erlang.html</link>
            <category>Code</category>
    
    <comments>http://pentaphase.de/index.php?/archives/30-Pooling-and-Automated-Code-Distribution-with-Erlang.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=30</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=30</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    Erlang&#039;s &lt;a href=&quot;http://www.erlang.org/doc/man/pool.html&quot; title=&quot;pool manual&quot;&gt;pool&lt;/a&gt; module provides a very easy to use load-balancing pooling mechanism implementing a master-slave pooling paradigm with one master and many slaves. By starting the pool, the master tries to log in to all slave machines and start the slave (see &lt;a href=&quot;http://www.erlang.org/doc/man/slave.html&quot; title=&quot;slave manual&quot;&gt;slave(3)&lt;/a&gt;). At that point the pool is set up and ready to use - basically.&lt;br /&gt;
Stey by step: First of all a useful pool needs at least one additional slave node (with the pool module the master incorporates a slave node at the same time). The full hostnames must be listed as erlang atoms in the file &lt;tt&gt;.hosts.erlang&lt;/tt&gt;, which resides either in the current working directory or in your home directory. Example:&lt;br /&gt;
&lt;pre&gt;&#039;foo.bar.priv&#039;.&lt;br /&gt;
&#039;blubb.bar.priv&#039;.&lt;br /&gt;
(newline)&lt;/pre&gt;&lt;br /&gt;
Make sure that it is possible to log in to all machines without a password prompt. &lt;tt&gt;~/.ssh/authorized_keys&lt;/tt&gt; and &lt;tt&gt;~/.ssh/config&lt;/tt&gt; might be of help here. If you get an error involving &quot;ssh-askpass&quot; later, try to log in manually first.&lt;br /&gt;
In order to let the erlang nodes communicate with each other their cookies must be synced. This can be done by setting the &lt;tt&gt;~/.erlang.cookie&lt;/tt&gt; or by passing the command line argument &lt;tt&gt;-setcookie COOKIE&lt;/tt&gt;.&lt;br /&gt;
That&#039;s all for the basic setup. To try it out we could start erlang like so:&lt;br /&gt;
&lt;pre&gt;erl -pa boo -setcookie pooltest000 -name pooltest@`hostname` -rsh ssh&lt;/pre&gt; and start the pool by &lt;pre&gt;pool:start(pooltest, lists:concat([&quot;-setcookie &quot;, erlang:get_cookie()])).&lt;/pre&gt;&lt;br /&gt;
The argument &lt;tt&gt;-pa boo&lt;/tt&gt; adds boo to the code search path and &lt;tt&gt;-rsh ssh&lt;/tt&gt; tells &lt;tt&gt;pool&lt;/tt&gt; to use ssh instead of rsh.&lt;br /&gt;
Next, it would be nice to automatically distribute our local code base to all the slave nodes. Luckily the &lt;a href=&quot;http://erlang.org/doc/man/code.html&quot; title=&quot;code manual&quot;&gt;code module&lt;/a&gt; provides a simple way to do this:&lt;br /&gt;
&lt;pre&gt;...       &lt;br /&gt;
{_Module, Binary, Filename} = code:get_object_code(Module),&lt;br /&gt;
rpc:call(Node, code, load_binary, [Module, Filename, Binary]),&lt;br /&gt;
...&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
Distributed processes can be easily created using &lt;tt&gt;pool:pspawn/3&lt;/tt&gt;.&lt;br /&gt;
&lt;br /&gt;
A complete example:&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://pentaphase.de/index.php?/archives/30-Pooling-and-Automated-Code-Distribution-with-Erlang.html#extended&quot;&gt;Continue reading &quot;Pooling and Automated Code Distribution with Erlang&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 12 Mar 2008 18:54:01 +0100</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/30-guid.html</guid>
    <category>cluster</category>
<category>code</category>
<category>erlang</category>
<category>parallel computing</category>
<category>pooling</category>

</item>
<item>
    <title>Erlang unscrables SWF</title>
    <link>http://pentaphase.de/index.php?/archives/29-Erlang-unscrables-SWF.html</link>
            <category>Code</category>
    
    <comments>http://pentaphase.de/index.php?/archives/29-Erlang-unscrables-SWF.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=29</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=29</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    Using the &lt;a href=&quot;http://www.erlang.org/doc/reference_manual/expressions.html#bit_syntax&quot; title=&quot;Expressions&quot;&gt;Erlang bit syntax&lt;/a&gt; it&#039;s an easy task to unpack the tags of an SWF file. With this thought in mind &lt;a href=&quot;http://code.google.com/p/erlswf/&quot; title=&quot;Erlang SWF (Flash) file analysis toolkit&quot;&gt;erlswf&lt;/a&gt; has been specifically designed to analyse SWF Tags and ActionScript ByteCode for security issues such as the previously mentioned oversized branch offset or pattern matching against URLs loaded during runtime. The toolkit could also be used to implement a transparent proxy filter for exchanging pictures inside Flash files on the fly. Or if you had no choice but to accept prebuilt SWFs from a third party (e.g. ad hosters), it would still be possible to check for arbitrary conditions or restrictions respectively prior to delivery.&lt;br /&gt;
The other pure erlang SWF library &lt;a href=&quot;http://code.google.com/p/eswf/&quot; title=&quot;erlang swf library&quot;&gt;eswf&lt;/a&gt; places emphasis on SWF construction and related data formats (AMF, ABC). 
    </content:encoded>

    <pubDate>Mon, 18 Feb 2008 16:43:44 +0100</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/29-guid.html</guid>
    <category>code</category>
<category>erlang</category>
<category>flash</category>
<category>swf</category>

</item>
<item>
    <title>SWF in a nutshell and the malware tragedy</title>
    <link>http://pentaphase.de/index.php?/archives/28-SWF-in-a-nutshell-and-the-malware-tragedy.html</link>
            <category>Code</category>
    
    <comments>http://pentaphase.de/index.php?/archives/28-SWF-in-a-nutshell-and-the-malware-tragedy.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=28</wfw:comment>

    <slash:comments>9</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=28</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    SWF - or otherwise known as the flash file format - recently caught my attention while discussing web security issues. It can be played on virtually any platform&#039;s browser nowadays, which makes it a perfect environment for cross-platform applications (including malware). But before getting into exploring our options of how to exploit the format, let&#039;s just get a brief insight into the binary structure of SWF.&lt;br /&gt;
The file starts with the string FWS or CWS, followed by an 8-bit version number and 32-bit file length field. In case of CWS all the remaining file contents are zlib compressed:&lt;br /&gt;
&lt;pre&gt;[FWS] [Version] [Length] [Data] or [CWS] [Version] [Length] [Zlib Data]&lt;/pre&gt;&lt;br /&gt;
The complete SWF specification can be found on &lt;a href=&quot;http://www.adobe.com/licensing/developer/&quot; title=&quot;SWF v9 Specification&quot;&gt;Adobe&#039;s site&lt;/a&gt; (registration required), or &lt;a href=&quot;http://sswf.sourceforge.net/SWFalexref.html&quot; title=&quot;Alexis&#039; SWF reference&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
Now, the uncompressed data part starts with a header followed by a list of tags.&lt;br /&gt;
&lt;pre&gt;[Header] [Tag] [Tag] ...&lt;/pre&gt;&lt;br /&gt;
Each tag acts as a container for a datatype, e.g. for a jpeg image, rgb color or an actionscript bytecode. A tag starts with a tag type identifier and the tag&#039;s length, followed by arbitrary data.&lt;br /&gt;
&lt;pre&gt;[tag code and length (16 bits)] [data (length bytes)]&lt;/pre&gt;&lt;br /&gt;
The complete swf looks like this:&lt;br /&gt;
&lt;pre&gt;[FWS/CWS] [Version] [Length] [ [Header] [[Tag Code + Length] [Tag Contens]] ... [0] ]&lt;/pre&gt;&lt;br /&gt;
As indicated, the last tag is a tag with tag type 0 and length 0 hence resulting in a 16 bit representation of 0.&lt;br /&gt;
If we wanted to analyze an SWF file, it would be best to uncompress where needed, parse the header and then break down each tag by its code first. When doing so with &lt;a href=&quot;http://www.google.co.kr/search?complete=1&amp;hl=ko&amp;q=+filetype%3Aswf&quot; title=&quot;SWF files&quot;&gt;real world data&lt;/a&gt;  we may encounter undocumented or unknown codes. There can be several reasons for these mysterious tag codes, for example the file could be corrupted or our parser could be incomplete. More likely, however, is either that a commonly used - yet undocumented - tag was used correctly according to the programmer&#039;s point of view (tag type IDs 16, 29, 31, 38, 40, 42, 47,  49, 50, 51,52, 63, 72), OR the tag was deliberately marked with an unknown code in order to hide bytecode or other data.&lt;br /&gt;
We&#039;ll go along with the latter case, so let&#039;s assume - just for a moment - that we are programming a malware flash file. As such our code needs to avoid detection and should be obfuscated as well. The actionscript2 bytecode as located inside doAction tags can issue a branch action (aka. jump or goto) which is ordinarily being used for loops and conditions. Each branch action comes with a relative address of the next action. Example:&lt;br /&gt;
&lt;pre&gt;0x00: action 1&lt;br /&gt;
0x01: some actions...&lt;br /&gt;
...&lt;br /&gt;
0x10: jump -0x10&lt;/pre&gt;&lt;br /&gt;
Ominously the branch offset (here -0x16) is not restricted to the current code block, but could jump to an entirely different tag instead, where the code is being executed as if it were a code block. Example:&lt;br /&gt;
&lt;pre&gt;0x100: tag1 header with unknown code&lt;br /&gt;
0x104: code in tag 1&lt;br /&gt;
...&lt;br /&gt;
0x200: doAction tag&lt;br /&gt;
0x204: jump -0x100&lt;/pre&gt;&lt;br /&gt;
This way the code inside tag1 is hidden from ordinary SWF analyzer tools and can still be executed. In order to make it even harder to find the hidden code, random bytecode could be inserted in between actual bytecode, or dormant bytecode (which is never executed) could be used as distraction. Fortunately this technique is also really easy to detect since a checker only needs to be able to check for uncommon branch offsets, however most disassemblers (such as flare) can be fooled.&lt;br /&gt;
Another interesting way to hide code, which is by far not the last one, would be a base64 encoded SWF file ebmedded in an image of another swf file, such as&lt;br /&gt;
&lt;pre&gt;&amp;lt;img src=&quot;data:application/x-shockwave-flash;base64,...&quot;/&amp;gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
In the end it does not really matter, which way your code is protected or even if it is hidden at all, because there is no security or malware check anywhere within a flash advertising deployment process. An evil attacker could simply buy ad space from an ad broker, the delivered ad is then quickly checked (possibly manually) for style guidelines such as size or close buttons, and finally delivered to their ad servers. That&#039;s the end of the (slightly simplified) deployment process.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s explore a few technical possibilities on how to protect yourself from flash malware. (Non-technical solutions such as contract fines or national law are not applicable for the anonymous evil hacker.) Java applets - for example - can have signatures. Since there is no way specified to embed cryptographic signatures in SWF files, and by the way only few people would grasp the signature&#039;s relevance anyway, this is not a viable option here. Then there is a sort of capability whitelisting: The SWF file could be checked against allowed capabilities, which include having obfuscated code hidden in unknown tags as described above. The check could be done automatically on client side (e.g. by a browser plugin) or by a proxy either intermediately or on server side. But such a capability filter is yet to be written.&lt;br /&gt;
&lt;br /&gt;
related URLs: &lt;a href=&quot;https://www.flashsec.org/&quot; title=&quot;flashsec&quot;&gt;https://www.flashsec.org/&lt;/a&gt; &lt;a href=&quot;http://osflash.org/&quot; title=&quot;OSflash&quot;&gt;http://osflash.org/&lt;/a&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Thu, 24 Jan 2008 13:21:00 +0100</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/28-guid.html</guid>
    <category>code</category>
<category>flash</category>
<category>security</category>
<category>SWF</category>

</item>
<item>
    <title>yaws' json-rpc error reply</title>
    <link>http://pentaphase.de/index.php?/archives/27-yaws-json-rpc-error-reply.html</link>
            <category>Code</category>
    
    <comments>http://pentaphase.de/index.php?/archives/27-yaws-json-rpc-error-reply.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=27</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=27</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    Just in case you ever wanted to develop a web-application in &lt;a href=&quot;http://erlang.org&quot; title=&quot;erlang&quot;&gt;Erlang&lt;/a&gt; and Javascript, you probably stumbled upon &lt;a href=&quot;http://json-rpc.org&quot; title=&quot;json-rpc specification&quot;&gt;JSON-RPC&lt;/a&gt;. The idea of JSON-RPC is as trivial as it sounds: You assemble a JSON object describing a remote procedure call, which usually consists of a method name, parameters and a unique id for asynchronous calls. This might look like the following:&lt;br /&gt;
&lt;div class=&quot;javascript&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;version&quot;&lt;/span&gt;:&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;1.1&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;method&quot;&lt;/span&gt;:&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;login&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;id&quot;&lt;/span&gt;:&lt;span style=&quot;color: #CC0000;&quot;&gt;2&lt;/span&gt;,&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;params&quot;&lt;/span&gt;:&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;myusername&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;mypassword&quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
The string representation of a JSON object will then be sent to our yaws-JSON-RPC-server. The &lt;a href=&quot;http://yaws.hyber.org/json_intro.yaws&quot; title=&quot;yaws json intro&quot;&gt;documentation&lt;/a&gt; describes a simple case which is always successful in returning the requested result. A JSON-RPC reply looks like this:&lt;br /&gt;
&lt;div class=&quot;javascript&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;result&quot;&lt;/span&gt;:&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;true&lt;/span&gt;,&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;id&quot;&lt;/span&gt;:&lt;span style=&quot;color: #CC0000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
Using the recommended yaws_rpc module, our erlang program looks - in essence - somewhat like this:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
out(A) -&gt;&lt;br /&gt;
    ...&lt;br /&gt;
    yaws_rpc:handler_session(A2, {?MODULE, handler}).&lt;br /&gt;
handler(..., {call, login, Params}, .....) -&gt;&lt;br /&gt;
    ...&lt;br /&gt;
    {true, 0, Session, {response, true}}.&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
Now we assume, that every once in a while your server function fails internally, let&#039;s say due to an unstable database connection. Naturally we have to reply with an error in this case. The error could - for example - be indicated by a HTTP return code other than 200 (200=success). The handler function of our server code would then simply return the error like &lt;tt&gt;{error, &quot;message&quot;, 500}&lt;/tt&gt; instead of &lt;tt&gt;{true, ...}&lt;/tt&gt; (the last line).&lt;br /&gt;
Alternatively the error could be coded into the JSON-RPC reply like so:&lt;br /&gt;
&lt;div class=&quot;javascript&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;id&quot;&lt;/span&gt;:&lt;span style=&quot;color: #CC0000;&quot;&gt;6&lt;/span&gt;,&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;error&quot;&lt;/span&gt;:&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;code&quot;&lt;/span&gt;:&lt;span style=&quot;color: #CC0000;&quot;&gt;23&lt;/span&gt;,&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;message&quot;&lt;/span&gt;:&lt;span style=&quot;color: #3366CC;&quot;&gt;&quot;this and that&quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
Unfortunately this error reply is not easily determined by the handler&#039;s return value using the yaws_rpc module, unless it&#039;s been patched:&lt;br /&gt;
&lt;a href=&quot;http://pentaphase.de/uploads/yaws_rpc.erl-1.73.diff&quot; title=&quot;yaws_rpc.erl-1.73.diff&quot; target=&quot;_blank&quot;&gt;yaws_rpc.erl-1.73.diff&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://pentaphase.de/uploads/yaws_rpc_fixed.erl&quot; title=&quot;yaws_rpc_fixed.erl&quot; target=&quot;_blank&quot;&gt;yaws_rpc_fixed.erl&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
After applying the patch, a return value of &lt;tt&gt;{jsonrpcerror, 23, &quot;this and that&quot;}&lt;/tt&gt; should do the trick. 
    </content:encoded>

    <pubDate>Sun, 16 Dec 2007 01:29:00 +0100</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/27-guid.html</guid>
    <category>code</category>
<category>erlang</category>
<category>error</category>
<category>json</category>
<category>json-rpc</category>
<category>yaws</category>

</item>
<item>
    <title>PoC Telephony Applications</title>
    <link>http://pentaphase.de/index.php?/archives/24-PoC-Telephony-Applications.html</link>
            <category>Code</category>
            <category>eventphone (이밴트폰)</category>
    
    <comments>http://pentaphase.de/index.php?/archives/24-PoC-Telephony-Applications.html#comments</comments>
    <wfw:comment>http://pentaphase.de/wfwcomment.php?cid=24</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://pentaphase.de/rss.php?version=2.0&amp;type=comments&amp;cid=24</wfw:commentRss>
    

    <author>nospam@example.com (БэФ)</author>
    <content:encoded>
    A growing number of telephony applications primarily developed for the Phone Operation Center is now freely available on sourceforce: &lt;a href=&quot;http://poc-apps.sf.net&quot; title=&quot;PoC Telephony Applications&quot;&gt;poc-apps.sf.net&lt;/a&gt;. As of now you can download the maze (english+german), spoken human rights (german) and a small time announcement application from the SVN repository. The maze has been solved to the very end only about twice since its first appearance in 2005 at the annual Chaos Communication Congress (&lt;a href=&quot;http://events.ccc.de/congress/2005/&quot; title=&quot;22c3&quot;&gt;22C3&lt;/a&gt;). Moreover the in-game phrase &quot;Du stehst vor einer Wand.&quot; (&quot;You&#039;re facing a wall.&quot;) is well known as it has been cited numerous times at the 22C3 and similar gatherings.&lt;br /&gt;
&lt;br /&gt;
The code so far is written in Tcl as Asterisk AGI, however there is no need to know either Tcl or AGI in order to use the application. More about Asterisk may be found in the &lt;a href=&quot;http://bef.eventphone.de/a/Ast.%20C.%20I..html&quot; title=&quot;Conceptual Introduction to Asterisk&quot;&gt;Conceptual Introduction to Asterisk&lt;/a&gt;. 
    </content:encoded>

    <pubDate>Thu, 01 Nov 2007 20:35:06 +0100</pubDate>
    <guid isPermaLink="false">http://pentaphase.de/index.php?/archives/24-guid.html</guid>
    <category>agi</category>
<category>asterisk</category>
<category>code</category>
<category>eventphone (이밴트폰)</category>
<category>poc</category>
<category>tcl</category>

</item>

</channel>
</rss>