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.


Messages - AHB

Pages: 1 2 [3] 4
31
Mods & Development / Re: Lat Trick Bot
« on: May 15, 2018, 10:13:33 AM »
Hi @iL

A couple things that you said:

1 - Is it a vulnerability to expose IPs?

Well no I dont think it is a problem, you already get everyones IP when you join a game with them, the only difference is now you can get everyones IP without joining a game

2 - Symmetric NAT is rare

I didnt know, I have a pfSense firewall. I will try a new firewall with another type of NAT and see if I can defeat that

3 - Step 5/6 - why do all other players need to respond to UDP?

They don't, I was just imagining a world where no one port forwards anymore and we all host games using the new NAT hosting fix

4 - Will your udp_client.py script work as you said?

No, I dont think so, the problem is that port 6112 isn't going to be opened, 49123 or something like that will be opened publicly and translated to 6112 on the LAN. Your friend will try to join <your-external-ip>:6112 and it will be closed... we have to somehow let PvPGN know to tell other players to join on <your-external-ip>:49123

Possibly this is a Symmetric NAT thing though and maybe your router will rewrite <internal-ip>:6112 -> <external-ip>:6112, in which case I think youd be good


more reading http://www.think-like-a-computer.com/2011/09/16/types-of-nat/

32
Mods & Development / Re: Lat Trick Bot
« on: May 11, 2018, 03:49:13 PM »
Updated Design:

1. Client A wants to host a game but is behind NAT without port forward
2. Client A's War2Combat sends an HTTP GET to war2.ru to grab a list of all player external IPs and ports
3. Client A's War2Combat runs a script to get STUN info -> their nat_type, external_ip, external_port
4. Client A's War2Combat sends an HTTP POST to war.2ru sending its external_ip and external_port and war2.ru server receives this and adds it to the list in #2
5. Client A sends periodic UDP traffic to the ext_ip and ext_port of all other players
6. All other players send periodic traffic to the ext_ip and ext_port of Client A

[ TODO: Somehow client A needs to update PvPGN letting other war2 clients to know to join games using its external port identified in #3, if this occurs in the port setting of war2, my idea is that steps 1-6 take place before even launching war2, then war2 is launched binded to the ext_port discovered?

This is the biggest challenge right now
]

7. Now that Client A has connections opened to all other players, he is able to host and anyone can join



Update .. this STUN idea doesn't work for symetric NAT, which creates a different port mapping for every new connection. Getting a hell of an education on NAT right now, man this is harder than I thought it would be https://networkengineering.stackexchange.com/questions/7781/why-stun-doesnt-work-with-symmetric-nat

33
Mods & Development / Re: Lat Trick Bot
« on: May 11, 2018, 03:43:49 PM »
Here is the code to get NAT info that we need using STUN:

First install pystun with pip install pystun, then:


import stun
interface = "0.0.0.0" # interface to listen on (all)
port = 6112 # port to listen on
nat_type, external_ip, external_port = stun.get_ip_info(interface, port)
print nat_type
print external_ip
print external_port

This will return:
Symmetric NAT
1.1.1.1
30738

34
Mods & Development / Re: Lat Trick Bot
« on: May 11, 2018, 02:33:28 PM »
This is the best summary of the problem that I have found yet http://resources.infosecinstitute.com/udp-hole-punching

35
Mods & Development / Re: Lat Trick Bot
« on: May 11, 2018, 02:20:32 PM »
@iL

So I have setup a test environment to start the proof of concept. The first problems I am seeing:

1. My game host is listening on 6112. However, if I make an outbound connection to player 2, I dont know how to obtain the NAT translated port that was opened for that connection this can be solved using a STUN client and connecting to a free STUN server which will give me my external port and external IP. Here is a python library I am working with for this https://github.com/jtriley/pystun
2. Say that I figure out somehow that the outbound port opened to player 2 is port 49222, now how do I get that response traffic to go back to 6112 ... solve this by binding to port 6112 in the UDP python script


here is simple python code to send from each machine to open that connection between them (if we can figure out the above)

import socket

target_host = "1.1.1.1"
target_port = 6112

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

# send some data
client.sendto("AAABBBCCC",(target_host, target_port))

print "Done!"


36
Mods & Development / Re: Lat Trick Bot
« on: May 11, 2018, 12:55:11 PM »
@Igognito

Your design:
Although it is one solution, the flaw that I see in your design is it requires user interaction each time before hosting a game. How would the server even know who you want to open ports with? You would have /lattrick <username>? And then the host would have to repeat for each player that he wants to be able to join?

My design:
- No user interaction required, no chat bot commands, runs in background and opens connections to every player so that anyone can host

