May 29, 2005
そう言えば、Blog Hackers Conference 2005 で、時間がもし余れば公開しようかと思っていた、あの時の島男さんのようになれる "Terminal Frontier" のエミュレータを公開します。
#!/usr/local/bin/perl
use strict;
use Term::ReadKey;
use constant TYPES_PER_LINE => 2;
ReadMode 3;
my $keycount = 0;
while (1) {
if (ReadKey(0) && ++$keycount == TYPES_PER_LINE) {
last unless my $line = <DATA>;
print $line;
$keycount = 0;
}
}
ReadMode 0;
__DATA__
Index: contrib/bind/bin/named/db_defs.h
===================================================================
RCS file: /home/ncvs/src/contrib/bind/bin/named/db_defs.h,v
retrieving revision 1.1.1.2.2.5
diff -c -c -r1.1.1.2.2.5 db_defs.h
*** contrib/bind/bin/named/db_defs.h 7 Jul 2002 08:19:13 -0000 1.1.1.2.2.5
--- contrib/bind/bin/named/db_defs.h 14 Nov 2002 01:30:48 -0000
***************
*** 78,84 ****
*/
/* max length of data in RR data field */
! #define MAXDATA (2*MAXDNAME + 5*INT32SZ)
/* max length of data in a TXT RR segment */
#define MAXCHARSTRING 255
--- 78,84 ----
*/
/* max length of data in RR data field */
! #define MAXDATA (3*MAXDNAME + 5*INT32SZ)
/* max length of data in a TXT RR segment */
#define MAXCHARSTRING 255
Index: contrib/bind/bin/named/db_sec.c
===================================================================
RCS file: /home/ncvs/src/contrib/bind/bin/named/db_sec.c,v
retrieving revision 1.1.1.1.4.3
diff -c -c -r1.1.1.1.4.3 db_sec.c
*** contrib/bind/bin/named/db_sec.c 17 Feb 2002 15:48:38 -0000 1.1.1.1.4.3
--- contrib/bind/bin/named/db_sec.c 14 Nov 2002 01:30:48 -0000
***************
*** 479,485 ****
struct sig_record *sigdata;
struct dnode *sigdn;
struct databuf *sigdp;
! time_t now;
char *signer;
u_char name_n[MAXDNAME];
u_char *sig, *eom;
--- 479,487 ----
struct sig_record *sigdata;
struct dnode *sigdn;
struct databuf *sigdp;
! u_int32_t now;
! u_int32_t exptime;
! u_int32_t signtime;
char *signer;
u_char name_n[MAXDNAME];
u_char *sig, *eom;
***************
*** 492,497 ****
--- 494,500 ----
int dnssec_failed = 0, dnssec_succeeded = 0;
int return_value;
int i;
+ int expired = 0;
if (rrset == NULL || rrset->rr_name == NULL) {
ns_warning (ns_log_default, "verify_set: missing rrset/name");
***************
*** 527,537 ****
* Don't verify a set if the SIG inception time is in
* the future. This should be fixed before 2038 (BEW)
*/
! if ((time_t)ntohl(sigdata->sig_time_n) > now)
continue;
/* An expired set is dropped, but the data is not. */
! if ((time_t)ntohl(sigdata->sig_exp_n) < now) {
db_detach(&sigdn->dp);
sigdp = NULL;
continue;
--- 530,543 ----
* Don't verify a set if the SIG inception time is in
* the future. This should be fixed before 2038 (BEW)
*/
! signtime = ntohl(sigdata->sig_time_n);
! if (SEQ_GT(signtime, now))
continue;
/* An expired set is dropped, but the data is not. */
! exptime = ntohl(sigdata->sig_exp_n);
! if (SEQ_GT(now, exptime)) {
! expired++;
db_detach(&sigdn->dp);
sigdp = NULL;
continue;
***************
*** 723,729 ****
}
end:
! if (dnssec_failed > 0)
rrset_trim_sigs(rrset);
if (trustedkey == 0 && key != NULL)
dst_free_key(key);
最後、適当なとこで切りました。。。
一見 C で書かれてる風ですけど、実は
__DATA__ と書かれている行以降は BIND 8 の patch です。どのバージョンに対する patch なのかとか、そういうのは一切問いません。ってかむしろ、何でもいいです。
大好きなあの娘のために綴った詩でも勿論 OK なのですが、ただ、日本語よりは英語のもの、それと、なんとなくプログラムのような Syntax のもののほうが、それっぽく見えるでしょう。
一応、今回はドラマに忠実に、適当に入手した BIND 8 の patch を使いましたが、何でも結構です。
これを実行してみるとあら不思議、キーをテキトーにパチパチ叩いただけで、まるでスーパーハカーのように見えます。
なんなら、ウィルスぐらいだったら手で駆除出来んじゃねぇか?ぐらいの錯覚に陥れます。
また、仕事中に使えば、システムに疎い上司に「ほぉ、アイツの仕事ぶりはかなりスゴイな」と思わせられます。
ただ、その場合の注意点として「一切の成果がない」という点にご注意ください。
この夏の流行を先取り!!
モテる男のマストアイテム!!
Terminal Frontier Emulator
是非ご利用ください。