|
...
|
...
|
@@ -87,7 +87,8 @@ class Monitor(callback.CallBack): |
|
|
|
try:
|
|
|
|
result, email, password, cookie, user_agent = self.selenium_login(email, password, cookie)
|
|
|
|
if result:
|
|
|
|
self.onChangSucceed(email, '匹配设备指纹成功', data={'email': email, 'password': password, 'cookie': cookie})
|
|
|
|
self.onChangSucceed(email, '匹配设备指纹成功',
|
|
|
|
data={'email': email, 'password': password, 'cookie': cookie})
|
|
|
|
except Exception as err:
|
|
|
|
self.onChangEnv(email, 'changeError', str(err))
|
|
|
|
raise err
|
|
...
|
...
|
@@ -101,7 +102,9 @@ class Monitor(callback.CallBack): |
|
|
|
self.onLoggedIn(client)
|
|
|
|
return client.info()
|
|
|
|
else:
|
|
|
|
user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
|
|
|
|
if user_agent is None or user_agent == '':
|
|
|
|
user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) " \
|
|
|
|
"Chrome/84.0.4147.105 Safari/537.36"
|
|
|
|
obj = self.onLoggingIn(email, password, cookie, user_agent, proxy)
|
|
|
|
try:
|
|
|
|
client = FacebookClient(obj, logout_call=functools.partial(self.logout, obj.email),
|
|
...
|
...
|
@@ -126,7 +129,7 @@ class Monitor(callback.CallBack): |
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
email = email.strip()
|
|
|
|
password = email.strip()
|
|
|
|
password = password.strip()
|
|
|
|
import random
|
|
|
|
capabilities = DesiredCapabilities.CHROME
|
|
|
|
chrome_options = webdriver.ChromeOptions()
|
|
...
|
...
|
@@ -165,26 +168,27 @@ class Monitor(callback.CallBack): |
|
|
|
print(email, '输入密码')
|
|
|
|
browser.find_element_by_xpath('//*[@id="m_login_password"]').send_keys(password)
|
|
|
|
browser.find_element_by_xpath('//*[@id="u_0_4"]/button').click()
|
|
|
|
i = 0
|
|
|
|
while browser.current_url == mainUrl:
|
|
|
|
time.sleep(2)
|
|
|
|
i += 1
|
|
|
|
if i >= 3:
|
|
|
|
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
print(email, '等待页面', browser.current_url)
|
|
|
|
continue
|
|
|
|
if 'save-device' in browser.current_url and 'checkpoint' not in browser.current_url:
|
|
|
|
self.onChangEnv(email, 'changeSaveFinger', '保存设备指纹...')
|
|
|
|
print(email, '保存设备点击ok')
|
|
|
|
browser.find_element_by_xpath('//*[@id="root"]/div[1]/div/div/div[3]/div[2]/form/div/button').click()
|
|
|
|
# user_agent_ = browser.execute_script("return navigator.userAgent") # 获取ua头部
|
|
|
|
i = 0
|
|
|
|
while browser.current_url == mainUrl:
|
|
|
|
time.sleep(2)
|
|
|
|
i += 1
|
|
|
|
if i >= 3:
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
print(email, '等待页面', browser.current_url)
|
|
|
|
continue
|
|
|
|
if 'save-device' in browser.current_url and 'checkpoint' not in browser.current_url:
|
|
|
|
self.onChangEnv(email, 'changeSaveFinger', '保存设备指纹...')
|
|
|
|
print(email, '保存设备点击ok')
|
|
|
|
browser.find_element_by_xpath('//*[@id="root"]/div[1]/div/div/div[3]/div[2]/form/div/button').click()
|
|
|
|
# user_agent_ = browser.execute_script("return navigator.userAgent") # 获取ua头部
|
|
|
|
user_agent_ = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36' # 因为协议初始化必须要PCua头部
|
|
|
|
print(email, '提取user_agent_', user_agent_)
|
|
|
|
from utils.encpass import deal_cookies
|
|
|
|
cookie_ = deal_cookies(browser.get_cookies())
|
|
|
|
print(email, '提取cookies', cookie_)
|
|
|
|
print("判断连接", browser.current_url)
|
|
|
|
time.sleep(2)
|
|
|
|
if 'checkpoint' in browser.current_url:
|
|
|
|
self.onChangEnv(email, 'changeError', '登录失败:帐号封锁')
|
|
|
|
browser.close()
|
|
...
|
...
|
@@ -206,7 +210,7 @@ class Monitor(callback.CallBack): |
|
|
|
self.onChangEnv(email, 'changeMatching', f'匹配设备指纹{i}...')
|
|
|
|
browser.find_element_by_name(action).click()
|
|
|
|
browser.get('https://m.facebook.com/home.php')
|
|
|
|
time.sleep(random.randint(1, 3))
|
|
|
|
# time.sleep(random.randint(1, 3))
|
|
|
|
browser.close()
|
|
|
|
return True, email, password, cookie_, user_agent_
|
|
|
|
|
|
...
|
...
|
@@ -354,6 +358,7 @@ class Monitor(callback.CallBack): |
|
|
|
unicode = cmd.get('unicode', False)
|
|
|
|
payload = self.decode_payload(payload) if unicode else payload
|
|
|
|
'topic' in cmd and lru_cache.set(taskid, cmd.get('topic'), ttl=180)
|
|
|
|
print('任务类型', type_)
|
|
|
|
if type_ == 'change':
|
|
|
|
kwargs = parameter.join(self.change, payload)
|
|
|
|
client = Munch(email=kwargs.get('email'))
|
|
...
|
...
|
@@ -377,15 +382,16 @@ class Monitor(callback.CallBack): |
|
|
|
self.executor.submit(self.thread, client, taskid, kwargs)
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
client = self._get_member(target)
|
|
|
|
assert hasattr(client, 'extend'), '帐号未登录'
|
|
|
|
if hasattr(client.extend, type_):
|
|
|
|
func = getattr(client.extend, type_)
|
|
|
|
else:
|
|
|
|
func = getattr(client, type_)
|
|
|
|
assert func, '未找到该类型指令'
|
|
|
|
kwargs = parameter.join(func, payload)
|
|
|
|
self.executor.submit(self.thread, client, taskid, kwargs)
|
|
|
|
if type_ not in ['change']:
|
|
|
|
client = self._get_member(target)
|
|
|
|
assert hasattr(client, 'extend'), '帐号未登录'
|
|
|
|
if hasattr(client.extend, type_):
|
|
|
|
func = getattr(client.extend, type_)
|
|
|
|
else:
|
|
|
|
func = getattr(client, type_)
|
|
|
|
assert func, '未找到该类型指令'
|
|
|
|
kwargs = parameter.join(func, payload)
|
|
|
|
self.executor.submit(self.thread, client, taskid, kwargs)
|
|
|
|
except Exception as err:
|
|
|
|
self._task_(type_, Munch(email=target), taskid, code=TaskStatus.EXCEPTION, msg={'error': repr(err)})
|
|
|
|
|
...
|
...
|
|