Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Lance

Pages: [1] 2 3
1
General Programming / [JAVA] Datagram Hook
« on: June 25, 2010, 09:35:46 pm »
I want to receive the outgoing UDP datagrams from a C++ program, and spoof the sender address of incoming datagrams; nothing more and nothing less. Is this possible with Java, or is the language too limited?

I am using Fedora by the way.

Thanks :)

EDIT: The C++ program is open source so I have full access to it's API.

EDIT 2: Fixed some bad wording.

2
General Programming / [JAVA] Issue replying to Datagrams
« on: June 22, 2010, 06:49:10 pm »
Some machines on my network are sending datagrams to me and I am trying to reply to them, but I am not sure how to code a datagram listener. The code below works (well, it receives the datagrams), but when I try to get the InetAddress it originated from, it is either null or my own InetAddress (I suppose it varies by what I try, but I always get one of those two results). How can I get the correct InetAddress to reply with another datagram?

Code: [Select]
setSocket(new DatagramSocket(1234)); // Just a setter for a DatagramSocket instance.

...

byte[] raw = new byte[256];
DatagramPacket datagram = new DatagramPacket(raw, raw.length);
getSocket() // Just a getter for a DatagramSocket instance.
           .receive(datagram);

...

datagram.getInetAddress(); // Either null or my InetAddress

Thanks :)

3
General Programming / [JAVA] Packet Joins
« on: June 21, 2010, 12:37:55 am »
Joe brought something interesting up in the JavaOp section:
Quote from: Joe
Because all the packet plugins are loaded by the core, not by the Battle.net plugin, so they'd be getting the raw socket data instead of packets. The only issue with that is that Battle.net is known to send packets in pieces or several packets in one clump, so there'd have to be a non-protocol-agnostic packet thread to pick these apart for parsing, not to mention it's not a good idea to trust TCP connections to have packets split perfectly, even if it's known to in the past.

I am currently working on a program with a (non-bnet) protocol, but have run into this issue. In particular, I have 13000 bytes of data split over a few packets. This is the code I am currently using:
Code: [Select]
public void run() {
while(true) {
try {
Packet buf = new Packet(); //Packet is just a small extension of iago's Buffer class, similar to BNetPacket in some ways.
int size = new Buffer(PacketTools.getInputStreamBytes(in, 4)).removeDword(); //This reads 4 bytes (packet size) into a new Buffer and converts them into an int
buf.addBytes(PacketTools.getInputStreamBytes(in, size)); //Read "size" number of bytes from the InputStream and add them to the buffer
// Do stuff
} catch (Exception e) {
e.printStackTrace();
return;
}
}
}

How can I change this so I can read multiple packets into that single Packet instance (buf)?

Thanks :)

4
General Programming / :<
« on: April 03, 2010, 06:14:19 pm »
:<

5
JavaOp Board / Shaman join throws java.lang.NullPointerException
« on: February 25, 2010, 09:27:46 am »
When a shaman joins the channel, I get this:
Code: [Select]
[TIME] WARNING: Error processing event: java.lang.NullPointerException
and events are no longer received from that shaman! If I make the bot leave the clan channel and come back, it does not see the shaman in the channel.

After throwing in a .prinstackTrace() in BnetEventProcess, and running eclipse debug, I got this:
Code: [Select]
java.lang.NullPointerException
at com.javaop.users.Statstring.getClient(Statstring.java:33)
at com.javaop.SwingGui.JavaOpPanel.userFlags(Unknown Source)
at com.javaop.pluginmanagers.PluginRegistration.userFlags(PluginRegistration.java:538)
at com.javaop.bot.BotCore.userFlags(BotCore.java:487)
at com.javaop.BnetEventProcess.PluginMain.processEvent(PluginMain.java:249)
at com.javaop.BnetEventProcess.PluginMain.access$1(PluginMain.java:220)
at com.javaop.BnetEventProcess.PluginMain$Callback.run(PluginMain.java:208)
at java.util.TimerThread.mainLoop(Timer.java:534)
at java.util.TimerThread.run(Timer.java:484)

This has been a problem for a while, starting around 2.1.1 if I remember right.

EDIT: It looks like "String[] tokens" is not being set by com.javaop.users.Statstring because the statstring passed to the constructor is null.

6
JavaOp Board / StayConnected Problem
« on: February 24, 2010, 09:33:41 pm »
If I try to connect to Battle.Net with a bad password and StayConnected enabled, StayConnected will detect the password failure socket disconnect and repeatedly attempt to reconnect me with the bad password, using up my login attempts and eventually getting the bot a temporary ban. How can this be fixed?

Thanks :)

7
JavaOp Board / Modularization
« on: February 24, 2010, 09:25:43 pm »
I am posting in this thread classes that I think should be moved from the core to plugins so JavaOp is more modular.

I think Battle.net should have its own plugin (named Bnet, possibly making BnetLogin and BnetEventProcess parts of the plugin) to hold the protocol-specific classes. Of course there are plugins that use these classes from the core, but there is nothing wrong with having more than one project on the build path right? :P

com.javaop.util
BnetEvent > Bnet
BnetPacket > Bnet
BnlsPacket > Bnet
Profile > Bnet

com.javaop.users
Statstring > Bnet
War3Statstring > Bnet

com.javaop.constants
PacketConstants > Bnet (This is heavily based on the Bnet protocol :P)

com.javaop.bot
PacketThread > Bnet (This class is horribly dependant on the Bnet protocol and needs to be modularized somehow)

Once those are moved, adding IRC functionality and such will be a breeze ;D

8
JavaOp Board / Plugin Packages
« on: February 17, 2010, 11:07:30 pm »
The Simple Event Processor, Command, and Channel List plugins are useless without the Battle.net Login one, so why have four plugin files instead of one? The 4-file dilemma is what led me to making this suggestion to create a package-type plugin system. The Simple Event Processor and Channel List plugins have no packages and one class! Surely, the overhead that comes with loading them is not worth it.

One jar (Bnet.jar) would contain the src/plugins package:
-src.plugins.Main (this is not a folder, but a class to retrieve a list of plugins, provide access to PublicExposedFunctions, provide activate(), deactivate(), and load(); and provide an interface to extend)
-src.plugins.LoginProcessor (Formerly BNetLogin.jar)
-src.plugins.SimpleEventProcessor
-src.plugins.Commands
-src.plugins.Channel List

Also, parts of the product could still be disabled individually (like Commands).

This will most likely require a massive rewriting of the bot, but it is just an idea anyway... for now :)

Thanks for reading! :)

9
JavaOp Board / CD-Key Exception
« on: February 03, 2010, 10:38:09 pm »
Just updated to 2.1.2 (with the new BNetLogin.jar), tried to connect (W3XP) and got the following error:

Code: [Select]
CRITICAL: [BNET] Caught exception while validating CD-Keys: exceptions.LoginException: CDKey is not 24 characters!

Thanks for the help :)

10
Botdev / [JAVA, W3XP, W3GS] Host Counter Decoding
« on: December 06, 2009, 01:22:29 am »
DotA.For.Rest:
(char[8])3130303030303030 |text formated hexadecimal Hosting Counter (upper case)

After I get those 8 bytes, how would I go about converting them into a host counter/4-length byte array that I can send back to the host (e.g. new byte[] { 1, 0, 0, 0 })?

I have tried converting the byte array to a string, then using String.getBytes with the default, ascii, and utf-8 encodings. None of them work! :(

Thanks :)

11
Botdev / [WAR3, W3XP] Packet before W3GS_REQJOIN
« on: November 30, 2009, 12:10:22 pm »
How do I get battle.net to give me the IP and game port for the host of a specified private game name? I have looked everywhere for the packet and can't find it.

Thanks  :)

12
Botdev / Information on W3GS data
« on: November 29, 2009, 11:46:51 pm »
I am trying to figure out how to decode a buffer. In the thread in the quote below, the posters seem to decode the buffer somehow. How are they decoding the buffer? (which in the first code block seems to be enc1_raw)

Thanks :)

i have some comments on the gameInfo packet.
about the encoded part.
i am very certain, as i stated in the other thread, that the encoded part starts after the 0x00 after the gamename. why?
1) in replays it starts there
2) some values tagged unknown by you do vanish...

