reait 1.2.1__tar.gz → 1.2.2__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.
- {reait-1.2.1 → reait-1.2.2}/PKG-INFO +1 -1
- {reait-1.2.1 → reait-1.2.2}/pyproject.toml +1 -1
- {reait-1.2.1 → reait-1.2.2}/src/reait/api.py +45 -35
- {reait-1.2.1 → reait-1.2.2}/src/reait.egg-info/PKG-INFO +1 -1
- {reait-1.2.1 → reait-1.2.2}/LICENSE +0 -0
- {reait-1.2.1 → reait-1.2.2}/README.md +0 -0
- {reait-1.2.1 → reait-1.2.2}/requirements.txt +0 -0
- {reait-1.2.1 → reait-1.2.2}/setup.cfg +0 -0
- {reait-1.2.1 → reait-1.2.2}/setup.py +0 -0
- {reait-1.2.1 → reait-1.2.2}/src/reait/__init__.py +0 -0
- {reait-1.2.1 → reait-1.2.2}/src/reait/main.py +0 -0
- {reait-1.2.1 → reait-1.2.2}/src/reait.egg-info/SOURCES.txt +0 -0
- {reait-1.2.1 → reait-1.2.2}/src/reait.egg-info/dependency_links.txt +0 -0
- {reait-1.2.1 → reait-1.2.2}/src/reait.egg-info/entry_points.txt +0 -0
- {reait-1.2.1 → reait-1.2.2}/src/reait.egg-info/requires.txt +0 -0
- {reait-1.2.1 → reait-1.2.2}/src/reait.egg-info/top_level.txt +0 -0
- {reait-1.2.1 → reait-1.2.2}/tests/test_apis.py +0 -0
- {reait-1.2.1 → reait-1.2.2}/tests/test_reait.py +0 -0
@@ -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
|
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|