Advertisement
Guest User

Untitled

a guest
Feb 1st, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.97 KB | None | 0 0
  1. import random
  2.  
  3. def buildjson(accts, proxies, sizes, auth, startacct, startproxy):
  4. """
  5.  
  6. accts file: user:pass
  7. proxy file: ip:port:user:pass
  8. """
  9. acctcount = 0
  10. proxycount = 0
  11. file = open('data.json', 'w')
  12. if accts != "":
  13. acctlen = sum(1 for line in open(accts))
  14. accts = open(accts)
  15. if proxies != "":
  16. proxylen = sum(1 for line in open(proxies))
  17. proxies = open(proxies)
  18. file.write('{\n')
  19. if accts != "":
  20. file.write(' "accounts": {\n')
  21. for acct in accts:
  22. if acctcount == 0:
  23. acct = acct.strip("\n")
  24. format = acct.split(":")
  25. user = format.index("user")
  26. pw = format.index("pass")
  27. startacct -= 1
  28. else:
  29. lst = acct.split(":")
  30. file.write(' "'+str(startacct)+'": {\n')
  31. file.write(' "carted": "0",\n')
  32. file.write(' "password": "'+lst[pw].strip("\n")+'",\n')
  33. file.write(' "size": "' + random.choice(sizes) + '",\n')
  34. file.write(' "username": "'+lst[user].strip("\n")+'"\n')
  35. if acctcount == acctlen-1:
  36. file.write(' }\n')
  37. else:
  38. file.write(' },\n')
  39. acctcount += 1
  40. startacct += 1
  41. file.write(' },\n')
  42. if proxies != "":
  43. file.write(' "proxies": {\n')
  44. for proxy in proxies:
  45. if proxycount == 0:
  46. startproxy -= 1
  47. proxy = proxy.strip("\n")
  48. format = proxy.split(":")
  49. if auth == True:
  50. user = format.index("user")
  51. pw = format.index("pass")
  52. ip = format.index("ip")
  53. port = format.index("port")
  54. else:
  55. lst = proxy.split(":")
  56. file.write(' "' + str(startproxy) + '": {\n')
  57. file.write(' "ip": "'+lst[ip].strip("\n")+'",\n')
  58. if auth == True:
  59. file.write(' "password": "' + lst[pw].strip("\n") + '",\n')
  60. else:
  61. file.write(' "password": "",\n')
  62. file.write(' "port": "' + lst[port].strip("\n") + '",\n')
  63. if auth == True:
  64. file.write(' "username": "' + lst[user].strip("\n") + '"\n')
  65. else:
  66. file.write(' "username": ""\n')
  67. if proxycount == proxylen-1:
  68. file.write(' }\n')
  69. else:
  70. file.write(' },\n')
  71. proxycount += 1
  72. startproxy += 1
  73. file.write(' }\n')
  74. file.write('}')
  75.  
  76. def main():
  77. print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
  78. print("$ __ __ _____ $")
  79. print("$ | \\/ | ___ _ __ ___ ___| ___|__ _ __ ___ ___ $")
  80. print("$ | |\\/| |/ _ \\ '_ ` _ \\ / _ \ |_ / _ \\| '__/ __/ _ \\$")
  81. print("$ | | | | __/ | | | | | __/ _| (_) | | | (_| __/$")
  82. print("$ |_|__|_|\\___|_| |_| |_|\\___|_| \\___/|_| \\___\\___|$")
  83. print("$ / ___|___ _ ____ _____ _ __| |_ ___ _ __ $")
  84. print("$ | | / _ \\| '_ \\ \\ / / _ \\ '__| __/ _ \\ '__| $")
  85. print("$ | |__| (_) | | | \\ V / __/ | | || __/ | $")
  86. print("$ \\____\\___/|_| |_|\\_/ \\___|_| \\__\\___|_| $")
  87. print("$ $")
  88. print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
  89. print("")
  90. print("By BrianBoko The Smooth Voiced God")
  91. print("")
  92. print("Make sure your files have one line at the top to show how they are formatted!")
  93. print("Please use the following keywords for formatting:")
  94. print("user:pass:ip:port")
  95. print("You can arrange them in any order to correspond with your specific files.")
  96. print("")
  97. sizes = []
  98. while True:
  99. size = input("Enter at least one size to add to your account list then hit enter with no data to continue: ")
  100. if size == "":
  101. break
  102. else:
  103. sizes.append(size)
  104. accts = input("Enter the accounts txt file (or press enter for proxies only): ")
  105. proxies = input("Enter the proxies txt file (or press enter for accounts only): ")
  106. auth = input("Are you using authenticated proxies (Y/N): ")
  107. if auth == "Y":
  108. auth = True
  109. startacct = input("Enter a number to start your account conversion from (Makes it easier to copy paste newly converted accounts to old json file. Enter 0 if starting fresh.)")
  110. startproxy = input("Enter a number to start your proxy conversion from (Makes it easier to copy paste newly converted accounts to old json file. Enter 0 if starting fresh.)")
  111. buildjson(accts, proxies, sizes, auth, int(startacct), int(startproxy))
  112.  
  113. if __name__ == '__main__':
  114. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement