|
|
@ -215,7 +215,6 @@ if (args.address or len(args.solidity_file) or args.init_db): |
|
|
|
else: |
|
|
|
else: |
|
|
|
eth = EthIpc() |
|
|
|
eth = EthIpc() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Database search ops |
|
|
|
# Database search ops |
|
|
|
|
|
|
|
|
|
|
|
if args.search or args.init_db: |
|
|
|
if args.search or args.init_db: |
|
|
@ -245,12 +244,16 @@ if args.search or args.init_db: |
|
|
|
contracts = [] |
|
|
|
contracts = [] |
|
|
|
|
|
|
|
|
|
|
|
if (args.code): |
|
|
|
if (args.code): |
|
|
|
|
|
|
|
address = util.get_indexed_address(0) |
|
|
|
|
|
|
|
|
|
|
|
contracts.append(ETHContract(args.code, name="MAIN")) |
|
|
|
contracts.append(ETHContract(args.code, name="MAIN")) |
|
|
|
|
|
|
|
|
|
|
|
# Get bytecode from a contract address |
|
|
|
# Get bytecode from a contract address |
|
|
|
|
|
|
|
|
|
|
|
elif (args.address): |
|
|
|
elif (args.address): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
address = args.address |
|
|
|
|
|
|
|
|
|
|
|
if not re.match(r'0x[a-fA-F0-9]{40}', args.address): |
|
|
|
if not re.match(r'0x[a-fA-F0-9]{40}', args.address): |
|
|
|
exitWithError(args.outform, "Invalid contract address. Expected format is '0x...'.") |
|
|
|
exitWithError(args.outform, "Invalid contract address. Expected format is '0x...'.") |
|
|
|
|
|
|
|
|
|
|
@ -273,6 +276,8 @@ elif (args.address): |
|
|
|
|
|
|
|
|
|
|
|
elif (len(args.solidity_file)): |
|
|
|
elif (len(args.solidity_file)): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
address = util.get_indexed_address(0) |
|
|
|
|
|
|
|
|
|
|
|
if(args.graph and len(args.solidity_file) > 1): |
|
|
|
if(args.graph and len(args.solidity_file) > 1): |
|
|
|
exitWithError(args.outform, "Cannot generate call graphs from multiple input files. Please do it one at a time.") |
|
|
|
exitWithError(args.outform, "Cannot generate call graphs from multiple input files. Please do it one at a time.") |
|
|
|
|
|
|
|
|
|
|
@ -366,9 +371,9 @@ elif (args.graph) or (args.fire_lasers): |
|
|
|
|
|
|
|
|
|
|
|
# try: |
|
|
|
# try: |
|
|
|
if (args.dynld): |
|
|
|
if (args.dynld): |
|
|
|
sym = SymExecWrapper(contracts, dynloader=DynLoader(eth), max_depth=args.max_depth) |
|
|
|
sym = SymExecWrapper(contracts[0], address, dynloader=DynLoader(eth), max_depth=args.max_depth) |
|
|
|
else: |
|
|
|
else: |
|
|
|
sym = SymExecWrapper(contracts, max_depth=args.max_depth) |
|
|
|
sym = SymExecWrapper(contracts[0], address, max_depth=args.max_depth) |
|
|
|
# except: |
|
|
|
# except: |
|
|
|
# exitWithError(args.outform, "Symbolic execution error: " + str(e)) |
|
|
|
# exitWithError(args.outform, "Symbolic execution error: " + str(e)) |
|
|
|
|
|
|
|
|
|
|
@ -392,9 +397,9 @@ elif (args.graph) or (args.fire_lasers): |
|
|
|
|
|
|
|
|
|
|
|
# try: |
|
|
|
# try: |
|
|
|
if (args.dynld): |
|
|
|
if (args.dynld): |
|
|
|
sym = SymExecWrapper([contract], dynloader=DynLoader(eth), max_depth=args.max_depth) |
|
|
|
sym = SymExecWrapper(contract, address, dynloader=DynLoader(eth), max_depth=args.max_depth) |
|
|
|
else: |
|
|
|
else: |
|
|
|
sym = SymExecWrapper([contract], max_depth=args.max_depth) |
|
|
|
sym = SymExecWrapper(contract, address, max_depth=args.max_depth) |
|
|
|
# except Exception as e: |
|
|
|
# except Exception as e: |
|
|
|
# exitWithError(args.outform, "Symbolic exection error: " + str(e)) |
|
|
|
# exitWithError(args.outform, "Symbolic exection error: " + str(e)) |
|
|
|
|
|
|
|
|
|
|
|