日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

EVM反编译软件Porosity的使用-mac

發(fā)布時間:2025/3/15 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 EVM反编译软件Porosity的使用-mac 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

首先給出 porosity 的 GitHub 地址:?here

本文也是根據(jù)這個網(wǎng)址進行學(xué)習。

1. 創(chuàng)建和約

可以使用自己寫的合約,也可以在etherscan?上面找一些合約, 給出例子如下:

//vulnerable.sol pragma solidity ^0.4.4; contract SendBalance {mapping ( address => uint ) userBalances;function SendBalance(){}function getBalance (address u) constant returns ( uint ){return userBalances [u];}function addToBalance () payable{userBalances[msg.sender] += msg.value ;}function withdrawBalance (){if (!(msg.sender.call.gas(0x1111).value (userBalances [msg . sender])())) { throw ; }userBalances [msg.sender ] = 0;} }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

2. 下載porosity 并編譯

下載之后,在終端進入porosity/porosity/porosity目錄 然后輸入:make //編譯你會看到生成了porosity(exec)
  • 1
  • 2
  • 3
  • 4
  • 5

3. 使用porosity

a. 在porosity下創(chuàng)建文件夾 solidity-example (自己取得名字隨意創(chuàng)),并將合約放在該目錄下面。

b. 創(chuàng)建decompile.sh

#!/bin/bash solc --abi -o output vulnerable.sol solc --bin -o output vulnerable.sol solc --bin-runtime -o output vulnerable.solabi=$(< output/SendBalance.abi) echo "This is abi variable: " echo $abibin=$(< output/SendBalance.bin) echo "" echo "This is bin variable: " echo $binbinRuntime=$(< output/SendBalance.bin-runtime) echo "" echo "This is binruntime variable: " echo $binRuntimeecho "" echo "Firstly listing functions: " #注意路徑,指向的是前面編譯之后生成的porosity文件 ../porosity/porosity/porosity --code $bin --abi $abi --list --verbose 0 echo "Now performing decompilation: " ../porosity/porosity/porosity --code $bin --abi $abi --decompile --verbose 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

c. 授權(quán)decompile.sh (只有第一次需要)

輸入:chmod 777 decompile.sh
  • 1
  • 2

d.運行decompile.sh

輸入:./decompile.sh
  • 1
  • 2

e. 結(jié)果,類似于

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. [+] Hash: 0x0A19B14A (trade) (1 references) [+] Hash: 0x0B927666 (order) (1 references) [+] Hash: 0x19774D43 (orderFills) (1 references) [+] Hash: 0x278B8C0E (cancelOrder) (1 references) [+] Hash: 0x2E1A7D4D (withdraw) (1 references) [+] Hash: 0x338B5DEA (depositToken) (1 references) [+] Hash: 0x46BE96C3 (amountFilled) (1 references) [+] Hash: 0x508493BC (tokens) (1 references) [+] Hash: 0x54D03B5C (changeFeeMake) (1 references) [+] Hash: 0x57786394 (feeMake) (1 references) [+] Hash: 0x5E1D7AE4 (changeFeeRebate) (1 references) [+] Hash: 0x65E17C9D (feeAccount) (1 references) [+] Hash: 0x6C86888B (testTrade) (1 references) [+] Hash: 0x71FFCB16 (changeFeeAccount) (1 references) [+] Hash: 0x731C2F81 (feeRebate) (1 references) [+] Hash: 0x8823A9C0 (changeFeeTake) (1 references) [+] Hash: 0x8F283970 (changeAdmin) (1 references) [+] Hash: 0x9E281A98 (withdrawToken) (1 references) [+] Hash: 0xBB5F4629 (orders) (1 references) [+] Hash: 0xC281309E (feeTake) (1 references) [+] Hash: 0xD0E30DB0 (deposit) (1 references) [+] Hash: 0xE8F6BC2E (changeAccountLevelsAddr) (1 references) [+] Hash: 0xF3412942 (accountLevelsAddr) (1 references) [+] Hash: 0xF7888AEC (balanceOf) (1 references) [+] Hash: 0xF851A440 (admin) (1 references) [+] Hash: 0xFB6E155F (availableVolume) (1 references)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
版權(quán)聲明:本文為博主原創(chuàng)文章,未經(jīng)博主允許不得轉(zhuǎn)載。 http://blog.csdn.net/loy_184548/article/details/78152455 與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的EVM反编译软件Porosity的使用-mac的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。