War2.ru Slogan
News: All hail our wise & benevolent admins!

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Welcome to the forums! We're glad to have you here! :) You can register your account here, then feel free to introduce yourself in the Server.War2.ru board & let us know who you are on the server.
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.

Messages - AHB

Pages: [1] 2 3 4
1) Mods & Development / Re: Lat Trick Bot
« on: May 26, 2018, 04:16:12 PM »
Actually wrong, I came up with it on my own while hacking an IP camera and that is how I learned about UDP hole punching and was the inspiration for the program:


but nice try

By the way here was your response saying it is impossible:

"""There are many ways this could be accomplished, but they all involve some reasonably tricky mods and/or additions to the wc2 exe... one day maybe...""""

"one day maybe" well guess that day is today thanks to my dedicated research and terrible programming skills, neat huh?

2) Mods & Development / Re: Lat Trick Bot
« on: May 26, 2018, 11:34:27 AM »
@Lambchops once again you talk way too much and neither of us have time to keep reading your meaningless replies while we are solving hosting

You "knew" the solution 2 years ago yet never programmed it. Why? Because either you dont actually understand the solution or you don;t know how to program. Probably both.

Why dont you quick talking and go set up a pvpgn server, write the proof of concept, and actually do something useful? Oh wait because you cant. You cant even write psuedo code lol that is a joke

If we want to only send packets to people in channels, that is easy to do. I would just add a few lines to make a request to the server status page and parse it out. The only problem with that is that we would have to tie IP addresses to usernames which isnt exactly desirable, so if we can find a way to not do it that way, it would be better. One solution would be to have iL rewrite player_ips.php to only output IP Addresses of players who in a channel, but that would be some work on the backend that I'm not sure he has time for at the moment

But dont worry about it iL and I have it covered

3) Mods & Development / Re: Lat Trick Bot
« on: May 25, 2018, 12:06:08 PM »
The program is already working the way that I described (not knowing the remote port):

This is the code that is sending data to the wrong port for the player, but it should still trick his router to allow that player to join the game :)
 client.sendto("For the Alliance", (target_host, war2_port))

4) Mods & Development / Re: Lat Trick Bot
« on: May 25, 2018, 12:01:21 PM »

I dont think we need to know the remote player's port at all, just send from your own port, then your router will hold open the connection from your local port to the external IP and allow a response back from external IP to  your game port

Say remote host has port 6113, but person hosting the game has port 6112:

Host sends a packet to remote-host:6112 (it doesnt know that remote player port is actually 6113)
Hosts router opens a connection and listens for player to respond on port 6112
Player's router receives the packet, sees that it is for port 6112 and not 6113, so it drops it and ignores it
Player's War2 client knows to join the host's game on his port, 6112, because pvpgn told him that
So Player sends traffic to Host on port 6112
Host's router has a connection open to Player already on port 6112, so it allows the response traffic to come through

Do you see that we dont need to know the remote port? Only use the local game port as both the source and destination

5) Mods & Development / Re: Lat Trick Bot
« on: May 25, 2018, 10:32:09 AM »

shuts down read and write on the socket

6) Mods & Development / Re: Lat Trick Bot
« on: May 25, 2018, 09:08:36 AM »

I updated the code below to shutdown and close the socket each time. From what I read, shutdown will fix that TIME_WAIT issue, releasing it immediately.

I also implemented a basic error check, and will skip to the next player in the list if an error occurs instead of crashing out

Let me know if this works for you. I will test also

import _winreg
import stun
import requests
import socket
import time
import json

def get_war2_port():
    # Open the key and return the handle object
    hKey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Software\Battle.net\Configuration")
    # Read the value
      result = _winreg.QueryValueEx(hKey, "Game Data Port")
    # If not found, set to default
    except Exception as e:
      print e
      result = [6112]
    # Return port
    return result[0]

war2_port = get_war2_port()
nat_type, external_ip, external_port = stun.get_ip_info("", war2_port)
req = requests.get('https://war2.info/nat_stats.php?nat_type=' + str(nat_type))

if nat_type != "Sytmmetric NAT":
  while True:
    req = requests.get('https://war2.info/player_ips.php')
    json_obj = json.loads(req.content)
    player_ip_list = json_obj["player_ips"]
    print player_ip_list
    for player_ip in player_ip_list:
        # Target host is IP of player you want to be able to join your game
        target_host = player_ip

        # create a socket object
        client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        client.bind(('', war2_port))

        # send some data
        client.sendto("For the Alliance", (target_host, war2_port))
        print "Sent data to " + str(player_ip) + " on port " + str(war2_port)
      except Exception as e:
        print e

7) Mods & Development / Re: Lat Trick Bot
« on: May 25, 2018, 08:57:32 AM »

Your definition of how remote port and local port is correct actually, you are right that is how it works.

So we are able to port forward now, but possibly the problem is that Python is intercepting packets destined for War2 causing the game to disconnect. I will have to think about this...

My first idea is to try changing the "binding" IP address. means to listen on all interfaces, but we don't actually want to listen on any interfaces.. not sure what to do. I will keep testing

I can add error checking so that if a socket fails it keeps trying instead of crashing

