0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

URL, htmlで間違えたこと。英語(66)

Last updated at Posted at 2019-03-03

URL, htmlで間違えたこと。

<この項は書きかけです。順次追記します。>

「;」を「;」に

「Wireless Hack」by Rob Flickengerをハックしたい<書きかけ>
https://qiita.com/kaizen_nagoya/items/df87e75fe9a931fff472

p.92

freenetworks.html
<html>
<head>
    <meta http-equiv="Refresh" content="5:http://freenetworks.org" />
</head>
<body>

<h1> This is Rendezvous linux brought to you  by : me!</h1>

Redirecting you automatically in five seconds...
</body>
</html>

5秒でリダイレクトと書いてあった。ブラウザでファイルを読み込んでも止まったまま。
よくみると、「5:http」になっている。「5;http」と;じゃなきゃ。

freenetworks.html
<html>
<head>
    <meta http-equiv="Refresh" content="5;http://freenetworks.org" />
</head>
<body>

<h1> This is Rendezvous linux brought to you  by : me!</h1>

Redirecting you automatically in five seconds...
</body>
</html>

ちゃんと5秒たったら、リダイレクトし始めようとした。

「:」を「;」に

「Wireless Hacks」 p.85 MACアドレスからメーカ一覧を作るmachine.plを手打ちしてエラー報告。未完。
https://qiita.com/kaizen_nagoya/items/26841520b9b9f9c61034

p.85

machine.pl
#!/usr/bin/perl

my %cards;
my %ips;

open (ARP,"arp -an|") || die "Couldn't open arp table: $!\n";

print "Looking up OUIs.";
while(<ARP>){
 chomp;
 my $addr = $_;
 my $ip = $_;
 $addr =~ s/.* ([\d\w]+:[\d\w]+:[\d\w]+):.*/$1/;
 $addr =~ s/\b([\d\w])\b/0$1/g;
 $addr =~ s/:/-/g;
 next unless $addr =~ /..-..-../;

 $ip =~ s/.*?(\d+\.\d+\.\d+\.\d+).*/$1/;
 print ".";
 $cards{$addr}||=`curl -sd 'x=$addr' http;//standards.ieee.org/cgi-bin/ouisearch`;
 ($cards{$addr} =~ /Sorry!/) && ($cards{$addr} = "Unknown OUI; $addr");
 $ips{$ip} = $addr;
}
print "\n";
for(keys(%ips)){
 $cards{$ips{$_}} =~ s/.*.hex.\s+([\w\s\,\.]+)\n.*/$1/s;
 print "$_ -> $cards{$ips{$_}}\n";
}

curlで処理しようとしたURLに;があるとまずそこまで処理するらしい。

$ perl freenetworks.html
...
curl: (6) Could not resolve host: http
sh: 1: //standards.ieee.org/cgi-bin/ouisearch: not found
...

;を:に直して

machine.pl
#!/usr/bin/perl

my %cards;
my %ips;

open (ARP,"arp -an|") || die "Couldn't open arp table: $!\n";

print "Looking up OUIs.";
while(<ARP>){
 chomp;
 my $addr = $_;
 my $ip = $_;
 $addr =~ s/.* ([\d\w]+:[\d\w]+:[\d\w]+):.*/$1/;
 $addr =~ s/\b([\d\w])\b/0$1/g;
 $addr =~ s/:/-/g;
 next unless $addr =~ /..-..-../;

 $ip =~ s/.*?(\d+\.\d+\.\d+\.\d+).*/$1/;
 print ".";
 $cards{$addr}||=`curl -sd 'x=$addr' http://standards.ieee.org/cgi-bin/ouisearch`;
 ($cards{$addr} =~ /Sorry!/) && ($cards{$addr} = "Unknown OUI; $addr");
 $ips{$ip} = $addr;
}
print "\n";
for(keys(%ips)){
 $cards{$ips{$_}} =~ s/.*.hex.\s+([\w\s\,\.]+)\n.*/$1/s;
 print "$_ -> $cards{$ips{$_}}\n";
}

5秒経つとリダイレクトし始めた。実際に開き終わるまでの時間は様々。

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?