@@ -107,7 +107,7 @@ def __init__ (self, api_key=None, config=None, proxies=None, base_url=None, retr
107
107
self .api_key = api_key
108
108
self .base_url = base_url
109
109
self .config_file = config
110
- self .num_retries = retries
110
+ self .retries = retries
111
111
self .proxies = proxies
112
112
self .verify_ssl = verify_ssl
113
113
self .verbosity = verbose
@@ -176,7 +176,7 @@ def __init__ (self, api_key=None, config=None, proxies=None, base_url=None, retr
176
176
self .__VERBOSE ("api_key_source=%s" % self .api_key_source , INFO )
177
177
178
178
####################################################################################################################
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 ):
180
180
"""
181
181
Internal API wrapper.
182
182
@@ -429,7 +429,7 @@ def dfi_attributes (self, sha256, filter_by=None):
429
429
raise inquestlabs_exception (message )
430
430
431
431
# dance with the API.
432
- attributes = self .__API ("/dfi/details/attributes" , dict (sha256 = sha256 ))
432
+ attributes = self .API ("/dfi/details/attributes" , dict (sha256 = sha256 ))
433
433
434
434
# filter if necessary.
435
435
if filter_by :
@@ -499,7 +499,7 @@ def dfi_details (self, sha256, attributes=False):
499
499
assert self .is_sha256 (sha256 )
500
500
501
501
# API dance.
502
- data = self .__API ("/dfi/details" , dict (sha256 = sha256 ))
502
+ data = self .API ("/dfi/details" , dict (sha256 = sha256 ))
503
503
504
504
if attributes :
505
505
data ['attributes' ] = self .dfi_attributes (sha256 )
@@ -521,7 +521,7 @@ def dfi_download (self, sha256, path):
521
521
522
522
# NOTE: we're reading the file directly into memory here! not worried about it as the files are small and we
523
523
# 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 )
525
525
526
526
# ensure we got what we were looking for.
527
527
calculated = self .sha256 (bytes = data )
@@ -575,7 +575,7 @@ def dfi_list (self, malicious=None, kind=None, has_code=None, has_context=None,
575
575
576
576
filtered = []
577
577
578
- for entry in self .__API ("/dfi/list" ):
578
+ for entry in self .API ("/dfi/list" ):
579
579
580
580
# process filters as disqualifiers.
581
581
if malicious == True and entry ['classification' ] != "MALICIOUS" :
@@ -666,7 +666,7 @@ def dfi_search (self, category, subcategory, keyword):
666
666
else :
667
667
data = dict (keyword = keyword )
668
668
669
- return self .__API ("/dfi/search/%s/%s" % (category , subcategory ), data )
669
+ return self .API ("/dfi/search/%s/%s" % (category , subcategory ), data )
670
670
671
671
####################################################################################################################
672
672
def dfi_sources (self ):
@@ -678,7 +678,7 @@ def dfi_sources (self):
678
678
:return: API response.
679
679
"""
680
680
681
- return self .__API ("/dfi/sources" )
681
+ return self .API ("/dfi/sources" )
682
682
683
683
####################################################################################################################
684
684
def dfi_upload (self , path ):
@@ -707,7 +707,7 @@ def dfi_upload (self, path):
707
707
raise inquestlabs_exception (message )
708
708
709
709
# dance with the API.
710
- return self .__API ("/dfi/upload" , method = "POST" , path = path )
710
+ return self .API ("/dfi/upload" , method = "POST" , path = path )
711
711
712
712
####################################################################################################################
713
713
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):
735
735
736
736
filtered = []
737
737
738
- for entry in self .__API ("/iocdb/list" ):
738
+ for entry in self .API ("/iocdb/list" ):
739
739
740
740
# process filters as disqualifiers.
741
741
if kind is not None and not entry ['artifact_type' ].startswith (kind .lower ()):
@@ -764,7 +764,7 @@ def iocdb_search (self, keyword):
764
764
:return: API response.
765
765
"""
766
766
767
- return self .__API ("/iocdb/search" , dict (keyword = keyword ))
767
+ return self .API ("/iocdb/search" , dict (keyword = keyword ))
768
768
769
769
####################################################################################################################
770
770
def iocdb_sources (self ):
@@ -775,7 +775,7 @@ def iocdb_sources (self):
775
775
:return: API response.
776
776
"""
777
777
778
- return self .__API ("/iocdb/sources" )
778
+ return self .API ("/iocdb/sources" )
779
779
780
780
####################################################################################################################
781
781
def rate_limit_banner (self ):
@@ -825,7 +825,7 @@ def repdb_list (self, kind=None, source=None):
825
825
826
826
filtered = []
827
827
828
- for entry in self .__API ("/repdb/list" ):
828
+ for entry in self .API ("/repdb/list" ):
829
829
830
830
# process filters as disqualifiers.
831
831
if kind is not None and not entry ['data_type' ].startswith (kind .lower ()):
@@ -851,7 +851,7 @@ def repdb_search (self, keyword):
851
851
:return: API response.
852
852
"""
853
853
854
- return self .__API ("/repdb/search" , dict (keyword = keyword ))
854
+ return self .API ("/repdb/search" , dict (keyword = keyword ))
855
855
856
856
####################################################################################################################
857
857
def repdb_sources (self ):
@@ -862,7 +862,7 @@ def repdb_sources (self):
862
862
:return: API response.
863
863
"""
864
864
865
- return self .__API ("/repdb/sources" )
865
+ return self .API ("/repdb/sources" )
866
866
867
867
####################################################################################################################
868
868
def stats (self ):
@@ -873,7 +873,7 @@ def stats (self):
873
873
:return: List of dictionaries.
874
874
"""
875
875
876
- return self .__API ("/stats" )
876
+ return self .API ("/stats" )
877
877
878
878
####################################################################################################################
879
879
def yara_b64re (self , regex , endian = None ):
@@ -905,7 +905,7 @@ def yara_b64re (self, regex, endian=None):
905
905
raise inquestlabs_exception ("invalid endianess supplied to yara_b64re: %s" % endian )
906
906
907
907
# dance with the API and return results.
908
- return self .__API ("/yara/base64re" , data )
908
+ return self .API ("/yara/base64re" , data )
909
909
910
910
####################################################################################################################
911
911
def yara_hexcase (self , instring ):
@@ -919,7 +919,7 @@ def yara_hexcase (self, instring):
919
919
:return: Mixed hex case insensitive regular expression.
920
920
"""
921
921
922
- return self .__API ("/yara/mixcase" , dict (instring = instring ))
922
+ return self .API ("/yara/mixcase" , dict (instring = instring ))
923
923
924
924
####################################################################################################################
925
925
def yara_widere (self , regex , endian = None ):
@@ -948,7 +948,7 @@ def yara_widere (self, regex, endian=None):
948
948
raise inquestlabs_exception ("invalid endianess supplied to yara_b64re: %s" % endian )
949
949
950
950
# dance with the API and return results.
951
- return self .__API ("/yara/widere" , data )
951
+ return self .API ("/yara/widere" , data )
952
952
953
953
####################################################################################################################
954
954
def yara_uint (self , magic , offset = 0 , is_hex = False ):
@@ -967,7 +967,7 @@ def yara_uint (self, magic, offset=0, is_hex=False):
967
967
:return: YARA condition looking for magic at offset via uint() magic.
968
968
"""
969
969
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 ))
971
971
972
972
########################################################################################################################
973
973
########################################################################################################################
0 commit comments