-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMS-ACC-CREATOR.py
More file actions
102 lines (92 loc) · 5.02 KB
/
MS-ACC-CREATOR.py
File metadata and controls
102 lines (92 loc) · 5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait
import time
import os, random
from selenium.common.exceptions import NoSuchElementException
def randomString(length=16):
base_Str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'
random_str = ''
for i in range(length):
random_str += base_Str[random.randint(0, (len(base_Str) - 1))]
return random_str
# 前置操作
edge_options = webdriver.EdgeOptions()
edge_options.use_chromium = False
edge_options.add_experimental_option('useAutomationExtension', False)
edge_options.add_argument('--inprivate')
edge_options.add_experimental_option('excludeSwitches', ['enable-automation', 'enable-logging'])
driver = webdriver.Edge('msedgedriver.exe', options=edge_options)
wait = WebDriverWait(driver, 30)
os.system("cls || clear")
print("微软账户注册工具 - Kawakaze || 白洲アズサ")
# 创建Edge浏览器对象
print("这是一个自动创建MS账号的小程序 使用selenium执行 请确认相关依赖和msedgedriver.exe已经正确设置")
print("作者:白洲アズサ || Kawakaze")
print("𝓔𝓽 𝓸𝓷𝓶𝓲𝓪 𝓥𝓪𝓷𝓲𝓽𝓪𝓼")
print("更新地址:https://github.com/XokoukioX/AutoMSACC")
amount = 1
while True:
try:
amount = int(input("你想要创建多少个账号?\n> "))
if amount > 0: break
print("请检查你的输入")
except ValueError:
print("请检查你的输入")
pass
for x in range(amount):
email = randomString(10)
for y in range(5):
b = random.randint(0, 3)
if b == 0:
password = randomString(8)
elif b == 1:
password = randomString(5) + "!" + randomString(1)
else:
password = randomString(3) + "A" + randomString(2) + "!" + randomString(1)
driver.get(
"https://signup.live.com/signup?lcid=1033&wa=wsignin1.0&rpsnv=13&ct=1605407946&rver=7.0.6738.0&wp=MBI_SSL&wreply=https:%2F%2Faccount.microsoft.com%2Fauth%2Fcomplete-signin%3Fru%3Dhttps%253A%252F%252Faccount.microsoft.com%252F%253Frefp%253Dsignedout-index&lc=1033&id=292666&lw=1&fl=easi2&mkt=en-CN")
print("##################################")
print("Your Account is: " + 'a' + email + '@outlook.com')
print("Your password is: " + 'b' + password)
print("##################################")
time.sleep(2)
try:
driver.find_element(By.XPATH, '//*[@id="iSignupAction"]').click()
except NoSuchElementException:
pass
driver.find_element(By.XPATH, '//*[@id="MemberName"]').send_keys('a' + email + '@outlook.com')
time.sleep(1)
driver.find_element(By.XPATH, '//*[@id="iSignupAction"]').click()
WebDriverWait(driver, 200).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="PasswordInput"]'))).click()
driver.find_element(By.XPATH, '//*[@id="PasswordInput"]').send_keys('b' + password)
driver.find_element(By.XPATH, '//*[@id="iSignupAction"]').click()
WebDriverWait(driver, 200).until((EC.visibility_of_element_located((By.ID, "Country")))).click()
Select(driver.find_element(By.ID, "Country")).select_by_value("US")
Select(driver.find_element(By.ID, "BirthMonth")).select_by_value("1")
Select(driver.find_element(By.ID, "BirthDay")).select_by_value("1")
driver.find_element(By.ID, "BirthYear").send_keys("1984")
driver.find_element(By.ID, "iSignupAction").click()
WebDriverWait(driver, 20000).until(EC.visibility_of_element_located((By.ID, "enforcementFrame"))).click()
print("请通过人机验证")
WebDriverWait(driver, 2000).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="id__0"]'))).click()
try:
driver.find_element(By.XPATH, '//*[@id="id__0"]').click()
except NoSuchElementException:
pass
#询问是否保持登录
WebDriverWait(driver, 2000).until(EC.visibility_of_element_located((By.XPATH,
'/html/body/div[1]/div/div/div/div[2]/div[1]/div/div/div/div/div[2]/div[2]/div/form/div[3]/div[2]/div/div[2]/button'))).click()
#太久了 不知道这干嘛的,删了 :D
#WebDriverWait(driver,2000).until(EC.visibility_of_element_located((By.XPATH,'//*[@id="idSIButton9"]'))).click()
#检查是否到达账户页面
time.sleep(4)
if driver.find_element(By.XPATH,"/html/body/div/div[3]/div[1]/div[1]/div/div/div/div[2]/div/div/main/div[3]/div[1]/div/div[2]/div/div[1]/div[1]/div/div/div/div[2]/div/div/div/div/div/div[2]/div/div[3]/div/button/span/span/span").is_displayed():
email = str(email)
with open("accounts.txt", "a") as f:
f.write(f"{'a' + email + '@outlook.com'}----{'b' + password}\n")
else:
print("未找到相应的检测元素,请自行判断是否注册成功!")
#我很急 我写错COMMIT了,随便写点把他顶掉吧