#!/usr/bin/perl use CGI ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); $query = new CGI; print $query->header(-charset=>'SJIS'); $id = $query->param('id'); $ip = $query->param('ip'); $day= $query->param('day'); $hour = $query->param('hour'); $info = "IDに値を入れるとID→IP, IPに値を入れるとIP→ID変換します。
\nあと、IPに入れるのはIPアドレスです、、数字のやつ。ホスト名入れてもダメです。
\n"; $search_form = '
ID: IP: DAY:
'; $search_form .= ' '; open(LOG,">>ASDFaeg2345rtghjMSgmM.log"); print LOG time."\nid:$id\nip:$ip\nday:$day\nhour:$hour\n\n"; close(LOG); if ($id eq '' && $ip eq '' || $day eq '' && $hour eq '') { print ' ID ⇔ IP '; print $info; print $search_form; print "\n\n"; exit; } print ' ID ⇔ IP '; print $info; print $search_form; if ($id ne '') { $id =~ /(^.)/; $idt = $1; $idt =~ tr/A-Z\/\./a-z_,/; if ($day ne '') { print ("id:$id
\n"); print ("day:$day

\n"); open(LIST, "$day/$idt.lst"); while () { ($idcrypt, $idnum) = split(); if ($idcrypt eq $id) { print "$id = xxxxxxxx$idnum
\n"; } } close(LIST); print "

\n"; } elsif ($hour ne '') { print ("id:$id
\n"); print ("hour:$hour

\n"); open(LIST, "000826/".substr($hour,0,1)."/$idt.lst"); while () { ($idcrypt, $idnum) = split(); if ($idcrypt eq $id) { print "$id = xxxxxxxx$idnum
\n"; } } close(LIST); print "

\n"; } } if ($ip ne '') { if ($day ne '') { print ("ip:$ip
\n"); print ("day:$day

\n"); $idnum = substr($ip, 8); $idcrypt = substr(crypt($idnum * $idnum, sprintf("%02s",$day)), -8); print "$ip = $idcrypt"; } elsif ($hour ne '') { print ("ip:$ip
\n"); print ("hour:$hour

\n"); $idnum = substr($ip, 8); my $salt = ' '.substr($hour,0,1); $idcrypt = substr(crypt($idnum * $idnum, $salt), -8); print "$ip = $idcrypt"; } } print ' ';