Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Javascript] Hacking flashgames from inside a browser.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Webbrowser stuff related tutorials
View previous topic :: View next topic  
Author Message
The Jorg hi
Grandmaster Cheater Supreme
Warning
Reputation: 18

Joined: 24 Dec 2007
Posts: 1858
Location: Minnesota

PostPosted: Mon Nov 02, 2009 6:27 pm    Post subject: [Javascript] Hacking flashgames from inside a browser. This post has 1 review(s) Reply with quote

In order for this tutorial to be knowledgeable to you, you must first understand how to create a normal trainer using the flash.ocx first.

1) Javascript is browser based code, that can be used in a url address bar.

An example is like this...

To Execute that code just navigate to it. IF done correctly you should see this.




2) Understanding Embeds
What Embeds really is, is an object collection of all the embedded objects in the webpage. So to access the first embedded object you use embeds[0], the second embeds[1] so on and so forth.

But sometimes we don't know which embed to use? Thats when this script gets in handy.

Enumerate Embeds:
Code:
javascript:enumerateembeds();

function enumerateembeds()  /*Shows a messagebox with all the embeds*/
{
var str = "";
var x = 0;
while (x<document.embeds.length)
  {
str +="Embed#: " + x + "   Movie:  " + document.embeds[x].src.substring(0,document.embeds[x].src.indexOf(".swf")+4) + "\n";
x+=1;
  }
alert(str);
}
enumerateembeds();


Just enter that in your webbrowser(best one would be mozzila) and then execute it to show a message with the embed# and object url. If your going to use Internet Explorer/other make sure to put all this code on one line.

3) Executing more that one Statements
To execute more than one statement, you need to use a ';' splitter. What it does is split the code, its like a command that tells the JS engine to run the next script after it.

Bad Practice:
Code:
javascript:var x
x=prompt("Enter your name.")
alert("Hi, " + x + ".")


Good Practice:
Code:
javascript:var x;
x=prompt("Enter your name.");
alert("Hi, " + x + ".");


The 'Bad Practice' will still work if your creating a JS file, but if you execute it in a browser url bar, it most likely wont run correctly.


4) Basic Commands List

Flash:
Code:
document.embeds[0].SetVariable("Var","Val");
document.embeds[0].loadMovie(1,"www.website.com/movie.swf");
document.embeds[0].CallFunction("args");
document.embeds[0].play();


Basic User Interface
Code:
alert("hello, I'm a messagebox");
prompt("Hello, I'm a prompt box","Default Value");
confirm("I'm an Ok or Cancel dialog, I return True, or False!");



5) Declaring Variables
Declaring variables in javascript is very similar to AS, C, & Delphi.

Examples:
var variable = 0;
var cry = true;
var bye = "so?";
var sire = -123;
var make = document.embeds[0].src;
var mommy = document.embeds[0].GetVariable("fail");


6) Okay Now that you have basic lets create our first Javascript Trainer!

I have chosen to hack this very simple game!
Code:

Javascript:
alert("Loading Stick RPG!");

window.location.href = "http://www.ilazy.com/swf/stickrpg.swf";

function ShowHackList(){
var lst = new Array("Name Hack", "Day Hack", "Max Days", "Max Stats");

var returned = prompt("Choose a hack: ID \n" +  lst.toString());

switch (returned)
{
case "Name Hack":
  document.embeds[0].SetVariable("pname",prompt("Enter a new name"));
  break;
case "Day Hack":
  document.embeds[0].SetVariable("day",prompt("Choose a day"));
  break;
case "Max Days":
  document.embeds[0].SetVariable("gamelenght",prompt("Choose the ending day"));
  break;
case "Max Stats":
  document.embeds[0].SetVariable("karma",999);
  document.embeds[0].SetVariable("charm",999);
  document.embeds[0].SetVariable("intelligence",999);
  document.embeds[0].SetVariable("strength",999);
  document.embeds[0].SetVariable("hp max",999);
  document.embeds[0].SetVariable("cash",9999999);
  document.embeds[0].SetVariable("bankcash",99999999);
  document.embeds[0].SetVariable("bankrate",999);
  break;
default:
alert("Error, wrong command entered.");
}
}

prompt("To show the hack menu navigate to this script.(Sorry, don't have time to create UI for this.)","javascript:ShowHackList();");


We are done for today! If you have any questions or suggestions please post. And please reply any errors found! I didn't have time to proofread this.

_________________
Fucktard! wrote:
They can't even do anything with the water yet
Back to top
View user's profile Send private message
GOGOGOGOGOGOGOGOGOGOGOGO!
I post too much
WarningWarningBan
Reputation: 8

Joined: 24 Jan 2009
Posts: 2849

PostPosted: Wed Nov 04, 2009 6:20 pm    Post subject: This post has 1 review(s) Reply with quote

Purely awesome, wonderful tutorial.
_________________

Want the latest cheats for games of your choice? Join LCF today! We're new & have over 220 members!
Back to top
View user's profile Send private message
CodeKiller
How do I cheat?
Reputation: 0

Joined: 30 Jun 2009
Posts: 8

PostPosted: Tue Nov 10, 2009 8:50 am    Post subject: Reply with quote

Wow i didn't know javascript can interact with flash objects !
Back to top
View user's profile Send private message
The Jorg hi
Grandmaster Cheater Supreme
Warning
Reputation: 18

Joined: 24 Dec 2007
Posts: 1858
Location: Minnesota

PostPosted: Thu Nov 12, 2009 2:59 pm    Post subject: Reply with quote

CodeKiller wrote:
Wow i didn't know javascript can interact with flash objects !


It can control literally everything on a webpage.

edit:I know there is an error in the final script I posted, I'll fix it once I have the feeling to.

_________________
Fucktard! wrote:
They can't even do anything with the water yet
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Webbrowser stuff related tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki