stix_schema_spy 1.0 → 1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/config/1.1/stix/cybox/objects/Win_Hook_Object.xsd +1 -1
- data/config/1.1.1/stix/campaign.xsd +220 -0
- data/config/1.1.1/stix/course_of_action.xsd +191 -0
- data/config/1.1.1/stix/cybox/cybox_common.xsd +2700 -0
- data/config/1.1.1/stix/cybox/cybox_core.xsd +1145 -0
- data/config/1.1.1/stix/cybox/cybox_default_vocabularies.xsd +5180 -0
- data/config/1.1.1/stix/cybox/extensions/location/ciq_address_3.0.xsd +27 -0
- data/config/1.1.1/stix/cybox/extensions/platform/cpe2.3.xsd +34 -0
- data/config/1.1.1/stix/cybox/external/cpe_2.3/cpe-language_2.3.xsd +234 -0
- data/config/1.1.1/stix/cybox/external/cpe_2.3/cpe-naming_2.3.xsd +45 -0
- data/config/1.1.1/stix/cybox/external/cpe_2.3/xml.xsd +145 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/CommonTypes.xsd +104 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xAL-types.xsd +511 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xAL.xsd +672 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xNAL-types.xsd +36 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xNAL.xsd +126 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xNL-types.xsd +222 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xNL.xsd +284 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xPIL-types.xsd +854 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xPIL.xsd +1621 -0
- data/config/1.1.1/stix/cybox/external/oasis_ciq_3.0/xlink-2003-12-31.xsd +90 -0
- data/config/1.1.1/stix/cybox/objects/API_Object.xsd +55 -0
- data/config/1.1.1/stix/cybox/objects/ARP_Cache_Object.xsd +98 -0
- data/config/1.1.1/stix/cybox/objects/AS_Object.xsd +50 -0
- data/config/1.1.1/stix/cybox/objects/Account_Object.xsd +501 -0
- data/config/1.1.1/stix/cybox/objects/Address_Object.xsd +127 -0
- data/config/1.1.1/stix/cybox/objects/Archive_File_Object.xsd +134 -0
- data/config/1.1.1/stix/cybox/objects/Artifact_Object.xsd +212 -0
- data/config/1.1.1/stix/cybox/objects/Code_Object.xsd +417 -0
- data/config/1.1.1/stix/cybox/objects/Custom_Object.xsd +42 -0
- data/config/1.1.1/stix/cybox/objects/DNS_Cache_Object.xsd +53 -0
- data/config/1.1.1/stix/cybox/objects/DNS_Query_Object.xsd +164 -0
- data/config/1.1.1/stix/cybox/objects/DNS_Record_Object.xsd +92 -0
- data/config/1.1.1/stix/cybox/objects/Device_Object.xsd +65 -0
- data/config/1.1.1/stix/cybox/objects/Disk_Object.xsd +117 -0
- data/config/1.1.1/stix/cybox/objects/Disk_Partition_Object.xsd +199 -0
- data/config/1.1.1/stix/cybox/objects/Domain_Name_Object.xsd +57 -0
- data/config/1.1.1/stix/cybox/objects/Email_Message_Object.xsd +278 -0
- data/config/1.1.1/stix/cybox/objects/File_Object.xsd +397 -0
- data/config/1.1.1/stix/cybox/objects/GUI_Dialogbox_Object.xsd +41 -0
- data/config/1.1.1/stix/cybox/objects/GUI_Object.xsd +40 -0
- data/config/1.1.1/stix/cybox/objects/GUI_Window_Object.xsd +46 -0
- data/config/1.1.1/stix/cybox/objects/HTTP_Session_Object.xsd +633 -0
- data/config/1.1.1/stix/cybox/objects/Hostname_Object.xsd +45 -0
- data/config/1.1.1/stix/cybox/objects/Image_File_Object.xsd +124 -0
- data/config/1.1.1/stix/cybox/objects/Library_Object.xsd +114 -0
- data/config/1.1.1/stix/cybox/objects/Link_Object.xsd +36 -0
- data/config/1.1.1/stix/cybox/objects/Linux_Package_Object.xsd +75 -0
- data/config/1.1.1/stix/cybox/objects/Memory_Object.xsd +141 -0
- data/config/1.1.1/stix/cybox/objects/Mutex_Object.xsd +40 -0
- data/config/1.1.1/stix/cybox/objects/Network_Connection_Object.xsd +540 -0
- data/config/1.1.1/stix/cybox/objects/Network_Flow_Object.xsd +1559 -0
- data/config/1.1.1/stix/cybox/objects/Network_Packet_Object.xsd +2934 -0
- data/config/1.1.1/stix/cybox/objects/Network_Route_Entry_Object.xsd +155 -0
- data/config/1.1.1/stix/cybox/objects/Network_Route_Object.xsd +93 -0
- data/config/1.1.1/stix/cybox/objects/Network_Socket_Object.xsd +529 -0
- data/config/1.1.1/stix/cybox/objects/Network_Subnet_Object.xsd +64 -0
- data/config/1.1.1/stix/cybox/objects/PDF_File_Object.xsd +595 -0
- data/config/1.1.1/stix/cybox/objects/Pipe_Object.xsd +40 -0
- data/config/1.1.1/stix/cybox/objects/Port_Object.xsd +40 -0
- data/config/1.1.1/stix/cybox/objects/Process_Object.xsd +199 -0
- data/config/1.1.1/stix/cybox/objects/Product_Object.xsd +65 -0
- data/config/1.1.1/stix/cybox/objects/SMS_Message_Object.xsd +79 -0
- data/config/1.1.1/stix/cybox/objects/Semaphore_Object.xsd +50 -0
- data/config/1.1.1/stix/cybox/objects/Socket_Address_Object.xsd +50 -0
- data/config/1.1.1/stix/cybox/objects/System_Object.xsd +410 -0
- data/config/1.1.1/stix/cybox/objects/URI_Object.xsd +62 -0
- data/config/1.1.1/stix/cybox/objects/URL_History_Object.xsd +104 -0
- data/config/1.1.1/stix/cybox/objects/Unix_File_Object.xsd +164 -0
- data/config/1.1.1/stix/cybox/objects/Unix_Network_Route_Entry_Object.xsd +56 -0
- data/config/1.1.1/stix/cybox/objects/Unix_Pipe_Object.xsd +36 -0
- data/config/1.1.1/stix/cybox/objects/Unix_Process_Object.xsd +143 -0
- data/config/1.1.1/stix/cybox/objects/Unix_User_Account_Object.xsd +78 -0
- data/config/1.1.1/stix/cybox/objects/Unix_Volume_Object.xsd +41 -0
- data/config/1.1.1/stix/cybox/objects/User_Account_Object.xsd +110 -0
- data/config/1.1.1/stix/cybox/objects/User_Session_Object.xsd +60 -0
- data/config/1.1.1/stix/cybox/objects/Volume_Object.xsd +235 -0
- data/config/1.1.1/stix/cybox/objects/Whois_Object.xsd +430 -0
- data/config/1.1.1/stix/cybox/objects/Win_Computer_Account_Object.xsd +135 -0
- data/config/1.1.1/stix/cybox/objects/Win_Critical_Section_Object.xsd +40 -0
- data/config/1.1.1/stix/cybox/objects/Win_Driver_Object.xsd +270 -0
- data/config/1.1.1/stix/cybox/objects/Win_Event_Log_Object.xsd +137 -0
- data/config/1.1.1/stix/cybox/objects/Win_Event_Object.xsd +80 -0
- data/config/1.1.1/stix/cybox/objects/Win_Executable_File_Object.xsd +1311 -0
- data/config/1.1.1/stix/cybox/objects/Win_File_Object.xsd +269 -0
- data/config/1.1.1/stix/cybox/objects/Win_Filemapping_Object.xsd +175 -0
- data/config/1.1.1/stix/cybox/objects/Win_Handle_Object.xsd +351 -0
- data/config/1.1.1/stix/cybox/objects/Win_Hook_Object.xsd +152 -0
- data/config/1.1.1/stix/cybox/objects/Win_Kernel_Hook_Object.xsd +109 -0
- data/config/1.1.1/stix/cybox/objects/Win_Kernel_Object.xsd +128 -0
- data/config/1.1.1/stix/cybox/objects/Win_Mailslot_Object.xsd +56 -0
- data/config/1.1.1/stix/cybox/objects/Win_Memory_Page_Region_Object.xsd +198 -0
- data/config/1.1.1/stix/cybox/objects/Win_Mutex_Object.xsd +42 -0
- data/config/1.1.1/stix/cybox/objects/Win_Network_Route_Entry_Object.xsd +200 -0
- data/config/1.1.1/stix/cybox/objects/Win_Network_Share_Object.xsd +205 -0
- data/config/1.1.1/stix/cybox/objects/Win_Pipe_Object.xsd +73 -0
- data/config/1.1.1/stix/cybox/objects/Win_Prefetch_Object.xsd +113 -0
- data/config/1.1.1/stix/cybox/objects/Win_Process_Object.xsd +174 -0
- data/config/1.1.1/stix/cybox/objects/Win_Registry_Key_Object.xsd +290 -0
- data/config/1.1.1/stix/cybox/objects/Win_Semaphore_Object.xsd +42 -0
- data/config/1.1.1/stix/cybox/objects/Win_Service_Object.xsd +287 -0
- data/config/1.1.1/stix/cybox/objects/Win_System_Object.xsd +126 -0
- data/config/1.1.1/stix/cybox/objects/Win_System_Restore_Object.xsd +207 -0
- data/config/1.1.1/stix/cybox/objects/Win_Task_Object.xsd +755 -0
- data/config/1.1.1/stix/cybox/objects/Win_Thread_Object.xsd +146 -0
- data/config/1.1.1/stix/cybox/objects/Win_User_Account_Object.xsd +73 -0
- data/config/1.1.1/stix/cybox/objects/Win_Volume_Object.xsd +161 -0
- data/config/1.1.1/stix/cybox/objects/Win_Waitable_Timer_Object.xsd +90 -0
- data/config/1.1.1/stix/cybox/objects/X509_Certificate_Object.xsd +275 -0
- data/config/1.1.1/stix/data_marking.xsd +97 -0
- data/config/1.1.1/stix/exploit_target.xsd +324 -0
- data/config/1.1.1/stix/extensions/address/ciq_3.0_address.xsd +27 -0
- data/config/1.1.1/stix/extensions/attack_pattern/capec_2.7_attack_pattern.xsd +31 -0
- data/config/1.1.1/stix/extensions/identity/ciq_3.0_identity.xsd +113 -0
- data/config/1.1.1/stix/extensions/malware/maec_4.1_malware.xsd +31 -0
- data/config/1.1.1/stix/extensions/marking/simple_marking.xsd +31 -0
- data/config/1.1.1/stix/extensions/marking/terms_of_use_marking.xsd +31 -0
- data/config/1.1.1/stix/extensions/marking/tlp_marking.xsd +40 -0
- data/config/1.1.1/stix/extensions/structured_coa/generic_structured_coa.xsd +46 -0
- data/config/1.1.1/stix/extensions/test_mechanism/generic_test_mechanism.xsd +46 -0
- data/config/1.1.1/stix/extensions/test_mechanism/open_ioc_2010_test_mechanism.xsd +32 -0
- data/config/1.1.1/stix/extensions/test_mechanism/oval_5.10_test_mechanism.xsd +37 -0
- data/config/1.1.1/stix/extensions/test_mechanism/snort_test_mechanism.xsd +56 -0
- data/config/1.1.1/stix/extensions/test_mechanism/yara_test_mechanism.xsd +36 -0
- data/config/1.1.1/stix/extensions/vulnerability/cvrf_1.1_vulnerability.xsd +33 -0
- data/config/1.1.1/stix/external/capec_2.7/ap_schema_v2.7.xsd +3618 -0
- data/config/1.1.1/stix/external/cvrf_1.1/common.xsd +176 -0
- data/config/1.1.1/stix/external/cvrf_1.1/cpe-language_2.2a.xsd +182 -0
- data/config/1.1.1/stix/external/cvrf_1.1/cvrf.xsd +487 -0
- data/config/1.1.1/stix/external/cvrf_1.1/cvss-v2_0.9.xsd +415 -0
- data/config/1.1.1/stix/external/cvrf_1.1/dc.xsd +118 -0
- data/config/1.1.1/stix/external/cvrf_1.1/prod.xsd +292 -0
- data/config/1.1.1/stix/external/cvrf_1.1/scap-core_0.9.xsd +170 -0
- data/config/1.1.1/stix/external/cvrf_1.1/vuln.xsd +631 -0
- data/config/1.1.1/stix/external/cvrf_1.1/xml.xsd +287 -0
- data/config/1.1.1/stix/external/maec_4.1/maec_bundle_schema.xsd +1228 -0
- data/config/1.1.1/stix/external/maec_4.1/maec_container_schema.xsd +62 -0
- data/config/1.1.1/stix/external/maec_4.1/maec_default_vocabularies.xsd +5325 -0
- data/config/1.1.1/stix/external/maec_4.1/maec_package_schema.xsd +1095 -0
- data/config/1.1.1/stix/external/maec_4.1/metadataSharing.xsd +1712 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/CommonTypes.xsd +104 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xAL-types.xsd +511 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xAL.xsd +672 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xNAL-types.xsd +36 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xNAL.xsd +126 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xNL-types.xsd +222 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xNL.xsd +284 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xPIL-types.xsd +854 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xPIL.xsd +1621 -0
- data/config/1.1.1/stix/external/oasis_ciq_3.0/xlink-2003-12-31.xsd +90 -0
- data/config/1.1.1/stix/external/open_ioc_2010/ioc-TR.xsd +25 -0
- data/config/1.1.1/stix/external/open_ioc_2010/ioc.xsd +105 -0
- data/config/1.1.1/stix/external/oval_5.10/oval-common-schema.xsd +781 -0
- data/config/1.1.1/stix/external/oval_5.10/oval-definitions-schema.xsd +1608 -0
- data/config/1.1.1/stix/external/oval_5.10/oval-variables-schema.xsd +84 -0
- data/config/1.1.1/stix/external/oval_5.10/xmldsig-core-schema.xsd +309 -0
- data/config/1.1.1/stix/incident.xsd +762 -0
- data/config/1.1.1/stix/indicator.xsd +368 -0
- data/config/1.1.1/stix/stix_common.xsd +923 -0
- data/config/1.1.1/stix/stix_core.xsd +253 -0
- data/config/1.1.1/stix/stix_default_vocabularies.xsd +2081 -0
- data/config/1.1.1/stix/threat_actor.xsd +182 -0
- data/config/1.1.1/stix/ttp.xsd +430 -0
- data/config/1.1.1/uber_schema.xsd +149 -0
- data/lib/stix_schema_spy/models/attribute.rb +1 -1
- data/lib/stix_schema_spy/models/element.rb +2 -9
- data/lib/stix_schema_spy/models/external_type.rb +29 -0
- data/lib/stix_schema_spy/models/has_children.rb +9 -9
- data/lib/stix_schema_spy/models/node.rb +7 -6
- data/lib/stix_schema_spy/models/schema.rb +6 -4
- data/lib/stix_schema_spy/models/type.rb +44 -5
- data/lib/stix_schema_spy/util/tasks.rb +15 -14
- data/lib/stix_schema_spy/version.rb +1 -1
- metadata +171 -9
@@ -0,0 +1,149 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<schema xmlns="http://www.w3.org/2001/XMLSchema">
|
3
|
+
<import namespace="http://stix.mitre.org/Campaign-1" schemaLocation="campaign.xsd"/>
|
4
|
+
<import namespace="http://stix.mitre.org/CourseOfAction-1" schemaLocation="course_of_action.xsd"/>
|
5
|
+
<import namespace="http://cybox.mitre.org/common-2" schemaLocation="cybox/cybox_common.xsd"/>
|
6
|
+
<import namespace="http://cybox.mitre.org/cybox-2" schemaLocation="cybox/cybox_core.xsd"/>
|
7
|
+
<import namespace="http://cybox.mitre.org/default_vocabularies-2" schemaLocation="cybox/cybox_default_vocabularies.xsd"/>
|
8
|
+
<import namespace="http://cybox.mitre.org/extensions/Address#CIQAddress3.0-1" schemaLocation="cybox/extensions/location/ciq_address_3.0.xsd"/>
|
9
|
+
<import namespace="http://cybox.mitre.org/extensions/platform#CPE2.3-1" schemaLocation="cybox/extensions/platform/cpe2.3.xsd"/>
|
10
|
+
<import namespace="http://cpe.mitre.org/language/2.0" schemaLocation="external/cvrf_1.1/cpe-language_2.2a.xsd"/>
|
11
|
+
<import namespace="http://cpe.mitre.org/naming/2.0" schemaLocation="cybox/external/cpe_2.3/cpe-naming_2.3.xsd"/>
|
12
|
+
<import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="external/cvrf_1.1/xml.xsd"/>
|
13
|
+
<import namespace="urn:oasis:names:tc:ciq:ct:3" schemaLocation="external/oasis_ciq_3.0/CommonTypes.xsd"/>
|
14
|
+
<import namespace="urn:oasis:names:tc:ciq:xal:3" schemaLocation="external/oasis_ciq_3.0/xAL.xsd"/>
|
15
|
+
<import namespace="http://www.w3.org/1999/xlink" schemaLocation="external/oasis_ciq_3.0/xlink-2003-12-31.xsd"/>
|
16
|
+
<import namespace="urn:oasis:names:tc:ciq:xnal:3" schemaLocation="external/oasis_ciq_3.0/xNAL.xsd"/>
|
17
|
+
<import namespace="urn:oasis:names:tc:ciq:xnl:3" schemaLocation="external/oasis_ciq_3.0/xNL.xsd"/>
|
18
|
+
<import namespace="urn:oasis:names:tc:ciq:xpil:3" schemaLocation="external/oasis_ciq_3.0/xPIL.xsd"/>
|
19
|
+
<import namespace="http://cybox.mitre.org/objects#AccountObject-2" schemaLocation="cybox/objects/Account_Object.xsd"/>
|
20
|
+
<import namespace="http://cybox.mitre.org/objects#AddressObject-2" schemaLocation="cybox/objects/Address_Object.xsd"/>
|
21
|
+
<import namespace="http://cybox.mitre.org/objects#APIObject-2" schemaLocation="cybox/objects/API_Object.xsd"/>
|
22
|
+
<import namespace="http://cybox.mitre.org/objects#ArchiveFileObject-1" schemaLocation="cybox/objects/Archive_File_Object.xsd"/>
|
23
|
+
<import namespace="http://cybox.mitre.org/objects#ARPCacheObject-1" schemaLocation="cybox/objects/ARP_Cache_Object.xsd"/>
|
24
|
+
<import namespace="http://cybox.mitre.org/objects#ArtifactObject-2" schemaLocation="cybox/objects/Artifact_Object.xsd"/>
|
25
|
+
<import namespace="http://cybox.mitre.org/objects#ASObject-1" schemaLocation="cybox/objects/AS_Object.xsd"/>
|
26
|
+
<import namespace="http://cybox.mitre.org/objects#CodeObject-2" schemaLocation="cybox/objects/Code_Object.xsd"/>
|
27
|
+
<import namespace="http://cybox.mitre.org/objects#CustomObject-1" schemaLocation="cybox/objects/Custom_Object.xsd"/>
|
28
|
+
<import namespace="http://cybox.mitre.org/objects#DeviceObject-2" schemaLocation="cybox/objects/Device_Object.xsd"/>
|
29
|
+
<import namespace="http://cybox.mitre.org/objects#DiskObject-2" schemaLocation="cybox/objects/Disk_Object.xsd"/>
|
30
|
+
<import namespace="http://cybox.mitre.org/objects#DiskPartitionObject-2" schemaLocation="cybox/objects/Disk_Partition_Object.xsd"/>
|
31
|
+
<import namespace="http://cybox.mitre.org/objects#DNSCacheObject-2" schemaLocation="cybox/objects/DNS_Cache_Object.xsd"/>
|
32
|
+
<import namespace="http://cybox.mitre.org/objects#DNSQueryObject-2" schemaLocation="cybox/objects/DNS_Query_Object.xsd"/>
|
33
|
+
<import namespace="http://cybox.mitre.org/objects#DNSRecordObject-2" schemaLocation="cybox/objects/DNS_Record_Object.xsd"/>
|
34
|
+
<import namespace="http://cybox.mitre.org/objects#DomainNameObject-1" schemaLocation="cybox/objects/Domain_Name_Object.xsd"/>
|
35
|
+
<import namespace="http://cybox.mitre.org/objects#EmailMessageObject-2" schemaLocation="cybox/objects/Email_Message_Object.xsd"/>
|
36
|
+
<import namespace="http://cybox.mitre.org/objects#FileObject-2" schemaLocation="cybox/objects/File_Object.xsd"/>
|
37
|
+
<import namespace="http://cybox.mitre.org/objects#GUIDialogboxObject-2" schemaLocation="cybox/objects/GUI_Dialogbox_Object.xsd"/>
|
38
|
+
<import namespace="http://cybox.mitre.org/objects#GUIObject-2" schemaLocation="cybox/objects/GUI_Object.xsd"/>
|
39
|
+
<import namespace="http://cybox.mitre.org/objects#GUIWindowObject-2" schemaLocation="cybox/objects/GUI_Window_Object.xsd"/>
|
40
|
+
<import namespace="http://cybox.mitre.org/objects#HostnameObject-1" schemaLocation="cybox/objects/Hostname_Object.xsd"/>
|
41
|
+
<import namespace="http://cybox.mitre.org/objects#HTTPSessionObject-2" schemaLocation="cybox/objects/HTTP_Session_Object.xsd"/>
|
42
|
+
<import namespace="http://cybox.mitre.org/objects#ImageFileObject-1" schemaLocation="cybox/objects/Image_File_Object.xsd"/>
|
43
|
+
<import namespace="http://cybox.mitre.org/objects#LibraryObject-2" schemaLocation="cybox/objects/Library_Object.xsd"/>
|
44
|
+
<import namespace="http://cybox.mitre.org/objects#LinkObject-1" schemaLocation="cybox/objects/Link_Object.xsd"/>
|
45
|
+
<import namespace="http://cybox.mitre.org/objects#LinuxPackageObject-2" schemaLocation="cybox/objects/Linux_Package_Object.xsd"/>
|
46
|
+
<import namespace="http://cybox.mitre.org/objects#MemoryObject-2" schemaLocation="cybox/objects/Memory_Object.xsd"/>
|
47
|
+
<import namespace="http://cybox.mitre.org/objects#MutexObject-2" schemaLocation="cybox/objects/Mutex_Object.xsd"/>
|
48
|
+
<import namespace="http://cybox.mitre.org/objects#NetworkConnectionObject-2" schemaLocation="cybox/objects/Network_Connection_Object.xsd"/>
|
49
|
+
<import namespace="http://cybox.mitre.org/objects#NetworkFlowObject-2" schemaLocation="cybox/objects/Network_Flow_Object.xsd"/>
|
50
|
+
<import namespace="http://cybox.mitre.org/objects#PacketObject-2" schemaLocation="cybox/objects/Network_Packet_Object.xsd"/>
|
51
|
+
<import namespace="http://cybox.mitre.org/objects#NetworkRouteEntryObject-2" schemaLocation="cybox/objects/Network_Route_Entry_Object.xsd"/>
|
52
|
+
<import namespace="http://cybox.mitre.org/objects#NetworkRouteObject-2" schemaLocation="cybox/objects/Network_Route_Object.xsd"/>
|
53
|
+
<import namespace="http://cybox.mitre.org/objects#NetworkSocketObject-2" schemaLocation="cybox/objects/Network_Socket_Object.xsd"/>
|
54
|
+
<import namespace="http://cybox.mitre.org/objects#NetworkSubnetObject-2" schemaLocation="cybox/objects/Network_Subnet_Object.xsd"/>
|
55
|
+
<import namespace="http://cybox.mitre.org/objects#PDFFileObject-1" schemaLocation="cybox/objects/PDF_File_Object.xsd"/>
|
56
|
+
<import namespace="http://cybox.mitre.org/objects#PipeObject-2" schemaLocation="cybox/objects/Pipe_Object.xsd"/>
|
57
|
+
<import namespace="http://cybox.mitre.org/objects#PortObject-2" schemaLocation="cybox/objects/Port_Object.xsd"/>
|
58
|
+
<import namespace="http://cybox.mitre.org/objects#ProcessObject-2" schemaLocation="cybox/objects/Process_Object.xsd"/>
|
59
|
+
<import namespace="http://cybox.mitre.org/objects#ProductObject-2" schemaLocation="cybox/objects/Product_Object.xsd"/>
|
60
|
+
<import namespace="http://cybox.mitre.org/objects#SemaphoreObject-2" schemaLocation="cybox/objects/Semaphore_Object.xsd"/>
|
61
|
+
<import namespace="http://cybox.mitre.org/objects#SMSMessageObject-1" schemaLocation="cybox/objects/SMS_Message_Object.xsd"/>
|
62
|
+
<import namespace="http://cybox.mitre.org/objects#SocketAddressObject-1" schemaLocation="cybox/objects/Socket_Address_Object.xsd"/>
|
63
|
+
<import namespace="http://cybox.mitre.org/objects#SystemObject-2" schemaLocation="cybox/objects/System_Object.xsd"/>
|
64
|
+
<import namespace="http://cybox.mitre.org/objects#UnixFileObject-2" schemaLocation="cybox/objects/Unix_File_Object.xsd"/>
|
65
|
+
<import namespace="http://cybox.mitre.org/objects#UnixNetworkRouteEntryObject-2" schemaLocation="cybox/objects/Unix_Network_Route_Entry_Object.xsd"/>
|
66
|
+
<import namespace="http://cybox.mitre.org/objects#UnixPipeObject-2" schemaLocation="cybox/objects/Unix_Pipe_Object.xsd"/>
|
67
|
+
<import namespace="http://cybox.mitre.org/objects#UnixProcessObject-2" schemaLocation="cybox/objects/Unix_Process_Object.xsd"/>
|
68
|
+
<import namespace="http://cybox.mitre.org/objects#UnixUserAccountObject-2" schemaLocation="cybox/objects/Unix_User_Account_Object.xsd"/>
|
69
|
+
<import namespace="http://cybox.mitre.org/objects#UnixVolumeObject-2" schemaLocation="cybox/objects/Unix_Volume_Object.xsd"/>
|
70
|
+
<import namespace="http://cybox.mitre.org/objects#URIObject-2" schemaLocation="cybox/objects/URI_Object.xsd"/>
|
71
|
+
<import namespace="http://cybox.mitre.org/objects#URLHistoryObject-1" schemaLocation="cybox/objects/URL_History_Object.xsd"/>
|
72
|
+
<import namespace="http://cybox.mitre.org/objects#UserAccountObject-2" schemaLocation="cybox/objects/User_Account_Object.xsd"/>
|
73
|
+
<import namespace="http://cybox.mitre.org/objects#UserSessionObject-2" schemaLocation="cybox/objects/User_Session_Object.xsd"/>
|
74
|
+
<import namespace="http://cybox.mitre.org/objects#VolumeObject-2" schemaLocation="cybox/objects/Volume_Object.xsd"/>
|
75
|
+
<import namespace="http://cybox.mitre.org/objects#WhoisObject-2" schemaLocation="cybox/objects/Whois_Object.xsd"/>
|
76
|
+
<import namespace="http://cybox.mitre.org/objects#WinComputerAccountObject-2" schemaLocation="cybox/objects/Win_Computer_Account_Object.xsd"/>
|
77
|
+
<import namespace="http://cybox.mitre.org/objects#WinCriticalSectionObject-2" schemaLocation="cybox/objects/Win_Critical_Section_Object.xsd"/>
|
78
|
+
<import namespace="http://cybox.mitre.org/objects#WinDriverObject-3" schemaLocation="cybox/objects/Win_Driver_Object.xsd"/>
|
79
|
+
<import namespace="http://cybox.mitre.org/objects#WinEventLogObject-2" schemaLocation="cybox/objects/Win_Event_Log_Object.xsd"/>
|
80
|
+
<import namespace="http://cybox.mitre.org/objects#WinEventObject-2" schemaLocation="cybox/objects/Win_Event_Object.xsd"/>
|
81
|
+
<import namespace="http://cybox.mitre.org/objects#WinExecutableFileObject-2" schemaLocation="cybox/objects/Win_Executable_File_Object.xsd"/>
|
82
|
+
<import namespace="http://cybox.mitre.org/objects#WinFilemappingObject-1" schemaLocation="cybox/objects/Win_Filemapping_Object.xsd"/>
|
83
|
+
<import namespace="http://cybox.mitre.org/objects#WinFileObject-2" schemaLocation="cybox/objects/Win_File_Object.xsd"/>
|
84
|
+
<import namespace="http://cybox.mitre.org/objects#WinHandleObject-2" schemaLocation="cybox/objects/Win_Handle_Object.xsd"/>
|
85
|
+
<import namespace="http://cybox.mitre.org/objects#WinHookObject-1" schemaLocation="cybox/objects/Win_Hook_Object.xsd"/>
|
86
|
+
<import namespace="http://cybox.mitre.org/objects#WinKernelHookObject-2" schemaLocation="cybox/objects/Win_Kernel_Hook_Object.xsd"/>
|
87
|
+
<import namespace="http://cybox.mitre.org/objects#WinKernelObject-2" schemaLocation="cybox/objects/Win_Kernel_Object.xsd"/>
|
88
|
+
<import namespace="http://cybox.mitre.org/objects#WinMailslotObject-2" schemaLocation="cybox/objects/Win_Mailslot_Object.xsd"/>
|
89
|
+
<import namespace="http://cybox.mitre.org/objects#WinMemoryPageRegionObject-2" schemaLocation="cybox/objects/Win_Memory_Page_Region_Object.xsd"/>
|
90
|
+
<import namespace="http://cybox.mitre.org/objects#WinMutexObject-2" schemaLocation="cybox/objects/Win_Mutex_Object.xsd"/>
|
91
|
+
<import namespace="http://cybox.mitre.org/objects#WinNetworkRouteEntryObject-2" schemaLocation="cybox/objects/Win_Network_Route_Entry_Object.xsd"/>
|
92
|
+
<import namespace="http://cybox.mitre.org/objects#WinNetworkShareObject-2" schemaLocation="cybox/objects/Win_Network_Share_Object.xsd"/>
|
93
|
+
<import namespace="http://cybox.mitre.org/objects#WinPipeObject-2" schemaLocation="cybox/objects/Win_Pipe_Object.xsd"/>
|
94
|
+
<import namespace="http://cybox.mitre.org/objects#WinPrefetchObject-2" schemaLocation="cybox/objects/Win_Prefetch_Object.xsd"/>
|
95
|
+
<import namespace="http://cybox.mitre.org/objects#WinProcessObject-2" schemaLocation="cybox/objects/Win_Process_Object.xsd"/>
|
96
|
+
<import namespace="http://cybox.mitre.org/objects#WinRegistryKeyObject-2" schemaLocation="cybox/objects/Win_Registry_Key_Object.xsd"/>
|
97
|
+
<import namespace="http://cybox.mitre.org/objects#WinSemaphoreObject-2" schemaLocation="cybox/objects/Win_Semaphore_Object.xsd"/>
|
98
|
+
<import namespace="http://cybox.mitre.org/objects#WinServiceObject-2" schemaLocation="cybox/objects/Win_Service_Object.xsd"/>
|
99
|
+
<import namespace="http://cybox.mitre.org/objects#WinSystemObject-2" schemaLocation="cybox/objects/Win_System_Object.xsd"/>
|
100
|
+
<import namespace="http://cybox.mitre.org/objects#WinSystemRestoreObject-2" schemaLocation="cybox/objects/Win_System_Restore_Object.xsd"/>
|
101
|
+
<import namespace="http://cybox.mitre.org/objects#WinTaskObject-2" schemaLocation="cybox/objects/Win_Task_Object.xsd"/>
|
102
|
+
<import namespace="http://cybox.mitre.org/objects#WinThreadObject-2" schemaLocation="cybox/objects/Win_Thread_Object.xsd"/>
|
103
|
+
<import namespace="http://cybox.mitre.org/objects#WinUserAccountObject-2" schemaLocation="cybox/objects/Win_User_Account_Object.xsd"/>
|
104
|
+
<import namespace="http://cybox.mitre.org/objects#WinVolumeObject-2" schemaLocation="cybox/objects/Win_Volume_Object.xsd"/>
|
105
|
+
<import namespace="http://cybox.mitre.org/objects#WinWaitableTimerObject-2" schemaLocation="cybox/objects/Win_Waitable_Timer_Object.xsd"/>
|
106
|
+
<import namespace="http://cybox.mitre.org/objects#X509CertificateObject-2" schemaLocation="cybox/objects/X509_Certificate_Object.xsd"/>
|
107
|
+
<import namespace="http://data-marking.mitre.org/Marking-1" schemaLocation="data_marking.xsd"/>
|
108
|
+
<import namespace="http://stix.mitre.org/ExploitTarget-1" schemaLocation="exploit_target.xsd"/>
|
109
|
+
<import namespace="http://stix.mitre.org/extensions/Address#CIQAddress3.0-1" schemaLocation="extensions/address/ciq_3.0_address.xsd"/>
|
110
|
+
<import namespace="http://stix.mitre.org/extensions/AP#CAPEC2.7-1" schemaLocation="extensions/attack_pattern/capec_2.7_attack_pattern.xsd"/>
|
111
|
+
<import namespace="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1" schemaLocation="extensions/identity/ciq_3.0_identity.xsd"/>
|
112
|
+
<import namespace="http://stix.mitre.org/extensions/Malware#MAEC4.1-1" schemaLocation="extensions/malware/maec_4.1_malware.xsd"/>
|
113
|
+
<import namespace="http://data-marking.mitre.org/extensions/MarkingStructure#Simple-1" schemaLocation="extensions/marking/simple_marking.xsd"/>
|
114
|
+
<import namespace="http://data-marking.mitre.org/extensions/MarkingStructure#Terms_Of_Use-1" schemaLocation="extensions/marking/terms_of_use_marking.xsd"/>
|
115
|
+
<import namespace="http://data-marking.mitre.org/extensions/MarkingStructure#TLP-1" schemaLocation="extensions/marking/tlp_marking.xsd"/>
|
116
|
+
<import namespace="http://stix.mitre.org/extensions/StructuredCOA#Generic-1" schemaLocation="extensions/structured_coa/generic_structured_coa.xsd"/>
|
117
|
+
<import namespace="http://stix.mitre.org/extensions/TestMechanism#Generic-1" schemaLocation="extensions/test_mechanism/generic_test_mechanism.xsd"/>
|
118
|
+
<import namespace="http://stix.mitre.org/extensions/TestMechanism#OpenIOC2010-1" schemaLocation="extensions/test_mechanism/open_ioc_2010_test_mechanism.xsd"/>
|
119
|
+
<import namespace="http://stix.mitre.org/extensions/TestMechanism#OVAL5.10-1" schemaLocation="extensions/test_mechanism/oval_5.10_test_mechanism.xsd"/>
|
120
|
+
<import namespace="http://stix.mitre.org/extensions/TestMechanism#Snort-1" schemaLocation="extensions/test_mechanism/snort_test_mechanism.xsd"/>
|
121
|
+
<import namespace="http://stix.mitre.org/extensions/TestMechanism#YARA-1" schemaLocation="extensions/test_mechanism/yara_test_mechanism.xsd"/>
|
122
|
+
<import namespace="http://stix.mitre.org/extensions/Vulnerability#CVRF-1" schemaLocation="extensions/vulnerability/cvrf_1.1_vulnerability.xsd"/>
|
123
|
+
<import namespace="http://capec.mitre.org/capec-2" schemaLocation="external/capec_2.7/ap_schema_v2.7.xsd"/>
|
124
|
+
<import namespace="http://www.icasi.org/CVRF/schema/common/1.1" schemaLocation="external/cvrf_1.1/common.xsd"/>
|
125
|
+
<import namespace="http://www.icasi.org/CVRF/schema/cvrf/1.1" schemaLocation="external/cvrf_1.1/cvrf.xsd"/>
|
126
|
+
<import namespace="http://scap.nist.gov/schema/cvss-v2/1.0" schemaLocation="external/cvrf_1.1/cvss-v2_0.9.xsd"/>
|
127
|
+
<import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="external/cvrf_1.1/dc.xsd"/>
|
128
|
+
<import namespace="http://www.icasi.org/CVRF/schema/prod/1.1" schemaLocation="external/cvrf_1.1/prod.xsd"/>
|
129
|
+
<import namespace="http://scap.nist.gov/schema/scap-core/1.0" schemaLocation="external/cvrf_1.1/scap-core_0.9.xsd"/>
|
130
|
+
<import namespace="http://www.icasi.org/CVRF/schema/vuln/1.1" schemaLocation="external/cvrf_1.1/vuln.xsd"/>
|
131
|
+
<import namespace="http://maec.mitre.org/XMLSchema/maec-bundle-4" schemaLocation="external/maec_4.1/maec_bundle_schema.xsd"/>
|
132
|
+
<import namespace="http://maec.mitre.org/XMLSchema/maec-container-2" schemaLocation="external/maec_4.1/maec_container_schema.xsd"/>
|
133
|
+
<import namespace="http://maec.mitre.org/default_vocabularies-1" schemaLocation="external/maec_4.1/maec_default_vocabularies.xsd"/>
|
134
|
+
<import namespace="http://maec.mitre.org/XMLSchema/maec-package-2" schemaLocation="external/maec_4.1/maec_package_schema.xsd"/>
|
135
|
+
<import namespace="http://xml/metadataSharing.xsd" schemaLocation="external/maec_4.1/metadataSharing.xsd"/>
|
136
|
+
<import namespace="http://schemas.mandiant.com/2010/ioc/TR/" schemaLocation="external/open_ioc_2010/ioc-TR.xsd"/>
|
137
|
+
<import namespace="http://schemas.mandiant.com/2010/ioc" schemaLocation="external/open_ioc_2010/ioc.xsd"/>
|
138
|
+
<import namespace="http://oval.mitre.org/XMLSchema/oval-common-5" schemaLocation="external/oval_5.10/oval-common-schema.xsd"/>
|
139
|
+
<import namespace="http://oval.mitre.org/XMLSchema/oval-definitions-5" schemaLocation="external/oval_5.10/oval-definitions-schema.xsd"/>
|
140
|
+
<import namespace="http://oval.mitre.org/XMLSchema/oval-variables-5" schemaLocation="external/oval_5.10/oval-variables-schema.xsd"/>
|
141
|
+
<import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="external/oval_5.10/xmldsig-core-schema.xsd"/>
|
142
|
+
<import namespace="http://stix.mitre.org/Incident-1" schemaLocation="incident.xsd"/>
|
143
|
+
<import namespace="http://stix.mitre.org/Indicator-2" schemaLocation="indicator.xsd"/>
|
144
|
+
<import namespace="http://stix.mitre.org/common-1" schemaLocation="stix_common.xsd"/>
|
145
|
+
<import namespace="http://stix.mitre.org/stix-1" schemaLocation="stix_core.xsd"/>
|
146
|
+
<import namespace="http://stix.mitre.org/default_vocabularies-1" schemaLocation="stix_default_vocabularies.xsd"/>
|
147
|
+
<import namespace="http://stix.mitre.org/ThreatActor-1" schemaLocation="threat_actor.xsd"/>
|
148
|
+
<import namespace="http://stix.mitre.org/TTP-1" schemaLocation="ttp.xsd"/>
|
149
|
+
</schema>
|
@@ -9,18 +9,11 @@ module StixSchemaSpy
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def min_occurs
|
12
|
-
@xml.attributes['minOccurs'].
|
12
|
+
@xml.attributes['minOccurs'] ? @xml.attributes['minOccurs'].value : "1"
|
13
13
|
end
|
14
14
|
|
15
15
|
def max_occurs
|
16
|
-
|
17
|
-
when nil
|
18
|
-
"1"
|
19
|
-
when "unbounded"
|
20
|
-
"n"
|
21
|
-
else
|
22
|
-
value
|
23
|
-
end
|
16
|
+
@xml.attributes['maxOccurs'] ? @xml.attributes['maxOccurs'].value : "1"
|
24
17
|
end
|
25
18
|
end
|
26
19
|
end
|
@@ -13,6 +13,35 @@ module StixSchemaSpy
|
|
13
13
|
@prefix || ""
|
14
14
|
end
|
15
15
|
|
16
|
+
# For compatibility w/ normal types
|
17
|
+
def use(by)
|
18
|
+
return self
|
19
|
+
end
|
20
|
+
|
21
|
+
def usages
|
22
|
+
[]
|
23
|
+
end
|
24
|
+
|
25
|
+
def own_usages
|
26
|
+
[]
|
27
|
+
end
|
28
|
+
|
29
|
+
def use_parent(child)
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
def child_types
|
34
|
+
[]
|
35
|
+
end
|
36
|
+
|
37
|
+
def abstract?
|
38
|
+
false
|
39
|
+
end
|
40
|
+
|
41
|
+
def has_own_fields?
|
42
|
+
false
|
43
|
+
end
|
44
|
+
|
16
45
|
def full_name
|
17
46
|
if prefix && prefix.length > 0
|
18
47
|
"#{prefix}:#{name}"
|
@@ -4,8 +4,8 @@ module StixSchemaSpy
|
|
4
4
|
load!
|
5
5
|
if @elements[name]
|
6
6
|
@elements[name]
|
7
|
-
elsif
|
8
|
-
|
7
|
+
elsif parent_type && all
|
8
|
+
parent_type.find_element(name)
|
9
9
|
else
|
10
10
|
nil
|
11
11
|
end
|
@@ -15,8 +15,8 @@ module StixSchemaSpy
|
|
15
15
|
load!
|
16
16
|
if @attributes[name]
|
17
17
|
@attributes[name]
|
18
|
-
elsif
|
19
|
-
|
18
|
+
elsif parent_type && all
|
19
|
+
parent_type.find_attribute(name)
|
20
20
|
else
|
21
21
|
nil
|
22
22
|
end
|
@@ -24,12 +24,12 @@ module StixSchemaSpy
|
|
24
24
|
|
25
25
|
def elements(all = true)
|
26
26
|
load!
|
27
|
-
(@elements.values + (all &&
|
27
|
+
(@elements.values + (all && parent_type ? parent_type.elements : []))
|
28
28
|
end
|
29
29
|
|
30
30
|
def attributes(all = true)
|
31
31
|
load!
|
32
|
-
(@attributes.values + (all &&
|
32
|
+
(@attributes.values + (all && parent_type ? parent_type.attributes : []))
|
33
33
|
end
|
34
34
|
|
35
35
|
def own_fields
|
@@ -39,7 +39,7 @@ module StixSchemaSpy
|
|
39
39
|
|
40
40
|
def fields
|
41
41
|
load!
|
42
|
-
(
|
42
|
+
(parent_type ? parent_type.fields : []) + own_fields
|
43
43
|
end
|
44
44
|
|
45
45
|
#################################################################################################
|
@@ -51,10 +51,10 @@ module StixSchemaSpy
|
|
51
51
|
if ['complexContent', 'simpleContent', 'sequence', 'group', 'choice', 'extension'].include?(child.name)
|
52
52
|
child.elements.each {|grandchild| process_field(grandchild)}
|
53
53
|
elsif child.name == 'element'
|
54
|
-
element = Element.new(child, self.schema)
|
54
|
+
element = Element.new(child, self.schema, self)
|
55
55
|
@elements[element.name] = element
|
56
56
|
elsif child.name == 'attribute'
|
57
|
-
attribute = Attribute.new(child, self.schema)
|
57
|
+
attribute = Attribute.new(child, self.schema, self)
|
58
58
|
@attributes[attribute.name] = attribute
|
59
59
|
elsif child.name == 'complexType'
|
60
60
|
type = ComplexType.build(child, self.schema)
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
module StixSchemaSpy
|
4
4
|
class Node
|
5
|
-
attr_reader :documentation, :schema
|
5
|
+
attr_reader :documentation, :schema, :containing_type
|
6
6
|
|
7
|
-
def initialize(xml, schema)
|
7
|
+
def initialize(xml, schema, containing_type = nil)
|
8
8
|
@xml = xml
|
9
9
|
@schema = schema
|
10
|
+
@containing_type = containing_type
|
10
11
|
@documentation = @xml.xpath('xs:annotation/xs:documentation', {'xs' => 'http://www.w3.org/2001/XMLSchema'}).to_a.map {|node| node.text}.join("\n")
|
11
12
|
end
|
12
13
|
|
@@ -29,15 +30,15 @@ module StixSchemaSpy
|
|
29
30
|
def type!
|
30
31
|
if reference?
|
31
32
|
if referenced_element
|
32
|
-
referenced_element.type
|
33
|
+
referenced_element.type.use(self)
|
33
34
|
else
|
34
|
-
ExternalType.new(*@xml.attributes['ref'].value.split(':'))
|
35
|
+
ExternalType.new(*@xml.attributes['ref'].value.split(':')).use(self)
|
35
36
|
end
|
36
37
|
elsif named_type = @xml.attributes['type']
|
37
38
|
type = schema.find_type(named_type.value) || Type.find(named_type.value)
|
38
|
-
type
|
39
|
+
type.use(self)
|
39
40
|
else
|
40
|
-
Type.inline(@xml, self.schema, self.name)
|
41
|
+
Type.inline(@xml, self.schema, self.name).use(self)
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
@@ -74,8 +74,8 @@ module StixSchemaSpy
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# Again, just for compatibility with Type
|
77
|
-
def
|
78
|
-
|
77
|
+
def parent_type
|
78
|
+
false
|
79
79
|
end
|
80
80
|
|
81
81
|
# More compatibility with type
|
@@ -157,7 +157,7 @@ module StixSchemaSpy
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def self.namespaces
|
160
|
-
self.all.inject({'xs' => 'http://www.w3.org/2001/XMLSchema'}) {|coll, schema| coll[schema.prefix] = schema.namespace; coll}
|
160
|
+
self.all.inject({'xs' => 'http://www.w3.org/2001/XMLSchema', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance'}) {|coll, schema| coll[schema.prefix] = schema.namespace; coll}
|
161
161
|
end
|
162
162
|
|
163
163
|
def self.schema_dir
|
@@ -165,7 +165,7 @@ module StixSchemaSpy
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def self.version
|
168
|
-
"1.1"
|
168
|
+
"1.1.1"
|
169
169
|
end
|
170
170
|
|
171
171
|
# Don't process non STIX or CybOX schemas
|
@@ -198,6 +198,8 @@ module StixSchemaSpy
|
|
198
198
|
Dir.glob("#{schema_dir}/stix/*.xsd").each {|f| self.build(f)}
|
199
199
|
Dir.glob("#{schema_dir}/stix/extensions/**/*.xsd").each {|f| self.build(f)}
|
200
200
|
@uber_schema = Dir.chdir(schema_dir) {Nokogiri::XML::Schema.new(File.read('uber_schema.xsd'))}
|
201
|
+
Schema.all.each(&:preload!)
|
202
|
+
return true
|
201
203
|
end
|
202
204
|
|
203
205
|
def self.schema_root
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module StixSchemaSpy
|
4
4
|
class Type
|
5
5
|
|
6
|
-
attr_reader :name, :documentation, :
|
6
|
+
attr_reader :name, :documentation, :schema, :inline
|
7
7
|
|
8
8
|
def initialize(xml, schema, inline = false)
|
9
9
|
@inline = !!inline
|
@@ -11,7 +11,7 @@ module StixSchemaSpy
|
|
11
11
|
@xml = xml
|
12
12
|
@name = xml.attributes['name'] ? xml.attributes['name'].value : "#{inline}InlineType"
|
13
13
|
@documentation = xml.xpath('./xs:annotation/xs:documentation', {'xs' => 'http://www.w3.org/2001/XMLSchema'}).to_a.map {|node| node.text}.join("\n")
|
14
|
-
|
14
|
+
|
15
15
|
end
|
16
16
|
|
17
17
|
def full_name
|
@@ -21,9 +21,15 @@ module StixSchemaSpy
|
|
21
21
|
def get_extension(type)
|
22
22
|
if node = type.xpath('xs:complexContent/xs:extension | xs:simpleContent/xs:extension | xs:complexContent/xs:restriction | xs:simpleContent/xs:restriction', {'xs' => 'http://www.w3.org/2001/XMLSchema'}).first
|
23
23
|
base = node.attributes['base'].value
|
24
|
-
schema.find_type(base) || Type.find(base)
|
24
|
+
parent = schema.find_type(base) || Type.find(base)
|
25
|
+
if parent.nil?
|
26
|
+
puts "Unable to find base type #{base} for extended type #{full_name}"
|
27
|
+
return false
|
28
|
+
else
|
29
|
+
return parent.use_parent(self)
|
30
|
+
end
|
25
31
|
else
|
26
|
-
|
32
|
+
false
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
@@ -32,7 +38,8 @@ module StixSchemaSpy
|
|
32
38
|
end
|
33
39
|
|
34
40
|
def parent_type
|
35
|
-
@extension
|
41
|
+
@extension = get_extension(@xml) if @extension.nil?
|
42
|
+
return @extension
|
36
43
|
end
|
37
44
|
|
38
45
|
# URL is just the prefix/type
|
@@ -90,6 +97,38 @@ module StixSchemaSpy
|
|
90
97
|
end
|
91
98
|
end
|
92
99
|
|
100
|
+
def use(by)
|
101
|
+
@usages ||= []
|
102
|
+
@usages.push(by)
|
103
|
+
return self
|
104
|
+
end
|
105
|
+
|
106
|
+
def own_usages
|
107
|
+
@usages || []
|
108
|
+
end
|
109
|
+
|
110
|
+
def usages
|
111
|
+
if parent_type
|
112
|
+
(own_usages + parent_type.usages).flatten.uniq
|
113
|
+
else
|
114
|
+
own_usages.uniq
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def use_parent(child)
|
119
|
+
@child_types ||= []
|
120
|
+
@child_types << child
|
121
|
+
self
|
122
|
+
end
|
123
|
+
|
124
|
+
def child_types
|
125
|
+
(@child_types || []).uniq
|
126
|
+
end
|
127
|
+
|
128
|
+
def has_own_fields?
|
129
|
+
fields.length > 0 && (parent_type.nil? || parent_type.fields.length != fields.length)
|
130
|
+
end
|
131
|
+
|
93
132
|
def prefix
|
94
133
|
@schema.prefix
|
95
134
|
end
|
@@ -3,16 +3,19 @@ require 'nokogiri'
|
|
3
3
|
|
4
4
|
namespace :stix_schema_spy do
|
5
5
|
|
6
|
-
desc "
|
7
|
-
task :generate_schemas, :output_dir do |task, args|
|
8
|
-
|
6
|
+
desc "Convert the STIX source schemas into compiled schemas useful for validation. Mainly used to update the schemas within stix_schema_spy itself."
|
7
|
+
task :generate_schemas, [:input_dir, :output_dir] do |task, args|
|
8
|
+
schema_dir = args[:input_dir]
|
9
|
+
output_dir = File.expand_path(args[:output_dir])
|
10
|
+
stix_dir = output_dir + "/stix"
|
11
|
+
|
12
|
+
raise "Please specify the schemas directory and the output directory" if schema_dir.nil? || output_dir.nil?
|
9
13
|
|
10
14
|
import_chains = Hash.new([])
|
11
15
|
namespace_map = {}
|
12
|
-
schema_dir = File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'schemas')
|
13
16
|
|
14
|
-
# Create the output directory
|
15
|
-
FileUtils.mkdir_p(
|
17
|
+
# Create the output directory
|
18
|
+
FileUtils.mkdir_p(stix_dir)
|
16
19
|
|
17
20
|
# Collect each of the necessary schemas
|
18
21
|
Dir.chdir(schema_dir) do
|
@@ -39,13 +42,11 @@ namespace :stix_schema_spy do
|
|
39
42
|
coll[namespace] = schema_location unless import_chains[namespace].include?(filename) # Set this namespace's parent to the current schema unless any other includes point to it
|
40
43
|
|
41
44
|
# Write the schema out to the target directory
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
48
|
-
end
|
45
|
+
directory = schema_location.split('/')[0..-2].join('/')
|
46
|
+
Dir.chdir(stix_dir) {
|
47
|
+
FileUtils.mkdir_p(directory) if directory.length > 0
|
48
|
+
File.open(schema_location, "w") {|f| f.write(schema)}
|
49
|
+
}
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
@@ -60,7 +61,7 @@ namespace :stix_schema_spy do
|
|
60
61
|
end
|
61
62
|
|
62
63
|
# Write the schema
|
63
|
-
Dir.chdir(output_dir
|
64
|
+
Dir.chdir(output_dir) {
|
64
65
|
File.open("uber_schema.xsd", "w") {|f| f.write(doc.to_xml)}
|
65
66
|
}
|
66
67
|
|