PDA

View Full Version : Add-On Releases - AIM Controller (AIM Bot For Vb)


Jafo232
11-08-2006, 10:00 PM
This Add-on Is Beta

The AIM Controller is an AIM Bot that connects to Vbulletin and can perform endless functions via Instant Messaging.

The Controller utilizes "action scripts" which are nothing more than Perl (CGI) scripts. You can write your own to perform almost any action.

I have only included a few proof of concept action scripts. They do the following:


Return latest threads (5).

Shut down or Re-open forum.

Notify users of replies to subscribed threads.

Who's online.


I do plan on adding more, but before I get too far into this, I would like some of you out there to try what is already available. I am mostly concerned with the controller. I have tested it extensively and have found it works great.

Requirements:

You must be able to execute Perl scripts on the command line via a shell like Telnet or SSH. Or you COULD run this from your desktop providing you have Perl installed on your PC, and you can connect to your MySQL database from your PC. Many servers only allow connections from localhost.

The ability to install Perl modules.

Perl (CGI).

You should be able to install Perl modules on your server, as the following are required:


DBI (with DBD::MySQl drivers)
constant (core module, should already be installed)
Net::OSCAR
Digest::MD5
IO::Poll
PHP::Serialization (for install/uninstall action scripts)
XML::RSS::Parser (for action scripts)
LWP 5.64 or higher


This IS NOT A CGI script and CANNOT be called in the browser. I will not answer any questions that pertain to "server 500 error in my browser" or browser timeouts. You should not be accessing this with your browser in any way.

Make sure you read the readme BEFORE you attempt to install.


UPDATES:

11/15/2006:

Updated aimnot.pl and functions.pl. Added flood protection and admin help for available commands. Just upload new admin.pl and functions.pl file and restart bot from scratch (no rehash). Make sure you redefine the vars or just copy them from the old file.

11/14/2006:

1. Created a new file called use_once.pl. This is where ALL use statements for action scripts must go. This stops memory hammering on action script calls. Edited aimnot.pl to require this file.

2. All Vbulletin settings (setting table) are loaded on init/rehash and populated in the %vbulletin hash.

3. Removed all "use" statements from action scripts. This caused the script to bloat wildly if an action script was executed frequently, such as polling scripts. All modules being used in action scripts MUST be used in this file only!

4. Fixed a minor bug in the message action script. If the VB version was up to date, a finish command was called on a query that actually never happened, throwing a warning.

5. Added global.cgi which is loaded at runtime. Here is where user defined variables can be placed and loaded on init/rehash.

6. Edited who.cgi action script so it reflects the vbulletin cookietimeout setting instead of my arbitrary 1000 seconds.

11/10/2006 11am EST: Updated installer and uninstaller to add/remove table aimmessages. This creates a message queue for user messages.

11/10/2006 added two action scripts. One (messages) checks the VB version on init and notifies admins if version out of date. Added REQUIRED action script that will send messages in queue.

Both of the above updates requires your execute: aimnot.pl uninstall and then aimnot.pl install with the latest version.

I will be adding action scripts from time to time without changing the version number of the add-on. You will only need to upload the new action scripts to their respective folders to implement them (rehash or restart the bot). I will be listing them here along with their dates.

Latest Action Scripts:

load.cgi & load_alarm.cgi 11/15/2006 - The admin command #load will display the load average on Unix/Linux/*nix servers. A new polling script will check the load every few seconds and send you an alarm if the load is over 10 (configurable). The warnings will persist every 30 seconds until the load is reduced.

stats.cgi 11/14/2006 - Will show user/post/thread stats. I put it in the custom_user folder, but if you only want this for admins, then place it in the custom_admin folder.

cron.cgi 11/10/2006 - Will execute cron.php as a polling event (every X seconds) instead of users activating it via the browser. Upload to polling_events folder.

Antv912
11-09-2006, 05:57 PM
screen shots would help :)

Jafo232
11-09-2006, 08:35 PM
Not sure if there are any that could be relevant. The bot runs on your server (or desktop) and you IM it commands, or it IM's you post notifications etc...

I will see what I can whip up tomorrow.

Stangsta
11-09-2006, 09:07 PM
I think this has ALOT of potential

Farjad
11-09-2006, 09:29 PM
Can you give more info on how it works etc please? And please post screenshots!

Jafo232
11-09-2006, 10:26 PM
Well, basically this script runs as a bot on your server. It connects to AIM. You can see the bot online.

The bot is setup to recognize you (and whoever else you want) as administrators. You can issue commands to the bot and it will execute them.

