Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Python
  4. How to secure Python application using license key?

How to secure Python application using license key?

Scheduled Pinned Locked Moved Python
tutorialquestionpythoncomregex
2 Posts 2 Posters 33 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alex Dunlop
    wrote on last edited by
    #1

    I want to secure my python app using an online license key. Consider the following simple example:

    import requests

    def license():
    # The list with all keys.
    keys = requests.get("http://yourlink.com/licensekeys.txt").text
    # keys = ["key1", "key2", "key3"]

    # License key from user.
    keyfromuser = "mykey"
    
    for key in keys.splitlines():
        if key == keyfromuser:
            # Code when key match.
            return
    
    # Code if the key don't match.
    exit()
    

    license()

    Anybody can open my code in notepad and make some changes to disable the license key requirement. What is the best strategy to implement license approach to make it harder to beginner and intermediate level programmers to reverse engineer my app?

    L 1 Reply Last reply
    0
    • A Alex Dunlop

      I want to secure my python app using an online license key. Consider the following simple example:

      import requests

      def license():
      # The list with all keys.
      keys = requests.get("http://yourlink.com/licensekeys.txt").text
      # keys = ["key1", "key2", "key3"]

      # License key from user.
      keyfromuser = "mykey"
      
      for key in keys.splitlines():
          if key == keyfromuser:
              # Code when key match.
              return
      
      # Code if the key don't match.
      exit()
      

      license()

      Anybody can open my code in notepad and make some changes to disable the license key requirement. What is the best strategy to implement license approach to make it harder to beginner and intermediate level programmers to reverse engineer my app?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You put the functionality in a web service. No service without a valid key.

      "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups