The Nemisis Guide to Hacking Article Three - Visual Basic TocSock with Control Arrays Level - Beg/Inter By Nemisis (sbbutts@attbi.com/www.NemisisCommunications.com) This document is soley for educational purposes. I take no responsibility for anything you do, or say, after reading it. In other words; Do not try this at home...(or anywhere else). During the course of about 5 minutes, I got 3 IM's asking me for help Multi-Threading logins for AIM, using tocsock. This is one of the conversations I had. It explains how to do it, along with what a control array is, and how to use it. Many of the questions, you would ask me, are asked in this, and are answered. There are also code examples. The names were changed of course, and the content edited, as was needed. Student (4:47:11 PM): u think you could help me out with a mass log in (aim) Nemisis (4:48:02 PM): sure Nemisis (4:48:04 PM): what ya using Nemisis (4:48:07 PM): oscar or toc? Student (4:48:16 PM): tocsock Nemisis (4:48:30 PM): ok, do you know what a control array is? Student (4:49:04 PM): no :[ Student (4:49:05 PM): see... Student (4:49:18 PM): i tried to put 3 different pass/names Student (4:49:21 PM): and changed all that Student (4:49:25 PM): and it logs them all in Student (4:49:27 PM): except... Student (4:49:33 PM): it logs the other one out, then the other one in Student (4:49:39 PM): and thats not what im trying to do Nemisis (4:49:44 PM): i know Nemisis (4:49:46 PM): ok Nemisis (4:49:54 PM): a control is what you put on a form Nemisis (4:50:03 PM): tocsock is a control Nemisis (4:50:07 PM): a text box is a control Nemisis (4:50:08 PM): etc Nemisis (4:50:48 PM): an array is a bunch of controls with the same name, that you choose with a number Student (4:50:49 PM): yea Nemisis (4:50:56 PM): like tocsock(1).sendim Nemisis (4:51:00 PM): tocsock(2).sendim Nemisis (4:51:17 PM): to make a control array Nemisis (4:51:28 PM): copy and paste tocsock, Nemisis (4:51:33 PM): it will ask if you want to make one, say yes Nemisis (4:51:45 PM): then you have tocsock1(0) and tocsock1(1) Student (4:52:06 PM): okay thanks! :-) lemme try it Nemisis (4:52:08 PM): the point of this, is to use the same, but diffrent tocsock to log in your bots Nemisis (4:52:19 PM): the index is the # of the tocsock u wanna use Nemisis (4:52:24 PM): you can make a loop like this Nemisis (4:52:28 PM): dim a as integer Nemisis (4:52:32 PM): for a = 1 to 3 Nemisis (4:53:56 PM): tocsock1(a).signon sn(a) pw(a) Nemisis (4:53:58 PM): next a Nemisis (4:54:05 PM): so a would be the index Nemisis (4:54:13 PM): and sn(a) would be a variable like Nemisis (4:54:18 PM): dim sn(10) as string Nemisis (4:54:23 PM): so that makes 10 sn variables Nemisis (4:54:27 PM): that can be filled Nemisis (4:54:40 PM): and dim pw(10) as string Nemisis (4:54:43 PM): and 10 pw strings Nemisis (4:54:49 PM): and a will go though them all Nemisis (4:54:54 PM): and log them into diffrent tocsock Nemisis (4:54:55 PM): s Student (4:56:03 PM): well Student (4:56:31 PM): i pasted tocsock Student (4:56:41 PM): i pit f5 Student (4:56:46 PM): and got a complie error Student (4:56:49 PM): Private Sub tocSock_incomingChatID(strRoom As String, lngId As Long Student (4:56:53 PM): highlighted that Student (4:57:18 PM): procedure declaretion does not match description of event or procedure having the same name Nemisis (4:57:35 PM): ok Nemisis (4:57:51 PM): that is ebcause when you make a control array, you have to add this Nemisis (4:59:28 PM): 1sec Student (4:59:57 PM): okay Nemisis (5:00:07 PM): your not adding the index in, it should look like this Student (5:00:11 PM): i apprecaite your helping me :-) Nemisis (5:00:20 PM): Private Sub tocSock1_incomingChatID(Index As Integer, strRoom As String, lngId As Long) Nemisis (5:00:24 PM): see the index as integer Nemisis (5:00:35 PM): index designates which tocsock in the array to send the data too Nemisis (5:00:42 PM): like tocsock(1). Nemisis (5:00:46 PM): or tocsock(2) Nemisis (5:00:56 PM): you can take a look at my source on PScode.com Nemisis (5:00:59 PM): it my nbots Nemisis (5:01:06 PM): which has a multiple login scheme Student (5:01:22 PM): i have Private Sub tocSock_incomingChatSend(lngId As Long, strName As String, strMessage As String, boolWhisper As Boolean now Nemisis (5:01:44 PM): add index as integer Nemisis (5:01:46 PM): to the beggingin Nemisis (5:01:50 PM): infront of lngID as long Nemisis (5:01:58 PM): think of it like this Nemisis (5:02:06 PM): intsead of having tocsock1 and tocsock2 Nemisis (5:02:13 PM): you have tocsock(1) and tocsock(2) Student (5:02:34 PM): Private Sub tocSock_incomingChatSend(Index As Integer, strName As String, strMessage As String, boolWhisper As Boolean) Student (5:02:40 PM): right? Nemisis (5:02:44 PM): there the same tocsock, meaning they have the same code, BUT, they can be accessed at the same time by an infinate amount of diffrent things Nemisis (5:02:45 PM): yes Nemisis (5:02:58 PM): and the designation, as to which tocsock is which in the array, is the index Student (5:03:22 PM): Private Sub tocSock_incomingChatSend(Index As Integer, strName As String, strMessage As String, boolWhisper As Boolean Student (5:03:28 PM): same errpr Student (5:03:28 PM): error* Nemisis (5:03:38 PM): yeah Nemisis (5:04:14 PM): its beacuse you errased lngid as long Student (5:04:20 PM): ? Student (5:04:20 PM): lol Nemisis (5:04:24 PM): you goto keep that Student (5:05:26 PM): Private Sub tocSock_incomingChatSend(Index As Integer, strName As String, strMessage As String, lngId As Long boolWhisper As Boolean Student (5:05:28 PM): how that look? Nemisis (5:05:46 PM): should work Student (5:06:16 PM): complie error Student (5:06:16 PM): ;/ Nemisis (5:06:26 PM): where Nemisis (5:06:42 PM): u didnt puit a comma in Student (5:06:44 PM): Private Sub tocSock_incomingChatSend(Index As Integer, strName As String, strMessage As String, boolWhisper As Boolean Nemisis (5:06:51 PM): er Nemisis (5:07:15 PM): your still not having the lngid as long in there Nemisis (5:07:59 PM): Private Sub tocSock_incomingChatSend(index as integer, lngId As Long, strName As String, strMessage As String, boolWhisper As Boolean) Nemisis (5:08:03 PM): that should work Student (5:08:04 PM): Private Sub tocSock_incomingChatSend(Index As Integer, strName As String, strMessage As String, lngId As Long, boolWhisper As Boolean Student (5:08:04 PM): same thing Student (5:08:10 PM): and i put a comma in there Nemisis (5:08:11 PM): u need a ) at the end Nemisis (5:08:15 PM): use the one i sent Nemisis (5:08:15 PM): Private Sub tocSock_incomingChatSend(index as integer, lngId As Long, strName As String, strMessage As String, boolWhisper As Boolean) Student (5:08:36 PM): k Student (5:08:44 PM): now Private Sub tocSock_incomingError(intErrorCode As Integer Student (5:08:52 PM): so its basically the same thing w/ the last one? Nemisis (5:09:03 PM): yeah, you need to add index as integer Nemisis (5:09:06 PM): to allof them Student (5:09:31 PM): Private Sub tocSock_incomingError(intErrorCode As Integer,index as integer ) Student (5:09:31 PM): right? Nemisis (5:09:42 PM): index as integer should be first, but im not sure if it matters Student (5:10:11 PM): well it moved to another error now? Student (5:10:11 PM): Private Sub tocSock_loggedIn Student (5:10:19 PM): i dont know how to change that? Nemisis (5:10:22 PM): same thing for all te tocsocks Nemisis (5:10:32 PM): tocsock_loggedin(index as integer) Nemisis (5:10:48 PM): that variable has to be in any of the tocsock subs Student (5:10:50 PM): i typed Private Sub tocSock_loggedIn(),index as integer Student (5:10:50 PM): k Nemisis (5:11:02 PM): no the variables go inside the ()'s Nemisis (5:11:25 PM): the paraentheisis attach the variable to the sub Student (5:11:29 PM): it highlighted 'as' ? Nemisis (5:11:44 PM): because its not in the ('s Nemisis (5:11:45 PM): ) Nemisis (5:11:55 PM): tocsock_loggedin(index as integer) Student (5:12:09 PM): no this is yours, i pasted it Nemisis (5:12:17 PM): 1 sec Student (5:12:19 PM): tocsock_loggedin(index as integer) Student (5:12:19 PM): highlighted the as Student (5:12:26 PM): nvm Student (5:12:31 PM): now its Private Sub tocSock_loggedOut() 'disconnected from server Label3 = Text1 & " signed off!" End Sub Student (5:12:46 PM): k i fixed that one :-) Student (5:13:10 PM): Private Sub tocSock_updateChatBuddy(index as integer, lngId As Long, strName As String, boolEnter As Boolean Student (5:13:11 PM): fixed that one too Student (5:13:19 PM): and the program opens :-) Nemisis (5:13:26 PM): ;-) Nemisis (5:13:32 PM): you might get more erros like that one Nemisis (5:13:36 PM): just add the index Student (5:13:55 PM): yes... Student (5:13:55 PM): i just clicked sign on Student (5:14:03 PM): and .loginUser highlighted Student (5:14:12 PM): i did, Private Sub Command1_Click(index As Integer) Student (5:14:19 PM): that doesn't wanna work Nemisis (5:17:24 PM): you only have to add it too the tocsocks Student (5:17:26 PM): tocSock.loginUser,index As Integer, Student (5:17:26 PM): i tried that Student (5:17:26 PM): ;/ Nemisis (5:17:37 PM): now, when your specifying tocsock.loginuser Nemisis (5:17:43 PM): you dont add the index as integer Student (5:17:46 PM): k Nemisis (5:17:48 PM): thats only at the begging of the subs Nemisis (5:17:52 PM): you do it like this Nemisis (5:18:02 PM): tocsock(1).loginuser Nemisis (5:18:05 PM): the 1 is the index Nemisis (5:18:14 PM): thats the variable you've been putting everywhere Nemisis (5:18:24 PM): it tells tocsock which # in the index to use Student (5:19:03 PM): its signing them both off Student (5:19:03 PM): i only have 2 log ins Student (5:19:12 PM): and i added tocsock(1).loginuser for both Student (5:19:12 PM): shouldn't i make one Student (5:19:12 PM): tocsock(1).loginuser Student (5:19:12 PM): and the other Student (5:19:18 PM): tocsock(2).loginuser Student (5:19:18 PM): ? Nemisis (5:19:20 PM): yeah Nemisis (5:19:21 PM): exactly Nemisis (5:19:24 PM): u got it Student (5:19:28 PM): mqvs= online now Student (5:19:38 PM): the other one doesn't want to Student (5:19:47 PM): k Student (5:27:46 PM): well Student (5:27:55 PM): tocSock(2).loginUser Text10, Text9, "tocSock Example", "toc.oscar.aol.com", "5190" Student (5:27:59 PM): is having a error Student (5:28:06 PM): tocsock(1) signs on Student (5:28:08 PM): this one doesn't Nemisis (5:28:36 PM): well, you using the same text boxes Nemisis (5:28:41 PM): so its trying to sign on the same name twice Student (5:29:27 PM): Text10, Text9 (for the name that wont sign on) Text11, Text12,(for the name that signs on ) Nemisis (5:33:18 PM): well Nemisis (5:33:26 PM): see. that defeats the whole thing Student (5:33:30 PM): i just changed it to tocSock(2).loginUser Text1, Text2, "tocSock Example", "toc.oscar.aol.com", "5190" Nemisis (5:33:35 PM): because your just doing normal text boxes Student (5:33:43 PM): debug error Student (5:33:45 PM): tocSock(2).loginUser Text1, Text2, "tocSock Example", "toc.oscar.aol.com", "5190" Student (5:33:51 PM): highlighted it all Nemisis (5:33:55 PM): ahh Nemisis (5:34:07 PM): prolly because you dont have a tocsock(2) on your form Nemisis (5:34:12 PM): copy and paste tocsock a few more times Student (5:34:25 PM): omfg Student (5:34:29 PM): it had tocsock 0 Student (5:34:32 PM): and tocsoc 1 Student (5:34:34 PM): thats why Student (5:34:35 PM): lol Student (5:35:02 PM): omfg Student (5:35:02 PM): it works Student (5:35:04 PM): you=god Student (5:35:12 PM): thank you so much for all your help Nemisis (5:35:38 PM): :-) Nemisis (5:35:38 PM): np Nemisis (5:35:42 PM): but here is what yous hould do Student (5:35:43 PM): :-D Student (5:35:46 PM): k Nemisis (5:35:47 PM): copy and paste text1 and text2 Nemisis (5:35:52 PM): and make them control arrays Nemisis (5:35:54 PM): so you can do this Nemisis (5:36:00 PM): dim a as integer Nemisis (5:36:13 PM): for a = 0 to 1 Student (5:36:30 PM): im lost ;/ Nemisis (5:36:47 PM): tocSock(a).loginUser Text1(a), Text2(a), "tocSock Example", "toc.oscar.aol.com", "5190" Nemisis (5:36:50 PM): next a Student (5:37:17 PM): k, i just was messing around Student (5:37:20 PM): to see if it works Student (5:37:24 PM): and the IM shit doesn't wanna work= Student (5:37:47 PM): index as integer, Nemisis (5:37:48 PM): whats it sayin Student (5:37:49 PM): lemme try it Student (5:38:00 PM): .sendIM Nemisis (5:38:00 PM): tocsock(1).sendim Nemisis (5:38:02 PM): remember that Nemisis (5:38:14 PM): you have to add the (1) or (2) or (0) Student (5:38:18 PM): mqvs (5:38:34 PM): die mqvs signed off at 5:38:36 PM. mqvs signed on at 5:38:37 PM. Student (5:38:19 PM): lmao Nemisis (5:38:21 PM): at the end of the tocsocks Student (5:38:41 PM): so.. Student (5:38:42 PM): tocSock(1)(2).sendIM Text3, Text4, True Student (5:38:43 PM): wouldn't work? Nemisis (5:38:53 PM): nope that wouldnt Nemisis (5:38:55 PM): u could do Nemisis (5:39:03 PM): for a = 1 to 2 Student (5:39:04 PM): tocSock(1).sendIM Text3, Text4, True Student (5:39:06 PM): tocSock(2).sendIM Text3, Text4, True Student (5:39:11 PM): i just put that under both Nemisis (5:39:16 PM): see Student (5:39:16 PM): i doubt its gonna work Nemisis (5:39:36 PM): thas the problem, your still copy and pasting code, you goto use a loop, to make it more efficent like this Nemisis (5:40:28 PM): dim a as integer 'this is the index number for a = 1 to 2 'this makes a loop through the one and 2 tocsock index tocSock(a).sendIM Text3, Text4, True next a Nemisis (5:40:43 PM): a = 1 and then a = 2 Nemisis (5:40:46 PM): during the loop Nemisis (5:40:48 PM): so it saves time Nemisis (5:41:12 PM): you can make it go from tocsock(1) to tocsock 10 by changeing for a = 1 to 2 to for a = 1 to 10 Nemisis (5:41:14 PM): that easy Nemisis (5:41:18 PM): if you wanna add mroe bots Student (5:41:30 PM): yes, both IMed me :] Student (5:49:09 PM): for the chats Student (5:49:10 PM): Private Sub Command5_Click() 'send an instant message Dim a As Integer 'this is the index number For a = 1 To 2 'this makes a loop through the one and 2 tocsock index tocSock.joinChat Text8, Text7, True Next a Student (5:49:11 PM): i did that Student (5:49:15 PM): somethings wrong Student (5:49:15 PM): ;/ Nemisis (5:49:36 PM): tocsock(a) Student (5:50:15 PM): tocSock(a).joinChat Text8, Text7, True Student (5:50:18 PM): error Nemisis (5:50:35 PM): what error Student (5:50:49 PM): complie Student (5:50:50 PM): chat erro Student (5:50:51 PM): error* Student (5:50:55 PM): im trying to join a chat Nemisis (5:51:12 PM): yeah Nemisis (5:51:17 PM): you have to read the variables that go into it Nemisis (5:51:24 PM): type, tocsock(a).joinchat Nemisis (5:51:27 PM): and you see it wants Nemisis (5:51:35 PM): an exchange # and a room name Nemisis (5:51:42 PM): there is no true or false at the end Nemisis (5:51:42 PM): so its Nemisis (5:51:52 PM): tocsock(a).joinchat 5, "Nemisis" Student (5:52:41 PM): aim:gochat?roomname=Nemisis&exchange=5 Student (5:52:42 PM): lets see Student (5:52:58 PM): LoL Student (5:53:02 PM): worked Student (5:53:03 PM): :] Student (5:53:33 PM): gawd Student (5:53:34 PM): Private Sub Text5_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyReturn Then 'send something to a chat room tocSock.sendChat chatID, Text5 Text5 = "" End If End Sub Student (5:53:38 PM): ;l Nemisis (5:53:53 PM): tocsock(a) !!!! Nemisis (5:53:56 PM): tocsock(a) Nemisis (5:54:00 PM): or Nemisis (5:54:02 PM): in that case Nemisis (5:54:18 PM): you have to figure out which one you wnat to send with Nemisis (5:54:23 PM): so tocsock(1) or tocsock(2) Student (5:55:32 PM): i tried Student (5:55:34 PM): tocSock(1).sendChat chatID, Text5 Student (5:55:35 PM): and Student (5:55:37 PM): tocSock(a).sendChat chatID, Text5 Student (5:55:39 PM): nothing Student (5:55:40 PM): ;/ Nemisis (5:55:53 PM): do Nemisis (5:56:29 PM): chatid = tocSock1(1).lastestchatid Nemisis (5:56:41 PM): the a only works if you have set it up as an integer variable Student (5:57:24 PM): nope Nemisis (5:57:33 PM): er Nemisis (5:57:40 PM): tocsock(1).lastestchatid Nemisis (5:57:45 PM): take the xtra 1 out Student (5:58:25 PM): if im kinda annoying u, i can let u go... just lemme know :/ Nemisis (5:58:31 PM): its cool Student (5:58:31 PM): okay i did chatID = tocSock(1).lastestchatid Student (5:58:34 PM): and same error Student (5:58:34 PM): k Nemisis (5:58:58 PM): do Nemisis (5:59:06 PM): dim chatid as string Nemisis (5:59:10 PM): before anything else Student (5:59:51 PM): u know im lost right Student (5:59:52 PM): ; Student (5:59:52 PM): ;x Student (5:59:53 PM): lo Student (5:59:55 PM): l Nemisis (6:00:11 PM): lol Nemisis (6:00:21 PM): do this Nemisis (6:01:24 PM): Private Sub Text5_KeyPress(KeyAscii As Integer) dim chatid as string chatID = tocSock(1).lastestchatid If KeyAscii = vbKeyReturn Then 'send something to a chat room tocSock(1).sendChat chatID, text5 Text5 = "" End If End Sub Student (6:01:55 PM): .lastestchatid Nemisis (6:02:44 PM): latest Student (6:03:00 PM): me = dumb closed the project Student (6:03:04 PM): but i get the idea Student (6:03:07 PM): :-) thanks Nemisis (6:03:14 PM): np And that, is that. -Nemisis