Commit Graph

1228 Commits (631460f45f83a7b50b7db221c60edaa9c0cc89d5)

Author SHA1 Message Date
Chris Lenk 92f7e706bf Improve error handling in relationships/related_to 2017-11-21 10:29:57 -05:00
Greg Back f481788e1e
Merge pull request #112 from samcornwell/get_type_from_id
Add get_type_from_id utility function
2017-11-20 15:19:24 +00:00
Sam Cornwell eff51a2bb8 fixed pycodestyle failure 2017-11-19 23:00:42 -05:00
Sam Cornwell 78612530ff added tests for get_type_from_id 2017-11-19 22:27:31 -05:00
Sam Cornwell 8930e72cc3 added get_type_from_id function to utils 2017-11-19 22:11:44 -05:00
Chris Lenk 7e0f911972 Add relationship_type note to docstrings 2017-11-17 17:30:24 -05:00
= ec42182cb1 issue #107 , also MemorySource.load_from_file() parses JSON into python-stix2 objects now 2017-11-17 12:19:06 -05:00
Emmanuelle Vargas-Gonzalez c03ecb5230 Update test modules 2017-11-17 08:50:40 -05:00
= da4e843993 issue #104 with TAXIICollectionSource tweak 2017-11-16 17:47:27 -05:00
Chris Lenk 515ff1e53f Clean up test 2017-11-16 16:50:27 -05:00
Chris Lenk cfa18bfd0d Improve Environment tests 2017-11-16 16:43:27 -05:00
Chris Lenk f0331f8b9b Reorganize DataStore code for dereferencing
- Move `relationships()` to DataStore like `related_to()` is. If a
  DataStore implementation needs a different way to handle relationship
  dereferencing (e.g. TAXII in the future, or CompositeDataSource), it
  can overwrite these functions.
- Reduce code duplication.
- Check for presence of Data Source/Sink in all DataStores, not just in
  Environment.
2017-11-16 16:25:57 -05:00
Chris Lenk 29dec997a0 Add related_to()
Function for calling relationships() but instead of just returning the
Relationship objects, returns the STIX objects being refered to in those
Relationships.
2017-11-16 14:58:59 -05:00
Chris Lenk 86f28644f9 Fix Python2 bug when filter value is unicode 2017-11-15 16:56:55 -05:00
Chris Lenk 1b816c3d84 Test relationships() functions 2017-11-15 16:34:07 -05:00
Emmanuelle Vargas-Gonzalez e6a8b555d3 Add test for CustomMarking. closes #109 2017-11-15 13:12:00 -05:00
Emmanuelle Vargas-Gonzalez fbce8f15fe Allow no custom __init__() on CustomMarking 2017-11-15 12:55:34 -05:00
Chris Lenk 55cf00d7f0 Move relationships() to DataSources 2017-11-15 10:37:17 -05:00
Chris Lenk ef3ce9f6f0 Bump version: 0.3.0 → 0.4.0 2017-11-13 16:40:58 -05:00
Chris Lenk 2dc8a97a51 Fix documentation links for v20 2017-11-13 14:14:24 -05:00
Chris Lenk f9ad7ceb65 Add relationships() function to Environment 2017-11-13 11:09:56 -05:00
Chris Lenk 7495ea6588 Add inter-documentation links
So when users read the guide docs, they can click a link to go to a
relevant section in the API reference.
2017-11-09 15:42:59 -05:00
Chris Lenk c38483b631 Improve markings docstrings
Including a note that the markings functions can be used as methods on
SDO/SRO/MarkingDefinition objects.
2017-11-09 10:19:57 -05:00
Emmanuelle Vargas-Gonzalez 258ea4b82c Some cleanup in MemoryStore 2017-11-08 14:01:56 -05:00
Emmanuelle Vargas-Gonzalez da66f10147 Make DataStore a regular class, remove unwanted overrides, update tests. Remove CustomProperty since it is no longer needed 2017-11-08 13:53:21 -05:00
Emmanuelle Vargas-Gonzalez 489e45ad1b Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into issue-98 2017-11-08 10:31:49 -05:00
Greg Back 5aa8c66bfc
Merge pull request #97 from oasis-open/memory-tests
Test MemoryStore saving/loading to/from file
2017-11-08 14:59:27 +00:00
Emmanuelle Vargas-Gonzalez 19818c8573 Remove stray print() 2017-11-06 14:21:29 -05:00
Emmanuelle Vargas-Gonzalez 0d5859b906 Test other CompositeDataSource operations 2017-11-03 15:13:00 -04:00
Emmanuelle Vargas-Gonzalez 79475586d8 Revert object_properties() to #85 fix. Update tests accordingly 2017-11-03 14:17:36 -04:00
Emmanuelle Vargas-Gonzalez d31b110330 Update TAXII datastores 2017-11-03 08:58:47 -04:00
Emmanuelle Vargas-Gonzalez d6c14139f3 Extend object serialization options for _STIXBase 2017-11-03 08:02:32 -04:00
Emmanuelle Vargas-Gonzalez 8c2af813b2 Define CustomProperty. Make sure to update _properties dict when allow_custom=True 2017-11-02 21:56:18 -04:00
Emmanuelle Vargas-Gonzalez cd6c7982af Update tests related to Datastores 2017-11-02 21:31:56 -04:00
Emmanuelle Vargas-Gonzalez 1e591a827d ABC for DataSink, DataStore and DataSource. Fixes across the concrete objects 2017-11-02 21:29:25 -04:00
Emmanuelle Vargas-Gonzalez f6f7d0aed8 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 2017-11-02 07:48:37 -04:00
Emmanuelle Vargas-Gonzalez bdb91c6ac4 Update STIX 2.1 structure 2017-11-02 07:21:24 -04:00
Greg Back 37e9049536
Merge pull request #93 from emmanvg/issue-91
Update stix2 Package Structure
2017-11-01 20:09:15 +00:00
Greg Back f029a01f9a
Merge pull request #95 from oasis-open/filters
Change filters to allow filtering all properties
2017-11-01 20:04:48 +00:00
Emmanuelle Vargas-Gonzalez b2ff16994f Document new util method 2017-11-01 14:21:26 -04:00
Emmanuelle Vargas-Gonzalez a17d770d34 Merge master 2017-11-01 14:17:41 -04:00
Chris Lenk 7dd222b202 Test MemoryStore saving/loading to/from file
Python 3 dict.values() returns a view, not a list. See
https://stackoverflow.com/a/17431716/

Fix #65.
2017-11-01 12:51:04 -04:00
Emmanuelle Vargas-Gonzalez 84fa86a2fd Fix import statement 2017-11-01 11:03:02 -04:00
Emmanuelle Vargas-Gonzalez 06a50b0178 Update README, add DEFAULT_VERSION 2017-11-01 10:48:28 -04:00
Chris Lenk c2d1e9777b Clean up filters
- Simplify an if statement since split() with no matches returns single
  item list
- Rename _all_filter -> _check_property and make it a method on Filter
- Raise an error instead of returning -1
- s/field/property
2017-11-01 10:40:10 -04:00
Chris Lenk d93bf44c00
Merge branch 'master' into 76-filesystem-bundles 2017-10-31 14:10:29 -04:00
Chris Lenk 482135465b
Merge pull request #92 from oasis-open/issue66
Fix #66 - checking STIX obj ID from TAXII server
2017-10-31 14:06:34 -04:00
= d8e4f1ab98 addessing requested changes 2017-10-31 13:48:31 -04:00
Chris Lenk 924c72e98a Change filters to allow filtering all properties
(Not just common properties)
2017-10-30 17:25:32 -04:00
Emmanuelle Vargas-Gonzalez a514c5a3df Add test for _register_type() 2017-10-29 00:09:13 -04:00
Chris Lenk 612f2fbab8 Increase code coverage for filesystem datastore
Found a couple bugs in the process and fixed them, too.
2017-10-27 15:50:43 -04:00
Emmanuelle Vargas-Gonzalez 42317ddf31 Update filesystem.py to allow_custom and version 2017-10-27 12:38:03 -04:00
Chris Lenk f103084439 Add `bundlify` parameter to FileSystemStore/Sink
This brings back the option (disabled by default) to wrap objects in a bundle
when saving them to the filesystem.
2017-10-27 12:23:57 -04:00
Chris Lenk 4e3752912d Remove stray `print` statement 2017-10-26 15:35:19 -04:00
Emmanuelle Vargas-Gonzalez 9aefa61153 Small fix for Python 3.3, 3.4 2017-10-26 12:39:27 -04:00
Emmanuelle Vargas-Gonzalez 8c56adda21 Update package structure 2017-10-26 11:39:45 -04:00
= 082973f780 whitespace - somehow pre-commit got turned off?? 2017-10-25 15:18:32 -04:00
= 7092990565 tested code with jupyter notebook and local TAXII server 2017-10-25 14:36:20 -04:00
Chris Lenk 5dffe74867 Clean up creator_of
(renamed from created_by)
2017-10-24 14:20:42 -04:00
Emmanuelle Vargas-Gonzalez d4db4f0ab8 Define source code encoding 2017-10-24 12:53:53 -04:00
Chris Lenk 47b11453fa Increase test coverage for memory datastore 2017-10-24 12:43:30 -04:00
Chris Lenk 5c28074364 Add `allow_custom` to datastore docstrings 2017-10-24 09:15:09 -04:00
Emmanuelle Vargas-Gonzalez 7b6236674c Add new tests. 2017-10-23 08:06:29 -04:00
Emmanuelle Vargas-Gonzalez ef98c38937 Minor changes 2017-10-23 08:04:18 -04:00
Chris Lenk e1e368c0d2 Add created_by() function to Environment 2017-10-20 09:13:04 -04:00
Chris Lenk 476cd1ed5b Add option for custom content to TAXII datastore 2017-10-18 18:34:08 -04:00
Chris Lenk c6d5eee083 Separate out Memory datatstore tests
Makes sure custom content can be added to a MemoryStore.
2017-10-18 18:31:46 -04:00
Chris Lenk e1d8c2872e Don't Bundlify data in FileSystemStore
Don't wrap objects in a Bundle when adding them to a FileSystemStore,
but still support getting objects from FileSystemStore that were saved
in a bundle.

Also:
- Add option to allow custom content in FileSystemStore
- Simplify an if statement
- Improve FileSystem docstrings
- Remove an unnecessary parse() call in FileSystemSource.get()
2017-10-18 15:46:45 -04:00
Emmanuelle Vargas-Gonzalez be3e841ecb New object test files 2017-10-18 13:58:24 -04:00
Chris Lenk 84094e9f79 Separate out filesystem tests 2017-10-18 08:27:12 -04:00
Emmanuelle Vargas-Gonzalez 6deaddc04e Make sure custom properties are returned by object. closes #85 2017-10-12 14:08:32 -04:00
Chris Lenk 134267bfd6 Add FileSystem test fixture, test adding bundle 2017-10-12 11:20:20 -04:00
Greg Back 374539a6cc Don't try to re-parse STIX Objects when adding to Bundle. 2017-10-12 14:38:25 +00:00
Emmanuelle Vargas-Gonzalez cccd42d984 Make AS 'number' required, add missing props to SocketExt. closes #77 2017-10-11 15:10:06 -04:00
Emmanuelle Vargas-Gonzalez f6e21d2199 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into stix2.1 2017-10-11 13:31:46 -04:00
Emmanuelle Vargas-Gonzalez c4c2fb950e Implement LanguageContent object. Update GranularMarking and other missing properties 2017-10-11 13:30:26 -04:00
Emmanuelle Vargas-Gonzalez b99d9e4132 Update confidence docstrings 2017-10-11 13:16:59 -04:00
Chris Lenk 2b6023e7bb Allow objects with custom properties in bundles 2017-10-09 17:33:12 -04:00
Emmanuelle Vargas-Gonzalez 2ec8205f1e Implement confidence conversion scales 2017-10-09 07:22:19 -04:00
Emmanuelle Vargas-Gonzalez 50f3d60259 Update branch 2017-10-06 20:34:08 -04:00
Chris Lenk 51361216e9 Bump version: 0.2.0 → 0.3.0 2017-10-06 15:40:34 -04:00
Chris Lenk 2f58d7888b Merge branch 'master' of https://github.com/oasis-open/cti-python-stix2 2017-10-06 15:09:35 -04:00
Emmanuelle Vargas-Gonzalez 5577686ee8 Add new STIX2.1 SDOs and additional properties 2017-10-06 15:09:14 -04:00
Chris Lenk e57c36f525 Check custom extension properties is not empty 2017-10-06 15:05:39 -04:00
Chris Lenk d0f3fb0b47 Merge pull request #62 from oasis-open/documentation
Documentation: Fixes #53.
2017-10-06 14:33:14 -04:00
Emmanuelle Vargas-Gonzalez 2b65f7205b Mutex 'name' is required. Bunch of formatting, update test 2017-10-06 14:24:46 -04:00
Chris Lenk 66e57ced25 Fix merge conflicts 2017-10-06 14:19:09 -04:00
Chris Lenk 23e3b3cc20 Fix FileSystemSource.all_versions bug
If `get()` returned a single STIX object, `all_versions()` would return a
list of the properties/values of that object.
2017-10-06 14:02:25 -04:00
Chris Lenk 1821cdb197 Merge pull request #71 from oasis-open/more_ds_tests
FileSystem tests
2017-10-06 13:31:50 -04:00
Chris Lenk 63e9d6af70 Merge pull request #69 from emmanvg/master
Update required properties in SDOs
2017-10-06 13:30:14 -04:00
Chris Lenk 79902f361e Merge pull request #61 from oasis-open/list_comp
frivolous list comprehensions converted to list()
2017-10-06 13:29:22 -04:00
= a36922990f removing list comps 2017-10-06 11:20:18 -04:00
= 205013000d removing debug line 2017-10-06 11:00:39 -04:00
= a26e9b589f FileSystem tests, and test directory of sample stix2 data 2017-10-06 10:56:24 -04:00
Emmanuelle Vargas-Gonzalez 24bc282d7e Update required properties, indicator label and tests. closes #68 2017-10-06 10:29:30 -04:00
Chris Lenk 9ea4344ca7 Make MarkingsMixin private
Partially so it doesn't clog up the markings API documentation.
2017-10-05 20:50:54 -04:00
Chris Lenk 8b702c6985 Minor API docs improvements
- Hide "Bases" below class signatures
- Leave some empty space after tables
2017-10-05 20:44:58 -04:00
Greg Back 1414035e8d Isolate TimestampConstant in test. 2017-10-05 21:54:58 +00:00
Greg Back f3431c97da nested summaries for sources 2017-10-05 18:45:31 +00:00
Richard Piazza 0dc3226048 added test for Timestamp_Constant 2017-10-05 13:43:56 -04:00
= ec34aa952f Merge branch 'documentation' of https://github.com/oasis-open/cti-python-stix2 into documentation 2017-10-04 15:59:04 -04:00
= f7c17d0c07 some progress on CompositeDS guide, but includes some bug fixes in the DataSource API 2017-10-04 15:57:38 -04:00
Chris Lenk 233ee7924e Merge branch 'master' into documentation 2017-10-04 10:38:40 -04:00
Richard Piazza ebd28aca9d Merge branch 'master' of https://github.com/oasis-open/cti-python-stix2 2017-10-04 10:27:18 -04:00
Richard Piazza 3891595250 Use t prefix for timestamp constant 2017-10-04 10:27:06 -04:00
= 5789fbce20 filesystem list comps 2017-10-04 09:47:18 -04:00
= 616ec6bbeb frivalous list comprehensions converted to list() 2017-10-03 16:20:03 -04:00
Chris Lenk 3ca8cf820e Add STIXDomainObject and STIXRelationshipObject 2017-10-03 15:01:55 -04:00
Chris Lenk 2bdf83401a Add a shortcut for marking functions
So marking functions like `add_markings()` can be directly called as methods on
SDO/SRO classes. Note that they return new versions of the objects
because objects are immutable.
2017-10-03 10:28:58 -04:00
= 3b9e52ce19 parsing taxii filters not needed when retrieving by id 2017-10-02 16:43:08 -04:00
Chris Lenk 58db629de8 Add markings functions to top level namespace 2017-10-02 16:09:38 -04:00
Chris Lenk 035f1a6c73 Support MarkingDefinition objs, not just ID strs
(when passed into `add_markings()` or `remove_markings()`)
2017-10-02 12:28:47 -04:00
= fea2499ae2 forgot to pull doc branch down first, after having merged master into doc branch locally (to get access to DataStore/Filter code 2017-09-29 16:03:48 -04:00
= 4af665bf81 merge conflicts 2017-09-29 15:47:39 -04:00
Greg Back 9e21a69c7f Merge branch 'master' into documentation 2017-09-29 19:14:11 +00:00
Greg Back b31b4f29f8 Handle inconsistent error messages between Python 2 and Python 3. 2017-09-29 18:45:15 +00:00
= ffa2242878 code changes brought about by discussion of pull request of 'bug_fixes' branch 2017-09-29 11:24:19 -04:00
Chris Lenk ac97eb8bdc Add Environment documentation (Jupyter)
Has errors, needs #57.
2017-09-25 16:39:58 -04:00
Chris Lenk b6d1bb26de Improve utils docs, rename subpackage docs folders 2017-09-22 14:54:21 -04:00
= 55943847fa updated corresponding tests that would have broke 2017-09-22 11:49:54 -04:00
= 94df10bf8d docstrings redone; code changes for adding/returning STIX objects to FileSystem, Memory, TAXII; code changes for query sets and filters 2017-09-22 11:29:17 -04:00
Chris Lenk eac1ce94de Improve docstrings for Sphinx output
Also remove package and module names from classes and functions.

Also remove stix2.base from docs. We hide all private classes and
functions from the docs, so the only thing the documentation for base
included was STIXJSONEncoder.
2017-09-22 11:24:55 -04:00
Chris Lenk c0fd740e0a Improve autodoc output
- Add markings and sources
- Tidy up some docstrings
2017-09-22 10:01:00 -04:00
Chris Lenk d7efd1f752 Set up Sphinx autodoc
This will automatically generate API documentation from docstrings.
2017-09-21 17:27:13 -04:00
Chris Lenk 21d978acc8 Fix errors when instantiating custom classes
Defining a custom object/observable/extension class with no custom
__init__() function would result in an `AttributeError` or `TypeError`,
depending on if the class sub-classed `object` or not.
2017-09-21 09:11:01 -04:00
Greg Back 463d1e6b28 Merge pull request #52 from oasis-open/environment
Environment layer
2017-09-12 13:59:08 +00:00
Greg Back f00dcb682a Fix imports 2017-09-11 13:00:40 +00:00
Greg Back 774acb23ea Remove extra newline 2017-09-11 11:56:23 +00:00
Chris Lenk 190b639126 Fix memory datastore to pass tests
1) 'stix_data' is now optional; you can set up a MemorySink without
needing a starting set of data.
2) Removed stix2-validator calls. The validator fails when called on our
_STIXBase-derived classes because we store timestamps as datetime
objects, while the validator expects strings. Also, this was the only
datastore that used the validator, and we should be consistent across
all of them. The validator can be added back in later.
2017-09-08 12:49:08 -04:00
Chris Lenk be07c32500 Add parse() to Environment layer
The Environment layer does not keep its own mapping of custom object types.
If we think it likely that users will want to maintain separate lists of
custom object types between two or more Environments, we can add this
later.
2017-09-08 12:40:01 -04:00
Chris Lenk f60331fb77 Improve docstrings for Environment layer 2017-09-08 11:15:10 -04:00
Chris Lenk 4dfb5d2365 Test Environment layer 2017-09-08 09:01:12 -04:00
Richard Piazza ceb88f176e added TimestampConstant 2017-09-07 10:35:31 -04:00
Richard Piazza 95cac595da merge in latest 2017-09-07 10:18:02 -04:00
Chris Lenk 598f38921f Start Environment layer 2017-09-06 16:20:16 -04:00
Greg Back adac43708b Merge pull request #46 from oasis-open/markings
Marking Support
2017-09-05 19:08:45 +00:00
Chris Lenk 42962e6675 Improve markings tests
- Test markings functions with both dictionaries and our _STIXBase-derived
  classes as input.
- Slightly improve test coverage.
- Drop Python 2.6 support.
2017-09-01 16:41:16 -04:00
Chris Lenk cc66e1a492 Make markings function signatures consistent
Put `marking` before `selectors`. The granular marking version of
`is_marked` requires selectors to not be None.
2017-09-01 10:50:01 -04:00
Emmanuelle Vargas-Gonzalez 6f36ea8488 Merge remote-tracking branch 'oasis/master' into datastores 2017-09-01 10:13:57 -04:00
Emmanuelle Vargas-Gonzalez 13f2810b25 Remove name positional argument, clean memory.py redundant codeother minor changes. Increase coverage. 2017-09-01 08:15:50 -04:00
Greg Back 124da846c3 Merge branch 'master' into markings 2017-08-31 20:36:59 +00:00
Greg Back b1054e780a Merge remote-tracking branch 'origin/master' into datastores 2017-08-31 19:52:48 +00:00
Greg Back ba846f9501 Clean up some tests. 2017-08-31 18:23:08 +00:00
Greg Back 7b46283a5c Build filter function map 2017-08-31 18:21:29 +00:00
Greg Back 71d42b0e51 Merge remote-tracking branch 'origin/datastores' into filter 2017-08-31 17:18:20 +00:00
Chris Lenk 9d45a3dca2 Keep MALWARE_KWARGS to a minimal set
...but use an additional set with a description for marking tests.
2017-08-31 12:51:13 -04:00
Chris Lenk 15287959a4 Modify versioning API to work on dictionaries
This includes new_version() and revoke().
2017-08-31 12:28:07 -04:00
clenk 8a33cb7716 Touch up ObjectReferenceProperty checks
- reword "_refs" error
- check with isinstance instead of __class__.__name__
2017-08-30 16:15:05 -04:00
clenk 0e658255a8 Move check to when custom observable is defined
Catch properties named "_ref" or "_refs" that aren't
ObjectReferenceProperty when the custom observable is defined, not when
it is instantiated.
2017-08-30 15:33:28 -04:00
= 22c749d0df filter changes 2017-08-30 11:18:11 -04:00
Emmanuelle Vargas-Gonzalez 8ca2c3390b Minor changes to DataSource.apply_common_filters(). Improve overall code coverage. 2017-08-29 15:15:32 -04:00
Emmanuelle Vargas-Gonzalez b1ac24d46e Minor changes. 2017-08-29 15:08:26 -04:00
Emmanuelle Vargas-Gonzalez 415c53066f Code coverage changes, fix some tests. Add stix2-validator dependency. 2017-08-28 15:19:55 -04:00
Emmanuelle Vargas-Gonzalez aea076103c Update tests to improve coverage. 2017-08-28 14:33:12 -04:00
Emmanuelle Vargas-Gonzalez 160d69b03d Changes to datastores. 2017-08-28 14:32:51 -04:00
Emmanuelle Vargas-Gonzalez 07bbe23a98 Add some tests for custom objects. 2017-08-28 14:32:05 -04:00
Emmanuelle Vargas-Gonzalez 23f36a9a69 Minor changes to custom object decorators. Add new marking decorator. 2017-08-28 14:30:53 -04:00
clenk 095c5066d5 Touch up markings tests
Increase code coverage and s/tlo/sdo/
2017-08-25 15:56:39 -04:00
clenk 0cd75e3fba Increase code coverage 2017-08-24 17:53:43 -04:00
clenk 6fa3c84aa3 Improve tests and coverage for custom content
In ObservableProperty.clean(), parse_observable() will handle the issue
of non-cyber observable objects being presnt in an observable property.
The line raising a ValueError would not be reached so it was removed.
2017-08-24 15:46:36 -04:00
Emmanuelle Vargas-Gonzalez 3822e39243 Remove COMMON_PROPERTIES. 2017-08-24 15:10:09 -04:00
Emmanuelle Vargas-Gonzalez 1dfaaf15ef Minor change. closes #29 2017-08-24 12:54:50 -04:00
Emmanuelle Vargas-Gonzalez dd17e88ae0 Code refactor/clean-up, changed some exceptions. Update docstrings. 2017-08-24 12:47:14 -04:00
clenk ee49e78c72 Add custom extensions to cyber observables
Fix #31.
2017-08-23 18:36:24 -04:00
Emmanuelle Vargas-Gonzalez 8d4c1d55b5 Minor style changes. 2017-08-23 13:12:40 -04:00
Emmanuelle Vargas-Gonzalez f33427328b Update tests for object and granular markings. 2017-08-23 13:07:22 -04:00
Emmanuelle Vargas-Gonzalez 15bff530be Refactor granular_markings.py code and remove unnecessary code in utils.py 2017-08-23 13:06:51 -04:00
Emmanuelle Vargas-Gonzalez f437a4df5b Merge branch 'datastores' of github.com:oasis-open/cti-python-stix2 into datastores 2017-08-22 10:47:23 -04:00
Emmanuelle Vargas-Gonzalez d060abbed5 Updated regex expressions. Thanks to @drothenberg for that contribution! 2017-08-22 10:47:13 -04:00
Greg Back 69eb09c32b Merge remote-tracking branch 'origin/master' into datastores 2017-08-21 22:40:07 +00:00
Greg Back 4cd99f04ea Use version of taxii2-client from PyPI. 2017-08-21 22:16:23 +00:00
clenk 8687521111 Change object markings for immutable SDOs 2017-08-21 13:57:01 -04:00
clenk d4edb8b0bc Validate patterns when creating Indicators 2017-08-18 14:22:57 -04:00
clenk c0d02fbfcd [WIP] Touch up marking code 2017-08-18 12:36:34 -04:00
Emmanuelle Vargas-Gonzalez c64b7de761 Change query dict style for Filter namedtuple. 2017-08-18 12:05:12 -04:00
Richard Piazza fb75de47c5 added TimestampConstant 2017-08-17 14:50:42 -04:00
clenk 14b922ba92 Merge remote-tracking branch 'emmanvg/marking-support' into markings 2017-08-17 12:26:46 -04:00
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
clenk 1a75d830bb Add Autonomous System 2017-05-03 18:19:30 -04:00
clenk 2c67b90638 Add Artifact type 2017-05-03 17:35:33 -04:00
clenk c63ba8e447 Add ObservableProperty, DictionaryProperty, HashesProperty,
BinaryProperty, and HexProperty
2017-05-03 14:10:10 -04:00
Richard Piazza 5b8585b392 added versioning test for embedded_object
replaced VersioningError with RevokeError and UnmodifiablePropertyError
added __deepcopy__ to base class to handle embedded_objects
2017-05-03 12:14:09 -04:00
Richard Piazza c2d628db50 import style errors 2 2017-05-02 15:53:07 -04:00
Richard Piazza cda2b47691 import style errors 2 2017-05-02 14:29:59 -04:00
Richard Piazza 411c087fc1 import style errors 2017-05-02 14:25:01 -04:00
Richard Piazza a70fc2c952 Added versioning api, with tests 2017-05-02 14:17:26 -04:00
Richard Piazza 4efe5357b1 Added versioning api, with tests 2017-05-02 14:06:42 -04:00
clenk c5ba5dad65 Modify UUID checking 2017-04-25 10:03:37 -04:00
clenk cd815bfe84 Fix import order, add flake8-import-order plugin
to Tox
2017-04-24 18:29:56 -04:00
clenk fe4c4d78fc Fix typos, add to Property class documentation, small performance
boosts, and let strings and booleans in a ListProperty be handled by
__call__().
2017-04-24 17:34:16 -04:00
clenk 76acd8c0c2 Merge branch 'master' into parsing 2017-04-19 15:22:36 -04:00
clenk d06df8b9da Fix parsing errors
- Typos in Attack Pattern tests
- Put MarkingDefinition, ExternalReference, and KillChainPhase together
  in a file for objects that aren't SDOs or SROs
