Commit Graph

465 Commits (b2613ca62c0c552b37900c1efc4a8b413e2391cb)

Author SHA1 Message Date
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
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
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
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
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
Chris Lenk 2b6023e7bb Allow objects with custom properties in bundles 2017-10-09 17:33:12 -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
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