コード例 #1
0
    def login(self, login, password):
        self.browser.select_form(nr=0)
        self.browser.set_all_readonly(False)
        try:
            self.browser['numero'] = login
            self.browser['code'] = password
        except ControlNotFoundError:
            try:
                self.browser['userLogin'] = login
                self.browser['userPassword'] = password
            except ControlNotFoundError:
                self.browser.controls.append(
                    ClientForm.TextControl('text', 'numero', {'value': ''}))
                self.browser.controls.append(
                    ClientForm.TextControl('text', 'code', {'value': ''}))
                self.browser.controls.append(
                    ClientForm.TextControl('text', 'userLogin', {'value': ''}))
                self.browser.controls.append(
                    ClientForm.TextControl('text', 'userPassword',
                                           {'value': ''}))
                self.browser['numero'] = login
                self.browser['code'] = password
                self.browser['userLogin'] = login
                self.browser['userPassword'] = password

        self.browser.submit()
コード例 #2
0
    def login(self, login, passwd):
        try:
            length = int(
                self.document.xpath('//input[@id="pass"]')
                [0].attrib['maxlength'])
        except (IndexError, KeyError):
            pass
        else:
            passwd = passwd[:length]

        self.browser.select_form(name='authen')
        try:
            self.browser['id'] = login.encode(self.browser.ENCODING)
            self.browser['pass'] = passwd.encode(self.browser.ENCODING)
        except ControlNotFoundError:
            self.browser.controls.append(
                ClientForm.TextControl(
                    'text', 'id',
                    {'value': login.encode(self.browser.ENCODING)}))
            self.browser.controls.append(
                ClientForm.TextControl(
                    'text', 'pass',
                    {'value': passwd.encode(self.browser.ENCODING)}))

        self.browser.submit(nologin=True)
コード例 #3
0
ファイル: pages.py プロジェクト: yang2lalang/weboob
 def renew(self, id):
     # find the good box
     input = self.document.find('//input[@value="%s"]' % id)
     self.browser.select_form("checkout_form")
     self.browser.form.set_all_readonly(False)
     self.browser.controls.append(
         ClientForm.TextControl('text', input.attrib['name'],
                                {'value': id}))
     self.browser.controls.append(
         ClientForm.TextControl('text', 'requestRenewSome',
                                {'value': 'requestRenewSome'}))
     self.browser.submit()
コード例 #4
0
ファイル: login.py プロジェクト: nledez/cozy-weboob
    def login(self, login, password):
        DOMAIN_LOGIN = self.browser.DOMAIN_LOGIN
        DOMAIN = self.browser.DOMAIN

        url_login = '******' + DOMAIN_LOGIN + '/index.html'

        base_url = 'https://' + DOMAIN
        url = base_url + '//sec/vkm/gen_crypto?estSession=0'
        headers = {'Referer': url_login}
        request = self.browser.request_class(url, None, headers)
        infos_data = self.browser.readurl(request)

        infos_data = re.match('^_vkCallback\((.*)\);$', infos_data).group(1)

        infos = json.loads(infos_data.replace("'", '"'))

        infos['grid'] = self.decode_grid(infos)

        url = base_url + '//sec/vkm/gen_ui?modeClavier=0&cryptogramme=' + infos[
            "crypto"]
        img = Captcha(self.browser.openurl(url), infos)

        try:
            img.build_tiles()
        except TileError as err:
            error("Error: %s" % err)
            if err.tile:
                err.tile.display()

        self.browser.select_form('n2g_authentification')
        self.browser.controls.append(
            ClientForm.TextControl('text', 'codsec', {'value': ''}))
        self.browser.controls.append(
            ClientForm.TextControl('text', 'cryptocvcs', {'value': ''}))
        self.browser.controls.append(
            ClientForm.TextControl('text', 'vkm_op', {'value': 'auth'}))
        self.browser.set_all_readonly(False)

        pwd = img.get_codes(password[:6])
        t = pwd.split(',')
        newpwd = ','.join([t[self.strange_map[j]] for j in xrange(6)])

        self.browser['codcli'] = login.encode('iso-8859-1')
        self.browser['user_id'] = login.encode('iso-8859-1')
        self.browser['codsec'] = newpwd
        self.browser['cryptocvcs'] = infos["crypto"].encode('iso-8859-1')
        self.browser.form.action = 'https://particuliers.secure.societegenerale.fr//acces/authlgn.html'
        self.browser.submit(nologin=True)
コード例 #5
0
 def go_life_insurance(self, account):
     link = self.document.xpath(
         '//table[@summary="Mes contrats d\'assurance vie"]/tbody/tr[td[contains(text(), '
         + account.id + ') ]]//a')[0]
     m = re.search(
         "PostBack(Options)?\([\"'][^\"']+[\"'],\s*['\"](REDIR_ASS_VIE[\d\w&]+)?['\"]",
         link.attrib.get('href', ''))
     if m is not None:
         self.browser.select_form(name='main')
         self.browser.set_all_readonly(False)
         self.browser['__EVENTTARGET'] = 'MM$SYNTHESE_ASSURANCE_CNP'
         self.browser['__EVENTARGUMENT'] = m.group(2)
         try:
             self.browser['MM$m_CH$IsMsgInit'] = '0'
         except ControlNotFoundError:
             # Not available on new website.
             pass
         self.browser.controls.append(
             ClientForm.TextControl('text', 'm_ScriptManager',
                                    {'value': ''}))
         self.browser['m_ScriptManager'] = 'MM$m_UpdatePanel|MM$SYNTHESE'
         try:
             self.browser.controls.remove(
                 self.browser.find_control(
                     name='Cartridge$imgbtnMessagerie', type='image'))
             self.browser.controls.remove(
                 self.browser.find_control(
                     name='MM$m_CH$ButtonImageFondMessagerie',
                     type='image'))
             self.browser.controls.remove(
                 self.browser.find_control(
                     name='MM$m_CH$ButtonImageMessagerie', type='image'))
         except ControlNotFoundError:
             pass
         self.browser.submit()
コード例 #6
0
 def go_history(self, info):
     self.browser.select_form(name='main')
     self.browser.set_all_readonly(False)
     self.browser['__EVENTTARGET'] = 'MM$SYNTHESE'
     self.browser['__EVENTARGUMENT'] = info['link']
     try:
         self.browser['MM$m_CH$IsMsgInit'] = '0'
     except ControlNotFoundError:
         # Not available on new website.
         pass
     self.browser.controls.append(
         ClientForm.TextControl('text', 'm_ScriptManager', {'value': ''}))
     self.browser['m_ScriptManager'] = 'MM$m_UpdatePanel|MM$SYNTHESE'
     try:
         self.browser.controls.remove(
             self.browser.find_control(name='Cartridge$imgbtnMessagerie',
                                       type='image'))
         self.browser.controls.remove(
             self.browser.find_control(
                 name='MM$m_CH$ButtonImageFondMessagerie', type='image'))
         self.browser.controls.remove(
             self.browser.find_control(name='MM$m_CH$ButtonImageMessagerie',
                                       type='image'))
     except ControlNotFoundError:
         pass
     self.browser.submit()
コード例 #7
0
ファイル: pages.py プロジェクト: sourcery-ai-bot/weboob
    def go_list(self):
        self.browser.select_form(name='main')
        self.browser.set_all_readonly(False)
        self.browser['__EVENTARGUMENT'] = 'CPTSYNT0'
        self.browser.controls.append(
            ClientForm.TextControl('text', 'm_ScriptManager', {'value': ''}))

        # Ugly check to determine if we are on the new or old website.
        try:
            self.browser['MM$m_CH$IsMsgInit']
        except ControlNotFoundError:
            self.logger.debug('New website')
            self.browser['__EVENTTARGET'] = 'MM$m_PostBack'
            self.browser['m_ScriptManager'] = 'MM$m_UpdatePanel|MM$m_PostBack'
        else:
            self.logger.debug('Old website')
            self.browser['__EVENTTARGET'] = 'Menu_AJAX'
            self.browser['m_ScriptManager'] = 'm_ScriptManager|Menu_AJAX'

        try:
            self.browser.controls.remove(
                self.browser.find_control(name='Cartridge$imgbtnMessagerie',
                                          type='image'))
            self.browser.controls.remove(
                self.browser.find_control(
                    name='MM$m_CH$ButtonImageFondMessagerie', type='image'))
            self.browser.controls.remove(
                self.browser.find_control(name='MM$m_CH$ButtonImageMessagerie',
                                          type='image'))
        except ControlNotFoundError:
            pass
        self.browser.submit()
