Guest User

Untitled

a guest
Jul 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. var VictimContract = eth.contract([
  2. {
  3. "constant": false,
  4. "inputs": [],
  5. "name": "withdraw",
  6. "outputs": [],
  7. "payable": false,
  8. "stateMutability": "nonpayable",
  9. "type": "function"
  10. },
  11. {
  12. "constant": false,
  13. "inputs": [],
  14. "name": "deposit",
  15. "outputs": [],
  16. "payable": true,
  17. "stateMutability": "payable",
  18. "type": "function"
  19. }
  20. ]);
  21.  
  22. var Victim = VictimContract.at('0xed1f0ae556562f41e4f689fae1abeefd9426fc34');
  23.  
  24. var AttackerContract = eth.contract([
  25. {
  26. "constant": true,
  27. "inputs": [],
  28. "name": "count",
  29. "outputs": [
  30. {
  31. "name": "",
  32. "type": "uint256"
  33. }
  34. ],
  35. "payable": false,
  36. "stateMutability": "view",
  37. "type": "function"
  38. },
  39. {
  40. "inputs": [
  41. {
  42. "name": "victim",
  43. "type": "address"
  44. }
  45. ],
  46. "payable": false,
  47. "stateMutability": "nonpayable",
  48. "type": "constructor"
  49. },
  50. {
  51. "payable": true,
  52. "stateMutability": "payable",
  53. "type": "fallback"
  54. },
  55. {
  56. "anonymous": false,
  57. "inputs": [
  58. {
  59. "indexed": false,
  60. "name": "c",
  61. "type": "uint256"
  62. },
  63. {
  64. "indexed": false,
  65. "name": "balance",
  66. "type": "uint256"
  67. }
  68. ],
  69. "name": "LogFallback",
  70. "type": "event"
  71. },
  72. {
  73. "constant": false,
  74. "inputs": [],
  75. "name": "attack",
  76. "outputs": [],
  77. "payable": false,
  78. "stateMutability": "nonpayable",
  79. "type": "function"
  80. }
  81. ]);
  82.  
  83. var Attacker = AttackerContract.at('0xbf3615b919cc305f2a69fb874148d0804dfdc087');
  84.  
  85. getBalance = eth.getBalance;
  86.  
  87. function balanceInEth(address) {
  88. return web3.fromWei(getBalance(address).toString());
  89. }
Add Comment
Please, Sign In to add comment