Hacking [Source] Cheat menu plugin demo for NTR CFW

Agent Moose

Well-Known Member
Member
Joined
Dec 6, 2014
Messages
407
Trophies
0
Age
33
XP
552
Country
United States
So I'm trying to port the .bat file over to be able to run on OSX (I'm a mac user) and I can't figure it out one bit.

To me it seems as if you could essentialy run everything from the python script, but I have no clue how to make it work. No matter what I do, I always get this error:
Code:
Whale:~ AgentMoose$ python /Users/AgentMoose/Downloads/menuCheat/build.py
rm: obj/*.o: No such file or directory
rm: bin/*.elf: No such file or directory
sh: arm-none-eabi-gcc: command not found
sh: arm-none-eabi-gcc: command not found
sh: arm-none-eabi-ld: command not found
cp: directory obj does not exist
cp: a.out: No such file or directory
sh: arm-none-eabi-objcopy: command not found
rm: *.o: No such file or directory
rm: *.out: No such file or directory
sh: copy: command not found
Whale:~ AgentMoose$

clearly the directory can't be found, but I've got it located on my hard drive for a fact. (I used to do 3DS homebrew back when it was just Ninjhax.)

Here's the python code I am using:
Code:
#!/usr/bin/python
import sys
import os
import ftplib
import glob

# the path plugin was copied to
COPYTOPATH = 'cheat.plg'

CC = "arm-none-eabi-gcc"
CP = "arm-none-eabi-g++"
OC = "arm-none-eabi-objcopy"
LD = "arm-none-eabi-ld"
CTRULIB = '~/3DS/devkitPro/devkitARM/libctru'
DEVKITARM = '~/3DS/devkitPro/devkitARM'
LIBPATH = '-L ~/3DS/devkitPro/devkitARM/lib'


def allFile(pattern):
  s = "";
  for file in glob.glob(pattern):
  s += file + " ";
  return s;

def run(cmd):
   #print(cmd);
   os.system(cmd)

cwd = os.getcwd()
run("rm obj/*.o")
run("rm bin/*.elf")
run(CC+  " -Os -s  -g -I include -I include/libntrplg " + allFile('source/libntrplg/*.c') + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/libctru/*.c') + " -c  -march=armv6 -mlittle-endian  ");
run(CC+"  -Os " + allFile('source/libntrplg/*.s') +  allFile('source/ns/*.s')  + allFile('source/*.s') + allFile('source/libctru/*.s') + " -c -s -march=armv6 -mlittle-endian ");

run(LD + ' ' + LIBPATH + " -pie --print-gc-sections  -T 3ds.ld -Map=homebrew.map " + allFile("*.o") + " " + allFile("lib/*.o") + " -lc -lgcc --nostdlib"  )
run("cp -r *.o obj/ ")
run("cp a.out bin/homebrew.elf ")
run(OC+" -O binary a.out payload.bin -S")
run("rm *.o")
run("rm *.out")
run('copy payload.bin ' + COPYTOPATH);
 

Nanquitas

Well-Known Member
Member
Joined
Sep 29, 2015
Messages
2,345
Trophies
0
Age
30
Location
South of France :)
XP
3,336
Country
France
So I'm trying to port the .bat file over to be able to run on OSX (I'm a mac user) and I can't figure it out one bit.

To me it seems as if you could essentialy run everything from the python script, but I have no clue how to make it work. No matter what I do, I always get this error:
Code:
Whale:~ AgentMoose$ python /Users/AgentMoose/Downloads/menuCheat/build.py
rm: obj/*.o: No such file or directory
rm: bin/*.elf: No such file or directory
sh: arm-none-eabi-gcc: command not found
sh: arm-none-eabi-gcc: command not found
sh: arm-none-eabi-ld: command not found
cp: directory obj does not exist
cp: a.out: No such file or directory
sh: arm-none-eabi-objcopy: command not found
rm: *.o: No such file or directory
rm: *.out: No such file or directory
sh: copy: command not found
Whale:~ AgentMoose$

clearly the directory can't be found, but I've got it located on my hard drive for a fact. (I used to do 3DS homebrew back when it was just Ninjhax.)

Here's the python code I am using:
Code:
#!/usr/bin/python
import sys
import os
import ftplib
import glob

# the path plugin was copied to
COPYTOPATH = 'cheat.plg'

CC = "arm-none-eabi-gcc"
CP = "arm-none-eabi-g++"
OC = "arm-none-eabi-objcopy"
LD = "arm-none-eabi-ld"
CTRULIB = '~/3DS/devkitPro/devkitARM/libctru'
DEVKITARM = '~/3DS/devkitPro/devkitARM'
LIBPATH = '-L ~/3DS/devkitPro/devkitARM/lib'


def allFile(pattern):
  s = "";
  for file in glob.glob(pattern):
  s += file + " ";
  return s;

def run(cmd):
   #print(cmd);
   os.system(cmd)

cwd = os.getcwd()
run("rm obj/*.o")
run("rm bin/*.elf")
run(CC+  " -Os -s  -g -I include -I include/libntrplg " + allFile('source/libntrplg/*.c') + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/libctru/*.c') + " -c  -march=armv6 -mlittle-endian  ");
run(CC+"  -Os " + allFile('source/libntrplg/*.s') +  allFile('source/ns/*.s')  + allFile('source/*.s') + allFile('source/libctru/*.s') + " -c -s -march=armv6 -mlittle-endian ");

run(LD + ' ' + LIBPATH + " -pie --print-gc-sections  -T 3ds.ld -Map=homebrew.map " + allFile("*.o") + " " + allFile("lib/*.o") + " -lc -lgcc --nostdlib"  )
run("cp -r *.o obj/ ")
run("cp a.out bin/homebrew.elf ")
run(OC+" -O binary a.out payload.bin -S")
run("rm *.o")
run("rm *.out")
run('copy payload.bin ' + COPYTOPATH);
You need to add the path of the devkitpro in the environment variable of the shell you're using to launch the script.
Look for the EXPORT command. ;)

gameshark code
I didn't create this code, so I can't tell you how he did find it. But I think with IDA Pro. ;)
 

Agent Moose

Well-Known Member
Member
Joined
Dec 6, 2014
Messages
407
Trophies
0
Age
33
XP
552
Country
United States
I am terrible at thissssss >.<

So Now I get this error:
Code:
Whale:menuCheat AgentMoose$ bash build.sh
build.sh: line 1: /Users/AgentMoose/3DS/devkitPro/devkitARM/bin: is a directory
: command not found
  File "build.py", line 22
  s += file + " ";
  ^
IndentationError: expected an indented block

that's after I redirect to the folder "menuCheat", then run "bash build.sh" in the terminal. I guess the good news is that it's reading the build.py?

Here's what the other files look like:
Build.sh:
Code:
export PATH="~/3DS/devkitPro/devkitARM/bin/:$PATH"
python build.py

build.py:
Code:
#!/usr/bin/python
import sys
import os
import ftplib
import glob

# the path plugin was copied to
COPYTOPATH = 'cheat.plg'

CC = "arm-none-eabi-gcc"
CP = "arm-none-eabi-g++"
OC = "arm-none-eabi-objcopy"
LD = "arm-none-eabi-ld"
CTRULIB = '~/3DS/devkitPro/devkitARM/libctru'
DEVKITARM = '~/3DS/devkitPro/devkitARM'
LIBPATH = '-L ~/3DS/devkitPro/devkitARM/lib'


def allFile(pattern):
  s = "";
  for file in glob.glob(pattern):
  s += file + " ";
  return s;

def run(cmd):
  #print(cmd);
  os.system(cmd)

cwd = os.getcwd()
run("rm obj/*.o")
run("rm bin/*.elf")
run(CC+  " -Os -s  -g -I include -I include/libntrplg " + allFile('source/libntrplg/*.c') + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/libctru/*.c') + " -c  -march=armv6 -mlittle-endian  ");
run(CC+"  -Os " + allFile('source/libntrplg/*.s') +  allFile('source/ns/*.s')  + allFile('source/*.s') + allFile('source/libctru/*.s') + " -c -s -march=armv6 -mlittle-endian ");

run(LD + ' ' + LIBPATH + " -pie --print-gc-sections  -T 3ds.ld -Map=homebrew.map " + allFile("*.o") + " " + allFile("lib/*.o") + " -lc -lgcc --nostdlib"  )
run("cp -r *.o obj/ ")
run("cp a.out bin/homebrew.elf ")
run(OC+" -O binary a.out payload.bin -S")
run("rm *.o")
run("rm *.out")
run('copy payload.bin ' + COPYTOPATH);
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: Sup