reait 1.2.2__py3-none-any.whl → 1.2.3__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.
- reait/api.py +97 -25
- {reait-1.2.2.dist-info → reait-1.2.3.dist-info}/METADATA +1 -1
- reait-1.2.3.dist-info/RECORD +9 -0
- reait-1.2.2.dist-info/RECORD +0 -9
- {reait-1.2.2.dist-info → reait-1.2.3.dist-info}/WHEEL +0 -0
- {reait-1.2.2.dist-info → reait-1.2.3.dist-info}/entry_points.txt +0 -0
- {reait-1.2.2.dist-info → reait-1.2.3.dist-info}/licenses/LICENSE +0 -0
- {reait-1.2.2.dist-info → reait-1.2.3.dist-info}/top_level.txt +0 -0
reait/api.py
CHANGED
@@ -15,11 +15,12 @@ from pandas import DataFrame
|
|
15
15
|
from requests import request, Response, HTTPError
|
16
16
|
from sklearn.metrics.pairwise import cosine_similarity
|
17
17
|
|
18
|
-
__version__ = "1.2.
|
18
|
+
__version__ = "1.2.3"
|
19
19
|
|
20
20
|
re_conf = {
|
21
21
|
"apikey": environ.get("REAI_API_KEY", ""),
|
22
22
|
"host": environ.get("REAI_API_HOST", "https://api.reveng.ai"),
|
23
|
+
"user_agent": environ.get("REAI_USER_AGENT", "RevEng.AI Toolkit"),
|
23
24
|
}
|
24
25
|
|
25
26
|
|
@@ -65,7 +66,8 @@ def reveng_req(
|
|
65
66
|
:param files: Dictionary of files to send to the specified URL
|
66
67
|
"""
|
67
68
|
url = f"{re_conf['host']}/{end_point if end_point[0] != '/' else end_point[1:]}"
|
68
|
-
headers = {"Authorization": re_conf["apikey"]
|
69
|
+
headers = {"Authorization": re_conf["apikey"],
|
70
|
+
"User-Agent": re_conf["user_agent"]}
|
69
71
|
|
70
72
|
if ex_headers:
|
71
73
|
headers.update(ex_headers)
|
@@ -246,7 +248,7 @@ def RE_analyse(
|
|
246
248
|
skip_scraping: bool = False,
|
247
249
|
skip_capabilities: bool = False,
|
248
250
|
skip_sbom: bool = False,
|
249
|
-
advanced_analysis: bool = False
|
251
|
+
advanced_analysis: bool = False,
|
250
252
|
) -> Response:
|
251
253
|
"""
|
252
254
|
Start analysis job for binary file
|
@@ -308,7 +310,8 @@ def RE_analyse(
|
|
308
310
|
"skip_scraping",
|
309
311
|
"skip_capabilities",
|
310
312
|
"skip_sbom",
|
311
|
-
"advanced_analysis"
|
313
|
+
"advanced_analysis",
|
314
|
+
"skip_cves",
|
312
315
|
):
|
313
316
|
p_value = locals()[p_name]
|
314
317
|
|
@@ -741,9 +744,7 @@ def RE_functions_list(
|
|
741
744
|
params["max_v_address"] = max_v_address
|
742
745
|
|
743
746
|
res: Response = reveng_req(
|
744
|
-
requests.get,
|
745
|
-
f"/v2/analyses/{analysis_id}/functions/list",
|
746
|
-
params=params
|
747
|
+
requests.get, f"/v2/analyses/{analysis_id}/functions/list", params=params
|
747
748
|
)
|
748
749
|
|
749
750
|
res.raise_for_status()
|
@@ -850,12 +851,10 @@ def _binary_format(binary: Binary) -> str:
|
|
850
851
|
return "Mach-O"
|
851
852
|
|
852
853
|
logger.error(
|
853
|
-
"Error, could not determine or unsupported"
|
854
|
-
f" binary format: {binary.format}."
|
854
|
+
"Error, could not determine or unsupported" f" binary format: {binary.format}."
|
855
855
|
)
|
856
856
|
raise RuntimeError(
|
857
|
-
"Error, could not determine or "
|
858
|
-
f"unsupported binary format: {binary.format}"
|
857
|
+
"Error, could not determine or " f"unsupported binary format: {binary.format}"
|
859
858
|
)
|
860
859
|
|
861
860
|
|
@@ -951,10 +950,7 @@ def RE_functions_data_types_poll(
|
|
951
950
|
return res
|
952
951
|
|
953
952
|
|
954
|
-
def RE_generate_data_types(
|
955
|
-
analysis_id: int,
|
956
|
-
function_ids: list[int]
|
957
|
-
) -> Response:
|
953
|
+
def RE_generate_data_types(analysis_id: int, function_ids: list[int]) -> Response:
|
958
954
|
"""
|
959
955
|
Generate data types for the analysis
|
960
956
|
:param aid: Analysis ID
|
@@ -1014,10 +1010,7 @@ def RE_begin_ai_decompilation(function_id: int) -> Response:
|
|
1014
1010
|
return res
|
1015
1011
|
|
1016
1012
|
|
1017
|
-
def RE_poll_ai_decompilation(
|
1018
|
-
function_id: int,
|
1019
|
-
summarise: bool = False
|
1020
|
-
) -> Response:
|
1013
|
+
def RE_poll_ai_decompilation(function_id: int, summarise: bool = False) -> Response:
|
1021
1014
|
"""
|
1022
1015
|
Poll AI decompilation for the function
|
1023
1016
|
:param function_id: Function ID
|
@@ -1050,9 +1043,9 @@ def RE_analysis_lookup(binary_id: int) -> Response:
|
|
1050
1043
|
|
1051
1044
|
|
1052
1045
|
def RE_collections_search(
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1046
|
+
page: int = 1,
|
1047
|
+
page_size: int = 10,
|
1048
|
+
query: dict = {},
|
1056
1049
|
) -> Response:
|
1057
1050
|
"""
|
1058
1051
|
Search for collections in the database
|
@@ -1092,9 +1085,9 @@ def RE_collections_search(
|
|
1092
1085
|
|
1093
1086
|
|
1094
1087
|
def RE_binaries_search(
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1088
|
+
page: int = 1,
|
1089
|
+
page_size: int = 10,
|
1090
|
+
query: dict = {},
|
1098
1091
|
) -> Response:
|
1099
1092
|
"""
|
1100
1093
|
Search for binaries in the database
|
@@ -1253,6 +1246,40 @@ def RE_recent_analysis(
|
|
1253
1246
|
return res
|
1254
1247
|
|
1255
1248
|
|
1249
|
+
def RE_recent_analysis_v2(
|
1250
|
+
search: str = "",
|
1251
|
+
workspace: str = "personal",
|
1252
|
+
status: str = "All",
|
1253
|
+
users: list[str] = [],
|
1254
|
+
limit: int = 50
|
1255
|
+
) -> Response:
|
1256
|
+
"""
|
1257
|
+
Get recent analysis using the v2 API
|
1258
|
+
:param status: Status of the analysis (default: "All")
|
1259
|
+
:param scope: Scope of the analysis (default: "ALL")
|
1260
|
+
:param nb_analysis: Number of analysis to retrieve (default: 50)
|
1261
|
+
"""
|
1262
|
+
res: Response = reveng_req(
|
1263
|
+
requests.get,
|
1264
|
+
"/v2/analyses/list",
|
1265
|
+
params={
|
1266
|
+
"search_term": search, "status": status, "workspace": workspace,
|
1267
|
+
"limit": limit, "usernames": users},
|
1268
|
+
)
|
1269
|
+
|
1270
|
+
res.raise_for_status()
|
1271
|
+
return res
|
1272
|
+
|
1273
|
+
|
1274
|
+
def RE_users_me() -> Response:
|
1275
|
+
"""
|
1276
|
+
Get the current user's information
|
1277
|
+
"""
|
1278
|
+
res: Response = reveng_req(requests.get, "/v2/users/me")
|
1279
|
+
res.raise_for_status()
|
1280
|
+
return res
|
1281
|
+
|
1282
|
+
|
1256
1283
|
def RE_search(fpath: str) -> Response:
|
1257
1284
|
bin_id = re_binary_id(fpath)
|
1258
1285
|
|
@@ -1311,3 +1338,48 @@ def RE_binary_ann(
|
|
1311
1338
|
res: Response = reveng_req(requests.post, end_point, json_data=json_data)
|
1312
1339
|
res.raise_for_status()
|
1313
1340
|
return res
|
1341
|
+
|
1342
|
+
|
1343
|
+
def RE_name_score(functions: list, is_debug: bool = False) -> Response:
|
1344
|
+
|
1345
|
+
body = {"functions": functions, "is_debug": is_debug}
|
1346
|
+
res: Response = reveng_req(
|
1347
|
+
requests.post, "v2/confidence/functions/name_score", json_data=body
|
1348
|
+
)
|
1349
|
+
|
1350
|
+
res.raise_for_status()
|
1351
|
+
return res
|
1352
|
+
|
1353
|
+
|
1354
|
+
def RE_get_analysis_id_from_binary_id(binary_id: int) -> Response:
|
1355
|
+
|
1356
|
+
res: Response = reveng_req(requests.get, f"v2/analyses/lookup/{binary_id}")
|
1357
|
+
|
1358
|
+
res.raise_for_status()
|
1359
|
+
return res
|
1360
|
+
|
1361
|
+
|
1362
|
+
def RE_get_functions_from_analysis(analysis_id: int) -> Response:
|
1363
|
+
|
1364
|
+
res: Response = reveng_req(
|
1365
|
+
requests.get, f"v2/analyses/{analysis_id}/functions/list"
|
1366
|
+
)
|
1367
|
+
|
1368
|
+
res.raise_for_status()
|
1369
|
+
return res
|
1370
|
+
|
1371
|
+
|
1372
|
+
def RE_update_collection_description(
|
1373
|
+
collection_id: int,
|
1374
|
+
description: str = "",
|
1375
|
+
):
|
1376
|
+
params = {
|
1377
|
+
"description": description,
|
1378
|
+
}
|
1379
|
+
|
1380
|
+
res: Response = reveng_req(
|
1381
|
+
requests.patch, f"v2/collections/{collection_id}", json_data=params
|
1382
|
+
)
|
1383
|
+
|
1384
|
+
res.raise_for_status()
|
1385
|
+
return res
|
@@ -0,0 +1,9 @@
|
|
1
|
+
reait/__init__.py,sha256=EoVCKwQwWxEBfwe-iEE5rFKvhi1gPEA8NPhnzXJTb2Y,42
|
2
|
+
reait/api.py,sha256=Y7SZVr8d8gTE0y1Y7FVpEJGGzWhFtD00aHTtV7VXM8Q,38872
|
3
|
+
reait/main.py,sha256=rSzEowDrK2KFmmLdbRNVsfVpvMLZNXA3fQOrBw03T4Y,20396
|
4
|
+
reait-1.2.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
5
|
+
reait-1.2.3.dist-info/METADATA,sha256=Ue_-BK0dEm_0kI1O4WlBZeiYsvJJKeUyWA8lrYfmcy4,47663
|
6
|
+
reait-1.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
+
reait-1.2.3.dist-info/entry_points.txt,sha256=8Ek11o7a6O8hjBFw6-1vmkBfbv_45O2vOKj5CDUB1e4,42
|
8
|
+
reait-1.2.3.dist-info/top_level.txt,sha256=EnJssmctKe3Ugjcmu66L9_Q4elLdAwaXK6M8E6E8f_M,6
|
9
|
+
reait-1.2.3.dist-info/RECORD,,
|
reait-1.2.2.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
reait/__init__.py,sha256=EoVCKwQwWxEBfwe-iEE5rFKvhi1gPEA8NPhnzXJTb2Y,42
|
2
|
-
reait/api.py,sha256=10D3tITkhQN1mb04hHpgJgq26cii9gpzD2B3jcSxFQ0,36915
|
3
|
-
reait/main.py,sha256=rSzEowDrK2KFmmLdbRNVsfVpvMLZNXA3fQOrBw03T4Y,20396
|
4
|
-
reait-1.2.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
5
|
-
reait-1.2.2.dist-info/METADATA,sha256=WOJrwIHV2HD6zY_g5AyL1i7JJ2knoOM42MNJ6TXAIww,47663
|
6
|
-
reait-1.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
reait-1.2.2.dist-info/entry_points.txt,sha256=8Ek11o7a6O8hjBFw6-1vmkBfbv_45O2vOKj5CDUB1e4,42
|
8
|
-
reait-1.2.2.dist-info/top_level.txt,sha256=EnJssmctKe3Ugjcmu66L9_Q4elLdAwaXK6M8E6E8f_M,6
|
9
|
-
reait-1.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|