Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature: XML-Handler #130

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

2cute2die
Copy link

Offers methods for saving and loading a list of Symbols inclusivly the sessions.

This Modul saves and loads a Symbol + all included data. The approach is adapted from the XML-Modul from the Netzob release 0.4.2. For every class involved there are 4 methods:

saveToXML(): Creates a XML-Node and calls XMLProperties()
XMLProperties(): Adds the XML-Attributs to the Node.

loadFromXML(): Creates a Python Object out of the XML Node and calls RestoreFromXML()
RestoreFromXML(): Loads the attributs from the XML Node and provieds it to the loadFromXML() Method

Offers methods for saving and loading a list of Symbols inclusivly the sessions
@Sygus
Copy link
Member

Sygus commented Oct 25, 2017

Nice work!
Could you add some doctests to cover XML dumping and loading ? This will permit to detect potential regressions and issues in some classes. Besides, this will permit to understand clearly how to use the XML API.

@Sygus
Copy link
Member

Sygus commented Oct 25, 2017

Another question: is this feature similar to the symbol/message pickling ? or does it provide more coverage of the dumpable objects ?

@Sygus
Copy link
Member

Sygus commented Oct 25, 2017

Could you also change the targeted branch from 'master' to 'next' ?as 'next' is the integration branch ;)

@2cute2die 2cute2die changed the base branch from master to next October 26, 2017 08:41
@2cute2die
Copy link
Author

I added some doc-tests and a little explanation on how to use it. The tests are pretty basic because it is not easy to evaluate if the XML File is ok or not. I did a lot of testing to evaluate my XML-Modul in the past, but this test scripts are not easy portable to the Netzob tests.
---> Basically there is a bug in Netzob, i call it "ParsingPath"-Error, which prevents me from generating messages to a self-created symbol with the specialize()-Method. I have an experimental Fix for this Error from the git-lab of the University Ulm but it is more like a workaround and does not solve the problem as a whole.

This is why i cant test with a Symbol with all possible extras e.g: encoding Function, with size and aggregation fields and so on....
Additionally some parts of the persisted data is randomized. For example the UIDs of the Fields are created at random coin. This is why it is not possible to compaire a correct XML-Save-File with a genereted one in the tests.
But i assure you, i've tested the modul and the XML-Save-Files are okay.

So about the feature itself. It is pretty close to the XML Exporter from the Netzob Version 0.4.2. If have not studied the JSON Pickeling in detail but i think the XML Exporter is a bit better in cases of security.
It should not be that easy to execute code on an machine by loading a save file, because I just load the parameters for the constructor of the python object.

If you have any additional questions feel free to contact me. But at this point I dont know how to make my work more practical are easier to understand. But i have some diagrams to show the sturcture if you need this for your documentation

@Sygus
Copy link
Member

Sygus commented Nov 3, 2017

Thanks for the explanation. It will take a bit more time to review this PR, as it introduces lots of code (even though it is mainly related to XML-save and restore).

@Sygus Sygus changed the base branch from next to master January 4, 2023 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants