Skip to content

Instantly share code, notes, and snippets.

@Code-Hex
Last active August 29, 2015 14:22
Show Gist options
  • Save Code-Hex/85b90f28f89285ee2064 to your computer and use it in GitHub Desktop.
Save Code-Hex/85b90f28f89285ee2064 to your computer and use it in GitHub Desktop.
情報ネットワーク課題10
#!/usr/bin/perl
use strict;
use warnings;
# How to use?
# perl auto.pl
# or
# perl auto.pl hostname
# or
# perl auto.pl hostname ip_address
# or
# perl auto.pl hostname ip_address dns
my $hosts = $ARGV[0] || "ie.u-ryukyu.ac.jp";
my $address = $ARGV[1] || "133.13.48.8";
my $dns = $ARGV[2] || "8.8.8.8";
#課題7
print "% host $hosts \n";
system "host $hosts";
print "% host $address \n";
system "host $address";
print "% dig $hosts \n";
system "dig $hosts";
print "% dig -x $address \n";
system "dig -x $address";
#課題8
print "% host -t soa $hosts\n";
system "host -t soa $hosts"; #SOA
print "% host -t ns $hosts\n";
system "host -t ns $hosts"; #NS
print "% host -t mx $hosts\n";
system "host -t mx $hosts"; #MX
print "% dig soa $hosts\n";
system "dig soa $hosts";
print "% dig ns $hosts\n";
system "dig ns $hosts";
print "% dig mx $hosts\n";
system "dig mx $hosts";
#課題9
print "% host -v $hosts $dns\n";
system "host -v $hosts $dns";
print "% dig \@$dns $hosts\n";
system "dig \@$dns $hosts";
@Code-Hex
Copy link
Author

使い方
% perl auto.pl
(これはデフォルトでホスト名は ie.u-ryukyu.ac.jp、IPアドレスは133.13.48.8、DNSは8.8.8.8)
または
% perl auto.pl hostname ip_address
または
% perl auto.pl hostname ip_address dns
後者はスクリーン上の文字列を削除(前回実行した出力結果との距離をあける)して、実行する。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment