Coder Social home page Coder Social logo

python-wcfbin's Introduction

python-wcfbin

A python library for converting between WCF binary xml and plain xml.

A more complete documentation could be found in the doc directory (build with sphinx).

Stable: Build Status - Stable Dev: Build Status - Dev

Contributors

  • dannyquist
  • sschmieda
  • philiptzou

python-wcfbin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-wcfbin's Issues

Support utf8

Error encode binaryxml with utf8 symbols.

Sample file:
https://www.dropbox.com/s/1i6tuztv2tx7lpz/re4.bin?dl=0

Errors:
./wcf2xml.py re4 >re4.xml
Traceback (most recent call last):
File "./wcf2xml.py", line 44, in
print_records(records)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 68, in print_records
new_line = print_records(r.childs, skip+1, fp, False)
File "/home/python-wcfbin/wcf/records/init.py", line 64, in print_records
fp.write(str(r))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

Possible false interpretation

i have met one problem "Possible false interpretation" when i call wcf2xml.py file.svc, which leads the xml result doesn't work.

I'm not sure i understand the code, why it doesn't work for Decimal interpretation?
datatypes.py:181

KeyError exceptions when parsing the example WCF dump

I'm trying the code on the packet dump included in the blog post:

https://insinuator.net/2016/08/pentesting-webservices-with-net-tcp-binding/

I've exported the packet from 0x141 to a binary file:

python -c 'import binascii; print binascii.unhexlify("06db010056020b0173040b0161065608440a1e0082ab01400a41637469766974794964040d436f7272656c6174696f6e4964982436393837373766652d653637322d346163322d623163642d623962373464313437396538083d687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f323030342f30392f536572766963654d6f64656c2f446961676e6f7374696373b1bef9db6d9c998b4e9a140ebf2d6941a24412adf843211e834c8f4e8f0ce47db9cf3a67440c1e0082ab1401560e42030a054207990e596f7520656e74657265643a2030010101"),'  > test.bin

Running wcf2bin.py test.bin gives the following error:

Traceback (most recent call last):
  File "wcf2xml.py", line 43, in <module>
    records = Record.parse(fp)
  File ".../python-wcfbin/wcf/records/base.py", line 111, in parse
    obj = Record.records[type].parse(fp)
  File ".../python-wcfbin/wcf/records/attributes.py", line 174, in parse
    value = Record.records[type].parse(fp)
KeyError: 0

Even if I add exception handling to the affected parts of the code KeyErrors pop up at other parts of the application, that indicates that this is not a bug, but more like a user error... What am I missing?

problem with Serialization/Arrays Value

I use your project to communicate with Microsoft servers, it works fine except when using Serialization/Arrays :

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
        <s:Header>
            <a:Action s:mustUnderstand="1">http://schemas.microsoft.com/online/aws/change/2010/01/IProvisioningWebService/ProvisionAzureADSyncObjects</a:Action>
            <SyncToken s:role="urn:microsoft.online.administrativeservice" xmlns="urn:microsoft.online.administrativeservice" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <ApplicationId xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">1651564e-7ce4-4d99-88be-0a65050d8dc3</ApplicationId>
                <BearerToken xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">token</BearerToken>
                <ClientVersion xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">8.0</ClientVersion>
                <DirSyncBuildNumber xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">1.5.29.0</DirSyncBuildNumber>
                <FIMBuildNumber xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">1.5.29.0</FIMBuildNumber>
                <IsInstalledOnDC xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">False</IsInstalledOnDC>
                <IssueDateTime xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">0001-01-01T00:00:00</IssueDateTime>
                <LanguageId xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">en-US</LanguageId>
                <LiveToken xmlns="http://schemas.microsoft.com/online/aws/change/2010/01"/>
                <ProtocolVersion xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">2.0</ProtocolVersion>
                <RichCoexistenceEnabled xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">False</RichCoexistenceEnabled>
                <TrackingId xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">da890d67-152c-498a-8272-a4b5fbf1c023</TrackingId>
            </SyncToken>
            <a:MessageID>urn:uuid:da890d67-152c-498a-8272-a4b5fbf1c023</a:MessageID>
            <a:ReplyTo>
                <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
            </a:ReplyTo>
            <a:To s:mustUnderstand="1">https://adminwebservice.microsoftonline.com/provisioningservice.svc</a:To>
        </s:Header>
        <s:Body>
            <ProvisionAzureADSyncObjects xmlns="http://schemas.microsoft.com/online/aws/change/2010/01">
                <syncRequest xmlns:b="http://schemas.microsoft.com/online/aws/change/2014/06" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                    <b:SyncObjects>
                        <b:AzureADSyncObject>
                            <b:PropertyValues xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                                <c:KeyValueOfstringanyType><c:Key>SourceAnchor</c:Key><c:Value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">test</c:Value></c:KeyValueOfstringanyType>
                                <c:KeyValueOfstringanyType><c:Key>displayName</c:Key><c:Value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">testsf41</c:Value></c:KeyValueOfstringanyType>
                                <c:KeyValueOfstringanyType><c:Key>userPrincipalName</c:Key><c:Value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">[email protected]</c:Value></c:KeyValueOfstringanyType>
                            </b:PropertyValues>
                            <b:SyncObjectType>User</b:SyncObjectType>
                            <b:SyncOperation>Set</b:SyncOperation>
                        </b:AzureADSyncObject>
                    </b:SyncObjects>
                </syncRequest>
            </ProvisionAzureADSyncObjects>
        </s:Body>
 </s:Envelope>

Answer :

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/online/aws/change/2010/01:syncRequest. The InnerException message was 'Element 'http://schemas.microsoft.com/2003/10/Serialization/Arrays:Value' contains data from a type that maps to the name ':mustUnderstand'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver if you are using DataContractSerializer or add the type corresponding to 'mustUnderstand' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to the serializer.'.  Please see InnerException for more details.

I tried to look but I admit that I did not find

the project :

https://github.com/sfonteneau/AADInternals_python

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.