help about a python script?
hi, could you someone explain this script, line by line? thanks.. #! /usr/bin/env python3 __author__ = 'Felis-Sapiens' from sys import argv def gen_key(mac): charset = '02345679abcdefghijkmnpqrstuvwxyzACDEFGHJKLMNPQRSTUVWXYZ' tmp_key = '' xored_mac = bytearray(mac) for i in range(6, 0, -1): for j in range(i): if i != 6: xored_mac[j] ^= mac[i] tmp_key += charset[xored_mac[j] % 55] key = '' used = [0]*20 j = 7 for i in range(8): key += tmp_key[j] used[j] = 1 cnt = 0 for _ in range(20): j = (j + 1) % 20 cnt += used[j] == 0 if cnt == 8: break return key def main(): if len(argv) < 2: print('Usage:', __file__, 'MAC') return mac = argv[1].replace(':', '').replace('-', '').replace(' ', '') try: mac = bytes.fromhex(mac) except: print('ERROR: Invalid MAC ', argv[1]) return if len(mac) != 6: print('ERROR: Invalid MAC ', argv[1]) return print(gen_key(mac)) if __name__ == '__main__': main()