A tool to insert the country name and country code in the IP address part

What you can do

In the part of the IPv4 address of the text such as logs You can insert the country name and country code.

What to use

Use the iptocc command published at the following URL.

[Commentary] http://qiita.com/chocolatampcoffee/items/9887c5ee3a528ba43720

[Main body] https://github.com/INC-i/IPStaff

How to use

1 Command 1 | ./iptocc

2 iptocc IPv4 address

Specific example of 1

cat /var/log/messages | egrep "Dropped Packet" | egrep -o "SRC=[^ ]*" | head -10

SRC=85.25.43.94 SRC=74.42.63.123 SRC=74.42.63.123 SRC=27.118.26.131 SRC=66.240.192.138 SRC=27.118.26.131 SRC=14.157.226.199 SRC=14.157.226.199 SRC=14.157.226.199 SRC=216.218.206.121

If you pass the above output to the iptocc command, it will look like this:

cat /var/log/messages | egrep "Dropped Packet" | egrep -o "SRC=[^ ]*" | head -10 | ./iptocc

SRC=85.25.43.94(DE:Germany) SRC=74.42.63.123(US:United States) SRC=74.42.63.123(US:United States) SRC=27.118.26.131(VN:Viet Nam) SRC=66.240.192.138(US:United States) SRC=27.118.26.131(VN:Viet Nam) SRC=14.157.226.199(CN:China) SRC=14.157.226.199(CN:China) SRC=14.157.226.199(CN:China) SRC=216.218.206.121(US:United States)

With the -j option, the country name will be in Japanese.

cat /var/log/messages | egrep "Dropped Packet" | egrep -o "SRC=[^ ]*" | head -10 | ./iptocc -j

SRC = 85.25.43.94 (DE: Germany) SRC = 74.42.63.123 (US: United States) SRC = 74.42.63.123 (US: United States) SRC = 27.118.26.131 (VN: Vietnam) SRC = 66.240.192.138 (US: United States) SRC = 27.118.26.131 (VN: Vietnam) SRC = 14.157.226.199 (CN: People's Republic of China | China) SRC = 14.157.226.199 (CN: People's Republic of China | China) SRC = 14.157.226.199 (CN: People's Republic of China | China) SRC = 216.218.206.121 (US: United States)

Specific example of 2

./iptocc 8.8.8.8

IP: 8.8.8.8 CountryCode: US Country: United States

./iptocc -j 8.8.8.8

IP: 8.8.8.8 CountryCode: US Country: United States

Recommended Posts

A tool to insert the country name and country code in the IP address part
How to display the CPU usage, pod name, and IP address of a pod created with Kubernetes
[OCI] Python script to get the IP address of a compute instance in Cloud Shell
Get the IPv4 address assigned to the network interface in code (Linux)
Get the client's IP address in Django
Replace the directory name and the file name in the directory together with a Linux command.
[Python / Jupyter] Translate the comment of the program copied to the clipboard and insert it in a new cell
Qiita (1) How to write a code name
How to get a specific column name and index name in pandas DataFrame
How to make a container name a subdomain and make it accessible in Docker
To get a local IP address programmatically
The file name was bad in Python and I was addicted to import
Function to extract the maximum and minimum values ​​in a slice with Go
How to count the number of elements in Django and output to a template
Use libsixel to output Sixel in Python and output a Matplotlib graph to the terminal.
[Django] Create a form that automatically fills in the address from the zip code
Set a fixed IP in the Linux environment
[Python] Insert ":" in MAC address
Run the output code with tkinter, saying "A, pretending to be B" in python
[Note] How to write QR code and description in the same image with python
[Mac] A super-easy way to execute system commands in Python and output the results
A solution to the problem that files containing [and] are not listed in glob.glob ()
How to get the variable name itself in python
Get the file name in a folder using glob
Created a tool to mechanically visualize from the repository history in order to objectively know the productivity and soundness of the development team
Get a participant's username and screen name in Slack
Go language to see and remember Part 7 C language in GO language
[Linux] How to put your IP in a variable
Good and bad code to compare on a minimap
Now in Singapore The story of creating a LineBot and wanting to do a memorable job
Obtain the name and securities code of a stock listed on the First Section of the Tokyo Stock Exchange
Spit out a list of file name, last modified date and character code in python3
Recursively get the Excel list in a specific folder with python and write it to Excel.
What seems to be a template of the standard input part of the competition pro in python3
I also tried to imitate the function monad and State monad with a generator in Python
"A book to train programming skills to fight in the world" Python code answer example --1.8 "0" matrix
An easy way to view the time taken in Python and a smarter way to improve it
How to insert a specific process at the start and end of spider with scrapy
A story about porting the code of "Try and understand how Linux works" to Rust
Define a task to set the fabric env in YAML
A memorandum to register the library written in Hy in PyPI
[python] Change the image file name to a serial number
Change the standard output destination to a file in Python
Put the lists together in pandas to make a DataFrame
A standard way to develop and distribute packages in Python
I tried to illustrate the time and time in C language
Get a global IP and export it to Google Spreadsheets
How to generate a query using the IN operator in Django
Build a Python environment and transfer data to the server
Create code that outputs "A and pretending B" in python
How to get the last (last) value in a list in Python
How to get all the keys and values in the dictionary
Create a tool to check scraping rules (robots.txt) in Python
I want to map the EDINET code and securities number
Assign a link-local address to Linux and use DNS-SD / SSDP
Just try to receive a webhook in ngrok and python
"A book to train programming skills to fight in the world" Python code Solution example --1.6 String compression
Run the output code on the local web server as "A, pretending to be B" in python
"A book to train programming skills to fight in the world" Python code solution example --1.5 One-shot conversion
"A book to train programming skills to fight in the world" Python code answer example --3.1 Three stacks
"A book to train programming skills to fight in the world" Python code Solution example --1.7 Matrix rotation