1515from macaron .json_tools import JsonType , json_extract
1616from macaron .malware_analyzer .pypi_heuristics .base_analyzer import BaseHeuristicAnalyzer
1717from macaron .malware_analyzer .pypi_heuristics .heuristics import HeuristicResult , Heuristics
18+ from macaron .malware_analyzer .pypi_heuristics .metadata .anomalistic_version import AnomalisticVersionAnalyzer
1819from macaron .malware_analyzer .pypi_heuristics .metadata .closer_release_join_date import CloserReleaseJoinDateAnalyzer
1920from macaron .malware_analyzer .pypi_heuristics .metadata .empty_project_link import EmptyProjectLinkAnalyzer
2021from macaron .malware_analyzer .pypi_heuristics .metadata .high_release_frequency import HighReleaseFrequencyAnalyzer
@@ -73,6 +74,7 @@ class MaliciousMetadataFacts(CheckFacts):
7374 CloserReleaseJoinDateAnalyzer ,
7475 SuspiciousSetupAnalyzer ,
7576 WheelAbsenceAnalyzer ,
77+ AnomalisticVersionAnalyzer ,
7678]
7779
7880# The HeuristicResult sequence is aligned with the sequence of ANALYZERS list
@@ -86,6 +88,7 @@ class MaliciousMetadataFacts(CheckFacts):
8688 HeuristicResult ,
8789 HeuristicResult ,
8890 HeuristicResult ,
91+ HeuristicResult ,
8992 ],
9093 float ,
9194] = {
@@ -98,9 +101,26 @@ class MaliciousMetadataFacts(CheckFacts):
98101 HeuristicResult .FAIL , # Closer Release Join Date
99102 HeuristicResult .FAIL , # Suspicious Setup
100103 HeuristicResult .FAIL , # Wheel Absence
104+ HeuristicResult .FAIL , # Anomalistic Version
101105 # No project link, only one release, and the maintainer released it shortly
102106 # after account registration.
103107 # The setup.py file contains suspicious imports and .whl file isn't present.
108+ # Anomalistic version has no effect.
109+ ): Confidence .HIGH ,
110+ (
111+ HeuristicResult .FAIL , # Empty Project
112+ HeuristicResult .SKIP , # Unreachable Project Links
113+ HeuristicResult .FAIL , # One Release
114+ HeuristicResult .SKIP , # High Release Frequency
115+ HeuristicResult .SKIP , # Unchanged Release
116+ HeuristicResult .FAIL , # Closer Release Join Date
117+ HeuristicResult .FAIL , # Suspicious Setup
118+ HeuristicResult .FAIL , # Wheel Absence
119+ HeuristicResult .PASS , # Anomalistic Version
120+ # No project link, only one release, and the maintainer released it shortly
121+ # after account registration.
122+ # The setup.py file contains suspicious imports and .whl file isn't present.
123+ # Anomalistic version has no effect.
104124 ): Confidence .HIGH ,
105125 (
106126 HeuristicResult .FAIL , # Empty Project
@@ -111,6 +131,7 @@ class MaliciousMetadataFacts(CheckFacts):
111131 HeuristicResult .FAIL , # Closer Release Join Date
112132 HeuristicResult .FAIL , # Suspicious Setup
113133 HeuristicResult .FAIL , # Wheel Absence
134+ HeuristicResult .SKIP , # Anomalistic Version
114135 # No project link, frequent releases of multiple versions without modifying the content,
115136 # and the maintainer released it shortly after account registration.
116137 # The setup.py file contains suspicious imports and .whl file isn't present.
@@ -124,6 +145,7 @@ class MaliciousMetadataFacts(CheckFacts):
124145 HeuristicResult .FAIL , # Closer Release Join Date
125146 HeuristicResult .FAIL , # Suspicious Setup
126147 HeuristicResult .FAIL , # Wheel Absence
148+ HeuristicResult .SKIP , # Anomalistic Version
127149 # No project link, frequent releases of multiple versions,
128150 # and the maintainer released it shortly after account registration.
129151 # The setup.py file contains suspicious imports and .whl file isn't present.
@@ -137,6 +159,7 @@ class MaliciousMetadataFacts(CheckFacts):
137159 HeuristicResult .FAIL , # Closer Release Join Date
138160 HeuristicResult .PASS , # Suspicious Setup
139161 HeuristicResult .PASS , # Wheel Absence
162+ HeuristicResult .SKIP , # Anomalistic Version
140163 # No project link, frequent releases of multiple versions without modifying the content,
141164 # and the maintainer released it shortly after account registration. Presence/Absence of
142165 # .whl file has no effect
@@ -150,6 +173,7 @@ class MaliciousMetadataFacts(CheckFacts):
150173 HeuristicResult .FAIL , # Closer Release Join Date
151174 HeuristicResult .PASS , # Suspicious Setup
152175 HeuristicResult .FAIL , # Wheel Absence
176+ HeuristicResult .SKIP , # Anomalistic Version
153177 # No project link, frequent releases of multiple versions without modifying the content,
154178 # and the maintainer released it shortly after account registration. Presence/Absence of
155179 # .whl file has no effect
@@ -163,10 +187,56 @@ class MaliciousMetadataFacts(CheckFacts):
163187 HeuristicResult .FAIL , # Closer Release Join Date
164188 HeuristicResult .FAIL , # Suspicious Setup
165189 HeuristicResult .FAIL , # Wheel Absence
190+ HeuristicResult .SKIP , # Anomalistic Version
166191 # All project links are unreachable, frequent releases of multiple versions,
167192 # and the maintainer released it shortly after account registration.
168193 # The setup.py file contains suspicious imports and .whl file isn't present.
169194 ): Confidence .HIGH ,
195+ (
196+ HeuristicResult .FAIL , # Empty Project
197+ HeuristicResult .SKIP , # Unreachable Project Links
198+ HeuristicResult .FAIL , # One Release
199+ HeuristicResult .SKIP , # High Release Frequency
200+ HeuristicResult .SKIP , # Unchanged Release
201+ HeuristicResult .FAIL , # Closer Release Join Date
202+ HeuristicResult .PASS , # Suspicious Setup
203+ HeuristicResult .PASS , # Wheel Absence
204+ HeuristicResult .FAIL , # Anomalistic Version
205+ # No project link, only one release, and the maintainer released it shortly
206+ # after account registration.
207+ # The setup.py file has no effect and .whl file is present.
208+ # The version number is anomalistic.
209+ ): Confidence .MEDIUM ,
210+ (
211+ HeuristicResult .FAIL , # Empty Project
212+ HeuristicResult .SKIP , # Unreachable Project Links
213+ HeuristicResult .FAIL , # One Release
214+ HeuristicResult .SKIP , # High Release Frequency
215+ HeuristicResult .SKIP , # Unchanged Release
216+ HeuristicResult .FAIL , # Closer Release Join Date
217+ HeuristicResult .FAIL , # Suspicious Setup
218+ HeuristicResult .PASS , # Wheel Absence
219+ HeuristicResult .FAIL , # Anomalistic Version
220+ # No project link, only one release, and the maintainer released it shortly
221+ # after account registration.
222+ # The setup.py file has no effect and .whl file is present.
223+ # The version number is anomalistic.
224+ ): Confidence .MEDIUM ,
225+ (
226+ HeuristicResult .FAIL , # Empty Project
227+ HeuristicResult .SKIP , # Unreachable Project Links
228+ HeuristicResult .FAIL , # One Release
229+ HeuristicResult .SKIP , # High Release Frequency
230+ HeuristicResult .SKIP , # Unchanged Release
231+ HeuristicResult .FAIL , # Closer Release Join Date
232+ HeuristicResult .SKIP , # Suspicious Setup
233+ HeuristicResult .PASS , # Wheel Absence
234+ HeuristicResult .FAIL , # Anomalistic Version
235+ # No project link, only one release, and the maintainer released it shortly
236+ # after account registration.
237+ # The setup.py file has no effect and .whl file is present.
238+ # The version number is anomalistic.
239+ ): Confidence .MEDIUM ,
170240}
171241
172242
0 commit comments