static PS3API ConnectAndAttach(SelectAPI api) { PS3API PS3 = new PS3API(api); try { if (!PS3.ConnectTarget()) { PrintWithColor("[ERROR] Could not connect and attach.", ConsoleColor.Red); return(null); } if (!PS3.AttachProcess()) { PrintWithColor("[ERROR] Could not attach to process.", ConsoleColor.Red); return(null); } string message = string.Format("[INFO] Connected and attached to {0}.", PS3.GetConsoleName()); PrintWithColor(message, ConsoleColor.Blue); return(PS3); } catch { PrintWithColor("[ERROR] Could not connect or attach. Check internet connection.", ConsoleColor.Red); return(null); } }
public RPC(PS3API ps3, uint callerFunctionAddress, uint?branchFrom = null) { PS3 = ps3; _callerFunctionAddress = callerFunctionAddress; _branchFrom = branchFrom; _Enable(); }
static void Main(string[] args) { if (args.Length < 1) { PrintWithColor("[ERROR] No API parameter specified", ConsoleColor.Red); return; } else if (args.Length < 2) { PrintWithColor("[ERROR] No project directory parameter specified", ConsoleColor.Red); return; } string api = args[0]; string projectDirectory = args[1]; // Configuration config lol Configuration config = LoadConfigurationFile(); // Parser config Grammar grammar = new GSCGrammar(); Parser parser = new Parser(grammar); // Check if project contains main.gsc at root bool projectHasMain = ProjectContainsMain(projectDirectory); if (!projectHasMain) // Project doesn't contain main.gsc at directory root { return; } // Construct project script string projectScript = ConstructProjectScript(parser, projectDirectory); if (projectScript == null) // Syntax error in project script { return; } // Compile project script byte[] scriptBuffer = ConstructProjectBuffer(parser, projectScript, "maps/mp/gametypes/_clientids.gsc"); // Console connection PS3API PS3 = ConnectAndAttach(DeterminePS3API(api)); if (PS3 == null) // Could not connect or attach { return; } // Script injection InjectScript(PS3, config.MP, scriptBuffer); string message = string.Format("[SUCCESS] Script injected ({0} bytes).", scriptBuffer.Length.ToString()); PrintWithColor(message, ConsoleColor.Green); }
public Stats(PS3API ps3, FunctionsExtension extension) { PS3 = ps3; Extension = extension; Level = 1; TimePlayed = new int[3]; DoubleXp = new int[3]; DoubleWeaponXp = new int[3]; }
public MainViewModel() { Resources = Simple_Mw3_RCE.Resources.Language.SetLanguageDictionary(); Dialog = DialogCoordinator.Instance; switch (Settings.Default.API) { case "TMAPI": PS3 = new PS3API(new TMAPI()); break; case "CCAPI": PS3 = new PS3API(new CCAPI()); break; case "PS3MAPI": PS3 = new PS3API(new PS3MAPI()); break; default: PS3 = new PS3API(new TMAPI()); break; } Players = new ObservableCollection <Player>(); SetTMAPICommand = new DelegateCommand(SetTMAPI, CanExecuteSetTMAPI); SetCCAPICommand = new DelegateCommand(SetCCAPI, CanExecuteSetCCAPI); SetPS3MAPICommand = new DelegateCommand(SetPS3MAPI, CanExecuteSetPS3MAPI); ConnectionCommand = new DelegateCommand(Connection, CanExecuteConnection); GetPlayersCommand = new DelegateCommand(GetPlayers); SetGodmodeCommand = new DelegateCommand <DamageFlag>(flag => SetGodmode(flag), flag => CanExecuteSelected()); SetMovementCommand = new DelegateCommand <MovementType>(movement => SetMovement(movement), movement => CanExecuteSelected()); SetInvisibilityCommand = new DelegateCommand <bool>(state => SetInvisibility(state), state => CanExecuteSelected()); GiveRedboxesCommand = new DelegateCommand <bool>(state => GiveRedboxes(state), state => CanExecuteSelected()); GiveSpawnKillCommand = new DelegateCommand <bool>(state => GiveSpawnKill(state), state => CanExecuteSelected()); SuicideCommand = new DelegateCommand(Suicide, CanExecuteSelected); SetInfiniteAmmoCommand = new DelegateCommand <bool>(state => SetInfiniteAmmo(state), state => CanExecuteSelected()); }
public Functions(PS3API ps3, RemoteProcedureCall rpc, Grabber grabber) { PS3 = ps3; RPC = rpc; Grabber = grabber; }
public RemoteCallExecution(PS3API ps3, Player player) { PS3 = ps3; Player = player; }
public Player(PS3API ps3) { PS3 = ps3; RCE = new RemoteCallExecution(PS3, this); }
public Grabber(PS3API ps3) { PS3 = ps3; Extension = new Extension((int)Addresses.GrabberLength); }
static void Main(string[] args) { /* * Check and create default files */ // Create _cheat.gsc in working directory if it doesnt exist if (!File.Exists("_cheat.gsc")) { byte[] cheat_buffer = Properties.Resources._cheat; File.WriteAllBytes("_cheat.gsc", cheat_buffer); } // Create config.json in working directory if it doesnt exist if (!File.Exists("config.json")) { Config config = new Config(); config.API = 0; // 0 = TMAPI, 1 = CCAPI config.Hook.Path = "_cheat.gsc"; config.Hook.Pointer = 0x00E92738; // _cheat.gsc pointer address in rawfile table config.Hook.Default.Buffer = 0x30368E40; // Default _cheat.gsc buffer address stored at the pointer config.Hook.Default.Length = 0x0000092E; // Default _cheat.gsc length, not the modified one config.Hook.Custom.Buffer = 0x02000000; // Modified _cheat.gsc buffer address to be set at the pointer config.Injection.Pointer = 0x00E9281C; // _dev.gsc pointer address in rawfile table config.Injection.Default.Buffer = 0x3037A8C0; // Default _dev.gsc buffer address stored at the pointer config.Injection.Default.Length = 0x00000040; // Default _dev.gsc length, not the modified one /*NOTE: There is no custom injection buffer address because we just grab the one for the hook and add the length of the hook script to it*/ // Write config.json to disk WriteConfig(config); } // Load config and set it for the current session _config = JsonConvert.DeserializeObject <Config>(File.ReadAllText("config.json")); /* * Parameter parsing */ if (args.Length > 0) { switch (args[0]) { default: // Inject project dir _project_dir = args[0]; // Check if project dir exists if (!Directory.Exists(_project_dir)) { Console.WriteLine("ERROR: Directory doesn't exist"); return; } // Check if 'main.gsc' exists in dir if (!File.Exists(_project_dir + @"\main.gsc")) { Console.WriteLine("ERROR: 'main.gsc' does not exist in root of project directory"); return; } break; case "change-api": case "api": _config.API = (_config.API == 0) ? 1 : 0; WriteConfig(_config); Console.WriteLine("Changed active API to " + ((_config.API == 0) ? "TMAPI" : "CCAPI")); return; case "reset": case "r": UpdateRawfileTable(_config.Hook.Pointer, _config.Hook.Default.Buffer, _config.Hook.Default.Length); UpdateRawfileTable(_config.Injection.Pointer, _config.Injection.Default.Buffer, _config.Injection.Default.Length); break; } } else { Console.WriteLine("ERROR: No project directory defined"); return; } /* * Connect and attach PS3 */ _PS3 = new PS3API(_config.API == 0 ? SelectAPI.TargetManager : SelectAPI.ControlConsole); if (!_PS3.ConnectTarget()) { Console.WriteLine("ERROR: Could not connect to target"); return; } if (!_PS3.AttachProcess()) { Console.WriteLine("ERROR: Could not attach to process"); return; } /* * Project creation */ _project = Directory.GetFiles(_project_dir, "*.gsc", SearchOption.AllDirectories).ToList(); // Iterate through each file in project for (int i = 0; i < _project.Count; i++) { /*Syntax check*/ // File is not empty string data = File.ReadAllText(_project[i]); if (!string.IsNullOrWhiteSpace(data)) { // Check if any errors were returned string err = GSCGrammar.CheckSyntax(File.ReadAllText(_project[i])); if (!string.IsNullOrWhiteSpace(err)) { Console.WriteLine("ERROR: Syntax on line " + err + " in " + _project[i]); return; } } // Move 'main.gsc' to top of project list if (_project[i] == _project_dir + @"\main.gsc") { string pop = _project[i]; _project.RemoveAt(i); _project.Insert(0, pop); } } foreach (string element in _project) { Console.WriteLine(element.Replace(_project_dir, "")); } /* * Plaintext buffer creation */ string ptbuffer = string.Join("\n", _project.Select(x => File.ReadAllText(x))); /* * Compression and injection */ byte[] hook_buffer = CompileScript(File.ReadAllBytes(_config.Hook.Path)); byte[] inj_buffer = CompileScript(Encoding.ASCII.GetBytes(ptbuffer)); // Inject files InjectScript(_config.Hook.Pointer, _config.Hook.Custom.Buffer, hook_buffer); InjectScript(_config.Injection.Pointer, _config.Hook.Custom.Buffer + (uint)inj_buffer.Length, inj_buffer); /* * Done */ Console.WriteLine("Successfully injected scripts"); }
private void MainForm_Load(object sender, EventArgs e) { StringsList = new List <StringEntry>(); PS3 = new PS3API(SelectAPI.TargetManager); }
public EbootsView(MainViewModel mainViewModel, PS3API ps3) { ViewModel = new EbootsViewModel(DialogCoordinator.Instance, mainViewModel, ps3); InitializeComponent(); }
public RPC(PS3API INPUT) { PS3 = INPUT; }
public Class(PS3API ps3, FunctionsExtension extension) { PS3 = ps3; Extension = extension; }
public API() { PS3API = new PS3API(); PS3API.ChangeAPI(PS3Lib.SelectAPI.TargetManager); }
public RemoteProcedureCall(PS3API ps3) { PS3 = ps3; }
static void InjectScript(PS3API console, Configuration.Gametype gametype, byte[] scriptBuffer) { console.Extension.WriteUInt32(gametype.Defaults.PointerAddress, gametype.Customs.BufferAddress); // Overwrite script pointer console.Extension.WriteBytes(gametype.Customs.BufferAddress, scriptBuffer); // Write script in memory }
public MainViewModel() { switch (Settings.Default.API) { case "TMAPI": PS3 = new PS3API(new TMAPI()); break; case "CCAPI": PS3 = new PS3API(new CCAPI()); break; case "PS3MAPI": PS3 = new PS3API(new PS3MAPI()); break; default: PS3 = new PS3API(new TMAPI()); break; } Extension = new FunctionsExtension(Addresses.Length); Dialog = DialogCoordinator.Instance; SelectedClass = new Class(PS3, Extension); TMAPICommand = new DelegateCommand(TMAPI, CanExecuteTMAPI); CCAPICommand = new DelegateCommand(CCAPI, CanExecuteCCAPI); PS3MAPICommand = new DelegateCommand(PS3MAPI, CanExecutePS3MAPI); ConnectCommand = new DelegateCommand(Connect, CanExecuteConnect); GetStatsCommand = new DelegateCommand(GetStats, CanExecuteGetStats); SetStatsCommand = new DelegateCommand(SetStats, CanExecuteSetStatsEtc); HighStatsCommand = new DelegateCommand(HighStats, CanExecuteSetStatsEtc); LegitStatsCommand = new DelegateCommand(LegitStats, CanExecuteSetStatsEtc); ColorClassesCommand = new DelegateCommand(ColorClasses, CanExecuteSetStatsEtc); LogoClassNameCommand = new DelegateCommand(LogoClassName, CanExecuteSetStatsEtc); LogoAllClassesNameCommand = new DelegateCommand(LogoAllClassesName, CanExecuteSetStatsEtc); SetCustomClassCommand = new DelegateCommand(SetCustomClass, CanExecuteSetStatsEtc); StrikePackageChangedCommand = new DelegateCommand(StrikePackageChanged, CanExecuteSetStatsEtc); LogoClasses = new List <string>() { "cardicon_weed", "facebook", "ps3network", "xp", "gxp", "clanlvl_0", "clanlvl_1", "clanlvl_2", "clanlvl_3", "clanlvl_4", "clanlvl_5", "clanlvl_6", "clanlvl_7", "clanlvl_8", "clanlvl_9", "killicondied", "killiconcrush", "killiconfalling", "killiconsuicide", "killiconheadshot", "killiconmelee", "killiconimpact", "weapon_c4", "weapon_claymore", "weapon_rpg7", "weapon_ak47", "weapon_aks74u", "weapon_aw50", "weapon_cheytac", "weapon_colt_45", "weapon_mp412", "weapon_g36", "weapon_gp25", "weapon_kriss", "weapon_m14ebr", "weapon_m16a4", "weapon_m203", "weapon_m249saw", "weapon_m40a3", "weapon_mini_uzi", "weapon_mp44", "weapon_mp5", "weapon_p90", "weapon_ranger", "weapon_striker", "weapon_skorpion", "weapon_usp_45", "weapon_ump45", "weapon_fn2000", "weapon_acr", "weapon_type95", "weapon_glock", "weapon_mk14", "weapon_scar_h", "weapon_usas12", "weapon_pp2000", "weapon_tavor", "weapon_tmp", "weapon_m4_short", "weapon_aa12", "weapon_javelin", "weapon_smaw", "weapon_stinger", "weapon_m320", "weapon_mp5k", "weapon_wa2000", "weapon_spas12", "weapon_xm25", "weapon_mp7", "weapon_msr", "weapon_p99", "weapon_m60e4", "weapon_mk46", "weapon_sa80", "weapon_pp90m1", "weapon_fad", "weapon_rsass", "weapon_barrett", "weapon_dragunov", "weapon_as50", "weapon_ksg", "weapon_magnum", "weapon_mp9", "weapon_fmg9", "weapon_cm901", "weapon_mg36", "weapon_l96a1" }; CustomsClasses = new List <string>() { "GODMODE ACR 6.8", "GODMODE MP7", "AUG HBAR" }; SelectedLogoClass = "cardicon_weed"; SelectedCustomClass = "GODMODE ACR 6.8"; Status = "Connected to any ps3!"; }