Hello community,

here is the log from the commit of package python-shodan for openSUSE:Factory 
checked in at 2019-12-04 13:52:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-shodan (Old)
 and      /work/SRC/openSUSE:Factory/.python-shodan.new.4691 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-shodan"

Wed Dec  4 13:52:48 2019 rev:16 rq:753263 version:1.20.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-shodan/python-shodan.changes      
2019-10-02 12:00:46.242743358 +0200
+++ /work/SRC/openSUSE:Factory/.python-shodan.new.4691/python-shodan.changes    
2019-12-04 14:20:04.890423034 +0100
@@ -1,0 +2,7 @@
+Tue Nov 26 14:01:08 UTC 2019 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- update to version 1.20.0:
+ - New option "-S" for **shodan domain** to save results from the lookup
+ - New option "-D" for **shodan domain** to lookup open ports for IPs in the 
results
+
+-------------------------------------------------------------------

Old:
----
  shodan-1.19.0.tar.gz

New:
----
  shodan-1.20.0.tar.gz

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

Other differences:
------------------
++++++ python-shodan.spec ++++++
--- /var/tmp/diff_new_pack.69jzRu/_old  2019-12-04 14:20:05.822423819 +0100
+++ /var/tmp/diff_new_pack.69jzRu/_new  2019-12-04 14:20:05.850423843 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-shodan
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,12 +19,12 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %{!?license: %global license %doc}
 Name:           python-shodan
-Version:        1.19.0
+Version:        1.20.0
 Release:        0
 Summary:        Python library and command-line utility for Shodan
 License:        MIT
 Group:          Development/Languages/Python
-Url:            http://github.com/achillean/shodan-python/
+URL:            http://github.com/achillean/shodan-python/
 Source:         
https://files.pythonhosted.org/packages/source/s/shodan/shodan-%{version}.tar.gz
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
@@ -76,7 +76,6 @@
 # SHODAN-API-KEY file required by tests
 
 %files %{python_files}
-%defattr(-,root,root,-)
 %doc AUTHORS README.rst
 %%license LICENSE
 %python3_only %{_bindir}/shodan

++++++ shodan-1.19.0.tar.gz -> shodan-1.20.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.19.0/CHANGELOG.md 
new/shodan-1.20.0/CHANGELOG.md
--- old/shodan-1.19.0/CHANGELOG.md      2019-09-29 20:29:46.000000000 +0200
+++ new/shodan-1.20.0/CHANGELOG.md      2019-11-19 02:21:51.000000000 +0100
@@ -1,6 +1,11 @@
 CHANGELOG
 =========
 
+1.20.0
+------
+* New option "-S" for **shodan domain** to save results from the lookup
+* New option "-D" for **shodan domain** to lookup open ports for IPs in the 
results
+
 1.19.0
 ------
 * New method to edit the list of IPs for an existing network alert
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.19.0/PKG-INFO new/shodan-1.20.0/PKG-INFO
--- old/shodan-1.19.0/PKG-INFO  2019-09-29 20:33:46.000000000 +0200
+++ new/shodan-1.20.0/PKG-INFO  2019-11-19 02:24:45.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: shodan
-Version: 1.19.0
+Version: 1.20.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.19.0/docs/examples/cert-stream.rst 
new/shodan-1.20.0/docs/examples/cert-stream.rst
--- old/shodan-1.19.0/docs/examples/cert-stream.rst     2018-03-16 
22:33:58.000000000 +0100
+++ new/shodan-1.20.0/docs/examples/cert-stream.rst     2019-11-13 
18:17:29.000000000 +0100
@@ -24,7 +24,6 @@
        # information.
        #
        # Author: achillean
-
        import shodan
        import sys
 
@@ -35,7 +34,7 @@
            # Setup the api
            api = shodan.Shodan(API_KEY)
 
-           print 'Listening for certs...'
+           print('Listening for certs...')
            for banner in api.stream.ports([443, 8443]):
                        if 'ssl' in banner:
                                # Print out all the SSL information that Shodan 
has collected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.19.0/requirements.txt 
new/shodan-1.20.0/requirements.txt
--- old/shodan-1.19.0/requirements.txt  2017-06-16 23:52:10.000000000 +0200
+++ new/shodan-1.20.0/requirements.txt  2019-11-13 18:17:29.000000000 +0100
@@ -2,4 +2,5 @@
 click-plugins
 colorama
 requests>=2.2.1
