Skip to content

Commit

Permalink
1.1.7
Browse files Browse the repository at this point in the history
   - From now on, you can create 1-998 permissions + normaln user (999) and 'owner' (0)
   - The entitlement structure changed, As of now The owner directory can have any name
     but it is important that it must be in configuration file ([USERSLEVELS]) 0
     also name must be added in PRIVILEGES.
     A normal user has userlevel 999 and can only see own commands
     user levels from (1) to (998) may be assigned other privileges
     The -lower- number has access to all -higher- level commands
     eg. if 'owner' is (0), 'admin' (1), 'someone else' (2), 'normal user' (999)
     'admin' can use own commands + 'someone else' commands + 'normal user' commands.
     'someone else' can use own commands + 'normal user' commands, etc,.
   - fixed: timezone from config was not set
   - fixed: wrong time in log filename
   - fixed: there was missing '<?php exit; ?>' in config file
            when changing default password
   - NEW PLUGIN: 'whoami' - Displays user assigned name and privilege level
   - plugin: 'ban' - now saves ban to ban list in config
   - new argument '-n', you can now set bot nickname from arg
   - new logs filename format: 'date-computer name'
   - bot prints channel user(s) on bot join
   - added files 'core_cmnds_helpers.php', 'on_numeric.php', 'on_word.php' and changed 'core_commands' to 'core_cmnds'
   - REMOVED PLUGINS: 'showconfig', 'save', 'addadmin', 'listadmins', 'remadmin', 'panel', 'plugin'
     plugins will return in future.
   - disabled for now 'fetch' plugin
   - removed files: 'debug.php', 'web.php'
   - code cleanup
  • Loading branch information
S3x0r committed Jan 17, 2023
1 parent 18b770f commit f817ac1
Show file tree
Hide file tree
Showing 90 changed files with 1,755 additions and 3,475 deletions.
20 changes: 14 additions & 6 deletions BOT.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@

/* simple os check */
/* PHP 7.2.0 we have PHP_OS_FAMILY */
strtoupper(substr(PHP_OS, 0, 3)) != 'WIN' ? $GLOBALS['OS'] = 'Linux' : false;
function ifWindowsOs()
{
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
return true;
} else {
return false;
}
}

/* hide prompt */
echo "\e[?25l";
Expand All @@ -36,14 +43,15 @@
'cli.php',
'misc.php',
'config.php',
'core_commands.php',
'debug.php',
'core_cmnds.php',
'core_cmnds_helpers.php',
'events.php',
'logs.php',
'plugins.php',
'socket.php',
'on_numeric.php',
'on_word.php',
'timers.php',
'web.php',
'ctcp.php',
'start.php'
];
Expand All @@ -58,7 +66,7 @@
" You can download missing files from:\n",
" https://github.com/S3x0r/MINION/releases\n\n",
" Terminating program after 10 seconds.\n\n";
!isset($GLOBALS['os']) ? sleep(10) : false;
(ifWindowsOs()) ? sleep(10) : false;
exit;
}
}
Expand All @@ -69,5 +77,5 @@
WinSleep(7);
exit;
} else {
Start();
StartBot();
}
66 changes: 35 additions & 31 deletions CONFIG.INI
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;<?php exit; ?>
<?php exit; ?>

[BOT]

Expand All @@ -13,42 +13,50 @@ ident = 'minion'

[SERVER]

; server where to connect
server = 'irc.dal.net'
; irc server
server = 'irc.pirc.pl'

; server port
; irc server port
port = '6667'

; if irc server have password
; If the irc server requires a password to connect, set it here
server.password = ''

; try connect 'n' (in seconds) times to server, if cannot then quit
; Try to connect to the server the amount set here, if after a certain amount the bot fails to connect then terminate the program
try.connect = '99'

; delay (in seconds) after new connection to server
; Pause (seconds) between connections to the server
connect.delay = '6'

; show message of the day
show.motd = 'yes'
; show server message of the day
show.motd = 'no'

[OWNER]

; bot administrator information
bot.admin = 'S3x0r <user@localhost>'
bot.admin = 'minion <user@localhost>'

