Python Sample Register a New File Type
Jump to navigation
Jump to search
You can extend Truxton to process new file types. The first step in that process is to create an identifier for that file type and tell Truxton some details about it. You can see this same sample implemented in C. After creating your new file type, you will need to write an ETL to identify it.
Automatic ID Generation
Truxton will automatically create a unique identifier for your file type. This is not recommended as the value is random which will make it difficult to share with other exploitation programs.
import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton
def main() -> None:
t = truxton.create()
file_type = t.newfiletype()
file_type.shortname = "Acme"
file_type.longname = "A new custom type derived from XML"
file_type.extension = "xm2"
file_type.mimetype = "text/xml"
file_type.parentid = truxton.Type_XML
file_type.save()
print( "ID is " + str(file_type.id))
return None
if __name__ == "__main__":
sys.exit(main())
Predefined Value
If you have carefully chosen a integer value for your new file type, you can specify it when you register the other details.
import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton
def main() -> None:
t = truxton.create()
file_type = t.newfiletype()
file_type.id = 11111
file_type.shortname = "Acme"
file_type.longname = "A new custom type derived from XML"
file_type.extension = "xm2"
file_type.mimetype = "text/xml"
file_type.parentid = truxton.Type_XML
file_type.save()
return None
if __name__ == "__main__":
sys.exit(main())