erlang-amf icon indicating copy to clipboard operation
erlang-amf copied to clipboard

Cannot decode

Open juacompe opened this issue 12 years ago • 0 comments

I tried to use amf3:decode to decode AMF content which I have captured in a file named /tmp/tsung_recorder20130311-1025-10.bin. However, it seems to me that the result is not decoded.

Below is what I captured from my erl shell.

juacompe@horus:~/projects/herffjones/erlang-amf/src$ erl
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.1  (abort with ^G)
1> c(amf3).
{ok,amf3}
2> {ok, Content} = file:read_file("/tmp/tsung_recorder20130311-1025-10.bin").
{ok,<<0,3,0,0,0,1,0,4,110,117,108,108,0,3,47,49,51,0,0,1,
      242,10,0,0,0,1,17,...>>}
3> {_, Rest} = amf3:decode(Content).
{undefined,<<3,0,0,0,1,0,4,110,117,108,108,0,3,47,49,51,
             0,0,1,242,10,0,0,0,1,17,10,...>>}
4> io:format("~s", [Rest]).
^C^@^@^@^A^@^Dnull^@^C/13^@^@^Aò
^@^@^@^A^Q
source^Soperation^UtimeToLive   body^QclientId^Oheaders^SmessageId^Stimestamp^Wdestination^A^F^Operform^D^@     ^C^A
loaded^F^Y59D88D9A318A^F-retrieveFinePaperItems^FOproductGlobalValueInitializationService       ^A^A^B^B^FIC85A1B2C-7D09-9B2B-B1D2-DC011356C968
^K^A^UDSEndpoint^A      DSId^FIC85A1717-9118-81F4-D237-5DAB430FE859^A^FI6017787D-86CB-859D-B834-59D8D75F2280^D^@^FblazeEndpointok
5> 

I also tried similar approach in Python using pyamf library.

juacompe@horus:~/projects/herffjones/tsung_recorder/tsung_recorder20130311-1025$ ipython 
Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from pyamf import remoting

In [2]: content = file('/tmp/tsung_recorder20130311-1025-10.bin','rb')

In [3]: envelope = remoting.decode(content)

In [4]: print envelope
<Envelope amfVersion=3>
 (u'/13', <Request target=u'null'>[<RemotingMessage  body=[{u'dispatchEvents': False, u'methodName': u'retrieveFinePaperItems', u'subSessionId': u'59D88D9A318A', u'loaded': False, u'serviceName': u'productGlobalValueInitializationService', u'methodArgs': []}] source=None timestamp=0 destination=u'blazeEndpoint' clientId=u'C85A1B2C-7D09-9B2B-B1D2-DC011356C968' headers={'DSId': u'C85A1717-9118-81F4-D237-5DAB430FE859', 'DSEndpoint': None} timeToLive=0 messageId=u'6017787D-86CB-859D-B834-59D8D75F2280' operation=u'perform' />]</Request>)
</Envelope>

The binary I used in my repro steps can be downloaded at tsung_recorder20130311-1025-10.bin.

Any comments or suggestions would be highly appreciated.

juacompe avatar Apr 24 '13 13:04 juacompe