Net_man Report post Posted May 16, 2006 (edited) hi, i mmaking a bot. he basically sits there and (later) i'll improove him to take basic commands and play a raffle. i got him to connect to eternal-lands.network-studio.com on port 2001... unfortinately, i cant get him to login. any help? this is the packet im sending: printf($conect,"140NetWizard\0passworddd\0"); i AM, however, getting YOU_DONT_EXIST, bu that might jsut be a random case thingy that happens if teh CASE variable($cmd) doesnth ave a value. if ANYONE has any ideas(especially admins/devs)..PLEASE post!!! <?php define($host,"eternal-lands.network-studio.com"); define($port,2000); define($username,"NetWizard"); define($password,"passorddd"); define($forever,1); define($cmd, ""); echo("Connecting to server\n"); $conect = fsockopen("eternal-lands.network-studio.com", 2001, $errno, $errstr, 120); fwrite($conect,"60"); if($conect !== FALSE) { echo("Connection established.\n"); } else { echo("Sorry, failed to connect to server.\n"); } echo("Logging in...\n"); printf($conect, '\0'); sleep(2); //printf($conect,"1409NetWizard0passworddd0"); printf($conect,"140NetWizard\0passworddd\0"); echo("Logged in to NetWizard(or atleast we THINK he is..)\n"); while($forever = 1) { //$cmd = scanf($conect); echo("$cmd"); //this for testing purposes. $cmd2 = ord(substr($cmd, 0, 1)); switch($cmd2) { case(250); echo("LOG_IN_OKAY. your good."); case(251); echo("LOG_IN_NOT_OK... sorry. wrong pass"); case(0); // process raw text. case(60); printf($conect,"60"); case(247); echo("YOU_DONT_EXIST. Wrong username"); } } function logout() { printf($conect,'BYE'); fclose($conect); } ?> Thanks for your support!! Dude Ingame Netdude Edited May 16, 2006 by Dude Share this post Link to post Share on other sites
crusadingknight Report post Posted May 16, 2006 (edited) The format is actually "Username Password\0": it's NULL-terminated, not delimited. Also, do you have NetWizard registered on port 2001? Anyway, another PHP bot can be found at http://www.eternal-lands.com/forum/index.php?showtopic=24328 EDIT: Smacks self in face... thanks learner, the protocol should also be binary (\140), not ASCII. Again, most of this is already presented in the above-mentioned thread. Edited May 16, 2006 by crusadingknight Share this post Link to post Share on other sites
Net_man Report post Posted May 16, 2006 The format is actually "Username Password\0": it's NULL-terminated, not delimited. Also, do you have NetWizard registered on port 2001? Anyway, another PHP bot can be found at http://www.eternal-lands.com/forum/index.php?showtopic=24328 EDIT: Smacks self in face... thanks learner, the protocol should also be binary (\140), not ASCII. Again, most of this is already presented in the above-mentioned thread. thanks for your help..but,can i have an example packet? i mnot exactly the brightest bulb in the box! Share this post Link to post Share on other sites
Jaxbot Report post Posted May 16, 2006 The format is actually "Username Password\0": it's NULL-terminated, not delimited. Also, do you have NetWizard registered on port 2001? Anyway, another PHP bot can be found at http://www.eternal-lands.com/forum/index.php?showtopic=24328 EDIT: Smacks self in face... thanks learner, the protocol should also be binary (\140), not ASCII. Again, most of this is already presented in the above-mentioned thread. still not working I think it might be the connection... Share this post Link to post Share on other sites
crusadingknight Report post Posted May 16, 2006 (edited) Ooops, I guess I didn't examine that well enough... aren't you using a function to insert lengths? (I didn't check for that since, I'm used to my bots, even the ruby one inserting it themself.) In anycase, you should be sending [1 byte: Protocol][2-Bytes, Little-Endian: Length][Message...]. The other link wasn't inserting it in his bot code, and that was his problem too. Thus, the example packet would be '\140\21\0NetWizard passworddd\0', where \140 is the protocol, and \21\0 is the little-endian binary representation of the length of the string+1. Edited May 16, 2006 by crusadingknight Share this post Link to post Share on other sites
Net_man Report post Posted May 16, 2006 (edited) Ooops, I guess I didn't examine that well enough... aren't you using a function to insert lengths? (I didn't check for that since, I'm used to my bots, even the ruby one inserting it themself.) In anycase, you should be sending [1 byte: Protocol][2-Bytes, Little-Endian: Length][Message...]. The other link wasn't inserting it in his bot code, and that was his problem too. Thus, the example packet would be '\140\21\0NetWizard passworddd\0', where \140 is the protocol, and \21\0 is the little-endian binary representation of the length of the string+1. TY!!!!!!1111111~ lol oh, whats the IP ADDESS of teh EL server? im converting it to JAVA so i can test it without apache. thanks! Edited May 16, 2006 by Dude Share this post Link to post Share on other sites
Jaxbot Report post Posted May 17, 2006 Still not working... I'm starting to think it's not even connecting. Share this post Link to post Share on other sites
dns_server Report post Posted May 17, 2006 Ethereal is your friend, start by capturing the stream of you logging with a real client to use as a reference and then work on your bot to ensure the same packets are sent by your bot. if you are converting it to java you don't need the ip address, you can just open up a socket from the hostname, java will find the ip itself. <shamless plug> if you want to do a bot in java (unfortunately no trade yet) use Jelc</shameless plug> or you could use one of the other bot projects from the stickey "How do I make a bot?" Share this post Link to post Share on other sites
Jaxbot Report post Posted May 17, 2006 Ok. I'm using a Visual Basic program I made to try to run the bot, however, it disconnects every 2 seconds. I'm not sure what I did wrong... do I need to send a heartbeat or something? Share this post Link to post Share on other sites
Learner Report post Posted May 17, 2006 Ok. I'm using a Visual Basic program I made to try to run the bot, however, it disconnects every 2 seconds. I'm not sure what I did wrong... do I need to send a heartbeat or something? Almost any error in the protocol will get you disconnected. There is a required heartbeat, but that is at about 45 seconds if I remember correctly. Share this post Link to post Share on other sites
Net_man Report post Posted May 18, 2006 Ok. I'm using a Visual Basic program I made to try to run the bot, however, it disconnects every 2 seconds. I'm not sure what I did wrong... do I need to send a heartbeat or something? you got it to log in? cool. i tried crusadingknight's idea..but it didnt work. Share this post Link to post Share on other sites
Jaxbot Report post Posted May 18, 2006 LOL, no. It connected. Share this post Link to post Share on other sites
Net_man Report post Posted May 22, 2006 oklol..got it to work..see "any new function idead ofr bot?" or something. its market with a smilie and near top of forum. Share this post Link to post Share on other sites