Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
QWB-EasyFake.sol
contract Contract {
function main() {
memory[0x40:0x60] = 0x80;
if (msg.data.length < 0x04) { stop(); }
var var0 = msg.data[0x00:0x20] / 0x0100000000000000000000000000000000000000000000000000000000 & 0xffffffff;
if (var0 == 0x19ff1d21) {
// Dispatch table entry for hello()
var var1 = msg.value;
if (var1) { revert(memory[0x00:0x00]); }
var1 = 0x00a5;
var var2 = hello();
var temp0 = memory[0x40:0x60];
var var3 = temp0;
var var4 = var3;
var temp1 = var4 + 0x20;
memory[var4:var4 + 0x20] = temp1 - var4;
var temp2 = var2;
memory[temp1:temp1 + 0x20] = memory[temp2:temp2 + 0x20];
var var5 = temp1 + 0x20;
var var6 = temp2 + 0x20;
var var7 = memory[temp2:temp2 + 0x20];
var var8 = var7;
var var9 = var5;
var var10 = var6;
var var11 = 0x00;
if (var11 >= var8) {
label_00E5:
var temp3 = var7;
var5 = temp3 + var5;
var6 = temp3 & 0x1f;
if (!var6) {
var temp4 = memory[0x40:0x60];
return memory[temp4:temp4 + var5 - temp4];
} else {
var temp5 = var6;
var temp6 = var5 - temp5;
memory[temp6:temp6 + 0x20] = ~(0x0100 ** (0x20 - temp5) - 0x01) & memory[temp6:temp6 + 0x20];
var temp7 = memory[0x40:0x60];
return memory[temp7:temp7 + (temp6 + 0x20) - temp7];
}
} else {
label_00D3:
var temp8 = var11;
memory[var9 + temp8:var9 + temp8 + 0x20] = memory[var10 + temp8:var10 + temp8 + 0x20];
var11 = temp8 + 0x20;
if (var11 >= var8) { goto label_00E5; }
else { goto label_00D3; }
}
} else if (var0 == 0x24b04905) {
// Dispatch table entry for gift()
var1 = 0x0128;
gift();
stop();
} else if (var0 == 0x2f76c9c2) {
// Dispatch table entry for 0x2f76c9c2 (unknown)
var1 = msg.value;
if (var1) { revert(memory[0x00:0x00]); }
var1 = 0x013f;
var2 = func_0406();
var temp9 = memory[0x40:0x60];
memory[temp9:temp9 + 0x20] = var2;
var temp10 = memory[0x40:0x60];
return memory[temp10:temp10 + (temp9 + 0x20) - temp10];
} else if (var0 == 0x645b8b1b) {
// Dispatch table entry for status(address)
var1 = msg.value;
if (var1) { revert(memory[0x00:0x00]); }
var1 = 0x0196;
var2 = msg.data[0x04:0x24] & 0xffffffffffffffffffffffffffffffffffffffff;
var2 = status(var2);
var temp11 = memory[0x40:0x60];
memory[temp11:temp11 + 0x20] = var2;
var temp12 = memory[0x40:0x60];
return memory[temp12:temp12 + (temp11 + 0x20) - temp12];
} else if (var0 == 0x6bc344bc) {
// Dispatch table entry for payforflag(string)
var1 = 0x0206;
var temp13 = msg.data[0x04:0x24] + 0x04;
var temp14 = msg.data[temp13:temp13 + 0x20];
var temp15 = memory[0x40:0x60];
memory[0x40:0x60] = temp15 + (temp14 + 0x1f) / 0x20 * 0x20 + 0x20;
memory[temp15:temp15 + 0x20] = temp14;
memory[temp15 + 0x20:temp15 + 0x20 + temp14] = msg.data[temp13 + 0x20:temp13 + 0x20 + temp14];
var2 = temp15;
var4 = msg.sender;
var3 = address(var4).code.length;
if (var3 != 0x00) { revert(memory[0x00:0x00]); }
var temp16 = memory[0x40:0x60];
memory[temp16:temp16 + 0x20] = 0x696c6f7665717762000000000000000000000000000000000000000000000000;
var temp17 = memory[0x40:0x60];
= keccak256(memory[temp17:temp17 + (temp16 + 0x08) - temp17]);
var temp18 = var2;
var6 = temp18;
var7 = memory[0x40:0x60] + 0x20;
var8 = var7;
var9 = var6 + 0x20;
var10 = memory[var6:var6 + 0x20];
var11 = var10;
var var12 = var8;
var var13 = var9;
if (var11 < 0x20) {
label_04B0:
var temp19 = 0x0100 ** (0x20 - var11) - 0x01;
var temp20 = var12;
memory[temp20:temp20 + 0x20] = (memory[var13:var13 + 0x20] & ~temp19) | (memory[temp20:temp20 + 0x20] & temp19);
var temp21 = var10 + var8;
var temp22 = memory[0x40:0x60];
memory[temp22:temp22 + 0x20] = temp21 - temp22 - 0x20;
var6 = temp22;
memory[0x40:0x60] = temp21;
var7 = memory[0x40:0x60];
var8 = var7;
var10 = memory[var6:var6 + 0x20];
var9 = var6 + 0x20;
var11 = var10;
var12 = var8;
var13 = var9;
if (var11 < 0x20) {
label_0519:
var temp23 = 0x0100 ** (0x20 - var11) - 0x01;
var temp24 = var12;
memory[temp24:temp24 + 0x20] = (memory[var13:var13 + 0x20] & ~temp23) | (memory[temp24:temp24 + 0x20] & temp23);
var temp25 = memory[0x40:0x60];
if (keccak256(memory[temp25:temp25 + (var10 + var8) - temp25]) != var5) { revert(memory[0x00:0x00]); }
memory[0x00:0x20] = msg.sender;
memory[0x20:0x40] = 0x01;
var5 = storage[keccak256(memory[0x00:0x40])] >= 0x03e8;
if (!var5) {
if (!var5) { selfdestruct(msg.sender); }
label_05B4:
memory[0x0800:0x0820] = 0x1234;
var5 = memory[0x0800:0x0820];
var6 = var5;
memory[0x2000:0x2020] = 0x06ee;
var7 = memory[0x2000:0x2020];
// Error: Could not resolve jump destination!
} else if (msg.value != 0x0de0b6b3a7640000) { selfdestruct(msg.sender); }
else { goto label_05B4; }
} else {
label_04FF:
var temp26 = var13;
var temp27 = var12;
memory[temp27:temp27 + 0x20] = memory[temp26:temp26 + 0x20];
var12 = temp27 + 0x20;
var13 = temp26 + 0x20;
var11 = var11 - 0x20;
if (var11 < 0x20) { goto label_0519; }
else { goto label_04FF; }
}
} else {
label_0496:
var temp28 = var13;
var temp29 = var12;
memory[temp29:temp29 + 0x20] = memory[temp28:temp28 + 0x20];
var12 = temp29 + 0x20;
var13 = temp28 + 0x20;
var11 = var11 - 0x20;
if (var11 < 0x20) { goto label_04B0; }
else { goto label_0496; }
}
} else if (var0 == 0x70a08231) {
// Dispatch table entry for balanceOf(address)
var1 = msg.value;
if (var1) { revert(memory[0x00:0x00]); }
var1 = 0x0249;
var2 = msg.data[0x04:0x24] & 0xffffffffffffffffffffffffffffffffffffffff;
var2 = balanceOf(var2);
var temp30 = memory[0x40:0x60];
memory[temp30:temp30 + 0x20] = var2;
var temp31 = memory[0x40:0x60];
return memory[temp31:temp31 + (temp30 + 0x20) - temp31];
} else if (var0 == 0xf0d25268) {
// Dispatch table entry for 0xf0d25268 (unknown)
var1 = msg.value;
if (var1) { revert(memory[0x00:0x00]); }
var1 = 0x02aa;
var2 = msg.data[0x04:0x24] & 0xffffffffffffffffffffffffffffffffffffffff;
var3 = msg.data[0x24:0x44];
func_0602(var2, var3);
stop();
} else if (var0 == 0x2665f77d) {
// Dispatch table entry for 0x2665f77d (unknown)
var1 = msg.value;
if (var1) { revert(memory[0x00:0x00]); }
var1 = 0x02c1;
var2 =0x20;
memory[0x2000:0x2020] = 0x00;
memory[0x2100:0x2120] = 0x00;
var4 = storage[address(msg.sender).code.length];
memory[0x20:0x40] = storage[0x1234];
memory[0x5000:0x5020] = 0x3c;
var5 = 3c;
memory[0x5000:0x5020] = 0x00;
var6 = msg.data[0x7e:0x9e];
var7 = msg.gas;
// Error: Could not resolve jump destination!
} else { stop(); }
}
function hello() returns (var r0) {
var temp0 = memory[0x40:0x60];
r0 = temp0;
memory[0x40:0x60] = r0 + 0x60;
memory[r0:r0 + 0x20] = 0x27;
var temp1 = r0 + 0x20;
memory[temp1:temp1 + 0x20] = 0x57656c636f6d6520746f205334206f66207177622120456e6a6f7920796f7572;
memory[temp1 + 0x20:temp1 + 0x20 + 0x20] = 0x73656c66203a4400000000000000000000000000000000000000000000000000;
return r0;
}
function gift() {
memory[0x00:0x20] = msg.sender;
memory[0x20:0x40] = 0x02;
if (storage[keccak256(memory[0x00:0x40])] != 0x00) { revert(memory[0x00:0x00]); }
memory[0x00:0x20] = msg.sender;
memory[0x20:0x40] = 0x01;
var temp0 = keccak256(memory[0x00:0x40]);
storage[temp0] = storage[temp0] + 0x0a;
memory[0x00:0x20] = msg.sender;
memory[0x20:0x40] = 0x02;
storage[keccak256(memory[0x00:0x40])] = 0x01;
}
function func_0406() returns (var r0) { return storage[0x00]; }
function status(var arg0) returns (var arg0) {
memory[0x20:0x40] = 0x02;
memory[0x00:0x20] = arg0;
return storage[keccak256(memory[0x00:0x40])];
}
function balanceOf(var arg0) returns (var arg0) {
memory[0x20:0x40] = 0x01;
memory[0x00:0x20] = arg0;
return storage[keccak256(memory[0x00:0x40])];
}
function func_0602(var arg0, var arg1) {
memory[0x00:0x20] = msg.sender;
memory[0x20:0x40] = 0x01;
if (storage[keccak256(memory[0x00:0x40])] < arg1) { revert(memory[0x00:0x00]); }
var temp0 = arg1;
memory[0x00:0x20] = msg.sender;
memory[0x20:0x40] = 0x01;
var temp1 = keccak256(memory[0x00:0x40]);
storage[temp1] = storage[temp1] - temp0;
memory[0x00:0x20] = arg0 & 0xffffffffffffffffffffffffffffffffffffffff;
memory[0x20:0x40] = 0x01;
var temp2 = keccak256(memory[0x00:0x40]);
storage[temp2] = storage[temp2] + temp0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment