Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some basic functions in the source #31

Closed
priamai opened this issue Aug 12, 2023 · 7 comments
Closed

Add some basic functions in the source #31

priamai opened this issue Aug 12, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@priamai
Copy link
Contributor

priamai commented Aug 12, 2023

Hello,
we discuss before to support a full STIX filter function like this but for now I would need just a set of primitives added:

  • return stix id list by object type (all of them including the base but also our object types like the DOD or the Feeds)
  • return stix id list by SCO,SDO, SRO macro type
  • return stix id based on created time stamp with >, < and [] interval dates
  • return stix id based on modified time stamp with >, < and [] interval dates

Also cherry on the cake if we can combine the filters for example:

  • return stix id list of type Feeds between creation date A and B
  • return stix id list of malware type with creation more than A
  • etc etc
@priamai priamai added the enhancement New feature or request label Aug 12, 2023
@brettforbes
Copy link
Collaborator

@dfjosullivan , can you comment please? I guess these methods underlie the block definitions we want to build. So if we build these methods out first, then it should be pretty useful. Can you advise on the best way to layout queries to underlie the table of block definitions? Like what do i call them, how should all of the methods be organised?

@brettforbes
Copy link
Collaborator

brettforbes commented Aug 14, 2023

Hi
I cant understand queries 1 and 2, please provide greater detail.

Also, I can't understand 5, since the same Feed object is continuously updated, and in fact it is the Observed Data and the Threat Sub Objects that have creation dates. Finally, the data observed also has its own created and modified dates. What specifically are your referring to in your query request? We can make anything, but what do you want? Can you be MECE (Mutually Exclusive, Collectively Exhaustive)?

@priamai
Copy link
Contributor Author

priamai commented Aug 14, 2023

I was thinking something like this approach:

filterme = Conditions(type="campaign",created__gt="2023-01-01",created__lt="2023-03-01")

List_id = source.filter(filterme)

@priamai
Copy link
Contributor Author

priamai commented Aug 14, 2023

filterme2 = Conditions(stixtype="SDO",library="stix2.1")

To get all the SDO of the standard library.

Filterme3 = Conditions(stixtype="Technique",library="attack")

@brettforbes
Copy link
Collaborator

Yes, but its not like this at all, and by not understanding how it works, it is making t hard.

Instead we need to assemble a query to get stix_id's based on certain constraints, like
match $sdo isa stix-domain-object, has created $created, has stix-id $stix_id; $created > "2023-01-01"; $created < "2023-03-01"; get $stix_id;

Then we simply run the TypeDBSource.get() method for each of the returned stix_id's

The key is to understand the object variations and constraints well enough so that we can deal with all of them pretty easily. this is why i ask for more detail

@priamai
Copy link
Contributor Author

priamai commented Aug 14, 2023

At the bone to build the query:

Operators: equal, greater than (greater than equal), less than (less than equal).

The stix fields I want to filter:
created
modified
type (equal only)

Everything else we can build on top of this core function.
Well i guess the Mitre technique and subtechniques will be tricky but we can make some syntax magic.

@brettforbes
Copy link
Collaborator

completed and pushed, @dfjosullivan is to convert it onto the TypeDB function in Issue #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants