spal
23 February 2024 07:57
1
Hi,
I’m new to TypeDB and while going through the github and looking into the code i got a doubt. Is the parser doing the STIX conversion from JSON and then inserting into TypeDB or it’s two different things. Please help me to understand this. Thank you!
spal
27 February 2024 07:10
2
am working on this repo currently - GitHub - typedb-osi/typedb-cti: Open Source Threat Intelligence Platform
any help would be highly appreciated.
alex
27 February 2024 09:42
3
The file stix/type_mapping.py
contains a mapping from “raw” STIX data to TypeDB concepts:
#
# Copyright (C) 2022 Vaticle
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
This file has been truncated. show original
In stix/migrator.py
we can find the JSON parser method _read_stix_objects_json
;
#
# Copyright (C) 2022 Vaticle
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
This file has been truncated. show original
And stix/query.py
contains all the methods for generating TypeQL Insert queries from the imported data:
#
# Copyright (C) 2022 Vaticle
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
This file has been truncated. show original
spal
27 February 2024 12:22
4
Thank you @alex
So, to my understanding that’s a step by step process from
mapping → migration → insertion
please correct me for anything.
alex
29 February 2024 11:58
5
I’d say so, yes this looks correct to me.
1 Like