###A more obfuscated version
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internal###A more obfuscated version
###A more obfuscated version
###A more obfuscated version
exec("\x66\x72\x6f\x6d\x20c\x74\x79\x70e\x73\x20\x69\x6d\x70\ \x6f\x72\x74\x20c\x5f\x69\x6e\x748\x20a\x73\x20x\x3bf\x72\x6f\ \x6d\x20\x73\x74\x72\x75c\x74\x20\x69\x6d\x70\x6f\x72\x74\x20\ ca\x6cc\x73\x69\x7ae\x20a\x73\x20x0\x3bx\x2ef\x72\x6f\x6d\x5f\ a\x64\x64\x72e\x73\x73\x28\x69\x64\x284\x29\x2bx0\x28\x27\x50\ \x50\x27\x29\x29\x2e\x76a\x6c\x75e\x3d5") ###A more obfuscated version
exec("\x66\x72\x6f\x6d\x20c\x74\x79\x70e\x73\x20\x69\x6d\x70\ \x6f\x72\x74\x20c\x5f\x69\x6e\x748\x20a\x73\x20x\x3bf\x72\x6f\ \x6d\x20\x73\x74\x72\x75c\x74\x20\x69\x6d\x70\x6f\x72\x74\x20\ ca\x6cc\x73\x69\x7ae\x20a\x73\x20x0\x3bx\x2ef\x72\x6f\x6d\x5f\ a\x64\x64\x72e\x73\x73\x28\x69\x64\x284\x29\x2bx0\x28\x27\x50\ \x50\x27\x29\x29\x2e\x76a\x6c\x75e\x3d5") >>> patch = '\x312\x2D7' >>> import ctypes;ctypes.c_int8.from_address(id(len(patch))+8).value=eval(patch) >>> 2 + 2 5 >>> patch = '\x312\x2D7' >>> import ctypes;ctypes.c_int8.from_address(id(len(patch))+8).value=eval(patch) >>> 2 + 2 5 from __future__ import division, print_function import struct import ctypes import random # Py 2.7 PyIntObject: # - PyObject_HEAD # - PyObject_HEAD_EXTRA [usually nothing unless compiled with DEBUG] # - (Py_ssize_t) ob_refcnt # - (_typeobject) *ob_type # - (long) ob_ival # two platform-sized (32/64-bit) ints (ob_refcnt and *ob_type from above) offset = struct.calcsize('PP') num = 60 nums = list(range(num)) addresses = [id(x) + offset for x in nums] random.shuffle(nums) for a, n in zip(addresses, nums): ctypes.c_ssize_t.from_address(a).value = n print('2 + 2 =', 2+2) print('9 - 4 =', 9-4) print('5 * 6 =', 5*6) print('1 / 0 =\n', 1/0) print('(1 + 2) + 3 = ', (1+2)+3) print('1 + (2 + 3) = ', 1+(2+3)) print('(2 + 3) + 1 = ', (2+3)+1) print('2 + (3 + 1) = ', 2+(3+1)) from __future__ import division, print_function import struct import ctypes import random # Py 2.7 PyIntObject: # - PyObject_HEAD # - PyObject_HEAD_EXTRA [usually nothing unless compiled with DEBUG] # - (Py_ssize_t) ob_refcnt # - (_typeobject) *ob_type # - (long) ob_ival # two platform-sized (32/64-bit) ints (ob_refcnt and *ob_type from above) offset = struct.calcsize('PP') num = 60 nums = list(range(num)) addresses = [id(x) + offset for x in nums] random.shuffle(nums) for a, n in zip(addresses, nums): ctypes.c_ssize_t.from_address(a).value = n print('2 + 2 =', 2+2) print('9 - 4 =', 9-4) print('5 * 6 =', 5*6) print('1 / 0 =\n', 1/0) print('(1 + 2) + 3 = ', (1+2)+3) print('1 + (2 + 3) = ', 1+(2+3)) print('(2 + 3) + 1 = ', (2+3)+1) print('2 + (3 + 1) = ', 2+(3+1)) >>> patch = '\x312\x2D7' >>> import ctypes;ctypes.c_int8.from_address(id(len(patch))+8).value=eval(patch) >>> 2 + 2 5 from __future__ import division, print_function import struct import ctypes import random # Py 2.7 PyIntObject: # - PyObject_HEAD # - PyObject_HEAD_EXTRA [usually nothing unless compiled with DEBUG] # - (Py_ssize_t) ob_refcnt # - (_typeobject) *ob_type # - (long) ob_ival # two platform-sized (32/64-bit) ints (ob_refcnt and *ob_type from above) offset = struct.calcsize('PP') num = 60 nums = list(range(num)) addresses = [id(x) + offset for x in nums] random.shuffle(nums) for a, n in zip(addresses, nums): ctypes.c_ssize_t.from_address(a).value = n print('2 + 2 =', 2+2) print('9 - 4 =', 9-4) print('5 * 6 =', 5*6) print('1 / 0 =\n', 1/0) print('(1 + 2) + 3 = ', (1+2)+3) print('1 + (2 + 3) = ', 1+(2+3)) print('(2 + 3) + 1 = ', (2+3)+1) print('2 + (3 + 1) = ', 2+(3+1)) >>> patch = '\x312\x2D7' >>> import ctypes;ctypes.c_int8.from_address(id(len(patch))+8).value=eval(patch) >>> 2 + 2 5 from __future__ import division, print_function import struct import ctypes import random # Py 2.7 PyIntObject: # - PyObject_HEAD # - PyObject_HEAD_EXTRA [usually nothing unless compiled with DEBUG] # - (Py_ssize_t) ob_refcnt # - (_typeobject) *ob_type # - (long) ob_ival # two platform-sized (32/64-bit) ints (ob_refcnt and *ob_type from above) offset = struct.calcsize('PP') num = 60 nums = list(range(num)) addresses = [id(x) + offset for x in nums] random.shuffle(nums) for a, n in zip(addresses, nums): ctypes.c_ssize_t.from_address(a).value = n print('2 + 2 =', 2+2) print('9 - 4 =', 9-4) print('5 * 6 =', 5*6) print('1 / 0 =\n', 1/0) print('(1 + 2) + 3 = ', (1+2)+3) print('1 + (2 + 3) = ', 1+(2+3)) print('(2 + 3) + 1 = ', (2+3)+1) print('2 + (3 + 1) = ', 2+(3+1))