1. Client A wants to host a game, but is behind NAT with no port forward
2. Client A downloads a list of IP addresses and ports of all other players of the server periodically by downloading HTTP JSON response from war2.ru. Keep in mind this is not a "bot" in the sense of a chat bot, it is a program bundled into War2Combat that runs continuously in the background without user interaction or even knowing about it
3. Client A periodically sends UDP traffic to every single one of those IPs/ports from port 6112, however, his NAT router translates 6112 to a high number port like 49123. The first time traffic is sent, it will be ignored, until the otherside initiates a response (since it is doing the same periodic sending of traffic), after that the two will be able to communicate freely
4. All of those clients that Client A is sending periodic traffic to can now respond on port 49123, and join games on that port, however, they need to know that is the port Client A is listening on so they have to get that info from PvPGN, who is already maintaining this information. (We might need to have a way to update PvPGN with this NAT port, which tells the War2 client which port to join a game on, this is the only step I am unsure how to code)

There is no /lattrick command needed, and definitely no point in encrypting anything. Once you are in a game, you know the IPs of all players right now anyways, it is not secret information, the only difference now is that you will know the IPs of people you arent in a game with as well

Since Client A is sending periodic UDP traffic to every single other player on the server, anyone can join his game without having to run a command, send an IP etc

UDP hole punching example in Python:
https://github.com/dwoz/python-nat-hole-punching

2 clients connect to the server, the server tells each client about the other client's IP and port, then the clients talk to each other over the IP/port

37
Mods & Development / Re: Lat Trick Bot
« on: May 10, 2018, 11:28:39 AM »
It fundamentally cant be solved at the PvPGN level, actually there is no need to modify pvpgn at all I think. There needs to be a server which receives the port mappings for each client and distributes them to all other clients, however this would be much easier written in PHP with a JSON HTTP output rather than hacking with C++ TCP connections in PvPGN.

On the client side I would prefer Python to make HTTP posts, but whatever will work, eventually that will be compiled into an exe, and added to the War2Combat startup script to run whenever war2 is launched

Here is another good source:

https://steamcommunity.com/app/427520/discussions/4/371919771755670102/


At this point I understand how NAT hole punching works, I'm just not sure how we will get the other war2 clients know to connect to different high number ports rather than 6112 depending on who is hosting?

Currently we know people can change their War2 port, so I guess I just need to understand how the client knows to connect to a host's custom port rather than the default 6112.

38
Mods & Development / Re: Lat Trick Bot
« on: May 10, 2018, 09:41:04 AM »
A good, simple description of UDP hole punching, I added notes on how we could implement it for war2.ru:


