reait 1.2.0__py3-none-any.whl → 1.2.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.
- reait/api.py +46 -36
- {reait-1.2.0.dist-info → reait-1.2.2.dist-info}/METADATA +1 -1
- reait-1.2.2.dist-info/RECORD +9 -0
- {reait-1.2.0.dist-info → reait-1.2.2.dist-info}/WHEEL +1 -1
- reait-1.2.0.dist-info/RECORD +0 -9
- {reait-1.2.0.dist-info → reait-1.2.2.dist-info}/entry_points.txt +0 -0
- {reait-1.2.0.dist-info → reait-1.2.2.dist-info}/licenses/LICENSE +0 -0
- {reait-1.2.0.dist-info → reait-1.2.2.dist-info}/top_level.txt +0 -0
reait/api.py
CHANGED
@@ -15,7 +15,7 @@ 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.2"
|
19
19
|
|
20
20
|
re_conf = {
|
21
21
|
"apikey": environ.get("REAI_API_KEY", ""),
|
@@ -335,43 +335,25 @@ def RE_upload(fpath: str) -> Response:
|
|
335
335
|
:param fpath: File path for binary to analyse
|
336
336
|
"""
|
337
337
|
bin_id = re_binary_id(fpath)
|
338
|
-
result = re_hash_check(bin_id)
|
339
338
|
|
340
|
-
|
339
|
+
with open(fpath, "rb") as fd:
|
340
|
+
res: Response = reveng_req(
|
341
|
+
requests.post, "v1/upload", files={"file": fd})
|
342
|
+
|
343
|
+
if res.ok:
|
341
344
|
logger.info(
|
342
|
-
"
|
343
|
-
|
344
|
-
|
345
|
-
res.
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
.format("{", bin_id, "}")
|
354
|
-
.encode()
|
345
|
+
"Successfully uploaded binary to your account. %s - %s", fpath, bin_id
|
346
|
+
)
|
347
|
+
elif res.status_code == 400:
|
348
|
+
if "error" in res.json().keys():
|
349
|
+
logger.warning("Error uploading %s - %s",
|
350
|
+
fpath, res.json()["error"])
|
351
|
+
elif res.status_code == 413:
|
352
|
+
logger.warning("File too large. Please upload files under 10MB.")
|
353
|
+
elif res.status_code == 500:
|
354
|
+
logger.error(
|
355
|
+
"Internal Server Error. Please contact support. Skipping upload..."
|
355
356
|
)
|
356
|
-
else:
|
357
|
-
with open(fpath, "rb") as fd:
|
358
|
-
res: Response = reveng_req(
|
359
|
-
requests.post, "v1/upload", files={"file": fd})
|
360
|
-
|
361
|
-
if res.ok:
|
362
|
-
logger.info(
|
363
|
-
"Successfully uploaded binary to your account. %s - %s", fpath, bin_id
|
364
|
-
)
|
365
|
-
elif res.status_code == 400:
|
366
|
-
if "error" in res.json().keys():
|
367
|
-
logger.warning("Error uploading %s - %s",
|
368
|
-
fpath, res.json()["error"])
|
369
|
-
elif res.status_code == 413:
|
370
|
-
logger.warning("File too large. Please upload files under 10MB.")
|
371
|
-
elif res.status_code == 500:
|
372
|
-
logger.error(
|
373
|
-
"Internal Server Error. Please contact support. Skipping upload..."
|
374
|
-
)
|
375
357
|
|
376
358
|
res.raise_for_status()
|
377
359
|
return res
|
@@ -760,7 +742,7 @@ def RE_functions_list(
|
|
760
742
|
|
761
743
|
res: Response = reveng_req(
|
762
744
|
requests.get,
|
763
|
-
f"v2/analyses/{analysis_id}/
|
745
|
+
f"/v2/analyses/{analysis_id}/functions/list",
|
764
746
|
params=params
|
765
747
|
)
|
766
748
|
|
@@ -1301,3 +1283,31 @@ def RE_similar_functions(
|
|
1301
1283
|
|
1302
1284
|
res.raise_for_status()
|
1303
1285
|
return res
|
1286
|
+
|
1287
|
+
|
1288
|
+
def RE_binary_ann(
|
1289
|
+
analysis_id: int,
|
1290
|
+
confidence: float = 0.0,
|
1291
|
+
nns: int = 1,
|
1292
|
+
collection_ids: list[int] = None,
|
1293
|
+
binary_ids: list[int] = None,
|
1294
|
+
) -> Response:
|
1295
|
+
"""
|
1296
|
+
Perform binary ANN (Approximate Nearest Neighbor) search.
|
1297
|
+
:param analysis_id: Analysis ID
|
1298
|
+
:param confidence: Confidence threshold for the search
|
1299
|
+
:param nns: Number of nearest neighbors to retrieve
|
1300
|
+
:param collection_ids: List of collection IDs to search within
|
1301
|
+
:param binary_ids: List of binary IDs to search within
|
1302
|
+
"""
|
1303
|
+
end_point = f"v2/binary_ann/{analysis_id}"
|
1304
|
+
json_data = {
|
1305
|
+
"confidence": confidence,
|
1306
|
+
"nns": nns,
|
1307
|
+
"collection_ids": collection_ids or [],
|
1308
|
+
"binary_ids": binary_ids or [],
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
res: Response = reveng_req(requests.post, end_point, json_data=json_data)
|
1312
|
+
res.raise_for_status()
|
1313
|
+
return res
|
@@ -0,0 +1,9 @@
|
|
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,,
|
reait-1.2.0.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
reait/__init__.py,sha256=EoVCKwQwWxEBfwe-iEE5rFKvhi1gPEA8NPhnzXJTb2Y,42
|
2
|
-
reait/api.py,sha256=OzRPRgXAfOUmdPWx7b7_CwKfZ6OoT1VK07VYTSmWnB4,36646
|
3
|
-
reait/main.py,sha256=rSzEowDrK2KFmmLdbRNVsfVpvMLZNXA3fQOrBw03T4Y,20396
|
4
|
-
reait-1.2.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
5
|
-
reait-1.2.0.dist-info/METADATA,sha256=AQusdz1uqsRJ1qdlnlV10OlEKGlaR0n-L5vk1pt8_u4,47663
|
6
|
-
reait-1.2.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
7
|
-
reait-1.2.0.dist-info/entry_points.txt,sha256=8Ek11o7a6O8hjBFw6-1vmkBfbv_45O2vOKj5CDUB1e4,42
|
8
|
-
reait-1.2.0.dist-info/top_level.txt,sha256=EnJssmctKe3Ugjcmu66L9_Q4elLdAwaXK6M8E6E8f_M,6
|
9
|
-
reait-1.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|