123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- # -*- coding: utf-8 -*-
- import random
- from time import strftime, localtime
- import string
- import os
-
-
- def getran():
- ran0 = random.randint(0,11)
- ran1 = ran0
- while True:
- if ran1 == ran0:
- ran1 = random.randint(0,11)
- else:
- break
- ran2 = ran0
- while True:
- if ran2 == ran0 or ran2 == ran1:
- ran2 = random.randint(0,11)
- else:
- break
- ran3 = ran0
- while True:
- if ran3 == ran0 or ran3 == ran1 or ran3 == ran2:
- ran3 = random.randint(0,11)
- else:
- break
- ran = []
- ran.append(ran0)
- ran.append(ran1)
- ran.append(ran2)
- ran.append(ran3)
- return ran
-
- def tostr(numlist):
- numto = {
- 10:'a',
- 11:'b',
- }
- count1 = len(numlist)
- strlist = []
- xx = 0
- while xx < count1:
- #这里要把10以上的转换为十六进制
- zz = numlist[xx]
- if zz > 9:
- yy = numto[zz]
- strlist.append(yy)
- xx = xx + 1
- else:
- yy = str(numlist[xx])
- strlist.append(yy)
- xx = xx + 1
- str0 = ''.join(strlist)
- return str0
-
- def getmac(bigmac,num0):
- #全部转换为小写
- mac = bigmac.lower()
- count0 = len(num0)
- ii =0
- passmac = []
- while ii < count0:
- mm = mac[num0[ii]]
- passmac.append(mm)
- ii = ii + 1
- password = ''.join(passmac)
- return password
-
- def encryDate(date):
- datekey = {
- '0':'ze','1':'im','2':'tw','3':'ee','4':'fr','5':'ve',
- '6':'ix','7':'se','8':'ei','9':'ni'
- }
- datestrlist = []
- for d in date :
- d1 = datekey[d]
- datestrlist.append(d1)
-
- datestr = ''.join(datestrlist)
- f = datestr[0:8]
- l = datestr[8:]
- newdatestr = l + f
- #把时间用:分割
- newy = date[:4]
- newm = date[4:6]
- newd = date[6:8]
- new = []
- new.append(newy)
- new.append(newm)
- new.append(newd)
- newstr = ':'.join(new)
- return newdatestr ,newstr
-
- def gettime():
- time = strftime("%Y-%m-%d %H:%M:%S", localtime())
- return time
-
- def ran16():
- ran_str = ''.join(random.sample(string.ascii_letters + string.digits, 16))
- rans = ran_str.lower()
- return rans
-
- def ran12():
- ran_str = ''.join(random.sample(string.ascii_letters + string.digits, 12))
- return ran_str
-
- def jid(ran0,num0):
- nid = []
- nid.append(ran0)
- nid.append(num0)
- id_str = '-'.join(nid)
- return id_str
-
- def jci(s0,s1,s2):
- news = []
- news.append(s0)
- xx = 0
- yy = 4
- ii = 0
- while ii < 4:
- x1 = xx + ii * 4
- y1 = yy + ii * 4
- str0 = s1[x1:y1]
- str1 = s2[x1:y1]
- news.append(str0)
- news.append(str1)
- ii = ii + 1
- ci_str = '-'.join(news)
- return ci_str
-
- def txtwri(path,s0,s1,s2,s3,s4,s5,s6,s7,s8):
- #整个重编吧
- with open(path,'w+') as lines:
- lines.write('Copyright (c) 2021, CMC and/or its affiliates. All rights reserved.\n')
- linestr = joins('User-computer-mac-address:',s0)
- lines.write(linestr)
- linestr1 = joins('Current run time:',s1)
- lines.write(linestr1)
- linestr2 = joins('deadline:',s2)
- lines.write(linestr2)
- linestr3 = joins('uc:',s3)
- lines.write(linestr3)
- lines.write('Sichuan Zhongshui chengkanyu Surveying & Mapping Engineering Co., Ltd. (CMC) is located in the beautiful Huanhua\n')
- lines.write('river of Chengdu, adjacent to the former residence of Du Fu, the great poet of Tang Dynasty, when he was living in\n')
- lines.write('Chengdu.\n\n')
- lines.write('Our company is a surveying and mapping geographic information services for the main business of high-tech\n')
- lines.write('enterprises, can provide users with more complete surveying and mapping geographic information engineering or\n')
- lines.write('technical project solutions.\n\n')
- lines.write('Over the years, we have provided a lot of high-quality surveying and mapping technical services for the construction\n')
- lines.write('of national super large hydropower stations such as Ertan, Xiluodu, Pubugou and Jinping I.\n\n')
- lines.write('username:CMC\n')
- linestr4 = joins('password:',s4)
- lines.write(linestr4)
- lines.write('\n')
- linestr5 = joins('header:',s5)
- lines.write(linestr5)
- linestr6 = joins('cf-request-id:',s6)
- lines.write(linestr6)
- lines.write('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)\n')
- lines.write('Chrome/87.0.4280.88 Safari/537.36\n\n')
- linestr7 = joins('product ID:',s7)
- lines.write(linestr7)
- linestr8 = joins('cipher:',s8)
- lines.write(linestr8)
-
-
- def joins(s0,s1):
- new = []
- new.append(s0)
- new.append(s1)
- new.append('\n')
- linestr = ''.join(new)
- return linestr
-
-
- if __name__ == '__main__':
- ts = ''
- errordata = 1
- # 将要运行的代码加到这里
- #这些都写死,打包成exe(框架写好,直接打包)
- mac = '9cfce80958a7'
- #b05cda2103a5
- date = '20230124'
- #看有没有D盘
- path = 'D:\\'
- # isExists=os.path.exists(path)
- # 判断结果
- # if not isExists:
- # # 如果不存在则创建目录
- # # 创建目录操作函数
- # path1 = 'E:\\'
- # isExists1=os.path.exists(path1)
- # if not isExists1:
- # path2 = 'F:\\'
- # isExists2=os.path.exists(path2)
- # if not isExists2:
- #
- # errordata = -1
- # else:
- # opath1 = 'F:\\CMCtbxLisence'
- # isExists4=os.path.exists(opath1)
- # if not isExists4:
- # os.makedirs(opath1)
- # outpath = 'F:\\CMCtbxLisence\\tbxLisence.txt'
- # else:
- # os.remove('F:\\CMCtbxLisence\\tbxLisence.txt')
- # outpath = 'F:\\CMCtbxLisence\\tbxLisence.txt'
- # else:
- # opath2 = 'E:\\CMCtbxLisence'
- # isExists5=os.path.exists(opath2)
- # if not isExists5:
- # os.makedirs(opath2)
- # outpath = 'E:\\CMCtbxLisence\\tbxLisence.txt'
- # else:
- # os.remove('E:\\CMCtbxLisence\\tbxLisence.txt')
- # outpath = 'E:\\CMCtbxLisence\\tbxLisence.txt'
- # else:
- # opath = 'D:\\CMCtbxLisence'
- # isExists3=os.path.exists(opath)
- # if not isExists3:
- # os.makedirs(opath)
- # outpath = 'D:\\CMCtbxLisence\\tbxLisence.txt'
- # else:
- # os.remove('D:\\CMCtbxLisence\\tbxLisence.txt')
- # outpath = 'D:\\CMCtbxLisence\\tbxLisence.txt'
- outpath = os.path.expandvars("%APPDATA%") + '\\CMCtbxLisence'
- isExists = os.path.exists(outpath)
- if not isExists:
- os.makedirs(outpath)
- outpath = os.path.expandvars("%APPDATA%") + '\\CMCtbxLisence\\tbxLisence.txt'
- netadd = 'http://www.sccehui.com/intro/24.html'
- aa = getran()
- num0 = sorted(aa)
- str1 = tostr(num0)
- #print (str1)
- bb = getmac(mac,num0)
- #print (bb)
- cc,dd = encryDate(date)
- #print (cc)
- #print (dd)
- stime = gettime()
- #print (stime)
- ee = ran16()
- #print (ee)
- ee1 = ran16()
- ee2 = ran16()
- ees = []
- ees.append(ee1)
- ees.append(ee2)
- eeid = ''.join(ees)
- #print eeid
- ee12 = ran12()
- pid = jid(ee12,str1)
- #print pid
- ff = ran16()
- ff1 = ran16()
- pci = jci(bb,ff,ff1)
- #print pci
- if errordata == -1:
- ts = u'没有找到DEF盘,请联系管理员'
- else:
- txtwri(outpath,mac,stime,dd,cc,ee,netadd,eeid,pid,pci)
- ts = u'完成!'
- input('press enter to exit')
|