8) Mods & Development / Re: Lat Trick Bot
« on: May 24, 2018, 07:29:56 PM »

Thanks for checking it out! I know we are close. Just ignore @Lambchops hes a dumbass

I think I see your problem ! I think it is because you are sending traffic to the REMOTE port. The "remote port" variable should actually be your LOCAL port, not remote port.

I know its confusing but there is a reason -- you need to send traffic to the remote host:local port, that way the connection is opened for the remote host to reply on your LOCAL port. They dont need to reply on their own port. Also, the traffic we are sending them we dont care that they dont ever receive it, we are just tricking out own firewall (not theirs) make sense? Try again with that and let me know if it works

Like this

war2_client_port = 6113
# war2_remote_port = 6112 -- this is not needed at all
      client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      client.bind(('', war2_client_port))
      client.sendto("For the Alliance", (target_host, war2_client_port))

9) Mods & Development / Re: Lat Trick Bot
« on: May 23, 2018, 09:44:13 PM »
Nice work tupac

10) Mods & Development / Re: Lat Trick Bot
« on: May 22, 2018, 09:47:25 PM »
dude you need to chill Mr., read a Berk on how the internets work, U cant get sql access when u give someone some code that filteRs sql injection and the db username and password are changed before being uploaded ... oK?

bEsides the nat stats arent even a necessary component of the program so take it or leave it who cares. you already gave access to install war2combat in your pc so you should know we know much more than just your nat type lmao jeez quit trippin. no need for the nasty Gram

11) Mods & Development / Re: Lat Trick Bot
« on: May 21, 2018, 09:15:52 AM »
You do know that the definition of a script kiddie is someone who uses code that other people write, and cant write their own code right?

So by definition I wrote the code, and you know nothing about programming as youve made apparent, so that would make you a script kiddie lol

I know this is really hard for you to understand, but the part of the PHP code where it says "username=username" and "password=password" is intended to be changed by iL to his own credentials which I wont know what they are, so no I dont have SQL access. Sorry no time to keep explaining how these basic things work.

12) Mods & Development / Re: Lat Trick Bot
« on: May 20, 2018, 02:16:01 PM »
Everyone knows me in in real life here, and anyone with a brain can read the code and see there is no backdoor in it...

Keep telling yourself you solved hosting lol congrats to you

13) Mods & Development / Re: Lat Trick Bot
« on: May 19, 2018, 01:09:02 PM »

man you talk tooooo much dude. Its really simple and Ive already explained how it works too many times...

@iL understood exactly what it does, and thats all that matters. If he has any questions I will explain further

Put simply UDP hole punching 6112 to allow player to host games works like this - PlayerA downloads list of IPs of all players on the server and sends UDP traffic on 6112 to each of them. In most types of NAT this will open port 6112 to allow responses back only from those IPs.

You seem to misunderstand that this is not a "concept" anymore, it is a "proof of concept", i have proved that it works. It is not up for debate, I dont need help or advice lol

But youre right, I'm just an idiot.

I don't have any understanding of how it works - TCP/IP,  UDP, programming, databases, MySQL/PHP/Python, types of NAT/difference between them, I'm no expert, I'm just the guy who solved a 20+ year old hosting problem after an entire month of dedicated research, trial and error.

Did you really think we all need you to explain how these things work to us? I enjoy some of your posts, but damn you can ramble.

There are alot of us here who are experts in our fields, - programming, network engineering, server ops, @iL @mousEtopher @tupac @{Lance} to name a few and we dont need you to explain all the mysteries of how computers work to us lmao

We all argue sometimes but try to show some respect for each other and put ego aside to further development here which is just a hobby we all do for fun

I hardly even play War2 anymore, and I know how to port forward, so I really dont care if you guys dont implement this, its just for the good of others and the game as a whole. I plan to help some other PvPGN servers implement it too since it solves hosting for all games not just War2

14) Mods & Development / Re: Lat Trick Bot
« on: May 19, 2018, 10:33:35 AM »
This was just a crazy idea a month ago :D


15) Mods & Development / Re: Lat Trick Bot
« on: May 19, 2018, 10:11:48 AM »
No there is no problem with the Python client, Ive already tested and it works :D :D :D

The only problem is that UDP hole punching doesnt work when behind certain type of NAT, but it is a less common type (we think) so it shouldnt be a problem. But because of that, the Python code checks what type of NAT and doesnt run if it finds that it is a type of NAT that wont work. It also sends simple ping to a PHP script to record what type of NAT so that we can find out if the script is actually helping people or if they are all behind the type of NAT that doesnt work

This program could easily be rewritten in C++, it would just take me a few more hours so I dont feel like it... the "performance boost" isnt worth it when you are talking about a tiny simple program

The Python code already works perfectly... and I even gave all the instructions to compile to exe (its one simple command)

The SQL login needs to be changed by iL to his own username, password, and database, nothing "strange" there. It is simply used to record the stats from the NAT type collector

I wasnt a NAT expert last week but I can honestly say I am basically an expert now. I spent probably a dozen hours reading about the different types of NAT and how they work, so I know exactly why this works for the types of NAT that it does work for, and exactly why it doesnt work for Symmetric NAT type

Pages: [1] 2 3 4