Skip to content

Commit 8adbcdb

Browse files
committed
Update client.py
Bulk api v2
1 parent 9216fa2 commit 8adbcdb

File tree

1 file changed

+207
-0
lines changed

1 file changed

+207
-0
lines changed

onyphe/client.py

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,213 @@ def bulk_summary_hostname(self, path):
451451
else:
452452
raise ParamError('%s is no a file' % path)
453453

454+
def bulk__simple_ctl_ip(self, path):
455+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/ctl/ip
456+
457+
:param path: path of the files with IPs
458+
:type path:str
459+
:return: dict -- a dictionary with result
460+
"""
461+
if os.path.isfile(path):
462+
463+
file_iocs = open(path, 'rb')
464+
return self._prepare_request('/'.join([self.version,
465+
'bulk/simple/ctl/ip']),
466+
method='post', files=file_iocs)
467+
else:
468+
raise ParamError('%s is no a file' % path)
469+
470+
def bulk_simple_datascan_ip(self, path):
471+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/datascan/ip
472+
473+
:param path: path of the files with IPs
474+
:type path:str
475+
:return: dict -- a dictionary with result
476+
"""
477+
if os.path.isfile(path):
478+
479+
file_iocs = open(path, 'rb')
480+
return self._prepare_request('/'.join([self.version,
481+
'bulk/simple/datascan/ip']),
482+
method='post', files=file_iocs)
483+
else:
484+
raise ParamError('%s is no a file' % path)
485+
486+
def bulk_simple_datashot_ip(self, path):
487+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/datashot/ip
488+
489+
:param path: path of the files with IPs
490+
:type path:str
491+
:return: dict -- a dictionary with result
492+
"""
493+
if os.path.isfile(path):
494+
495+
file_iocs = open(path, 'rb')
496+
return self._prepare_request('/'.join([self.version,
497+
'bulk/simple/datashot/ip']),
498+
method='post', files=file_iocs)
499+
else:
500+
raise ParamError('%s is no a file' % path)
501+
502+
def bulk_simple_geoloc_ip(self, path):
503+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/geoloc/ip
504+
505+
:param path: path of the files with IPs
506+
:type path:str
507+
:return: dict -- a dictionary with result
508+
"""
509+
if os.path.isfile(path):
510+
511+
file_iocs = open(path, 'rb')
512+
return self._prepare_request('/'.join([self.version,
513+
'bulk/simple/geoloc/ip']),
514+
method='post', files=file_iocs)
515+
else:
516+
raise ParamError('%s is no a file' % path)
517+
518+
def bulk_simple_inetnum_ip(self, path):
519+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/inetnum/ip
520+
521+
:param path: path of the files with IPs
522+
:type path:str
523+
:return: dict -- a dictionary with result
524+
"""
525+
if os.path.isfile(path):
526+
527+
file_iocs = open(path, 'rb')
528+
return self._prepare_request('/'.join([self.version,
529+
'bulk/simple/inetnum/ip']),
530+
method='post', files=file_iocs)
531+
else:
532+
raise ParamError('%s is no a file' % path)
533+
534+
def bulk_simple_pastries_ip(self, path):
535+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/pastries/ip
536+
537+
:param path: path of the files with IPs
538+
:type path:str
539+
:return: dict -- a dictionary with result
540+
"""
541+
if os.path.isfile(path):
542+
543+
file_iocs = open(path, 'rb')
544+
return self._prepare_request('/'.join([self.version,
545+
'bulk/simple/pastries/ip']),
546+
method='post', files=file_iocs)
547+
else:
548+
raise ParamError('%s is no a file' % path)
549+
550+
def bulk_simple_resolver_ip(self, path):
551+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/resolver/ip
552+
553+
:param path: path of the files with IPs
554+
:type path:str
555+
:return: dict -- a dictionary with result
556+
"""
557+
if os.path.isfile(path):
558+
559+
file_iocs = open(path, 'rb')
560+
return self._prepare_request('/'.join([self.version,
561+
'bulk/simple/resolver/ip']),
562+
method='post', files=file_iocs)
563+
else:
564+
raise ParamError('%s is no a file' % path)
565+
566+
def bulk_simple_sniffer_ip(self, path):
567+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/sniffer/ip
568+
569+
:param path: path of the files with IPs
570+
:type path:str
571+
:return: dict -- a dictionary with result
572+
"""
573+
if os.path.isfile(path):
574+
575+
file_iocs = open(path, 'rb')
576+
return self._prepare_request('/'.join([self.version,
577+
'bulk/simple/sniffer/ip']),
578+
method='post', files=file_iocs)
579+
else:
580+
raise ParamError('%s is no a file' % path)
581+
582+
def bulk_simple_synscan_ip(self, path):
583+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/synscan/ip
584+
585+
:param path: path of the files with IPs
586+
:type path:str
587+
:return: dict -- a dictionary with result
588+
"""
589+
if os.path.isfile(path):
590+
591+
file_iocs = open(path, 'rb')
592+
return self._prepare_request('/'.join([self.version,
593+
'bulk/simple/synscan/ip']),
594+
method='post', files=file_iocs)
595+
else:
596+
raise ParamError('%s is no a file' % path)
597+
598+
def bulk_simple_threatlist_ip(self, path):
599+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/threatlist/ip
600+
601+
:param path: path of the files with IPs
602+
:type path:str
603+
:return: dict -- a dictionary with result
604+
"""
605+
if os.path.isfile(path):
606+
607+
file_iocs = open(path, 'rb')
608+
return self._prepare_request('/'.join([self.version,
609+
'bulk/simple/threatlist/ip']),
610+
method='post', files=file_iocs)
611+
else:
612+
raise ParamError('%s is no a file' % path)
613+
614+
def bulk_simple_topsite_ip(self, path):
615+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/topsite/ip
616+
617+
:param path: path of the files with IPs
618+
:type path:str
619+
:return: dict -- a dictionary with result
620+
"""
621+
if os.path.isfile(path):
622+
623+
file_iocs = open(path, 'rb')
624+
return self._prepare_request('/'.join([self.version,
625+
'bulk/simple/topsite/ip']),
626+
method='post', files=file_iocs)
627+
else:
628+
raise ParamError('%s is no a file' % path)
629+
630+
def bulk_simple_vulnscan_ip(self, path):
631+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/vulnscan/ip
632+
633+
:param path: path of the files with IPs
634+
:type path:str
635+
:return: dict -- a dictionary with result
636+
"""
637+
if os.path.isfile(path):
638+
639+
file_iocs = open(path, 'rb')
640+
return self._prepare_request('/'.join([self.version,
641+
'bulk/simple/vulnscan/ip']),
642+
method='post', files=file_iocs)
643+
else:
644+
raise ParamError('%s is no a file' % path)
645+
646+
def bulk_simple_whois_ip(self, path):
647+
"""Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/whois/ip
648+
649+
:param path: path of the files with IPs
650+
:type path:str
651+
:return: dict -- a dictionary with result
652+
"""
653+
if os.path.isfile(path):
654+
655+
file_iocs = open(path, 'rb')
656+
return self._prepare_request('/'.join([self.version,
657+
'bulk/simple/whois/ip']),
658+
method='post', files=file_iocs)
659+
else:
660+
raise ParamError('%s is no a file' % path)
454661
def export(self, query):
455662
"""Call API Onyphe https://www.onyphe.io/api/v2/export/
456663
:param query: example: category:datascan product:Nginx protocol:http os:Windows tls:true

0 commit comments

Comments
 (0)