コード例 #1
0
ファイル: msnsend.py プロジェクト: waitingzeng/ttwait
    def work(self, name, id=0):
        try:
            line = self.accounts.get_rnd()
            if line.find('----') != -1:
                account, psw = line.split('----', 1)
            else:
                account = line.split('\t')[0]
                psw = '846266'
        except NotDataException:
            mysignal.ALIVE = False
            return

        self.msn_ct += 1
        msn_ct = self.msn_ct
        #self.log.error('%d %s begin connect' % (msn_ct, account))
        app = MSN()
        T = DiffTime()
        try:
            res = app.connect(account, psw)
        except TimeoutException:
            self.log.error("$d %s login timeout usetime %s", msn_ct, account, T.get_diff())
            return
        if not res:
            self.log.error('%d %s %s login fail, usetime %s' % (msn_ct, account, psw, T.get_diff()))
            self.accounts.set_fail(line)
            return
        else:
            self.log.error('%d %s login success usetime %s' % (msn_ct, account, T.get_diff()))
        try:
            self.send_members_oim(app, account, psw, msn_ct, self.msgs, T)
        except:
            self.log.exception('%s %s send fail', account, psw)
            pass
        app.disconnect()
コード例 #2
0
ファイル: addfriend.py プロジェクト: waitingzeng/ttwait
    def _work(self, name, id):
        line = self.accounts.get_rnd()
        if line.find("----") != -1:
            account, psw = line.split("----", 1)
        else:
            account = line.split("\t")[0]
            psw = "846266"
        account = account.strip()
        psw = psw.strip()
        msn = MSN(self.wait_chl)
        try:
            ret = msn.connect(account, psw)
        except TimeoutException:
            log.trace("%s login timeout", account)
            return
        if ret:
            # log.trace("%s login success", account)

            self.account_success += 1
            for i in range(self.conf.add_num):
                to_email = self.get_to()
                ret = msn.add_contact(to_email, 1, self.hello)
                if ret == 0:
                    members = msn.get_allow_email()
                    num = members and len(members) or 0
                    if not self.name and num:
                        self.accounts.update_contact(account, num)

                    self.total += 1
                    log.trace("%s add %s success friends %s", account, to_email, num)

                # else:
                #    log.trace('%s add %s fail ret %s friends %s', account, to_email, ret, num)
                #    break

        else:
            # log.trace('%s %s login fail', account, psw)
            self.accounts.set_fail(line)
            self.account_fail += 1