Closed aab12345 closed 4 years ago
Hi, this was more of a funny side project some years ago (5+) and I never implemented any advanced auth like SASL which is what freenode now requires.
You can see from here it is a quite lengthy process.
So I'm not going to add this, as this script should be mainly used for learning purposes or a little unsecure fun with friends.
If you need Sasl support check out https://github.com/WildPHP/irc-bot
Cheers ;)
Well, with the help of someone I now have this implementation working with SASL using base64 encoding authentication!
It would be nice if you could keep your script updated though.
// Opening the socket to the Rizon network
$socket = fsockopen("irc.freenode.net", 6667);
fputs($socket, "CAP LS\n");
// Force an endless while
while (1) {
// Continue the rest of the script here
while ($data = fgets($socket, 128)) {
echo $data;
flush();
` // Separate all data
$ex = explode(' ', $data);
// SASL plain witchcraft. Run at own risk. I don't know PHP.
if ($ex[1] == "CAP" && $ex[3] == "LS") {
echo "LOL\n";
fputs($socket, "NICK " . $nickname . "\n");
fputs($socket, "USER " . $nickname . " 0 * :" . $master . "'s Bot\n");
fputs($socket, "CAP REQ :sasl\n");
}
// :irc.foobar.net CAP HammsterBot ACK :sasl
if ($ex[1] == "CAP" && $ex[3] == "ACK") {
// Why does this not work above??
// && $ex[4] == ":sasl\n") {
fputs($socket, "AUTHENTICATE PLAIN\n");
}
if ($ex[0] == "AUTHENTICATE") {
// Create Password in Base64 - printf 'username\0username\0password' | mmencode
fputs($socket, "AUTHENTICATE YOUR_BASE_CODE_64_PASSWORD_HERE\n");
}
if ($ex[1] == "903") {
fputs($socket, "CAP END\n");
fputs($socket, "JOIN $channel\n");
}
// End of SASL Witchcraft.
I can certainly add the script you commented. I'll just need to test it once i have some time. ;)
Thanks 👍
It might need a tiny tiny tiny bit of work as not 100% sure how to handle. Full Code - Here - https://pastebin.com/kjHPPQGD
// Deal with Nick in use. // Deal with SASL FAILURE (903)
To generate your base64 password; SASL > Base64 -->
Please edit only the username and password part below then run the command;
perl -MMIME::Base64 -e \ 'print encode_base64("username\0username\0password");'
Hello, I am trying to use this bot on an Amazon S3 VPS and I now get a message saying the following; (Would you happen to know how to resolve it with this script?) I tried updating it with the password but still comes up with same message. Thanks!