Skip to content

Commit 5ffa8d9

Browse files
removed private naming of API and fixed num_retries issue
1 parent a6d68cc commit 5ffa8d9

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

inquestlabs.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __init__ (self, api_key=None, config=None, proxies=None, base_url=None, retr
107107
self.api_key = api_key
108108
self.base_url = base_url
109109
self.config_file = config
110-
self.num_retries = retries
110+
self.retries = retries
111111
self.proxies = proxies
112112
self.verify_ssl = verify_ssl
113113
self.verbosity = verbose
@@ -176,7 +176,7 @@ def __init__ (self, api_key=None, config=None, proxies=None, base_url=None, retr
176176
self.__VERBOSE("api_key_source=%s" % self.api_key_source, INFO)
177177

178178
####################################################################################################################
179-
def __API (self, api, data=None, path=None, method="GET", raw=False):
179+
def API (self, api, data=None, path=None, method="GET", raw=False):
180180
"""
181181
Internal API wrapper.
182182
@@ -429,7 +429,7 @@ def dfi_attributes (self, sha256, filter_by=None):
429429
raise inquestlabs_exception(message)
430430

431431
# dance with the API.
432-
attributes = self.__API("/dfi/details/attributes", dict(sha256=sha256))
432+
attributes = self.API("/dfi/details/attributes", dict(sha256=sha256))
433433

434434
# filter if necessary.
435435
if filter_by:
@@ -499,7 +499,7 @@ def dfi_details (self, sha256, attributes=False):
499499
assert self.is_sha256(sha256)
500500

501501
# API dance.
502-
data = self.__API("/dfi/details", dict(sha256=sha256))
502+
data = self.API("/dfi/details", dict(sha256=sha256))
503503

504504
if attributes:
505505
data['attributes'] = self.dfi_attributes(sha256)
@@ -521,7 +521,7 @@ def dfi_download (self, sha256, path):
521521

522522
# NOTE: we're reading the file directly into memory here! not worried about it as the files are small and we
523523
# done anticipate any OOM issues.
524-
data = self.__API("/dfi/download", dict(sha256=sha256), raw=True)
524+
data = self.API("/dfi/download", dict(sha256=sha256), raw=True)
525525

526526
# ensure we got what we were looking for.
527527
calculated = self.sha256(bytes=data)
@@ -575,7 +575,7 @@ def dfi_list (self, malicious=None, kind=None, has_code=None, has_context=None,
575575

576576
filtered = []
577577

578-
for entry in self.__API("/dfi/list"):
578+
for entry in self.API("/dfi/list"):
579579

580580
# process filters as disqualifiers.
581581
if malicious == True and entry['classification'] != "MALICIOUS":
@@ -666,7 +666,7 @@ def dfi_search (self, category, subcategory, keyword):
666666
else:
667667
data = dict(keyword=keyword)
668668

669-
return self.__API("/dfi/search/%s/%s" % (category, subcategory), data)
669+
return self.API("/dfi/search/%s/%s" % (category, subcategory), data)
670670

671671
####################################################################################################################
672672
def dfi_sources (self):
@@ -678,7 +678,7 @@ def dfi_sources (self):
678678
:return: API response.
679679
"""
680680

681-
return self.__API("/dfi/sources")
681+
return self.API("/dfi/sources")
682682

683683
####################################################################################################################
684684
def dfi_upload (self, path):
@@ -707,7 +707,7 @@ def dfi_upload (self, path):
707707
raise inquestlabs_exception(message)
708708

709709
# dance with the API.
710-
return self.__API("/dfi/upload", method="POST", path=path)
710+
return self.API("/dfi/upload", method="POST", path=path)
711711

712712
####################################################################################################################
713713
def iocdb_list (self, kind=None, ref_link_keyword=None, ref_text_keyword=None):
@@ -735,7 +735,7 @@ def iocdb_list (self, kind=None, ref_link_keyword=None, ref_text_keyword=None):
735735

736736
filtered = []
737737

738-
for entry in self.__API("/iocdb/list"):
738+
for entry in self.API("/iocdb/list"):
739739

740740
# process filters as disqualifiers.
741741
if kind is not None and not entry['artifact_type'].startswith(kind.lower()):
@@ -764,7 +764,7 @@ def iocdb_search (self, keyword):
764764
:return: API response.
765765
"""
766766

767-
return self.__API("/iocdb/search", dict(keyword=keyword))
767+
return self.API("/iocdb/search", dict(keyword=keyword))
768768

769769
####################################################################################################################
770770
def iocdb_sources (self):
@@ -775,7 +775,7 @@ def iocdb_sources (self):
775775
:return: API response.
776776
"""
777777

778-
return self.__API("/iocdb/sources")
778+
return self.API("/iocdb/sources")
779779

780780
####################################################################################################################
781781
def rate_limit_banner (self):
@@ -825,7 +825,7 @@ def repdb_list (self, kind=None, source=None):
825825

826826
filtered = []
827827

828-
for entry in self.__API("/repdb/list"):
828+
for entry in self.API("/repdb/list"):
829829

830830
# process filters as disqualifiers.
831831
if kind is not None and not entry['data_type'].startswith(kind.lower()):
@@ -851,7 +851,7 @@ def repdb_search (self, keyword):
851851
:return: API response.
852852
"""
853853

854-
return self.__API("/repdb/search", dict(keyword=keyword))
854+
return self.API("/repdb/search", dict(keyword=keyword))
855855

856856
####################################################################################################################
857857
def repdb_sources (self):
@@ -862,7 +862,7 @@ def repdb_sources (self):
862862
:return: API response.
863863
"""
864864

865-
return self.__API("/repdb/sources")
865+
return self.API("/repdb/sources")
866866

867867
####################################################################################################################
868868
def stats (self):
@@ -873,7 +873,7 @@ def stats (self):
873873
:return: List of dictionaries.
874874
"""
875875

876-
return self.__API("/stats")
876+
return self.API("/stats")
877877

878878
####################################################################################################################
879879
def yara_b64re (self, regex, endian=None):
@@ -905,7 +905,7 @@ def yara_b64re (self, regex, endian=None):
905905
raise inquestlabs_exception("invalid endianess supplied to yara_b64re: %s" % endian)
906906

907907
# dance with the API and return results.
908-
return self.__API("/yara/base64re", data)
908+
return self.API("/yara/base64re", data)
909909

910910
####################################################################################################################
911911
def yara_hexcase (self, instring):
@@ -919,7 +919,7 @@ def yara_hexcase (self, instring):
919919
:return: Mixed hex case insensitive regular expression.
920920
"""
921921

922-
return self.__API("/yara/mixcase", dict(instring=instring))
922+
return self.API("/yara/mixcase", dict(instring=instring))
923923

924924
####################################################################################################################
925925
def yara_widere (self, regex, endian=None):
@@ -948,7 +948,7 @@ def yara_widere (self, regex, endian=None):
948948
raise inquestlabs_exception("invalid endianess supplied to yara_b64re: %s" % endian)
949949

950950
# dance with the API and return results.
951-
return self.__API("/yara/widere", data)
951+
return self.API("/yara/widere", data)
952952

953953
####################################################################################################################
954954
def yara_uint (self, magic, offset=0, is_hex=False):
@@ -967,7 +967,7 @@ def yara_uint (self, magic, offset=0, is_hex=False):
967967
:return: YARA condition looking for magic at offset via uint() magic.
968968
"""
969969

970-
return self.__API("/yara/trigger", dict(trigger=magic, offset=offset, is_hex=is_hex))
970+
return self.API("/yara/trigger", dict(trigger=magic, offset=offset, is_hex=is_hex))
971971

972972
########################################################################################################################
973973
########################################################################################################################

0 commit comments

Comments
 (0)