Blame
Date:
Fri Dec 17 13:35:57 2021 UTC
Message:
Imported sources
001
2021-12-17
jrmu
<?php
002
2021-12-17
jrmu
003
2021-12-17
jrmu
$hashirc = isset($_REQUEST['hashirc']) ? $_REQUEST['hashirc'] : NULL;
004
2021-12-17
jrmu
$hashbnc = isset($_REQUEST['hashbnc']) ? $_REQUEST['hashbnc'] : NULL;
005
2021-12-17
jrmu
$hashshell = isset($_REQUEST['hashshell']) ? $_REQUEST['hashshell'] : NULL;
006
2021-12-17
jrmu
$hashsmtp = isset($_REQUEST['hashsmtp']) ? $_REQUEST['hashsmtp'] : NULL;
007
2021-12-17
jrmu
$lines = file('botnow.conf');
008
2021-12-17
jrmu
009
2021-12-17
jrmu
foreach ($lines as $i => $line) {
010
2021-12-17
jrmu
if (preg_match('/^\#/', $line, $matches)) {
011
2021-12-17
jrmu
} elseif (preg_match('/^\s*$/', $line, $matches)) {
012
2021-12-17
jrmu
} elseif (preg_match('/^([^=\s]+)\s*=\s*(.*)$/', $line, $matches)) {
013
2021-12-17
jrmu
$key = $matches[1];
014
2021-12-17
jrmu
$val = $matches[2];
015
2021-12-17
jrmu
$conf{$key} = $val;
016
2021-12-17
jrmu
}
017
2021-12-17
jrmu
}
018
2021-12-17
jrmu
019
2021-12-17
jrmu
$wordslist = file('words');
020
2021-12-17
jrmu
$wordslen = sizeof($wordslist);
021
2021-12-17
jrmu
for ($n = 0; $n < 5; $n++) {
022
2021-12-17
jrmu
$i = rand(0, $wordslen-1);
023
2021-12-17
jrmu
$words[] = substr($wordslist[$i],0,-1); // remove newline
024
2021-12-17
jrmu
}
025
2021-12-17
jrmu
$passphrase = implode(" ", $words);
026
2021-12-17
jrmu
$passphrase = ucwords($passphrase);
027
2021-12-17
jrmu
$fpr{"passphrase"} = $passphrase;
028
2021-12-17
jrmu
$fpr{"remoteaddr"} = $_SERVER['REMOTE_ADDR'];
029
2021-12-17
jrmu
$fpr{"httpxforwarded"} = $_SERVER['HTTP_X_FORWARDED_FOR'];
030
2021-12-17
jrmu
$fpr{"time"} = date("Y-m-d H:i:s");
031
2021-12-17
jrmu
if (isset($hashirc)) {
032
2021-12-17
jrmu
$fpr{"hashirc"} = $hashirc;
033
2021-12-17
jrmu
} elseif (isset($hashbnc)) {
034
2021-12-17
jrmu
$fpr{"hashbnc"} = $hashbnc;
035
2021-12-17
jrmu
} elseif (isset($hashshell)) {
036
2021-12-17
jrmu
$fpr{"hashshell"} = $hashshell;
037
2021-12-17
jrmu
} elseif (isset($hashsmtp)) {
038
2021-12-17
jrmu
$fpr{"hashsmtp"} = $hashsmtp;
039
2021-12-17
jrmu
}
040
2021-12-17
jrmu
041
2021-12-17
jrmu
foreach (getallheaders() as $key => $value) {
042
2021-12-17
jrmu
if ($key == "User-Agent") {
043
2021-12-17
jrmu
$key = "useragent";
044
2021-12-17
jrmu
} elseif ($key == "Upgrade-Insecure-Requests") {
045
2021-12-17
jrmu
$key = "upgradeinsecure";
046
2021-12-17
jrmu
} elseif ($key == "Host") {
047
2021-12-17
jrmu
$key = "host";
048
2021-12-17
jrmu
} elseif ($key == "Dnt") {
049
2021-12-17
jrmu
$key = "dnt";
050
2021-12-17
jrmu
} elseif ($key == "Connection") {
051
2021-12-17
jrmu
$key = "connection";
052
2021-12-17
jrmu
} elseif ($key == "Cache-Control") {
053
2021-12-17
jrmu
$key = "cachecontrol";
054
2021-12-17
jrmu
} elseif ($key == "Accept-Language") {
055
2021-12-17
jrmu
$key = "acceptlanguage";
056
2021-12-17
jrmu
} elseif ($key == "Accept-Encoding") {
057
2021-12-17
jrmu
$key = "acceptencoding";
058
2021-12-17
jrmu
} elseif ($key == "Accept") {
059
2021-12-17
jrmu
$key = "accept";
060
2021-12-17
jrmu
} elseif ($key == "Cookie") {
061
2021-12-17
jrmu
$key = "cookie";
062
2021-12-17
jrmu
}
063
2021-12-17
jrmu
$fpr{$key} = $value;
064
2021-12-17
jrmu
}
065
2021-12-17
jrmu
066
2021-12-17
jrmu
setcookie("ircnow[hashirc]", $hashirc, time()+86400*30, '/', 'ircnow.org', true);
067
2021-12-17
jrmu
setcookie("ircnow[hashbnc]", $hashbnc, time()+86400*30, '/', 'ircnow.org', true);
068
2021-12-17
jrmu
setcookie("ircnow[hashshell]", $hashshell, time()+86400*30, '/', 'ircnow.org', true);
069
2021-12-17
jrmu
setcookie("ircnow[hashsmtp]", $hashsmtp, time()+86400*30, '/', 'ircnow.org', true);
070
2021-12-17
jrmu
071
2021-12-17
jrmu
class wwwdb extends SQLite3 {
072
2021-12-17
jrmu
function __construct() {
073
2021-12-17
jrmu
$this->open('/botnow/botnow.db');
074
2021-12-17
jrmu
}
075
2021-12-17
jrmu
}
076
2021-12-17
jrmu
$wwwdb = new wwwdb();
077
2021-12-17
jrmu
if(!$wwwdb) {
078
2021-12-17
jrmu
echo $wwwdb->lastErrorMsg();
079
2021-12-17
jrmu
} else {
080
2021-12-17
jrmu
foreach ($fpr as $key => $value) {
081
2021-12-17
jrmu
$keys[] = $key;
082
2021-12-17
jrmu
$values[] = $value;
083
2021-12-17
jrmu
}
084
2021-12-17
jrmu
$keystr = '"'.implode('","', $keys).'"';
085
2021-12-17
jrmu
$valstr = '"'.implode('","', $values).'"';
086
2021-12-17
jrmu
$sql =<<<EOF
087
2021-12-17
jrmu
INSERT INTO www ($keystr)
088
2021-12-17
jrmu
VALUES ($valstr);
089
2021-12-17
jrmu
EOF;
090
2021-12-17
jrmu
if (!$wwwdb->exec($sql)) {
091
2021-12-17
jrmu
echo $db->lastErrorMsg();
092
2021-12-17
jrmu
}
093
2021-12-17
jrmu
$clients = array("AdiIRC", "Adium", "AndroIRC", "Atomic", "Colloquy", "Hexchat", "HydraIRC", "IRCForAndroid", "IRCCloud", "IceChat", "ircEX", "irssi", "Igloo", "KVIrc", "KiwiIRC", "Limechat", "Mibbit", "mIRC", "nettalk", "Pidgin", "qwebirc", "Quassel", "RevolutionIRC", "SimpleIRC", "Smuxi", "Textual", "Thunderbird", "TurboIRC", "Weechat", "Yaaic", "XChat");
094
2021-12-17
jrmu
$sql =<<<EOF
095
2021-12-17
jrmu
SELECT * from irc where hashid = "$hashirc";
096
2021-12-17
jrmu
EOF;
097
2021-12-17
jrmu
$ret = $wwwdb->query($sql);
098
2021-12-17
jrmu
while($row = $ret->fetchArray(SQLITE3_ASSOC)) {
099
2021-12-17
jrmu
echo "Don't worry I got called";
100
2021-12-17
jrmu
$ircid = $row['id'];
101
2021-12-17
jrmu
$ctcpversion = $row['ctcpversion'];
102
2021-12-17
jrmu
$hostmask = $row['hostmask'];
103
2021-12-17
jrmu
foreach ($clients as $i => $value) {
104
2021-12-17
jrmu
if (preg_match("/$value/i", $ctcpversion, $matches)) {
105
2021-12-17
jrmu
$client = $value;
106
2021-12-17
jrmu
}
107
2021-12-17
jrmu
}
108
2021-12-17
jrmu
if (!isset($client)) {
109
2021-12-17
jrmu
if (preg_match('/!~?uid\d+/i', $hostmask, $matches)) {
110
2021-12-17
jrmu
$client = "IRCCloud";
111
2021-12-17
jrmu
} elseif(preg_match('/!~?quassel/i', $hostmask, $matches)) {
112
2021-12-17
jrmu
$client = "Quassel";
113
2021-12-17
jrmu
} elseif(preg_match('/!~?IceChat/i', $hostmask, $matches)) {
114
2021-12-17
jrmu
$client = "IceChat";
115
2021-12-17
jrmu
} elseif(preg_match('/Purple\s+IRC/i', $ctcpversion, $matches)) {
116
2021-12-17
jrmu
$client = "Pidgin";
117
2021-12-17
jrmu
} elseif(preg_match('/X-Chat/i', $ctcpversion, $matches)) {
118
2021-12-17
jrmu
$client = "XChat";
119
2021-12-17
jrmu
} elseif(preg_match('/Kiwi\s+IRC/i', $ctcpversion, $matches)) {
120
2021-12-17
jrmu
$client = "KiwiIRC";
121
2021-12-17
jrmu
} elseif(preg_match('/Android\s+IRC/i', $ctcpversion, $matches)) {
122
2021-12-17
jrmu
$client = "AndroIRC";
123
2021-12-17
jrmu
} elseif(preg_match('/IRC\s+for\s+Android/i', $ctcpversion, $matches)) {
124
2021-12-17
jrmu
$client = "IRCForAndroid";
125
2021-12-17
jrmu
} elseif(preg_match('/Revolution\s+IRC/i', $ctcpversion, $matches)) {
126
2021-12-17
jrmu
$client = "RevolutionIRC";
127
2021-12-17
jrmu
} elseif(preg_match('/Yet\s+another\s+Android\s+IRC\s+client/i', $ctcpversion, $matches)) {
128
2021-12-17
jrmu
$client = "Yaaic";
129
2021-12-17
jrmu
} else {
130
2021-12-17
jrmu
$client = "Bouncer";
131
2021-12-17
jrmu
}
132
2021-12-17
jrmu
}
133
2021-12-17
jrmu
134
2021-12-17
jrmu
}
135
2021-12-17
jrmu
$sql =<<<EOF
136
2021-12-17
jrmu
SELECT * from bnc where ircid = "$ircid";
137
2021-12-17
jrmu
EOF;
138
2021-12-17
jrmu
$ret = $wwwdb->query($sql);
139
2021-12-17
jrmu
while($row = $ret->fetchArray(SQLITE3_ASSOC)) {
140
2021-12-17
jrmu
$username = $row['username'];
141
2021-12-17
jrmu
}
142
2021-12-17
jrmu
$wwwdb->close();
143
2021-12-17
jrmu
}
144
2021-12-17
jrmu
function myURLEncode($string) {
145
2021-12-17
jrmu
$replace = array('%20', '%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%23', '%5B', '%5D');
146
2021-12-17
jrmu
$search = array(' ', '!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "+", "$", ",", "/", "?", "#", "[", "]");
147
2021-12-17
jrmu
return str_replace($search, $replace, $string);
148
2021-12-17
jrmu
}
149
2021-12-17
jrmu
$hostname = $conf{"hostname"};
150
2021-12-17
jrmu
?>
151
2021-12-17
jrmu
152
2021-12-17
jrmu
<!DOCTYPE html>
153
2021-12-17
jrmu
<html lang="en">
154
2021-12-17
jrmu
<head>
155
2021-12-17
jrmu
<meta charset="utf-8">
156
2021-12-17
jrmu
<meta name="viewport" content="width=device-width, initial-scale=1">
157
2021-12-17
jrmu
<meta name="robots" content="index, follow"/>
158
2021-12-17
jrmu
<title>IRCNow -- Verify Account</title>
159
2021-12-17
jrmu
<style>
160
2021-12-17
jrmu
body {
161
2021-12-17
jrmu
width: 80%;
162
2021-12-17
jrmu
margin: 5rem auto;
163
2021-12-17
jrmu
text-align: center;
164
2021-12-17
jrmu
font-family: "Tahoma", "Verdana", "Arial";
165
2021-12-17
jrmu
}
166
2021-12-17
jrmu
</style>
167
2021-12-17
jrmu
<script>
168
2021-12-17
jrmu
console.log(Intl.DateTimeFormat().resolvedOptions().timeZone);
169
2021-12-17
jrmu
var offset = new Date().getTimezoneOffset();
170
2021-12-17
jrmu
console.log(offset);
171
2021-12-17
jrmu
console.log(new Date().toString());
172
2021-12-17
jrmu
console.log(window.screen.width);
173
2021-12-17
jrmu
console.log(window.screen.height);
174
2021-12-17
jrmu
//console.log(screen.availWidth);
175
2021-12-17
jrmu
//console.log(screen.availHeight);
176
2021-12-17
jrmu
console.log(screen.colorDepth);
177
2021-12-17
jrmu
</script>
178
2021-12-17
jrmu
</head>
179
2021-12-17
jrmu
180
2021-12-17
jrmu
<body>
181
2021-12-17
jrmu
<p>Please email <a href="mailto:<?php echo $conf{"mailfrom"}."?subject=".myURLEncode("IRCNow Verify: $passphrase")."&body=".myURLEncode("IRCNow Verify: $passphrase") ?>"><?php echo $conf{"mailfrom"} ?></a> with the following passphrase:</p>
182
2021-12-17
jrmu
183
2021-12-17
jrmu
<p>IRCNow Verify: <?php echo $passphrase ?></p>
184
2021-12-17
jrmu
185
2021-12-17
jrmu
<p><a href="https://wiki.ircnow.org/index.php?n=Bouncer.<?php echo $client ?>">Click here for <?php echo $client ?> connection instructions.</a></p>
186
2021-12-17
jrmu
187
2021-12-17
jrmu
<p>To change your password, login to <a href="<?php echo "https://bnc.$hostname/" ?>"><?php echo "https://bnc.$hostname/" ?></a>, fill in the password field, then click on the "Save and Return" button.</p>
188
2021-12-17
jrmu
189
2021-12-17
jrmu
<p>Or, you can change the password from your IRC client. Once you have logged in, type:</p>
190
2021-12-17
jrmu
191
2021-12-17
jrmu
<code>/msg *controlpanel set password <?php echo $username ?> newpassword</code>
192
2021-12-17
jrmu
193
2021-12-17
jrmu
</body>
194
2021-12-17
jrmu
</html>
IRCNow