The action scripts are where the command logic is stored (they are just plain Perl CGI scripts).

So, for example, you set up the bot, and the bots name is: MyVBBot. That is its AIM screenname.

It logs on.

You IM the bot this text:

#who

It will read back to you who is online.

Or:

#close_forum

And it will close down the forum, just like you do in the admin control panel.

Normal users can also make commands, like:

!latest

This will show the 5 latest threads.

User commands start with ! by default and admin with #. These control characters can be defined to anything you want, so you could say, make it &:

&who

etc..

There are more commands, and you can make your own custom commands providing you have some knowledge in the Perl programming language.

I do plan on writing a PHP bridge so action scripts can be written in PHP and the bot will call them directly through the PHP binary.

Not sure what kind of screenshot there is that would illustrate all of this.

Jafo232
11-10-2006, 12:37 PM
Added an action script to newactionscripts.zip:

cron.cgi: Will execute cron.php as a polling event (every X seconds) instead of users activating it via the browser. cron.php runs scheduled tasks.

Jafo232
11-10-2006, 02:17 PM
New version is 1.0.1. Added a new table to hold message queue. Just download the latest version, overwrite, run aimnot.pl uninstall, then aimnot.pl install and you should be all set..

Distance
11-11-2006, 12:33 PM
Any chance of one for MSN?

this hack sounds BRILL! btw

Jafo232
11-11-2006, 02:00 PM
Any chance of one for MSN?

this hack sounds BRILL! btw

I knew it wouldnt be long before someone asked that :).

Perhaps when I have worked out all of the kinks in this one, I will try to do one for each service. They would have to run as separate bots.

I am still refining the controller. I already see an issue that needs to be fixed but my weekend is swamped with work.

iran.gs
11-11-2006, 02:29 PM
can we have same for yahoo or msn ???

Jafo232
11-11-2006, 04:04 PM
can we have same for yahoo or msn ???


https://vborg.vbsupport.ru/showpost.php?p=1114764&postcount=10

Ntfu2
11-11-2006, 05:03 PM
This looks very interesting.

Before i take time to install it, say my users wanted to use this feature to get thread updates on AIM. could they also execute the admin commands, or is there a spot where only commands from a certain username will be executed?

Jafo232
11-11-2006, 05:08 PM
This looks very interesting.

Before i take time to install it, say my users wanted to use this feature to get thread updates on AIM. could they also execute the admin commands, or is there a spot where only commands from a certain username will be executed?

Only admins defined in the add-ons setup can execute admin commands.

vbreal
11-13-2006, 08:22 PM
sounds cool. got a question

why would i want to use aim vs loging into the board and doing this.

Jafo232
11-13-2006, 08:27 PM
sounds cool. got a question

why would i want to use aim vs loging into the board and doing this.

Well, there are many scenarios, but how about controlling your forum from your cellphone?

Distance
11-13-2006, 09:00 PM
What an idea.. scrap this dude.. this hack can be premium!!..

I would defo buy it!!

Jafo232
11-14-2006, 03:20 PM
Revamped a bunch of stuff with the script (see updates in thread title post). Upload/overwrite with new files, run aimnot.pl uninstall, and then aimnot.pl install.

Jafo232
11-14-2006, 04:26 PM
Added an action script that will display forum stats to users (users, threads, posts, new users, newest member). See newactionscripts.zip.

Jafo232
11-15-2006, 12:55 PM
Added two action scripts today:

The admin command #load will display the load average on Unix/Linux/*nix servers. A new polling script will check the load every few seconds and send you an alarm if the load is over 10 (configurable). The warnings will persist every 30 seconds until the load is reduced.

Farjad
11-16-2006, 08:18 PM
I am trying to install XML::RSS::Parser, via WHM, it stops automatically at:
CPAN: LWP::UserAgent loaded ok

Fetching with LWP:

http://cpan.erlbaum.net/authors/id/S/SA/SAMTREGAR/Class-XPath-1.4.tar.gz

Out of memory!

Any help :( ?

Jafo232
11-17-2006, 12:30 AM
Seems your server is running out of memory I guess? I have never seen that error when I use the CPAN module.

Perhaps if you use a different cpan mirror when downloading?

Farjad
11-17-2006, 12:54 AM
Seems your server is running out of memory I guess? I have never seen that error when I use the CPAN module.

Perhaps if you use a different cpan mirror when downloading?
How do I do that .. sorry i am totally new in linux.. so I use it directly from WHM.. and I do have 4GB Ram on this server.. I am confused.

Jafo232
11-17-2006, 02:52 AM
How do I do that .. sorry i am totally new in linux.. so I use it directly from WHM.. and I do have 4GB Ram on this server.. I am confused.

Hmm, depends on your server. However, with 4gb of ram, you should not run out of memory.. Perhaps you should speak to your server admin?

Also, you may want to contact the authors of the module, and maybe the CPAN module too..

The only reason why you need this module is to run the latest.cgi action script. You can comment out the use statement in the use_once.pl file and just delete the latest.cgi script from the custom_user directory until you get the module installed.

Farjad
11-17-2006, 06:40 PM
Hmm, depends on your server. However, with 4gb of ram, you should not run out of memory.. Perhaps you should speak to your server admin?

Also, you may want to contact the authors of the module, and maybe the CPAN module too..

The only reason why you need this module is to run the latest.cgi action script. You can comment out the use statement in the use_once.pl file and just delete the latest.cgi script from the custom_user directory until you get the module installed.
Actually, I own this server.. I got this cause my site is growing big.. currently with 100k members.. BTW.. Ill ask my datacenter :)

EDIT:

Now I don't think I need XML::RSS:Parser.. I decided to recode the script latest.cgi to :
## Include this at the top of all action scripts.
if (!CONTROLLER) { print "Cannot be executed directly"; exit; }

my $db = &dbconnect;

my $dbh=$db->prepare("SELECT * FROM " . $dbprefix . "thread ORDER by threadid DESC LIMIT 20");



$dbh->execute() or print "$! Cannot execute query DBI: $DBI::errstr";
## ($threads) = $dbh->fetchrow_array();
while (@rows = $dbh->fetchrow()) {
($threads .= "<a href='$bburl/showthread.php?t=".$rows[0]."'>".$rows[1]."</a>\n")
}
$dbh->finish();



$oscar->send_im($who, "$threads");

($threads = "")

EDIT:
One last question:
when i start the bot I get

Can't get http://api.oscar.aol.com/SOA/key=MYAPIKEYHERE/resource-lists/users/*anonymous*/presence/~~/resource-lists/list[name="users"]/entry[@uri="user:MuftoBot"] -- 500 Internal error in validating key.VB Version Out Of Date!
There was an error in messages.cgi. Returned was Can't call method "finish" on an undefined value at (eval 46) line 30, <FH> line 64.
and Resource temporarily unavailableLoaded 191 users
.................You are now signed on to AOL Instant Messenger.
.........basic OSCAR service: Unknown extended info request

also, how do I start this without being logged in SHELL ? .. as when I exit the shell it automatically goes offline.

and, how can i ban/block users who curse X number of times?

finally, how about #exit , that would turn off the bot , useful at times at high loads.

Jafo232
12-31-2006, 04:43 PM
#shutdown turns the bot off

As for your bot shutting off after you log off, use nohup. Example:

nohup /path/to/executable &

Remember the pid # it returns (after you hit return twice) in case you need to kill the process.

Make sure your AIM API key is correct.

Mupetz
01-01-2007, 12:25 PM
Don't forget Google Talk :)

Jafo232
01-01-2007, 07:49 PM
I will not be adding any other IM services to this bot.

Distance
01-09-2007, 05:23 PM
oh right ... damn no Msn then..

bye

AzzidReign
01-10-2007, 03:52 AM
Wow, this sounds pretty awesome!

Tralala
02-19-2007, 01:26 AM
Awesome indeed, what a great concept. Thanks, Jafo232! I'm going to have to play with this.

I have a question, and perhaps it's outside of the scope of this hack's intention (but then it might inspire some new innovation too.)

Your work here allows users to interact with the forum via an AIM bot. What about allowing the AIM bot to interact with users via the forum?

What I mean by that is best illustrated by an example:

My forum has a dedicated AIM chat room that we gather in; everyone prefers to use AOL IM or Trillian or iChat over a vB-integrated FlashChat. (https://vborg.vbsupport.ru/showthread.php?t=120926) However, FlashChat has an advantage over AOL IM, in that you can have a module that reports "Who is Chatting Right Now" on your forum.

So what I'm thinking is, would this AIM bot be able to report how many users are gathered in the AIM chat room (and/or their names) and report it to a module/banner/whatever that appears on our forum?

Just a thought to throw out there on an otherwise idle Sunday evening.

Thanks again for the great work you've shared here.

BigJimTheLug
02-19-2007, 10:24 PM
Wow, this is good.

Great work!

Installed!

subnet_rx
02-19-2007, 10:33 PM
This looks like an excellent addon, and is something along the lines of what I've been looking for. I've always wanted to use IM to connect to a certain thread and let users "chat" using the thread.