; bot will give op's if this hosts join channel <nick!ident@hostname>
auto.op.list = ''

; BOT OWNER HOSTS <nick!ident@hostname>
bot.owners = ''

; owner password (SHA256)
; owner bot password (SHA256)
owner.password = '47a8f9b32ec41bd93d79bf6c1c924aaecaa26d9afe88c39fc3a638f420f251ed'

[ADMIN]
[PRIVILEGES]

; bot admin list <nick!ident@hostname>
admin.list = ''
; BOT OWNER HOSTS <nick!ident@hostname>
OWNER = ''
; other users hosts
ADMIN = ''
; other users hosts
USER = ''

[USERSLEVELS]

;users access levels
; Owner = 0
; Normal User = 999
; others from 1 to 998
OWNER = '0'
ADMIN = '1'
USER = '999'

[RESPONSE]

Expand All @@ -60,6 +68,9 @@ bot.response = 'notice'
; bot will give op when join to channel from auto.op.list: 'yes', 'no'
auto.op = 'yes'

; bot will give op when hosts join channel <nick!ident@hostname>
auto.op.list = ''

; bot will auto rejoin channel when kicked: 'yes', 'no'
auto.rejoin = 'yes'

Expand Down Expand Up @@ -99,10 +110,10 @@ command.prefix = '!'
ctcp.response = 'yes'

; ctcp version response (please do not change it:)
ctcp.version = 'MINION (1.1.6) powered by minions!'
ctcp.version = 'minion (1.1.7) powered by minions!'

; ctcf finger response
ctcp.finger = 'MINION'
ctcp.finger = 'minion'

[DELAYS]

Expand All @@ -120,14 +131,6 @@ notice.delay = '1'
; log CLI messages to LOGS folder? 'yes', 'no'
logging = 'yes'

[PANEL]

; web panel login
web.login = 'changeme'

; web panel password
web.password = 'changeme'

[TIME]

; bot time zone
Expand All @@ -147,4 +150,5 @@ play.sounds = 'yes'

; show raw output on CLI window
show.raw = 'no'
show.own.messages.in.raw.mode = 'no'
show.own.messages.in.raw.mode = 'no'
show.debug = 'no'
27 changes: 27 additions & 0 deletions DOCS/CHANGELOG.TXT
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@

v1.1.7 changes (17.01.2023):
- From now on, you can create 1-998 permissions + normaln user (999) and 'owner' (0)
- The entitlement structure changed, As of now The owner directory can have any name
but it is important that it must be in configuration file ([USERSLEVELS]) 0
also name must be added in PRIVILEGES.
A normal user has userlevel 999 and can only see own commands
user levels from (1) to (998) may be assigned other privileges
The -lower- number has access to all -higher- level commands
eg. if 'owner' is (0), 'admin' (1), 'someone else' (2), 'normal user' (999)
'admin' can use own commands + 'someone else' commands + 'normal user' commands.
'someone else' can use own commands + 'normal user' commands, etc,.
- fixed: timezone from config was not set
- fixed: wrong time in log filename
- fixed: there was missing '<?php exit; ?>' in config file
when changing default password
- NEW PLUGIN: 'whoami' - Displays user assigned name and privilege level
- plugin: 'ban' - now saves ban to ban list in config
- new argument '-n', you can now set bot nickname from arg
- new logs filename format: 'date-computer name'
- bot prints channel user(s) on bot join
- added files 'core_cmnds_helpers.php', 'on_numeric.php', 'on_word.php' and changed 'core_commands' to 'core_cmnds'
- REMOVED PLUGINS: 'showconfig', 'save', 'addadmin', 'listadmins', 'remadmin', 'panel', 'plugin'
plugins will return in future.
- disabled for now 'fetch' plugin
- removed files: 'debug.php', 'web.php'
- code cleanup

v1.1.6 changes (28.12.2022):
- fixed reconnect delay time
- new option in config: 'show_own_messages_in_raw_mode'
Expand Down
1 change: 1 addition & 0 deletions DOCS/CLI Arguments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

-c <config_file> # loads config
-h # this help
-n # set bot nickname
-o <server> <port> # connect to specified server: eg: BOT.php irc.dal.net 6667
-p <password> # hash password to SHA256
-u # check if there is new bot version on server
Expand Down
8 changes: 0 additions & 8 deletions DOCS/config.ini info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ notice_delay = '1'
; log CLI messages to LOGS folder? 'yes', 'no'
logging = 'yes'

[PANEL]

; web panel login (for panel plugin)
web_login = 'changeme'

; web panel password (for panel plugin)
web_password = 'changeme'

[TIME]

; bot time zone
Expand Down
30 changes: 14 additions & 16 deletions PLUGINS/ADMIN/autoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,31 @@
//---------------------------------------------------------------------------------------------------------

$VERIFY = 'bfebd8778dbc9c58975c4f09eae6aea6ad2b621ed6a6ed8a3cbc1096c6041f0c';
$plugin_description = "Adds host to autoop list in config file: {$GLOBALS['CONFIG.CMD.PREFIX']}autoop <nick!ident@host>";
$plugin_description = "Adds host to autoop list in config file: ".loadValueFromConfigFile('COMMAND', 'command.prefix')."autoop <nick!ident@host>";
$plugin_command = 'autoop';

function plugin_autoop()
{
$nick = explode('!', trim($GLOBALS['args']));
/* get nick from hostname mask */
$hostNick = explode('!', trim(msgAsArguments()));

response($hostNick);

if (OnEmptyArg('autoop <nick!ident@hostname>')) {
} elseif ($nick[0] != getBotNickname()) {
if (preg_match('/^(.+?)!(.+?)@(.+?)$/', $GLOBALS['args'], $host)) {
LoadData($GLOBALS['configFile'], 'OWNER', 'auto.op.list');
} elseif ($hostNick[0] != getBotNickname()) {
if (preg_match('/^(.+?)!(.+?)@(.+?)$/', msgAsArguments())) {
$autoOpList = loadValueFromConfigFile('AUTOMATIC', 'auto.op.list');

if (strpos($GLOBALS['LOADED'], $GLOBALS['args']) !== false) {
response('I already have this host.');
if (strpos($autoOpList, msgAsArguments()) !== false) {
response('I already have that host in my auto op list.');
} else {
empty($GLOBALS['LOADED']) ? $new_list = $host[0] : $new_list = "{$GLOBALS['LOADED']}, {$host[0]}";
empty($autoOpList) ? $newList = msgAsArguments() : $newList = "{$autoOpList}, ".msgAsArguments();

SaveData($GLOBALS['configFile'], 'OWNER', 'auto.op.list', $new_list);

/* update variable with new owners */
$cfg = new IniParser($GLOBALS['configFile']);
$GLOBALS['CONFIG.AUTO.OP.LIST'] = $cfg->get("OWNER", "auto.op.list");
SaveValueToConfigFile('AUTOMATIC', 'auto.op.list', $newList);

/* Inform nick about it */
privateMsg('From now you are on my auto op list, enjoy.');
privateMsgTo($hostNick[0], 'From now you are on my auto op list, enjoy.');

response("Host: '{$host[0]}' added to auto op list.");
response("Host: '".msgAsArguments()."' added to auto op list.");
}
} else {
response('Bad input, try: nick!ident@hostname');
Expand Down
26 changes: 18 additions & 8 deletions PLUGINS/ADMIN/ban.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,30 @@
//---------------------------------------------------------------------------------------------------------

$VERIFY = 'bfebd8778dbc9c58975c4f09eae6aea6ad2b621ed6a6ed8a3cbc1096c6041f0c';
$plugin_description = "Ban specified host: {$GLOBALS['CONFIG.CMD.PREFIX']}ban <nick!ident@host>";
$plugin_description = "Ban specified host: ".loadValueFromConfigFile('COMMAND', 'command.prefix')."ban <hostname>";
$plugin_command = 'ban';

function plugin_ban()
{
if (OnEmptyArg('ban <nick!ident@host>')) {
if (OnEmptyArg('ban <hostname>')) {
} elseif(BotOpped() == true) {
$nickToBan = explode('!', trim($GLOBALS['args']));
$nickToBan = explode('!', trim(msgAsArguments()));
$nickToBan = $nickToBan[0];

if ($nickToBan != getBotNickname() && $nickToBan != $GLOBALS['USER']) {
toServer("MODE ".getBotChannel()." +b {$GLOBALS['args']}");
}
if ($nickToBan != getBotNickname() && $nickToBan != userPreg()[0]) {
/* ban host */
toServer("MODE ".getBotChannel()." +b ".msgAsArguments());

/* save host to ban list */
$banList = loadValueFromConfigFile('BANS', 'ban.list');

if (strpos($banList, msgAsArguments()) === false) {
empty($banList) ? $newList = $host[0] : $newList = "{$banList}, ".msgAsArguments();

SaveValueToConfigFile('BANS', 'ban.list', $newList);

unset($nickToBan);
response("Host: '".msgAsArguments()."' added to ban list.");
}
}
}
}
}
4 changes: 2 additions & 2 deletions PLUGINS/ADMIN/cham.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//---------------------------------------------------------------------------------------------------------

$VERIFY = 'bfebd8778dbc9c58975c4f09eae6aea6ad2b621ed6a6ed8a3cbc1096c6041f0c';
$plugin_description = "Shows random text from file: {$GLOBALS['CONFIG.CMD.PREFIX']}cham <nick>";
$plugin_description = "Shows random text from file: ".loadValueFromConfigFile('COMMAND', 'command.prefix')."cham <nick>";
$plugin_command = 'cham';

/*
Expand All @@ -45,7 +45,7 @@ function plugin_cham()

shuffle($texts);
$text = $texts[$count++];
$who = trim($GLOBALS['args']);
$who = trim(msgAsArguments());

response("{$who}: {$text}");
} else {
Expand Down
6 changes: 3 additions & 3 deletions PLUGINS/ADMIN/deop.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
//---------------------------------------------------------------------------------------------------------

$VERIFY = 'bfebd8778dbc9c58975c4f09eae6aea6ad2b621ed6a6ed8a3cbc1096c6041f0c';
$plugin_description = "Deops someone: {$GLOBALS['CONFIG.CMD.PREFIX']}deop <nick>";
$plugin_description = "Deops someone: ".loadValueFromConfigFile('COMMAND', 'command.prefix')."deop <nick>";
$plugin_command = 'deop';

function plugin_deop()
{
if (OnEmptyArg('deop <nick>')) {
} elseif (BotOpped() == true && $GLOBALS['args'] != getBotNickname() && $GLOBALS['args'] != $GLOBALS['USER']) {
toServer("MODE ".getBotChannel()." -o {$GLOBALS['args']}");
} elseif (BotOpped() == true && msgAsArguments() != getBotNickname() && msgAsArguments() != userPreg()[0]) {
toServer("MODE ".getBotChannel()." -o ".msgAsArguments());
}
}
6 changes: 3 additions & 3 deletions PLUGINS/ADMIN/devoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
//---------------------------------------------------------------------------------------------------------

$VERIFY = 'bfebd8778dbc9c58975c4f09eae6aea6ad2b621ed6a6ed8a3cbc1096c6041f0c';
$plugin_description = "Devoice user: {$GLOBALS['CONFIG.CMD.PREFIX']}devoice <nick>";
$plugin_description = "Devoice user: ".loadValueFromConfigFile('COMMAND', 'command.prefix')."devoice <nick>";
$plugin_command = 'devoice';

function plugin_devoice()
{
if (OnEmptyArg('devoice <nick>')) {
} elseif (BotOpped() == true && $GLOBALS['args'] != getBotNickname() && $GLOBALS['args'] != $GLOBALS['USER']) {
toServer("MODE ".getBotChannel()." -v {$GLOBALS['args']}");
} elseif (BotOpped() == true && msgAsArguments() != getBotNickname() && msgAsArguments() != userPreg()[0]) {
toServer("MODE ".getBotChannel()." -v ".msgAsArguments());
}
}
Loading

0 comments on commit f817ac1

Please sign in to comment.