Search code examples
pythonasp.netserializationdeserializationviewstate

Python Deserialize ViewState


I am writing a program to decode edit and re-encode ViewState in python. I have successfully been able to find view state and decode the base64 encoded string, but became stuck trying to deserialize it. Is there a way to deserialize view state using python without using a windows-only python library? I wand my program to be able to run it on any computer with python installed.


Solution

  • I've recently released a library that does .NET viewstate decoding, feel free to try it out https://github.com/yuvadm/viewstate/

    Sample usage:

    >>> from viewstate import ViewState
    >>> base64_encoded_viewstate = '/wEPBQVhYmNkZQ9nAgE='
    >>> vs = ViewState(base64_encoded_viewstate)
    >>> vs.decode()
    ('abcde', (True, 1))