- Create utility function to return dictionary from string or
  file-like object
- Put off testing parsing Cyber Observable Objects until a later commit
2017-04-19 14:32:56 -04:00
clenk fabfbe20ec Parse all SDOs and SROs 2017-04-19 09:22:08 -04:00
Greg Back 6bf3584616 Create custom exception class for modifying an immutable object. 2017-04-18 15:06:41 -05:00
Greg Back 91cecb7b0c Add exception for extra/invalid custom properties. 2017-04-18 14:56:16 -05:00
Greg Back 32ff00559e Rename exception class. 2017-04-18 14:42:59 -05:00
Greg Back a7805c4ac0 Add Exception for missing values. 2017-04-18 14:41:18 -05:00
Greg Back 2aa1f5cedd Add exception for invalid Property values. 2017-04-18 14:19:16 -05:00
clenk 05ccffc5bd Use correct Property classes for all STIX objects 2017-04-18 09:21:38 -04:00
clenk a14d507f48 Add IntegerProperty 2017-04-18 09:19:38 -04:00
clenk 635a3ec389 Combine clean() and validate() 2017-04-17 15:13:11 -04:00
clenk cf0b56c04f Use correct property classes for ExternalReference 2017-04-17 14:15:01 -04:00
clenk 40810646fb Fix Flake8 error and use UTC as default timezone 2017-04-17 13:16:14 -04:00
clenk b4f116a33f Fix TimestampProperty
- improved timestamp formatting
- python-stix2 will only include subsecond values if they don't equal 0
- in Python 3.6, datetime.astimezone doesn't throw an error on naive
  timestamps as in previous versions
