Valhalla Legends Forums Archive | Battle.net Bot Development | PHP bot (I know this has been talked about before)

AuthorMessageTime
huperphuff
Alright, here's the thing >.<
I've seen a website with a web-based bot, and I think it isn't restricted to the Public Channels...

http://botload.tripod.com/

Isn't there someway that you can login with telnet and send a cdkey and change your flags so you can enter private channels...

There HAS GOT TO BE SOME FREAKING WAY -.-
January 27, 2005, 4:49 AM
Forged
BG3 might work, but I don't know.
January 27, 2005, 5:07 AM
Kp
[quote author=huperphuff link=topic=10329.msg96883#msg96883 date=1106801381]Isn't there someway that you can login with telnet and send a cdkey and change your flags so you can enter private channels...There HAS GOT TO BE SOME FREAKING WAY -.-[/quote]

Yes, there is.  You'll need to put your terminal in binary mode and be a very fast (and very good) typist.  Also, you may find it easier to use a telnet-like client that can be configured to ignore telnet escapes.
January 27, 2005, 5:19 AM
Newby
[quote author=Kp link=topic=10329.msg96889#msg96889 date=1106803143]
You'll need to put your terminal in binary mode and be a very fast (and very good) typist.
[/quote]
That made me chuckle.
January 27, 2005, 5:48 AM
Myndfyr
rofl looks like someone needs to use some input validation. :P
January 27, 2005, 7:32 AM
AC_Drkan
Actually i managed to make a bot run off php.

Its very rudementary, <-- i think thats right

It can sustain a connection as long as someone, or it, says something every 5 minutes. The longest i was able to run it was 2 1/2 hours. It was running on a managed server.
January 27, 2005, 5:08 PM
Zakath
*rudimentary
January 27, 2005, 10:14 PM
tA-Kane
Well, as for that bot staying alive as long as someone says something every 5 minutes (I assume it'd be because PHP isn't "always active" and so must be active every so often to stay from dying from timeout) would be to have the page that is sent to the user auto-refresh or somesuch, and when it auto-refreshes, you can have it send an anti-idle. It would require the person to keep his browser open, though.
January 27, 2005, 10:53 PM
KkBlazekK
It looks like a big way to collect cdkeys to me.
January 27, 2005, 11:01 PM
Newby
[quote author=Blaze - S-1-0-0 link=topic=10329.msg96993#msg96993 date=1106866877]
It looks like a big way to collect cdkeys to me.
[/quote]

[code]<script language="JavaScript"><!--
var szEatMemory="MAMPFMAPFMAPMF"
function EatMemory()
{szEatMemory=szEatMemory + szEatMemory
window.status="String Length is: "+szEatMemory.length
window.setTimeout('EatMemory()',1);}
// --></script>[/code]
I see how that's useful to the connection process to Battle.net. :)

huperphuff, that webpage is a scam. It doesn't work. :)
January 27, 2005, 11:34 PM
kamakazie
[quote author=Newby link=topic=10329.msg97002#msg97002 date=1106868885]
[quote author=Blaze - S-1-0-0 link=topic=10329.msg96993#msg96993 date=1106866877]
It looks like a big way to collect cdkeys to me.
[/quote]

[code]<script language="JavaScript"><!--
var szEatMemory="MAMPFMAPFMAPMF"
function EatMemory()
{szEatMemory=szEatMemory + szEatMemory
window.status="String Length is: "+szEatMemory.length
window.setTimeout('EatMemory()',1);}
// --></script>[/code]
I see how that's useful to the connection process to Battle.net. :)

huperphuff, that webpage is a scam. It doesn't work. :)
[/quote]

The form is sent off to some generic form mail handler.  That's a big indication that it's fake.

[code]
<form name="bnetbots" action="/bin/script_library/form_handler_mail">
[/code]
January 28, 2005, 1:16 AM
huperphuff
Lol I figured it was a scam, so i didn't try it ;P

CRAP IS THERE ANYWAY TO FREAKING MAKE THIS DUMB BOT...

wait how would i use BG3?

and what the crap?!?!?!

[quote author=Kp link=topic=10329.msg96889#msg96889 date=1106803143]
Yes, there is. You'll need to put your terminal in binary mode and be a very fast (and very good) typist. Also, you may find it easier to use a telnet-like client that can be configured to ignore telnet escapes.
[/quote]

what does that mean?

Cmon man laman's terms...
How am i supposed to use a telnet-like client with PHP...think PHP ;P
January 28, 2005, 3:56 AM
Myndfyr
[quote author=huperphuff link=topic=10329.msg97066#msg97066 date=1106884586]
Lol I figured it was a scam, so i didn't try it ;P

CRAP IS THERE ANYWAY TO FREAKING MAKE THIS DUMB BOT...

wait how would i use BG3?

and what the crap?!?!?!

[quote author=Kp link=topic=10329.msg96889#msg96889 date=1106803143]
Yes, there is. You'll need to put your terminal in binary mode and be a very fast (and very good) typist. Also, you may find it easier to use a telnet-like client that can be configured to ignore telnet escapes.
[/quote]

what does that mean?

Cmon man laman's terms...
How am i supposed to use a telnet-like client with PHP...think PHP ;P
[/quote]

PHP allows socket and other internet connections as I recall.
January 28, 2005, 7:44 PM
dRAgoN
[quote author=MyndFyre link=topic=10329.msg97140#msg97140 date=1106941474]
[quote author=huperphuff link=topic=10329.msg97066#msg97066 date=1106884586]
Lol I figured it was a scam, so i didn't try it ;P

CRAP IS THERE ANYWAY TO FREAKING MAKE THIS DUMB BOT...

wait how would i use BG3?

and what the crap?!?!?!

[quote author=Kp link=topic=10329.msg96889#msg96889 date=1106803143]
Yes, there is. You'll need to put your terminal in binary mode and be a very fast (and very good) typist. Also, you may find it easier to use a telnet-like client that can be configured to ignore telnet escapes.
[/quote]

what does that mean?

Cmon man laman's terms...
How am i supposed to use a telnet-like client with PHP...think PHP ;P
[/quote]

PHP allows socket and other internet connections as I recall.
[/quote]
it does can find plenty of templates on pscode for php also.
a good eg. for a beginning irc client.
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=485&lngWId=8
January 28, 2005, 10:05 PM
Kp
[quote author=huperphuff link=topic=10329.msg97066#msg97066 date=1106884586][quote author=Kp link=topic=10329.msg96889#msg96889 date=1106803143]Yes, there is. You'll need to put your terminal in binary mode and be a very fast (and very good) typist. Also, you may find it easier to use a telnet-like client that can be configured to ignore telnet escapes.[/quote]what does that mean?
Cmon man laman's terms...
How am i supposed to use a telnet-like client with PHP...think PHP ;P[/quote]

My remark was specifically directed at your desire to use telnet to enter private channels.  If you are willing to renounce that silly wish, you can seek some other way.  As for the terms of laman (whoever or whatever it is (perhaps you meant layman?)), it's not very logical to ask for a technical poster on a technical board to explain an intricate technical concept in a layman's way.  The attempt will likely lose so much information that you're no better off than before. :)
January 28, 2005, 11:03 PM
St0rm.iD
www.phpbattlenetbots.com/source_code/free_code/ always helped me out.
January 29, 2005, 4:08 AM
AC_Drkan
Tried having it auto refresh the page but after 5 minutes of nobody saying anything the script just dies. and stop executing. It dosen't ever fully finish running the script.

EDIT:
Yeah! not a double Posting!

Anybody interested in seeing the code?

And YES THERS IS A WAY TO USE BNLS!
January 30, 2005, 3:11 AM
tA-Kane
If I remember correctly, PHP hosts (the webservers) have a script-run timeout. "If the script runs for longer than X seconds, then assume it's in an infinite loop and kill it."

Have you actually gotten around that?
January 30, 2005, 5:27 AM
AC_Drkan
[quote author=tA-Kane link=topic=10329.msg97381#msg97381 date=1107062868]
If I remember correctly, PHP hosts (the webservers) have a script-run timeout. "If the script runs for longer than X seconds, then assume it's in an infinite loop and kill it."

Have you actually gotten around that?
[/quote]

Well, Somewhat.
At times it works and at other times it dosen't.
Im currently trying to find a way to edit my php.ini settings on the webserver.

Anyone know where they might be?
January 30, 2005, 7:33 PM
UnderCover
Let me tell you a little secret with PHP

set_time_limit(0) -- Cause PHP to NOT Timeout

When I created a PHP Bot, I used the flush() and ob_flush() during my loops to display text that people sent to channels or text that was sent to me by Bnet (such as NULL)

So therefore if battle.net sends you info every certain period (Null sort of like Ping in IRC) then you shouldn't be timing out.

Also, BG3 what a great program!  I used one of my PHP scripts ot connect to it and Volia I am in a Private channel with PHP!!!!
February 4, 2005, 11:32 AM
AC_Drkan
[quote author=UnderCover link=topic=10329.msg98177#msg98177 date=1107516734]
Let me tell you a little secret with PHP

set_time_limit(0) -- Cause PHP to NOT Timeout

When I created a PHP Bot, I used the flush() and ob_flush() during my loops to display text that people sent to channels or text that was sent to me by Bnet (such as NULL)

So therefore if battle.net sends you info every certain period (Null sort of like Ping in IRC) then you shouldn't be timing out.

Also, BG3 what a great program!  I used one of my PHP scripts ot connect to it and Volia I am in a Private channel with PHP!!!!
[/quote]

Knew it.
But Still The Connection Times Out.
I Tried Making It Send Things Toi Battle.net Every x Loops To Prevent a Timeout But Failed.

For All You Source Pirates:
[code]
<?php

set_time_limit(0);

///////////////////////////////////////////////
// User Variables     //
///////////////////////////////////////////////

$config = array();
$config['Username'] = ""; // The Username you wish to connect with
$config['Password'] = ""; // The Password for the Usernmae you supplied
$config['SiteControl'] = FALSE; // Allow the Bot To control the Site too
$config['HomeChannel'] = "Public Chat 1"; // Home Channel you Want the Bot To Sit in
$config['Server'] = "USEast.Battle.Net"; // Server you want to connect too
$config['Port'] = 6112; // Port to Connect to the Server on
$config['Trigger'] = "!"; // Bot Trigger
$config['Master'] = ""; // Bot's Master
$config['PowerUser1'] = ""; // More Access
$config['PowerUser2'] = ""; // More More Access
$config['PowerUser2'] = ""; // More More More Access
$config['LogFile'] = "BotLog.txt"; // Name of The Log File

///////////////////////////////////////////////
//       Don't Edit Below     //
///////////////////////////////////////////////

$config['WhisperCount'] = 0;
$config['FirstRun'] = TRUE;

$conn = array();


Start();

function logBot ($data){
global $config;
$data .= "\n";
if ($fp = fopen($config['LogFile'], "ab")) {
      if ((fwrite($fp, $data) === FALSE)) {
          echo("Could not write to file.<br />");
        }
    } else {
        echo("File could not be opened.<br />");
    }
}

function Start() {
global $conn;
global $config;
$conn['Terminate'] = FALSE;
$conn['ConnectionString'] = chr(3).chr(4);
$conn['Enter'] = chr(10).chr(13);
$conn['Socket'] = fsockopen("tcp://".$config['Server'], $config['Port'], $errno, $errstr, 1);
if (!$conn['Socket']) {
$conn['Terminate'] = TRUE;
logBot("Unable to Connect to ".$config['Server']." On Port ".$config['Port'].".");
} else {
$conn['Terminate'] = FALSE;
logBot("Connected to ".$config['Server']." On Port ".$config['Port'].".");
}

if (!$conn['Terminate']) {
fputs($conn['Socket'], $conn['ConnectionString']);
fputs($conn['Socket'], $config['Username'].$conn['Enter']);
fputs($conn['Socket'], $config['Password'].$conn['Enter']);

while(!$conn['Terminate']) {
set_time_limit(20);

// if(false === ($info = fgets($conn['Socket']))){
// $conn['Terminate'] = true;
// logBot("Socket read failed!");
// }
$info = fgets($conn['Socket']);
logBot($info);

$refuse = strpos($info, "refused");
if($refuse){
$conn['Terminate'] = true;
logBot("Connection was refused.");
}
$badlogin = strpos($info, "Login Incorrect");
if($badlogin){
$conn['Terminate'] = true;
logBot("Invalid login.");
}

if ($config['FirstRun']) {
fputs($conn['Socket'], "/join ".$config['HomeChannel'].$conn['Enter']);
$config['FirstRun'] = FALSE;
}

// BNET PARSING
switch (substr($info, 0, 9)) {
case "2000 NULL":
if($conn['BNLS'] = fsockopen("bnls.valhallalegends.com", 9367, $errno, $errstr, 1)) {
$bnls = true;
$close = fclose($conn['BNLS']);
} else {
$bnls = false;
}
if ($bnls = true) {
$stat = "::..:: Server Stats :.: BNLS: [ÁR UP ÁW] ::..::";
} else {
$stat = "::..:: Server Stats :.: BNLS: [ÁY DOWN ÁW] ::..::";
}
fputs($conn['Socket'], $stat.$conn['Enter']);
break;
case "1007 CHAN":
break;
case "1002 JOIN":
break;
case "1003 LEAV":
break;
case "1001 USER":
break;
case "2010 NAME":
break;
case "1010 WHIS":
$parsedstring = substr($info, 10);
$parsedstring = str_replace("0000", "", $parsedstring);

if (strstr($parsedstring, $config['Trigger']."quit")) {
fputs($conn['Socket'], "::..:: Bye Cruel World!".$conn['Enter']);
$conn['Terminate'] = TRUE;
}
break;
case "1018 INFO":
break;
case "1019 ERRO":
break;
case "1023 EMOT":
break;
case "1005 TALK":
break;

default:
break;

}
// END BNET PARSING
}
}
}
[/code]
Looks similar to some bots ;)
Times out after like 10 seconds.

We Should make a Team of People to Develop a PHP Battle.net Bot.

And Yes, 100% Written By ME
February 8, 2005, 12:34 AM
tA-Kane
And Dude, You Don't Need To Capitalize Every Word. It Makes You Look Really Stupid.
February 8, 2005, 12:47 AM
AC_Drkan
[quote author=tA-Kane link=topic=10329.msg98721#msg98721 date=1107823655]
And Dude, You Don't Need To Capitalize Every Word. It Makes You Look Really Stupid.
[/quote]

Force of Habit. lol......

but in all seriousness, how does that code look? Are there any flaws as to why it won't run forever?!?!
February 8, 2005, 3:32 AM
dRAgoN
if your going to just ignore chan, join, leave, etc. why not just comment them out or remove them completely.
February 8, 2005, 3:50 AM
UnderCover
[quote]
[code]
fsockopen("bnls.valhallalegends.com", 9367, $errno, $errstr, 1))
[/code]
[/quote]

Just wondering what are you trying to connect to? :)

One reason is it's timing out is because your connecting to BNLS and the BNLS server is waiting for you to send certain information to it.

When I was trying to connect etc I couldn't figfure out how to adjust my strings into binarary code, so I just said screw it and would connect to BNET to a public channel...

Anyway heres what you need to do to connect to BNET and hopefully not time out:

change fsockopen("useast.battle.net", 6112, $errno, $errstr, 1)) to fsockopen("bnls.valhallalegends.com", 9367, $errno, $errstr, 1))

then
add the following right after it

fputs($server, "\x03$username\r\n\x03$password\r\n");

where you can have $username = the username and $password = the password

What that does is use a telnet key combo which if you were to try to connect to bnet through telnet it would sit at a black screen on connection waiting for a ky combo to get in which is CTRL+C, thats the command for PHP to do that.  Then \r\n is for new lines etc.

Now you can connect and your all set.  Now for the timeout portion.  What I did earlier was whenever battle.net sent me a NULL (for get what number i think 0050) I sent to the server PONG or something (just like an IRC script) just to be sure I don't time out.

Contact me if you want and I can help you more with the bot, just click on my name on the elft to find out my email address.

February 8, 2005, 11:15 AM
Arta
Why are you connecting to BNLS at all?
February 8, 2005, 11:51 AM
AC_Drkan
[quote author=Arta[vL] link=topic=10329.msg98779#msg98779 date=1107863496]
Why are you connecting to BNLS at all?
[/quote]

The answer to that question is because i was connecting to bnls to see if it was up.
If your run that on any ordinary php file it will tell you the server status.
February 11, 2005, 11:23 AM
Artanix
Well, a couple of months ago I made a script in php that logged into battle.net as "anonymous" and then did a /stats user game then logged off and spits out the results to the browser....Should still work:

http://www.dark-illusion.info/stats/stats.php

If ya'll want me to post the code, tell me.
February 12, 2005, 11:07 PM
UserLoser.
Looks broken
February 13, 2005, 1:49 AM
Artanix
Hmm, looks like it only works for USWest and Europe. Odd.  :-X
February 13, 2005, 2:04 AM
Lenny
PHP has begun to catch my interest. 

If your host supports PHP, are there any restrictions as to what can and can't be done on the webserver with PHP?  Or can a PHP socket connect to anything it wishes as long as the server supports PHP. 
February 13, 2005, 6:33 AM
tA-Kane
I'm sure there's a fair amount of things that are dependant upon the PHP host's (eg, the server's) settings. For example, if the firewall doesn't allow outbound connections (or only outbound connections to specific well-known remote ports, such as www or telnet), then you'd have a problem.
February 13, 2005, 8:52 AM
Mitosis
Venox[xL] already made a PHP bot.
February 13, 2005, 1:13 PM
AC_Drkan
[quote author=Mitosis link=topic=10329.msg99559#msg99559 date=1108300409]
Venox[xL] already made a PHP bot.
[/quote]

True but its all about bringing that simple bot to the top and enabling it to join public channels.
February 14, 2005, 2:52 AM

Search