The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Other Code
Posted by: writing a bot - client for ares | July 16, 2009 @ 2:46pm
Other Code
[
Download
]
Programming an Ares Bot / Client Note: This tutorial will refer to making a bot using REALbasic ( http://www.realsoftware.com ). You will also to need to download WPE Pro 0.9a for packet sniffing Ares. Step One: Startinf Out Start out by getting WPE ready to sniff Ares. When ready and Ares is open,chosse the name of your bot by the user name you would use in Ares, then start WPE then join a chatroom in Ares (anyone will work). When you have joined and recieved the motd text then stop WPE. Go back and Look at the text in WPE. What you are looking for is a packet that conyains your user-name (if non unicode it will appear) and the text Ares 1.8.12947. This is the connection packet. When you think you have got the packet, save it as a text file with IP's shown. Step Two: The Protocol Open REALbasic 5.5. Now add a socket control to the window. By default it will be a TCPSocket (TCPSocket1). Leave it as a TCPSocket you need it! Double-click the socket control in window1 (your default project window), now in the Connected Event you will need to place the hex code from the packet. Open Notepad and find the packet we need. There is a line at the top of the packet that has the sending and receiving IP addreses, ignore that you don't need it. Now there is a set of four numbers at the beginning of every line in the packet, delete them all, they are nothing more than a counter for the packet sniffer. Now you will see some text and charaters at the right of the packet, delete those as well. Now all you should have left is the raw hex. Something like this: 50 00 02 61 01 2A B7 47 2B 41 4A 86 EB 29 3E 3B 65 4C C0 00 00 00 43 2D 45 D1 86 DD B1 6F A8 61 00 00 5B C5 A6 CE 9E 5D C4 B6 C5 97 C5 B7 CF 81 C5 A3 C4 B1 C3 A7 00 41 72 65 73 20 31 2E 38 2E 31 2E 32 39 34 37 00 42 BC 1B C2 42 BC 1B C2 01 Now reformat the hex code in this way: chr(&h50)+chr(&h00)+chr(&h02)+chr(&h61)+chr(&h01)+chr(&h2A)+chr(&hB7)+chr(&h47)+chr(&h2B)+chr(&h41)+chr(&h4A) And so on till you have the entire packet coded in this format. The whole packet must be in ONE line of code so if you format this way in Notepad first then turn off the word wrap so you make no mistakes. Step Three: Writing The Connection Now that that everything is fromatted correctly we can move on to writing the code for the connection. Double click on TCPSocket1 and you will then be in the Connected Event of the socket. Now write this code: TCPSocket1.write (your hex code here) Example: TCPSocket1.write chr(&h50)+chr(&h00)+chr(&h02)+chr(&h61)+chr(&h01)+chr(&h2A)+chr(&hB7) That is all you need for the bot/client to connect to Ares and display your chosen name. Step Four: Design The Interface A few things will need to be added to make your bot/client work correctly. Here is a list of controls that need to be added to Window1: 1. 3 - EditFeilds 2. 2 - PushButtons 3. 1 - CheckBox Arrange them like the following example or something similar to it: Now click once on Pushbutton1. Now in the properties to the right of window1, go to Caption and type in Connect. Now do the same for Pushbutton2 but anme this one disconnect. Step Five: More Code Double-click on Pushbutton1. You will, by default, be in the Action Event of Pushbutton1. Now place the following code there: TCPSocket1.Address = Editfield1.text TCPSocket1.Port = val(editfield2.text) TCPSocket1.connect That just enabled Pushbutton1 to connect using Editfield1 for the IP address ad Editfield2 for the port and then connects. Now double click on Pushbutton2. And in it's Action Event place the following code: TCPSocket.disconnect When you want to close your bot/client this wil disconnect it. Step Six: Sending Text Double-click on Editfield3. You will, by default in the Key Down Event. Place the following code: if key = chr(13) OR key = chr(3) then //Means both enter keyson your keyboard. if me.text = "" then //if the editfield is empty it will not send anything return true end Sock.write Chr(lenB(Editfield3.text))+chr(&h00)+chr(&h0A)+Editfield3.text me.text = "" //this causes the editfield to clear the text after sending return true end That is pretty much it. Your bot.client will now connect to Ares and send text.
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.42 / 8
95 Votes
http://codebin.yi.org/332
page generated in 0.01 seconds