Migrated From JP Software Wiki
This batch file looks up a list of IP addresses and puts the IP address and URL in a CSV-format file. It is used to look up a list of raw IP addresses pulled from a website stat log. The setup and usage instructions are in the comments.
Using this requires an active Internet connection. Due to the normal time lag involved in the lookup, the computer and Internet connections do not have to be particularly fast. Also, to speed things up the IP address list can be split into several files and several copies of this can be run on the same computer at the same time.
This batch file looks up a list of IP addresses and puts the IP address and URL in a CSV-format file. It is used to look up a list of raw IP addresses pulled from a website stat log. The setup and usage instructions are in the comments.
Using this requires an active Internet connection. Due to the normal time lag involved in the lookup, the computer and Internet connections do not have to be particularly fast. Also, to speed things up the IP address list can be split into several files and several copies of this can be run on the same computer at the same time.
Code:
: IP_LOOKUP
: by Joseph "Rick" Reinckens
:
: Usage: IP_LOOKUP list_file_name output_file_name
:
: Source file format: one IP per line: 21.69.0.71
:
: Output file will have one per line: 21.69.0.71,www.abcdef.com
: This is CSV (comma separated values) format.
:
: This also prints a count, the IP and the URL to the screen.
: When copying this, don't forget to include the closing paren
: below the final line of text.
@echo off
color red on bright white
cls
set cnt=0
: %1 = name of IP source file
: %2 = name of output file CSV file with IPNUM,URL
for /f %a in (%1) (
set url=%@ipname[%a]
set cnt=%@inc[%cnt]
echo %cnt %@left[18, %a%@repeat[ ,8]]%url
echo %a,%url>>%2
)