Need help decompiling .beam file

Hi, I’m new to this ERLANG and BEAM language, I’m looking for a person with experience in Erlang, I want to know how I can decompile and compile a Beam file from my server, I know very little about that type of file or how I can edit it, when opening the file I find this at the beginning FOR1 can be a key piece, more information to the intern, I attach the file in case you need to see it, thank you very much in advance

File .Beam
https://github.com/granados12/decompile/blob/main/charge_data.beam?raw=true

1 Like

Do you try read:
(C):

Writing a decompiler which can turn the above example back to source is a fifteen minute job. 
Writing a decompiler which handles more complex Erlang code is more time consuming, 
but not much harder. The syntax_tools application can do most of the hard work. 

https://www.erlang.org/faq/tools.html
?

1 Like

If you can’t read the original file, maybe you don’t own it? :upside_down_face:
Where you get this BEAM file what you push into new GitHub account what was created 9 Jan at 2022?

1 Like

I’m new to this, and I don’t understand how to apply it, can you help me by explaining a little, if I want to decompile a .BEAM file and edit some texts that the file has and recompile it to its .BEAM origin

1 Like

Similar topic How to disassemble .beam file

1 Like

Yes, I was reading that but since I’m new I don’t understand how to apply it, could you help me by explaining a little, I have erlang and beam installed on my server but I don’t know what commands I should use to decompile it, they don’t explain much about it, and since I’m new I don’t I understand a lot, could you help me a little, I thank you very much

1 Like

Well, you can read about it a bit here The Erlang Runtime System

The quick start you can try is to use beam_lib:all_chunks(“charge_data.beam”)..

But your question sounds too suspicious for me to try to help further xD Don’t want to be chaised by FBI or smth xD

3 Likes

hahahahaha the FBI good man, in the same way thank you very much, I will read the two links that you sent me anything I will comment again

1 Like

You posted the same question on the Elixir Forum and I think the concern is where you obtained this file (and why you don’t have the original source files). Could you shed some light on that please?

2 Likes

in elixir they gave me an answer and it works but for some files not for all the files, it seems to me that the best way is with erlang since, and the files is a server of a game that you download and to be able to translate the game it is directly with these files from the server and they only come in .BEAM files and with the elixir solution I have been able to advance with the translation but not all the files since it does not decompile all the files only some

1 Like

I can see that those files have “encrypted debug info”

3> beam_lib:chunks("charge_data.beam", ["Abst"]).       
{ok,{charge_data,[{"Abst",
                   <<0,8,100,101,115,51,95,99,98,99,3,180,148,25,2,131,
                     13,114,156,126,91,155,...>>}]}}
4> beam_lib:chunks("charge_data.beam", [abstract_code]).
{error,beam_lib,
       {key_missing_or_invalid,"charge_data.beam",abstract_code}}

Which means the one who compiled this .beam file did not want anyone to restore the source code of this module, and also there won’t be any easy way to restore the original source code from it.

Your only way than is to decompile the "Code" chunk of the .beam file. But it is very low-level…

$ erl
> rp(beam_disasm:file("charge_data.beam")).

and, as it’s being said in another thread, it’s unlikely that you’ll be able to compile it back

2 Likes

@erlic123 the application where you get this BEAM is name is sszg_srv. The data of API what you try find can provide getting some charge user personal data(as I see in fields) - where you get this BEAM?

2 Likes

damn, and that’s the idea that I can decompile it and recompile it, since with the answer in elixir if I could decompile and compile the files again but not all the files work, then the solution is difficult, as you say the one who did it he didn’t want me to restore the source code

1 Like

if it is a server the game is called Eloras Raid, the server has a registered database with names that start with sszg_""

is this server and is in a VPS Centos 7

1 Like

You can check out this implementation of the Erlang decompiler:

inside the util library.

1 Like

Those beams have encrypted abstract_code chunks, so, this won’t work I think

2 Likes

did not work

1 Like

Ok perfect thank you very much to all of you and thank you very much for your time

1 Like

But did you try to use the tool from this post?

1 Like

the truth is I tried many ways but since they don’t explain very well for us new to this erlang thing I don’t understand much, if only I knew how to do it I could try

1 Like