[PYTHON] Convert IP address to decimal

head -n1 /etc/issue

CentOS release 6.4 (Final)

cd /usr/local/src/ wget https://ipaddr-py.googlecode.com/files/3144.tar.gz tar zxvf 3144.tar.gz cd ipaddr-branches/3144/ python ./setup.py install

yum install bind-utils host www.kame.net

www.kame.net is an alias for orange.kame.net.
orange.kame.net has address 203.178.141.194
orange.kame.net has IPv6 address 2001:200:dff:fff1:216:3eff:feb1:44d7

IPv4

python -c "import ipaddr; print ipaddr.IPv4Interface('203.178.141.194/32')._ip"

3417476546

python -c "import ipaddr; print ipaddr.IPv4Address(3417476546)"

203.178.141.194

IPv6

python -c "import ipaddr; print ipaddr.IPv6Interface('2001:200:dff:fff1:216:3eff:feb1:44d7/32')._ip"

42540528731127839924839251083080582359

python -c "import ipaddr; print ipaddr.IPv6Address(42540528731127839924839251083080582359)"

2001:200:dff:fff1:216:3eff:feb1:44d7

Markdown: ipaddr-py Using3144

Recommended Posts

Convert IP address to decimal
Convert decimal numbers to n-ary numbers [python]
Convert to HSV
To get a local IP address programmatically
Translate IP address range to another subnet 1: 1
Note to plot IP address with Kibana + Elasticsearch
Added firewalld to Amazon Linux 2 (IP address restrictions)
Convert 202003 to 2020-03 with pandas
Convert kanji to kana
Convert jupyter to py
Convert keras-yolo3 to onnx
Get local IP address
Convert dict to array
Convert json to excel
[Python] Convert decimal numbers to binary numbers, octal numbers, and hexadecimal numbers
C> Convert decimal to hexadecimal> Do not use sprintf ()
python, php, ruby How to convert decimal numbers to n-ary numbers
Convert hexadecimal string to binary
[python] Convert date to string
[Python] Convert list to Pandas [Pandas]
Convert HTML to text file
Convert Scratch project to Python
[Python] Convert Shift_JIS to UTF-8
Convert SDF to CSV quickly
Convert genbank file to gff file
Convert python 3.x code to python 2.x
Convert Tweepy Status object to JSON
Convert .ipynb to .html (with BatchFile)
Convert PDF to Documents by OCR
Convert markdown to PDF in Python
Convert A4 PDF to A3 every 2 pages
Convert wma to mp3 on Mac
convert ggplot based graph to html
Workflow to convert formula (image) to python
Convert list to DataFrame with python
Convert sentences to vectors with gensim
How to convert 0.5 to 1056964608 in one shot
Python> list> Convert double list to single list
Convert from pdf to txt 2 [pyocr]
How to convert Tensorflow model to Lite
Convert a string to an image
[Python] Convert natural numbers to ordinal numbers
Program to convert Japanese to station name
How to convert from .mgz to .nii.gz
Convert PDF to image with ImageMagick
A tool to convert Juniper config
Python> tuple> Convert double tuple to single tuple
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
Script to register the IP address used by wercker in Security Group