example:
Code: [Select]
i let my encoded data start with 01034907... not with 997d01...

static const char enc1_raw[] =
{
0x01,0x03,0x49,0x07,0x01,0x01,0x7d,0x01,
0x99,0x7d,0x01,0xa3,0xdf,0x1d,0x43,0x4d,0x8b,0x61,
0x71,0x73,0x5d,0x29,0x35,0x29,0xcd,0x4d,0x6f,0x73,
0x75,0x55,0x65,0x6d,0xe9,0x71,0x6d,0x65,0x2f,0x77,
0x33,0x6d,0x89,0x01,0x47,0x6f,0x73,0x2f,0x53,0x65,
0x03,0x73,0x75,0x01,0x01
};
if we decode that, we get
Code: [Select]
02 48 06 00 00 7c 00 7c
.  H  .  .  .  |  .  |  
00 a3 df 1c 42 4d 61 70
.  .  .  .  B  M  a  p  
73 5c 28 34 29 4c 6f 73
s  \  (  4  )  L  o  s  
74 54 65 6d 70 6c 65 2e
t  T  e  m  p  l  e  .  
77 33 6d 00 46 6f 72 2e
w  3  m  .  F  o  r  .  
52 65 73 74 00 00
r  e  s  t
...

13
JavaOp Support Archive / Using local hashes
« on: November 29, 2009, 08:58:43 am »
How can I use local hashing? When I try to connect using local hashing, I get this:

Code: [Select]
...
[08:51:19.328] NOTICE: [BNET] Server successfully authenticated -- it's Blizzard's
[08:51:19.547] INFO: [BNET] Client token: ...
[08:51:19.585] INFO: [BNET] Version Hash: ...
[08:51:19.600] INFO: [BNET] Checksum: ...
[08:51:19.601] INFO: [BNET] CDKey owner: ...
[08:51:19.604] NOTICE: [BNET] CDKey and Version check sent.
[08:51:19.625] exceptions.InvalidVersion: [BNET] Invalid game version
[08:51:19.631] Login.getLogin(Login.java:180)
[08:51:19.632] PluginMain.processedPacket(PluginMain.java:328)
[08:51:19.633] pluginmanagers.PluginRegistration.processedIncomingPacket(PluginRegistration.java:722)
[08:51:19.634] bot.PacketThread.run(PacketThread.java:178)

I have the hashes in the .hashes folder and are up to date (from a live client).
The CDKeys are valid.
Using JavaOp 2.1.1.

BNetLogin->game is set to W3XP (which works when I use BNLS servers). If I try to use "Warcraft III: TFT" from the dropdown, I get:
Code: [Select]
[08:56:31.400] NOTICE: Bot 'PrivateBot' has been started.
[08:56:32.243] DEBUG: Entering disconnect()
[08:56:32.245] DEBUG: Entering connect()
[08:56:32.254] ALERT: [BNET] Unable to connect due to exception: exceptions.InvalidVersion: Game not found - warcraft iii: tft

I have googled around and looked in the archive but have found no solutions that don't involve BNLS (which I would like to avoid).

14
JavaOp Support Archive / JavaOP and Java ME
« on: September 14, 2008, 03:23:17 pm »
Is there a way to run JavaOP on a mobile edition of Java such as the Java installed on the Motorola Razr v3?

15
JavaOp Support Archive / Catching Java.net.SocketException Disconnect
« on: August 13, 2008, 04:22:11 pm »
Code: [Select]
[14:19:37.728] java.net.SocketException: Connection reset
[14:19:37.744] java.net.SocketInputStream.read(Unknown Source)
[14:19:37.790] java.net.SocketInputStream.read(Unknown Source)
[14:19:37.790] bot.PacketThread.run(PacketThread.java:139)
[14:19:57.712] WARNING: Keepalive failed to send: java.net.SocketException: Socket closed

I'm trying to make a plugin to reconnect my bot after it is disconnected like it was above. When I create PluginMain, what do I need to implement so I may have a method availiable to catch it. Furthermore, what method is it? :p

Thanks.

Pages: [1] 2 3