Skip to main content
Commonmark migration
Source Link

###A more obfuscated version

A more obfuscated version

###A more obfuscated version

A more obfuscated version

added 420 characters in body
Source Link
Nick T
  • 3.3k
  • 2
  • 23
  • 34

###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") 
added 68 characters in body
Source Link
Nick T
  • 3.3k
  • 2
  • 23
  • 34
>>> 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)) 
CPython obviously with all the ctypes, etc.
Source Link
Nick T
  • 3.3k
  • 2
  • 23
  • 34
Loading
better code
Source Link
Nick T
  • 3.3k
  • 2
  • 23
  • 34
Loading
added 655 characters in body
Source Link
Nick T
  • 3.3k
  • 2
  • 23
  • 34
Loading
Source Link
Nick T
  • 3.3k
  • 2
  • 23
  • 34
Loading