Thursday, June 05, 2008

AIMbot

I decided to write myself an AIMbot. This does not mean a bot for helping me aim better in FPS games (since I've never really played much of them beyond GoldenEye and Perfect Dark), but a bot for the AOL Instant Messenger. I ran into some difficulties, and wanted to mention them somewhere so I don't have to keep all my tabs open in my Konqueror/Firefox windows. Good? Great. :-P

If I forget a step in here, I'll fix it later.

To build my bot, I went straight to the AOL source: openAIM. Sweet! They have official junks for writing bots. Perfect. Unfortunately, I had a massive problem with the openAIM web interface. Notably: whenever I clicked on a link to look at a related feature/page/forum/something, it logged me out of my account. This happened many times, to the point where I'm not sure I could log back in anymore. Also, it then redirected me to some unwanted homepage. If I tried to open the same link again, it would then bring me to the same page, but without the logged-in features. Great.

I immediately decided to work in Java. I found this page to be extremely helpful. It basically details how to get the bot up and running (in Windows) and then guides through some of the Java coding of the bot. I wasn't quite sure what to do in Linux, but I used this as a guide and tried to mimic the Windows parts with whatever Linux know-how I had. I didn't think too highly of my Linux knowledge. I'm, like, a newbie who's going on 8-years of running Linuxes instead of Windows. This was really my first foray into changing things in Linux and dabbling in the libraries, etc. I'm very proud of myself ;)

There are two issues with that windows-explanatory page (which is very good) which are not issues for everyone, but were issues for me:

1) I'm not using Eclipse. Or any kind of real environment. I've been doing my coding in KATE, the K Advanced Text Editor (yes, I'm running Kubuntu, tyvm). I know it's not as good as emacs or vim, but I get things done there. Due to this, however, I didn't know how to set up all the project stuff correctly. As it turned out, I didn't need to follow all the weird folder-creation setting that were taking place there. I wound up putting my code into the following folders:

The root of my code:

username@machine:~/Junk/accsdk_linux_rhel4x86_1_6_7/

from here I have a folder: botnameBot/

inside this, I put the build.xml file that was a part of the downloaded package and created two folders:

src/
which has my java file: botnameBot.java as well as the accbuddy file, com directory and accjwrap.jar file all provided by openAIM

lib/
which has symbolic links to the libraries mentioned later.

I wound up getting annoyed with all this distinction and finally put all the links from lib/ into the src/ directory instead. Java doesn't seem to care. I don't care :-P

The second issue here was on how to run all this junk. I'll cover that at the end.

2) I'm not using windows. Thus, I don't care about .dll files, and instead needed the linux libraries. They gave me a link to the linux install notes. This gives instructions on how to download the libraries, then, how to create the symbolic links for them. Very nice :) Unfortunately, I hate downloading packages from sites, as I prefer to use the package maintainer with kubuntu (Adept, or whatever). So, I searched on there for "nss" and found some things that looked reasonably correct.

Some of them I already had onboard. Great! However, some of them conflict with others, and some of the libraries live in places which are different from the places listed in the above link. People mentioned that on this forum. They are having trouble getting the Java version to run. There are two problems for this:

A) As mentioned, some (two) of the symlinks aren't correct. Look at the second post of the third page, which says to redirect them to /usr/lib/nss/ instead of just /usr/lib/

I did this, but I noticed that the file /usr/lib/nss/libnssckbi.so still didn't exist. Then, I went to the Internets, and googled that sucker up.

I can't find the exact same page as I did before, but I found something like this. Basically, the file was sitting in /usr/lib/xulrunner/ instead. So, I changed the symbolic link there. Done. Figuring out this was one of my proudest linux moments! (Don't laugh.)

B) I needed to set some extra library things, also as mentioned in the forum. I did those, setting the library path variable to the right place:

.../src$ LD_LIBRARY_PATH=.
.../src$ export LD_LIBRARY_PATH

Finally, here are the commands used to compile and run the bot:

.../src$ javac -cp accjwrap.jar *.java
.../src$ java -classpath accjwrap.jar:. javaClassName botSN botPassWord

After that, you see the following happy messages:

ConnectingACC_S_OK
ValidatingACC_S_OK
TransferringACC_S_OK
NegotiatingACC_S_OK
StartingACC_S_OK
OnlineACC_S_OK

which tell you that you've successfully put your bot online. Yay! :)

-Kyle

2 Comments:

Blogger Kyle said...

Also, the JavaDoc specs are here:

http://dev.aol.com/aimclient/OpenAIM167/java-docs/index.html

Glee!

7:41 PM  
Blogger Jason said...

I don't understand any of this....

5:29 PM  

Post a Comment

<< Home