From e29b1456c06576b607fd255f5da34a3cc3e97ca2 Mon Sep 17 00:00:00 2001 From: Janik Kleinhoff Date: Mon, 5 Sep 2016 01:09:49 +0000 Subject: Extirpate traces of XML Summary: Resolve T6 and use the opportunity to get rid of our dependency on `XML::Simple` once and for all. Test Plan: Run the bot with JSON config files. Reviewers: Unit193 Reviewed By: Unit193 Tags: #antispammeta Maniphest Tasks: T6 Differential Revision: https://asm.shalture.org/D1 --- config-default/blacklist.json | 1 + config-default/blacklist.xml | 2 - config-default/channels.json | 19 ++ config-default/channels.xml | 16 -- config-default/dnsbl.json | 95 ++++++++++ config-default/dnsbl.xml | 37 ---- config-default/mysql.json | 16 ++ config-default/mysql.xml | 16 -- config-default/restrictions.json | 5 + config-default/restrictions.xml | 8 - config-default/rules.json | 368 +++++++++++++++++++++++++++++++++++++++ config-default/rules.xml | 59 ------- config-default/settings.json | 35 ++++ config-default/settings.xml | 37 ---- config-default/users.json | 7 + config-default/users.xml | 3 - cpanfile | 1 - lib/ASM/Config.pm | 44 +---- 18 files changed, 554 insertions(+), 215 deletions(-) create mode 100644 config-default/blacklist.json delete mode 100644 config-default/blacklist.xml create mode 100644 config-default/channels.json delete mode 100644 config-default/channels.xml create mode 100644 config-default/dnsbl.json delete mode 100644 config-default/dnsbl.xml create mode 100644 config-default/mysql.json delete mode 100644 config-default/mysql.xml create mode 100644 config-default/restrictions.json delete mode 100644 config-default/restrictions.xml create mode 100644 config-default/rules.json delete mode 100644 config-default/rules.xml create mode 100644 config-default/settings.json delete mode 100644 config-default/settings.xml create mode 100644 config-default/users.json delete mode 100644 config-default/users.xml diff --git a/config-default/blacklist.json b/config-default/blacklist.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/config-default/blacklist.json @@ -0,0 +1 @@ +{} diff --git a/config-default/blacklist.xml b/config-default/blacklist.xml deleted file mode 100644 index d2e12dc..0000000 --- a/config-default/blacklist.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/config-default/channels.json b/config-default/channels.json new file mode 100644 index 0000000..8f911ce --- /dev/null +++ b/config-default/channels.json @@ -0,0 +1,19 @@ +{ + "channel" : { + "#antispammeta" : { + "hilights" : {}, + "msgs" : {} + }, + "default" : { + "hilights" : {} + }, + "master" : { + "hilights" : {}, + "msgs" : { + "debug" : [ + "#antispammeta" + ] + } + } + } +} diff --git a/config-default/channels.xml b/config-default/channels.xml deleted file mode 100644 index 5bdb9e7..0000000 --- a/config-default/channels.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - #antispammeta - - - diff --git a/config-default/dnsbl.json b/config-default/dnsbl.json new file mode 100644 index 0000000..b217ebe --- /dev/null +++ b/config-default/dnsbl.json @@ -0,0 +1,95 @@ +{ + "query" : { + "dnsbl.dronebl.org." : { + "response" : { + "127.0.0.1" : { + "content" : "Testing data" + }, + "127.0.0.10" : { + "content" : "ProxyChain" + }, + "127.0.0.14" : { + "content" : "Open Wingate Proxy" + }, + "127.0.0.15" : { + "content" : "Compromised router / gateway" + }, + "127.0.0.2" : { + "content" : "Sample" + }, + "127.0.0.255" : { + "content" : "Unknown" + }, + "127.0.0.3" : { + "content" : "IRC Drone" + }, + "127.0.0.5" : { + "content" : "Bottler" + }, + "127.0.0.6" : { + "content" : "Unknown spambot or drone" + }, + "127.0.0.7" : { + "content" : "DDOS drone" + }, + "127.0.0.8" : { + "content" : "SOCKS proxy" + }, + "127.0.0.9" : { + "content" : "HTTP proxy" + } + } + }, + "dnsbl.incredibl.org." : { + "response" : { + "127.0.0.2" : { + "content" : "SOCKS Proxy" + }, + "127.0.0.3" : { + "content" : "IRC Proxy" + }, + "127.0.0.4" : { + "content" : "HTTP Proxy" + }, + "127.0.0.5" : { + "content" : "IRC Drone" + }, + "127.0.0.6" : { + "content" : "TOR" + } + } + }, + "dnsbl.sorbs.net." : { + "response" : { + "127.0.0.2" : { + "content" : "HTTP Proxy" + }, + "127.0.0.3" : { + "content" : "SOCKS Proxy" + }, + "127.0.0.4" : { + "content" : "Misc. proxy" + } + } + }, + "rbl.efnetrbl.org." : { + "response" : { + "127.0.0.1" : { + "content" : "Open proxy" + }, + "127.0.0.2" : { + "content" : "Trojan spreader" + }, + "127.0.0.3" : { + "content" : "Trojan infected client" + }, + "127.0.0.4" : { + "content" : "TOR exit server" + }, + "127.0.0.5" : { + "content" : "Drones / Flooding" + } + } + } + } +} diff --git a/config-default/dnsbl.xml b/config-default/dnsbl.xml deleted file mode 100644 index 01f72b4..0000000 --- a/config-default/dnsbl.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - Open proxy - Trojan spreader - Trojan infected client - TOR exit server - Drones / Flooding - - - Testing data - Sample - IRC Drone - Bottler - Unknown spambot or drone - DDOS drone - SOCKS proxy - HTTP proxy - ProxyChain - - Open Wingate Proxy - Compromised router / gateway - - Unknown - - - HTTP Proxy - SOCKS Proxy - Misc. proxy - - - SOCKS Proxy - IRC Proxy - HTTP Proxy - IRC Drone - TOR - - diff --git a/config-default/mysql.json b/config-default/mysql.json new file mode 100644 index 0000000..ca97b86 --- /dev/null +++ b/config-default/mysql.json @@ -0,0 +1,16 @@ +{ + "actiontable" : "actionlog", + "db" : "asm_main", + "dblog" : "asm_log", + "host" : "localhost", + "ignoredgecos" : [ + "new now know how" + ], + "ignoredidents" : [ + "~chatzilla" + ], + "pass" : "PASS", + "port" : "3307", + "table" : "alertlog", + "user" : "USER" +} diff --git a/config-default/mysql.xml b/config-default/mysql.xml deleted file mode 100644 index 299c167..0000000 --- a/config-default/mysql.xml +++ /dev/null @@ -1,16 +0,0 @@ - - USER - PASS - asm_main - asm_log - alertlog
- actionlog - localhost - 3307 - - ~chatzilla - - - new now know how - -
diff --git a/config-default/restrictions.json b/config-default/restrictions.json new file mode 100644 index 0000000..136061b --- /dev/null +++ b/config-default/restrictions.json @@ -0,0 +1,5 @@ +{ + "accounts" : {}, + "hosts" : {}, + "nicks" : {} +} diff --git a/config-default/restrictions.xml b/config-default/restrictions.xml deleted file mode 100644 index d32963f..0000000 --- a/config-default/restrictions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/config-default/rules.json b/config-default/rules.json new file mode 100644 index 0000000..fab019f --- /dev/null +++ b/config-default/rules.json @@ -0,0 +1,368 @@ +{ + "event" : { + "advflood" : { + "class" : "advsplitflood", + "content" : "5:3", + "reason" : "advanced distributed flooding", + "risk" : "high", + "type" : "public,part,caction" + }, + "appleexploit" : { + "class" : "re", + "content" : "سمَـ", + "reason" : "using the apple corefont exploit", + "risk" : "high", + "type" : "public,caction,part" + }, + "asciiflood" : { + "class" : "asciiflood", + "content" : "20:3:3", + "reason" : "ascii art algorithm", + "risk" : "medium", + "type" : "public" + }, + "autoremove" : { + "class" : "re", + "content" : "^requested by ChanServ", + "reason" : "on chanserv autoremove", + "risk" : "info", + "type" : "part" + }, + "banevade" : { + "class" : "banevade", + "content" : "contentisuseless", + "reason" : "appears to be ban evading", + "risk" : "info", + "type" : "join" + }, + "blacklist2" : { + "class" : "strblnew", + "content" : "blah", + "reason" : "blacklist $xresult", + "risk" : "medium", + "type" : "public,part,quit,caction" + }, + "blacklistpcre" : { + "class" : "strblpcre", + "content" : "blah", + "reason" : "pcre blacklist $xresult", + "risk" : "medium", + "type" : "public,part,quit,caction" + }, + "botnickbl" : { + "class" : "nickbl", + "content" : "contentisuseless", + "reason" : "matches against a possible bot nick", + "risk" : "info", + "type" : "join,nick" + }, + "botpattern1" : { + "class" : "nuhg", + "content" : "DISABLED[A-Za-z]{4}\\d+!~[A-Za-z]{4}@.*![A-Za-z]{4}", + "reason" : "matches probable botnet pattern", + "risk" : "debug", + "type" : "join" + }, + "cloning" : { + "class" : "cloning", + "content" : "3", + "reason" : "excessive clones detected ($xresult) !clonesdetected ", + "risk" : "debug", + "type" : "join" + }, + "ctcp-dcc" : { + "class" : "re", + "content" : ".*", + "reason" : "ctcp-dcc", + "risk" : "high", + "type" : "cdcc" + }, + "ctcp-ping" : { + "class" : "re", + "content" : ".*", + "reason" : "channel-wide CTCP PING", + "risk" : "medium", + "type" : "cping" + }, + "ctcp-version" : { + "class" : "re", + "content" : ".*", + "reason" : "channel-wide CTCP VERSION", + "risk" : "medium", + "type" : "cversion" + }, + "cyclebotnet" : { + "class" : "cyclebotnet", + "content" : "4:4:30", + "reason" : "botnet cyclespam", + "risk" : "high", + "type" : "part" + }, + "dcc" : { + "class" : "re", + "content" : "^DCC (SEND|S?CHAT) |\\bDCC (SEND|S?CHAT) \"?[A-Za-z0-9]+\"? \\d+ \\d+ \\d+", + "override" : "dcc-medium", + "reason" : "using the DC.C SE.ND exploit", + "risk" : "high", + "type" : "public" + }, + "dcc-medium" : { + "class" : "re", + "content" : "\\bDCC SEND ", + "reason" : "using the DC.C SE.ND exploit", + "risk" : "medium", + "type" : "public" + }, + "dcc-part" : { + "class" : "re", + "content" : "\\bDCC SEND ", + "reason" : "using the DC.C SE.ND exploit in a part message", + "risk" : "high", + "type" : "part" + }, + "dcc-topic" : { + "class" : "re", + "content" : "\\bDCC SEND ", + "reason" : "setting a bad topic", + "risk" : "medium", + "type" : "topic" + }, + "debugme" : { + "class" : "re", + "content" : "debugantispambotdebug", + "reason" : "sending a string designed to trigger a debug test alert, disregard this", + "risk" : "debug", + "type" : "public" + }, + "fakechristel" : { + "class" : "nuhg", + "content" : "(?i)chr[i1]ste[l1]_?!.*", + "reason" : "christel's nick but not host", + "risk" : "medium", + "type" : "join" + }, + "fakeglobal" : { + "class" : "re", + "content" : "(?i)\\[global notice\\]", + "override" : "notice", + "reason" : "fake global notice", + "risk" : "high", + "type" : "notice" + }, + "floodqueue10-20" : { + "class" : "floodqueue", + "content" : "10:20", + "reason" : "flooding (10 msgs in 20 seconds)", + "risk" : "low", + "type" : "public,caction" + }, + "genspammer2" : { + "class" : "nuhg", + "content" : ".*!~hyd@.*!.*", + "reason" : "suspicious NUHG, rule 3 (~hyd trolling 2012/12, 2013/03)", + "risk" : "info", + "type" : "join" + }, + "gnaa-topic" : { + "class" : "re", + "content" : "(?i)\\bgnaa\\b", + "reason" : "setting a GNAA topic", + "risk" : "medium", + "type" : "topic" + }, + "gnaaquit" : { + "class" : "re", + "content" : "(?i)\\bgnaa\\b", + "reason" : "quitting with a GNAA message", + "risk" : "medium", + "type" : "quit" + }, + "invite" : { + "class" : "invite", + "content" : "blah", + "reason" : "invited to a channel", + "risk" : "debug", + "type" : "invite" + }, + "joinflood" : { + "class" : "floodqueue", + "content" : "5:20", + "reason" : "join flood (5 joins in 20 seconds)", + "risk" : "medium", + "type" : "join" + }, + "joinfloodquiet" : { + "class" : "floodqueue2", + "content" : "3:90", + "reason" : "join flood (3 joins in 90 seconds) by quieted user", + "risk" : "low", + "type" : "join" + }, + "joinmsgquit" : { + "class" : "joinmsgquit", + "content" : "3", + "reason" : "joined, said something, parted/quit", + "risk" : "info", + "type" : "quit,part" + }, + "keylogger" : { + "class" : "re", + "content" : "^startkeylogger$|^stopkeylogger$", + "override" : "keylogger-medium", + "reason" : "using the norton start-key-logger exploit", + "risk" : "high", + "type" : "public" + }, + "keylogger-medium" : { + "class" : "re", + "content" : "\\bstartkeylogger\\b|\\bstopkeylogger\\b", + "reason" : "using the norton start-key-logger exploit", + "risk" : "medium", + "type" : "public" + }, + "last_measure_regex" : { + "class" : "re", + "content" : "(?i)(http://(\\S+\\.)?on\\.nimp\\.org|http://(\\S+\\.)?feenode.net|http://wikipaste\\.eu|http://(\\S+\\.)?bioghost\\.com|http://(\\S+\\.)?on\\.zoy\\.org|http://(lastmeasure|dirtysanchez|doom3|freeipods|halflife2|halo2|lastmeasure4|lastmeasureunified|softmeasure|traceroute)\\.zoy\\.org)", + "reason" : "posting what appears to be a last measure link", + "risk" : "high", + "type" : "public" + }, + "levenflood" : { + "class" : "levenflood", + "content" : "contentisuseless", + "override" : "flood-5to3", + "reason" : "levenshtein flood match", + "risk" : "low", + "type" : "public" + }, + "malspreader1" : { + "class" : "nuhg", + "content" : ".*!~NUMONE@.*!REAL_NAME", + "reason" : "suspicious NUHG, rule 1", + "risk" : "low", + "type" : "join" + }, + "massflood" : { + "class" : "splitflood", + "content" : "4:4", + "reason" : "distributed flooding", + "risk" : "high", + "type" : "public,caction" + }, + "meepsheep1" : { + "class" : "nuhg", + "content" : "(?i).*..psh..p.*", + "reason" : "common troll (meepsheep)", + "risk" : "info", + "type" : "join" + }, + "nickbl" : { + "class" : "nickfuzzy", + "content" : "1:chanserv,nickserv,hostserv,operserv,memoserv", + "reason" : "fuzzy matching against nick blacklist (services set)", + "risk" : "low", + "type" : "join,nick" + }, + "nickbl2" : { + "class" : "nickfuzzy", + "content" : "1:incog,meepsheep,blackman,brthmthr,patroclus_rex", + "reason" : "fuzzy matching against nick blacklist (set 2)", + "risk" : "debug", + "type" : "join,nick" + }, + "nickbl_impersonate" : { + "class" : "nickfuzzy", + "content" : "2:botchlab,bremmyfag,ilbelkyr,bremsstrahlung,ishanyx", + "reason" : "fuzzy matching against nick blacklist (impersonation set), see ;falsematch if in error", + "risk" : "medium", + "type" : "join,nick" + }, + "nickspam" : { + "class" : "nickspam", + "content" : "60:10", + "reason" : "nickspamming", + "risk" : "high", + "type" : "public" + }, + "notice" : { + "class" : "re", + "content" : ".*", + "reason" : "sending a notice to the channel", + "risk" : "medium", + "type" : "notice" + }, + "phishing1" : { + "class" : "re", + "content" : "identify.*/msg .* identify ", + "override" : "notice", + "reason" : "trying to steal passwords (v1)", + "risk" : "high", + "type" : "notice" + }, + "phishing2" : { + "class" : "re", + "content" : "^This nickname is registered", + "override" : "notice", + "reason" : "trying to steal passwords (v2)", + "risk" : "high", + "type" : "notice" + }, + "proxylist" : { + "class" : "proxy", + "content" : "lolz", + "reason" : "IP is blacklisted", + "risk" : "info", + "type" : "join" + }, + "redarmyoflol" : { + "class" : "re", + "content" : "RED ARMY OF LOL", + "reason" : "parting with 'red army of lol'", + "risk" : "low", + "type" : "part" + }, + "sms_spam" : { + "class" : "re", + "content" : "\\.com/sms.exe", + "reason" : "spam link / virus", + "risk" : "low", + "type" : "public" + }, + "suckmynick" : { + "class" : "re", + "content" : "(suck.*dick)", + "reason" : "using a potentially offensive nick", + "risk" : "low", + "type" : "join" + }, + "urlcrunch" : { + "class" : "urlcrunch", + "content" : "^(https?:\\/\\/bitly.com\\/a\\/warning|https?://(?:i.)?imgur.com|https?://(?:www.)?hotxgirls.net)", + "reason" : "URL that resolves to some place that is bad", + "risk" : "medium", + "type" : "public" + }, + "wikifags2" : { + "class" : "re", + "content" : "(?i)^sure are a ?lot of .*fags? in here", + "reason" : "saying 'sure are a lot of wikifag'...", + "risk" : "low", + "type" : "public" + }, + "xchatbroad" : { + "class" : "re", + "content" : "THISHASBEENDISABLED[ð-÷][€-¿]{3}", + "reason" : "using an x-chat for windows unicode exploit (broad detection version, may be error prone)", + "risk" : "low", + "type" : "public,part,quit,caction" + }, + "xchatexploit" : { + "class" : "re", + "content" : "󠁟", + "override" : "xchatbroad", + "reason" : "using an x-chat for windows unicode exploit", + "risk" : "high", + "type" : "public,part,quit,caction" + } + } +} diff --git a/config-default/rules.xml b/config-default/rules.xml deleted file mode 100644 index a8bd48c..0000000 --- a/config-default/rules.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4:4:30 - 3 - 5:3 - 20:3:3 - ^requested by ChanServ - blah - blah - 3 - .* - .* - .* - ^DCC (SEND|S?CHAT) |\bDCC (SEND|S?CHAT) "?[A-Za-z0-9]+"? \d+ \d+ \d+ - \bDCC SEND - \bDCC SEND - \bDCC SEND - debugantispambotdebug - سمَـ - - - (?i)chr[i1]ste[l1]_?!.* - (?i)\[global notice\] - 10:20 - (?i)\bgnaa\b - (?i)\bgnaa\b - 5:20 - ^startkeylogger$|^stopkeylogger$ - \bstartkeylogger\b|\bstopkeylogger\b - (?i)(http://(\S+\.)?on\.nimp\.org|http://(\S+\.)?feenode.net|http://wikipaste\.eu|http://(\S+\.)?bioghost\.com|http://(\S+\.)?on\.zoy\.org|http://(lastmeasure|dirtysanchez|doom3|freeipods|halflife2|halo2|lastmeasure4|lastmeasureunified|softmeasure|traceroute)\.zoy\.org) - contentisuseless - .*!~NUMONE@.*!REAL_NAME - - .*!~hyd@.*!.* - 4:4 - (?i).*..psh..p.* - 60:10 - .* - identify.*/msg .* identify <password> - ^This nickname is registered - RED ARMY OF LOL - \.com/sms.exe - - (suck.*dick) - (?i)^sure are a ?lot of .*fags? in here - THISHASBEENDISABLED[ð-÷][€-¿]{3} - 󠁟 - lolz - 1:chanserv,nickserv,hostserv,operserv,memoserv - 1:incog,meepsheep,blackman,brthmthr,patroclus_rex - 2:botchlab,bremmyfag,ilbelkyr,bremsstrahlung,ishanyx - contentisuseless - DISABLED[A-Za-z]{4}\d+!~[A-Za-z]{4}@.*![A-Za-z]{4} - contentisuseless - 3:90 - blah - ^(https?:\/\/bitly.com\/a\/warning|https?://(?:i.)?imgur.com|https?://(?:www.)?hotxgirls.net) - - diff --git a/config-default/settings.json b/config-default/settings.json new file mode 100644 index 0000000..6b6347c --- /dev/null +++ b/config-default/settings.json @@ -0,0 +1,35 @@ +{ + "altnicks" : [ + "AntiSpamMeta_", + "AntiSpamMeta2" + ], + "autojoins" : "#antispammeta", + "debugchan" : "#antispammeta-debug", + "log" : { + "actiondir" : "actionlogs/", + "detectdir" : "detectlogs/", + "dir" : "logs/", + "filefmt" : "-%Y-%m-%d.log", + "timefmt" : "%Y-%m-%d %T ", + "zone" : "GMT" + }, + "masterchan" : "#antispammeta", + "nick" : "AntiSpamMeta", + "pass" : {}, + "port" : "6697", + "realname" : "I am a new AntiSpamBot in the making.", + "server" : [ + "irc.freenode.net" + ], + "ssl" : "1", + "username" : "MetaBot", + "web" : { + "groupfile" : "/var/www/.htgroup", + "shortener" : { + "apikey" : "yoursecretkey", + "domain" : "yourls.org", + "secure" : "0" + }, + "userfile" : "/var/www/.htpasswd" + } +} diff --git a/config-default/settings.xml b/config-default/settings.xml deleted file mode 100644 index c9b84a0..0000000 --- a/config-default/settings.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - AntiSpamMeta_ - AntiSpamMeta2 - - - #antispammeta - - #antispammeta-debug - - actionlogs/ - detectlogs/ - logs/ - -%Y-%m-%d.log - %Y-%m-%d %T - GMT - - #antispammeta - AntiSpamMeta - - 6697 - 1 - I am a new AntiSpamBot in the making. - - irc.freenode.net - - MetaBot - - /var/www/.htgroup - /var/www/.htpasswd - - yoursecretkey - yourls.org - 0 - - - diff --git a/config-default/users.json b/config-default/users.json new file mode 100644 index 0000000..68ef65c --- /dev/null +++ b/config-default/users.json @@ -0,0 +1,7 @@ +{ + "person" : { + "YOU" : { + "flags" : "acdhps" + } + } +} diff --git a/config-default/users.xml b/config-default/users.xml deleted file mode 100644 index a9ae193..0000000 --- a/config-default/users.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/cpanfile b/cpanfile index 34f5997..a617fc0 100644 --- a/cpanfile +++ b/cpanfile @@ -18,7 +18,6 @@ requires 'String::Interpolate', '0.32'; requires 'Text::LevenshteinXS', '0.03'; requires 'Tie::CPHash', '1.06'; requires 'URI::Escape', '3.31'; -requires 'XML::Simple', '2.20'; requires 'DBI', '1.63'; requires 'DBD::mysql', '4.025'; diff --git a/lib/ASM/Config.pm b/lib/ASM/Config.pm index de0bb21..ff6f745 100644 --- a/lib/ASM/Config.pm +++ b/lib/ASM/Config.pm @@ -4,10 +4,8 @@ use warnings; use strict; use feature 'state'; -use XML::Simple qw(:strict); use JSON; use IO::All; -no if $] >= 5.017011, warnings => 'experimental::smartmatch'; our $json = JSON->new->utf8->pretty->canonical; @@ -18,41 +16,15 @@ sub deserialize { return $json->decode(@_); } -sub readXML { - my ( $p ) = $::cset; - my @fchan = ( 'event', keys %::RISKS ); - my $xs1 = XML::Simple->new( KeyAttr => ['id'], Cache => [ qw/memcopy/ ]); - $::settings = $xs1->XMLin( "$p/settings.xml", ForceArray => ['host'], - 'GroupTags' => { altnicks => 'altnick', server => 'host', - autojoins => 'autojoin' }); - $::channels = $xs1->XMLin( "$p/channels.xml", ForceArray => \@fchan ); - $::users = $xs1->XMLin( "$p/users.xml", ForceArray => 'person'); - $::mysql = $xs1->XMLin( "$p/mysql.xml", ForceArray => ['ident', 'geco'], - 'GroupTags' => { ignoredidents => 'ident', ignoredgecos => 'geco' }); - $::dnsbl = $xs1->XMLin( "$p/dnsbl.xml", ForceArray => []); - $::rules = $xs1->XMLin( "$p/rules.xml", ForceArray => []); - $::restrictions = $xs1->XMLin( "$p/restrictions.xml", ForceArray => ['host', 'nick', 'account']); - $::blacklist = $xs1->XMLin( "$p/blacklist.xml", ForceArray => 'string'); -} - sub readConfig { - if (!-e "$::cset/settings.json") { - state $in_readconfig = 0; - die "Unexpected readConfig recursion" if $in_readconfig++; - readXML(); - writeConfig(); - readConfig(); - } - else { - $::settings = deserialize(io->file("$::cset/settings.json")->all); - $::channels = deserialize(io->file("$::cset/channels.json")->all); - $::users = deserialize(io->file("$::cset/users.json")->all); - $::mysql = deserialize(io->file("$::cset/mysql.json")->all); - $::dnsbl = deserialize(io->file("$::cset/dnsbl.json")->all); - $::rules = deserialize(io->file("$::cset/rules.json")->all); - $::restrictions = deserialize(io->file("$::cset/restrictions.json")->all); - $::blacklist = deserialize(io->file("$::cset/blacklist.json")->all); - } + $::settings = deserialize(io->file("$::cset/settings.json")->all); + $::channels = deserialize(io->file("$::cset/channels.json")->all); + $::users = deserialize(io->file("$::cset/users.json")->all); + $::mysql = deserialize(io->file("$::cset/mysql.json")->all); + $::dnsbl = deserialize(io->file("$::cset/dnsbl.json")->all); + $::rules = deserialize(io->file("$::cset/rules.json")->all); + $::restrictions = deserialize(io->file("$::cset/restrictions.json")->all); + $::blacklist = deserialize(io->file("$::cset/blacklist.json")->all); } sub writeConfig { -- cgit v1.2.3