mm201 / pkmn-classic-framework

Pokémon application logic for Generation IV and V, including servers
http://pkmnclassic.net/
Other
219 stars 43 forks source link

Notifications for when a trade is completed #34

Open mm201 opened 7 years ago

mm201 commented 7 years ago

Somebody wanted to bring back the Wii Mail-based notifications. I myself would like to do notifications via email or maybe Web Push. Discuss.

celorodovalho commented 7 years ago

What about a Telegram group? Or Telegram bot?

Anyway, I think Web Push is the better choice.

Hmmm. The server 104.131.93.87 is offline since 7th December. Do you see that?

ghost commented 7 years ago

Perhaps we could do it via multiple ways? Web Push/email could be used in people's own apps (someone may make an app or similar for it), however I personally feel as though the Wii Mail notifications would make sense to add at least as they were in the original GTS.

ghost commented 7 years ago

I know GameStats is told the Wii FC to add; do you have packet dumps of it's response so that could be coded? I can tell you what to send us (we could be told via HTTP) - we'd only need to know the FC to send, as long as you know who the PID and FC is on your end. In the future, we'll be supporting direct emails from your end, but for now we could craft a script that makes the mail and injects it into our database. Email me at GITHUBUSERNAME (at) OUTLOOK (dot) COM if you wish for more info c:

mm201 commented 7 years ago

I never did any Wii packet captures. Sorry. If you can show me the request being made against a dummy server, I can probably piece some of it together. Many of the gamestats APIs dole out completely blank responses.

ghost commented 7 years ago

It wasnt a Wii thing; the DS sent the Wii FC to register. I can do a DS packet dump of registering the Wii; I know your gamestats server sends the wrong thing back :P

ghost commented 7 years ago

I just did a quick packet dump: "There was a communication error." on below packets. EDIT: It seems to get something from 104.103.144.164 over HTTPS (a104-103-144-164.deploy.static.akamaitechnologies.com), though that could just be my 3DS itself

    Host: gamestats2.gs.nintendowifi.net
    User-Agent: GameSpyHTTP/1.0
    Connection: close

16:10:54.163  Q<1   185.82.21.64:80 -> 192.168.1.75:3305, client -1
          6 (0x6) data bytes in 1 record [TCP=ACK]
   -1.RELX.TACK,  6 (  6/dec) bytes, offset 0x00
       0:  0000 0000 0000                            :......:

16:10:56.635  O<5   104.103.144.164:443 -> 192.168.1.75:54795, client -1
         53 (0x35) data bytes in 1 record [TCP=ACK,PSH,FIN]
   -1.RELX.TCP , 35 ( 53/dec) bytes, offset 0x00
       0:  1503 0200 309c 681b  6550 4777 b1a8 3e2c  :....0.h.ePGw±¨>,:
      10:  764a 0b14 c197 fb42  f5ee 12c9 7bdc 1629  :vJ..Á.ûBõî.É{Ü.):
      20:  ea00 930a b3ac 35f3  fa44 c1cf 520f 0129  :ê...³¬5óúDÁÏR..):
      30:  cda4 0a01 b8                              :ͤ..¸:

16:11:08.089  Q<1   185.82.21.64:80 -> 192.168.1.75:3305, client -1
        344 (0x158) data bytes in 1 record [TCP=ACK,PSH]
   -1.RELX.HRS1, 158 (344/dec) bytes, offset 0x00
    HTTP/1.1 200 OK
    Date: Fri, 16 Dec 2016 12:22:14 GMT
    Server: Microsoft-IIS/8.5
    Cache-Control: private
    Content-Length: 32
    Content-Type: text/html; charset=utf-8
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Set-Cookie: ASP.NET_SessionId=toxfr4stvkolli4etraysp03; path=/; HttpOnly
    Connection: close
    TPjc2ZHsvh7WUJIMNotmy6Fetq6P9jWY

16:11:08.089  Q<1   185.82.21.64:80 -> 192.168.1.75:3305, client -1
          6 (0x6) data bytes in 1 record [TCP=ACK,FIN]
   -1.RELX.TFIN,  6 (  6/dec) bytes, offset 0x00
       0:  0000 0000 0000                            :......:

16:11:08.096   Q>1  192.168.1.75:3305 -> 185.82.21.64:80, client -1
          0 (0x0) data bytes in 1 record [TCP=ACK]
   -1.RELX.TACK,  0 (  0/dec) bytes, offset 0x00

16:11:08.098   Q>1  192.168.1.75:3305 -> 185.82.21.64:80, client -1
          0 (0x0) data bytes in 1 record [TCP=ACK,FIN]
   -1.RELX.TFIN,  0 (  0/dec) bytes, offset 0x00

16:11:08.109   Q>1  192.168.1.75:3305 -> 185.82.21.64:80, client -1
          0 (0x0) data bytes in 1 record [TCP=ACK]
   -1.RELX.TACK,  0 (  0/dec) bytes, offset 0x00

16:11:08.112   Q>1  192.168.1.75:3305 -> 185.82.21.64:80, client -1
          0 (0x0) data bytes in 1 record [TCP=ACK]
   -1.RELX.TACK,  0 (  0/dec) bytes, offset 0x00

16:11:08.126  Q<1   185.82.21.64:80 -> 192.168.1.75:3305, client -1
          6 (0x6) data bytes in 1 record [TCP=ACK]
   -1.RELX.TACK,  6 (  6/dec) bytes, offset 0x00
       0:  0000 0000 0000                            :......:

