Decoding Actionscript ByteArray using python
<p>I am using actionscript to send an array to the server with this code(I am only writing that part of the code here):-</p>

<pre><code>var a:ByteArray=new ByteArray;
a.writeObject({'a':'b','c':'d'});
socket.writeBytes(a);
socket.flush();
</code></pre>

<p>here I already opened a socket to a port on my server and I have a python code listenting on that port. How do I decode the bytes I receive using python when I run the swf after compiling it?
I received the following in the server side:- <code>b'\n\x0b\x01\x03c\x06\x03d\x03a\x06\x03b\x01'</code></p>

<p>ActionScript uses <a href="https://en.wikipedia.org/wiki/Action_Message_Format" rel="nofollow">AMF</a> format. There is an AMF library for Python which you can use: <a href="https://pypi.python.org/pypi/PyAMF" rel="nofollow">PyAMF</a>.</p>

<p>I got this when I tested it (with <em>Python 2.7</em>):</p>

<pre><code>&gt;&gt;&gt; import pyamf
&gt;&gt;&gt; for item in pyamf.decode('\n\x0b\x01\x03c\x06\x03d\x03a\x06\x03b\x01'):
...     print item
...
{'a': u'b', 'c': u'd'}
</code></pre>

python arrays actionscript-3 flex decode