Decoding/Encoding captured AMF blobs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Decoding/Encoding captured AMF blobs

Benjamin Scherrey
We're doing a load/capacity test on an application with a Flex front
end. The tool we're using can capture the AMF response/requests and
save them as files. We need to be able to take these AMF file captures
and decode them then encode new replacement packets for our playback
simulation. Having python talk directly to the Flex app is not a
likely solution for us for various reasons.

Are AMF requests/responses self-defining structures?

What's the simplest way to decode a captured AMF file blob into some
python structure and then write it back out to another file after
editing?

Thanx much for the insights.

 -- Ben Scherrey
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Decoding/Encoding captured AMF blobs

Nick Joyce
On Tuesday, 12 March 2013 at 05:25, Benjamin Scherrey wrote:
We're doing a load/capacity test on an application with a Flex front
end. The tool we're using can capture the AMF response/requests and
save them as files. We need to be able to take these AMF file captures
and decode them then encode new replacement packets for our playback
simulation. Having python talk directly to the Flex app is not a
likely solution for us for various reasons.

Are AMF requests/responses self-defining structures?
To a point, yes. Each AMF payload is contextual, a table of classes, object instances and string references are built up as the data is de/encoded. The payload can also declare labelled classes which can map to class objects declared in the language. See pyamf.register_class for more details on that.

What's the simplest way to decode a captured AMF file blob into some
python structure and then write it back out to another file after
editing?
Something along the lines of:
 
with open('/path/to/file/blob', 'rb') as stream:
    decoder = pyamf.decode(stream)

    # now iteratively decode objects out of the stream until it is exhausted
    for obj in decoder:
        print obj


Cheers,

Nick

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Loading...