Skip to content

Commit

Permalink
1.1.1
Browse files Browse the repository at this point in the history
- Plugin: leave - fixed bug with channels in capital letters
- some messages was present in silent mode, fixed
- cli messages changed: [bot], [server], [channel], etc
- own input in show_raw mode
- file name changed from 'encrypt_password.bat' to 'hash password.bat'
- file name changed from 'update_check.bat' to 'update check.bat'
- DOCS/Cli Arguments.txt updated
- many small changes/core
  • Loading branch information
S3x0r committed Dec 20, 2020
1 parent 9b5a6dd commit cf6bb0c
Show file tree
Hide file tree
Showing 67 changed files with 906 additions and 903 deletions.
2 changes: 2 additions & 0 deletions BOT.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
/* hide prompt */
echo "\e[?25l";

/* needed files */
$botCoreFiles = ['cli.php',
'misc.php',
'config.php',
Expand All @@ -50,6 +51,7 @@
'ctcp.php'
];

/* check if we got all files */
foreach ($botCoreFiles as $botCoreFile) {
if (is_file("src/{$botCoreFile}")) {
require_once("src/{$botCoreFile}");
Expand Down
2 changes: 1 addition & 1 deletion CONFIG.INI
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ command_prefix = '!'
ctcp_response = 'yes'

; ctcp version response (please do not change it:)
ctcp_version = 'MINION (1.1.0) powered by minions!'
ctcp_version = 'MINION (1.1.1) powered by minions!'

; ctcf finger response
ctcp_finger = 'MINION'
Expand Down
10 changes: 10 additions & 0 deletions DOCS/CHANGELOG.TXT
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@

v1.1.1 changes (20.12.2020):
- Plugin: leave - fixed bug with channels in capital letters
- some messages was present in silent mode, fixed
- cli messages changed: [bot], [server], [channel], etc
- own input in show_raw mode
- file name changed from 'encrypt_password.bat' to 'hash password.bat'
- file name changed from 'update_check.bat' to 'update check.bat'
- DOCS/Cli Arguments.txt updated
- many small changes/core

v1.1.0 changes (16.12.2020):
- Plugin: bash - removed
- Plugin: gethost - moved to ADMIN
Expand Down
14 changes: 7 additions & 7 deletions DOCS/CLI Arguments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

Bot cli commands usage: BOT.php [argument]

-c <config_file> loads config
-h this help
-o connect to specified server: eg: BOT.php irc.dal.net 6667
-p <password> hash password to SHA256
-s silent mode (no output from bot)
-u check if there is new bot version on server
-v prints bot version
-c <config_file> # loads config
-h # this help
-o <server> <port> # connect to specified server: eg: BOT.php irc.dal.net 6667
-p <password> # hash password to SHA256
-s # silent mode (no output from bot)
-u # check if there is new bot version on server
-v # prints bot version
6 changes: 3 additions & 3 deletions PLUGINS/ADMIN/autoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function plugin_autoop()
$nick = explode('!', trim($GLOBALS['args']));

if (OnEmptyArg('autoop <nick!ident@hostname>')) {
} elseif ($nick[0] != $GLOBALS['BOT_NICKNAME']) {
} elseif ($nick[0] != getBotNickname()) {
if (preg_match('/^(.+?)!(.+?)@(.+?)$/', $GLOBALS['args'], $host)) {
LoadData($GLOBALS['configFile'], 'OWNER', 'auto_op_list');

Expand All @@ -45,7 +45,7 @@ function plugin_autoop()
$GLOBALS['CONFIG_AUTO_OP_LIST'] = $cfg->get("OWNER", "auto_op_list");

/* Inform nick about it */
responsePriv('From now you are on my auto op list, enjoy.');
privateMsg('From now you are on my auto op list, enjoy.');

response("Host: '{$host[0]}' added to auto op list.");
}
Expand All @@ -55,5 +55,5 @@ function plugin_autoop()
} else {
response('I cannot add myself to auto op list, im already OP MASTER :)');
}
CLI_MSG("[PLUGIN: autoop] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: autoop] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
6 changes: 3 additions & 3 deletions PLUGINS/ADMIN/ban.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ function plugin_ban()
$nickToBan = explode('!', trim($GLOBALS['args']));
$nickToBan = $nickToBan[0];

if ($nickToBan != $GLOBALS['BOT_NICKNAME'] && $nickToBan != $GLOBALS['USER']) {
fputs($GLOBALS['socket'], "MODE {$GLOBALS['channel']} +b {$GLOBALS['args']}".PHP_EOL);
if ($nickToBan != getBotNickname() && $nickToBan != $GLOBALS['USER']) {
toServer("MODE ".getBotChannel()." +b {$GLOBALS['args']}");
}

unset($nickToBan);
}

CLI_MSG("[PLUGIN: ban] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: ban] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
4 changes: 2 additions & 2 deletions PLUGINS/ADMIN/cham.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function plugin_cham()
unset($file);
}
}
CLI_MSG("[PLUGIN: cham] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: cham] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
} catch (Exception $e) {
CLI_MSG('[ERROR]: Function: '.__FUNCTION__.' failed', '1');
cliLog('[ERROR]: Function: '.__FUNCTION__.' failed');
}
}
6 changes: 3 additions & 3 deletions PLUGINS/ADMIN/deop.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
function plugin_deop()
{
if (OnEmptyArg('deop <nick>')) {
} elseif (BotOpped() == true && $GLOBALS['args'] != $GLOBALS['BOT_NICKNAME'] && $GLOBALS['args'] != $GLOBALS['USER']) {
fputs($GLOBALS['socket'], "MODE {$GLOBALS['channel']} -o {$GLOBALS['args']}".PHP_EOL);
} elseif (BotOpped() == true && $GLOBALS['args'] != getBotNickname() && $GLOBALS['args'] != $GLOBALS['USER']) {
toServer("MODE ".getBotChannel()." -o {$GLOBALS['args']}");
}

CLI_MSG("[PLUGIN: deop] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: deop] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
6 changes: 3 additions & 3 deletions PLUGINS/ADMIN/devoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
function plugin_devoice()
{
if (OnEmptyArg('devoice <nick>')) {
} elseif (BotOpped() == true && $GLOBALS['args'] != $GLOBALS['BOT_NICKNAME'] && $GLOBALS['args'] != $GLOBALS['USER']) {
fputs($GLOBALS['socket'], "MODE {$GLOBALS['channel']} -v {$GLOBALS['args']}".PHP_EOL);
} elseif (BotOpped() == true && $GLOBALS['args'] != getBotNickname() && $GLOBALS['args'] != $GLOBALS['USER']) {
toServer("MODE ".getBotChannel()." -v {$GLOBALS['args']}");
}

CLI_MSG("[PLUGIN: devoice] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: devoice] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
4 changes: 2 additions & 2 deletions PLUGINS/ADMIN/gethost.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function plugin_gethost()
} elseif (empty($host)) {
response('Address is not a valid IPv4/IPv6 address');
}

CLI_MSG("[PLUGIN: gethost] by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}) | chan: {$GLOBALS['channel']} | {$host}/{$GLOBALS['args']}", '1');
}

cliLog("[PLUGIN: gethost] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
6 changes: 3 additions & 3 deletions PLUGINS/ADMIN/kick.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
function plugin_kick()
{
if (OnEmptyArg('kick <#channel> <who>')) {
} elseif (BotOpped() == true && $GLOBALS['piece2'] != $GLOBALS['BOT_NICKNAME'] && $GLOBALS['piece2'] != $GLOBALS['USER']) {
fputs($GLOBALS['socket'], "KICK {$GLOBALS['piece1']} :{$GLOBALS['piece2']}".PHP_EOL);
} elseif (BotOpped() == true && $GLOBALS['piece2'] != getBotNickname() && $GLOBALS['piece2'] != $GLOBALS['USER']) {
toServer("KICK {$GLOBALS['piece1']} :{$GLOBALS['piece2']}");
}

CLI_MSG("[PLUGIN: kick] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: kick] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
4 changes: 2 additions & 2 deletions PLUGINS/ADMIN/op.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function plugin_op()
{
if (OnEmptyArg('op <nick>')) {
} elseif (BotOpped() == true) {
fputs($GLOBALS['socket'], "MODE {$GLOBALS['channel']} +o {$GLOBALS['args']}".PHP_EOL);
toServer("MODE ".getBotChannel()." +o {$GLOBALS['args']}");
}

CLI_MSG("[PLUGIN: op] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: op] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
51 changes: 22 additions & 29 deletions PLUGINS/ADMIN/ping.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,36 @@

function plugin_ping()
{
try {
if (OnEmptyArg('ping <host/ip>')) {
} elseif (!isset($GLOBALS['OS'])) {
$ip = gethostbyname($GLOBALS['args']);
if (OnEmptyArg('ping <host/ip>')) {
} elseif (!isset($GLOBALS['OS'])) {
$ip = gethostbyname($GLOBALS['args']);

if ((!preg_match('/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/', $ip)) and
(($ip == $GLOBALS['args']) or ($ip === false))) {
response("Unknown host/ip: '{$GLOBALS['args']}'");
} else {
$ping = ping($ip);
if ($ping) {
$ping[0] = $GLOBALS['USER'].': '.$ping[0];
foreach ($ping as $thisline) {
response($thisline);
}
if ((!preg_match('/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/', $ip)) and
(($ip == $GLOBALS['args']) or ($ip === false))) {
response("Unknown host/ip: '{$GLOBALS['args']}'");
} else {
$ping = ping($ip);
if ($ping) {
$ping[0] = $GLOBALS['USER'].': '.$ping[0];
foreach ($ping as $thisline) {
response($thisline);
}
}
} else {
response('This plugin works on windows only at this time.');
}
CLI_MSG("[PLUGIN: ping] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
} else {
response('This plugin works on windows only at this time.');
}
catch (Exception $e) {
CLI_MSG('[ERROR] Exception: '.__FUNCTION__.' '.$e. '1');
}

cliLog("[PLUGIN: ping] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}

function ping($hostname)
{
try {
exec('ping '.escapeshellarg($hostname), $list);
if (isset($list[4])) {
return(array($list[2], $list[3], $list[4]));
} else {
return(array($list[2], $list[3]));
}
} catch (Exception $e) {
CLI_MSG('[ERROR] Exception: '.__FUNCTION__.' '.$e, '1');
exec('ping '.escapeshellarg($hostname), $list);

if (isset($list[4])) {
return([$list[2], $list[3], $list[4]]);
} else {
return([$list[2], $list[3]]);
}
}
3 changes: 1 addition & 2 deletions PLUGINS/ADMIN/ripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ function plugin_ripe()
if ($GLOBALS['args'] == '127.0.0.1' or $GLOBALS['args'] == '0.0.0.0') {
} else {
response(ripeCheckAddress($GLOBALS['args']));

}
} else {
response('I cannot use this plugin, i need php_openssl extension to work!');
}
CLI_MSG("[PLUGIN: ripe] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: ripe] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}

function ripeCheckAddress($args)
Expand Down
14 changes: 5 additions & 9 deletions PLUGINS/ADMIN/say.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@

function plugin_say()
{
try {
if (OnEmptyArg('say <text>')) {
} else {
fputs($GLOBALS['socket'], "PRIVMSG {$GLOBALS['channel']} ".inputFromLine('4').PHP_EOL);
}

CLI_MSG("[PLUGIN: say] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
} catch (Exception $e) {
CLI_MSG('[ERROR]: Function: '.__FUNCTION__.' failed', '1');
if (OnEmptyArg('say <text>')) {
} else {
toServer("PRIVMSG ".getBotChannel()." ".inputFromLine('4'));
}

cliLog("[PLUGIN: say] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
4 changes: 2 additions & 2 deletions PLUGINS/ADMIN/topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function plugin_topic()
{
if (OnEmptyArg('topic <new_topic>')) {
} else {
fputs($GLOBALS['socket'], "TOPIC {$GLOBALS['channel']} ".msg_without_command().PHP_EOL);
toServer("TOPIC ".getBotChannel()." ".msg_without_command());
}

CLI_MSG("[PLUGIN: topic] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: topic] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
4 changes: 2 additions & 2 deletions PLUGINS/ADMIN/unban.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function plugin_unban()
{
if (OnEmptyArg('unban <nick!ident@host>')) {
} else if (BotOpped() == true) {
fputs($GLOBALS['socket'], "MODE {$GLOBALS['channel']} -b {$GLOBALS['args']}".PHP_EOL);
toServer("MODE ".getBotChannel()." -b {$GLOBALS['args']}");
}

CLI_MSG("[PLUGIN: unban] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: unban] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
2 changes: 1 addition & 1 deletion PLUGINS/ADMIN/uptime.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function plugin_uptime()

response("I've been running since (".date('d.m.Y, H:i:s', START_TIME).") and been running for {$uptimeTime}");

CLI_MSG("[PLUGIN: uptime] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');
cliLog("[PLUGIN: uptime] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}

function uptimeCount($s)
Expand Down
6 changes: 3 additions & 3 deletions PLUGINS/ADMIN/voice.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function plugin_voice()
{
if (OnEmptyArg('voice <nick>')) {
} else if (BotOpped() == true) {
fputs($GLOBALS['socket'], "MODE {$GLOBALS['channel']} +v {$GLOBALS['args']}".PHP_EOL);
toServer("MODE ".getBotChannel()." +v {$GLOBALS['args']}");
}
CLI_MSG("[PLUGIN: voice] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: {$GLOBALS['channel']}", '1');

cliLog("[PLUGIN: voice] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
29 changes: 15 additions & 14 deletions PLUGINS/OWNER/addadmin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* Copyright (c) 2013-2018, S3x0r <olisek@gmail.com>
/* Copyright (c) 2013-2020, S3x0r <olisek@gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand All @@ -15,20 +15,21 @@
*/

//---------------------------------------------------------------------------------------------------------
PHP_SAPI !== 'cli' ? exit('<h2>This script can\'t be run from a web browser. Use terminal to run it<br>
Visit https://github.com/S3x0r/MINION/ website for more instructions.</h2>') : false;
!in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) ?
exit('This script can\'t be run from a web browser. Use CLI terminal to run it<br>'.
'Visit <a href="https://github.com/S3x0r/MINION/">this page</a> for more information.') : false;
//---------------------------------------------------------------------------------------------------------

$VERIFY = 'bfebd8778dbc9c58975c4f09eae6aea6ad2b621ed6a6ed8a3cbc1096c6041f0c';
$VERIFY = 'bfebd8778dbc9c58975c4f09eae6aea6ad2b621ed6a6ed8a3cbc1096c6041f0c';
$plugin_description = "Add host to admin list in config: {$GLOBALS['CONFIG_CMD_PREFIX']}addadmin <nick!ident@host>";
$plugin_command = 'addadmin';
$plugin_command = 'addadmin';

function plugin_addadmin()
{
$nick_ex = explode('!', trim($GLOBALS['args']));
$nick = explode('!', trim($GLOBALS['args']));

if (OnEmptyArg('addadmin <nick!ident@hostname>')) {
} elseif ($nick_ex[0] != $GLOBALS['BOT_NICKNAME']) {
} elseif ($nick[0] != getBotNickname()) {
if (preg_match('/^(.+?)!(.+?)@(.+?)$/', $GLOBALS['args'], $host)) {
LoadData($GLOBALS['configFile'], 'ADMIN', 'admin_list');

Expand All @@ -44,19 +45,19 @@ function plugin_addadmin()
$GLOBALS['CONFIG_ADMIN_LIST'] = $cfg->get("ADMIN", "admin_list");

/* inform user about adding */
fputs($GLOBALS['socket'], "PRIVMSG {$nick_ex[0]} :From now you are on my ADMIN(S) list, enjoy.\n");
fputs($GLOBALS['socket'], "PRIVMSG {$nick_ex[0]} :Core Commands: {$GLOBALS['CONFIG_CMD_PREFIX']}seen\n");
fputs($GLOBALS['socket'], "PRIVMSG {$nick_ex[0]} :Admin Commands: ".implode(' ', $GLOBALS['ADMIN_PLUGINS'])."\n");
fputs($GLOBALS['socket'], "PRIVMSG {$nick_ex[0]} :User Commands: ".implode(' ', $GLOBALS['USER_PLUGINS'])."\n");
toServer("PRIVMSG {$nick[0]} :From now you are on my ADMIN(S) list, enjoy.");
toServer("PRIVMSG {$nick[0]} :Core Commands: {$GLOBALS['CONFIG_CMD_PREFIX']}seen");
toServer("PRIVMSG {$nick[0]} :Admin Commands: ".implode(' ', $GLOBALS['ADMIN_PLUGINS']));
toServer("PRIVMSG {$nick[0]} :User Commands: ".implode(' ', $GLOBALS['USER_PLUGINS']));

response("Host: '{$host[0]}' added to admin list.");

CLI_MSG("[PLUGIN: addadmin] by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}) | chan: {$GLOBALS['channel']} | admin added: {$host[0]}", '1');
}
} else {
response('Bad input, try: nick!ident@hostname');
}
} else {
response('I cannot add myself to admins, im already master :)');
response("I'm already a master!");
}

cliLog("[PLUGIN: addadmin] Used by: {$GLOBALS['USER']} ({$GLOBALS['USER_HOST']}), channel: ".getBotChannel());
}
Loading

0 comments on commit cf6bb0c

Please sign in to comment.