Skip to content Skip to sidebar Skip to footer

How To Convert Ioc Files To Database Entries Using Python?

I'm an old assembly coder trying to join the 21st century. I'm not really trying to get you to write my program for me, just wondering if any of you can point out the best referen

Solution 1:

I would recommend having a look at a package that provides you with an Object-relational mapping, examples here:

What are some good Python ORM solutions?

Doing so, your code is independent from what database you use. Django for instance supports mysql, postgres and sqlite.

In Django speak, you would want to create a model class that represents one database record. So all fields you want to parse from your IOC files are a field of your model.

If I understand correctly your input is based on XML, so you may want to use the xml.etree.ElementTree class to parse one file at a time, loop over the nodes and create model instances.

Voila, they are in the database of your choice.

Post a Comment for "How To Convert Ioc Files To Database Entries Using Python?"