• Welcome to Valhalla Legends Archive.
 

Bot idea

Started by Undeference, August 23, 2004, 03:42 PM

Previous topic - Next topic

Undeference

Well... as I've decided that it would be a total waste of my time to write a bot of any kind (neural networks are not really 'bots' -- no offense implied), I figure it will be safe for me to post my ideas for the bot I was going to write (this was a few years back; before I took on a bunch of other stuff that I'm now pressed to finish -- by next year).

Here is my most recent idea:
  • Application

    • Socket handling
    • Protocol handling
  • External Scripting

    • Users

      • UserDB
      • User scripts
      • User logs
    • Command
    • Error handling
Basically, the bot is just a connection and anti-flood mechanism. Everything else is done using Perl modules. This will especially seem unattractive to Windows users because... Perl... ew, right? The reason Perl is the major candidate is for the following reasons:
  • Perl is not OS-specific (there's a Windows version and there's MacPerl, in addition to nix)
  • Perl is especially good for string manipulation, mainly due to its exceptionally good regex handling
Another reason Perl is a good candidate is because you can use arbitrary command lines even on Mac and Windows.

A users list can be done with a Perl db (written manually) or using a popular SQL syntax such as MySQL, Postgresql, M$ Access, etc. Due to the nature of the bot, it won't really matter; you can use all or none of the options.

This solves the problem with user-scriptability (the bot owner) being so inefficient. Alternatively, a modified CGI-like setup could be used. What do you think?

[ EDIT: Changed the leveling to be more to my initial thought. ]

Banana fanna fo fanna

I think it should use SOAP or XML-RPC or something standard for communication.

OnlyMeat

Thats similar to my own setup, my bots contain no actual specific commands etc they simply execute bot and command scripts written in an integrated script editor which supports any ActiveX script engine installed on the system.

Currently their are about 5 different engines that i know of:-

(1) VBScript
(2) Javascript
(3) ActivePerl
(4) ActivePython
(5) ActiveHCL

All my scripts can be written in these languages using the intellisense editor i designed and executed in my bot at runtime.

I also use the IActiveScriptSite COM interfaces directly as they provide fast powerful scripting support.

And before you ask i dont use .net based scripting because my bots are written in c++ without the .net framework.

I personally prefer this kind of automation as apposed to dynamic loading modules and plugins because you have the option to run these out-of-process which enables a higher degree of security when dealing with possible script exceptions or infinite loops or what ever situation may occur that might affect the main thread of the program.

Thats my 2 cents anyways.

MyndFyre

Funny you should mention .NET scripting.  I don't know of any actual scripting in .NET aside from the nerfed Microsoft.Vsa namespace.  :/
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Undeference

#4
Imagine user db searching using a Perl regular expression though:
&dbm('.*?bob.*', 'i');

sub dbm { # database match
  my ($regex, $flags) = @_;
  my (@found);
  foreach (@dblines) {
     if (eval ("$_ =~ m/$regex/$flags")) {
        push (@found, $1.$2.$3.$4.$5.$6.$7.$8.$9);
     }
  }
  my ($reult) = "Found $#found results:";
  foreach (@found) {
     if ($_ ne '') { $result .= "$_, "; }
  }
  &send ($result);
}

Something like that. There would obviously be more code with send having to do with user options. Also, @dblines has to be defined, but a setup like this would allow for a simple if (user can do this) { eval (whatever the user said); } type of a deal.

Kp

Quote from: Undeference on August 25, 2004, 02:17 PMAlso, @dblines has to be defined, but a setup like this would allow for a simple if (user can do this) { eval (whatever the user said); } type of a deal.

Be very careful passing arbitrary constructs to eval!  Malicious users could do a variety of unpleasant things, such as unlink the database file, sigkill the host process, etc.  Also, before you just say "Well, I'll only give such access to people I trust", think about what you're relying on to authenticate them.  You're trusting that a presence on battle.net is the friend you believe it to be, which isn't a particularly good assumption since accounts can be stolen, expire, etc.  For that matter, even if you prevent all those, you still need to hope that TrustedFriend's little brother doesn't wander by an unlocked keyboard feeling mischievious.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

warz

see c0ol's old perl bot. i think it was called "Perl Chat" or "c0ol chat" not sure though.

Undeference

#7
So don't use eval:
sub dbm {
 my ($regex, $i) = ($_[0], 0);
 my (@found);
 foreach (@dblines) {
     if ($_ =~ m/($regex)/ig) {
       push (@found, $1);
     }
 }
 my ($result) = "Found $#found results:";
 while ($i <= @found) {
     $result .= $found[$i++];
     if ($i < @found) {
        $result .= ', ';
     }
  }
  &send ($result);
}