Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-shodan for openSUSE:Factory 
checked in at 2022-01-14 23:13:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-shodan (Old)
 and      /work/SRC/openSUSE:Factory/.python-shodan.new.1892 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-shodan"

Fri Jan 14 23:13:26 2022 rev:27 rq:946399 version:1.26.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-shodan/python-shodan.changes      
2021-01-26 14:51:07.363789895 +0100
+++ /work/SRC/openSUSE:Factory/.python-shodan.new.1892/python-shodan.changes    
2022-01-14 23:14:55.906697203 +0100
@@ -1,0 +2,6 @@
+Fri Jan  7 09:15:15 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- Update to version 1.26.0:
+ - Add the ability to create custom data streams in the Shodan() class as well 
as the CLI (shodan stream --custom-filters <query>)
+
+-------------------------------------------------------------------

Old:
----
  shodan-1.25.0.tar.gz

New:
----
  shodan-1.26.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-shodan.spec ++++++
--- /var/tmp/diff_new_pack.Emsx97/_old  2022-01-14 23:14:56.306697461 +0100
+++ /var/tmp/diff_new_pack.Emsx97/_new  2022-01-14 23:14:56.314697466 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-shodan
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %{!?license: %global license %doc}
 Name:           python-shodan
-Version:        1.25.0
+Version:        1.26.0
 Release:        0
 Summary:        Python library and command-line utility for Shodan
 License:        MIT
@@ -37,7 +37,7 @@
 Requires:       python-requests >= 2.2.1
 Requires:       python-setuptools
 Requires(post): update-alternatives
-Requires(postun): update-alternatives
+Requires(postun):update-alternatives
 Recommends:     python-curses
 Suggests:       %{name}-doc
 BuildArch:      noarch

++++++ shodan-1.25.0.tar.gz -> shodan-1.26.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.25.0/PKG-INFO new/shodan-1.26.0/PKG-INFO
--- old/shodan-1.25.0/PKG-INFO  2021-01-25 23:35:15.000000000 +0100
+++ new/shodan-1.26.0/PKG-INFO  2022-01-06 23:05:29.000000000 +0100
@@ -1,8 +1,8 @@
 Metadata-Version: 2.1
 Name: shodan
-Version: 1.25.0
+Version: 1.26.0
 Summary: Python library and command-line utility for Shodan 
