Tag Archives: compiler

Python script to single .exe

It’s plain annoying when you want to show someone your amazing Python script but they don’t have Python (and all of your libraries) installed. It’d be nice to just bundle everything in one executable, wouldn’t it?

Download py2exe !

When installed, open a command prompt and enter:

build_exe "the_name_of_my_script.py" --bundle-files 0 -O -c

…which will gather all needed libraries, optimize them (the -O option), compress them (-c) and bundle them into one big file inside a folder called ‘dist’.

PyPy – Extremely fast Python

When using Python you may want some more speed sometimes. Maybe when bruteforcing CRC’s and such (hehe).

PyPy comes with a Just-In-Time compiler, which is way faster than the standard CPython interpreter.

Usage:

  1. Download and extract PyPy
  2. Open cmd and cd into your PyPy directory
  3. Use pypy.exe just like you’d use python.exe .
  4. Copy any needed libraries from your main Python site-packages folder (Ex. C:\Python34\Lib\site-packages\ to the PyPy site-packages C:\pypy3-2.4.0-win32\site-packages\ folder.)
  5. ??
  6. Profit

My CRC brute forcer suddenly finished within 30 seconds instead of 5 minutes.
I ran it again but this time with ‘detail-mode’ set to 4 so it’d use ‘Letters, numbers, punctuation and whitespace’. This brings the total of combinations to try up to a whopping 166750… Which is ~9 times more than on mode 1.

Enter string to find CRC16 collisions for: sample text
CRC of target: 0xb40d

Enter level of detail:
         1. Only lowercase letters  (abc)
         2. Letters  (ABc)
         3. Letters and numbers  (ABc123)
         4. Letters, numbers, punctuation and whitespace  (ABc123 .,)
4

Generating CRC's of all combinations of 1 characters...
         (Total of 100 combinations)
         Nothing found.

Generating CRC's of all combinations of 2 characters...
         (Total of 4950 combinations)
         Nothing found.

Generating CRC's of all combinations of 3 characters...
         (Total of 161700 combinations)
         COLLISION FOUND: 3Qe: 0xb40d
         COLLISION FOUND: cQY: 0xb40d
         COLLISION FOUND: oQ\: 0xb40d
         COLLISION FOUND: wQV: 0xb40d
         COLLISION FOUND: GQB: 0xb40d
         COLLISION FOUND: KQG: 0xb40d
         COLLISION FOUND: SQM: 0xb40d
         COLLISION FOUND: 'Qj: 0xb40d
         COLLISION FOUND: +Qo: 0xb40d
         COLLISION FOUND: ?Q`: 0xb40d
         COLLISION FOUND: _QH: 0xb40d
         COLLISION FOUND: {QS: 0xb40d

Continue searching? Y/N N

It finished in about 2 minutes. Amazing.