hexora 0.2.4__tar.gz → 0.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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hexora
3
- Version: 0.2.4
3
+ Version: 0.3.0
4
4
  Summary: Static analysis of malicous Python scripts.
5
5
  Author-email: Artem Golubin <me@rushter.com>
6
6
  License-Expression: MIT
@@ -18,6 +18,7 @@ Dynamic: license-file
18
18
 
19
19
 
20
20
  Hexora is a static analysis tool designed to detect malicious and harmful patterns in Python code.
21
+ It combines a rule-based static analysis engine with a machine-learned model that scores entire source files to classify them as malicious or benign.
21
22
 
22
23
  It can be used to:
23
24
 
@@ -71,6 +72,7 @@ warning[HX2000]: Reading from the clipboard can be used to exfiltrate sensitive
71
72
  │
72
73
  = Confidence: High
73
74
  Help: Clipboard access can be used to exfiltrate sensitive data such as passwords and keys.
75
+ Machine learning based score for file: 0.93
74
76
 
75
77
  warning[HX3000]: Possible execution of unwanted code
76
78
  ┌─ resources/test/test.py:20:1
@@ -4,6 +4,7 @@
4
4
 
5
5
 
6
6
  Hexora is a static analysis tool designed to detect malicious and harmful patterns in Python code.
7
+ It combines a rule-based static analysis engine with a machine-learned model that scores entire source files to classify them as malicious or benign.
7
8
 
8
9
  It can be used to:
9
10
 
@@ -57,6 +58,7 @@ warning[HX2000]: Reading from the clipboard can be used to exfiltrate sensitive
57
58
  │
58
59
  = Confidence: High
59
60
  Help: Clipboard access can be used to exfiltrate sensitive data such as passwords and keys.
61
+ Machine learning based score for file: 0.93
60
62
 
61
63
  warning[HX3000]: Possible execution of unwanted code
62
64
  ┌─ resources/test/test.py:20:1
@@ -0,0 +1,81 @@
1
+ from typing import List, Optional, Tuple, TypedDict, Literal, Union
2
+ import os
3
+
4
+ class AuditItem(TypedDict):
5
+ label: str
6
+ rule: str
7
+ description: str
8
+ confidence: Literal["very_low", "low", "medium", "high", "very_high"]
9
+ location: Optional[Tuple[int, int]]
10
+ annotation: Optional[str]
11
+
12
+ class AuditResult(TypedDict):
13
+ items: List[AuditItem]
14
+ path: str
15
+ archive_path: Optional[str]
16
+
17
+ def audit_path(input_path: Union[str, os.PathLike[str]]) -> List[AuditResult]:
18
+ """
19
+ Runs audit in the specified folder.
20
+
21
+ Example:
22
+ >>> import hexora
23
+ >>> results = hexora.audit_path("hexora/resources/test/")
24
+ >>> results[0]
25
+ {
26
+ "items": [
27
+ {
28
+ "label": "pyperclip",
29
+ "rule": "HX5010",
30
+ "description": "pyperclip can be used to copy and paste data from the clipboard.",
31
+ "confidence": "low",
32
+ "location": (7, 16),
33
+ "annotation": None,
34
+ }
35
+ ],
36
+ "path": "hexora/resources/test/clipboard_01.py",
37
+ "archive_path": None,
38
+ }
39
+ """
40
+ ...
41
+
42
+ def audit_file(
43
+ input_path: Union[str, os.PathLike[str]],
44
+ ) -> List[AuditResult]:
45
+ """
46
+ Runs audit for the specified path.
47
+
48
+ Returns ``List[AuditResult]`` for both regular files and archives
49
+ (``.zip`` or ``.tar.gz``).
50
+
51
+ Example (regular file):
52
+ >>> import hexora
53
+ >>> result = hexora.audit_file("resources/test/exec_02.py")
54
+ >>> result[0]
55
+ {
56
+ 'items': [
57
+ {
58
+ 'label': 'eval',
59
+ 'rule': 'HX3000',
60
+ 'description': 'Possible execution of unwanted code.',
61
+ 'confidence': 'medium',
62
+ 'location': (17, 36),
63
+ 'annotation': 'warning[HX3000]: Possible execution of unwanted code...Confidence: Medium'
64
+ },
65
+ {
66
+ 'label': 'builtins.exec',
67
+ 'rule': 'HX3000',
68
+ 'description': 'Possible execution of unwanted code.',
69
+ 'confidence': 'very_high',
70
+ 'location': (37, 65),
71
+ 'annotation': 'warning[HX3000]: Possible execution of unwanted code...Confidence: VeryHigh'
72
+ },
73
+ ...
74
+ ],
75
+ 'path': 'resources/test/exec_02.py',
76
+ 'archive_path': None
77
+ }
78
+ """
79
+ ...
80
+
81
+ def run_cli() -> None: ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hexora
3
- Version: 0.2.4
3
+ Version: 0.3.0
4
4
  Summary: Static analysis of malicous Python scripts.
5
5
  Author-email: Artem Golubin <me@rushter.com>
6
6
  License-Expression: MIT
@@ -18,6 +18,7 @@ Dynamic: license-file
18
18
 
19
19
 
20
20
  Hexora is a static analysis tool designed to detect malicious and harmful patterns in Python code.
21
+ It combines a rule-based static analysis engine with a machine-learned model that scores entire source files to classify them as malicious or benign.
21
22
 
22
23
  It can be used to:
23
24
 
@@ -71,6 +72,7 @@ warning[HX2000]: Reading from the clipboard can be used to exfiltrate sensitive
71
72
  │
72
73
  = Confidence: High
73
74
  Help: Clipboard access can be used to exfiltrate sensitive data such as passwords and keys.
75
+ Machine learning based score for file: 0.93
74
76
 
75
77
  warning[HX3000]: Possible execution of unwanted code
76
78
  ┌─ resources/test/test.py:20:1
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = 'hexora'
3
- version = '0.2.4'
3
+ version = '0.3.0'
4
4
  description = 'Static analysis of malicous Python scripts.'
5
5
  readme = 'README.md'
6
6
  requires-python = '>=3.9'
@@ -1,26 +0,0 @@
1
- from typing import List, Optional, Tuple, TypedDict, Literal, Union
2
- import os
3
-
4
- class AuditItem(TypedDict):
5
- label: str
6
- rule: str
7
- description: str
8
- confidence: Literal["very_low", "low", "medium", "high", "very_high"]
9
- location: Optional[Tuple[int, int]]
10
-
11
- class AuditResult(TypedDict):
12
- items: List[AuditItem]
13
- path: str
14
- archive_path: Optional[str]
15
-
16
- def audit_path(input_path: Union[str, os.PathLike[str]]) -> List[AuditResult]:
17
- """
18
- Runs audit in the specified folder.
19
- """
20
- ...
21
-
22
- def audit_file(input_path: Union[str, os.PathLike[str]]) -> AuditResult:
23
- """
24
- Runs audit for the specified file.
25
- """
26
- ...
File without changes
File without changes
File without changes
File without changes
File without changes