Commit Graph

432 Commits (722d46c6c53c90f032029bd9726e69074db3ba3b)

Author SHA1 Message Date
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