dict: E: ## AI
dict: E: ## 1 linux
+dns: D: Query DNS
+dns: U: ## <host|ip>
+dns: E: ## debian.org
+dns: E: ## 3.1.33.7
+
do: D: operator command to do things in a channel
do: U: ## <chan> <what>
nickometer: E: ## unknown_lamer
nickometer: E: ## #botpark
-nslookup: D: Query DNS
-nslookup: U: ## <host|ip>
-nslookup: E: ## debian.org
-nslookup: E: ## 3.1.33.7
-
ord: D: Convert ascii to decimal
ord: U: ## <single character>
ord: E: ## c
-#v1: blootbot -- infobot -- written Thu Feb 17 03:17:32 2005
+#v1: blootbot -- infobot -- written Thu Feb 17 03:57:07 2005
#botpark
+RootWarn
+Weather
+Zippy
+allowConv
- +allowDNS
+allowTelling
+babelfish
+botmail
+cookie
+countdown
debianRefreshInterval 7
+ +dns
+factoidArguments
floodMessages 10:30
floodRepeat 2:10
# [0/1] ord/chr etc
set allowConv 1
-# [0/1] do you want to allow DNS lookup
-set allowDNS 1
-
# [0/1] Forking... disable for non-nix OS or to reduce mem usage.
# Disabling should make the bot work on Win32 and MacOS.
set forking 1
&addCmdHook("extra", '[ia]?spell', ('CODEREF' => 'spell::query',
'Identifier' => 'spell', 'Cmdstats' => 'spell',
'Forker' => 1, 'Help' => 'spell') );
+&addCmdHook("extra", 'dns|d?nslookup|host', ('CODEREF' => 'dns::query',
+ 'Identifier' => 'dns', 'Cmdstats' => 'dns',
+ 'Forker' => 1, 'Help' => 'dns') );
###
### END OF ADDING HOOKS.
###
delete $cache{confvars};
}
-# registered flags... not used yet.
-my @regFlagsChan = (
- "autojoin",
- "limitcheckInterval",
- "limitcheckPlus",
- "allowConv",
- "allowDNS",
-### TODO: finish off this list.
-);
-
my @regFlagsUser = (
# possible chars to include in FLAG
"A", # bot administration over /msg
--- /dev/null
+#
+# dns.pl: host lookups
+# Author: Tim Riker <Tim@Rikers.org>
+# Source: extracted from UserExtra.pl
+# Licensing: Artistic License (as perl itself)
+# Version: v0.1
+#
+# Copyright (c) 2005 Tim Riker
+#
+
+package dns;
+
+use strict;
+
+sub dns::dns {
+ my $dns = shift;
+ my($match, $x, $y, $result, $pid);
+
+ if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) {
+ use Socket;
+
+ &main::status("DNS query by IP address: $dns");
+
+ $y = pack('C4', split(/\./, $dns));
+ $x = (gethostbyaddr($y, &AF_INET));
+
+ if ($x !~ /^\s*$/) {
+ $result = "$dns is $x" unless ($x =~ /^\s*$/);
+ } else {
+ $result = "I can't find the address $dns in DNS";
+ }
+
+ } else {
+
+ &main::status("DNS query by name: $dns");
+ $x = join('.',unpack('C4',(gethostbyname($dns))[4]));
+
+ if ($x !~ /^\s*$/) {
+ $result = "$dns is $x";
+ } else {
+ $result = "I can't find $dns in DNS";
+ }
+ }
+
+ return($result);
+}
+
+sub dns::query {
+ &::performStrictReply(&dns(@_));
+ return;
+}
+
+1;
+# vim: ts=2 sw=2
&addCmdHook("main", 'help', ('CODEREF' => 'help',
'Cmdstats' => 'Help', ) );
&addCmdHook("main", 'karma', ('CODEREF' => 'karma', ) );
-&addCmdHook("main", 'd?nslookup', ('CODEREF' => 'DNS',
- Help => 'nslookup', Identifier => 'allowDNS',
- Forker => "NULL", ) );
&addCmdHook("main", 'tell|explain', ('CODEREF' => 'tell',
Help => 'tell', Identifier => 'allowTelling',
Cmdstats => 'Tell') );
}
}
-sub nslookup {
- my $query = shift;
- &status("DNS Lookup: $query");
- &DNS($query);
-}
-
sub tell {
my $args = shift;
my ($target, $tell_obj) = ('','');
&msg($target, $reply);
}
-sub DNS {
- my $dns = shift;
- my($match, $x, $y, $result);
- my $pid;
- $dns =~ s/^\s+|\s+$//g;
-
- if (!defined $dns or $dns =~ /^\s*$/ or $dns =~ / /) {
- &help("dns");
- return;
- }
-
- if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) {
- $match = $1;
- &status("DNS query by IP address: $match");
-
- $y = pack('C4', split(/\./, $match));
- $x = (gethostbyaddr($y, &AF_INET));
-
- if ($x !~ /^\s*$/) {
- $result = $match." is ".$x unless ($x =~ /^\s*$/);
- } else {
- $result = "I can't seem to find that address in DNS";
- }
-
- } else {
-
- &status("DNS query by name: $dns");
- $x = join('.',unpack('C4',(gethostbyname($dns))[4]));
-
- if ($x !~ /^\s*$/) {
- $result = $dns." is ".$x;
- } else {
- $result = "I can\'t find that machine name";
- }
- }
-
- &performReply($result);
-}
-
sub countryStats {
if (exists $cache{countryStats}) {
&msg($who,"countrystats is already running!");