コード例 #8
0
    def go_next(self):
        # <a id="MM_HISTORIQUE_CB_lnkSuivante" class="next" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;MM$HISTORIQUE_CB$lnkSuivante&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))">Suivant<span class="arrow">></span></a>

        link = self.document.xpath('//a[contains(@id, "lnkSuivante")]')
        if len(link) == 0 or 'disabled' in link[0].attrib:
            return False

        account_type = 'COMPTE'
        m = re.search('HISTORIQUE_(\w+)', link[0].attrib['href'])
        if m:
            account_type = m.group(1)

        self.browser.select_form(name='main')
        self.browser.set_all_readonly(False)
        self.browser['__EVENTTARGET'] = 'MM$HISTORIQUE_%s$lnkSuivante' % account_type
        self.browser['__EVENTARGUMENT'] = ''
        try:
            self.browser['MM$m_CH$IsMsgInit'] = 'N'
        except ControlNotFoundError:
            # New website
            pass
        self.browser.controls.append(ClientForm.TextControl('text', 'm_ScriptManager', {'value': ''}))
        self.browser['m_ScriptManager'] = 'MM$m_UpdatePanel|MM$HISTORIQUE_COMPTE$lnkSuivante'
        try:
            self.browser.controls.remove(self.browser.find_control(name='Cartridge$imgbtnMessagerie', type='image'))
            self.browser.controls.remove(self.browser.find_control(name='MM$m_CH$ButtonImageFondMessagerie', type='image'))
            self.browser.controls.remove(self.browser.find_control(name='MM$m_CH$ButtonImageMessagerie', type='image'))
        except ControlNotFoundError:
            pass
        self.browser.submit()

        return True
コード例 #9
0
ファイル: pages.py プロジェクト: yang2lalang/weboob
 def go_life_insurance(self, account):
     link = self.document.xpath('//tr[td[contains(., ' + account.id +
                                ') ]]//a')[0]
     m = re.search(
         "PostBackOptions?\([\"']([^\"']+)[\"'],\s*['\"](REDIR_ASS_VIE[\d\w&]+)?['\"]",
         link.attrib.get('href', ''))
     if m is not None:
         self.browser.select_form(name='main')
         self.browser.set_all_readonly(False)
         self.browser['__EVENTTARGET'] = m.group(1)
         self.browser['__EVENTARGUMENT'] = m.group(2)
         try:
             self.browser['MM$m_CH$IsMsgInit'] = '0'
         except ControlNotFoundError:
             # Not available on new website.
             pass
         self.browser.controls.append(
             ClientForm.TextControl('text', 'm_ScriptManager',
                                    {'value': ''}))
         self.browser['m_ScriptManager'] = 'MM$m_UpdatePanel|MM$SYNTHESE'
         for name in ['MM$HISTORIQUE_COMPTE$btnCumul','Cartridge$imgbtnMessagerie','MM$m_CH$ButtonImageFondMessagerie',\
         'MM$m_CH$ButtonImageMessagerie']:
             try:
                 self.browser.controls.remove(
                     self.browser.find_control(name=name))
             except ControlNotFoundError:
                 pass
         self.browser.submit()
コード例 #10
0
 def set_category(self, category):
     if category:
         select = self.parser.select(self.document.getroot(),
                                     'select#issue_category_id', 1)
         for option in select.findall('option'):
             if option.text and option.text.strip() == category:
                 self.browser['issue[category_id]'] = [
                     option.attrib['value']
                 ]
                 return
         value = None
         if len(self.document.xpath('//a[@title="New category"]')) > 0:
             value = self.browser.create_category(
                 self.get_project_name(), category,
                 self.get_authenticity_token())
         if value:
             control = self.browser.find_control('issue[category_id]')
             ClientForm.Item(control, {'name': category, 'value': value})
             self.browser['issue[category_id]'] = [value]
         else:
             self.logger.warning('Category "%s" not found' % category)
     else:
         try:
             self.browser['issue[category_id]'] = ['']
         except ClientForm.ControlNotFoundError:
             self.logger.warning('Category item not found')
