recongraph 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {recongraph-0.0.1 → recongraph-0.0.2}/LICENSE +21 -21
- {recongraph-0.0.1/recongraph.egg-info → recongraph-0.0.2}/PKG-INFO +181 -166
- {recongraph-0.0.1 → recongraph-0.0.2}/README.md +164 -149
- {recongraph-0.0.1 → recongraph-0.0.2}/pyproject.toml +33 -33
- {recongraph-0.0.1 → recongraph-0.0.2}/recongraph/__init__.py +3 -3
- {recongraph-0.0.1 → recongraph-0.0.2}/recongraph/recongraph.py +911 -911
- {recongraph-0.0.1 → recongraph-0.0.2/recongraph.egg-info}/PKG-INFO +181 -166
- {recongraph-0.0.1 → recongraph-0.0.2}/setup.cfg +4 -4
- {recongraph-0.0.1 → recongraph-0.0.2}/tests/test_recongraph.py +99 -99
- {recongraph-0.0.1 → recongraph-0.0.2}/recongraph.egg-info/SOURCES.txt +0 -0
- {recongraph-0.0.1 → recongraph-0.0.2}/recongraph.egg-info/dependency_links.txt +0 -0
- {recongraph-0.0.1 → recongraph-0.0.2}/recongraph.egg-info/entry_points.txt +0 -0
- {recongraph-0.0.1 → recongraph-0.0.2}/recongraph.egg-info/requires.txt +0 -0
- {recongraph-0.0.1 → recongraph-0.0.2}/recongraph.egg-info/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 forensic-timeline
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 forensic-timeline
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,166 +1,181 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: recongraph
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary: Reconstruction of Forensic Timelines Using Graph Theory
|
|
5
|
-
Author: Muhammad Nur Yasir Utomo
|
|
6
|
-
Project-URL: Homepage, https://github.com/forensic-timeline/recongraph
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: Operating System :: OS Independent
|
|
9
|
-
Requires-Python: >=3.8
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: PyYAML
|
|
13
|
-
Requires-Dist: networkx
|
|
14
|
-
Requires-Dist: pandas
|
|
15
|
-
Requires-Dist: lxml
|
|
16
|
-
Dynamic: license-file
|
|
17
|
-
|
|
18
|
-
# ReconGraph
|
|
19
|
-
|
|
20
|
-
**Reconstruction of Forensic Timelines Using Graph Theory**
|
|
21
|
-
|
|
22
|
-
`recongraph` is a Python library designed to reconstruct and visualize system behaviors and activities based on logs from various devices, such as Windows and Linux systems. It converts Plaso log2timeline CSV files into a forensic graph timeline. By parsing sequential log data and mapping them to defined events, `recongraph` builds a `MultiDiGraph` (Multi-Directed Graph) that represents the state transitions and operational flow of the target system. This graph-based approach aids in forensic analysis, anomaly detection, and understanding complex system behaviors across diverse platforms.
|
|
23
|
-
|
|
24
|
-
## Table of Contents
|
|
25
|
-
|
|
26
|
-
- [Features](#features)
|
|
27
|
-
- [Prerequisites](#prerequisites)
|
|
28
|
-
- [Installation](#installation)
|
|
29
|
-
- [Python Virtual Environment Setup](#python-virtual-environment-setup)
|
|
30
|
-
- [Recongraph Package Installation](#recongraph-package-installation)
|
|
31
|
-
- [Sigma Rules Setup](#sigma-rules-setup)
|
|
32
|
-
- [Quick Start](#quick-start)
|
|
33
|
-
- [Input Data Format](#input-data-format)
|
|
34
|
-
- [Log File](#log-file)
|
|
35
|
-
- [Event File](#event-file)
|
|
36
|
-
- [Output](#output)
|
|
37
|
-
- [Documentation](#documentation)
|
|
38
|
-
- [License](#license)
|
|
39
|
-
|
|
40
|
-
## Features
|
|
41
|
-
|
|
42
|
-
- **Sigma Rule-Based Pattern Matching**: Leverages standardized Sigma rules to identify and label security-relevant events in raw logs.
|
|
43
|
-
- **Forensic Graph Construction**: Transforms sequential log entries from Plaso (log2timeline) into a directed graph, where nodes represent detected events and edges represent temporal transitions.
|
|
44
|
-
- **Intelligent Log Detection**: Automatically identifies various log formats (e.g., Apache, Linux auth, Syslog) and extracts relevant metadata like HTTP methods, URIs, and status codes.
|
|
45
|
-
- **Weighted Behavioral Mapping**: Edges are weighted by transition frequency, helping to distinguish common flows from rare or suspicious sequences.
|
|
46
|
-
- **Anomaly-Focused Reconstruction**: Specifically isolates and maps behaviors based on rule severity levels (Critical, High, Medium, Low).
|
|
47
|
-
- **Multi-Format Export**: Exports graphs to GraphML for visualization (Gephi, Cytoscape) and detailed forensic timelines to CSV.
|
|
48
|
-
|
|
49
|
-
## Prerequisites
|
|
50
|
-
|
|
51
|
-
- Python 3.13 or higher
|
|
52
|
-
- Git
|
|
53
|
-
- Python virtual environment (venv or conda)
|
|
54
|
-
|
|
55
|
-
## Python Virtual Environment Setup
|
|
56
|
-
|
|
57
|
-
Recongraph uses several Python packages to function properly. It is recommended to install the package in a virtual environment to avoid dependency conflicts. Here is a simple example of how to create and activate a virtual environment:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
conda create -n recongraph python
|
|
63
|
-
conda activate recongraph
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Or using venv (recommended):
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
python -m venv venv
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
The tool
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: recongraph
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Reconstruction of Forensic Timelines Using Graph Theory
|
|
5
|
+
Author: Muhammad Nur Yasir Utomo
|
|
6
|
+
Project-URL: Homepage, https://github.com/forensic-timeline/recongraph
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: PyYAML
|
|
13
|
+
Requires-Dist: networkx
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: lxml
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# ReconGraph
|
|
19
|
+
|
|
20
|
+
**Reconstruction of Forensic Timelines Using Graph Theory**
|
|
21
|
+
|
|
22
|
+
`recongraph` is a Python library designed to reconstruct and visualize system behaviors and activities based on logs from various devices, such as Windows and Linux systems. It converts Plaso log2timeline CSV files into a forensic graph timeline. By parsing sequential log data and mapping them to defined events, `recongraph` builds a `MultiDiGraph` (Multi-Directed Graph) that represents the state transitions and operational flow of the target system. This graph-based approach aids in forensic analysis, anomaly detection, and understanding complex system behaviors across diverse platforms.
|
|
23
|
+
|
|
24
|
+
## Table of Contents
|
|
25
|
+
|
|
26
|
+
- [Features](#features)
|
|
27
|
+
- [Prerequisites](#prerequisites)
|
|
28
|
+
- [Installation](#installation)
|
|
29
|
+
- [Python Virtual Environment Setup](#python-virtual-environment-setup)
|
|
30
|
+
- [Recongraph Package Installation](#recongraph-package-installation)
|
|
31
|
+
- [Sigma Rules Setup](#sigma-rules-setup)
|
|
32
|
+
- [Quick Start](#quick-start)
|
|
33
|
+
- [Input Data Format](#input-data-format)
|
|
34
|
+
- [Log File](#log-file)
|
|
35
|
+
- [Event File](#event-file)
|
|
36
|
+
- [Output](#output)
|
|
37
|
+
- [Documentation](#documentation)
|
|
38
|
+
- [License](#license)
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
- **Sigma Rule-Based Pattern Matching**: Leverages standardized Sigma rules to identify and label security-relevant events in raw logs.
|
|
43
|
+
- **Forensic Graph Construction**: Transforms sequential log entries from Plaso (log2timeline) into a directed graph, where nodes represent detected events and edges represent temporal transitions.
|
|
44
|
+
- **Intelligent Log Detection**: Automatically identifies various log formats (e.g., Apache, Linux auth, Syslog) and extracts relevant metadata like HTTP methods, URIs, and status codes.
|
|
45
|
+
- **Weighted Behavioral Mapping**: Edges are weighted by transition frequency, helping to distinguish common flows from rare or suspicious sequences.
|
|
46
|
+
- **Anomaly-Focused Reconstruction**: Specifically isolates and maps behaviors based on rule severity levels (Critical, High, Medium, Low).
|
|
47
|
+
- **Multi-Format Export**: Exports graphs to GraphML for visualization (Gephi, Cytoscape) and detailed forensic timelines to CSV.
|
|
48
|
+
|
|
49
|
+
## Prerequisites
|
|
50
|
+
|
|
51
|
+
- Python 3.13 or higher
|
|
52
|
+
- Git
|
|
53
|
+
- Python virtual environment (venv or conda)
|
|
54
|
+
|
|
55
|
+
## Python Virtual Environment Setup
|
|
56
|
+
|
|
57
|
+
Recongraph uses several Python packages to function properly. It is recommended to install the package in a virtual environment to avoid dependency conflicts. Here is a simple example of how to create and activate a virtual environment:
|
|
58
|
+
|
|
59
|
+
1. Anaconda or Miniconda
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
conda create -n recongraph python
|
|
63
|
+
conda activate recongraph
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or using venv (recommended):
|
|
67
|
+
|
|
68
|
+
2. Venv
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python -m venv venv
|
|
72
|
+
source venv/bin/activate
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Recongraph Package Installation
|
|
76
|
+
|
|
77
|
+
Recongraph package installation can be done directly from PyPI using `pip` or by cloning this repository
|
|
78
|
+
|
|
79
|
+
### Installing via Pip
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install recongraph
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Or installing by cloning this repository:
|
|
86
|
+
|
|
87
|
+
### Installing from Source
|
|
88
|
+
|
|
89
|
+
1. **Clone the Repository**
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/forensic-timeline/recongraph
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
2. **Install Depedencies**
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
cd recongraph
|
|
99
|
+
pip install -e .
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Sigma Rules Setup
|
|
103
|
+
|
|
104
|
+
To use the recongraph tools, sigma rules are needed to label and detect events in the log files. Sigma rules can be downloaded from https://github.com/SigmaHQ/sigma. The sigma rules are released under the [Detection Rule License (DRL) 1.1](https://github.com/SigmaHQ/Detection-Rule-License).
|
|
105
|
+
|
|
106
|
+
Using git clone, you can use the sigma rules folder:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
git clone https://github.com/SigmaHQ/sigma
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Quick Start
|
|
113
|
+
|
|
114
|
+
Here is a simple example of how to use `recongraph` to reconstruct a forensic timeline:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
recongraph -f /path/to/your/plaso-file.csv -r /path/to/your/sigma-rules-folder -o output-filename.graphml
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## How to Test
|
|
121
|
+
|
|
122
|
+
To ensure that the installation is correct and the code is functioning as expected, you can run the test suite provided in the ``tests/`` directory.
|
|
123
|
+
|
|
124
|
+
1. **Install Test Dependencies**:
|
|
125
|
+
Ensure you have ``pytest`` installed.
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pip install pytest pandas pyyaml
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
2. **Run Tests**:
|
|
132
|
+
Navigate to the project root directory and execute:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pytest -v
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
You should see output indicating that all tests have passed.
|
|
139
|
+
|
|
140
|
+
## Input Data Format
|
|
141
|
+
|
|
142
|
+
`recongraph` processes raw log data and applies Sigma rules to identify significant security events.
|
|
143
|
+
|
|
144
|
+
### Log File (`<filename>.csv`)
|
|
145
|
+
|
|
146
|
+
A sequential log file containing system activities. The tool supports supports CSV format from Plaso (log2timeline).
|
|
147
|
+
|
|
148
|
+
### Sigma Rules (`rules/` directory)
|
|
149
|
+
|
|
150
|
+
A directory containing standardized Sigma rules in `.yml` format. These rules define the logic used to detect and label events within the logs.
|
|
151
|
+
|
|
152
|
+
Sigma rules are downloaded from https://github.com/SigmaHQ/sigma.
|
|
153
|
+
|
|
154
|
+
The content of that repository is released under the following licenses:
|
|
155
|
+
|
|
156
|
+
- The Sigma specification (https://github.com/SigmaHQ/sigma-specification) and the Sigma logo are public domain
|
|
157
|
+
- The rules contained in the SigmaHQ repository (https://github.com/SigmaHQ) are released under the [Detection Rule License (DRL) 1.1](https://github.com/SigmaHQ/Detection-Rule-License)
|
|
158
|
+
|
|
159
|
+
## Output
|
|
160
|
+
|
|
161
|
+
The tool generates several files to aid in analysis:
|
|
162
|
+
|
|
163
|
+
- **GraphML File** (`reconstruction_edge_graph.graphml`): A directed graph where nodes are detected events and edges represent the flow between them. Suitable for visualization in Gephi or Cytoscape.
|
|
164
|
+
- **Event Logs CSV** (`reconstruction_event_logs.csv`): A detailed breakdown of every log entry associated with a graph node, including timestamps and raw message content.
|
|
165
|
+
- **Sigma Labeled CSV** (`<filename>_sigma_labeled.csv`): The input log file augmented with matching Sigma rule titles and severity levels.
|
|
166
|
+
|
|
167
|
+
## Documentation
|
|
168
|
+
|
|
169
|
+
Full documentation is available at [ReadTheDocs](https://recongraph.readthedocs.io/).
|
|
170
|
+
|
|
171
|
+
## Licenses
|
|
172
|
+
|
|
173
|
+
### ReconGraph
|
|
174
|
+
|
|
175
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
176
|
+
|
|
177
|
+
### Third-Party Licenses
|
|
178
|
+
|
|
179
|
+
This project uses **Sigma Rules** for event detection.
|
|
180
|
+
- The **Sigma specification** and logo are public domain.
|
|
181
|
+
- The **detection rules** from the [SigmaHQ repository](https://github.com/SigmaHQ/sigma) are released under the [Detection Rule License (DRL) 1.1](https://github.com/SigmaHQ/Detection-Rule-License).
|