Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2021
11,954
3
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.48 KB | None | 3 0
  1. # Keygen program for Siglent oscilloscopes
  2.  
  3. import hashlib
  4.  
  5. # You get this by running "SCOPEID?" at the SCIP prompt and removing the dashes
  6. SCOPEID = '0000000000000000'
  7. # Replace this with your SN
  8. SN = 'SDS00000000000'
  9. # This is one of the four options below
  10. Model = 'SDS1000X-E'
  11. # 'SDS1000X-E', 'SDS2000X-E', 'SDS2000X+', 'SDS5000X', 'ZODIAC-'
  12.  
  13. bwopt = ('25M', '40M', '50M', '60M', '70M', '100M', '150M', '200M',
  14.          '250M', '300M', '350M', '500M', '750M', '1000M', 'MAX')
  15. otheropt = ('AWG', 'WIFI', 'MSO', 'FLX',
  16.             'CFD', 'I2S', '1553', 'FG', '16LA')
  17.  
  18. hashkey = '5zao9lyua01pp7hjzm3orcq90mds63z6zi5kv7vmv3ih981vlwn06txnjdtas3u2wa8msx61i12ueh14t7kqwsfskg032nhyuy1d9vv2wm925rd18kih9xhkyilobbgy'
  19.  
  20. def gen(x):
  21.     h = hashlib.md5((
  22.         hashkey +
  23.         (Model+'\n').ljust(32, '\x00') +
  24.         opt.ljust(5, '\x00') +
  25.         2*(((SCOPEID if opt in bwopt else SN) + '\n').ljust(32, '\x00')) +
  26.         '\x00'*16).encode('ascii')
  27.     ).digest()
  28.     key = ''
  29.     for b in h:
  30.         if (b <= 0x2F or b > 0x39) and (b <= 0x60 or b > 0x7A):
  31.             m = b % 0x24
  32.             b = m + (0x57 if m > 9 else 0x30)
  33.         if b == 0x30:
  34.             b = 0x32
  35.         if b == 0x31:
  36.             b = 0x33
  37.         if b == 0x6c:
  38.             b = 0x6d
  39.         if b == 0x6f:
  40.             b = 0x70
  41.         key += chr(b)
  42.     return key.upper()
  43.  
  44. for opt in bwopt:
  45.     print('{:5} {}'.format(opt, gen(SCOPEID)))
  46. for opt in otheropt:
  47.     print('{:5} {}'.format(opt, gen(SN)))
Advertisement
Comments
  • t1d
    t1d
    364 days
    # text 1.30 KB | 0 0
    1. Dear Maker,
    2.  
    3. Thank you so much for sharing this! I have a 1104X-E and I have made good progress with your instructions -- to a point. I have not been able to run the Python code successfully.
    4.  
    5. I downloaded Python v3.11, from the Microsoft App Store. I copied/pasted your code to NotePad. I adjusted the Scope ID and Serial number to my numbers (the last five changed to "#####," for personal security.) See RAW Paste Data ( I hope this is where I am supposed to put my code.) I copied the adjusted code to the Clipboard.
    6.  
    7. I opened Python and right clicked to paste the updated code. Windows gives me a warning and I accept. Python opens and automatically pastes my code on the page.
    8.  
    9. I know little of coding and nothing of Python, but it appears that the script runs automatically and fails =
    10. SyntaxError: invalid syntax
    11. >>> print('{:5} {}'.format(opt, gen(SN)))
    12.  
    13. I rather think that this is not related to the scope ID and serial numbers that I adjusted. However, please confirm the syntaxes are correct for both. Please also confirm that the code runs automatically and that I do not need to clean/compile/run it, in some manner. Of course, I need to know what to do to get things to work correctly, as well. Please be very specific with your instructions, step by step.
    14.  
    15. Thank you so much for your help!
    16. t1d
    17.  
    • t1d
      t1d
      362 days
      # text 0.48 KB | 0 0
      1. I used this on-line compiler and finally had success. I do not think that there is anything wrong with your instructions, or code. Thank you very much for sharing.
      2. https://www.programiz.com/python-programming/online-compiler/
      3. I now have my needed numbers.
      4. However, I used the on-line compiler out of desperation. I can only wonder what access I have given the dark web and who owns my computer, now. That is not a complaint, but rather a warning to others.
      5.  
      6. Much thanks. Cheers. t1d
    • ba2048
      208 days (edited)
      # text 0.34 KB | 0 0
      1. Late reply, but for any other would-be users: This error can come from running this script with Python 2.x instead of python 3.x. I just tried running it with Python 2.7 and I got an error similar to yours - and with Python 3.11 it worked fine.
      2.  
      3. Perhaps you had both Python 2 and Python 3 installed and accidentally ran the script using version 2?
Add Comment
Please, Sign In to add comment
Advertisement