From: pk910 Date: Thu, 22 Nov 2012 17:33:04 +0000 (+0100) Subject: updated database.defaults.sql and added some example scripts X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=d559baaa06c14a6dfc0354457a84ad904fc2f9be updated database.defaults.sql and added some example scripts --- diff --git a/database.defaults.sql b/database.defaults.sql index 0c692d9..25e3336 100644 --- a/database.defaults.sql +++ b/database.defaults.sql @@ -1,233 +1,266 @@ -- -- Daten für Tabelle `bot_binds` -- +-- +-- Daten für Tabelle `bot_binds` +-- + +INSERT INTO `bot_binds` (NULL, `botclass`, `botid`, `command`, `function`, `parameters`, `chan_access`, `global_access`, `flags`) VALUES +(NULL, 1, 0, 'bind', 'bind', '', NULL, NULL, 0), +(NULL, 1, 0, 'unbind', 'unbind', '', NULL, NULL, 0), +(NULL, 1, 0, 'adduser', 'adduser', '', NULL, NULL, 0), +(NULL, 1, 0, 'addowner', 'adduser', '%1 500', NULL, NULL, 0), +(NULL, 1, 0, 'addcoowner', 'adduser', '%1 400', NULL, NULL, 0), +(NULL, 1, 0, 'addco', 'adduser', '%1 400', NULL, NULL, 0), +(NULL, 1, 0, 'addmaster', 'adduser', '%1 300', NULL, NULL, 0), +(NULL, 1, 0, 'addop', 'adduser', '%1 200', NULL, NULL, 0), +(NULL, 1, 0, 'addpeon', 'adduser', '%1 100', NULL, NULL, 0), +(NULL, 1, 0, 'addvoice', 'adduser', '%1 100', NULL, NULL, 0), +(NULL, 1, 0, 'deluser', 'deluser', '', NULL, NULL, 0), +(NULL, 1, 0, 'clvl', 'clvl', '', NULL, NULL, 0), +(NULL, 1, 0, 'access', 'access', '', NULL, NULL, 0), +(NULL, 1, 0, 'a', 'access', '', NULL, NULL, 0), +(NULL, 1, 0, 'users', 'users', '', NULL, NULL, 0), +(NULL, 1, 0, 'vlist', 'users', '%1|* 100 199', NULL, NULL, 0), +(NULL, 1, 0, 'olist', 'users', '%1|* 200 299', NULL, NULL, 0), +(NULL, 1, 0, 'plist', 'users', '%1|* 100 199', NULL, NULL, 0), +(NULL, 1, 0, 'mlist', 'users', '%1|* 300 399', NULL, NULL, 0), +(NULL, 1, 0, 'clist', 'users', '%1|* 400 499', NULL, NULL, 0), +(NULL, 1, 0, 'suspend', 'suspend', '', NULL, NULL, 0), +(NULL, 1, 0, 'unsuspend', 'unsuspend', '', NULL, NULL, 0), +(NULL, 1, 0, 'delme', 'delme', '', NULL, NULL, 0), +(NULL, 1, 0, 'deleteme', 'delme', '', NULL, NULL, 0), +(NULL, 1, 0, 'myaccess', 'myaccess', '', NULL, NULL, 0), +(NULL, 1, 0, 'mya', 'myaccess', '', NULL, NULL, 0), +(NULL, 1, 0, 'ma', 'myaccess', '', NULL, NULL, 0), +(NULL, 1, 0, 'up', 'up', '', NULL, NULL, 0), +(NULL, 1, 0, 'down', 'down', '', NULL, NULL, 0), +(NULL, 1, 0, 'upall', 'upall', '', NULL, NULL, 0), +(NULL, 1, 0, 'uall', 'upall', '', NULL, NULL, 0), +(NULL, 1, 0, 'downall', 'downall', '', NULL, NULL, 0), +(NULL, 1, 0, 'dall', 'downall', '', NULL, NULL, 0), +(NULL, 1, 0, 'mdeluser', 'mdeluser', '', NULL, NULL, 0), +(NULL, 1, 0, 'mdelop', 'mdeluser', '200 %1', NULL, NULL, 0), +(NULL, 1, 0, 'mdelvoice', 'mdeluser', '100 %1', NULL, NULL, 0), +(NULL, 1, 0, 'mdelpeon', 'mdeluser', '100 %1', NULL, NULL, 0), +(NULL, 1, 0, 'mdelmaster', 'mdeluser', '300 %1', NULL, NULL, 0), +(NULL, 1, 0, 'mdelcoowner', 'mdeluser', '400 %1', NULL, NULL, 0), +(NULL, 1, 0, 'mdelco', 'mdeluser', '400 %1', NULL, NULL, 0), +(NULL, 1, 0, 'trim', 'trim', '', NULL, NULL, 0), +(NULL, 1, 0, 'giveowner', 'giveowner', '', NULL, NULL, 0), +(NULL, 1, 0, 'giveownership', 'giveowner', '', NULL, NULL, 0), +(NULL, 1, 0, 'op', 'op', '', NULL, NULL, 0), +(NULL, 1, 0, 'deop', 'deop', '', NULL, NULL, 0), +(NULL, 1, 0, 'voice', 'voice', '', NULL, NULL, 0), +(NULL, 1, 0, 'devoice', 'devoice', '', NULL, NULL, 0), +(NULL, 1, 0, 'v', 'voice', '', NULL, NULL, 0), +(NULL, 1, 0, 'opall', 'opall', '', NULL, NULL, 0), +(NULL, 1, 0, 'deopall', 'deopall', '', NULL, NULL, 0), +(NULL, 1, 0, 'voiceall', 'voiceall', '', NULL, NULL, 0), +(NULL, 1, 0, 'vall', 'voiceall', '', NULL, NULL, 0), +(NULL, 1, 0, 'devoiceall', 'devoiceall', '', NULL, NULL, 0), +(NULL, 1, 0, 'set', 'set', '', NULL, NULL, 0), +(NULL, 1, 0, 'kick', 'kick', '', NULL, NULL, 0), +(NULL, 1, 0, 'k', 'kick', '', NULL, NULL, 0), +(NULL, 1, 0, 'kickban', 'kickban', '', NULL, NULL, 0), +(NULL, 1, 0, 'kb', 'kickban', '', NULL, NULL, 0), +(NULL, 1, 0, 'ban', 'ban', '', NULL, NULL, 0), +(NULL, 1, 0, 'b', 'ban', '', NULL, NULL, 0), +(NULL, 1, 0, 'wipeinfo', 'wipeinfo', '', NULL, NULL, 0), +(NULL, 1, 0, 'deluinfo', 'wipeinfo', '', NULL, NULL, 0), +(NULL, 1, 0, 'addban', 'addban', '', NULL, NULL, 0), +(NULL, 1, 0, 'ab', 'addban', '', NULL, NULL, 0), +(NULL, 1, 0, 'bans', 'bans', '', NULL, NULL, 0), +(NULL, 1, 0, 'shitlist', 'bans', '', NULL, NULL, 0), +(NULL, 1, 0, 'showbans', 'bans', '', NULL, NULL, 0), +(NULL, 1, 0, 'showban', 'bans', '', NULL, NULL, 0), +(NULL, 1, 0, 'delban', 'delban', '', NULL, NULL, 0), +(NULL, 1, 0, 'netinfo', 'netinfo', '', NULL, NULL, 0), +(NULL, 1, 0, 'topic', 'topic', '', NULL, NULL, 0), +(NULL, 1, 0, 'chanservsync', 'chanservsync', '', NULL, NULL, 0), +(NULL, 1, 0, 'resync', 'resync', '', NULL, NULL, 0), +(NULL, 1, 0, 'addtimeban', 'addtimeban', '', NULL, NULL, 0), +(NULL, 1, 0, 'addtimedban', 'addtimeban', '', NULL, NULL, 0), +(NULL, 1, 0, 'timeban', 'addtimeban', '', NULL, NULL, 0), +(NULL, 1, 0, 'timedban', 'addtimeban', '', NULL, NULL, 0), +(NULL, 1, 0, 'tb', 'addtimeban', '', NULL, NULL, 0), +(NULL, 1, 0, 'atb', 'addtimeban', '', NULL, NULL, 0), +(NULL, 1, 0, 'mode', 'mode', '', NULL, NULL, 0), +(NULL, 1, 0, 'version', 'version', '', NULL, NULL, 0), +(NULL, 1, 0, 'peek', 'peek', '', NULL, NULL, 0), +(NULL, 1, 0, 'uset', 'uset', '', NULL, NULL, 0), +(NULL, 1, 0, 'aset', 'uset', '', NULL, NULL, 0), +(NULL, 1, 0, 'unban', 'unban', '', NULL, NULL, 0), +(NULL, 1, 0, 'ub', 'unban', '', NULL, NULL, 0), +(NULL, 1, 0, 'unbanall', 'unbanall', '', NULL, NULL, 0), +(NULL, 1, 0, 'uba', 'unbanall', '', NULL, NULL, 0), +(NULL, 1, 0, 'unbanme', 'unbanme', '', NULL, NULL, 0), +(NULL, 1, 0, 'ubme', 'unbanme', '', NULL, NULL, 0), +(NULL, 1, 0, 'invite', 'invite', '', NULL, NULL, 0), +(NULL, 1, 0, 'inviteme', 'inviteme', '', NULL, NULL, 65536), +(NULL, 1, 0, 'help', 'help', '', NULL, NULL, 0), +(NULL, 1, 0, 'cmds', 'commands', '', NULL, NULL, 0), +(NULL, 1, 0, 'trace', 'trace', '', NULL, NULL, 0), +(NULL, 1, 0, 'register', 'register', '', NULL, NULL, 0), +(NULL, 1, 0, 'reg', 'register', '', NULL, NULL, 0), +(NULL, 1, 0, 'unregister', 'unregister', '', NULL, NULL, 0), +(NULL, 1, 0, 'unreg', 'unregister', '', NULL, NULL, 0), +(NULL, 1, 0, 'recover', 'recover', '', NULL, NULL, 0), +(NULL, 1, 0, 'say', 'say', '', NULL, NULL, 0), +(NULL, 1, 0, 'emote', 'emote', '', NULL, NULL, 0), +(NULL, 1, 0, 'notice', 'notice', '', NULL, NULL, 0), +(NULL, 1, 0, 'raw', 'raw', '', NULL, NULL, 0), +(NULL, 1, 0, 'god', 'god', '', NULL, NULL, 0), +(NULL, 1, 0, 'godmode', 'god', '', NULL, NULL, 0), +(NULL, 1, 0, 'reloadlang', 'reloadlang', '', NULL, NULL, 0), +(NULL, 1, 0, 'csuspend', 'csuspend', '', NULL, NULL, 0), +(NULL, 1, 0, 'cunsuspend', 'cunsuspend', '', NULL, NULL, 0), +(NULL, 1, 0, 'move', 'move', '', NULL, NULL, 0), +(NULL, 1, 0, 'events', 'events', '', NULL, NULL, 0), +(NULL, 1, 0, 'oplog', 'oplog', '', NULL, NULL, 0), +(NULL, 1, 0, 'search', 'search', '', NULL, NULL, 0), +(NULL, 1, 0, 'command', 'command', '', NULL, NULL, 0), +(NULL, 1, 0, 'va', 'voiceall', '', NULL, NULL, 0), +(NULL, 1, 0, 'setaccess', 'setaccess', '', NULL, NULL, 0), +(NULL, 1, 0, 'blist', 'bans', '', NULL, NULL, 0), +(NULL, 1, 0, 'addrank', 'addrank', '', NULL, NULL, 0), +(NULL, 1, 0, 'delrank', 'delrank', '', NULL, NULL, 0), +(NULL, 1, 0, 'listrank', 'listrank', '', NULL, NULL, 0), +(NULL, 1, 0, 'rank', 'assignrank', '', NULL, NULL, 0), +(NULL, 1, 0, 'assignrank', 'assignrank', '', NULL, NULL, 0), +(NULL, 1, 0, 'setrank', 'setrank', '', NULL, NULL, 0), +(NULL, 1, 0, 'ranks', 'listrank', '', NULL, NULL, 0), +(NULL, 1, 0, 'setinfo', 'uset', 'info %1-', NULL, NULL, 0), +(NULL, 1, 0, 'info', 'info', '', NULL, NULL, 0), +(NULL, 1, 0, 'rename', 'rename', '', NULL, NULL, 0), +(NULL, 1, 0, 'unvisited', 'unvisited', '', NULL, NULL, 0), +(NULL, 1, 0, 'add', 'adduser', '', NULL, NULL, 0), +(NULL, 1, 0, 'sync', 'resync', '', NULL, NULL, 0), +(NULL, 1, 0, 'dv', 'devoice', '', NULL, NULL, 0), +(NULL, 1, 0, 'ping', 'funcmd.ping', '', NULL, NULL, 0), +(NULL, 1, 0, 'pong', 'funcmd.pong', '', NULL, NULL, 0), +(NULL, 1, 0, 'dice', 'funcmd.dice', '', NULL, NULL, 0), +(NULL, 1, 0, 'd', 'funcmd.dice', '', NULL, NULL, 0), +(NULL, 1, 0, '8ball', 'funcmd.8ball', '', NULL, NULL, 0), +(NULL, 1, 0, '8', 'funcmd.8ball', '', NULL, NULL, 0), +(NULL, 1, 0, 'staff', 'staff', '', NULL, NULL, 0), +(NULL, 1, 0, 'noregister', 'noregister', '', NULL, NULL, 0), +(NULL, 1, 0, 'commands', 'commands', '', NULL, NULL, 0), +(NULL, 1, 0, 'oplogs', 'oplog', '', NULL, NULL, 0), +(NULL, 1, 0, 'cmd', 'command', '', NULL, NULL, 0), +(NULL, 1, 0, 'team', 'staff', '', NULL, NULL, 0), +(NULL, 1, 0, 'syncusers', 'chanservsync', '', NULL, NULL, 0), +(NULL, 1, 0, 'cookie', 'FunCMD.cookie', '', NULL, NULL, 0), +(NULL, 1, 0, 'banlist', 'bans', '', NULL, NULL, 0), +(NULL, 1, 0, 'del', 'deluser', '', NULL, NULL, 0), +(NULL, 1, 0, 'nicklist', 'nicklist', '', NULL, NULL, 0), +(NULL, 1, 0, 'bots', 'bots', '', NULL, NULL, 0), +(NULL, 1, 0, 'bot list', 'bots', '', NULL, NULL, 0), +(NULL, 1, 0, 'bot add', 'addbot', '', NULL, NULL, 0), +(NULL, 1, 0, 'bot del', 'delbot', '', NULL, NULL, 0), +(NULL, 1, 0, 'bot reconnect', 'reconnect', '', NULL, NULL, 0), +(NULL, 1, 0, 'bot', 'linker', '', NULL, NULL, 0), +(NULL, 1, 0, 'bot set', 'setbot', '', NULL, NULL, 0), +(NULL, 1, 0, 'dva', 'devoiceall', '', NULL, NULL, 0), +(NULL, 1, 0, 'restart', 'restart', '', NULL, NULL, 0), +(NULL, 1, 0, 'showcommands', 'commands', '', NULL, NULL, 0), +(NULL, 1, 0, 'moo', 'extscript', 'toys apt-get moo %1+', NULL, NULL, 0), +(NULL, 1, 0, 'botinfo', 'netinfo', '', NULL, NULL, 0), +(NULL, 1, 0, 'reload', 'reload', '', NULL, NULL, 0), +(NULL, 1, 0, 'moo', 'extscript', 'toys apt-get moo %1+', NULL, NULL, 0), +(NULL, 1, 0, 'botinfo', 'netinfo', '', NULL, NULL, 0), +(NULL, 1, 0, 'meminfo', 'meminfo', '', NULL, NULL, 0), +(NULL, 1, 0, 'die', 'die', '', NULL, NULL, 0), +(NULL, 1, 0, 'loadmod', 'loadmod', '', NULL, NULL, 0), +(NULL, 1, 0, 'unloadmod', 'unloadmod', '', NULL, NULL, 0), +(NULL, 1, 0, 'reloadmod', 'reloadmod', '', NULL, NULL, 0), +(NULL, 1, 0, 'modules', 'modules', '', NULL, NULL, 0), +(NULL, 1, 0, 'changelevel', 'clvl', '', NULL, NULL, 0), +(NULL, 1, 0, 'changelvl', 'clvl', '', NULL, NULL, 0), +(NULL, 1, 0, '4wins', 'NeonFun.4wins', '', NULL, NULL, 0), +(NULL, 1, 0, '4stone', 'NeonFun.4stone', '', NULL, NULL, 0), +(NULL, 1, 0, '4view', 'NeonFun.4view', '', NULL, NULL, 0), +(NULL, 1, 0, 'uno', 'NeonFun.uno', '', NULL, NULL, 0), +(NULL, 1, 0, 'unoplay', 'NeonFun.unoplay', '', NULL, NULL, 0), +(NULL, 1, 0, 'unotake', 'NeonFun.unotake', '', NULL, NULL, 0), +(NULL, 1, 0, 'netstats', 'netinfo', '', NULL, NULL, 0), +(NULL, 1, 0, 'bomb', 'funcmd.bomb', '', NULL, NULL, 0), +(NULL, 1, 0, 'inviteme all', 'invitemeall', '', NULL, NULL, 0), +(NULL, 1, 0, 'ship', 'funcmd.ship', '', NULL, NULL, 0), +(NULL, 1, 0, 'bj', 'NeonFun.blackjack', '', NULL, NULL, 0), +(NULL, 1, 0, 'bjtake', 'NeonFun.bjtake', '', NULL, NULL, 0), +(NULL, 1, 0, 'bjenough', 'NeonFun.bjenough', '', NULL, NULL, 0), + +(NULL, 2, 0, 'bind', 'bind', '', NULL, NULL, 0), +(NULL, 2, 0, 'unbind', 'unbind', '', NULL, NULL, 0), +(NULL, 2, 0, 'register', 'register', '', NULL, NULL, 0), +(NULL, 2, 0, 'unregister', 'unregister', '', NULL, NULL, 0), +(NULL, 2, 0, 'version', 'version', '', NULL, NULL, 0), +(NULL, 2, 0, 'netinfo', 'netinfo', '', NULL, NULL, 0), +(NULL, 2, 0, 'set', 'set', '', NULL, NULL, 0), +(NULL, 2, 0, 'csuspend', 'csuspend', '', NULL, NULL, 0), +(NULL, 2, 0, 'cunsuspend', 'cunsuspend', '', NULL, NULL, 0), +(NULL, 2, 0, 'say', 'say', '', NULL, NULL, 0), +(NULL, 2, 0, 'emote', 'emote', '', NULL, NULL, 0), +(NULL, 2, 0, 'notice', 'notice', '', NULL, NULL, 0), +(NULL, 2, 0, 'raw', 'raw', '', NULL, NULL, 0), +(NULL, 2, 0, 'god', 'god', '', NULL, NULL, 0), +(NULL, 2, 0, 'commands', 'commands', '', NULL, NULL, 0), +(NULL, 2, 0, 'bans', 'NeonServ.bans', '', NULL, NULL, 0), +(NULL, 2, 0, 'banlist', 'NeonServ.bans', '', NULL, NULL, 0), +(NULL, 2, 0, 'delban', 'NeonServ.delban', '', NULL, NULL, 0), +(NULL, 2, 0, 'addban', 'NeonServ.addban', '', NULL, NULL, 0), +(NULL, 2, 0, 'search', 'NeonServ.search', '', NULL, NULL, 0), +(NULL, 2, 0, 'unreg', 'unregister', '', NULL, NULL, 0), +(NULL, 2, 0, 'reg', 'register', '', NULL, NULL, 0), +(NULL, 2, 0, 'move', 'move', '', NULL, NULL, 0), +(NULL, 2, 0, 'badwords', 'badwords', '', NULL, NULL, 0), +(NULL, 2, 0, 'listbad', 'badwords', '', NULL, NULL, 0), +(NULL, 2, 0, 'addbad', 'addbad', '', NULL, NULL, 0), +(NULL, 2, 0, 'delbad', 'delbad', '', NULL, NULL, 0), + +(NULL, 3, 0, 'bind', 'bind', '', NULL, NULL, 0), +(NULL, 3, 0, 'unbind', 'unbind', '', NULL, NULL, 0), +(NULL, 3, 0, 'say', 'say', '', NULL, NULL, 0), +(NULL, 3, 0, 'notice', 'notice', '', NULL, NULL, 0), +(NULL, 3, 0, 'emote', 'emote', '', NULL, NULL, 0), + +(NULL, 4, 0, 'raw', 'raw', '', NULL, NULL, 0), +(NULL, 4, 0, 'next', 'next', '', NULL, NULL, 0), +(NULL, 4, 0, 'requests', 'requests', '', NULL, NULL, 0), +(NULL, 4, 0, 'delete', 'delete', '', NULL, NULL, 0), +(NULL, 4, 0, 'del', 'delete', '', NULL, NULL, 0), +(NULL, 4, 0, 'reqs', 'requests', '', NULL, NULL, 0), +(NULL, 4, 0, 'commands', 'commands', '', NULL, NULL, 0), +(NULL, 4, 0, 'version', 'version', '', NULL, NULL, 0), +(NULL, 4, 0, 'netinfo', 'netinfo', '', NULL, NULL, 0), +(NULL, 4, 0, 'stats', 'stats', '', NULL, NULL, 0), +(NULL, 4, 0, 'history', 'history', '', NULL, NULL, 0), +(NULL, 4, 0, 'register', 'register', '', NULL, NULL, 0), +(NULL, 4, 0, 'unregister', 'unregister', '', NULL, NULL, 0), + +(NULL, 6, 0, 'backup', 'linker', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup bind', 'bind', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup unbind', 'unbind', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup modcmd', 'modcmd', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup register', 'register', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup unregister', 'unregister', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup commands', 'commands', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup command', 'command', '', NULL, NULL, 0), +(NULL, 6, 0, 'ping', 'funcmd.ping', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup search', 'neonserv.search', '', NULL, NULL, 0), +(NULL, 6, 0, 'backup raw', 'raw', '', NULL, NULL, 0), + +(NULL, 7, 0, 'kickserv register', 'register', '', NULL, NULL, 0), +(NULL, 7, 0, 'kickserv unregister', 'unregister', '', NULL, NULL, 0), +(NULL, 7, 0, 'kickserv raw', 'raw', '', NULL, NULL, 0), +(NULL, 7, 0, 'kickserv bind', 'bind', '', NULL, NULL, 0), +(NULL, 7, 0, 'kickserv unbind', 'unbind', '', NULL, NULL, 0), +(NULL, 7, 0, 'kickserv modcmd', 'modcmd', '', NULL, NULL, 0), +(NULL, 7, 0, 'kickserv', 'linker', '', NULL, NULL, 0), -INSERT INTO `bot_binds` (`id`, `botclass`, `botid`, `command`, `function`, `parameters`, `chan_access`, `global_access`, `flags`) VALUES -(1, 1, 0, 'bind', 'bind', '', NULL, NULL, 0), -(3, 1, 0, 'unbind', 'unbind', '', NULL, NULL, 0), -(4, 1, 0, 'adduser', 'adduser', '', NULL, NULL, 0), -(5, 1, 0, 'addowner', 'adduser', '%1 500', NULL, NULL, 0), -(6, 1, 0, 'addcoowner', 'adduser', '%1 400', NULL, NULL, 0), -(7, 1, 0, 'addco', 'adduser', '%1 400', NULL, NULL, 0), -(8, 1, 0, 'addmaster', 'adduser', '%1 300', NULL, NULL, 0), -(9, 1, 0, 'addop', 'adduser', '%1 200', NULL, NULL, 0), -(10, 1, 0, 'addpeon', 'adduser', '%1 100', NULL, NULL, 0), -(11, 1, 0, 'addvoice', 'adduser', '%1 100', NULL, NULL, 0), -(12, 1, 0, 'deluser', 'deluser', '', NULL, NULL, 0), -(13, 1, 0, 'clvl', 'clvl', '', NULL, NULL, 0), -(125, 1, 0, 'access', 'access', '', NULL, NULL, 0), -(124, 1, 0, 'a', 'access', '', NULL, NULL, 0), -(16, 1, 0, 'users', 'users', '', NULL, NULL, 0), -(17, 1, 0, 'vlist', 'users', '%1|* 100 199', NULL, NULL, 0), -(18, 1, 0, 'olist', 'users', '%1|* 200 299', NULL, NULL, 0), -(19, 1, 0, 'plist', 'users', '%1|* 100 199', NULL, NULL, 0), -(20, 1, 0, 'mlist', 'users', '%1|* 300 399', NULL, NULL, 0), -(21, 1, 0, 'clist', 'users', '%1|* 400 499', NULL, NULL, 0), -(22, 1, 0, 'suspend', 'suspend', '', NULL, NULL, 0), -(23, 1, 0, 'unsuspend', 'unsuspend', '', NULL, NULL, 0), -(24, 1, 0, 'delme', 'delme', '', NULL, NULL, 0), -(25, 1, 0, 'deleteme', 'delme', '', NULL, NULL, 0), -(26, 1, 0, 'myaccess', 'myaccess', '', NULL, NULL, 0), -(27, 1, 0, 'mya', 'myaccess', '', NULL, NULL, 0), -(28, 1, 0, 'ma', 'myaccess', '', NULL, NULL, 0), -(29, 1, 0, 'up', 'up', '', NULL, NULL, 0), -(30, 1, 0, 'down', 'down', '', NULL, NULL, 0), -(31, 1, 0, 'upall', 'upall', '', NULL, NULL, 0), -(32, 1, 0, 'uall', 'upall', '', NULL, NULL, 0), -(33, 1, 0, 'downall', 'downall', '', NULL, NULL, 0), -(34, 1, 0, 'dall', 'downall', '', NULL, NULL, 0), -(35, 1, 0, 'mdeluser', 'mdeluser', '', NULL, NULL, 0), -(41, 1, 0, 'mdelop', 'mdeluser', '200 %1', NULL, NULL, 0), -(40, 1, 0, 'mdelvoice', 'mdeluser', '100 %1', NULL, NULL, 0), -(39, 1, 0, 'mdelpeon', 'mdeluser', '100 %1', NULL, NULL, 0), -(42, 1, 0, 'mdelmaster', 'mdeluser', '300 %1', NULL, NULL, 0), -(43, 1, 0, 'mdelcoowner', 'mdeluser', '400 %1', NULL, NULL, 0), -(44, 1, 0, 'mdelco', 'mdeluser', '400 %1', NULL, NULL, 0), -(45, 1, 0, 'trim', 'trim', '', NULL, NULL, 0), -(46, 1, 0, 'giveowner', 'giveowner', '', NULL, NULL, 0), -(47, 1, 0, 'giveownership', 'giveowner', '', NULL, NULL, 0), -(48, 1, 0, 'op', 'op', '', NULL, NULL, 0), -(49, 1, 0, 'deop', 'deop', '', NULL, NULL, 0), -(50, 1, 0, 'voice', 'voice', '', NULL, NULL, 0), -(51, 1, 0, 'devoice', 'devoice', '', NULL, NULL, 0), -(52, 1, 0, 'v', 'voice', '', NULL, NULL, 0), -(54, 1, 0, 'opall', 'opall', '', NULL, NULL, 0), -(55, 1, 0, 'deopall', 'deopall', '', NULL, NULL, 0), -(56, 1, 0, 'voiceall', 'voiceall', '', NULL, NULL, 0), -(57, 1, 0, 'vall', 'voiceall', '', NULL, NULL, 0), -(58, 1, 0, 'devoiceall', 'devoiceall', '', NULL, NULL, 0), -(59, 1, 0, 'set', 'set', '', NULL, NULL, 0), -(60, 1, 0, 'kick', 'kick', '', NULL, NULL, 0), -(61, 1, 0, 'k', 'kick', '', NULL, NULL, 0), -(62, 1, 0, 'kickban', 'kickban', '', NULL, NULL, 0), -(63, 1, 0, 'kb', 'kickban', '', NULL, NULL, 0), -(64, 1, 0, 'ban', 'ban', '', NULL, NULL, 0), -(65, 1, 0, 'b', 'ban', '', NULL, NULL, 0), -(66, 1, 0, 'wipeinfo', 'wipeinfo', '', NULL, NULL, 0), -(67, 1, 0, 'deluinfo', 'wipeinfo', '', NULL, NULL, 0), -(68, 1, 0, 'addban', 'addban', '', NULL, NULL, 0), -(69, 1, 0, 'ab', 'addban', '', NULL, NULL, 0), -(70, 1, 0, 'bans', 'bans', '', NULL, NULL, 0), -(71, 1, 0, 'shitlist', 'bans', '', NULL, NULL, 0), -(72, 1, 0, 'showbans', 'bans', '', NULL, NULL, 0), -(73, 1, 0, 'showban', 'bans', '', NULL, NULL, 0), -(74, 1, 0, 'delban', 'delban', '', NULL, NULL, 0), -(75, 1, 0, 'netinfo', 'netinfo', '', NULL, NULL, 0), -(76, 1, 0, 'topic', 'topic', '', NULL, NULL, 0), -(78, 1, 0, 'chanservsync', 'chanservsync', '', NULL, NULL, 0), -(79, 1, 0, 'resync', 'resync', '', NULL, NULL, 0), -(81, 1, 0, 'addtimeban', 'addtimeban', '', NULL, NULL, 0), -(82, 1, 0, 'addtimedban', 'addtimeban', '', NULL, NULL, 0), -(83, 1, 0, 'timeban', 'addtimeban', '', NULL, NULL, 0), -(84, 1, 0, 'timedban', 'addtimeban', '', NULL, NULL, 0), -(85, 1, 0, 'tb', 'addtimeban', '', NULL, NULL, 0), -(86, 1, 0, 'atb', 'addtimeban', '', NULL, NULL, 0), -(87, 1, 0, 'mode', 'mode', '', NULL, NULL, 0), -(89, 1, 0, 'version', 'version', '', NULL, NULL, 0), -(90, 1, 0, 'peek', 'peek', '', NULL, NULL, 0), -(91, 1, 0, 'uset', 'uset', '', NULL, NULL, 0), -(92, 1, 0, 'aset', 'uset', '', NULL, NULL, 0), -(93, 1, 0, 'unban', 'unban', '', NULL, NULL, 0), -(94, 1, 0, 'ub', 'unban', '', NULL, NULL, 0), -(95, 1, 0, 'unbanall', 'unbanall', '', NULL, NULL, 0), -(96, 1, 0, 'uba', 'unbanall', '', NULL, NULL, 0), -(97, 1, 0, 'unbanme', 'unbanme', '', NULL, NULL, 0), -(98, 1, 0, 'ubme', 'unbanme', '', NULL, NULL, 0), -(99, 1, 0, 'invite', 'invite', '', NULL, NULL, 0), -(101, 1, 0, 'inviteme', 'inviteme', '', NULL, NULL, 0), -(102, 1, 0, 'help', 'help', '', NULL, NULL, 0), -(201, 1, 0, 'cmds', 'commands', '', NULL, NULL, 0), -(104, 1, 0, 'trace', 'trace', '', NULL, NULL, 0), -(105, 1, 0, 'register', 'register', '', NULL, NULL, 0), -(106, 1, 0, 'reg', 'register', '', NULL, NULL, 0), -(107, 1, 0, 'unregister', 'unregister', '', NULL, NULL, 0), -(108, 1, 0, 'unreg', 'unregister', '', NULL, NULL, 0), -(109, 1, 0, 'recover', 'recover', '', NULL, NULL, 0), -(110, 1, 0, 'say', 'say', '', NULL, NULL, 0), -(111, 1, 0, 'emote', 'emote', '', NULL, NULL, 0), -(112, 1, 0, 'notice', 'notice', '', NULL, NULL, 0), -(113, 1, 0, 'raw', 'raw', '', NULL, NULL, 0), -(114, 1, 0, 'god', 'god', '', NULL, NULL, 0), -(115, 1, 0, 'godmode', 'god', '', NULL, NULL, 0), -(116, 1, 0, 'reloadlang', 'reloadlang', '', NULL, NULL, 0), -(117, 1, 0, 'csuspend', 'csuspend', '', NULL, NULL, 0), -(118, 1, 0, 'cunsuspend', 'cunsuspend', '', NULL, NULL, 0), -(119, 1, 0, 'move', 'move', '', NULL, NULL, 0), -(120, 1, 0, 'events', 'events', '', NULL, NULL, 0), -(121, 1, 0, 'oplog', 'oplog', '', NULL, NULL, 0), -(122, 1, 0, 'search', 'search', '', NULL, NULL, 0), -(123, 1, 0, 'command', 'command', '', NULL, NULL, 0), -(126, 1, 0, 'va', 'voiceall', '', NULL, NULL, 0), -(127, 1, 0, 'setaccess', 'setaccess', '', NULL, NULL, 0), -(129, 1, 0, 'suckers', 'bans', '', NULL, NULL, 0), -(130, 1, 0, 'fu', 'kick', '', NULL, NULL, 0), -(131, 1, 0, 'mobb', 'kick', '', NULL, NULL, 0), -(132, 1, 0, 'blist', 'bans', '', NULL, NULL, 0), -(133, 1, 0, 'addrank', 'addrank', '', NULL, NULL, 0), -(134, 1, 0, 'delrank', 'delrank', '', NULL, NULL, 0), -(135, 1, 0, 'listrank', 'listrank', '', NULL, NULL, 0), -(136, 1, 0, 'rank', 'assignrank', '', NULL, NULL, 0), -(137, 1, 0, 'assignrank', 'assignrank', '', NULL, NULL, 0), -(138, 1, 0, 'setrank', 'setrank', '', NULL, NULL, 0), -(139, 1, 0, 'ranks', 'listrank', '', NULL, NULL, 0), -(145, 1, 0, 'setinfo', 'uset', 'info %1-', NULL, NULL, 0), -(147, 1, 0, 'info', 'info', '', NULL, NULL, 0), -(148, 1, 0, 'rename', 'rename', '', NULL, NULL, 0), -(149, 1, 0, 'unvisited', 'unvisited', '', NULL, NULL, 0), -(150, 1, 0, 'add', 'adduser', '', NULL, NULL, 0), -(151, 2, 0, 'bind', 'bind', '', NULL, NULL, 0), -(152, 2, 0, 'unbind', 'unbind', '', NULL, NULL, 0), -(153, 2, 0, 'register', 'register', '', NULL, NULL, 0), -(154, 2, 0, 'unregister', 'unregister', '', NULL, NULL, 0), -(155, 2, 0, 'version', 'version', '', NULL, NULL, 0), -(156, 2, 0, 'netinfo', 'netinfo', '', NULL, NULL, 0), -(157, 2, 0, 'set', 'set', '', NULL, NULL, 0), -(158, 2, 0, 'csuspend', 'csuspend', '', NULL, NULL, 0), -(159, 2, 0, 'cunsuspend', 'cunsuspend', '', NULL, NULL, 0), -(160, 2, 0, 'say', 'say', '', NULL, NULL, 0), -(161, 2, 0, 'emote', 'emote', '', NULL, NULL, 0), -(162, 2, 0, 'notice', 'notice', '', NULL, NULL, 0), -(163, 2, 0, 'raw', 'raw', '', NULL, NULL, 0), -(164, 2, 0, 'god', 'god', '', NULL, NULL, 0), -(165, 3, 0, 'bind', 'bind', '', NULL, NULL, 0), -(166, 3, 0, 'unbind', 'unbind', '', NULL, NULL, 0), -(167, 3, 0, 'say', 'say', '', NULL, NULL, 0), -(168, 3, 0, 'notice', 'notice', '', NULL, NULL, 0), -(169, 3, 0, 'emote', 'emote', '', NULL, NULL, 0), -(177, 1, 0, 'dns', 'extscript', 'toys php scripts/dnslookup.php $1- %1+', NULL, NULL, 0), -(171, 1, 0, 'sync', 'resync', '', NULL, NULL, 0), -(172, 1, 0, 'dv', 'devoice', '', NULL, NULL, 0), -(176, 1, 0, 'calc', 'extscript', 'toys php scripts/calc.php $1- %1+', NULL, NULL, 0), -(174, 2, 0, 'commands', 'commands', '', NULL, NULL, 0), -(178, 1, 0, 'iplocate', 'extscript', 'toys php scripts/iplocate.php $1- %1+', NULL, NULL, 0), -(179, 1, 0, 'ping', 'funcmd.ping', '', NULL, NULL, 0), -(180, 1, 0, 'pong', 'funcmd.pong', '', NULL, NULL, 0), -(181, 1, 0, 'dice', 'funcmd.dice', '', NULL, NULL, 0), -(182, 1, 0, 'd', 'funcmd.dice', '', NULL, NULL, 0), -(183, 1, 0, '8ball', 'funcmd.8ball', '', NULL, NULL, 0), -(184, 1, 0, '8', 'funcmd.8ball', '', NULL, NULL, 0), -(185, 1, 0, 'staff', 'staff', '', NULL, NULL, 0), -(186, 2, 0, 'bans', 'NeonServ.bans', '', NULL, NULL, 0), -(187, 2, 0, 'banlist', 'NeonServ.bans', '', NULL, NULL, 0), -(188, 2, 0, 'delban', 'NeonServ.delban', '', NULL, NULL, 0), -(189, 2, 0, 'addban', 'NeonServ.addban', '', NULL, NULL, 0), -(190, 1, 0, 'noregister', 'noregister', '', NULL, NULL, 0), -(191, 1, 0, 'commands', 'commands', '', NULL, NULL, 0), -(192, 1, 0, 'oplogs', 'oplog', '', NULL, NULL, 0), -(193, 1, 0, 'cmd', 'command', '', NULL, NULL, 0), -(194, 1, 0, 'team', 'staff', '', NULL, NULL, 0), -(195, 1, 0, 'syncusers', 'chanservsync', '', NULL, NULL, 0), -(196, 2, 0, 'search', 'NeonServ.search', '', NULL, NULL, 0), -(197, 1, 0, 'cookie', 'FunCMD.cookie', '', NULL, NULL, 0), -(198, 1, 0, 'ping_ip', 'extscript', 'toys php scripts/ping.php $1- %1+', NULL, NULL, 0), -(199, 1, 0, 'banlist', 'bans', '', NULL, NULL, 0), -(200, 1, 0, 'del', 'deluser', '', NULL, NULL, 0), -(202, 1, 0, 'nicklist', 'nicklist', '', NULL, NULL, 0), -(206, 1, 0, 'bots', 'bots', '', NULL, NULL, 0), -(207, 1, 0, 'bot list', 'bots', '', NULL, NULL, 0), -(208, 1, 0, 'bot add', 'addbot', '', NULL, NULL, 0), -(209, 1, 0, 'bot del', 'delbot', '', NULL, NULL, 0), -(210, 1, 0, 'bot reconnect', 'reconnect', '', NULL, NULL, 0), -(211, 1, 0, 'bot', 'linker', '', NULL, NULL, 0), -(212, 1, 0, 'bot set', 'setbot', '', NULL, NULL, 0), -(245, 1, 0, 'dva', 'devoiceall', '', NULL, NULL, 0), -(246, 1, 0, 'restart', 'restart', '', NULL, NULL, 0), -(247, 1, 0, 'showcommands', 'commands', '', NULL, NULL, 0), -(249, 2, 0, 'unreg', 'unregister', '', NULL, NULL, 0), -(252, 4, 0, 'raw', 'raw', '', NULL, NULL, 0), -(253, 4, 0, 'next', 'next', '', NULL, NULL, 0), -(255, 4, 0, 'requests', 'requests', '', NULL, NULL, 0), -(256, 4, 0, 'delete', 'delete', '', NULL, NULL, 0), -(257, 4, 0, 'del', 'delete', '', NULL, NULL, 0), -(258, 4, 0, 'reqs', 'requests', '', NULL, NULL, 0), -(260, 4, 0, 'supp', 'NeonServ.inviteme', '#Krypton-support', NULL, NULL, 0), -(261, 4, 0, 'KryptonHelp bind', 'bind', '', NULL, NULL, 0), -(262, 4, 0, 'KryptonHelp unbind', 'unbind', '', NULL, NULL, 0), -(263, 4, 0, 'KryptonHelp commands', 'commands', '', NULL, NULL, 0), -(264, 4, 0, 'KryptonHelp addbot', 'addbot', '', NULL, NULL, 0), -(265, 4, 0, 'KryptonHelp delbot', 'delbot', '', NULL, NULL, 0), -(266, 4, 0, 'KryptonHelp setbot', 'setbot', '', NULL, NULL, 0), -(267, 4, 0, 'KryptonHelp version', 'version', '', NULL, NULL, 0), -(268, 4, 0, 'KryptonHelp say', 'say', '', NULL, NULL, 0), -(269, 4, 0, 'KryptonHelp emote', 'emote', '', NULL, NULL, 0), -(270, 4, 0, 'KryptonHelp notice', 'notice', '', NULL, NULL, 0), -(271, 4, 0, 'KryptonHelp raw', 'raw', '', NULL, NULL, 0), -(272, 4, 0, 'KryptonHelp netinfo', 'netinfo', '', NULL, NULL, 0), -(273, 4, 0, 'KryptonHelp', 'linker', '', NULL, NULL, 0), -(274, 4, 0, 'KryptonHelp bots', 'bots', '', NULL, NULL, 0), -(275, 4, 0, 'KryptonHelp modcmd', 'modcmd', '', NULL, NULL, 0), -(284, 1, 0, 'moo', 'extscript', 'toys apt-get moo %1+', NULL, NULL, 0), -(285, 1, 0, 'botinfo', 'netinfo', '', NULL, NULL, 0), -(286, 2, 0, 'reg', 'register', '', NULL, NULL, 0), -(287, 1, 0, 'reload', 'reload', '', NULL, NULL, 0), -(288, 4, 0, 'stats', 'stats', '', NULL, NULL, 0), -(304, 1, 0, 'meminfo', 'meminfo', '', NULL, NULL, 0), -(306, 1, 0, 'die', 'die', '', NULL, NULL, 0), -(307, 1, 0, 'loadmod', 'loadmod', '', NULL, NULL, 0), -(308, 1, 0, 'unloadmod', 'unloadmod', '', NULL, NULL, 0), -(309, 1, 0, 'reloadmod', 'reloadmod', '', NULL, NULL, 0), -(310, 1, 0, 'modules', 'modules', '', NULL, NULL, 0), -(311, 2, 0, 'move', 'move', '', NULL, NULL, 0); +(NULL, 1, 0, 'dns', 'extscript', 'toys php scripts/examples/dnslookup.php $1 $2 %1+', NULL, NULL, 0), +(NULL, 1, 0, 'calc', 'funcmd.extscript', 'toys php scripts/examples/calc.php $1- %1+', NULL, NULL, 0); -- diff --git a/scripts/examples/calc.php b/scripts/examples/calc.php new file mode 100644 index 0000000..b907bc5 --- /dev/null +++ b/scripts/examples/calc.php @@ -0,0 +1,102 @@ +. + */ + +$text = implode(" ", array_slice($argv, 1)); + +$descriptor = array(0 => array("pipe", "r"),1 => array("pipe", "w"),2 => array("pipe", "w")); +$proc = proc_open('bc -l -q', $descriptor, $pipes); + +if(!is_resource($proc)) { + echo"internal calc error - please contact an administrator.\n"; + die(); +} + +fwrite($pipes[0], $text."\nquit\n"); + +$start = time(); + +$read=array($pipes[1]); +$write=NULL; +$except=NULL; + +while(1) { + $data = proc_get_status($proc); + if(!$data['running']) { + $out=""; + while(!feof($pipes[1])) { + $out .= fgets($pipes[1], 128); + } + if($out == "") { + $out="\0034"; + while(!feof($pipes[2])) { + $out .= fgets($pipes[2], 128); + } + $out.=""; + } + $out=str_replace("\n","",$out); + $out=str_replace("\r","",$out); + $out=str_replace("\\","",$out); + + if(strlen($text) > 20) { + if(strlen($out) > 450) { + echo "output too long (".strlen($out).")\n"; + } else { + echo "".$text."\n"; + echo $out."\n"; + } + } else { + $fout="".$text." = ".$out; + if(strlen($fout) > 450) { + echo "output too long (".strlen($out).")"; + } else { + echo $fout."\n"; + } + } + + fclose($pipes[0]); + fclose($pipes[1]); + fclose($pipes[2]); + proc_close($proc); + + die(); + } else { + + if($start+3 > time()) { + usleep(200000); //200ms + } else { + //TIMEOUT + fclose($pipes[0]); + fclose($pipes[1]); + fclose($pipes[2]); + //can't simply use proc_terminate: https://bugs.php.net/bug.php?id=39992 + $ppid = $data['pid']; + //use ps to get all the children of this process, and kill them + $pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`); + foreach($pids as $pid) { + if(is_numeric($pid)) { + posix_kill($pid, 9); //SIGKILL signal + } + } + proc_close($proc); + echo "calculator timeout. (maximum of 3 seconds exceeded)\n"; + die(); + } + } +} + +?> diff --git a/scripts/examples/dnslookup.php b/scripts/examples/dnslookup.php new file mode 100644 index 0000000..84ad4bc --- /dev/null +++ b/scripts/examples/dnslookup.php @@ -0,0 +1,180 @@ +. + */ + +function time2str($time, $anz = 9) { + $str=""; + if(!$anz) $anz=9; + if($time>=(60*60*24*365) && $anz > 0) { + $anz--; + $years=floor($time/(60*60*24*365)); + $str.=$years."Y"; + $time=$time-((60*60*24*365)*$years); + } + if($time>=(60*60*24*30) && $anz > 0) { + $anz--; + $months=floor($time/(60*60*24*30)); + if($str != "") $str.=" "; + $str.=$months."M"; + $time=$time-((60*60*24*30)*$months); + } + if($time>=(60*60*24) && $anz > 0) { + $anz--; + $days=floor($time/(60*60*24)); + if($str != "") $str.=" "; + $str.=$days."d"; + $time=$time-((60*60*24)*$days); + } + if($time>=(60*60) && $anz > 0) { + $anz--; + $stunden=floor($time/(60*60)); + if($str != "") $str.=" "; + $str.=$stunden."h"; + $time=$time-((60*60)*$stunden); + } + if($time>=(60) && $anz > 0) { + $anz--; + $min=floor($time/(60)); + if($str != "") $str.=" "; + $str.=$min."m"; + $time=$time-((60)*$min); + } + if(($time>1 || $str == "") && $anz > 0){ + $anz--; + if($str != "") $str.=" "; + $str.=$time."s"; + } + return $str; +} + + +$host = $argv[1]; +$show_record = strtoupper($argv[2]); + +$pattern_ipv6 = '/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))(|\/[0-9]{1,3})$/'; +$pattern_ipv4 = '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(|\/[0-9]{1,2})$/'; + +$record_order = array("SOA", "NS", "A", "AAAA", "MX"); + +function show_subrecords($host) { + $dns = dns_get_record($host, DNS_ALL); + if(count($dns)) { + usort($dns, "sort_records"); + foreach($dns as $record) { + switch($record['type']) { + case "A": + echo" \002A \002 ".$record['ip'].($record['ttl'] < 86400 ? " (ttl: ".time2str($record['ttl'],2).")" : "")."\n"; + break; + case "AAAA": + echo" \002AAAA \002 ".$record['ipv6'].($record['ttl'] < 86400 ? " (ttl: ".time2str($record['ttl'],2).")" : "")."\n"; + break; + case "CNAME": + echo" \002CNAME \002 ".$record['target']."\n"; + break; + } + } + } +} + +function sort_records($a, $b) { + global $record_order; + $index_a = array_search($a['type'], $record_order); + if($index_a === FALSE) $index_a = count($record_order); + $index_b = array_search($b['type'], $record_order); + if($index_b === FALSE) $index_b = count($record_order); + $order = $index_a - $index_b; + if($order == 0) { + switch($record['type']) { + case "A": + $suborder = "ip"; + break; + case "AAAA": + $suborder = "ipv6"; + break; + case "TXT": + $suborder = "txt"; + break; + default: + $suborder = "target"; + break; + } + $order = strcmp($a[$suborder], $b[$suborder]); + } + return $order; +} + +if(strlen($host) && preg_match("#^((([a-z0-9-.]*)\.|)([a-z]{2,5})|).?$#i", $host)) { + $dns = dns_get_record($host, DNS_ALL); + echo"DNS Records for \002".$host."\002:"; + if($show_record != "" && $show_record != "*" && $show_record != "ANY") + echo" (".$show_record.")"; + echo"\n"; + if(count($dns)) { + usort($dns, "sort_records"); + foreach($dns as $record) { + if($show_record != "" && $show_record != "*" && $show_record != "ANY" && $show_record != $record['type']) + continue; + switch($record['type']) { + case "A": + echo" \002A \002 ".$record['ip'].($record['ttl'] < 86400 ? " (ttl: ".time2str($record['ttl'],2).")" : "")."\n"; + break; + case "AAAA": + echo" \002AAAA \002 ".$record['ipv6'].($record['ttl'] < 86400 ? " (ttl: ".time2str($record['ttl'],2).")" : "")."\n"; + break; + case "MX": + echo" \002MX \002 ".$record['target']." (priority: ".$record['pri'].")\n"; + if($show_record == "MX") { + show_subrecords($record['target']); + } + break; + case "NS": + echo" \002NS \002 ".$record['target']."\n"; + if($show_record == "NS") { + show_subrecords($record['target']); + } + break; + case "CNAME": + echo" \002CNAME \002 ".$record['target']."\n"; + break; + case "TXT": + echo" \002TXT \002 ".$record['txt']."\n"; + break; + case "SOA": + if($show_record != "SOA") { + echo" \002SOA \002 (see: dns ".$host." SOA)\n"; + break; + } + echo" \002SOA \002 (Start of Authority):\n"; + echo" name: ".$record['mname']."\n"; + echo" serial: ".$record['serial']."\n"; + echo" refresh: ".$record['refresh']." (".time2str($record['refresh'], 2).")\n"; + echo" retry: ".$record['retry']." (".time2str($record['retry'], 2).")\n"; + echo" expire: ".$record['expire']." (".time2str($record['expire'], 2).")\n"; + echo" TTL: ".$record['minimum-ttl']." (".time2str($record['minimum-ttl'], 2).")\n"; + break; + } + } + } else + echo"No records found.\n"; +} else if(preg_match($pattern_ipv4, $host) || preg_match($pattern_ipv6, $host)) { + $hostname = gethostbyaddr($host); + echo"Reverse Lookup for \002".$host."\002:\n"; + echo " \002PTR \002 ".$hostname."\n"; +} else { + echo"Invalid Hostname or IP-Address.\n"; +} +?>