orf / xcat

XPath injection tool
https://xcat.readthedocs.org/
MIT License
363 stars 73 forks source link

ipgetter missing in pypi #26

Closed MMquant closed 5 years ago

MMquant commented 5 years ago

It seems like there isn't any ipgetter distribution in pypi anymore. See following pip3 output when trying to install ipgetter:

# pip3 install ipgetter -v
Collecting ipgetter
  1 location(s) to search for versions of ipgetter:
  * https://pypi.python.org/simple/ipgetter/
  Getting page https://pypi.python.org/simple/ipgetter/
  Looking up "https://pypi.python.org/simple/ipgetter/" in the cache
  Returning cached "301 Moved Permanently" response (ignoring date and etag information)
  Looking up "https://pypi.org/simple/ipgetter/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): pypi.org
  https://pypi.org:443 "GET /simple/ipgetter/ HTTP/1.1" 404 13 <<<<<<<<<<< ipgetter NOT FOUND <<<<<<<<<<<
  Status code 404 not in [200, 203, 300, 301]
  Could not fetch URL https://pypi.python.org/simple/ipgetter/: 404 Client Error: Not Found for url: https://pypi.org/simple/ipgetter/ - skipping
  Could not find a version that satisfies the requirement ipgetter (from versions: )
Cleaning up...
No matching distribution found for ipgetter

It would be probably sufficient to bundle ipgetter.py with the xcat package and remove it from install_requires directive in setup.py.

orf commented 5 years ago

Hmm, it seems that entire package has gone missing. That's a fair bit of broken code: https://github.com/search?l=Python&q=ipgetter&type=Code

I need to spend some time cleaning this project up, and this will be one of the things to do. I'm not sure how to work around this, because I don't have the source for ipgetter and the repo seems to have been deleted!

MMquant commented 5 years ago

So here is the original code for ipgetter https://github.com/Moshe-Malka/BabyKeeper_Project-Python-/blob/master/ipgetter.py

However I would go more elegant way. That is removing ipgetter completely and use following code to fetch public IP address

import urllib.request
import re

with urllib.request.urlopen('https://api.ipify.org') as content:
    public_ip = re.search( r'[0-9]+(?:\.[0-9]+){3}', str(content.read())).group(0)
    print(public_ip)

It uses builtin python3 libraries and the url is taken from https://stackoverflow.com/questions/2311510/getting-a-machines-external-ip-address-with-python

orf commented 5 years ago

I'm aware of this and I'm working on it. I've redesigned the internals, current master is working-ish but still needs work (OOB and shell).

orf commented 5 years ago

Hello, I've just released xcat 1.0 on pypi 🎉 . I've redesigned the CLI and it now all works. Please see the updated README for information.

I'm working on the documentation now. Please open an issue if you run into trouble.