vulners 2.2.2__tar.gz → 2.3.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.
@@ -1,10 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vulners
3
- Version: 2.2.2
3
+ Version: 2.3.0
4
4
  Summary: Python library and command-line utility for Vulners (https://vulners.com)
5
5
  Keywords: security,network,vulners,vulnerability,CVE
6
- Author: Kirill Ermakov
7
- Author-email: isox@vulners.com
6
+ Author: Vulners Team
8
7
  Requires-Python: >=3.8
9
8
  Classifier: Development Status :: 5 - Production/Stable
10
9
  Classifier: Intended Audience :: Developers
@@ -1,9 +1,9 @@
1
1
  [tool.poetry]
2
2
  name = "vulners"
3
- version = "2.2.2"
3
+ version = "2.3.0"
4
4
  description = "Python library and command-line utility for Vulners (https://vulners.com)"
5
5
  readme = "README.md"
6
- authors = ["Kirill Ermakov <isox@vulners.com>", "Andrei Churin <a.churin@qiwi.com>"]
6
+ authors = ["Vulners Team"]
7
7
  keywords = ["security", "network", "vulners", "vulnerability", "CVE"]
8
8
  classifiers = [
9
9
  "Development Status :: 5 - Production/Stable",
@@ -248,6 +248,27 @@ class Const(object):
248
248
  self.value = value
249
249
 
250
250
 
251
+ class Any(Param):
252
+ def __init__(self, *args, **kwargs):
253
+ assert all([p.__base__ == Param for p in args]), "Invalid argument type"
254
+ self.__params = [p(**kwargs) for p in args]
255
+ super(Any, self).__init__(**kwargs)
256
+
257
+ def validate(self, param, value):
258
+ errs = []
259
+ for _param in self.__params:
260
+ try:
261
+ return _param.validate(param, value)
262
+ except ParamError as e:
263
+ errs.append(e)
264
+ pass
265
+
266
+ raise ParamError(
267
+ "Expect %s but got '%s'",
268
+ (" or ".join([p.__class__.__name__ for p in self.__params]), type(value)),
269
+ )
270
+
271
+
251
272
  class String(Param):
252
273
  def __init__(self, choices=None, *args, **kwargs):
253
274
  super(String, self).__init__(*args, **kwargs)
@@ -4,6 +4,7 @@ import warnings
4
4
  import zipfile
5
5
 
6
6
  from .base import (
7
+ Any,
7
8
  Boolean,
8
9
  Const,
9
10
  Dict,
@@ -185,10 +186,13 @@ class VulnersApi(VulnersApiBase):
185
186
  ("sw_edition", String(required=False)),
186
187
  ("target_sw", String(required=False)),
187
188
  ("target_hw", String(required=False)),
188
- ("respect_major_version", String(required=False, choices=["yes", "no", "true", "false"])),
189
+ (
190
+ "respect_major_version",
191
+ String(required=False, choices=["yes", "no", "true", "false"]),
192
+ ),
189
193
  ("exclude_any_version", String(required=False, choices=["yes", "no", "true", "false"])),
190
- ("type", String(required=False)), # deprecated
191
- ("exactmatch", Boolean(default=False)), # deprecated
194
+ ("type", String(required=False)), # deprecated
195
+ ("exactmatch", Boolean(default=False)), # deprecated
192
196
  ],
193
197
  content_handler=_get_burp_software_content,
194
198
  )
@@ -208,8 +212,13 @@ class VulnersApi(VulnersApiBase):
208
212
  target_hw=None,
209
213
  respect_major_version=None,
210
214
  exclude_any_version=None,
211
- only_ids=None
215
+ only_ids=None,
212
216
  ):
217
+ warnings.warn(
218
+ "get_software_vulnerabilities() is deprecated and will be removed in future release. "
219
+ "Use VulnersApi.audit_software() or VulnersApi.audit_host() instead.",
220
+ DeprecationWarning,
221
+ )
213
222
  """
214
223
  Find software vulnerabilities using name and version.
215
224
 
@@ -227,16 +236,45 @@ class VulnersApi(VulnersApiBase):
227
236
  target_hw,
228
237
  respect_major_version,
229
238
  exclude_any_version,
230
- only_ids
239
+ only_ids,
231
240
  )
232
241
 
242
+ audit_software = Endpoint(
243
+ method="post",
244
+ url="/api/v4/audit/software-batch/",
245
+ params=[
246
+ (
247
+ "software",
248
+ List(
249
+ item=Dict(),
250
+ description="List of dicts. E.g., [{'product': 'curl', 'version': '8.11.1', ...}, ...]",
251
+ ),
252
+ ),
253
+ ],
254
+ content_handler=lambda c, _: c["result"],
255
+ )
256
+
257
+ audit_host = Endpoint(
258
+ method="post",
259
+ url="/api/v4/audit/host/",
260
+ params=[
261
+ (
262
+ "software",
263
+ List(
264
+ item=Dict(),
265
+ description="List of dicts. E.g., [{'product': 'curl', 'version': '8.11.1', ...}, ...]",
266
+ ),
267
+ ),
268
+ ("application", Any(String, Dict, required=False)),
269
+ ("operation_system", Any(String, Dict, required=False)),
270
+ ("hardware", Any(String, Dict, required=False)),
271
+ ],
272
+ content_handler=lambda c, _: c["result"],
273
+ )
274
+
233
275
  @validate_params(cpe=String())
234
276
  def get_cpe_vulnerabilities(
235
- self,
236
- cpe,
237
- respect_major_version=None,
238
- exclude_any_version=None,
239
- only_ids=None
277
+ self, cpe, respect_major_version=None, exclude_any_version=None, only_ids=None
240
278
  ):
241
279
  """
242
280
  Find software vulnerabilities using CPE string. See CPE references at https://cpe.mitre.org/specification/
@@ -432,6 +470,10 @@ class VulnersApi(VulnersApiBase):
432
470
  "os_version",
433
471
  String(description="Windows OS version, like '10.0.19045'"),
434
472
  ),
473
+ (
474
+ "platform",
475
+ String(required=False, description="os platform like x86"),
476
+ ),
435
477
  (
436
478
  "kb_list",
437
479
  List(
@@ -650,7 +692,7 @@ class VulnersApi(VulnersApiBase):
650
692
  ("format", String(default="html", choices=("html", "json", "pdf"))),
651
693
  ("crontab", String(allow_null=True, default=None)),
652
694
  ("query_type", String(default="lucene")),
653
- ]
695
+ ],
654
696
  )
655
697
 
656
698
  edit_subscription = Endpoint(
@@ -660,8 +702,11 @@ class VulnersApi(VulnersApiBase):
660
702
  ("subscriptionid", String()),
661
703
  ("format", String(allow_null=True, default=None, choices=("html", "json", "pdf"))),
662
704
  ("crontab", String(allow_null=True, default=None)),
663
- ("active", String(allow_null=True, default=None, choices=("yes", "no", "true", "false"))),
664
- ]
705
+ (
706
+ "active",
707
+ String(allow_null=True, default=None, choices=("yes", "no", "true", "false")),
708
+ ),
709
+ ],
665
710
  )
666
711
 
667
712
  delete_subscription = Endpoint(
@@ -669,7 +714,7 @@ class VulnersApi(VulnersApiBase):
669
714
  url="/api/v3/subscriptions/removeEmailSubscription/",
670
715
  params=[
671
716
  ("subscriptionid", String()),
672
- ]
717
+ ],
673
718
  )
674
719
 
675
720
  get_webhooks = Endpoint(
File without changes
File without changes
File without changes
File without changes
File without changes