Hacking TCPGecko Java Client Implementation

BullyWiiPlaza

Nintendo Hacking <3
OP
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,467
Country
Germany
Hey,

so I was trying to "port" tcpgecko.py to Java but I ran into difficulties. Is somebody able and willing to take a look? It would really help me out if I can get memory reading and editing working. Also since I might decide to implement actual codetypes or create applications that for instance apply a set of codes at the push of a button, such as unlock everything in a Wii U game via memory editing. The reason why I'm doing this in Java is because I'm most familiar with it. Also it helps me understand the internals better.

I posted all the technical details on StackOverflow, so check it out:
http://stackoverflow.com/questions/32591138

@NWPlayer123

Thank you :)
 

NWPlayer123

Well-Known Member
Member
Joined
Feb 17, 2012
Messages
2,642
Trophies
0
Location
The Everfree Forest
XP
6,693
Country
United States
I'm not sure how Java handles sockets but the codehandler also has those 3 options when creating a socket (AF_INET, SOCK_STREAM, and IPPROTO_TCP). What the readmem function's doing is
1) Make sure it's not trying to read a length of 0, since that's useless
2) Checks the range against a range of valid addresses
3) Checks to see if it has the right access so it won't freeze
4) Sends a single byte to tell the codehandler which function to run, which then jumps to it and waits for the data EG what address you want to read from
5) Codehandler's waiting for 8 bytes, address and the end address (why I just do + length). Then, send it so it can fetch the data
6) Depending on what it finds, it's going to send back a single byte telling you the status. If it's 0xBD, then read the size you sent it. Do note that it has a max of 0x400 bytes, so if you want more you'll have to make a loop client side
7) If it's 0xB0, then the codehandler function's done doing stuff and is back in the main loop, so just create a string with 0x00 times how much you read, and return it. If anything else happens then something went really wrong (not that you'll know since it'll probably have froze).
8) Then just return the data it read.

Side note, you'll probably be able to understand it better with my rewritten code. I'll push it into the main repo once I get everything reimplemented, but here's what I have right now. http://pastebin.com/3YYMUzTx
 

BullyWiiPlaza

Nintendo Hacking <3
OP
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,467
Country
Germany
I'm not sure how Java handles sockets but the codehandler also has those 3 options when creating a socket (AF_INET, SOCK_STREAM, and IPPROTO_TCP).
This isn't required, just making a new Socket object should suffice. I managed to connect to the Wii U already so that probably worked.
Code:
Socket clientSocket = new Socket(ipAddress, 7331);

7) If it's 0xB0, then the codehandler function's done doing stuff and is back in the main loop, so just create a string with 0x00 times how much you read, and return it.
Why does it distinguish between having read only zeros and non-zeros? It could also just read the null bytes and return them or not?
https://github.com/wiiudev/pyGecko/blob/master/codehandler/main.c#L120-L152

Side note, you'll probably be able to understand it better with my rewritten code.
Yes, it helps. Since I put some efforts into this myself, I easily understood the theory so I just need to get it put together in Java since it's very different in code. :P

As a side note:
What happens if I screw up the data that is sent? Will it bring the codehandler in a corrupt state? I figured that after connecting my (faulty) application and sending data, it would still allow me to connect with tcpgecko.py but reading the memory gets stuck so maybe that function started to block since it received invalid data or already or something. Tomorrow I will try to complete the Java client then.
 
Last edited by BullyWiiPlaza,

NWPlayer123

Well-Known Member
Member
Joined
Feb 17, 2012
Messages
2,642
Trophies
0
Location
The Everfree Forest
XP
6,693
Country
United States
This isn't required, just making a new Socket object should suffice. I managed to connect to the Wii U already so that probably worked.
Code:
Socket clientSocket = new Socket(ipAddress, 7331);

Why does it distinguish between having read only zeros and non-zeros? It could also just read the null bytes and return them or not?
https://github.com/wiiudev/pyGecko/blob/master/codehandler/main.c#L120-L152


Yes, it helps. Since I put some efforts into this myself, I easily understood the theory so I just need to get it put together in Java since it's very different in code. :P

As a side note:
What happens if I screw up the data that is sent? Will it bring the codehandler in a corrupt state? I figured that after connecting my (faulty) application and sending data, it would still allow me to connect tcpgecko.py but reading the memory gets stuck so maybe that function blocked. Tomorrow I will analyze this further.
Because when you're trying to dump a big block of memory with the dump tab in the dNet client, you want to have to send as little data as possible to make it fast, this way the processor can whiz by and make it without having to receive anything. Even with this, pyGecko is still super slow lmao. Need to like implement a compression algo or something
 

BullyWiiPlaza

Nintendo Hacking <3
OP
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,467
Country
Germany
Because when you're trying to dump a big block of memory with the dump tab in the dNet client, you want to have to send as little data as possible to make it fast, this way the processor can whiz by and make it without having to receive anything. Even with this, pyGecko is still super slow lmao. Need to like implement a compression algo or something
Ah, that's smart. Null bytes are very common. It needs all the tuning it can get so maybe turn off the on-screen current address display on TCP Gecko.NET to make it process faster. The one below in the status bar. The progress bar there should be enough progress symbolization I guess :P
 

BullyWiiPlaza

Nintendo Hacking <3
OP
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,467
Country
Germany
@NWPlayer123
Alright, I got it working. Thanks for your help :)
Code:
Sep 16, 2015 3:49:00 PM JGeckoU connect
INFO: Connecting to IP 192.168.178.35 and port 7331...
Sep 16, 2015 3:49:00 PM JGeckoU pokeMemory
INFO: Sending request to poke memory at address 10000000 with value 13371337...
Sep 16, 2015 3:49:00 PM JGeckoU readMemory
INFO: Sending request to read memory from address 10000000 to 10000004...
Sep 16, 2015 3:49:00 PM JGeckoU readMemory
INFO: Receiving server status...
Sep 16, 2015 3:49:00 PM JGeckoU readMemory
INFO: Receiving read values...
Sep 16, 2015 3:49:00 PM JGeckoU main
INFO: 13371337
Sep 16, 2015 3:49:00 PM JGeckoU endSession
INFO: Ending session...

Process finished with exit code 0
 
Last edited by BullyWiiPlaza,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • S @ salazarcosplay:
    @BigOnYa they ruined the gaming experience for me to be honest
  • S @ salazarcosplay:
    @BigOnYa Im not crazy about getting all of them, i feel like I have something to show for for the time put in
  • S @ salazarcosplay:
    @BigOnYa If you want to do rgh or 360 mod
  • S @ salazarcosplay:
    does it matter if you update your 360 or not before trying is it advisable or not
  • BigOnYa @ BigOnYa:
    Yea I don't pay attention to them really. Or do I try to 100% a game. I just play till story ends/ or I get the girl!
  • K3Nv2 @ K3Nv2:
    Bigonya uses his wiener to mod 360s
    +1
  • Xdqwerty @ Xdqwerty:
    Going to the water park, see ya
  • BigOnYa @ BigOnYa:
    You should update the 360 to newest dash before RGHing it yes. But not a big deal if you don't, you can install new dash/avatar updates after. It's just easier to do it auto online before, instead manual offline after.
  • BigOnYa @ BigOnYa:
    Have fun @Xdqwerty. If you see a chocolate candy bar floating in the water, don't eat it!
  • AncientBoi @ AncientBoi:
    :O:ohnoes: Y didn't U Tell ME that ALSO? @BigOnYa :ohnoes: 🤢🤮
    +1
  • BigOnYa @ BigOnYa:
    Does it taste like... chicken?
    +1
  • S @ salazarcosplay:
    @BigOnYa I wanted to ask you about your experience with seeing south park. Most of the people a bit younger like my younger brother and cousins that are a few younger than me that saw kids found south park funny because of the curse words, kids at school, that seemed like liking the show on a very basic level.

    I could not quite have a in depth discussion of the show.

    How was it for you? As an adult. What did you find the most interesting part about it. Did you relate to the parents of the kids and their situations. Was it satires, the commentary on society. The references on celebrities' and pop culture.
    +1
  • BigOnYa @ BigOnYa:
    I remember seeing the very first episode back in the day, and have watched every episode since. I used to set my VCR to record them even, shows how long ago.
  • BigOnYa @ BigOnYa:
    I just like any comedies really, and cartoons have always been a favorite of mine. Family guy, American Dad, Futurama, Cleveland Show, Simpsons - I like them all.
    +1
  • BigOnYa @ BigOnYa:
    South Park is great cause they always touch on relavent issues going on today, and make something funny out of it.
    +3
  • S @ salazarcosplay:
    @BigOnYa were you always up to date on the current events and issues of the time or were there issues that you first found out thru south park
  • BigOnYa @ BigOnYa:
    Most of the time yea I knew, I watch and read the news regularly, but sometimes the Hollywood BS stuff, like concerning actors slip by me. I don't follow most Hollywood BS (example: the Kardasians)
    +2
  • S @ salazarcosplay:
    @BigOnYa there were relevant issues before south park was made, that's why i think a south park prequel/spinoff would be great. Randy and his friends in their child hood
    +1
  • BigOnYa @ BigOnYa:
    Yea, like them running in high school together, getting into stuff, and how they got hitched and had kids. And how the town of South Park was back then compared to now. That would be cool to see.
  • BakerMan @ BakerMan:
    yeah
  • The Real Jdbye @ The Real Jdbye:
    @salazarcosplay if they made a prequel, it would still be about current issues, cause it doesn't make sense to make it about stuff that happened 30 years ago that nobody cares about anymore
  • The Real Jdbye @ The Real Jdbye:
    it's too late
  • The Real Jdbye @ The Real Jdbye:
    the older south park episodes about particular issues usually age poorly since the topic is no longer relevant
  • The Real Jdbye @ The Real Jdbye:
    an exception is giant douche vs turd sandwich, that's always relevant :P
    +1
    The Real Jdbye @ The Real Jdbye: an exception is giant douche vs turd sandwich, that's always relevant :P +1