teether
teether copied to clipboard
ERROR: Unknown option --bin
Hello, dear author:
I had this problem:
$ solc --bin test1.sol | tail -n1 > test1.code
ERROR: Unknown option --bin
I think my Solc is installed correctly When I enter this command $ solc -help Ubuntu will be displayed Usage: solc [OPTIONS] [ARGS]
Options: --out-dir [PATH] Output directory for the compiled contracts (Default is ./contracts) --optimise If present activate the solc optimiser -k, --no-color Omit color from output --debug Show debug information -h, --help Display help and usage details
Can i use command $ solcjs --bin test1.sol | tail -n1 > test1.code to replace $ solc --bin test1.sol | tail -n1 > test1.code
Hi,
solc
if installed correctly should have a --bin
option (see https://docs.soliditylang.org/en/latest/using-the-compiler.html).
The solcjs
command line tool available from npm
appears to be incompatible:
The commandline options of
solcjs
are not compatible withsolc
and tools (such asgeth
) expecting the behaviour ofsolc
will not work withsolcjs
.
(Quote from https://docs.soliditylang.org/en/latest/installing-solidity.html#solcjs)
If all else fails, Solidity does provide statically linked binaries for most versions at https://github.com/ethereum/solidity/releases which should work out-of-the-box.
Please note that for our experiments we used Solidity v0.4.9 (see also https://github.com/nescio007/teether/issues/17), and that some of the examples might not work with a newer version of Solidity.
Hi dear author
Now my solc version is 0.4.9 and solc can --bin
but When I execute $ solc --bin test.sol | tail -n1 > test.code
the error is: test.sol:27:9: Error: Undeclared identifier.
require(owner == msg.sender);
^-----^
and the content of test.sol is :
pragma solidity ^0.4.0;
contract Test{
struct Transaction{
address to;
uint amount;
}
mapping (bytes32 => Transaction) transactions;
address owner;
function set_owner(address new_owner){
owner = new_owner;
}
function new_transaction(address to, uint amount) returns (bytes32){
bytes32 token = sha3(to, amount);
Transaction storage t = transactions[token];
t.to = to;
t.amount += amount;
return token;
}
function approve(bytes32 token){
require(owner == msg.sender);
Transaction storage t = transactions[token];
t.to.transfer(t.amount);
delete transactions[token];
}
}
Apologies, apparently my notes were incorrect, require
was only introduced with v0.4.10 (and the contract compiles well with v0.4.11):
docker run -ti ethereum/solc:0.4.11 --bin -
pragma solidity ^0.4.0;
contract Test{
struct Transaction{
address to;
uint amount;
}
mapping (bytes32 => Transaction) transactions;
address owner;
function set_owner(address new_owner){
owner = new_owner;
}
function new_transaction(address to, uint amount) returns (bytes32){
bytes32 token = sha3(to, amount);
Transaction storage t = transactions[token];
t.to = to;
t.amount += amount;
return token;
}
function approve(bytes32 token){
require(owner == msg.sender);
Transaction storage t = transactions[token];
t.to.transfer(t.amount);
delete transactions[token];
}
}
======= <stdin>:Test =======
Binary:
6060604052341561000c57fe5b5b61038d8061001c6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630129ab27146100515780637cb97b2b146100ac578063a53a1adf146100e2575bfe5b341561005957fe5b61008e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610106565b60405180826000191660001916815260200191505060405180910390f35b34156100b457fe5b6100e0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506101e5565b005b34156100ea57fe5b61010460048080356000191690602001909190505061022a565b005b6000600060008484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140182815260200192505050604051809103902091506000600083600019166000191681526020019081526020016000209050848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508381600101600082825401925050819055508192505b505092915050565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60003373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156102895760006000fd5b60006000836000191660001916815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc82600101549081150290604051809050600060405180830381858888f19350505050151561030e57fe5b60006000836000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905550505b50505600a165627a7a723058206776bc2068e267b0908718b2a400bc9e6a8b2b5542a6505c1a171da3ec16c6810029
Hi dear author when i execute $ python bin/gen_exploit.py test.contract.code 0x1234 0x1000 +1000 and the result is : INFO:root:Finished all paths INFO:root:Finished all paths INFO:root:Finished all paths INFO:root:Found 1 CALL instructions INFO:root:Finished all paths INFO:root:CALL: ( 769) 301: f1 -7 +1 = -6 CALL INFO:root:Path: 0->39->44->e2->ea->22a->289->301 INFO:root:No DELEGATECALL instructions INFO:root:No CALLCODE instructions INFO:root:No SELFDESTRUCT instructions INFO:root:Found 3 RETURN and STOP instructions INFO:root:End: ( 171) ab: f3 -2 +0 = -2 RETURN INFO:root:Path: 0->51->59->106->1dd->8e->ab INFO:root:End: ( 225) e1: 00 -0 +0 = 0 STOP INFO:root:Path: 0->39->ac->b4->1e5->227->e0->e1 INFO:root:Calling contract 1461501637330902918203684832716283019655932542975 & 1461501637330902918203684832716283019655932542975 & UDiv(STORAGE_3[SHA3_5d_3], 1) (136_3) INFO:root:End: ( 261) 105: 00 -0 +0 = 0 STOP INFO:root:Path: 0->39->44->e2->ea->22a->289->30e->35d->104->105 INFO:root:All ends: [<teether.evm.results.SymbolicResult object at 0x7fd24ed197f0>, <teether.evm.results.SymbolicResult object at 0x7fd24ec550a0>, <teether.evm.results.SymbolicResult object at 0x7fd24ec554f0>] INFO:root:Could not exploit any RETURN+CALL Did I finish and succeed in this experiment?
Hi @chusanchen,
unfortunately no, teEther should be able to find an exploit for the example. I suspect it is an issue with the interface to z3. Could you post the version of z3 you were using? I'll then check whether I can recreate the problem.
Hi Do u remember me ? long time no see ;) how can i see my z3 version ? My version of Python3 is 3.8.5 ------------------ 原始邮件 ------------------ 发件人: "nescio007/teether" @.>; 发送时间: 2021年1月11日(星期一) 凌晨1:36 @.>; @.@.>; 主题: Re: [nescio007/teether] ERROR: Unknown option --bin (#18)
Hi @chusanchen,
unfortunately no, teEther should be able to find an exploit for the example. I suspect it is an issue with the interface to z3. Could you post the version of z3 you were using? I'll then check whether I can recreate the problem.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Hi,
if you installed z3-solver
using pip
you can use
pip freeze | grep z3
Otherwise, z3.get_version_string()
works from within python:
python -c 'import z3;print(z3.get_version_string())'
My version of Python 3 is 3.8.5。 The command 'Python' doesn't work in my work so i use the Python3 to execute. just like $ python3 bin/extract_contract_code.py test.code > test.contract.code $ python3 bin/gen_exploit.py test.contract.code 0x1234 0x1000 +1000 Is it because there's something wrong with Python3?
------------------ 原始邮件 ------------------ 发件人: "nescio007/teether" @.>; 发送时间: 2021年6月7日(星期一) 晚上9:08 @.>; @.@.>; 主题: Re: [nescio007/teether] ERROR: Unknown option --bin (#18)
Hi,
if you installed z3-solver using pip you can use pip freeze | grep z3
Otherwise, z3.get_version_string() works from within python: python -c 'import z3;print(z3.get_version_string())'
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
This is my z3 version 4.8.9
------------------ 原始邮件 ------------------ 发件人: "故事还长" @.>; 发送时间: 2021年6月7日(星期一) 晚上9:10 @.>;
主题: 回复: [nescio007/teether] ERROR: Unknown option --bin (#18)
My version of Python 3 is 3.8.5。 The command 'Python' doesn't work in my work so i use the Python3 to execute. just like $ python3 bin/extract_contract_code.py test.code > test.contract.code $ python3 bin/gen_exploit.py test.contract.code 0x1234 0x1000 +1000 Is it because there's something wrong with Python3?
------------------ 原始邮件 ------------------ 发件人: "nescio007/teether" @.>; 发送时间: 2021年6月7日(星期一) 晚上9:08 @.>; @.@.>; 主题: Re: [nescio007/teether] ERROR: Unknown option --bin (#18)
Hi,
if you installed z3-solver using pip you can use pip freeze | grep z3
Otherwise, z3.get_version_string() works from within python: python -c 'import z3;print(z3.get_version_string())'
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Sorry, it's easy to forget that python3 is not the default for everyone yet :) Thanks for posting your z3 version, I'll see whether I can recreate your issues.
In the meantime, could you try to downgrade your z3 to version 4.8.5?
pip install z3-solver==4.8.5.0
OK I will try my best to downgrade my z3 to version 4.8.5 :) Dear author are you Chinese? Do you use wechat? Maybe we can add wechat to make communication easier. Thank you very much and wish you have a good day :)
------------------ 原始邮件 ------------------ 发件人: "nescio007/teether" @.>; 发送时间: 2021年6月7日(星期一) 晚上9:16 @.>; @.@.>; 主题: Re: [nescio007/teether] ERROR: Unknown option --bin (#18)
Sorry, it's easy to forget that python3 is not the default for everyone yet :) Thanks for posting your z3 version, I'll see whether I can recreate your issues.
In the meantime, could you try to downgrade your z3 to version 4.8.5? pip install z3-solver==4.8.5.0
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.