Hello community,
here is the log from the commit of package python-shodan for openSUSE:Factory checked in at 2019-10-02 12:00:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-shodan (Old)
and /work/SRC/openSUSE:Factory/.python-shodan.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-shodan"
Wed Oct 2 12:00:43 2019 rev:15 rq:734407 version:1.19.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-shodan/python-shodan.changes 2019-09-11 10:35:35.283292834 +0200
+++ /work/SRC/openSUSE:Factory/.python-shodan.new.2352/python-shodan.changes 2019-10-02 12:00:46.242743358 +0200
@@ -1,0 +2,11 @@
+Tue Oct 1 15:47:16 UTC 2019 - Marketa Calabkova
+
+- Update to 1.19.0
+ * Ability to specify list of fields to include when converting to CSV/ Excel
+ * Filter the Shodan Firehose based on tags in the banner
+ * Fix bug that caused unicode error when printing domain information
+ * Add flag to let users get their IPv6 address shodan myip -6
+ * Add library methods for the new Notifications API
+ * New method to edit the list of IPs for an existing network alert
+
+-------------------------------------------------------------------
Old:
----
shodan-1.15.0.tar.gz
New:
----
shodan-1.19.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-shodan.spec ++++++
--- /var/tmp/diff_new_pack.WJCVoR/_old 2019-10-02 12:00:47.782739411 +0200
+++ /var/tmp/diff_new_pack.WJCVoR/_new 2019-10-02 12:00:47.802739359 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{!?license: %global license %doc}
Name: python-shodan
-Version: 1.15.0
+Version: 1.19.0
Release: 0
Summary: Python library and command-line utility for Shodan
License: MIT
++++++ shodan-1.15.0.tar.gz -> shodan-1.19.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.15.0/CHANGELOG.md new/shodan-1.19.0/CHANGELOG.md
--- old/shodan-1.15.0/CHANGELOG.md 2019-08-13 03:15:35.000000000 +0200
+++ new/shodan-1.19.0/CHANGELOG.md 2019-09-29 20:29:46.000000000 +0200
@@ -1,6 +1,24 @@
CHANGELOG
=========
+1.19.0
+------
+* New method to edit the list of IPs for an existing network alert
+
+1.18.0
+------
+* Add library methods for the new Notifications API
+
+1.17.0
+------
+* Fix bug that caused unicode error when printing domain information (#106)
+* Add flag to let users get their IPv6 address **shodan myip -6**(#35)
+
+1.16.0
+------
+* Ability to specify list of fields to include when converting to CSV/ Excel (#107)
+* Filter the Shodan Firehose based on tags in the banner
+
1.15.0
------
* New option "--skip" for download command to help users resume a download
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.15.0/PKG-INFO new/shodan-1.19.0/PKG-INFO
--- old/shodan-1.15.0/PKG-INFO 2019-08-13 03:40:03.000000000 +0200
+++ new/shodan-1.19.0/PKG-INFO 2019-09-29 20:33:46.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: shodan
-Version: 1.15.0
+Version: 1.19.0
Summary: Python library and command-line utility for Shodan (https://developer.shodan.io)
Home-page: http://github.com/achillean/shodan-python/tree/master
Author: John Matherly
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.15.0/setup.py new/shodan-1.19.0/setup.py
--- old/shodan-1.15.0/setup.py 2019-08-13 03:14:12.000000000 +0200
+++ new/shodan-1.19.0/setup.py 2019-09-29 20:13:33.000000000 +0200
@@ -7,7 +7,7 @@
setup(
name='shodan',
- version='1.15.0',
+ version='1.19.0',
description='Python library and command-line utility for Shodan (https://developer.shodan.io)',
long_description=README,
long_description_content_type='text/x-rst',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.15.0/shodan/__main__.py new/shodan-1.19.0/shodan/__main__.py
--- old/shodan-1.15.0/shodan/__main__.py 2019-08-13 03:22:56.000000000 +0200
+++ new/shodan-1.19.0/shodan/__main__.py 2019-09-22 01:40:22.000000000 +0200
@@ -89,15 +89,23 @@
'xlsx': ExcelConverter,
}
@main.command()
+@click.option('--fields', help='List of properties to output.', default=None)
@click.argument('input', metavar='<input file>')
@click.argument('format', metavar='<output format>', type=click.Choice(CONVERTERS.keys()))
-def convert(input, format):
+def convert(fields, input, format):
"""Convert the given input data file into a different format. The following file formats are supported:
kml, csv, geo.json, images, xlsx
Example: shodan convert data.json.gz kml
"""
+ # Check that the converter allows a custom list of fields
+ converter_class = CONVERTERS.get(format)
+ if fields:
+ if not hasattr(converter_class, 'fields'):
+ raise click.ClickException('File format doesnt support custom list of fields')
+ converter_class.fields = [item.strip() for item in fields.split(',')] # Use the custom fields the user specified
+
# Get the basename for the input file
basename = input.replace('.json.gz', '').replace('.json', '')
@@ -113,7 +121,7 @@
progress_bar_thread.start()
# Initialize the file converter
- converter = CONVERTERS.get(format)(fout)
+ converter = converter_class(fout)
converter.process([input])
@@ -143,7 +151,7 @@
click.echo('')
for record in info['data']:
click.echo(
- '{:32} {:14} {}'.format(
+ u'{:32} {:14} {}'.format(
click.style(record['subdomain'], fg='cyan'),
click.style(record['type'], fg='yellow'),
record['value']
@@ -392,11 +400,17 @@
@main.command()
-def myip():
+@click.option('--ipv6', '-6', is_flag=True, default=False, help='Try to use IPv6 instead of IPv4')
+def myip(ipv6):
"""Print your external IP address"""
key = get_api_key()
api = shodan.Shodan(key)
+
+ # Use the IPv6-enabled domain if requested
+ if ipv6:
+ api.base_url = 'https://apiv6.shodan.io'
+
try:
click.echo(api.tools.myip())
except shodan.APIError as e:
@@ -577,8 +591,9 @@
@click.option('--countries', help='A comma-separated list of countries to grab data on.', default=None, type=str)
@click.option('--asn', help='A comma-separated list of ASNs to grab data on.', default=None, type=str)
@click.option('--alert', help='The network alert ID or "all" to subscribe to all network alerts on your account.', default=None, type=str)
+@click.option('--tags', help='A comma-separated list of tags to grab data on.', default=None, type=str)
@click.option('--compresslevel', help='The gzip compression level (0-9; 0 = no compression, 9 = most compression', default=9, type=int)
-def stream(color, fields, separator, limit, datadir, ports, quiet, timeout, streamer, countries, asn, alert, compresslevel):
+def stream(color, fields, separator, limit, datadir, ports, quiet, timeout, streamer, countries, asn, alert, tags, compresslevel):
"""Stream data in real-time."""
# Setup the Shodan API
key = get_api_key()
@@ -604,9 +619,11 @@
stream_type.append('asn')
if alert:
stream_type.append('alert')
+ if tags:
+ stream_type.append('tags')
if len(stream_type) > 1:
- raise click.ClickException('Please use --ports, --countries OR --asn. You cant subscribe to multiple filtered streams at once.')
+ raise click.ClickException('Please use --ports, --countries, --tags OR --asn. You cant subscribe to multiple filtered streams at once.')
stream_args = None
@@ -627,6 +644,9 @@
if countries:
stream_args = countries.split(',')
+
+ if tags:
+ stream_args = tags.split(',')
# Flatten the list of stream types
# Possible values are:
@@ -647,6 +667,7 @@
'asn': api.stream.asn(args, timeout=timeout),
'countries': api.stream.countries(args, timeout=timeout),
'ports': api.stream.ports(args, timeout=timeout),
+ 'tags': api.stream.tags(args, timeout=timeout),
}.get(name, 'all')
stream = _create_stream(stream_type, stream_args, timeout=timeout)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.15.0/shodan/client.py new/shodan-1.19.0/shodan/client.py
--- old/shodan-1.15.0/shodan/client.py 2019-08-13 03:22:34.000000000 +0200
+++ new/shodan-1.19.0/shodan/client.py 2019-09-29 20:12:51.000000000 +0200
@@ -74,6 +74,72 @@
"""
return self.parent._request('/dns/domain/{}'.format(domain), {})
+ class Notifier:
+
+ def __init__(self, parent):
+ self.parent = parent
+
+ def create(self, provider, args, description=None):
+ """Get the settings for the specified notifier that a user has configured.
+
+ :param provider: Provider name
+ :type provider: str
+ :param args: Provider arguments
+ :type args: dict
+ :param description: Human-friendly description of the notifier
+ :type description: str
+ :returns: dict -- fields are 'success' and 'id' of the notifier
+ """
+ args['provider'] = provider
+
+ if description:
+ args['description'] = description
+
+ return self.parent._request('/notifier', args, method='post')
+
+ def edit(self, nid, args):
+ """Get the settings for the specified notifier that a user has configured.
+
+ :param nid: Notifier ID
+ :type nid: str
+ :param args: Provider arguments
+ :type args: dict
+ :returns: dict -- fields are 'success' and 'id' of the notifier
+ """
+ return self.parent._request('/notifier/{}'.format(nid), args, method='put')
+
+ def get(self, nid):
+ """Get the settings for the specified notifier that a user has configured.
+
+ :param nid: Notifier ID
+ :type nid: str
+ :returns: dict -- object describing the notifier settings
+ """
+ return self.parent._request('/notifier/{}'.format(nid), {})
+
+ def list_notifiers(self):
+ """Returns a list of notifiers that the user has added.
+
+ :returns: A list of notifierse that are available on the account
+ """
+ return self.parent._request('/notifier', {})
+
+ def list_providers(self):
+ """Returns a list of supported notification providers.
+
+ :returns: A list of providers where each object describes a provider
+ """
+ return self.parent._request('/notifier/provider', {})
+
+ def remove(self, nid):
+ """Delete the provided notifier.
+
+ :param nid: Notifier ID
+ :type nid: str
+ :returns: dict -- 'success' set to True if action succeeded
+ """
+ return self.parent._request('/notifier/{}'.format(nid), {}, method='delete')
+
class Tools:
def __init__(self, parent):
@@ -195,6 +261,7 @@
self.dns = self.Dns(self)
self.exploits = self.Exploits(self)
self.labs = self.Labs(self)
+ self.notifier = self.Notifier(self)
self.org = self.Organization(self)
self.tools = self.Tools(self)
self.stream = Stream(key, proxies=proxies)
@@ -573,6 +640,27 @@
return response
+ def edit_alert(self, aid, ip):
+ """Edit the IPs that should be monitored by the alert.
+
+ :param aid: Alert ID
+ :type name: str
+ :param ip: Network range(s) to monitor
+ :type ip: str OR list of str
+
+ :returns: A dict describing the alert
+ """
+ data = {
+ 'filters': {
+ 'ip': ip,
+ },
+ }
+
+ response = api_request(self.api_key, '/shodan/alert/{}'.format(aid), data=data, params={}, method='post',
+ proxies=self._session.proxies)
+
+ return response
+
def alerts(self, aid=None, include_expired=True):
"""List all of the active alerts that the user created."""
if aid:
@@ -617,3 +705,11 @@
def unignore_alert_trigger_notification(self, aid, trigger, ip, port):
"""Re-enable trigger notifications for the provided IP and port"""
return self._request('/shodan/alert/{}/trigger/{}/ignore/{}:{}'.format(aid, trigger, ip, port), {}, method='delete')
+
+ def add_alert_notifier(self, aid, nid):
+ """Enable the given notifier for an alert that has triggers enabled."""
+ return self._request('/shodan/alert/{}/notifier/{}'.format(aid, nid), {}, method='put')
+
+ def remove_alert_notifier(self, aid, nid):
+ """Remove the given notifier for an alert that has triggers enabled."""
+ return self._request('/shodan/alert/{}/notifier/{}'.format(aid, nid), {}, method='delete')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.15.0/shodan/stream.py new/shodan-1.19.0/shodan/stream.py
--- old/shodan-1.15.0/shodan/stream.py 2019-02-11 01:05:46.000000000 +0100
+++ new/shodan-1.19.0/shodan/stream.py 2019-09-21 19:00:41.000000000 +0200
@@ -123,3 +123,14 @@
stream = self._create_stream('/shodan/ports/%s' % ','.join([str(port) for port in ports]), timeout=timeout)
for line in self._iter_stream(stream, raw):
yield line
+
+ def tags(self, tags, raw=False, timeout=None):
+ """
+ A filtered version of the "banners" stream to only return banners that match the tags of interest.
+
+ :param tags: A list of tags to return banner data on.
+ :type tags: string[]
+ """
+ stream = self._create_stream('/shodan/tags/%s' % ','.join(tags), timeout=timeout)
+ for line in self._iter_stream(stream, raw):
+ yield line
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.15.0/shodan.egg-info/PKG-INFO new/shodan-1.19.0/shodan.egg-info/PKG-INFO
--- old/shodan-1.15.0/shodan.egg-info/PKG-INFO 2019-08-13 03:40:03.000000000 +0200
+++ new/shodan-1.19.0/shodan.egg-info/PKG-INFO 2019-09-29 20:33:46.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: shodan
-Version: 1.15.0
+Version: 1.19.0
Summary: Python library and command-line utility for Shodan (https://developer.shodan.io)
Home-page: http://github.com/achillean/shodan-python/tree/master
Author: John Matherly