question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash on particular IP address

See original GitHub issue

Crash of latest ipwhois 1.1 on IP=122.215.34.1:

import ipwhois

owner_info = ipwhois.IPWhois('122.215.34.1').lookup_rdap(depth=0)

print owner_info

Error log:

File "/usr/bin/XXX", line XXX, in XXX
    return ipwhois.IPWhois(ip).lookup_rdap(depth=0)
  File "/usr/lib/python2.7/site-packages/ipwhois/ipwhois.py", line 321, in lookup_rdap
    rate_limit_timeout=rate_limit_timeout
  File "/usr/lib/python2.7/site-packages/ipwhois/rdap.py", line 780, in lookup
    result_net.parse()
  File "/usr/lib/python2.7/site-packages/ipwhois/rdap.py", line 554, in parse
    self.vars[v] = self.json[v].strip()
AttributeError: 'NoneType' object has no attribute 'strip'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
MrCrutchMastercommented, Sep 23, 2022

I’ve got this problem too. With ip 1.5.186.0 and many other from JPNIC. They have one bad field in their output

    {'rdapConformance': ['cidr0', 'rdap_level_0'], 'notices': [{'title': 'Source', 'description': ['Objects returned came from source', 'JPNIC']}, {'title': 'Terms and Conditions', 'description': ['This is the APNIC WHOIS Database query service. The objects are in RDAP format.', 'This information has been partially mirrored by APNIC from JPNIC. To obtain more specific information, please use the JPNIC WHOIS Gateway at http://www.nic.ad.jp/en/db/whois/en-gateway.html or whois.nic.ad.jp for WHOIS client. (The WHOIS client defaults to Japanese output, use the /e switch for English output)'], 'links': [{'value': 'http://jpnic.rdap.apnic.net/ip/1.5.186.0', 'rel': 'terms-of-service', 'href': 'http://www.apnic.net/db/dbcopyright.html', 'type': 'text/html'}]}], 'country': 'JP', 'events': [{'eventAction': 'last changed', 'eventDate': '2011-04-05T03:05:05Z'}], 'name': 'ODN', 'remarks': [{'description': ['SOFTBANK TELECOM Corp.'], 'title': 'description'}], 'links': [{'value': 'http://jpnic.rdap.apnic.net/ip/1.5.186.0', 'rel': 'self', 'href': 'http://jpnic.rdap.apnic.net/ip/1.5.0.0/16', 'type': 'application/rdap+json'}], 'type': None, 'endAddress': '1.5.255.255', 'ipVersion': 'v4', 'startAddress': '1.5.0.0', 'objectClassName': 'ip network', 'handle': '1.5.0.0 - 1.5.255.255', 'entities': [{'roles': ['abuse'], 'events': [{'eventAction': 'last changed', 'eventDate': '2017-10-18T10:21:54Z'}], 'links': [{'value': 'http://jpnic.rdap.apnic.net/ip/1.5.186.0', 'rel': 'self', 'href': 'http://jpnic.rdap.apnic.net/entity/IRT-JPNIC-JP', 'type': 'application/rdap+json'}], 'vcardArray': ['vcard', [['version', {}, 'text', '4.0'], ['fn', {}, 'text', 'IRT-JPNIC-JP'], ['kind', {}, 'text', 'group'], ['adr', {'label': 'Urbannet-Kanda Bldg 4F, 3-6-2 Uchi-Kanda\nChiyoda-ku, Tokyo 101-0047, Japan'}, 'text', ['', '', '', '', '', '', '']], ['email', {}, 'text', 'hostmaster@nic.ad.jp'], ['email', {'pref': '1'}, 'text', 'hostmaster@nic.ad.jp']]], 'objectClassName': 'entity', 'handle': 'IRT-JPNIC-JP'}, {'roles': ['technical', 'administrative'], 'events': [{'eventAction': 'last changed', 'eventDate': '2012-08-28T07:58:02Z'}], 'links': [{'value': 'http://jpnic.rdap.apnic.net/ip/1.5.186.0', 'rel': 'self', 'href': 'http://jpnic.rdap.apnic.net/entity/JNIC1-AP', 'type': 'application/rdap+json'}], 'vcardArray': ['vcard', [['version', {}, 'text', '4.0'], ['fn', {}, 'text', 'Japan Network Information Center'], ['kind', {}, 'text', 'group'], ['adr', {'label': 'Urbannet-Kanda Bldg 4F\n3-6-2 Uchi-Kanda\nChiyoda-ku, Tokyo 101-0047,Japan'}, 'text', ['', '', '', '', '', '', '']], ['tel', {'type': 'voice'}, 'text', '+81-3-5297-2311'], ['tel', {'type': 'fax'}, 'text', '+81-3-5297-2312'], ['email', {}, 'text', 'hostmaster@nic.ad.jp']]], 'objectClassName': 'entity', 'handle': 'JNIC1-AP'}, {'roles': ['technical', 'administrative'], 'links': [{'value': 'http://jpnic.rdap.apnic.net/ip/1.5.186.0', 'rel': 'related', 'href': 'http://whois.nic.ad.jp/cgi-bin/whois_gw?key=JP00035900/e', 'type': 'text/html', 'hreflang': 'en'}, {'value': 'http://jpnic.rdap.apnic.net/ip/1.5.186.0', 'rel': 'related', 'href': 'http://whois.nic.ad.jp/cgi-bin/whois_gw?key=JP00035900', 'type': 'text/html', 'hreflang': 'jp'}], 'objectClassName': 'entity', 'handle': 'JP00035900'}], 'cidr0_cidrs': [{'v4prefix': '1.5.0.0', 'length': 16}], 'port43': 'whois.apnic.net'}

'type': None, wich crash parsing

I make small local fix in ipwhois.rdap in _RDAPNetwork.parse (line 556)

    for v in ['name', 'type', 'country']:

        try:

            self.vars[v] = self.json[v].strip()

       # except (KeyError, ValueError):
       except (KeyError, ValueError, AttributeError):

            pass
1reaction
dnkcommented, Jun 21, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

What's an IP Conflict and How Do You Resolve It? - MakeUseOf
What is an IP address conflict? Learn how to fix the problem if two devices have the same IP address on your network....
Read more >
How to fix and resolve IP address conflict - ManageEngine
Step 4: Click Properties, and double-click the Internet Protocol Version 4 (TCP/IPv4) field. Step 5: Select the Obtain an IP address automatically and...
Read more >
Computer crashes when setting up a Static IP Address.
Hey, so im trying to set up a Static IP Address following the instructions from www.PortForward.com. My router is a D-Link WBR-1310 and...
Read more >
Linksys Official Support - Resolving IP address conflicts
If there are cases of IP address conflicts in the network, then the administrator needs to re-assign unique static IP addresses to the...
Read more >
Wifi crashes after trying to connect to a specific wifi
I've uninstalled the network adapter and restarted my computer, I've reconfigured the IP address, I took my computer to my schools wifi ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found