2017-04-17 10:48:13 -04:00
clenk 35981025c5 Rework ListProperty, fix merging issues 2017-04-14 10:42:17 -04:00
clenk bc8bdccece Merge branch 'master' into parsing 2017-04-11 15:05:22 -04:00
clenk 2e3dfe5d84 Add TimestampProperty 2017-04-11 12:10:55 -04:00
clenk 168105603b Parse dictionaries as well as strings and file-like objects 2017-04-10 10:42:07 -04:00
clenk dd382520d6 Clean up code/comments 2017-04-10 10:18:54 -04:00
clenk bab8d187c9 Rework kill chain phases 2017-04-07 17:34:06 -04:00
Richard Piazza 3c17c9259c Add Sighting object and data markings
- Update ReferenceProperty to allow specifying a particular object type
- Update ListProperty and add SelectorProperty
- Add description to Relationship
2017-04-07 16:07:17 -05:00
Greg Back 1517eb899b Move fixtures to conftest.py 2017-04-07 15:36:42 -05:00
clenk 93b8076ae3 Use StringProperty and ListProperty in Malware objects,
fix bugs in those properties
2017-04-07 14:53:40 -04:00
clenk 474833248d Flesh out ListProperty, add StringProperty 2017-04-06 19:17:32 -04:00
clenk 253989cc52 Coerce boolean properties automatically
for values like "true", "F", or 1
2017-04-06 16:08:36 -04:00
clenk ce0de97df1 Validate UUID portion of IDProperty 2017-04-06 13:29:14 -04:00
clenk 5e4ca9e882 Add parsing of Malware objects 2017-04-05 17:12:44 -04:00
Greg Back 08dcfee64c Don't be so strict about exact error message 2017-03-22 08:33:42 -05:00
Greg Back a2f5981dfb Improve test coverage 2017-03-22 08:26:13 -05:00
Greg Back a0600b5ba4 Fix or ignore Flake8 warnings. 2017-03-22 08:05:59 -05:00
Greg Back 26c65e3bd0 Split up test functions 2017-03-22 07:46:39 -05:00
Greg Back c1a59265ae Remove unnecessary TODO comments. 2017-03-21 20:24:32 -04:00
Greg Back 79554a6491 Convert remaining properties from dicts to classes 2017-03-21 20:24:32 -04:00
Greg Back 9bcf064213 Convert most old-style properties to Property classes 2017-03-21 20:06:09 -04:00
Greg Back 19146c8327 Convert REF_PROPERTY to ReferenceProperty 2017-03-21 19:44:01 -04:00
Greg Back ef332a328b Convert BOOL_PROPERTY to BooleanProperty. 2017-03-21 19:33:43 -04:00
Greg Back aa1ecfa235 Remove unused code. 2017-02-24 13:08:18 -06:00
Greg Back a79df01449 Convert more fields to Property classes. 2017-02-24 13:07:54 -06:00
Greg Back 7ef6e20e9a Add tests for kill chain phases. 2017-02-24 12:53:57 -06:00
Greg Back 2768426a28 Used fixed property for Bundle spec_version 2017-02-24 12:33:47 -06:00
Greg Back 2645bf2c71 Convert 'type' to a new Property class. 2017-02-24 12:33:45 -06:00
Greg Back a264ca1e5e Convert ID properties to class style 2017-02-24 12:32:05 -06:00
Greg Back cf688c3851 WIP: Start transforming properties. 2017-02-24 12:29:51 -06:00
Greg Back 805c15c397 Add tests for all SDOs 2017-02-24 11:56:55 -06:00
clenk 61d3652514 Add more SDO skeletons
- Campaign
- CourseOfAction
- Identity
- ObservedData
- Report
- ThreatActor
- Vulnerability
2017-02-23 10:12:38 -05:00
clenk 375b915da4 Add KillChainPhase, AttackPattern, IntrusionSet, Tool 2017-02-22 10:06:35 -05:00
clenk 417b43b1fe Add revoked property 2017-02-20 16:19:07 -05:00
clenk e2f60bc8c5 Add created_by_ref common property 2017-02-15 17:10:30 -05:00
Greg Back 031cdc9931 Add blank line 2017-02-10 16:12:02 -06:00
Greg Back dbe98c664a More repr tests. 2017-02-10 16:09:37 -06:00
Greg Back bc66db94aa Add generic __repr__ to _STIXBase. 2017-02-10 15:58:17 -06:00
Greg Back 96e880b49b Refactor library into separate files. 2017-02-10 15:35:02 -06:00
Greg Back b171f025c8 Test for exact exception strings. 2017-02-02 11:07:57 -06:00
Greg Back 1a46a4b073 Add external references. 2017-02-02 10:58:46 -06:00
Greg Back 5d7ed643bd Check for required args first, and check for them all at once.
This is necessary for versions of Python <3.6, where dictionaries are
unordered by default, meaning we can't ensure the order in which fields
are checked.
2017-02-02 10:17:13 -06:00
Greg Back 1ba064734b Special handling for timestamp fields.
If a type has more than one timestamp field that should be automatically generated,
we want them to all be same, not vary by milliseconds.
2017-02-02 09:50:35 -06:00
Greg Back 675a29dbfb Add support for required fields with no default values. 2017-02-02 08:53:46 -06:00
Greg Back 67c3311672 Handle ID fields in a generic way. 2017-02-02 08:33:36 -06:00
Greg Back e677167cb4 Refine tests. 2017-02-02 08:13:48 -06:00
Greg Back 724774900d Generic form of JSON serialization 2017-02-01 16:04:20 -06:00
Greg Back 2a1709a7de Allow passing objects to Bundle as args 2017-02-01 14:57:07 -06:00
Greg Back 58fccd7f7d Further refactoring bundle. 2017-02-01 14:52:18 -06:00
Greg Back ce31356839 start of automated property checking. 2017-02-01 14:35:41 -06:00
Greg Back b4eb6c1fd1 Refactor common ID check. 2017-02-01 13:44:57 -06:00
Greg Back b5ab54b6a9 WIP: convert bundle to using kwargs. 2017-02-01 13:34:44 -06:00
Greg Back 8843e9b190 WIP: refactor common fields. 2017-02-01 13:27:24 -06:00
Greg Back 26ed0389ea Fix invalid numeric literals 2017-02-01 12:50:43 -06:00
Greg Back 15e9ff8da6 Make Bundle test repeatable 2017-01-18 17:03:20 -08:00
Greg Back 855ca929fa Add initial Bundle implementation. 2017-01-18 16:58:25 -08:00
Greg Back e4e75e459b Update how fixtures work during testing. 2017-01-18 16:57:26 -08:00
Greg Back 022f344b94 Add UUID fixture 2017-01-18 16:32:52 -08:00
Greg Back 439211082a Add custom clock fixture 2017-01-18 16:14:57 -08:00
Greg Back 4d9dcafbc6 Small fixups 2017-01-18 16:10:18 -08:00
Greg Back 742d9645d6 Allow shorter syntax for creating relationships. 2017-01-18 15:14:56 -08:00
Greg Back fd548a5f41 Allow creating relationships from objects, not just IDs. 2017-01-18 15:14:22 -08:00
Greg Back e683acbf48 Normalize IDs in tests. 2017-01-18 11:21:46 -08:00
Greg Back da75833400 Add Relationship class with required fields. 2017-01-18 10:59:28 -08:00
Greg Back e23d265d20 Use pytest fixtures 2017-01-18 09:31:33 -08:00
Greg Back 022f7c9166 Convert constructors to kwargs. 2017-01-17 17:25:40 -08:00
Greg Back 4eaa87660b Pull out __str__ function 2017-01-17 16:58:17 -08:00
Greg Back 3e7adef792 Add Malware object with required fields. 2017-01-17 16:53:27 -08:00
Greg Back ef0b80ad44 Allow attribute and key-based access. Make immutable. 2017-01-17 15:52:03 -08:00
Greg Back eeec5a4ce3 Allow key-based access along with attribute access 2017-01-17 15:03:56 -08:00
Greg Back 31cebdd34a Add tests for required fields. 2017-01-17 14:52:56 -08:00
Greg Back ebf6513445 Check for valid IDs and types on indicators. 2017-01-17 14:46:00 -08:00
Greg Back d054b9deba Add tests for all different fields 2017-01-17 14:09:20 -08:00
Greg Back 6761d1fdfc Add required fields to Indicator. 2017-01-17 14:07:49 -08:00
Greg Back 2f8c2780c2 Initial tests for STIX 2 2017-01-17 12:37:47 -08:00
Greg Back 86585d229e Initial package files. 2017-01-17 08:54:39 -08:00