コード例 #11
0
ファイル: pages.py プロジェクト: h4wkmoon/weboob
    def login(self, login, password):
        DOMAIN = self.browser.DOMAIN

        url_login = '******' + DOMAIN + '/'

        base_url = 'https://' + DOMAIN
        url = base_url + '//sec/vk/gen_crypto?estSession=0'
        headers = {'Referer': url_login}
        request = self.browser.request_class(url, None, headers)
        infos_data = self.browser.readurl(request)

        infos_data = re.match('^_vkCallback\((.*)\);$', infos_data).group(1)

        infos = json.loads(infos_data.replace("'", '"'))

        url = base_url + '//sec/vk/gen_ui?modeClavier=0&cryptogramme=' + infos[
            "crypto"]

        self.browser.readurl(url)
        img = Captcha(self.browser.openurl(url), infos)

        try:
            img.build_tiles()
        except TileError as err:
            error("Error: %s" % err)
            if err.tile:
                err.tile.display()

        self.browser.select_form(self.browser.LOGIN_FORM)
        self.browser.controls.append(
            ClientForm.TextControl('text', 'codsec', {'value': ''}))
        self.browser.controls.append(
            ClientForm.TextControl('text', 'cryptocvcs', {'value': ''}))
        self.browser.controls.append(
            ClientForm.TextControl('text', 'vk_op', {'value': 'auth'}))
        self.browser.set_all_readonly(False)

        self.browser['user_id'] = login.encode(self.browser.ENCODING)
        self.browser['codsec'] = img.get_codes(password[:6])
        self.browser['cryptocvcs'] = infos["crypto"]
        self.browser.form.action = base_url + '/authent.html'
        self.browser.submit(nologin=True)
コード例 #12
0
 def login(self, login, password):
     form = list(self.browser.forms())[0]
     self.browser.select_form("aspnetForm")
     self.browser.set_all_readonly(False)
     self.browser.controls.append(
         ClientForm.TextControl('text', '__ASYNCPOST', {'value': "true"}))
     self.browser['__EVENTTARGET'] = "ctl00$cMain$lnkValider"
     self.browser['ctl00$cMain$ascSaisieMsIsdn$txtMsIsdn'] = login.encode(
         'iso-8859-1')
     self.browser['ctl00$cMain$txtMdp'] = password.encode('iso-8859-1')
     self.browser.submit(nologin=True)
     return form
コード例 #13
0
ファイル: pages.py プロジェクト: skeptycal/weboob-devel
    def validate_useless_captacha(self):
        #paypal use a captcha page after login, but don't use the captcha
        self.browser.select_form(name='challenge')
        self.browser.form.set_all_readonly(False)

        #paypal add this on the captcha page when the validate should be automatique
        self.browser.controls.append(ClientForm.TextControl('text', 'ads_token_js', {'value': ''}))

        code = ''.join(self.document.xpath('//script[contains(text(), "autosubmit")]/text()'))
        code = re.search('(function .*)try', code).group(1)
        js = Javascript(code)
        func_name = re.search(r'function (\w+)\(e\)', code).group(1)
        self.browser['ads_token_js'] = str(js.call(func_name, self.browser['ads_token']))

        self.browser.submit(nologin=True)
コード例 #14
0
 def next(self, login, form):
     self.browser.form = form
     string = StringIO.StringIO()
     self.document.write(string)
     controlvalue = string.getvalue().split('__EVENTVALIDATION')[1].split(
         '|')[1]
     state = string.getvalue().split('__VIEWSTATE')[1].split('|')[1]
     self.browser.controls.append(
         ClientForm.TextControl(
             'text', 'ctl00$objScriptManager', {
                 'value':
                 "ctl00$ascAttente$panelAttente|ctl00$ascAttente$timerAttente"
             }))
     self.browser['__VIEWSTATE'] = state
     self.browser['__EVENTTARGET'] = "ctl00$ascAttente$timerAttente"
     self.browser['__EVENTVALIDATION'] = controlvalue
     self.browser['ctl00$cMain$ascSaisieMsIsdn$txtMsIsdn'] = login.encode(
         'iso-8859-1')
     self.browser['ctl00$cMain$txtMdp'] = ""
     self.browser.submit(nologin=True)
コード例 #15
0
ファイル: pages.py プロジェクト: sourcery-ai-bot/weboob
    def search(self, departure, arrival, date, age, card, comfort_class):
        self.browser.select_form(name='saisie')
        self.browser['ORIGIN_CITY'] = departure.encode(self.browser.ENCODING)
        self.browser['DESTINATION_CITY'] = arrival.encode(
            self.browser.ENCODING)

        if date is None:
            date = datetime.now() + timedelta(hours=1)
        elif date < datetime.now():
            raise UserError("You cannot look for older departures")

        self.browser['OUTWARD_DATE'] = date.strftime('%d/%m/%y')
        self.browser['OUTWARD_TIME'] = [str(date.hour)]
        self.browser['PASSENGER_1'] = [age]
        self.browser['PASSENGER_1_CARD'] = [card]
        self.browser['COMFORT_CLASS'] = [str(comfort_class)]
        self.browser.controls.append(
            ClientForm.TextControl('text', 'nbAnimalsForTravel',
                                   {'value': ''}))
        self.browser['nbAnimalsForTravel'] = '0'
        self.browser.submit()
コード例 #16
0
ファイル: pages.py プロジェクト: sourcery-ai-bot/weboob
    def login(self, login, passwd):
        self.browser.select_form(predicate=lambda x: x.attrs.get('id','')=='aspnetForm')
        self.browser.form.set_all_readonly(False)
        self.browser['ctl00$ContentPlaceHolder1$ctl00$ctl04$ctl00$TextSaisie'] = login
        self.browser['ctl00$ContentPlaceHolder1$ctl00$ctl04$ctl00$TextPass'] = passwd
        self.browser['ctl00_ScriptManager1_TSM']="%3B%3BSystem.Web.Extensions%2C%20Version%3D1.0.61025.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D31bf3856ad364e35%3Afr-FR%3A1f0f78f9-0731-4ae9-b308-56936732ccb8%3Aea597d4b%3Ab25378d2%3BTelerik.Web.UI%2C%20Version%3D2009.3.1314.20%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D121fae78165ba3d4%3Afr-FR%3Aec1048f9-7413-49ac-913a-b3b534cde186%3A16e4e7cd%3Aed16cbdc%3Af7645509%3A24ee1bba%3A19620875%3A874f8ea2%3A33108d14%3Abd8f85e4"
        self.browser.controls.append(ClientForm.TextControl('text', 'RadAJAXControlID', {'value': ''}))
        self.browser['RadAJAXControlID']="ctl00_ContentPlaceHolder1_ctl00_ctl04_ctl00_RadAjaxPanelConnexion"
        self.browser.controls.append(ClientForm.TextControl('text', 'ctl00$ScriptManager1', {'value': ''}))
        self.browser['ctl00$ScriptManager1']="ctl00$ContentPlaceHolder1$ctl00$ctl04$ctl00$ctl00$ContentPlaceHolder1$ctl00$ctl04$ctl00$RadAjaxPanelConnexionPanel|"
        self.browser.controls.append(ClientForm.TextControl('text', '__EVENTTARGET', {'value': ''}))
        self.browser.controls.append(ClientForm.TextControl('text', '__EVENTARGUMENT', {'value': ''}))
        self.browser.controls.append(ClientForm.TextControl('text', 'ctl00$ContentPlaceHolder1$ctl00$ctl04$ctl00$btnImgConnexion.x', {'value': ''}))
        self.browser['ctl00$ContentPlaceHolder1$ctl00$ctl04$ctl00$btnImgConnexion.x']="76"
        self.browser.controls.append(ClientForm.TextControl('text', 'ctl00$ContentPlaceHolder1$ctl00$ctl04$ctl00$btnImgConnexion.y', {'value': ''}))
        self.browser['ctl00$ContentPlaceHolder1$ctl00$ctl04$ctl00$btnImgConnexion.y']="10"

        try:
            self.browser.submit()
        except BrowserUnavailable:
            # Login is not valid
            return False
        return True