Hello community, here is the log from the commit of package python-shodan for openSUSE:Leap:15.2 checked in at 2020-04-30 18:51:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/python-shodan (Old) and /work/SRC/openSUSE:Leap:15.2/.python-shodan.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-shodan" Thu Apr 30 18:51:29 2020 rev:21 rq:794077 version:1.23.0 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/python-shodan/python-shodan.changes 2020-02-10 16:42:35.691751582 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.python-shodan.new.2738/python-shodan.changes 2020-04-30 18:51:32.800611728 +0200 @@ -1,0 +2,19 @@ +Tue Apr 7 07:07:18 UTC 2020 - Sebastian Wagner <[email protected]> + +- update to version 1.23.0: + - Add new CLI command: shodan alert domain + +------------------------------------------------------------------- +Fri Mar 27 18:31:29 UTC 2020 - Sebastian Wagner <[email protected]> + +- update to version 1.22.1: + - vulns: Fix bug when converting data file to CSV using Python3 + +------------------------------------------------------------------- +Fri Mar 27 10:45:45 UTC 2020 - [email protected] + +- version update to 1.22.0 + * New Streaming API method: /shodan/vulns/{vulns} to subscribe to IPs + that are vulnerable to an issue + +------------------------------------------------------------------- Old: ---- shodan-1.21.3.tar.gz New: ---- shodan-1.23.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-shodan.spec ++++++ --- /var/tmp/diff_new_pack.v2TytW/_old 2020-04-30 18:51:33.440613091 +0200 +++ /var/tmp/diff_new_pack.v2TytW/_new 2020-04-30 18:51:33.444613100 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %{!?license: %global license %doc} Name: python-shodan -Version: 1.21.3 +Version: 1.23.0 Release: 0 Summary: Python library and command-line utility for Shodan License: MIT @@ -77,7 +77,7 @@ %files %{python_files} %doc AUTHORS README.rst -%%license LICENSE +%license LICENSE %python3_only %{_bindir}/shodan %{python_sitelib}/* %python3_only %{_mandir}/man1/shodan.1%{ext_man} ++++++ shodan-1.21.3.tar.gz -> shodan-1.23.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/CHANGELOG.md new/shodan-1.23.0/CHANGELOG.md --- old/shodan-1.21.3/CHANGELOG.md 2020-01-20 20:57:07.000000000 +0100 +++ new/shodan-1.23.0/CHANGELOG.md 2020-04-06 22:00:31.000000000 +0200 @@ -1,6 +1,18 @@ CHANGELOG ========= +1.23.0 +------ +* Add new CLI command: shodan alert domain + +1.22.1 +------ +* Fix bug when converting data file to CSV using Python3 + +1.22.0 +------ +* Add support for new vulnerability streaming endpoints + 1.21.3 ------ * Fix geo.json file converter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/PKG-INFO new/shodan-1.23.0/PKG-INFO --- old/shodan-1.21.3/PKG-INFO 2020-01-20 21:22:45.000000000 +0100 +++ new/shodan-1.23.0/PKG-INFO 2020-04-06 22:10:29.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: shodan -Version: 1.21.3 +Version: 1.23.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.21.3/docs/examples/gifcreator.rst new/shodan-1.23.0/docs/examples/gifcreator.rst --- old/shodan-1.21.3/docs/examples/gifcreator.rst 2016-01-17 04:32:15.000000000 +0100 +++ new/shodan-1.23.0/docs/examples/gifcreator.rst 2020-03-17 23:24:35.000000000 +0100 @@ -106,7 +106,7 @@ os.system('rm -f /tmp/gif-image-*.jpg') # Show a progress indicator - print result['ip_str'] + print(result['ip_str']) -The full code is also available on GitHub: https://gist.github.com/achillean/963eea552233d9550101 \ No newline at end of file +The full code is also available on GitHub: https://gist.github.com/achillean/963eea552233d9550101 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/docs/examples/query-summary.rst new/shodan-1.23.0/docs/examples/query-summary.rst --- old/shodan-1.21.3/docs/examples/query-summary.rst 2017-12-03 06:42:17.000000000 +0100 +++ new/shodan-1.23.0/docs/examples/query-summary.rst 2020-03-17 23:24:35.000000000 +0100 @@ -48,7 +48,7 @@ # Input validation if len(sys.argv) == 1: - print 'Usage: %s <search query>' % sys.argv[0] + print('Usage: %s <search query>' % sys.argv[0]) sys.exit(1) try: @@ -62,22 +62,22 @@ # And it also runs faster than doing a search(). result = api.count(query, facets=FACETS) - print 'Shodan Summary Information' - print 'Query: %s' % query - print 'Total Results: %s\n' % result['total'] + print('Shodan Summary Information') + print('Query: %s' % query) + print('Total Results: %s\n' % result['total']) # Print the summary info from the facets for facet in result['facets']: - print FACET_TITLES[facet] + print(FACET_TITLES[facet]) for term in result['facets'][facet]: - print '%s: %s' % (term['value'], term['count']) + print('%s: %s' % (term['value'], term['count'])) # Print an empty line between summary info - print '' + print('') - except Exception, e: - print 'Error: %s' % e + except Exception as e: + print('Error: %s' % e) sys.exit(1) """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/docs/tutorial.rst new/shodan-1.23.0/docs/tutorial.rst --- old/shodan-1.21.3/docs/tutorial.rst 2018-03-16 22:31:41.000000000 +0100 +++ new/shodan-1.23.0/docs/tutorial.rst 2020-03-17 23:24:35.000000000 +0100 @@ -56,7 +56,7 @@ print('IP: {}'.format(result['ip_str'])) print(result['data']) print('') - except shodan.APIError, e: + except shodan.APIError as e: print('Error: {}'.format(e)) Stepping through the code, we first call the :py:func:`Shodan.search` method on the `api` object which diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/setup.py new/shodan-1.23.0/setup.py --- old/shodan-1.21.3/setup.py 2020-01-20 20:55:55.000000000 +0100 +++ new/shodan-1.23.0/setup.py 2020-04-06 21:29:29.000000000 +0200 @@ -2,12 +2,14 @@ from setuptools import setup + DEPENDENCIES = open('requirements.txt', 'r').read().split('\n') README = open('README.rst', 'r').read() + setup( name='shodan', - version='1.21.3', + version='1.23.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.21.3/shodan/__main__.py new/shodan-1.23.0/shodan/__main__.py --- old/shodan-1.21.3/shodan/__main__.py 2020-01-20 20:55:45.000000000 +0100 +++ new/shodan-1.23.0/shodan/__main__.py 2020-03-18 00:28:27.000000000 +0100 @@ -635,7 +635,8 @@ @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, tags, compresslevel): [email protected]('--vulns', help='A comma-separated list of vulnerabilities to grab data on.', default=None, type=str) +def stream(color, fields, separator, limit, datadir, ports, quiet, timeout, streamer, countries, asn, alert, tags, compresslevel, vulns): """Stream data in real-time.""" # Setup the Shodan API key = get_api_key() @@ -663,9 +664,11 @@ stream_type.append('alert') if tags: stream_type.append('tags') + if vulns: + stream_type.append('vulns') if len(stream_type) > 1: - raise click.ClickException('Please use --ports, --countries, --tags OR --asn. You cant subscribe to multiple filtered streams at once.') + raise click.ClickException('Please use --ports, --countries, --tags, --vulns OR --asn. You cant subscribe to multiple filtered streams at once.') stream_args = None @@ -689,6 +692,9 @@ if tags: stream_args = tags.split(',') + + if vulns: + stream_args = vulns.split(',') # Flatten the list of stream types # Possible values are: @@ -710,6 +716,7 @@ 'countries': api.stream.countries(args, timeout=timeout), 'ports': api.stream.ports(args, timeout=timeout), 'tags': api.stream.tags(args, timeout=timeout), + 'vulns': api.stream.vulns(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.21.3/shodan/cli/alert.py new/shodan-1.23.0/shodan/cli/alert.py --- old/shodan-1.21.3/shodan/cli/alert.py 2019-02-24 10:31:35.000000000 +0100 +++ new/shodan-1.23.0/shodan/cli/alert.py 2020-04-06 22:06:05.000000000 +0200 @@ -46,6 +46,35 @@ click.secho('Alert ID: {}'.format(alert['id']), fg='cyan') [email protected](name='domain') [email protected]('domain', metavar='<domain>', type=str) [email protected]('--triggers', help='List of triggers to enable', default='malware,industrial_control_system,internet_scanner,iot,open_database,new_service,ssl_expired,vulnerable') +def alert_domain(domain, triggers): + """Create a network alert based on a domain name""" + key = get_api_key() + + api = shodan.Shodan(key) + try: + # Grab a list of IPs for the domain + domain = domain.lower() + click.secho('Looking up domain information...', dim=True) + info = api.dns.domain_info(domain, type='A') + domain_ips = set([record['value'] for record in info['data']]) + + # Create the actual alert + click.secho('Creating alert...', dim=True) + alert = api.create_alert('__domain: {}'.format(domain), list(domain_ips)) + + # Enable the triggers so it starts getting managed by Shodan Monitor + click.secho('Enabling triggers...', dim=True) + api.enable_alert_trigger(alert['id'], triggers) + except shodan.APIError as e: + raise click.ClickException(e.value) + + click.secho('Successfully created domain alert!', fg='green') + click.secho('Alert ID: {}'.format(alert['id']), fg='cyan') + + @alert.command(name='info') @click.argument('alert', metavar='<alert id>') def alert_info(alert): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/shodan/cli/converter/csvc.py new/shodan-1.23.0/shodan/cli/converter/csvc.py --- old/shodan-1.21.3/shodan/cli/converter/csvc.py 2019-02-11 03:12:57.000000000 +0100 +++ new/shodan-1.23.0/shodan/cli/converter/csvc.py 2020-03-27 18:11:51.000000000 +0100 @@ -54,7 +54,7 @@ # The "vulns" property can't be nicely flattened as-is so we turn # it into a list before processing the banner. if 'vulns' in banner: - banner['vulns'] = banner['vulns'].keys() + banner['vulns'] = list(banner['vulns'].keys()) # Python3 returns dict_keys so we neeed to cover that to a list try: row = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/shodan/cli/converter/geojson.py new/shodan-1.23.0/shodan/cli/converter/geojson.py --- old/shodan-1.21.3/shodan/cli/converter/geojson.py 2020-01-20 20:49:17.000000000 +0100 +++ new/shodan-1.23.0/shodan/cli/converter/geojson.py 2020-04-06 22:06:15.000000000 +0200 @@ -48,5 +48,5 @@ }, } self.fout.write(dumps(feature) + ',') - except Exception as e: + except Exception: pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/shodan/cli/worldmap.py new/shodan-1.23.0/shodan/cli/worldmap.py --- old/shodan-1.21.3/shodan/cli/worldmap.py 2019-02-11 01:44:09.000000000 +0100 +++ new/shodan-1.23.0/shodan/cli/worldmap.py 2020-03-17 23:24:35.000000000 +0100 @@ -1,4 +1,3 @@ -#!/usr/bin/env python ''' F-Secure Virus World Map console edition diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shodan-1.21.3/shodan/stream.py new/shodan-1.23.0/shodan/stream.py --- old/shodan-1.21.3/shodan/stream.py 2019-09-21 19:00:41.000000000 +0200 +++ new/shodan-1.23.0/shodan/stream.py 2020-03-18 00:22:04.000000000 +0100 @@ -134,3 +134,14 @@ stream = self._create_stream('/shodan/tags/%s' % ','.join(tags), timeout=timeout) for line in self._iter_stream(stream, raw): yield line + + def vulns(self, vulns, raw=False, timeout=None): + """ + A filtered version of the "banners" stream to only return banners that match the vulnerabilities of interest. + + :param vulns: A list of vulns to return banner data on. + :type vulns: string[] + """ + stream = self._create_stream('/shodan/vulns/%s' % ','.join(vulns), 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.21.3/shodan.egg-info/PKG-INFO new/shodan-1.23.0/shodan.egg-info/PKG-INFO --- old/shodan-1.21.3/shodan.egg-info/PKG-INFO 2020-01-20 21:22:45.000000000 +0100 +++ new/shodan-1.23.0/shodan.egg-info/PKG-INFO 2020-04-06 22:10:29.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: shodan -Version: 1.21.3 +Version: 1.23.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
