今まで,ログに残る変な IP を調べる時「IP 検索」のサイトを利用していた.
が,もう少し手軽に利用できないものかと…
検索すると,wiki WHOIS
さらに,【 whois 】コマンド――ドメイン情報を表示する
Linux のコマンドであれば,Synology NAS でも可能と思い試してみることに.
Iwao@DS116:~$ sudo -i Password: root@DS116:~# opkg update -ash: opkg: command not found root@DS116:~# cd /var/services/homes/Iwao/ root@DS116:/var/services/homes/Iwao# source ./set_ds_inc.sh root@DS116:/var/services/homes/Iwao# opkg -v opkg version 0.1.8 root@DS116:/var/services/homes/Iwao# opkg update Downloading http://pkg.entware.net/binaries/armv7/Packages.gz Updated list of available packages in /opt/var/opkg-lists/packages root@DS116:/var/services/homes/Iwao# opkg install whois Installing whois (5.2.19-1) to root... Downloading http://pkg.entware.net/binaries/armv7/whois_5.2.19-1_armv7soft.ipk Installing libidn (1.33-2) to root... Downloading http://pkg.entware.net/binaries/armv7/libidn_1.33-2_armv7soft.ipk Configuring libidn. Configuring whois. root@DS116:/var/services/homes/Iwao# whois Usage: whois [OPTION]... OBJECT... -h HOST, --host HOST connect to server HOST -p PORT, --port PORT connect to PORT -H hide legal disclaimers --verbose explain what is being done --help display this help and exit --version output version information and exit These flags are supported by whois.ripe.net and some RIPE-like servers: -l find the one level less specific match -L find all levels less specific matches -m find all one level more specific matches -M find all levels of more specific matches -c find the smallest match containing a mnt-irt attribute -x exact match -b return brief IP address ranges with abuse contact -B turn off object filtering (show email addresses) -G turn off grouping of associated objects -d return DNS reverse delegation objects too -i ATTR[,ATTR]... do an inverse look-up for specified ATTRibutes -T TYPE[,TYPE]... only look for objects of TYPE -K only primary keys are returned -r turn off recursive look-ups for contact information -R force to show local copy of the domain object even if it contains referral -a also search all the mirrored databases -s SOURCE[,SOURCE]... search the database mirrored from SOURCE -g SOURCE:FIRST-LAST find updates from SOURCE from serial FIRST to LAST -t TYPE request template for object of TYPE -v TYPE request verbose template for object of TYPE -q [version|sources|types] query specified server info root@DS116:/var/services/homes/Iwao#
そのままでは Cannot open /opt/etc/whois.conf: Permission denied となる.
Iwao@DS116:~$ whois 27.92.169.109 Cannot open /opt/etc/whois.conf: Permission denied Iwao@DS116:~$ sudo -i Password: root@DS116:~# cd /opt/etc/ root@DS116:/opt/etc# ll total 28 drwxr-xr-x 3 root root 4096 Dec 28 10:55 . drwxr-xr-x 11 root root 4096 Jan 4 2018 .. drwxr-xr-x 2 root root 4096 Sep 25 2017 init.d -rw-r--r-- 1 root root 0 May 31 2017 ld.so.conf -rw-r--r-- 1 root root 282 May 31 2017 nsswitch.conf -rw-r--r-- 1 root root 142 Aug 16 2016 opkg.conf -rwxr-xr-x 1 root root 471 May 31 2017 profile -rw------- 1 root root 526 Jan 4 2018 whois.conf root@DS116:/opt/etc# chmod 644 whois.conf root@DS116:/opt/etc# exit logout Iwao@DS116:~$ whois 27.92.169.109 % [whois.apnic.net] % Whois data copyright terms http://www.apnic.net/db/dbcopyright.html % Information related to '27.80.0.0 - 27.95.255.255' % Abuse contact for '27.80.0.0 - 27.95.255.255' is 'hostmaster@nic.ad.jp' inetnum: 27.80.0.0 - 27.95.255.255 ... last-modified: 2011-03-01T18:11:04Z source: JPNIC % This query was served by the APNIC Whois Service version 1.88.15-46 (WHOIS-JP4) Iwao@DS116:~$