-1

I have downloaded IP2Proxy™ LITE database in csv format, below is the data in it

enter image description here

could anybody please help me how to read the ip addresses using python or powershell as it seems in plain number. Also please explain what does 1st to column represents.

Naveen Kumar
  • 1,266
  • 1
  • 21
  • 50

1 Answers1

1

Here's how you can convert those values into a string representation of an IPv4 address:

def convert(ip):
        def _genip(n):
            for shift in range(24, -8, -8):
                yield f'{(n >> shift) & 0xff:03d}'
        return '.'.join(list(_genip(int(ip))))
print(convert('34676992'))

Output:

002.017.033.000
DarkKnight
  • 19,739
  • 3
  • 6
  • 22
  • Thanks @Cobra just want to know what 1st and 2nd column represents, as it seems both are ip's – Naveen Kumar Nov 04 '22 at 07:47
  • I am using `$number = 2147483648 $w = [int]($number/16777216)%256 $x = [int]($number/65536)%256 $y = [int]($number/256)%256 $z = [int]$number%256 $ipAddress = "$w.$x.$y.$z"` But getting **Cannot convert value "2147483648" to type "System.Int32". Error: "Value was either too large or too small for an Int32."** – Naveen Kumar Nov 23 '22 at 12:40
  • @NaveenKumar Your question is tagged for Python. The INT32 limitation is nothing to do with Python – DarkKnight Nov 29 '22 at 11:15