-XlsxWriter
\ No newline at end of file
+XlsxWriter
+ipaddress;python_version<='2.7'
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.19.0/setup.py new/shodan-1.20.0/setup.py
--- old/shodan-1.19.0/setup.py  2019-09-29 20:13:33.000000000 +0200
+++ new/shodan-1.20.0/setup.py  2019-11-19 02:20:48.000000000 +0100
@@ -7,7 +7,7 @@
 
 setup(
     name='shodan',
-    version='1.19.0',
+    version='1.20.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.19.0/shodan/__main__.py 
new/shodan-1.20.0/shodan/__main__.py
--- old/shodan-1.19.0/shodan/__main__.py        2019-09-22 01:40:22.000000000 
+0200
+++ new/shodan-1.20.0/shodan/__main__.py        2019-11-19 02:22:44.000000000 
+0100
@@ -136,7 +136,9 @@
 
 @main.command(name='domain')
 @click.argument('domain', metavar='<domain>')
-def domain_info(domain):
+@click.option('--details', '-D', help='Lookup host information for any IPs in 
the domain results', default=False, is_flag=True)
+@click.option('--save', '-S', help='Save the information in the a file named 
after the domain (append if file exists).', default=False, is_flag=True)
+def domain_info(domain, details, save):
     """View all available information for a domain"""
     key = get_api_key()
     api = shodan.Shodan(key)
@@ -146,6 +148,37 @@
     except shodan.APIError as e:
         raise click.ClickException(e.value)
 
+    # Grab the host information for any IP records that were returned
+    hosts = {}
+    if details:
+        ips = [record['value'] for record in info['data'] if record['type'] in 
['A', 'AAAA']]
+        ips = set(ips)
+
+        fout = None
+        if save:
+            filename = u'{}-hosts.json.gz'.format(domain)
+            fout = helpers.open_file(filename)
+
+        for ip in ips:
+            try:
+                hosts[ip] = api.host(ip)
+
+                # Store the banners if requested
+                if fout:
+                    for banner in hosts[ip]['data']:
+                        if 'placeholder' not in banner:
+                            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)
+        fout = helpers.open_file(filename)
+
+        for record in info['data']:
+            helpers.write_banner(fout, record)
+
     click.secho(info['domain'].upper(), fg='green')
 
     click.echo('')
@@ -155,9 +188,16 @@
                 click.style(record['subdomain'], fg='cyan'),
                 click.style(record['type'], fg='yellow'),
                 record['value']
-            )
+            ),
+            nl=False,
         )
 
+        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('')
+
 
 @main.command()
 @click.argument('key', metavar='<api key>')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.19.0/shodan/cli/data.py 
new/shodan-1.20.0/shodan/cli/data.py
--- old/shodan-1.19.0/shodan/cli/data.py        2018-08-31 03:08:17.000000000 
+0200
+++ new/shodan-1.20.0/shodan/cli/data.py        2019-11-13 18:11:42.000000000 
+0100
@@ -27,6 +27,11 @@
         for file in files:
             click.echo(click.style(u'{:20s}'.format(file['name']), fg='cyan'), 
nl=False)
             
click.echo(click.style('{:10s}'.format(helpers.humanize_bytes(file['size'])), 
fg='yellow'), nl=False)
+
+            # Show the SHA1 checksum if available
+            if file.get('sha1'):
+                click.echo(click.style('{:42s}'.format(file['sha1']), 
fg='green'), nl=False)
+            
             click.echo('{}'.format(file['url']))
     else:
         # If no dataset was provided then show a list of all datasets
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.19.0/shodan/cli/helpers.py 
new/shodan-1.20.0/shodan/cli/helpers.py
--- old/shodan-1.19.0/shodan/cli/helpers.py     2019-07-20 03:09:37.000000000 
+0200
+++ new/shodan-1.20.0/shodan/cli/helpers.py     2019-11-13 18:17:29.000000000 
+0100
@@ -7,6 +7,7 @@
 import itertools
 import os
 import sys
+from ipaddress import ip_network, ip_address
 
 from .settings import SHODAN_CONFIG_DIR
 
@@ -64,9 +65,25 @@
     return None
 
 
+def filter_with_netmask(banner, netmask):
+    # filtering based on netmask is a more abstract concept than
+    # a mere check for a specific field and thus needs its own mechanism
+    # this will enable users to use the net:10.0.0.0/8 syntax they are used to
+    # to find specific networks from a big shodan download.
+    network = ip_network(netmask)
+    ip_field = get_banner_field(banner, 'ip')
+    if not ip_field:
+        return False
+    banner_ip_address = ip_address(ip_field)
+    return banner_ip_address in network
+
+
 def match_filters(banner, filters):
     for args in filters:
         flat_field, check = args.split(':', 1)
+        if flat_field == 'net':
+            return filter_with_netmask(banner, check)
+
         value = get_banner_field(banner, flat_field)
 
         # If the field doesn't exist on the banner then ignore the record
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/shodan-1.19.0/shodan.egg-info/PKG-INFO 
new/shodan-1.20.0/shodan.egg-info/PKG-INFO
--- old/shodan-1.19.0/shodan.egg-info/PKG-INFO  2019-09-29 20:33:46.000000000 
+0200
+++ new/shodan-1.20.0/shodan.egg-info/PKG-INFO  2019-11-19 02:24:45.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: shodan
-Version: 1.19.0
+Version: 1.20.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.19.0/shodan.egg-info/requires.txt 
new/shodan-1.20.0/shodan.egg-info/requires.txt
--- old/shodan-1.19.0/shodan.egg-info/requires.txt      2019-09-29 
20:33:46.000000000 +0200
+++ new/shodan-1.20.0/shodan.egg-info/requires.txt      2019-11-19 
02:24:45.000000000 +0100
@@ -3,3 +3,6 @@
 colorama
 requests>=2.2.1
 XlsxWriter
+
+[:python_version <= "2.7"]
+ipaddress


Reply via email to