How can I copy protect an executable file on a USB flash drive? [duplicate]

Well, I don't know why you have chosen to go with a scripting language like Python if you want to hide things or restrict uses.

You should think about using a compiled language like: C/C++, Java,..etc. To secure program itself from reverse engineering, that's a board topic.

To make things hard on the user, I though about a different approach which I didn't try: Use flash drive as dongle.

  • You program should check if the flash drive with this serial XXXXXX is connected.
  • You can go far and check where it's launched, if it is the same storage media.