Decompiling Erlang source code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Decompiling Erlang source code

Prakash Parmar-2

I have Erlang application's beam files which I want to decompile.

Application is Compiled and build with 'debug_info' options. here is snippet of emake file to which is used to build application :

    {"apps/my_app/src/*",   [debug_info, nowarn_export_all, {outdir, "apps/my_app/ebin"},{pa, "deps"},{parse_transform, lager_transform}, {parse_transform, events_transform}]}.

I have tried function from beam_lib module but getting following Error :

    1>{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(abc,[abstract_code]).
    ** exception error: no match of right hand side value {error,beam_lib,{not_a_beam_file,'abc.beam'}}

I have also tried solution mentioned in following post but Its not working for me. I'm getting following error :

    1> file:write_file("/tmp/my_module_disasm", io_lib:fwrite("~p.\n", [beam_disasm:file(abc)])).
    ok

/tmp/my_module_disasm file contains :

    {error,beam_lib,{not_a_beam_file,'abc.beam'}}.

Anyone have Idea ?




******* DISCLAIMER: This email and any files transmitted with it are privileged and confidential information and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Torry Harris Business Solutions has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. The recipient should check this email and any attachments for the presence of viruses. THBS reserves the right to monitor and review the content of all messages sent to or from this e-mail address********
******* DISCLAIMER: This email and any files transmitted with it are privileged and confidential information and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Torry Harris Business Solutions has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail.  The recipient should check this email and any attachments for the presence of viruses. THBS reserves the right to monitor and review the content of all messages sent to or from this e-mail address.********

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Decompiling Erlang source code

Brujo Benavides-3
Have you tried using recon:source/1?

On Oct 30, 2017, at 09:38, Prakash Parmar <[hidden email]> wrote:

I have Erlang application's beam files which I want to decompile.

Application is Compiled and build with 'debug_info' options. here is snippet of emake file to which is used to build application :

    {"apps/my_app/src/*",   [debug_info, nowarn_export_all, {outdir, "apps/my_app/ebin"},{pa, "deps"},{parse_transform, lager_transform}, {parse_transform, events_transform}]}.

I have tried function from beam_lib module but getting following Error :

    1>{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(abc,[abstract_code]).
    ** exception error: no match of right hand side value {error,beam_lib,{not_a_beam_file,'abc.beam'}}

I have also tried solution mentioned in following post but Its not working for me. I'm getting following error :

    1> file:write_file("/tmp/my_module_disasm", io_lib:fwrite("~p.\n", [beam_disasm:file(abc)])).
    ok

/tmp/my_module_disasm file contains :

    {error,beam_lib,{not_a_beam_file,'abc.beam'}}.

Anyone have Idea ?




******* DISCLAIMER: This email and any files transmitted with it are privileged and confidential information and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Torry Harris Business Solutions has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. The recipient should check this email and any attachments for the presence of viruses. THBS reserves the right to monitor and review the content of all messages sent to or from this e-mail address********
******* DISCLAIMER: This email and any files transmitted with it are privileged and confidential information and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Torry Harris Business Solutions has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail.  The recipient should check this email and any attachments for the presence of viruses. THBS reserves the right to monitor and review the content of all messages sent to or from this e-mail address.********
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Decompiling Erlang source code

Richard Carlsson-3
In reply to this post by Prakash Parmar-2
The first argument to beam_lib:chunks/2 should be a path to the beam file, not just the module name.


        /Richard

2017-10-30 13:38 GMT+01:00 Prakash Parmar <[hidden email]>:

I have Erlang application's beam files which I want to decompile.

Application is Compiled and build with 'debug_info' options. here is snippet of emake file to which is used to build application :

    {"apps/my_app/src/*",   [debug_info, nowarn_export_all, {outdir, "apps/my_app/ebin"},{pa, "deps"},{parse_transform, lager_transform}, {parse_transform, events_transform}]}.

I have tried function from beam_lib module but getting following Error :

    1>{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(abc,[abstract_code]).
    ** exception error: no match of right hand side value {error,beam_lib,{not_a_beam_file,'abc.beam'}}

I have also tried solution mentioned in following post but Its not working for me. I'm getting following error :

    1> file:write_file("/tmp/my_module_disasm", io_lib:fwrite("~p.\n", [beam_disasm:file(abc)])).
    ok

/tmp/my_module_disasm file contains :

    {error,beam_lib,{not_a_beam_file,'abc.beam'}}.

Anyone have Idea ?




******* DISCLAIMER: This email and any files transmitted with it are privileged and confidential information and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Torry Harris Business Solutions has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. The recipient should check this email and any attachments for the presence of viruses. THBS reserves the right to monitor and review the content of all messages sent to or from this e-mail address********
******* DISCLAIMER: This email and any files transmitted with it are privileged and confidential information and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Torry Harris Business Solutions has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail.  The recipient should check this email and any attachments for the presence of viruses. THBS reserves the right to monitor and review the content of all messages sent to or from this e-mail address.********

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Decompiling Erlang source code

Ilya Shcherbak-2
In reply to this post by Prakash Parmar-2
hey Prakash, can you attach the file which you want to decompile? .

2017-10-30 19:38 GMT+07:00 Prakash Parmar <[hidden email]>:

I have Erlang application's beam files which I want to decompile.

Application is Compiled and build with 'debug_info' options. here is snippet of emake file to which is used to build application :

    {"apps/my_app/src/*",   [debug_info, nowarn_export_all, {outdir, "apps/my_app/ebin"},{pa, "deps"},{parse_transform, lager_transform}, {parse_transform, events_transform}]}.

I have tried function from beam_lib module but getting following Error :

    1>{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(abc,[abstract_code]).
    ** exception error: no match of right hand side value {error,beam_lib,{not_a_beam_file,'abc.beam'}}

I have also tried solution mentioned in following post but Its not working for me. I'm getting following error :

    1> file:write_file("/tmp/my_module_disasm", io_lib:fwrite("~p.\n", [beam_disasm:file(abc)])).
    ok

/tmp/my_module_disasm file contains :

    {error,beam_lib,{not_a_beam_file,'abc.beam'}}.

Anyone have Idea ?




******* DISCLAIMER: This email and any files transmitted with it are privileged and confidential information and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Torry Harris Business Solutions has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. The recipient should check this email and any attachments for the presence of viruses. THBS reserves the right to monitor and review the content of all messages sent to or from this e-mail address********
******* DISCLAIMER: This email and any files transmitted with it are privileged and confidential information and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Torry Harris Business Solutions has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail.  The recipient should check this email and any attachments for the presence of viruses. THBS reserves the right to monitor and review the content of all messages sent to or from this e-mail address.********

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions