Skip to content

Commit

Permalink
Fixed GTS Features + Bug Fixes
Browse files Browse the repository at this point in the history
Changed the DNS server to use pkmnclassic.net's DNS server. This allows for the NDS to be able to once again connect to GTS communication.

Also fixed a handfull of broken features in the sendpkm.py file that either read the input path wrong, or simply had a typo and read the wrong variable.
  • Loading branch information
MoonlitJolteon committed Nov 17, 2019
1 parent dd86d43 commit 8161e91
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 103 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ This is a resurrection/modification of the Infinite Recursion GTS project (link:

> "IR-GTS is a Python script that allows users to send and receive individual Pokemon from retail NDS carts using the GTS feature added in Generation IV."
## Server functions not available
## Server functions have been restored

Since Nintendo's shutdown of all old Pokemon games' servers, including the GTS, none of the GTS-specific functions for this project will work. Analysis features should still work fine. A workaround for the server shutdown is being looked into. Until then, all new commits will be marked as unstable, with new experimental features being added that might not work. **You have been warned.**
GTS functions have been fixed to work post Nintendo server shutdown by using 3rd party GTS servers, allowing it to work for the forseeable future.
216 changes: 133 additions & 83 deletions ir-gts-bw-new.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,91 @@
# Recursion and LordLandon, with some code borrowed from Pokecheck.org.
#
# - chickenmatt5
#
# Changes:
# - Fixed online mode to work post Nintendo server shutdown. (Using pkmnclassic.net DNS server)
# - Fixed queue based PKM sending.
# - Made the menu clear the screen after selecting an option for easier readability
# - Removed all references to Pokecheck.org, that site redirects to a scam/ad site now.
#
# ~ ThyImortalGamer

from src import gtsvar
from src.pokehaxlib import initServ
from src.getpkm import getpkm
from src.sendpkm import sendpkm, multisend, queuesend, customqueuesend
from src.stats import statana
from src.gbatonds import threetofour
#from src.pokecheck import *
from src.util import clear, cleanexit
from platform import system
from sys import argv, exit
from time import sleep
import os

s = system()
if s == 'Darwin' or s == 'Linux':
if os.getuid() != 0:
print 'Program must be run as superuser. Enter your password below' + \
' if prompted.'
os.system('sudo ' + argv[0] + ' root')
exit(0)
def offlinemenu():
while True:
print '\nChoose:'
print 'a - analyze pkm file'
print 'o - continue to online mode'
print 'c - convert .pkm files to newer gens'
print 'q - quit\n'
print '\nPlease type your option, and press Enter\n'
choice = raw_input().strip().lower()

if choice.startswith('a'):
clear()
statana()
elif choice.startswith('o'):
clear()
print '\nContinuing to online menu...\n\n'
break
elif choice.startswith('c'):
threetofour()
elif choice.startswith('q'):
clear()
print 'Quitting program'
cleanexit()
else:
print 'Invalid option, please try again.'
continue
clear()
print 'Returning to menu...\n'

print "\n",gtsvar.version,"\n"
if gtsvar.stable == 'no':
print "==============================================="
print "EXPERIMENTAL/UNSTABLE VERSION! MIGHT HAVE BUGS!"
print "===============================================\n"
def onlinemenu():
while True:
print '\nChoose an option:'
print 's - send pkm file to game'
print 'r - receive Pokemon from game'
print 'm - receive multiple Pokemon from game'
print 'a - analyze pkm file'
print 'q - quit\n'
print '\nPlease type your option, and press Enter\n'
option = raw_input().strip().lower()

if option.startswith('s'):
clear()
sendmenu()
elif option.startswith('r'):
clear()
getpkm()
elif option.startswith('m'):
clear()
print 'Press ctrl + c to return to main menu'
while True:
try: getpkm()
except KeyboardInterrupt: break
elif option.startswith('a'):
clear()
statana()
elif option.startswith('q'):
clear()
print 'Quitting program'
cleanexit()
else:
print 'Invalid option, try again'
continue
clear()
print 'Returning to main menu...'

def convertmenu():
while True:
Expand All @@ -49,100 +108,91 @@ def convertmenu():
print 'q - quit'
number = raw_input().strip().lower()

if number.startswith('1'): threetofour()
elif number.startswith('2'): threetofive()
elif number.startswith('3'): fourtofive()
elif number.startswith('r'): break
if number.startswith('1'):
clear()
threetofour()
elif number.startswith('2'):
clear()
threetofive()
elif number.startswith('3'):
clear()
fourtofive()
elif number.startswith('r'):
clear()
break
elif number.startswith('q'):
clear()
print 'Quitting program'
exit()
cleanexit()
else:
print 'Invalid option, try again'
continue

clear()
print 'Returning to conversion menu...'

while True:
print '\nChoose:'
print 'a - analyze pkm file'
print 'o - continue to online mode'
print 'c - convert .pkm files to newer gens'
print 'q - quit\n'
print '\nPlease type your option, and press Enter\n'
choice = raw_input().strip().lower()

if choice.startswith('a'): statana()
elif choice.startswith('o'):
print '\nContinuing to online menu...\n\n'
break
elif choice.startswith('c'): threetofour()
elif choice.startswith('q'):
print 'Quitting program'
exit()
else:
print 'Invalid option, please try again.'
continue

print 'Returning to menu...\n'

initServ()
sleep(1)

def sendmenu():
while True:
print '\nChoose an option to send Pokemon:'
print 'o - send one Pokemon to game'
print 'm - choose & send multiple Pokemon to game'
print 'f - send all Pokemon in queue folder'
print 'c - choose folder full of Pokemon to send'
#print 'd - download and send a pkm from Pokecheck.org to game'
print 'r - return to main menu'
print 'q - quit\n'
print '\nPlease type your option, and press Enter\n'
soption = raw_input().strip().lower()

if soption.startswith('o'): sendpkm()
elif soption.startswith('m'):multisend()
elif soption.startswith('f'): queuesend()
elif soption.startswith('c'): customqueuesend()
#elif soption.startswith('d'): pcdownload()
elif soption.startswith('r'): break
if soption.startswith('o'):
clear()
sendpkm()
elif soption.startswith('m'):
clear()
multisend()
elif soption.startswith('f'):
clear()
queuesend()
elif soption.startswith('c'):
clear()
customqueuesend()
elif soption.startswith('r'):
clear()
break
elif soption.startswith('q'):
print 'Quitting program'
exit()
cleanexit()
else:
print 'Invalid option, try again'
continue

clear()
print 'Returning to send menu...'


done = False
while True:
print '\nChoose an option:'
print 's - send pkm file to game'
print 'r - receive Pokemon from game'
print 'm - receive multiple Pokemon from game'
print 'a - analyze pkm file'
#print 'p - search Pokecheck.org for pkm file'
print 'q - quit\n'
print '\nPlease type your option, and press Enter\n'
option = raw_input().strip().lower()

if option.startswith('s'): sendmenu()
elif option.startswith('r'): getpkm()
elif option.startswith('m'):
print 'Press ctrl + c to return to main menu'
while True:
try: getpkm()
except KeyboardInterrupt: break
elif option.startswith('a'): statana()
#elif option.startswith('p'): pcsearch()
elif option.startswith('q'):
print 'Quitting program'
exit()
else:
print 'Invalid option, try again'
continue

print 'Returning to main menu...'
def main():
s = system()
if s == 'Darwin' or s == 'Linux':
if os.getuid() != 0:
print 'Program must be run as superuser. Enter your password below' + \
' if prompted.'
os.system('sudo ' + argv[0] + ' root')
exit(0)

print "\n",gtsvar.version,"\n"
if gtsvar.stable == 'no':
print "==============================================="
print "EXPERIMENTAL/UNSTABLE VERSION! MIGHT HAVE BUGS!"
print "===============================================\n"

offlinemenu()

initServ()
sleep(1)

done = False
onlinemenu()

if __name__ == "__main__":
try:
clear()
main()
except KeyboardInterrupt:
cleanexit()
5 changes: 2 additions & 3 deletions src/pokehaxlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def getpkm(self):
return all

def dnsspoof():
s=socket.socket(); s.connect(("4.2.2.2",53));
s=socket.socket(); s.connect(("178.62.43.212", 53));
me="".join(chr(int(x)) for x in s.getsockname()[0].split("."))
print "Please set your DS's DNS server to",s.getsockname()[0]
dnsserv=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Expand All @@ -76,7 +76,7 @@ def dnsspoof():
while True:
r=dnsserv.recvfrom(512)
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('4.2.2.2', 53))
s.connect(('178.62.43.212', 53))
s.send(r[0])
rr=s.recv(512)
if "gamestats2" in rr: rr=rr[:-4]+me
Expand All @@ -90,7 +90,6 @@ def initServ(logfile=None):
serv=socket.socket()
serv.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
serv.bind(("0.0.0.0",80))
# serv.bind(("0.0.0.0",9999))
serv.listen(5)

if logfile: log=open(logfile, 'w')
Expand Down
Loading

0 comments on commit 8161e91

Please sign in to comment.