Advertisement
corot7b2

gerar.py

Aug 20th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. #!/usr/bin env python
  2.  
  3.  
  4. #
  5. #
  6. # bruno-santos /19/08/2020
  7. #
  8. #
  9. import os
  10. from random import randint
  11.  
  12.  
  13. def clear(arquivo):
  14.  
  15. abrir=open(arquivo,"rt")
  16.  
  17.  
  18. def progresso(total,contador):
  19. porcentagem = (contador * 100)/total
  20. print "\33[6HProgresso -> ",porcentagem, "%"
  21. def main(leng,arquivo):
  22.  
  23. print "\33[3;10H\033[31mGERADOR \033[0m"
  24. numero = 81000000
  25. ano_zero=1900
  26. dia_zero=01
  27. mes_zero=01
  28. data_0 = " "#dia/mes/ano
  29. data_1 = " "#mes/dia/ano
  30. data_2 = " "#ano/dia/mes
  31. data_3 = " "#ano/mes/dia
  32. data_4 = " "#dia/ano/mes
  33. data_5 = " "#diamesano
  34. total = leng
  35. contador = 0
  36. criar = open (arquivo,"a+")
  37. alfa = "abcdefghijklmnopqrstvxywz0123456789ABCDEFGHIJKLMNOPQRSTUVXYWZ_@!#"
  38. alfa = list(alfa)
  39. tm = len(alfa) - 1
  40. string = " "
  41.  
  42. while contador != total:
  43.  
  44. numero = numero + 1
  45. criar.write(str(numero)+"\n")
  46. a = randint(0,tm)
  47. b = randint(0,tm)
  48. c = randint(0,tm)
  49. d = randint(0,tm)
  50. e = randint(0,tm)
  51. f = randint(0,tm)
  52. g = randint(0,tm)
  53. h = randint(0,tm)
  54.  
  55. string = str(alfa[a])
  56. string += str(alfa[b])
  57. string += str(alfa[c])
  58. string += str(alfa[d])
  59. string += str(alfa[e])
  60. string += str(alfa[f])
  61. string += str(alfa[g])
  62. string += str(alfa[h])
  63.  
  64. data_0 = str(dia_zero)+str("/")+str(mes_zero)+str("/")+str(ano_zero)
  65. data_1 = str(dia_zero)+str("/")+str(ano_zero)+str("/")+str(mes_zero)
  66. data_2 = str(mes_zero)+str("/")+str(dia_zero)+str("/")+str(ano_zero)
  67. data_3 = str(mes_zero)+str("/")+str(ano_zero)+str("/")+str(dia_zero)
  68. data_4 = str(ano_zero)+str("/")+str(dia_zero)+str("/")+str(mes_zero)
  69. data_5 = str(dia_zero)+str(mes_zero)+str(ano_zero)
  70. if ano_zero < 2021:
  71.  
  72. if dia_zero < 32:
  73. dia_zero = dia_zero + 1
  74. if mes_zero < 12:
  75. mes_zero = mes_zero + 1
  76. elif mes_zero == 12 and dia_zero == 32:
  77. mes_zero = 001
  78. dia_zero = 001
  79. ano_zero = ano_zero + 1
  80.  
  81. criar.write(string+"\n")
  82. if ano_zero < 2020:
  83.  
  84. criar.write(data_0+"\n")
  85. criar.write(data_1+"\n")
  86. criar.write(data_2+"\n")
  87. criar.write(data_3+"\n")
  88. criar.write(data_4+"\n")
  89. criar.write(data_5+"\n")
  90.  
  91.  
  92. print "\33[7HSenha atual -> \033[31m", numero,"\033[0m"
  93. print "\33[7;15H \033[31m",string, "\033[0m"
  94.  
  95. contador = contador + 1
  96. progresso(total,contador)
  97.  
  98.  
  99.  
  100. criar.close()
  101.  
  102. print "\33[8;0HNome do arquivo -> ", arquivo
  103. print "\33[9;0HConcluido!"
  104.  
  105. leng = input("digite a quantidade de numeros:")
  106. arquivo = raw_input("digite o nome para o arquivo de saida:")
  107.  
  108. os.system("clear")
  109.  
  110.  
  111.  
  112.  
  113. main(leng,arquivo)
  114.  
  115.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement