def ban_user(usr): warning(f"ban user: {usr}") return ( DarkNet_User.update({"useful": False}) .where(DarkNet_User.user == usr) .execute() )
def Login(self): """ ### 再次尝试 1.因为网络问题重试 ### 重新注册 2.因为账户被封重试 3.因为账户认证错误重试 """ self.warn("Login...") url = f"http://{self.domain}/ucp.php?mode=login" data = { "username": self.usr, "password": self.pwd, "login": "******", "redirect": f"./index.php&sid={self.sid}", } resp = self.session.post(url, data=data, verify=False, timeout=120) self.sid = "".join(re.findall("sid=(.*?)'", resp.text)[:1]) if self.usr not in resp.text and "暗网欢迎您" not in resp.text: self.error("Auth faild") self.SaveError("Autherror.html", resp) if "已被封禁" in resp.text: DarkNet_User.update({"useful": False}).where( DarkNet_User.user == self.usr ).execute() self.Reg() raise ValueError else: self.report("Auth Success") self.types = { item(".index_list_title") .attr("href") .split("=")[1] .split("&")[0]: item("tr:nth-child(1) > td") .text() .split()[0] for item in jq(resp.text)(".ad_table_b").items() } self.report(self.types)
def Login(self): """ ### 再次尝试 1.因为网络问题重试 ### 重新注册 2.因为账户被封重试 3.因为账户认证错误重试 """ self.warn('Login...') url = f'http://{self.domain}/ucp.php?mode=login' data = { "username": self.usr, "password": self.pwd, "login": "******", "redirect": f"./index.php&sid={self.sid}" } resp = self.session.post(url, data=data, verify=False, timeout=120) self.sid = ''.join(re.findall("sid=(.*?)'", resp.text)[:1]) self.info(f"SID: {self.sid}") if self.usr not in resp.text: self.error('Auth faild') self.SaveError('Autherror.html', resp) if "已被封禁" in resp.text: DarkNet_User.update({ "useful": False }).where(DarkNet_User.user == self.usr).execute() self.Reg() raise ValueError else: self.report('Auth Success') self.types = { item('.index_list_title').attr('href').split('=')[1].split('&') [0]: item('tr:nth-child(1) > td').text().split()[0] for item in jq(resp.text)('.ad_table_b').items() } self.report(self.types)
def ban_user(usr): return ( DarkNet_User.update({"useful": False}) .where(DarkNet_User.user == usr) .execute() )