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 


Extracting all flash files from memory

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Wed Feb 16, 2011 9:33 pm    Post subject: Extracting all flash files from memory Reply with quote

If for some reason you want to get all the flash files of the target process in decompressed form then just execute this script
Code:

--Warning: Only works on 32-bit processes (convert to stringmethod for 64-bit. Will be slower)

chunksize=10;
function writeRegionToFile(filename, address, totalbytes)
  local f=assert(io.open(filename,"wb"))
  local i=0;
  local b='';

  print("Writing "..filename)

  while (i<totalbytes-chunksize) do
    b=b..string.char(readBytes(address+i,chunksize))
    i=i+chunksize
  end

  --write the rest
   print("i="..i.." totalbytes="..totalbytes.." left="..totalbytes-i)
   b=b..string.char(readBytes(address+i,totalbytes-i))

  f:write(b)

  f:close()
end

function saveFlashFiles(outputfolder)
  FWSHeaders=AOBScan("46 57 53");
  if (FWSHeaders ~= nil) then
    local count=stringlist_getCount(FWSHeaders);
    if count>0 then
      --I'm not yet comfortable with lua for loops so I use a while for now...
      local index=0;
      while (index<count) do
        local address=tonumber("0x"..stringlist_getString(FWSHeaders,index))
        local size=readInteger(address+4);
        if (size~=nil) then       
          if ((address % 0x1000)==0) then
            if (size>0) and (size<50000000) then --max limit in case of corrupted fws (50mb)   
              print("writing "..stringlist_getString(FWSHeaders,index).." size="..size)         
              writeRegionToFile(outputfolder.."swf"..index..".swf", address, size)
            end
          end
        end
       
        index=index+1;
      end
    end
    object_destroy(FWSHeaders)
  else
    showMessage("The selected process doesn\'t have any flash headers");
  end
end

saveFlashFiles([[c:\]]);

Replace saveFlashFiles([[c:\]]); with a folder of your choosing

When it's done that folder will contain several .swf files that where found in the process

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping


Last edited by Dark Byte on Thu Feb 17, 2011 6:56 am; edited 4 times in total
Back to top
View user's profile Send private message MSN Messenger
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Thu Feb 17, 2011 5:51 am    Post subject: Reply with quote

Hi DB!

I have tried this method and it doesn't seem to be working for me. Here is what happens:

I open up a flash based game, Youda Safari for example. I start Your lua script. It will generate a few small swf files (a few kb only) and then it seems like CE is working but nothing happens even if I wait like 10-15 minutes.

If I search for "FWS" manually, I have about 25 results (but not all of them related to flash, I have found strings like FWSetfirewall etc.)

Here is what I got with the script:
http://www.megaupload.com/?d=8F3JDEW6

I also tried opening a few flash games with the standalone flash player then try exporting the swf file out of the flash player but it had about the same results as above.

I don't really get it why is this happening as if I see it right, it should just export everything after the FWS string but it is not working for me.

EDIT:
Also, if CE doesn't find any flash headers, it will not display the message that should pop up. But it will not "freeze" either.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu Feb 17, 2011 6:52 am    Post subject: Reply with quote

I've updated the script a little to generate some output

it is working for me though, I loaded a flash game and it did export it
Try picking a smaller chunksize (e.g 1)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Thu Feb 17, 2011 7:57 am    Post subject: Reply with quote

Thanks, I have checked it again, it seems to be that writing the file takes wast amount of time. With a 100kb sized flash, it takes a few seconds only. With 400kb, it takes about 25 seconds and with a 3MB sized flash, it takes some indefinite time (surely longer than 5 minutes because I cancelled the thing after that and in the previous case, I have just gone from the comp for at least 10 minutes and didn't finish it).

When it is done, it is awesome because it rips the whole thing apart, separating the Mochi loader and the real game for example (so people can skip the stupid ads). But some patience is needed for sure. I have tried to freeze the process while I try to export the swf but it didn't help so I guess it is better to just leave there until it will be finished sometime.

Did You try it with larger swf files? Is it slow for You too or it is just me?

Changing the chunk sizes doesn't affect the speed of exporting. I have set it to 1 but it takes the same amount of time to export the same file.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu Feb 17, 2011 1:03 pm    Post subject: Reply with quote

Yes, it's a bit slow. I'll probably add a writeRegionToFile function to next ce version
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Thu Feb 17, 2011 1:13 pm    Post subject: Reply with quote

It is still very cool, I knew about this method already as You have mentioned it in some ancient post, but I never tried. Now I see it can be very useful in some cases. I will take apart some games with this feature.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
hackerdvm
Master Cheater
Reputation: -1

Joined: 23 Nov 2008
Posts: 385
Location: On the computer hacking

PostPosted: Fri Feb 18, 2011 12:46 pm    Post subject: Reply with quote

Could you do this same Method with websites? just curious (instead of .swfs)
_________________
MASTER HACKER ALL HAIL KAPPA

JACKPOT BOIS!!! https://www.youtube.com/watch?v=qwMuMSPW3bU
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Fri Feb 18, 2011 12:49 pm    Post subject: Reply with quote

You mean to save the contents of a website from a browser? Basically it is useless as the website is downloaded to Your computer anyway when You open it.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Fri Feb 18, 2011 2:28 pm    Post subject: Reply with quote

and file->save page as tends to work too.

I you're asking on getting the PHP sourcecode: No, that will not work because the php code is not loaded on your computer

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sat Feb 19, 2011 4:03 am    Post subject: Reply with quote

will it be able to extract .swf from sites like Facebook ?
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Sat Feb 19, 2011 7:31 am    Post subject: Reply with quote

Yes, at least the loader for sure.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
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 -> LUA 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   IRC (#CEF)   Twitter
Third party websites