16:11:08.176   R>g  192.168.1.75:3306 -> 185.82.21.64:53, client -1
         48 (0x30) data bytes in 1 record, [CSUM:ok,6151,6151]
   -1.RELX.DNS , 30 ( 48/dec) bytes, offset 0x00
      DNS query #12037: gamestats2.gs.nintendowifi.net.

16:11:08.209  R<g   185.82.21.64:53 -> 192.168.1.75:3306, client -1
         64 (0x40) data bytes in 1 record, [CSUM:ok,4e0a,4e0a]
   -1.RELX.DNS , 40 ( 64/dec) bytes, offset 0x00
      DNS reply #12037: gamestats2.gs.nintendowifi.net. => 185.82.21.64 [TTL=0]

16:11:08.216   S>1  192.168.1.75:3307 -> 185.82.21.64:80, client -1
          0 (0x0) data bytes in 1 record [TCP=SYN]
   -1.RELX.TSYN,  0 (  0/dec) bytes, offset 0x00

16:11:08.256  S<1   185.82.21.64:80 -> 192.168.1.75:3307, client -1
          2 (0x2) data bytes in 1 record [TCP=ACK,SYN]
   -1.RELX.TSYN,  2 (  2/dec) bytes, offset 0x00
       0:  0000                                      :..:

16:11:08.259   S>1  192.168.1.75:3307 -> 185.82.21.64:80, client -1
          0 (0x0) data bytes in 1 record [TCP=ACK]
   -1.RELX.TACK,  0 (  0/dec) bytes, offset 0x00

16:11:08.294   S>1  192.168.1.75:3307 -> 185.82.21.64:80, client -1
        347 (0x15b) data bytes in 1 record [TCP=ACK,PSH]
   -1.RELX.HRQ1, 15b (347/dec) bytes, offset 0x00
    GET /pokemondpds/common/setProfile.asp?pid=600175077&hash=d39dfdaeafa3d0977aa0cf29fdbe7128698129c9&data=Sjs4oVQTOBwAPpOFqaiTDk6EkYS-OR34BD2lr56wsgQdFG1lRJHZdv0dNX8KjjWLLez9LIUrQXakqJvFZkRRFiMDAccdNparVK3W53cYgQPSpu5IpDVWRHyFAp2IvLY0HhtefIj_-BqPHDxB HTTP/1.1
    Host: gamestats2.gs.nintendowifi.net
    User-Agent: GameSpyHTTP/1.0
    Connection: close

16:11:08.322  S<1   185.82.21.64:80 -> 192.168.1.75:3307, client -1
          6 (0x6) data bytes in 1 record [TCP=ACK]
   -1.RELX.TACK,  6 (  6/dec) bytes, offset 0x00
       0:  0000 0000 0000                            :......:

16:11:09.043  S<1   185.82.21.64:80 -> 192.168.1.75:3307, client -1
        304 (0x130) data bytes in 1 record [TCP=ACK,PSH]
   -1.RELX.HRS1, 130 (304/dec) bytes, offset 0x00
    HTTP/1.1 200 OK
    Date: Fri, 16 Dec 2016 12:22:14 GMT
    Server: Microsoft-IIS/8.5
    Cache-Control: private
    Content-Length: 8
    Content-Type: text/html
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Set-Cookie: ASP.NET_SessionId=wfj3cmbxs4t4imvjfwuszvik; path=/; HttpOnly
    Connection: close
       0:  0000 0000 0000 0000                       :........:
mm201 commented 7 years ago

The path for the first request seems to be cut off. Is it just info.asp or something else?

ghost commented 7 years ago

Full edit: @mm201 I've sent the dump to you via IRC on Rizon.

dmoeenm commented 7 years ago

I gotta ask is this working or no

ghost commented 7 years ago

No. EDIT for @mm201: RiiConnect24 now has full email support so we can now handle emails c:

dmoeenm commented 7 years ago

Ok well ill be looking forward to the out come of this project

ghost commented 7 years ago

Hey @mm201 was anything implemented for this? :3

mm201 commented 7 years ago

So I don't forget: https://docs.microsoft.com/en-us/azure/app-service-web/sendgrid-dotnet-how-to-send-email

ghost commented 7 years ago

Hilariously, we use SendGrid ourselves for the email sending and receiving - send me an email privately ( pokemonacer - I use Gmail :wink:) for more details

InternalLoss commented 6 years ago

This has been pretty inactive; just to inform you, we found the manuals for pokémon and it seems there is actually a bit more than just a code:

You have to first input a Wii code (it has to be valid, the game does number checks); then, a confirmation code is sent (XXX-YYYY) - the game wants to know YYYY, and then it may want a PIN to "protect" your number so people cant just read it out.

InternalLoss commented 3 years ago

And only 2 years later!

When Wii Number is sent to setProfile (it's sent as a full email since it seems Japanese copies were allowed to use arbitrary emails - International was Wii Number only, probably bc in Japan mobile phones/etc have their own email addresses so it's rather easy to send information to them), the response 00 00 00 00 01 00 00 00 will show the correct "registration succeeded please enter code" message (that byte being 00 causes a communication error, I have a feeling 02 and 03 probably are used for other errors)

The "XXX" mentioned above is generated by DS but doesnt seem to be sent to server, but it doesnt matter as only "YYYY" is validated and that is sent to server; it's likely all 0s for /that/ response but we arent yet ready to test

mm201 commented 1 year ago

Putting this info here, courtesy of Larsen/darkshade, for safekeeping:

I do.. I had to dig though my archives for it.

https://imgur.com/a/o9neAQK

The Message would have to be early 2011, or late 2010.

Hope this helps.

The original notification was very sparse. It only gives the names of the two Pokémon being traded and a number which looks about the right size for a pid. Feature parity should be trivial.