revengai 1.86.0__py3-none-any.whl → 1.89.2__py3-none-any.whl

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.

Potentially problematic release.


This version of revengai might be problematic. Click here for more details.

revengai/api_client.py CHANGED
@@ -90,7 +90,7 @@ class ApiClient:
90
90
  self.default_headers[header_name] = header_value
91
91
  self.cookie = cookie
92
92
  # Set default User-Agent.
93
- self.user_agent = 'OpenAPI-Generator/v1.86.0/python'
93
+ self.user_agent = 'OpenAPI-Generator/v1.89.2/python'
94
94
  self.client_side_validation = configuration.client_side_validation
95
95
 
96
96
  def __enter__(self):
revengai/configuration.py CHANGED
@@ -529,8 +529,8 @@ conf = revengai.Configuration(
529
529
  return "Python SDK Debug Report:\n"\
530
530
  "OS: {env}\n"\
531
531
  "Python Version: {pyversion}\n"\
532
- "Version of the API: v1.86.0\n"\
533
- "SDK Package Version: v1.86.0".\
532
+ "Version of the API: v1.89.2\n"\
533
+ "SDK Package Version: v1.89.2".\
534
534
  format(env=sys.platform, pyversion=sys.version)
535
535
 
536
536
  def get_host_settings(self) -> List[HostSetting]:
@@ -21,6 +21,7 @@ from revengai.models.analysis_create_request import AnalysisCreateRequest
21
21
  from revengai.models.analysis_create_response import AnalysisCreateResponse
22
22
  from revengai.models.analysis_detail_response import AnalysisDetailResponse
23
23
  from revengai.models.analysis_function_mapping import AnalysisFunctionMapping
24
+ from revengai.models.analysis_function_matching_request import AnalysisFunctionMatchingRequest
24
25
  from revengai.models.analysis_functions import AnalysisFunctions
25
26
  from revengai.models.analysis_record import AnalysisRecord
26
27
  from revengai.models.analysis_scope import AnalysisScope
@@ -207,6 +208,10 @@ from revengai.models.function_info_output import FunctionInfoOutput
207
208
  from revengai.models.function_local_variable_response import FunctionLocalVariableResponse
208
209
  from revengai.models.function_mapping import FunctionMapping
209
210
  from revengai.models.function_mapping_full import FunctionMappingFull
211
+ from revengai.models.function_matching_batch_response import FunctionMatchingBatchResponse
212
+ from revengai.models.function_matching_filters import FunctionMatchingFilters
213
+ from revengai.models.function_matching_request import FunctionMatchingRequest
214
+ from revengai.models.function_matching_result_with_best_match import FunctionMatchingResultWithBestMatch
210
215
  from revengai.models.function_name_confidence_body import FunctionNameConfidenceBody
211
216
  from revengai.models.function_name_history import FunctionNameHistory
212
217
  from revengai.models.function_name_input import FunctionNameInput
@@ -241,6 +246,7 @@ from revengai.models.list_collection_results import ListCollectionResults
241
246
  from revengai.models.login_request import LoginRequest
242
247
  from revengai.models.login_response import LoginResponse
243
248
  from revengai.models.logs import Logs
249
+ from revengai.models.matched_function import MatchedFunction
244
250
  from revengai.models.matched_function_suggestion import MatchedFunctionSuggestion
245
251
  from revengai.models.meta_model import MetaModel
246
252
  from revengai.models.model_name import ModelName
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ RevEng.AI API
5
+
6
+ RevEng.AI is Similarity Search Engine for executable binaries
7
+
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+
14
+ from __future__ import annotations
15
+ import pprint
16
+ import re # noqa: F401
17
+ import json
18
+
19
+ from pydantic import BaseModel, ConfigDict, Field
20
+ from typing import Any, ClassVar, Dict, List, Optional, Union
21
+ from typing_extensions import Annotated
22
+ from revengai.models.function_matching_filters import FunctionMatchingFilters
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class AnalysisFunctionMatchingRequest(BaseModel):
27
+ """
28
+ AnalysisFunctionMatchingRequest
29
+ """ # noqa: E501
30
+ min_similarity: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0.9, description="Minimum similarity expected for a match, default is 0.9")
31
+ filters: Optional[FunctionMatchingFilters] = None
32
+ __properties: ClassVar[List[str]] = ["min_similarity", "filters"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of AnalysisFunctionMatchingRequest from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of filters
74
+ if self.filters:
75
+ _dict['filters'] = self.filters.to_dict()
76
+ # set to None if filters (nullable) is None
77
+ # and model_fields_set contains the field
78
+ if self.filters is None and "filters" in self.model_fields_set:
79
+ _dict['filters'] = None
80
+
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of AnalysisFunctionMatchingRequest from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({
93
+ "min_similarity": obj.get("min_similarity") if obj.get("min_similarity") is not None else 0.9,
94
+ "filters": FunctionMatchingFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None
95
+ })
96
+ return _obj
97
+
98
+
@@ -0,0 +1,117 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ RevEng.AI API
5
+
6
+ RevEng.AI is Similarity Search Engine for executable binaries
7
+
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+
14
+ from __future__ import annotations
15
+ import pprint
16
+ import re # noqa: F401
17
+ import json
18
+
19
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
20
+ from typing import Any, ClassVar, Dict, List, Optional
21
+ from revengai.models.function_matching_result_with_best_match import FunctionMatchingResultWithBestMatch
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class FunctionMatchingBatchResponse(BaseModel):
26
+ """
27
+ FunctionMatchingBatchResponse
28
+ """ # noqa: E501
29
+ progress: Optional[StrictInt] = Field(default=0, description="Progress of the matching operation, represented as a percentage")
30
+ status: Optional[StrictStr] = None
31
+ total_time: Optional[StrictInt] = None
32
+ error_message: Optional[StrictStr] = None
33
+ matches: List[FunctionMatchingResultWithBestMatch]
34
+ __properties: ClassVar[List[str]] = ["progress", "status", "total_time", "error_message", "matches"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of FunctionMatchingBatchResponse from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of each item in matches (list)
76
+ _items = []
77
+ if self.matches:
78
+ for _item_matches in self.matches:
79
+ if _item_matches:
80
+ _items.append(_item_matches.to_dict())
81
+ _dict['matches'] = _items
82
+ # set to None if status (nullable) is None
83
+ # and model_fields_set contains the field
84
+ if self.status is None and "status" in self.model_fields_set:
85
+ _dict['status'] = None
86
+
87
+ # set to None if total_time (nullable) is None
88
+ # and model_fields_set contains the field
89
+ if self.total_time is None and "total_time" in self.model_fields_set:
90
+ _dict['total_time'] = None
91
+
92
+ # set to None if error_message (nullable) is None
93
+ # and model_fields_set contains the field
94
+ if self.error_message is None and "error_message" in self.model_fields_set:
95
+ _dict['error_message'] = None
96
+
97
+ return _dict
98
+
99
+ @classmethod
100
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
101
+ """Create an instance of FunctionMatchingBatchResponse from a dict"""
102
+ if obj is None:
103
+ return None
104
+
105
+ if not isinstance(obj, dict):
106
+ return cls.model_validate(obj)
107
+
108
+ _obj = cls.model_validate({
109
+ "progress": obj.get("progress") if obj.get("progress") is not None else 0,
110
+ "status": obj.get("status"),
111
+ "total_time": obj.get("total_time"),
112
+ "error_message": obj.get("error_message"),
113
+ "matches": [FunctionMatchingResultWithBestMatch.from_dict(_item) for _item in obj["matches"]] if obj.get("matches") is not None else None
114
+ })
115
+ return _obj
116
+
117
+
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ RevEng.AI API
5
+
6
+ RevEng.AI is Similarity Search Engine for executable binaries
7
+
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+
14
+ from __future__ import annotations
15
+ import pprint
16
+ import re # noqa: F401
17
+ import json
18
+
19
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
20
+ from typing import Any, ClassVar, Dict, List, Optional
21
+ from typing import Optional, Set
22
+ from typing_extensions import Self
23
+
24
+ class FunctionMatchingFilters(BaseModel):
25
+ """
26
+ FunctionMatchingFilters
27
+ """ # noqa: E501
28
+ binary_ids: Optional[List[StrictInt]] = Field(default=None, description="ID's of binaries to limit the search to, if empty, search all scoped binaries")
29
+ collection_ids: Optional[List[StrictInt]] = Field(default=None, description="ID's of collections to limit the search to, if empty, search all scoped collections")
30
+ function_ids: Optional[List[StrictInt]] = Field(default=None, description="ID's of functions to limit the search to, if empty, search all scoped functions")
31
+ debug_types: Optional[List[StrictStr]] = Field(default=None, description="Limit the search to specific debug types, if empty, search all scoped debug & non-debug functions")
32
+ __properties: ClassVar[List[str]] = ["binary_ids", "collection_ids", "function_ids", "debug_types"]
33
+
34
+ @field_validator('debug_types')
35
+ def debug_types_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value is None:
38
+ return value
39
+
40
+ for i in value:
41
+ if i not in set(['USER', 'SYSTEM', 'EXTERNAL']):
42
+ raise ValueError("each list item must be one of ('USER', 'SYSTEM', 'EXTERNAL')")
43
+ return value
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of FunctionMatchingFilters from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of FunctionMatchingFilters from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "binary_ids": obj.get("binary_ids"),
97
+ "collection_ids": obj.get("collection_ids"),
98
+ "function_ids": obj.get("function_ids"),
99
+ "debug_types": obj.get("debug_types")
100
+ })
101
+ return _obj
102
+
103
+
@@ -0,0 +1,102 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ RevEng.AI API
5
+
6
+ RevEng.AI is Similarity Search Engine for executable binaries
7
+
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+
14
+ from __future__ import annotations
15
+ import pprint
16
+ import re # noqa: F401
17
+ import json
18
+
19
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt
20
+ from typing import Any, ClassVar, Dict, List, Optional, Union
21
+ from typing_extensions import Annotated
22
+ from revengai.models.function_matching_filters import FunctionMatchingFilters
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class FunctionMatchingRequest(BaseModel):
27
+ """
28
+ FunctionMatchingRequest
29
+ """ # noqa: E501
30
+ model_id: StrictInt = Field(description="ID of the model used for function matching, used to determine the embedding model")
31
+ function_ids: List[StrictInt] = Field(description="ID's of functions to find matches for, must be at least one function ID")
32
+ min_similarity: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0.9, description="Minimum similarity expected for a match, default is 0.9")
33
+ filters: Optional[FunctionMatchingFilters] = None
34
+ __properties: ClassVar[List[str]] = ["model_id", "function_ids", "min_similarity", "filters"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of FunctionMatchingRequest from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of filters
76
+ if self.filters:
77
+ _dict['filters'] = self.filters.to_dict()
78
+ # set to None if filters (nullable) is None
79
+ # and model_fields_set contains the field
80
+ if self.filters is None and "filters" in self.model_fields_set:
81
+ _dict['filters'] = None
82
+
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of FunctionMatchingRequest from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "model_id": obj.get("model_id"),
96
+ "function_ids": obj.get("function_ids"),
97
+ "min_similarity": obj.get("min_similarity") if obj.get("min_similarity") is not None else 0.9,
98
+ "filters": FunctionMatchingFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None
99
+ })
100
+ return _obj
101
+
102
+
@@ -0,0 +1,106 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ RevEng.AI API
5
+
6
+ RevEng.AI is Similarity Search Engine for executable binaries
7
+
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+
14
+ from __future__ import annotations
15
+ import pprint
16
+ import re # noqa: F401
17
+ import json
18
+
19
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
20
+ from typing import Any, ClassVar, Dict, List, Optional, Union
21
+ from revengai.models.matched_function import MatchedFunction
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class FunctionMatchingResultWithBestMatch(BaseModel):
26
+ """
27
+ FunctionMatchingResultWithBestMatch
28
+ """ # noqa: E501
29
+ function_id: StrictInt
30
+ matched_function: MatchedFunction
31
+ suggested_name: Optional[StrictStr] = None
32
+ suggested_name_confidence: Optional[Union[StrictFloat, StrictInt]] = None
33
+ __properties: ClassVar[List[str]] = ["function_id", "matched_function", "suggested_name", "suggested_name_confidence"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of FunctionMatchingResultWithBestMatch from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of matched_function
75
+ if self.matched_function:
76
+ _dict['matched_function'] = self.matched_function.to_dict()
77
+ # set to None if suggested_name (nullable) is None
78
+ # and model_fields_set contains the field
79
+ if self.suggested_name is None and "suggested_name" in self.model_fields_set:
80
+ _dict['suggested_name'] = None
81
+
82
+ # set to None if suggested_name_confidence (nullable) is None
83
+ # and model_fields_set contains the field
84
+ if self.suggested_name_confidence is None and "suggested_name_confidence" in self.model_fields_set:
85
+ _dict['suggested_name_confidence'] = None
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of FunctionMatchingResultWithBestMatch from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "function_id": obj.get("function_id"),
100
+ "matched_function": MatchedFunction.from_dict(obj["matched_function"]) if obj.get("matched_function") is not None else None,
101
+ "suggested_name": obj.get("suggested_name"),
102
+ "suggested_name_confidence": obj.get("suggested_name_confidence")
103
+ })
104
+ return _obj
105
+
106
+