(https://developer.shodan.io)
-Home-page: http://github.com/achillean/shodan-python/tree/master
+Home-page: https://github.com/achillean/shodan-python
 Author: John Matherly
 Author-email: jm...@shodan.io
 License: UNKNOWN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.25.0/setup.py new/shodan-1.26.0/setup.py
--- old/shodan-1.25.0/setup.py  2021-01-25 23:30:39.000000000 +0100
+++ new/shodan-1.26.0/setup.py  2022-01-06 23:04:43.000000000 +0100
@@ -9,13 +9,13 @@
 
 setup(
     name='shodan',
-    version='1.25.0',
+    version='1.26.0',
     description='Python library and command-line utility for Shodan 
(https://developer.shodan.io)',
     long_description=README,
     long_description_content_type='text/x-rst',
     author='John Matherly',
     author_email='jm...@shodan.io',
-    url='http://github.com/achillean/shodan-python/tree/master',
+    url='https://github.com/achillean/shodan-python',
     packages=['shodan', 'shodan.cli', 'shodan.cli.converter'],
     entry_points={'console_scripts': ['shodan=shodan.__main__:main']},
     install_requires=DEPENDENCIES,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.25.0/shodan/__main__.py 
new/shodan-1.26.0/shodan/__main__.py
--- old/shodan-1.25.0/shodan/__main__.py        2020-11-02 20:46:46.000000000 
+0100
+++ new/shodan-1.26.0/shodan/__main__.py        2022-01-06 23:04:43.000000000 
+0100
@@ -106,7 +106,7 @@
         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', '')
 
@@ -173,7 +173,7 @@
                             helpers.write_banner(fout, banner)
             except shodan.APIError:
                 pass  # Ignore any API lookup errors as this isn't critical 
information
-    
+
     # Save the DNS data
     if save:
         filename = u'{}.json.gz'.format(domain)
@@ -198,7 +198,7 @@
         if record['value'] in hosts:
             host = hosts[record['value']]
             click.secho(u' Ports: {}'.format(', '.join([str(port) for port in 
sorted(host['ports'])])), fg='blue', nl=False)
-        
+
         click.echo('')
 
 
@@ -448,7 +448,7 @@
     # 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:
@@ -617,22 +617,23 @@
 
 
 @main.command()
-@click.option('--color/--no-color', default=True)
+@click.option('--streamer', help='Specify a custom Shodan stream server to use 
for grabbing data.', default='https://stream.shodan.io', type=str)
 @click.option('--fields', help='List of properties to output.', 
default='ip_str,port,hostnames,data')
 @click.option('--separator', help='The separator between the properties of the 
search results.', default='\t')
-@click.option('--limit', help='The number of results you want to download. -1 
to download all the data possible.', default=-1, type=int)
 @click.option('--datadir', help='Save the stream data into the specified 
directory as .json.gz files.', default=None, type=str)
-@click.option('--ports', help='A comma-separated list of ports to grab data 
on.', default=None, type=str)
-@click.option('--quiet', help='Disable the printing of information to the 
screen.', is_flag=True)
-@click.option('--timeout', help='Timeout. Should the shodan stream cease to 
send data, then timeout after <timeout> seconds.', default=0, type=int)
-@click.option('--streamer', help='Specify a custom Shodan stream server to use 
for grabbing data.', default='https://stream.shodan.io', type=str)
-@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('--countries', help='A comma-separated list of countries to grab 
data on.', default=None, type=str)
+@click.option('--custom-filters', help='A space-separated list of filters 
query to grab data on.', default=None, type=str)
+@click.option('--ports', help='A comma-separated list of ports to grab data 
on.', 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)
 @click.option('--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):
+@click.option('--limit', help='The number of results you want to download. -1 
to download all the data possible.', default=-1, type=int)
+@click.option('--compresslevel', help='The gzip compression level (0-9; 0 = no 
compression, 9 = most compression', default=9, type=int)
+@click.option('--timeout', help='Timeout. Should the shodan stream cease to 
send data, then timeout after <timeout> seconds.', default=0, type=int)
+@click.option('--color/--no-color', default=True)
+@click.option('--quiet', help='Disable the printing of information to the 
screen.', is_flag=True)
+def stream(streamer, fields, separator, datadir, asn, alert, countries, 
custom_filters, ports, tags, vulns, limit, compresslevel, timeout, color, 
quiet):
     """Stream data in real-time."""
     # Setup the Shodan API
     key = get_api_key()
@@ -662,9 +663,11 @@
         stream_type.append('tags')
     if vulns:
         stream_type.append('vulns')
+    if custom_filters:
+        stream_type.append('custom_filters')
 
     if len(stream_type) > 1:
-        raise click.ClickException('Please use --ports, --countries, --tags, 
--vulns OR --asn. You cant subscribe to multiple filtered streams at once.')
+        raise click.ClickException('Please use --ports, --countries, --custom, 
--tags, --vulns OR --asn. You cant subscribe to multiple filtered streams at 
once.')
 
     stream_args = None
 
@@ -685,13 +688,16 @@
 
     if countries:
         stream_args = countries.split(',')
-    
+
     if tags:
         stream_args = tags.split(',')
-    
+
     if vulns:
         stream_args = vulns.split(',')
 
+    if custom_filters:
+        stream_args = custom_filters
+
     # Flatten the list of stream types
     # Possible values are:
     # - all
@@ -710,6 +716,7 @@
             'alert': api.stream.alert(args, timeout=timeout),
             'asn': api.stream.asn(args, timeout=timeout),
             'countries': api.stream.countries(args, timeout=timeout),
+            'custom_filters': api.stream.custom(args, timeout=timeout),
             'ports': api.stream.ports(args, timeout=timeout),
             'tags': api.stream.tags(args, timeout=timeout),
             'vulns': api.stream.vulns(args, timeout=timeout),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.25.0/shodan/client.py 
new/shodan-1.26.0/shodan/client.py
--- old/shodan-1.25.0/shodan/client.py  2020-11-02 20:47:47.000000000 +0100
+++ new/shodan-1.26.0/shodan/client.py  2022-01-06 23:04:43.000000000 +0100
@@ -546,7 +546,7 @@
                     raise APIError('Retry limit reached 
({:d})'.format(retries))
 
                 tries += 1
-                time.sleep(1.0)  # wait 1 second if the search errored out for 
some reason
+                time.sleep(tries)  # wait (1 second * retry number) if the 
search errored out for some reason
 
     def search_facets(self):
         """Returns a list of search facets that can be used to get aggregate 
information about a search query.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.25.0/shodan/stream.py 
new/shodan-1.26.0/shodan/stream.py
--- old/shodan-1.25.0/shodan/stream.py  2020-03-18 00:22:04.000000000 +0100
+++ new/shodan-1.26.0/shodan/stream.py  2022-01-06 23:04:43.000000000 +0100
@@ -13,7 +13,7 @@
         self.api_key = api_key
         self.proxies = proxies
 
-    def _create_stream(self, name, timeout=None):
+    def _create_stream(self, name, query=None, timeout=None):
         params = {
             'key': self.api_key,
         }
@@ -30,6 +30,9 @@
         if timeout:
             params['heartbeat'] = False
 
+        if query is not None:
+            params['query'] = query
+
         try:
             while True:
                 req = requests.get(stream_url, params=params, stream=True, 
timeout=timeout,
@@ -113,6 +116,18 @@
         for line in self._iter_stream(stream, raw):
             yield line
 
+    def custom(self, query, raw=False, timeout=None):
+        """
+        A filtered version of the "banners" stream to only return banners that 
match the query of interest. The query
+        can vary and mix-match with different arguments (ports, tags, vulns, 
etc).
+
+        :param query: A space-separated list of key:value filters query to 
return banner data on.
+        :type query: string
+        """
+        stream = self._create_stream('/shodan/custom', query=query, 
timeout=timeout)
+        for line in self._iter_stream(stream, raw):
+            yield line
+
     def ports(self, ports, raw=False, timeout=None):
         """
         A filtered version of the "banners" stream to only return banners that 
match the ports of interest.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.25.0/shodan.egg-info/PKG-INFO 
new/shodan-1.26.0/shodan.egg-info/PKG-INFO
--- old/shodan-1.25.0/shodan.egg-info/PKG-INFO  2021-01-25 23:35:15.000000000 
+0100
+++ new/shodan-1.26.0/shodan.egg-info/PKG-INFO  2022-01-06 23:05:28.000000000 
+0100
@@ -1,8 +1,8 @@
 Metadata-Version: 2.1
 Name: shodan
-Version: 1.25.0
+Version: 1.26.0
 Summary: Python library and command-line utility for Shodan 
(https://developer.shodan.io)
-Home-page: http://github.com/achillean/shodan-python/tree/master
+Home-page: https://github.com/achillean/shodan-python
 Author: John Matherly
 Author-email: jm...@shodan.io
 License: UNKNOWN

Reply via email to