1. User A and User B establish a TCP connection to PvPGN server. Once established, both users send to PvPGN server a port on which they can be contacted. We'll call User A's "Port X" and User B's "Port Y". (this would be a Python program or whatever that gets added to War2Combat and posts public IP and port number to a war2.ru webpage, which collects it and adds to list of user/port combination to dat file)
2. PvPGN server shares the port information of User A with User B, and vice-versa. (iL outputs IP address and port number of all players in JSON format to .dat file, which is then downloaded by Python program embedded in War2Combat)
3. User A sends a UDP packet from Port X to User B on Port Y. User B's firewall will of course reject this packet because it was not expecting it
4. User B sends a UDP packet from Port Y to User A on Port X. User A's firewall will forward this port internally to User A, because User A's firewall just saw a packet leave User A through it out Port X and to User B on Port Y (and because it's UDP, it has no idea that it was rejected), so it assumed that a packet coming from User B on Port Y to User A on Port X is a response packet, so it lets it through.
5. User A sends another UDP packet from Port X to User B on Port Y, and it is also allowed through User B's firewall for the same reason.
6. Users A and B can now send UDP packets back and forth, and Control's participation is no longer needed.

The only thing I dont understand is how would war2 know to connect to a game on port 49000 for example instead of 6112/ is it possible?




Source: https://serverfault.com/questions/425258/does-hole-punching-require-a-udp-rendezvous-server-or-could-it-be-a-tcp-one?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

39
Mods & Development / Re: Lat Trick Bot
« on: May 10, 2018, 09:23:51 AM »
It is not so simple as sending traffic outbound from client A to all other players on 6112 in order to open 6112 to them:

- NAT does not map outbound connection on 6112 to be public-ip:6112, (otherwise only one person would be able to use web, email etc at a time)
- Instead it chooses a high number port like public-ip:49123 to map to private-ip:6112
- In order to join player A's game, player B's war2 client would have to connect to player A:49132 instead of A:6112 (not sure if this will ever be possible because would require a change to the war2 game itself right?)


this is a good resource:
http://www.brynosaurus.com/pub/net/p2pnat/

40
Mods & Development / Re: Lat Trick Bot
« on: May 09, 2018, 10:06:04 PM »
Like @tupac said, good point, might be less work to build VPN as part of the war2 client I bet, that might be another hack around

thanks for the support, I am the longest ban in server history FREE ARCHER 2018 served 3 years for my crimes let me out with community service lol @iL

41
Mods & Development / Re: Lat Trick Bot
« on: May 09, 2018, 06:39:59 PM »
Thanks for your interest @Igognito

I believe port forward free hosting of War2 games is possible as I discussed here http://forum.war2.ru/index.php/topic,4009.0.html

It would not require any modification of PvPGN, it would be an entirely client to client side hack

It is achievable using STUN I believe and has already been implemented in the new Starcraft 2.

I havent spent enough time studying how STUN works to figure it out, but I know it is the key to the puzzle. If someone can put time into this, you can test like this:

1. Study how STUN works
2. Setup a Windows PC behind a public IP and firewall without 6112 forwarded (game host), you'll need to setup VPN or port fwd RDP to get access to Windows
3. Use your Windows PC at secondary public IP and firewall combo without 6112 to try joining the host

From there, on the game host, you would write a program in your language of choice to send some traffic on UDP 6112 over to the person trying to join. From my understanding this would allow them to join your game now, but will probably require further research of how STUN works


After this proof of concept is established and we know it works, here is how we would convert it to production:

1. iL would have to post the IP addresses of every player to the .dat file (currently it doesnt have this). Yeah people might not like that but really who cares, you are giving your IP to everyone when you join a game anyways, the only difference is now you are giving your IP to people you havent joined a game with... this is the only way it is possible to make this trick work

2. The program built for the proof of concept would regularly (every few seconds) check the list of IP addresses of all players, and send traffic to every player UDP 6112 periodically to maintain connections with them.

3. Profit. 23 years of hosting problems fixed forever


(all of the above is basically what iL said, in more words)

I dont know if this is a very scalable solution (lot of traffic as players increase, could overwhelm a consumer router?) but for our small server itd be no problem

I will try to put some time into this. I really think we can do it.

@iL if I solve hosting will you forgive my misdeeds and give me USA-Archer name back lol

42
Lambchops,

Yes I think the game host has to contact the other players first (before they join the game) in order to open that inbound connection. However, the pvpgn server knows the IP of every player already, so what if a script was added to the client where the server sent the game host all IPs of the players, and the client reached out and contacted all the other players periodically to keep ports open to them

Something like that, I'm not really sure how it would work because the ports being opened by the game host to the other players would not be 6112? but if we spend some time learning how this problem has already been solved in other applications like VoIP then we can learn and understand how to hopefully apply it to PvPGN servers

Just look, I think theyve done it with Starcraft Remastered, it is possible I think

43
UPnP is a great addition to WarCombat, but alot of routers these days are blocking UPnP.

The other day I had an epiphany for how it could be possible to host games without any port forwarding at all.

I was trying to hack an IP camera, watching the network traffic of how it communicates with "the cloud" when I realized that the cloud server was able to contact the camera even though I had not forwarded any ports to it.

That is made possible by STUN, and I don't totally understand how we would do it but this could allow people to host games without port forwarding I believe

http://www.ietf.org/rfc/rfc3489.txt

I even found some mention of it here in regard to Starcraft:
https://www.reddit.com/r/starcraft/comments/7l0t5z/starcraft_remastered_future_network_latency/

"Without getting too technical, there are 3 different types of NAT networks, and we've already rolled out a STUN server solution for the first type in patch 1.21 - we're hearing that you've noticed the difference in latency since its release. The second type is more complicated and we're working on it right now. The third type still requires the connection to route via a proxy server."

Another article I came across, this is by a famous hacker who created the Myspace worm (https://en.wikipedia.org/wiki/Samy_(computer_worm)) , one of my favorite hacks of all time lol

http://samy.pl/pwnat/


44
Mods & Development / Re: PvPGN HTML5 Chatroom
« on: August 23, 2017, 02:39:32 PM »
added some updates, its more mobile friendly now:

https://war2.info/chat

Lots of work to do including

unicode support
more coloring of different messages
lots of fixing commands like making '/stats player1' send as '/stats player1 w2bn' etc to get around telnet behaviors and make it more wc2 natural
bug on iphone which puts padding above keyboard when input is focused

if anyone with html/css/javascript skills wants to help out let me know :)
(AKA @mousEtopher !)


45
Mods & Development / PvPGN HTML5 Chatroom
« on: August 03, 2017, 03:44:15 PM »
Hi
I found a way to make an HTML5 PvPGN chatroom login possible using websockets.

I used a library called websockify which runs on your webserver and acts as a proxy between the web user and server.war2.ru:6112, sending and receiving between the HTTP user and TCP socket

 If anyone with some Javascript and CSS skills has some time to contribute to make it prettier I think it would be a nice addition to the server to be able to log in and chat from mobile devices, especially iPhone which doesnt have a PvPGN chat app like Android does.

I have a TODO list on github with features that we can work on if anyone is interested

https://github.com/reillychase/pvpgn_html5_chatroom

example http://war2.info/static/chat.html

You can use my throwaway account to test it -- abcdef // abcdef

Pages: 1 2 [3] 4