工具箱相关
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

passwordtxt_e.py 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. # -*- coding: utf-8 -*-
  2. import random
  3. from time import strftime, localtime
  4. import string
  5. import os
  6. def getran():
  7. ran0 = random.randint(0,11)
  8. ran1 = ran0
  9. while True:
  10. if ran1 == ran0:
  11. ran1 = random.randint(0,11)
  12. else:
  13. break
  14. ran2 = ran0
  15. while True:
  16. if ran2 == ran0 or ran2 == ran1:
  17. ran2 = random.randint(0,11)
  18. else:
  19. break
  20. ran3 = ran0
  21. while True:
  22. if ran3 == ran0 or ran3 == ran1 or ran3 == ran2:
  23. ran3 = random.randint(0,11)
  24. else:
  25. break
  26. ran = []
  27. ran.append(ran0)
  28. ran.append(ran1)
  29. ran.append(ran2)
  30. ran.append(ran3)
  31. return ran
  32. def tostr(numlist):
  33. numto = {
  34. 10:'a',
  35. 11:'b',
  36. }
  37. count1 = len(numlist)
  38. strlist = []
  39. xx = 0
  40. while xx < count1:
  41. #这里要把10以上的转换为十六进制
  42. zz = numlist[xx]
  43. if zz > 9:
  44. yy = numto[zz]
  45. strlist.append(yy)
  46. xx = xx + 1
  47. else:
  48. yy = str(numlist[xx])
  49. strlist.append(yy)
  50. xx = xx + 1
  51. str0 = ''.join(strlist)
  52. return str0
  53. def getmac(bigmac,num0):
  54. #全部转换为小写
  55. mac = bigmac.lower()
  56. count0 = len(num0)
  57. ii =0
  58. passmac = []
  59. while ii < count0:
  60. mm = mac[num0[ii]]
  61. passmac.append(mm)
  62. ii = ii + 1
  63. password = ''.join(passmac)
  64. return password
  65. def encryDate(date):
  66. datekey = {
  67. '0':'ze','1':'im','2':'tw','3':'ee','4':'fr','5':'ve',
  68. '6':'ix','7':'se','8':'ei','9':'ni'
  69. }
  70. datestrlist = []
  71. for d in date :
  72. d1 = datekey[d]
  73. datestrlist.append(d1)
  74. datestr = ''.join(datestrlist)
  75. f = datestr[0:8]
  76. l = datestr[8:]
  77. newdatestr = l + f
  78. #把时间用:分割
  79. newy = date[:4]
  80. newm = date[4:6]
  81. newd = date[6:8]
  82. new = []
  83. new.append(newy)
  84. new.append(newm)
  85. new.append(newd)
  86. newstr = ':'.join(new)
  87. return newdatestr ,newstr
  88. def gettime():
  89. time = strftime("%Y-%m-%d %H:%M:%S", localtime())
  90. return time
  91. def ran16():
  92. ran_str = ''.join(random.sample(string.ascii_letters + string.digits, 16))
  93. rans = ran_str.lower()
  94. return rans
  95. def ran12():
  96. ran_str = ''.join(random.sample(string.ascii_letters + string.digits, 12))
  97. return ran_str
  98. def jid(ran0,num0):
  99. nid = []
  100. nid.append(ran0)
  101. nid.append(num0)
  102. id_str = '-'.join(nid)
  103. return id_str
  104. def jci(s0,s1,s2):
  105. news = []
  106. news.append(s0)
  107. xx = 0
  108. yy = 4
  109. ii = 0
  110. while ii < 4:
  111. x1 = xx + ii * 4
  112. y1 = yy + ii * 4
  113. str0 = s1[x1:y1]
  114. str1 = s2[x1:y1]
  115. news.append(str0)
  116. news.append(str1)
  117. ii = ii + 1
  118. ci_str = '-'.join(news)
  119. return ci_str
  120. def txtwri(path,s0,s1,s2,s3,s4,s5,s6,s7,s8):
  121. #整个重编吧
  122. with open(path,'w+') as lines:
  123. lines.write('Copyright (c) 2021, CMC and/or its affiliates. All rights reserved.\n')
  124. linestr = joins('User-computer-mac-address:',s0)
  125. lines.write(linestr)
  126. linestr1 = joins('Current run time:',s1)
  127. lines.write(linestr1)
  128. linestr2 = joins('deadline:',s2)
  129. lines.write(linestr2)
  130. linestr3 = joins('uc:',s3)
  131. lines.write(linestr3)
  132. lines.write('Sichuan Zhongshui chengkanyu Surveying & Mapping Engineering Co., Ltd. (CMC) is located in the beautiful Huanhua\n')
  133. 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')
  134. lines.write('Chengdu.\n\n')
  135. lines.write('Our company is a surveying and mapping geographic information services for the main business of high-tech\n')
  136. lines.write('enterprises, can provide users with more complete surveying and mapping geographic information engineering or\n')
  137. lines.write('technical project solutions.\n\n')
  138. lines.write('Over the years, we have provided a lot of high-quality surveying and mapping technical services for the construction\n')
  139. lines.write('of national super large hydropower stations such as Ertan, Xiluodu, Pubugou and Jinping I.\n\n')
  140. lines.write('username:CMC\n')
  141. linestr4 = joins('password:',s4)
  142. lines.write(linestr4)
  143. lines.write('\n')
  144. linestr5 = joins('header:',s5)
  145. lines.write(linestr5)
  146. linestr6 = joins('cf-request-id:',s6)
  147. lines.write(linestr6)
  148. lines.write('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)\n')
  149. lines.write('Chrome/87.0.4280.88 Safari/537.36\n\n')
  150. linestr7 = joins('product ID:',s7)
  151. lines.write(linestr7)
  152. linestr8 = joins('cipher:',s8)
  153. lines.write(linestr8)
  154. def joins(s0,s1):
  155. new = []
  156. new.append(s0)
  157. new.append(s1)
  158. new.append('\n')
  159. linestr = ''.join(new)
  160. return linestr
  161. if __name__ == '__main__':
  162. ts = ''
  163. errordata = 1
  164. # 将要运行的代码加到这里
  165. #这些都写死,打包成exe(框架写好,直接打包)
  166. mac = '9cfce80958a7'
  167. #b05cda2103a5
  168. date = '20230124'
  169. #看有没有D盘
  170. path = 'D:\\'
  171. # isExists=os.path.exists(path)
  172. # 判断结果
  173. # if not isExists:
  174. # # 如果不存在则创建目录
  175. # # 创建目录操作函数
  176. # path1 = 'E:\\'
  177. # isExists1=os.path.exists(path1)
  178. # if not isExists1:
  179. # path2 = 'F:\\'
  180. # isExists2=os.path.exists(path2)
  181. # if not isExists2:
  182. #
  183. # errordata = -1
  184. # else:
  185. # opath1 = 'F:\\CMCtbxLisence'
  186. # isExists4=os.path.exists(opath1)
  187. # if not isExists4:
  188. # os.makedirs(opath1)
  189. # outpath = 'F:\\CMCtbxLisence\\tbxLisence.txt'
  190. # else:
  191. # os.remove('F:\\CMCtbxLisence\\tbxLisence.txt')
  192. # outpath = 'F:\\CMCtbxLisence\\tbxLisence.txt'
  193. # else:
  194. # opath2 = 'E:\\CMCtbxLisence'
  195. # isExists5=os.path.exists(opath2)
  196. # if not isExists5:
  197. # os.makedirs(opath2)
  198. # outpath = 'E:\\CMCtbxLisence\\tbxLisence.txt'
  199. # else:
  200. # os.remove('E:\\CMCtbxLisence\\tbxLisence.txt')
  201. # outpath = 'E:\\CMCtbxLisence\\tbxLisence.txt'
  202. # else:
  203. # opath = 'D:\\CMCtbxLisence'
  204. # isExists3=os.path.exists(opath)
  205. # if not isExists3:
  206. # os.makedirs(opath)
  207. # outpath = 'D:\\CMCtbxLisence\\tbxLisence.txt'
  208. # else:
  209. # os.remove('D:\\CMCtbxLisence\\tbxLisence.txt')
  210. # outpath = 'D:\\CMCtbxLisence\\tbxLisence.txt'
  211. outpath = os.path.expandvars("%APPDATA%") + '\\CMCtbxLisence'
  212. isExists = os.path.exists(outpath)
  213. if not isExists:
  214. os.makedirs(outpath)
  215. outpath = os.path.expandvars("%APPDATA%") + '\\CMCtbxLisence\\tbxLisence.txt'
  216. netadd = 'http://www.sccehui.com/intro/24.html'
  217. aa = getran()
  218. num0 = sorted(aa)
  219. str1 = tostr(num0)
  220. #print (str1)
  221. bb = getmac(mac,num0)
  222. #print (bb)
  223. cc,dd = encryDate(date)
  224. #print (cc)
  225. #print (dd)
  226. stime = gettime()
  227. #print (stime)
  228. ee = ran16()
  229. #print (ee)
  230. ee1 = ran16()
  231. ee2 = ran16()
  232. ees = []
  233. ees.append(ee1)
  234. ees.append(ee2)
  235. eeid = ''.join(ees)
  236. #print eeid
  237. ee12 = ran12()
  238. pid = jid(ee12,str1)
  239. #print pid
  240. ff = ran16()
  241. ff1 = ran16()
  242. pci = jci(bb,ff,ff1)
  243. #print pci
  244. if errordata == -1:
  245. ts = u'没有找到DEF盘,请联系管理员'
  246. else:
  247. txtwri(outpath,mac,stime,dd,cc,ee,netadd,eeid,pid,pci)
  248. ts = u'完成!'
  249. input('press enter to exit')