# grapl_analyzerlib
Analyzer library for Grapl
This library provides two main constructs,
Queries and Entities.
Queries are used for performing subgraph searches against
Grapl's Master or Engagement graphs.
Entities are designed for pivoting off of query results.
https://pypi.org/project/grapl-analyzerlib/
`pip install grapl_analyzer`
### Querying
```python
from pydgraph import DgraphClient, DgraphClientStub
from grapl_analyzerlib.counters import ParentChildCounter
from grapl_analyzerlib.entities import ProcessQuery
from grapl_analyzerlib.entity_queries import Not
mclient = DgraphClient(DgraphClientStub('alpha0.mastergraphcluster.grapl:9080'))
# Query for suspicious svchost.exe's, based on the parent process not being whitelisted
p = (
ProcessQuery()
.with_process_name(contains=[
Not("services.exe"),
Not("lsass.exe"),
])
.with_children(
ProcessQuery()
.with_process_name(ends_with="svchost.exe")
)
.query_first(mclient)
)
if p:
# We now have a ProcessView, representing a concrete subgraph
print(f"Found: {p.process_name} at path: {p.get_bin_file()}")
```
### Entity Pivoting
Given an entity `p`, such as from the above example.
```python
parent = p.get_parent()
siblings = parent.get_children()
bin_file = p.get_bin_file()
bin_file_creator = bin_file.get_creator()
```
We can easily pivot across the graph, incrementally expanding
the scope.
### Counting
Counters are currently provided as simple, specialized helpers.
Given an entity `p`, such as from the above example.
```python
counter = ParentChildCounter(mclient)
count = counter.get_count_for(
parent_process_name=p.process_name,
child_process_name=p.children[0].process_name,
excluding=p.node_key
)
if count <= Seen.Once:
print("Seen one time or never")
```
PyPI 官网下载 | grapl_analyzerlib-0.1.255.tar.gz
版权申诉
163 浏览量
2022-02-10
12:08:22
上传
评论
收藏 28KB GZ 举报
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
最新资源
- 652027170733254多亿影视.apk
- 创新实践CNN车牌识别项目
- 小程序版图像分类算法对中文数字识别-不含数据集图片-含逐行注释和说明文档.zip
- 公交卡管理系统一个实验
- C语言学生成绩管理系统(信息可保存读取txt文件)
- 网上零食销售系统论文.docx
- 小程序版图像分类算法对电脑配件分类识别-不含数据集图片-含逐行注释和说明文档.zip
- 小程序版深度学习CNN训练识别8种水果-不含数据集图片-含逐行注释和说明文档.zip
- 小程序版基于深度学习对手势动作分类识别-不含数据集图片-含逐行注释和说明文档.zip
- 小程序版深度学习CNN训练识别手写数字图像中的数字分类-不含数据集图片-含逐行注释和说明文档.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