Commit Graph

351 Commits (71ee73c08a629effad6210e0f354dd1e02286c66)

Author SHA1 Message Date
Emmanuelle Vargas-Gonzalez 681be1a5d9 Make CompositeDataStore subclass DataStore. Remove deduplicate() from CompositeDataSource. 2017-08-16 09:58:33 -04:00
Emmanuelle Vargas-Gonzalez a18804a195 Add ordereddict dependency for 2.6 support. Import change in utils.py 2017-08-15 14:12:21 -04:00
Emmanuelle Vargas-Gonzalez 15b5e107d5 Fix imports, sort requirements. 2017-08-15 13:54:16 -04:00
Emmanuelle Vargas-Gonzalez 4ffc8edeeb Update all tests. Re-organize EXPECTED values, update some regex expressions. 2017-08-15 13:41:51 -04:00
Emmanuelle Vargas-Gonzalez 1b48ad9778 Changes to object serialization. 2017-08-15 13:40:47 -04:00
Emmanuelle Vargas-Gonzalez e3f82effc7 Apply OrderedDict changes to bundle, fix import in sdo.py 2017-08-15 08:24:43 -04:00
Emmanuelle Vargas-Gonzalez cb5c4ad080 Merge pull request #42 from oasis-open/bundles Parse bundles correctly 2017-08-14 15:21:58 -04:00
Emmanuelle Vargas-Gonzalez 569ca34d78 Remove test skip for data_sources. 2017-08-14 15:02:26 -04:00
Emmanuelle Vargas-Gonzalez 226a41e0ff Merge pull request #41 from oasis-open/namedtuple-filters Use Namedtuples for Filters. 2017-08-14 15:01:07 -04:00
Emmanuelle Vargas-Gonzalez 00462eb683 Add hashes property to ExternalReference, more documentation for parse_observable 2017-08-14 14:37:49 -04:00
Emmanuelle Vargas-Gonzalez 26297f9730 Fix call to update(), add a register_marking decorator. Add type to Markings. 2017-08-14 11:52:34 -04:00
Emmanuelle Vargas-Gonzalez 68afd6b38e Minor changes. 2017-08-14 10:36:47 -04:00
Emmanuelle Vargas-Gonzalez 81c9eab730 Apply OrderedDict changes to other.py 2017-08-14 10:34:53 -04:00
Emmanuelle Vargas-Gonzalez e2c9ecccaf Apply OrderedDict changes to Observables. 2017-08-14 10:29:17 -04:00
Emmanuelle Vargas-Gonzalez 1329e2e76f Apply OrderedDict changes to Bundle. 2017-08-14 09:24:41 -04:00
Emmanuelle Vargas-Gonzalez add14c2490 Update CustomObject docstring, re-organize object properties. 2017-08-14 09:06:20 -04:00
Emmanuelle Vargas-Gonzalez ccfcffb2f5 Minor change. 2017-08-14 08:31:08 -04:00
Emmanuelle Vargas-Gonzalez dd2a1db5c1 Change SROs to OrderedDict approach. Removed COMMON_PROPERTIES. 2017-08-14 08:27:49 -04:00
clenk ee8013d782 Parse bundles correctly
This required refactoring parts of the library. Code in __init__.py
merged into bundle.py, which was renamed core.py. Code in other.py was
merged into common.py.

Fixes #40.
2017-08-11 16:18:20 -04:00
Emmanuelle Vargas-Gonzalez 8086447fce Change SDOs to OrderedDict approach. Removed COMMON_PROPERTIES. 2017-08-11 15:12:45 -04:00
Emmanuelle Vargas-Gonzalez 228f488f5b Update commons.py to new OrderedDict format, just in case. 2017-08-11 15:11:54 -04:00
Emmanuelle Vargas-Gonzalez 5172f86a7b Change _STIXBase to output properties in spec order. closes #39 2017-08-11 15:10:44 -04:00
Emmanuelle Vargas-Gonzalez 56d8ca4939 Missing instantiation of STIXdatetime in parser. Added __repr__() to STIXdatetime class. 2017-08-11 15:04:58 -04:00
Emmanuelle Vargas-Gonzalez e52575e01a Add missing call to super() in TAXIICollectionStore. 2017-08-11 09:52:29 -04:00
Emmanuelle Vargas-Gonzalez 86fd3778f5 Formatting changes, replace deduplicate() code in DataSource, missing super() calls to initialize objects. 2017-08-11 08:10:20 -04:00
Greg Back 961dfdc984 Convert rest of code to use namedtuple Filters 2017-08-09 19:25:06 +00:00
Greg Back 87f7503c0a Convert filters to be NamedTuples 2017-08-09 18:49:06 +00:00
Emmanuelle Vargas-Gonzalez a4ead4f6e7 Formatting changes, skip add/remove filter test, change deduplicate() approach. 2017-08-09 13:31:07 -04:00
Greg Back b8c96e37a2 Update to get tests passing 2017-07-20 20:30:04 +00:00
Greg Back b82606ba38 Clean up TAXII Datastore to use latest TAXII client 2017-07-20 19:36:54 +00:00
Greg Back f4833c05f6 Remove duplicate code. 2017-07-20 19:34:09 +00:00
Greg Back 55e92bc237 Update with correct class name
Also PEP-8 fixes
2017-07-19 21:30:29 +00:00
Greg Back bf9677094f Merge branch 'master' into datastores 2017-07-19 21:21:08 +00:00
Greg Back f4335f43ad Clean up redundant code. 2017-07-19 21:12:56 +00:00
Greg Back bac87465cb Merge pull request #35 from oasis-open/pattern_expressions
Pattern expressions
2017-07-19 14:17:57 +00:00
Richard Piazza a2aacc5e20 merge all classes into patterns.py 2017-07-19 14:03:43 +00:00
Greg Back 595ba10695 Merge pull request #34 from oasis-open/object-factory
Object factory
2017-07-19 13:54:24 +00:00
mbastian1135 611045528f taxii client and source/sink seperated; memory store common data dict (bug); all *Store classes have their sources and sinks tethered to one backend target 2017-07-18 20:55:22 +00:00
mbastian1135 9f659f9ecb formatting 2017-07-18 20:44:21 +00:00
mbastian1135 9d72d60706 Data* suite reorg, fixing bugs 2017-07-18 20:44:19 +00:00
= 20958b908a more tests for TAXII data source 2017-07-18 20:42:43 +00:00
Richard Piazza 27af0c0d5b Fixed style errors 2017-07-18 20:34:39 +00:00
Richard Piazza 6fa009e509 added object_paths
added more tests for pattern expressions
added "set" comparison expressions
implemented make_constant
fixed type name for EmailAddress
2017-07-18 20:30:02 +00:00
Richard Piazza c1b07ef505 Introduce constant objects for literals in pattern expressions
fixed idioms
2017-07-18 20:26:46 +00:00
Richard Piazza c8bcece6f6 added tests for expressions
fix __str__ methods
2017-07-18 20:26:46 +00:00
Richard Piazza c0467da5f9 added classes for Pattern Expressions 2017-07-18 20:26:44 +00:00
clenk 4bdbb4a2f9 Deep-copy in Object Factory and allow appending multiple items to list
properties in ObjectFactory.create()
2017-07-18 12:05:19 -04:00
clenk 0a2cda00cc Add object factory docstring 2017-07-17 15:23:20 -04:00
clenk 2e45cacd52 Add to list properties like `external_references`, but include option to
replace instead
2017-07-17 14:56:13 -04:00
clenk e233a424fb Drop granular markings from object factory for now 2017-07-14 16:11:48 -04:00
clenk 5c5903179d Fix import sort order 2017-07-14 16:02:29 -04:00
clenk 7ebf5ac7c7 Fix timestamp in test 2017-07-14 15:30:19 -04:00
clenk e1330692c8 Move ObservableProperty, ExtensionsProperty, and Observable parsing code
into observables.py to prevent circular imports and fix #23.
2017-07-14 15:10:12 -04:00
Greg Back c29acfa3ce Alternate implementation of ObjectFactory. 2017-07-13 15:35:22 +00:00
clenk 4dba41afc8 Add created to object factory, clean up code 2017-07-13 09:45:43 -04:00
Emmanuelle Vargas-Gonzalez 6d2cfcdedf [WIP] Update tests. 2017-07-13 07:57:33 -04:00
Emmanuelle Vargas-Gonzalez 747f0307a7 [WIP] Changes to align python-stix2 with marking-prototype project. 2017-07-13 07:57:01 -04:00
Emmanuelle Vargas-Gonzalez 7abcce7635 Add new duplicate marking exception. 2017-07-13 07:55:52 -04:00
clenk 6ddad22810 Add external references to object factory 2017-07-12 16:11:51 -04:00
clenk 593f16662a Add granular markings to object factory 2017-07-12 15:22:50 -04:00
clenk 659ad3df89 Add object markings to object factory 2017-07-12 14:44:52 -04:00
clenk 0c47936ee0 Create ObjectFactory class
currently only supports created_by_ref
2017-07-12 11:36:15 -04:00
clenk 6f680be8a6 Add stix2.__version__ 2017-07-06 09:41:50 -04:00
Greg Back 9bfc240008 Merge pull request #27 from oasis-open/issue26
Allow passing a list to Bundle constructor
2017-07-06 13:36:06 +00:00
clenk 1d3c59cc44 Move TLP constants up to stix2 namespace 2017-07-05 13:27:09 -04:00
clenk 1ea9671b68 Allow passing a list to Bundle constructor
Fix #26
2017-07-05 11:31:56 -04:00
clenk 29d9467ce0 Add more timestamp test cases, address suggestions 2017-06-28 15:55:23 -04:00
clenk e01ce132db Add timestamp precision for `created` and `modified`
Fix #24
2017-06-22 18:47:35 -04:00
clenk fdbb6ff337 Add custom Cyber Observables 2017-06-14 09:36:35 -04:00
clenk d4e92dd813 Allow adding validation to custom object types
_Custom.__init__() is a solution to recursion errors arising from using
a decorator. See https://stackoverflow.com/q/14739809/1013457
2017-06-13 10:27:31 -04:00
clenk bcfb13f23c Add custom STIX Object types 2017-06-12 16:22:16 -04:00
clenk 8f1ae4e6d3 Add custom properties via 'allow_custom'
Custom properties can be specified by passing them to a STIX object
constructor in the 'custom_properties' argument, or with the
'allow_custom' argument set to True, which will add any unrecognized
keyword arguments as properties on the object. The 'allow_custom'
argument can also be used with the parse() and parse_observable()
functions.
An error is now raised when attempting to parse objects without a 'type'
property, such as external references, kill chain phases, and granular
markings. The object which contains them is what should be parsed, not
these objects themselves.
2017-06-12 13:04:20 -04:00
Emmanuelle Vargas-Gonzalez bf740b21eb Initial selector and marking_ref validation. 2017-06-12 08:06:37 -04:00
Emmanuelle Vargas-Gonzalez ee4618f6c8 Add new marking errors. 2017-06-12 08:06:13 -04:00
Emmanuelle Vargas-Gonzalez 1f258551e1 Add and update tests for markings API. 2017-06-09 14:22:56 -04:00
Emmanuelle Vargas-Gonzalez 1b7695c4f6 Initial marking code. 2017-06-09 14:21:42 -04:00
Emmanuelle Vargas-Gonzalez 069c82abf1 Add markings.utils.py 2017-06-09 14:20:16 -04:00
clenk 9036c7f7b8 Add custom properties 2017-06-09 12:30:19 -04:00
Emmanuelle Vargas-Gonzalez c1ce2bd3f1 Add markings package structure. 2017-06-08 10:44:23 -04:00
Emmanuelle Vargas-Gonzalez c1c5c05f47 Some changes to Process and EmailMessage objects. Added tests. 2017-06-08 10:09:18 -04:00
Emmanuelle Vargas-Gonzalez b9f63e8de6 Minor Code Changes. 2017-06-08 08:42:32 -04:00
clenk 860efcc230 Make object attribute access act like dictionary access, raising an
error for any property (including custom or optional) not set on the object.
2017-06-07 11:06:20 -04:00
Emmanuelle Vargas-Gonzalez a38b912d19 Change _check_property_dependency() to also check for values for the required properties. 2017-06-02 13:48:44 -04:00
Emmanuelle Vargas-Gonzalez 653eef4b95 Revert changes to test_file_example_encryption_error() 2017-06-02 13:47:08 -04:00
Emmanuelle Vargas-Gonzalez e11b3adb3f Style change. 2017-06-02 10:22:31 -04:00
Emmanuelle Vargas-Gonzalez 51e28f64da Change __getattr__() to use __getitem__() instead. Other minor changes. 2017-06-02 10:10:50 -04:00
Emmanuelle Vargas-Gonzalez d579c12172 Update ImmutableError test cases. 2017-06-02 07:34:37 -04:00
Emmanuelle Vargas-Gonzalez fceef4d85a Use class name for ImmutableError message. 2017-06-02 07:33:31 -04:00
Emmanuelle Vargas-Gonzalez 0cf0f97143 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 2017-06-02 07:15:01 -04:00
clenk f321447ecc Make Travis happy with cosmetic fixes 2017-06-01 16:47:56 -04:00
Emmanuelle Vargas-Gonzalez e1e7bade3f Updated this test since setting the value to False should not be a reason to fail the test. 2017-06-01 15:25:46 -04:00
Emmanuelle Vargas-Gonzalez 4d58fc3dbb Explicitly check for None, when intention is to set empty values or False. fixes #17 2017-06-01 15:25:03 -04:00
Emmanuelle Vargas-Gonzalez 5dc049d65a getattr() checks for attribute membership, returns the value if not None and raises AttributeError when is not present. fixes #19 2017-06-01 15:23:44 -04:00
Emmanuelle Vargas-Gonzalez ad46474663 Update immutable tests. 2017-06-01 12:43:42 -04:00
Emmanuelle Vargas-Gonzalez 49f58ff513 Make Immutable error more descriptive. Also fixes #13 2017-06-01 12:43:06 -04:00
Greg Back ea1e408b50 More style fixes 2017-05-31 10:02:37 -05:00
Greg Back 53ddf32e8c Style/lint fixes 2017-05-31 08:58:14 -05:00
= 6c3a689f02 fixed indentation 2017-05-31 09:47:36 -04:00
= 03f9af4b96 Merge branch 'taxii-data-source' of https://github.com/mitre/cti-python-stix2 into taxii-data-source 2017-05-31 09:41:32 -04:00
= d207ada05e in order to pull 2017-05-31 09:41:19 -04:00
= c65055bb0e tests for TAXII data source; some bug fixes 2017-05-30 16:56:27 -04:00
Emmanuelle Vargas-Gonzalez 835d675162 Merge fork changes. 2017-05-26 15:30:30 -04:00
Emmanuelle Vargas-Gonzalez 2a8af45ec2 Code style changes. 2017-05-26 15:24:33 -04:00
Greg Back fc1ce6d56d Add some tests 2017-05-25 12:31:45 -05:00
Michael Kouremetis 97d8d732fc Initial code for TAXII data source. 2017-05-24 10:27:37 -05:00
clenk b4dfa07a20 Improve coverage of utils.py
Also fix bugs this discovers. Fix #15.
2017-05-22 11:15:55 -04:00
Greg Back 41f2ceb8e5 Change remaining 'fields' to 'properties' 2017-05-19 12:51:59 -05:00
Greg Back a913d9d5ad Merge pull request #14 from oasis-open/parse-cyber-observables
Parse cyber observables
2017-05-19 09:15:00 -05:00
clenk 9bc3242736 Refactor extension properties
to inherit from a base class so all extension classes will include the
check for at least one property
2017-05-18 14:04:28 -04:00
clenk 0d736509e2 Fix tests 2017-05-18 11:24:43 -04:00
clenk 931de31a10 Merge branch 'parse-cyber-observables' of https://github.com/oasis-open/cti-python-stix2 into parse-cyber-observables 2017-05-18 11:08:12 -04:00
Chris Lenk b6e22bcbdf Merge pull request #12 from rpiazza/cyber-observables
Cyber observables
2017-05-18 11:02:10 -04:00
Richard Piazza f8242cffe4 correct misspelling on _check_object_constraints 2017-05-18 09:48:01 -04:00
Richard Piazza 8827149ef0 avoid {} set notation. It doesn't seem to be in 2.6 2017-05-17 15:51:07 -04:00
Richard Piazza f56ea8e951 added tests for process and file extensions
if no properties are passed to _check_at_least_one_property assume its all properties
when extensions are involved always check them in _check_at_least_one_property (caused by raising the exception on the enclosing type)
added _check_object_constaints to extensions, where appropriate
2017-05-17 15:33:28 -04:00
clenk 3e0e80141b For object reference properties, check the type of the object
referenced, not only that it is included in the local scope.
2017-05-17 15:21:02 -04:00
Richard Piazza 7c71b9e577 added tests for File and Process extensions
fixed typo in WindowsPEOptionalHeaderType
2017-05-16 12:39:04 -04:00
clenk 9761c37f20 Replace 'field' with 'property' to be consistent
with the specification
2017-05-16 12:27:30 -04:00
clenk a520a67511 Add tests for the Network Traffic extension and
User Account extensions
2017-05-16 11:35:43 -04:00
clenk 2460fb75be Rework select properties to use get_dict(),
which automatically coerces values to a dictionary if possible
2017-05-16 09:25:08 -04:00
Richard Piazza 826b6af644 added missing required properties 2017-05-15 15:21:59 -04:00
Richard Piazza 6456e490cc added rest of cyber observables extensions and embedded objects
set up EXT_MAPs
added FloatProperty
implemented ExtensionsProperty
2017-05-15 13:48:41 -04:00
clenk 958e60b01d Add 'labels' property to COMMON_PROPERTIES 2017-05-15 10:57:40 -04:00
Richard Piazza c20f640910 Merge branch 'cyber-observables' of https://github.com/rpiazza/cti-python-stix2 into cyber-observables 2017-05-12 13:18:40 -04:00
Richard Piazza a95e91005c too Chris' suggestions to improve interproperty constraint methods
added interproperty constraint check to ExternalReferences
2017-05-12 13:18:02 -04:00
clenk 9273207576 Merge branch 'parse-cyber-observables' of https://github.com/oasis-open/cti-python-stix2 into parse-cyber-observables 2017-05-12 12:19:54 -04:00
clenk 0568a0e671 Add ExtensionsProperty and ArchiveExt 2017-05-12 11:22:23 -04:00
Richard Piazza 29871427b7 fix import error 2017-05-11 15:42:56 -04:00
Richard Piazza 191b14a4bb fix import error 2017-05-11 15:33:45 -04:00
Rich Piazza ae5fb51564 Merge branch 'parse-cyber-observables' into cyber-observables 2017-05-11 15:29:15 -04:00
Richard Piazza 94f4f48329 Changes so File object creation doesn't violate on of the MUSTs
Added three new exceptions: DependentPropertiestError, AtLeastOnePropertyError, MutuallyExclusivePropertiesError
Added tests for NetworkTraffic, Process, URL, WindowsRegistryKey and X509Certificate
Added error tests for EmailMessage, NetworkTraffic, Artifact,
Added interproperty checker methods to the base class:  _check_mutually_exclusive_properties, _check_at_least_one_property and _check_properties_dependency
Added interproperty checkers to Artifact, EmailMIMEComponent, EmailMessage, NetworkTraffic
Made NetworkTraffic.protocols required
Added X509V3ExtenstionsType class
Use EmbeddedObjectProperty for X509Certificate.x509_v3_extensions
2017-05-11 15:22:46 -04:00
clenk 13245d28ce Add EnumProperty, use it in WindowsRegistryValueType 2017-05-10 11:52:59 -04:00
clenk b18259af77 Merge branch 'parse-cyber-observables' of https://github.com/oasis-open/cti-python-stix2 into parse-cyber-observables 2017-05-10 09:20:09 -04:00
clenk 67935d08fe Fix isort settings, rename Observable to clarify
it's an internal class
2017-05-09 18:03:46 -04:00
Richard Piazza 643941a950 Merge branch 'cyber-observables' of https://github.com/rpiazza/cti-python-stix2 into cyber-observables 2017-05-09 15:52:23 -04:00
Richard Piazza 4493ac9cae style issue 2017-05-09 15:51:52 -04:00
Rich Piazza 7c1fd1e7f0 Merge branch 'parse-cyber-observables' into cyber-observables 2017-05-09 15:36:59 -04:00
Richard Piazza 075b8485e5 fix conflict 2017-05-09 15:35:44 -04:00
Richard Piazza c3477b83bf encryption_algorithm was misspelled
uncomment test_file_example_encryption_error
added _check_object_constrains and properties_populated to base class
added ObjectConstraintError
added _check_object_constrains for File
2017-05-09 15:28:32 -04:00
clenk bdd18be6c3 Switch to isort for checking import order
because it has a pre-commit hook
2017-05-09 15:10:53 -04:00
clenk f4c813d84b Merge branch 'parse-cyber-observables' 2017-05-09 12:39:17 -04:00
clenk 555c81d30f Add EmailMessage and EmbeddedObjectProperty (for embedded object types
like EmailMIMEComponent)
2017-05-09 11:03:19 -04:00
Richard Piazza 549372048c style issues 2017-05-08 21:14:32 -04:00
Richard Piazza 125f57e297 added basic cyber observables
added some test cases
in Observable constructor permit no _valid_refs in kwargs
in Observable._check_property ensure that the prop_name is in the kwargs
2017-05-08 21:03:15 -04:00
clenk d26662776c Merge branch 'master' into parse-cyber-observables 2017-05-08 11:14:54 -04:00
clenk 04e3a72a7d Add EmailAddress and ObjectReferenceProperty 2017-05-05 12:32:02 -04:00
Richard Piazza 1e7e87ef44 style errors 3 2017-05-05 10:53:28 -04:00
Richard Piazza ddecd52904 style errors 2 2017-05-04 19:30:09 -04:00
Richard Piazza c9320ad895 style errors 2017-05-04 16:41:37 -04:00
Richard Piazza 200bb8556f added unsetting capability
cleaned up MissingFieldsError tests
error when new modified property is earlier than current modified property
2017-05-04 16:34:08 -04:00