netverdict 0.5.0__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.
Files changed (56) hide show
  1. netverdict-0.5.0/LICENSE +338 -0
  2. netverdict-0.5.0/PKG-INFO +300 -0
  3. netverdict-0.5.0/README.md +261 -0
  4. netverdict-0.5.0/netverdict/__init__.py +1 -0
  5. netverdict-0.5.0/netverdict/capture/capture.ps1 +130 -0
  6. netverdict-0.5.0/netverdict/capture/capture.sh +119 -0
  7. netverdict-0.5.0/netverdict/capture/sysmon-netverdict.xml +79 -0
  8. netverdict-0.5.0/netverdict/cli.py +377 -0
  9. netverdict-0.5.0/netverdict/compare.py +244 -0
  10. netverdict-0.5.0/netverdict/correlate.py +315 -0
  11. netverdict-0.5.0/netverdict/explain.py +85 -0
  12. netverdict-0.5.0/netverdict/flows.py +115 -0
  13. netverdict-0.5.0/netverdict/hostsnap.py +131 -0
  14. netverdict-0.5.0/netverdict/pcap.py +389 -0
  15. netverdict-0.5.0/netverdict/report.py +353 -0
  16. netverdict-0.5.0/netverdict/rules/__init__.py +0 -0
  17. netverdict-0.5.0/netverdict/rules/builtin.yaml +398 -0
  18. netverdict-0.5.0/netverdict/rules/engine.py +290 -0
  19. netverdict-0.5.0/netverdict/signals.py +448 -0
  20. netverdict-0.5.0/netverdict/sources/__init__.py +0 -0
  21. netverdict-0.5.0/netverdict/sources/auditd.py +320 -0
  22. netverdict-0.5.0/netverdict/sources/evtx.py +693 -0
  23. netverdict-0.5.0/netverdict/sources/syslog.py +452 -0
  24. netverdict-0.5.0/netverdict/timeline.py +215 -0
  25. netverdict-0.5.0/netverdict.egg-info/PKG-INFO +300 -0
  26. netverdict-0.5.0/netverdict.egg-info/SOURCES.txt +54 -0
  27. netverdict-0.5.0/netverdict.egg-info/dependency_links.txt +1 -0
  28. netverdict-0.5.0/netverdict.egg-info/entry_points.txt +2 -0
  29. netverdict-0.5.0/netverdict.egg-info/requires.txt +15 -0
  30. netverdict-0.5.0/netverdict.egg-info/top_level.txt +1 -0
  31. netverdict-0.5.0/pyproject.toml +78 -0
  32. netverdict-0.5.0/setup.cfg +4 -0
  33. netverdict-0.5.0/tests/test_auditd_real_format.py +64 -0
  34. netverdict-0.5.0/tests/test_chemins_sans_temoin.py +213 -0
  35. netverdict-0.5.0/tests/test_cli_audit.py +54 -0
  36. netverdict-0.5.0/tests/test_cli_timeline.py +60 -0
  37. netverdict-0.5.0/tests/test_compare.py +169 -0
  38. netverdict-0.5.0/tests/test_correlate.py +174 -0
  39. netverdict-0.5.0/tests/test_engine.py +112 -0
  40. netverdict-0.5.0/tests/test_faux_verdicts.py +436 -0
  41. netverdict-0.5.0/tests/test_hostsnap_pseudo_process.py +62 -0
  42. netverdict-0.5.0/tests/test_lab_pcaps.py +63 -0
  43. netverdict-0.5.0/tests/test_paquet.py +95 -0
  44. netverdict-0.5.0/tests/test_partial_attribution.py +115 -0
  45. netverdict-0.5.0/tests/test_portabilite.py +117 -0
  46. netverdict-0.5.0/tests/test_review_fixes.py +146 -0
  47. netverdict-0.5.0/tests/test_source_auditd.py +334 -0
  48. netverdict-0.5.0/tests/test_source_evtx.py +213 -0
  49. netverdict-0.5.0/tests/test_source_syslog.py +212 -0
  50. netverdict-0.5.0/tests/test_syslog_tz.py +215 -0
  51. netverdict-0.5.0/tests/test_sysmon_guard.py +54 -0
  52. netverdict-0.5.0/tests/test_sysmon_join.py +325 -0
  53. netverdict-0.5.0/tests/test_timeline.py +54 -0
  54. netverdict-0.5.0/tests/test_troncature_et_secrets.py +97 -0
  55. netverdict-0.5.0/tests/test_verdicts.py +103 -0
  56. netverdict-0.5.0/tests/test_wfp_join.py +328 -0
@@ -0,0 +1,338 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ <https://fsf.org/>
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, see <https://www.gnu.org/licenses/>.
308
+
309
+ Also add information on how to contact you by electronic and paper mail.
310
+
311
+ If the program is interactive, make it output a short notice like this
312
+ when it starts in an interactive mode:
313
+
314
+ Gnomovision version 69, Copyright (C) year name of author
315
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
316
+ This is free software, and you are welcome to redistribute it
317
+ under certain conditions; type `show c' for details.
318
+
319
+ The hypothetical commands `show w' and `show c' should show the appropriate
320
+ parts of the General Public License. Of course, the commands you use may
321
+ be called something other than `show w' and `show c'; they could even be
322
+ mouse-clicks or menu items--whatever suits your program.
323
+
324
+ You should also get your employer (if you work as a programmer) or your
325
+ school, if any, to sign a "copyright disclaimer" for the program, if
326
+ necessary. Here is a sample; alter the names:
327
+
328
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
329
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
330
+
331
+ <signature of Moe Ghoul>, 1 April 1989
332
+ Moe Ghoul, President of Vice
333
+
334
+ This General Public License does not permit incorporating your program into
335
+ proprietary programs. If your program is a subroutine library, you may
336
+ consider it more useful to permit linking proprietary applications with the
337
+ library. If this is what you want to do, use the GNU Lesser General
338
+ Public License instead of this License.
@@ -0,0 +1,300 @@
1
+ Metadata-Version: 2.4
2
+ Name: netverdict
3
+ Version: 0.5.0
4
+ Summary: Triage d'incident reseau/app/OS : analyse une capture et rend un verdict argumente avec preuves
5
+ Author: rhnetwork
6
+ License: GPL-2.0-only
7
+ Project-URL: Homepage, https://github.com/serytia/netverdict
8
+ Project-URL: Repository, https://github.com/serytia/netverdict
9
+ Project-URL: Issues, https://github.com/serytia/netverdict/issues
10
+ Keywords: pcap,tcp,network,troubleshooting,sysadmin,packet-analysis,incident-response,sysmon,auditd
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Intended Audience :: Information Technology
15
+ Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: System :: Networking :: Monitoring
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Classifier: Topic :: Security
24
+ Classifier: Natural Language :: French
25
+ Requires-Python: >=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: dpkt>=1.9.8
29
+ Requires-Dist: rich>=13.0
30
+ Requires-Dist: pyyaml>=6.0
31
+ Requires-Dist: tzdata; sys_platform == "win32"
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=8.0; extra == "dev"
34
+ Provides-Extra: explain
35
+ Requires-Dist: anthropic>=0.60; extra == "explain"
36
+ Provides-Extra: evtx
37
+ Requires-Dist: python-evtx>=0.8; extra == "evtx"
38
+ Dynamic: license-file
39
+
40
+ # netverdict
41
+
42
+ **La capture reseau dit si le probleme vient du reseau, de l'application ou du
43
+ systeme — avec les preuves, et une piste de correction.**
44
+
45
+ Fini le blame game "c'est le reseau / c'est l'appli / c'est le serveur".
46
+ `netverdict` lit un pcap (et si possible un snapshot de l'etat de l'hote pris
47
+ au meme moment), en extrait les signaux TCP qui ne mentent pas, et rend un
48
+ **verdict argumente** :
49
+
50
+ ```
51
+ $ netverdict analyze capture.pcapng --snapshot snapshot.json
52
+
53
+ 18 paquets lus - 18 TCP, 0 ICMP, 0 non-IP, 0 illisibles - 1 conversations
54
+ +--------- APP - 10.0.0.42:51006 -> 10.0.0.5:5432 [confiance haute] --------+
55
+ | Reponse applicative lente, reception prouvee par ACK rapide |
56
+ | * 3 echanges : ACK serveur en 5 ms mais reponse en 800 ms (p50), 0 perte |
57
+ | * etat hote : [SRV-DB01] socket detenue par postgres (pid 4212), |
58
+ | cpu machine 22%, disque 97%, ram libre 512 Mo |
59
+ | |
60
+ | Piste de correction : |
61
+ | Le reseau a livre la requete (ACK immediat) puis a attendu l'application.|
62
+ | Chercher COTE APPLICATIF de 10.0.0.5:5432 : ... |
63
+ +----------------------------------------------------------------------------+
64
+ ```
65
+
66
+ Le raisonnement est celui qu'un expert applique en lisant un pcap dans
67
+ Wireshark — encode dans un moteur de regles deterministe :
68
+
69
+ | Signature observee | Verdict |
70
+ |---|---|
71
+ | SYN repetes sans reponse | RESEAU (DROP silencieux ou hote injoignable) |
72
+ | ICMP admin-prohibited | RESEAU (REJECT explicite, l'equipement est identifie) |
73
+ | RST immediat au SYN | APP (rien n'ecoute sur ce port) |
74
+ | Retransmissions massives | RESEAU (perte sur le chemin) |
75
+ | Zero window | HOTE (l'application ne lit plus sa socket) |
76
+ | ACK rapide mais reponse lente | APP (le delai est dans le serveur, preuve a l'appui) |
77
+ | ICMP fragmentation-needed | RESEAU (MTU/tunnel) |
78
+ | RST en pleine session | AMBIGU (timeout firewall, IPS, ou crash — qui a emis ?) |
79
+
80
+ ## Installation
81
+
82
+ Pas encore publie sur PyPI — installation depuis les sources :
83
+
84
+ ```
85
+ git clone https://github.com/serytia/netverdict
86
+ cd netverdict
87
+ pip install . # analyse : aucune dependance systeme
88
+ pip install ".[explain]" # + synthese narrative via l'API Claude (optionnel)
89
+ pip install ".[evtx]" # + lecture directe des .evtx binaires
90
+ ```
91
+
92
+ 100 % Python (dpkt). Pas besoin de Wireshark/tshark, ni sur le poste
93
+ d'analyse, ni sur les serveurs.
94
+
95
+ ## Usage
96
+
97
+ ```
98
+ # Analyser une capture existante
99
+ netverdict analyze capture.pcapng
100
+ netverdict analyze capture.pcapng --json # sortie machine
101
+ netverdict analyze capture.pcapng --explain # + synthese narrative (API Claude)
102
+
103
+ # v1.1 : croiser avec ce qui a change dans l'infra (timeline)
104
+ netverdict analyze capture.pcapng --events events.xml --syslog fw01.log
105
+ # --events : events Windows (.evtx avec l'extra [evtx], ou export XML :
106
+ # wevtutil qe System /f:xml > events.xml)
107
+ # --syslog : fichiers syslog plats (RFC3164/RFC5424 melanges acceptes)
108
+
109
+ # Fuseau des lignes RFC3164 (le format n'en porte AUCUN). A donner des que le
110
+ # syslog ne vient pas d'une machine reglee comme le poste d'analyse : sinon les
111
+ # evenements se decalent et sortent de la fenetre, en silence.
112
+ netverdict analyze capture.pcapng --syslog central.log --syslog-tz UTC
113
+ netverdict analyze capture.pcapng --syslog fw01.log --syslog-tz Europe/Paris
114
+ netverdict analyze capture.pcapng --syslog fw01.log --syslog-tz +02:00
115
+ # UTC / nom IANA / decalage fixe. Le nom IANA gere l'heure d'ete.
116
+ # Sans effet sur les lignes RFC5424, qui portent deja leur fuseau.
117
+
118
+ # OU les paquets se perdent-ils ? Deux captures du meme trafic, deux points.
119
+ netverdict compare amont.pcap aval.pcap
120
+ # amont = pres du client, aval = pres du serveur, captures SIMULTANEES.
121
+ # Un segment vu en amont et absent en aval s'est perdu ENTRE les deux
122
+ # points ; s'ils sont tous retrouves, le chemin intermediaire est hors de
123
+ # cause et il faut chercher au-dela. C'est le seul moyen de trancher sans
124
+ # supposition. Les horloges des deux machines n'ont pas besoin d'etre
125
+ # synchronisees : le decalage est estime, et l'outil se tait sur la latence
126
+ # plutot que d'en inventer une quand il ne peut pas l'estimer.
127
+
128
+ # Qui detenait la socket ? La reponse MEME SI le process est deja mort.
129
+ netverdict analyze capture.pcap --audit /var/log/audit/audit.log # Linux
130
+ netverdict analyze capture.pcapng --events sysmon.xml # Windows (Sysmon)
131
+ netverdict analyze capture.pcapng --events security.xml # Windows (WFP natif)
132
+ # WFP = audit natif Windows, SANS installer d'agent :
133
+ # auditpol /set /subcategory:"Filtering Platform Connection" /success:enable
134
+ # wevtutil qe Security /f:xml > security.xml
135
+ # auditpol /set /subcategory:"Filtering Platform Connection" /success:disable
136
+ # (tres verbeux : a activer le temps du diagnostic. 5157 dit aussi quel
137
+ # process s'est fait BLOQUER une connexion — Sysmon, lui, reste muet.)
138
+ # Le snapshot d'etat hote est pris a UN instant : il rate le process qui
139
+ # s'est termine avant la fin de la capture. Un journal, lui, date chaque
140
+ # connexion a son etablissement — l'attribution devient retroactive.
141
+ # Linux : regle a charger (une fois) —
142
+ # auditctl -a always,exit -F arch=b64 -S connect -k netverdict_connect
143
+ # (persistant : un fichier dans /etc/audit/rules.d/)
144
+ # Windows: Sysmon avec NetworkConnect actif —
145
+ # sysmon -c netverdict/capture/sysmon-netverdict.xml
146
+ # Si la source est presente mais la regle absente, l'outil le DIT au lieu
147
+ # de rendre un rapport muet.
148
+ # Le rapport ajoute les changements des 15 min precedant la capture
149
+ # (service installe, regle firewall rechargee, passage sur batterie...)
150
+ # et marque ceux qui precedent l'incident de peu.
151
+ #
152
+ # v1.2 : les changements pertinents sont AUSSI rattaches au flux concerne,
153
+ # directement dans son panneau de verdict, sous « A verifier en premier ».
154
+ # Un `*` signale un type de changement pouvant produire ce verdict precis
155
+ # (regle firewall -> RESEAU, crash de service -> APP, batterie -> OS).
156
+ # C'est un CLASSEMENT de suspects, jamais une conclusion de causalite : les
157
+ # changements sans affinite restent affiches, plus bas.
158
+
159
+ # Capture assistee : trafic + etat hote en un coup (console admin/root)
160
+ netverdict capture --duration 60 # Windows: pktmon (natif) / Linux: tcpdump
161
+
162
+ # Lister les regles de verdict
163
+ netverdict rules
164
+ ```
165
+
166
+ Code retour : `0` = rien d'anormal, `1` = au moins un verdict, `2` = erreur.
167
+
168
+ La capture assistee est **tronquee par defaut** (128 octets/paquet sous Windows,
169
+ 96 sous Linux) : suffisant pour l'analyse et leger.
170
+
171
+ **Ce n'est PAS une garantie d'absence de credential**, contrairement a ce que
172
+ ce README affirmait avant le 25/07/2026. La troncature coupe a N octets *depuis
173
+ le debut de la trame* — un paquet plus court que N est donc capture EN ENTIER,
174
+ payload compris. Mesure :
175
+
176
+ | Payload | `-s 96` | 128 o |
177
+ |---|---|---|
178
+ | `PASS hunter2` (POP3/FTP en clair) | **complet** | **complet** |
179
+ | `USER admin` + `PASS ...` | **complet** | **complet** |
180
+ | `{"token":"eyJhbGciOi..."}` | **complet** | **complet** |
181
+ | En-tete `Authorization: Basic ...` (51 o) | 42/51 o | **complet** |
182
+
183
+ Autrement dit : la troncature elimine les gros transferts, pas les secrets
184
+ courts — et les protocoles d'authentification en clair sont precisement courts.
185
+ Traiter un bundle comme une donnee sensible : le relire avant de le transmettre,
186
+ et preferer `--full-packets` uniquement quand c'est necessaire et assume.
187
+
188
+ L'option `--explain` n'envoie jamais le pcap : uniquement le rapport JSON
189
+ (signaux et verdicts).
190
+
191
+ ## Comment ca marche
192
+
193
+ Deux etages strictement separes, comme decodeurs/regles dans Wazuh :
194
+
195
+ 1. **Mesure** (`pcap.py`, `flows.py`, `signals.py`) : lecture de la capture,
196
+ reconstruction des conversations TCP, calcul des signaux — retransmissions
197
+ (avec exclusion des doublons de capture et des keepalives), RTT, zero
198
+ window, delai requete->reponse applicatif, delai d'ACK serveur, ICMP
199
+ rattaches. Que des faits, aucun jugement.
200
+ 2. **Verdict** (`rules/`) : regles declaratives YAML — conditions sur les
201
+ signaux, verdict, confiance, preuves interpolees, remediation redigee.
202
+ Chaque seuil est commente avec sa justification.
203
+
204
+ Ajouter ses propres regles : `netverdict analyze ... --rules mes_regles.yaml`
205
+ (meme format que `netverdict/rules/builtin.yaml`).
206
+
207
+ ## Plateformes
208
+
209
+ | | Analyse (`analyze`) | Capture assistee | Jointure process <-> flux |
210
+ |---|---|---|---|
211
+ | Linux | oui | `capture.sh` (tcpdump + ss) | `--audit` (auditd) |
212
+ | Windows | oui | `capture.ps1` (pktmon, natif) | `--events` : Sysmon EID 3, **ou WFP 5156/5157 sans agent** |
213
+ | macOS | oui | non — capturer avec `tcpdump`, puis analyser | non |
214
+
215
+ `compare` (deux captures, deux points) fonctionne sur les trois.
216
+
217
+ CI : Linux/Windows/macOS x Python 3.11-3.13, plus un job en fuseau decale,
218
+ un avec les extras installes, un sur le paquet construit.
219
+
220
+ ## Statut de validation
221
+
222
+ - **Valide** : 239 tests automatises, verts sur Linux, Windows et macOS
223
+ (Python 3.11 a 3.13) et sous fuseau decale.
224
+ - **Valide au kernel** : 8 scenarios de panne reproduits par un vrai noyau
225
+ Linux (netem, iptables, vraies sockets — `lab/`), plus la jointure auditd
226
+ sur un journal auditd reel. Les pcaps produits servent de fixtures.
227
+ - **Valide sur incident reel** : chaine de capture Windows complete (pktmon
228
+ -> analyse) contre un service lent, un port ferme et un port filtre — les
229
+ trois verdicts exacts.
230
+ - **Pas encore fait** : incidents de production subis (non provoques). Les
231
+ verdicts sont un point de depart outille, pas un oracle — AMBIGU est un
232
+ verdict assume, et le rapport dit ce qu'il n'a pas su lire.
233
+
234
+ Ce que ces validations ont coute, et pourquoi elles figurent ici : chacune a
235
+ trouve des defauts que les tests sur donnees fabriquees ne voyaient pas —
236
+ detection de retransmissions cassee par TSO/GSO, `pktmon` qui annonce un
237
+ type de trame et en ecrit un autre, `auditd` dont le format par defaut n'est
238
+ pas celui de sa documentation, et des pannes Windows declenchees par des
239
+ donnees Linux. Les fixtures ecrites a la main decrivent l'outil qu'on
240
+ imagine ; l'execution reelle decrit celui qui existe.
241
+
242
+ ## Limites connues (v1)
243
+
244
+ - TCP/IPv4-IPv6 uniquement (pas d'UDP/QUIC, pas de reassemblage de fragments).
245
+ - RTT p95 pollue par les delayed ACK (~40-200 ms) : min et p50 sont fiables.
246
+ Aucune regle ne rend donc un verdict RESEAU sur le seul p95. En revanche un
247
+ p95 eleve n'est pas ignore : une mediane saine avec une queue significative
248
+ produit un verdict AMBIGU explicite (« pics de latence que la capture ne sait
249
+ pas attribuer »), qui nomme les deux causes possibles — gigue du chemin ou
250
+ delayed ACK — et donne de quoi les separer. Ni faux verdict reseau, ni faux
251
+ « transport sain ».
252
+ - Sens client/serveur estime par heuristique si la capture demarre en pleine
253
+ session (signale dans le rapport).
254
+ - Le snapshot hote vient d'une seule machine (celle ou on a lance la capture).
255
+ Il est pris a UN instant : il rate le process deja mort a la fin de la
256
+ capture. La jointure Sysmon (Event ID 3), elle, est retroactive et le
257
+ retrouve — voir « Jointure process » ci-dessous.
258
+ - Jointure process <-> flux : correspondance sur le quadruplet EXACT (les deux
259
+ sens sont testes), TCP uniquement, avec 60 s de tolerance d'horloge entre la
260
+ capture et le journal. Un port client reutilise pendant la capture produit
261
+ plusieurs candidats : le plus proche du debut du flux est retenu, et le
262
+ rapport signale l'ambiguite plutot que de la taire.
263
+ - Syslog RFC3164 (sans fuseau) : par defaut l'heure est interpretee dans le
264
+ fuseau du poste d'analyse, et les horodatages concernes sont marques `~`
265
+ dans le rapport. Une source en UTC lue depuis un poste en heure locale se
266
+ decale alors HORS de la fenetre, et le rapport affiche « aucun changement
267
+ detecte » — a lire comme « rien n'a ete retenu », pas comme « rien n'a
268
+ change ». **Corriger avec `--syslog-tz`** (voir Usage) : les horodatages
269
+ deviennent exacts, le `~` disparait et le delai avant l'incident est donne
270
+ a la seconde.
271
+ - `--syslog-tz` avec un decalage FIXE (`+02:00`) est faux de part et d'autre
272
+ d'un changement d'heure : un fichier qui traverse le passage a l'heure
273
+ d'hiver sera mal date sur une moitie. Preferer un nom IANA
274
+ (`Europe/Paris`), qui gere l'heure d'ete. Sur une heure ambigue (celle qui
275
+ existe deux fois lors du retour a l'heure d'hiver), la premiere occurrence
276
+ est retenue.
277
+
278
+ ## Roadmap
279
+
280
+ - v1.1 (fait) : timeline multi-sources — events Windows (EVTX/XML) + syslog
281
+ pour repondre a "qu'est-ce qui a change dans l'infra juste avant ?".
282
+ - v1.2 (fait) : `--syslog-tz`, correlation changement->verdict, jointure
283
+ process<->flux retroactive via Sysmon Event ID 3. **Reste a valider sur un
284
+ vrai enregistrement Sysmon** : les noms de champs viennent du schema du
285
+ binaire, la forme du XML est celle des evenements Windows standards deja
286
+ parses par sources/evtx.py. Pour activer la source (console admin) :
287
+
288
+ ```powershell
289
+ sysmon -i -accepteula <chemin>\netverdict\capture\sysmon-netverdict.xml
290
+ ```
291
+
292
+ Cette configuration n'active QUE l'Event ID 3 (NetworkConnect), desactive par
293
+ defaut dans le Sysmon livre avec Windows 11 24H2. Les 21 autres types
294
+ d'evenements y sont en `onmatch="include"` sans aucune regle, ce qui les
295
+ laisse eteints — on n'allume pas un journal complet pour une jointure.
296
+ - v2 : capture pilotee des deux cotes (client ET serveur) et comparaison.
297
+
298
+ ## Licence
299
+
300
+ GPL-2.0