msuiche / porosity

*UNMAINTAINED* Decompiler and Security Analysis tool for Blockchain-based Ethereum Smart-Contracts
https://www.comae.io
928 stars 181 forks source link

Porosity wont read from my input #43

Open samholmes opened 6 years ago

samholmes commented 6 years ago

Looks like no matter if I use the --code or --code-file arguments, it always outputs the same output:

ϟ porosity --code-file code --debug
Porosity v0.1 (https://www.comae.io)
Matt Suiche, Comae Technologies <support@comae.io>
The Ethereum bytecode commandline decompiler.
Decompiles the given Ethereum input bytecode and outputs the Solidity code.

Attempting to parse ABI definition...
Success.
function mint(address,uint256) {
      if (msg.sender == store_0) {
         store[arg_4] = arg_24 + store[arg_4];
      }
      return;
}

LOC: 6
function send(address,uint256) {
      if (store[msg.sender] >= arg_24) {
         store[msg.sender] = store[msg.sender] - arg_24;
         store[arg_4] = arg_24 + store[arg_4];
      }
      return;
}

LOC: 7
function balances(address) {
      return store[memory[0x20]];
}

LOC: 3
function minter() {
      store_0 = 0x10000000000000000000000000000000000000000 - 0x1;
      return store_0;
}

LOC: 4
Attempting to parse ABI definition...
Success.
function double(uint256) {
      memory[0x60] = 0x2 * arg_4;
      return memory[0x60];
}

LOC: 4
------------
function triple(uint256) {
      memory[0x60] = 0x3 * arg_4;
      return memory[0x60];
}

LOC: 4
After execution.
digraph porosity {
rankdir = TB;
size = "12"
graph[fontname = Courier, fontsize = 10.0, labeljust = l, nojustify = true];node[shape = record];
    "0x00000000"[label = "loc_0x00000000"];
    "0x00000000" -> "0x00000018" [color="red"];
    "0x00000000" -> "0x00000024" [color="green"];
    "0x00000018"[label = "loc_0x00000018"];
    "0x00000018" -> "0x00000022" [color="red"];
    "0x00000018" -> "0x00000035" [color="green"];
    "0x00000022"[label = "loc_0x00000022"];
    "0x00000024"[label = "double(uint256)"];
    "0x00000024" -> "0x00000031" [color="black"];
    "0x00000031"[label = "loc_0x00000031"];
    "0x00000031" -> "0x0000004f" [color="black"];
    "0x00000035"[label = "triple(uint256)"];
    "0x00000035" -> "0x00000031" [color="black"];
    "0x00000045"[label = "loc_0x00000045"];
    "0x0000004f"[label = "loc_0x0000004f"];
    "0x0000004f" -> "0x00000045" [color="black"];
}

Attempting to parse ABI definition...
Success.
function withdrawBalance() {
      if (msg.sender.call.gas(1410031344).value()()) {
         store[msg.sender] = 0x0;
      }
}

L3 (D8193): Potential reentrant vulnerability found.

LOC: 5
function getBalance(address) {
      return store[arg_4];
}

LOC: 3
function addToBalance() {
      store[msg.sender] = store[msg.sender] + msg.value;
      return;
}

LOC: 4

I even did chmod 000 code on my code file in order to test if it's even reading from my file, and nothing changes.

I'm on MacOS.

ming08108 commented 6 years ago

Don't use the debug flag.

samholmes commented 6 years ago

So when I try porosity --code $code --decompile it just hangs. How long do I wait in order to get the results?