Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
executable file
·175 lines (158 loc) · 5.37 KB
/
Copy pathpyproject.toml
File metadata and controls
executable file
·175 lines (158 loc) · 5.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "industrial-scanner"
version = "0.2.0.dev0"
description = "Read-only ICS/OT security analyzer for Modbus/TCP, S7Comm and DNP3."
readme = "README.md"
requires-python = ">=3.11"
license = { text = "MIT" }
authors = [
{ name = "Frangel Barrera", email = "frangelrcbarrera@gmail.com" },
]
keywords = [
"ics", "ot", "scada", "modbus", "s7comm", "dnp3",
"industrial", "cybersecurity", "pentest", "passive",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Security",
"Topic :: System :: Networking :: Monitoring",
]
dependencies = [
"pymodbus>=3.6.5,<4",
"Jinja2>=3.1.4,<4",
"scapy>=2.5.0,<3",
"click>=8.1",
"rich>=13.7",
"pydantic>=2.5",
"pydantic-settings>=2.1",
"markupsafe>=2.1",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0",
"pytest-cov>=4.1",
"pytest-asyncio>=0.23",
"hypothesis>=6.92",
"ruff>=0.5",
"mypy>=1.8",
"bandit>=1.7",
"pip-audit>=2.7",
"pre-commit>=3.6",
]
docs = [
"mkdocs>=1.6",
"mkdocs-material>=9.5",
"mkdocstrings[python]>=0.24",
]
[project.scripts]
industrial-scanner = "ics_scanner.cli:main"
[project.urls]
Homepage = "https://github.com/frangelbarrera/industrial-scanner"
Issues = "https://github.com/frangelbarrera/industrial-scanner/issues"
[tool.setuptools.packages.find]
where = ["."]
include = ["modbus_scanner*", "s7_comm_analyzer*", "dnp3_monitor*", "ics_scanner*", "reports*"]
exclude = ["tests*", "pcaps*", "docs*"]
[tool.setuptools]
py-modules = ["build_dnp3_index", "build_global_index", "build_modbus_index", "build_s7_index"]
[tool.setuptools.package-data]
reports = ["templates/*.html"]
[tool.ruff]
line-length = 100
target-version = "py311"
[tool.ruff.lint]
select = [
"E", "F", "W", # pycodestyle + pyflakes
"I", # isort
"B", # bugbear
"C4", # comprehensions
"UP", # pyupgrade
"SIM", # simplify
"RUF", # ruff-specific
"S", # bandit-style security
"T20", # no print() in production code
"PT", # pytest style
"PL", # pylint
]
ignore = [
"E501", # line length handled by formatter
"PLC0415", # import inside function (deliberate, breaks circular deps)
"PLR2004", # magic values in tests/build scripts are fine
"PLR0915", # too many statements (parsers have many branches by nature)
"PLR0913", # too many arguments (CLI signatures match spec)
"PLR0917", # too many positional args (same)
"PLW2901", # redefined-loop-name (iterators in build_*.py)
"RUF013", # implicit Optional (false positive with PEP 563)
"E702", # multiple statements on one line (compact style)
"S110", # try-except-pass (used for best-effort cleanup in protocol modules)
"S112", # try-except-continue (used for batch processing of malformed reports)
"SIM105", # contextlib.suppress (less readable than try/except in some cases)
"PLR0912", # too many branches (probe_host has 4 read paths by design)
]
[tool.ruff.lint.per-file-ignores]
# Tests use assert, print, and may have magic values for test fixtures.
"tests/**/*.py" = ["S101", "S106", "PLR2004", "T201", "PT011"]
# Build scripts are CLI utilities where print() is appropriate.
"build_*.py" = ["T201"]
# Legacy CLI uses print() for backward compat.
"cli.py" = ["T201"]
# run_*.py batch runners use print() for progress.
"run_*.py" = ["T201"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
[tool.mypy]
python_version = "3.12"
strict = false
warn_return_any = false
warn_unused_configs = true
disallow_untyped_defs = true
check_untyped_defs = true
warn_unused_ignores = true
ignore_missing_imports = true
no_implicit_optional = true
disable_error_code = ["attr-defined", "call-arg", "no-untyped-call", "arg-type", "assignment", "operator", "index", "return-value", "call-overload"]
files = ["modbus_scanner", "s7_comm_analyzer", "dnp3_monitor", "ics_scanner"]
# Per-module overrides: third-party libraries without type stubs.
[[tool.mypy.overrides]]
module = [
"pymodbus.*",
"pymodbus.client.*",
"pymodbus.exceptions.*",
"pymodbus.pdu.*",
"scapy.*",
"scapy.all.*",
"markupsafe.*",
"jinja2.*",
"click.*",
"rich.*",
]
ignore_missing_imports = true
[tool.pytest.ini_options]
minversion = "8.0"
testpaths = ["tests"]
addopts = "-ra -q --cov=modbus_scanner --cov=s7_comm_analyzer --cov=dnp3_monitor --cov-report=term-missing --cov-report=html"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests that require live devices",
"fuzz: marks property-based / fuzz tests",
]
[tool.bandit]
exclude_dirs = ["tests", "pcaps", "reports"]
skips = ["B101"] # assert usage in tests
[tool.coverage.run]
source = ["modbus_scanner", "s7_comm_analyzer", "dnp3_monitor"]
omit = ["*/tests/*", "*/__pycache__/*"]
[tool.coverage.report]
fail_under = 80
skip_empty = true