text: #!/usr/bin/env python
  # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
  # See LICENSE.txt for complete terms.
  
  import sys
  from stix.core import STIXPackage
  
  
  def parse_stix(pkg):
      print("== TTP ==")
      for thing in pkg.ttps:
          print("TTP: " + thing.title)
          print("Malware: " + str(thing.behavior.malware_instances[0].names[0]))
          print("Type: " + str(thing.behavior.malware_instances[0].types[0]))
      print("== INCIDENT ==")
  
      for inc in pkg.incidents:
  
          print("Title: " + inc.title)
  
          for relation in inc.leveraged_ttps:
              print("RelatedTTP: " + str(relation.relationship))
  
      return 0
  
  if __name__ == '__main__':
      try:
          fname = sys.argv[1]
      except:
          exit(1)
      fd = open(fname)
      stix_pkg = STIXPackage.from_xml(fd)
  
      parse_stix(stix_pkg)
  