Example #1
0
    def action_tncc(self):
        # Run tncc host checker
        # dspreauth_cookie = self.find_cookie('DSPREAUTH')
        # if dspreauth_cookie is None:
        #     raise Exception('Could not find DSPREAUTH key for host checker')

        # dssignin_cookie = self.find_cookie('DSSIGNIN')
        # t = tncc.tncc(self.args.host, self.cj)
        # self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))

        # self.r = self.br.open(self.r.geturl())
        # Run tncc host checker
        dspreauth_cookie = self.find_cookie('DSPREAUTH')
        if dspreauth_cookie is None:
            raise Exception('Could not find DSPREAUTH key for host checker')

        dssignin_cookie = self.find_cookie('DSSIGNIN')
        if self.host_checker:
            t = tncc.tncc(self.vpn_host, self.cj)
            self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))
        else:
            dssignin = (dssignin_cookie.value if dssignin_cookie else 'null')

            if not self.tncc_process:
                self.tncc_start()

            args = [('IC', self.vpn_host), ('Cookie', dspreauth_cookie.value), ('DSSIGNIN', dssignin)]

            print '[TNCC] starting with: {}'.format(args)
            try:
                self.tncc_send('start', args)
                results = self.tncc_recv()
            except:
                self.tncc_start()
                self.tncc_send('start', args)
                results = self.tncc_recv()
            self._close_socket()
            print '[TNCC] received: {}'.format(results)

            if len(results) < 4:
                raise Exception('tncc returned insufficent results', results)

            if results[0] == '200':
                dspreauth_cookie.value = results[2]
                self.cj.set_cookie(dspreauth_cookie)
            elif self.last_action == 'tncc':
                raise Exception('tncc returned non 200 code (' + results[0] + ')')
            else:
                self.cj.clear(self.vpn_host, '/dana-na/', 'DSPREAUTH')

        curl = urlparse.urlparse(self.r.geturl())
        state_id = urlparse.parse_qs(curl.query)['id'][0]
        postauth = "https://{}/dana-na/auth/{}/login.cgi?loginmode=mode_postAuth&postauth={}".format(self.vpn_host,
                                                                                                     self.args.url,
                                                                                                     state_id)
        print '[POSTAUTH] {}'.format(postauth)
        self.r = self.br.open(postauth)
        if not self.host_checker:
            self.tncc_set_cookie()
Example #2
0
    def action_tncc(self):
        # Run tncc host checker
        dspreauth_cookie = self.find_cookie('DSPREAUTH')
        if dspreauth_cookie is None:
            raise Exception('Could not find DSPREAUTH key for host checker')

        dssignin_cookie = self.find_cookie('DSSIGNIN')
        t = tncc.tncc(self.args.host);
        self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))

        self.r = self.br.open(self.r.geturl())
Example #3
0
    def action_tncc(self):
        # Run tncc host checker
        dspreauth_cookie = self.find_cookie('DSPREAUTH')
        if dspreauth_cookie is None:
            raise Exception('Could not find DSPREAUTH key for host checker')

        dssignin_cookie = self.find_cookie('DSSIGNIN')
        t = tncc.tncc(host_only(self.args.host))
        self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))

        self.r = self.br.open(self.r.geturl())
Example #4
0
    def action_tncc(self):
        # Run tncc host checker
        dspreauth_cookie = self.find_cookie('DSPREAUTH')
        if dspreauth_cookie is None:
            raise Exception('Could not find DSPREAUTH key for host checker')

        dssignin_cookie = self.find_cookie('DSSIGNIN')
        t = tncc.tncc(self.args.host, args.device_id, args.enable_funk,
                      args.platform, args.hostname, args.hwaddr, args.certs)
        self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))

        self.r = self.br.open(self.r.geturl())
Example #5
0
    def action_tncc(self):
        # Run tncc host checker
        dspreauth_cookie = self.find_cookie('DSPREAUTH')
        if dspreauth_cookie is None:
            raise Exception('Could not find DSPREAUTH key for host checker')

        dssignin_cookie = self.find_cookie('DSSIGNIN')
        t = tncc.tncc(self.args.host, args.device_id, args.enable_funk,
                    args.platform, args.hostname, args.hwaddr, args.certs);
        self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))

        self.r = self.br.open(self.r.geturl())
    def action_tncc(self):
        # Run tncc host checker
        dspreauth_cookie = self.find_cookie('DSPREAUTH')
        if dspreauth_cookie is None:
            raise Exception('Could not find DSPREAUTH key for host checker')

        dssignin_cookie = self.find_cookie('DSSIGNIN')
        if self.host_checker:
            t = tncc.tncc(self.vpn_host)
            self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))
        else:

            dssignin = (dssignin_cookie.value if dssignin_cookie else 'null')

            if not self.tncc_process:
                self.tncc_start()

            args = [('IC', self.vpn_host), ('Cookie', dspreauth_cookie.value),
                    ('DSSIGNIN', dssignin)]

            try:
                self.tncc_send('start', args)
                results = self.tncc_recv()
            except:
                self.tncc_start()
                self.tncc_send('start', args)
                results = self.tncc_recv()

            if len(results) < 4:
                raise Exception('tncc returned insufficent results', results)

            if results[0] == '200':
                dspreauth_cookie.value = results[2]
                self.cj.set_cookie(dspreauth_cookie)
            elif self.last_action == 'tncc':
                raise Exception('tncc returned non 200 code (' + result[0] +
                                ')')
            else:
                self.cj.clear(self.vpn_host, '/dana-na/', 'DSPREAUTH')

        self.r = self.br.open(self.r.geturl())
    def action_tncc(self):
        # Run tncc host checker
        dspreauth_cookie = self.find_cookie('DSPREAUTH')
        if dspreauth_cookie is None:
            raise Exception('Could not find DSPREAUTH key for host checker')

        dssignin_cookie = self.find_cookie('DSSIGNIN')
        if self.host_checker:
            t = tncc.tncc(self.vpn_host);
            self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))
        else:

		    dssignin = (dssignin_cookie.value if dssignin_cookie else 'null')

		    if not self.tncc_process:
		        self.tncc_start()

		    args = [('IC', self.vpn_host), ('Cookie', dspreauth_cookie.value), ('DSSIGNIN', dssignin)]

		    try:
		        self.tncc_send('start', args)
		        results = self.tncc_recv()
		    except:
		        self.tncc_start()
		        self.tncc_send('start', args)
		        results = self.tncc_recv()

		    if len(results) < 4:
		        raise Exception('tncc returned insufficent results', results)

		    if results[0] == '200':
		        dspreauth_cookie.value = results[2]
		        self.cj.set_cookie(dspreauth_cookie)
		    elif self.last_action == 'tncc':
		        raise Exception('tncc returned non 200 code (' + result[0] + ')')
		    else:
		        self.cj.clear(self.vpn_host, '/dana-na/', 'DSPREAUTH')

        self.r = self.br.open(self.r.geturl())