16
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ある日ElixirのSlackにて、コンパイルされたElixirモジュールを逆コンパイルする方法を見かけたので、遊んでみます。

論よりRUN

michalmuskala/decompileをインストールする

mix archive.install github michalmuskala/decompile

Elixirプロジェクトを作る

❯ mix new toukon

❯ cd toukon

❯ ls
README.md lib       mix.exs   testcat lib/toukon.ex
defmodule Toukon do
  @moduledoc """
  Documentation for `Toukon`.
  """

  @doc """
  Hello world.

  ## Examples

      iex> Toukon.hello()
      :world

  """
  def hello do
    :world
  end
end

コンパイルする

❯ mix compile

❯ ls
README.md _build    lib       mix.exs   test

❯ tree _build
_build
└── dev
    └── lib
        └── toukon
            ├── consolidated
            │   ├── Elixir.Collectable.beam
            │   ├── Elixir.Enumerable.beam
            │   ├── Elixir.Hex.Solver.Constraint.beam
            │   ├── Elixir.IEx.Info.beam
            │   ├── Elixir.Inspect.beam
            │   ├── Elixir.List.Chars.beam
            │   └── Elixir.String.Chars.beam
            └── ebin
                ├── Elixir.Toukon.beam
                └── toukon.app

逆コンパイルする

❯ mix decompile Toukon --to expanded

❯ ls
Elixir.Toukon.ex README.md        _build           lib              mix.exs          testcat Elixir.Toukon.ex
defmodule Toukon do
  def hello() do
    :world
  end
end

ご参考までに

16
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?