'''	[PSV-2017-0339] Router reboot CSRF at /strtblupgrade.cgi '''
''' anthor Cloud 2018-01-04'''
'''v1.0 '''
from API._API import *

# #def test_step_0():
    # #log.info( 'step-0-0 dut loaddrfault wait 160s')
    # #aploaddefault()
    # #log.info( "step-0-1 AP Genie over leap done")
    # #Genie_overleap()
#    log.info( "step-0-2 disable changed-url token")
#    Disable_changedToken()

def test_Step_1():
    log.info('step-1 Router reboot CSRF at /strtblupgrade.cgi')
    Authorization = 'Basic ' + base64.b64encode(user + ':' + passwd)
    headers = {
        'Host': hostip,
        'Cache-Control': 'max-age=0',
        'Authorization': Authorization,
        'Upgrade-Insecure-Requests': '1',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',
        'Content-Type': 'application/x-www-form-urlencoded',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4',
    }
    try:
        r = requests.get('http://' + hostip + '/strtblupgrade.cgi', headers=headers)
        log.info(r.status_code)
    except:
        time.sleep(1)

def test_Step_2():
    log.info( 'step-2 Make sure the Web GUI should not crash')
    url = "http://" + user + ':' + passwd + "@" + hostip + '/' + urlDevicecontrol
    str = check_DUTnocrash(url)
    assert str == 'pass', "This action should work."
8e1600b6aeb9fa3214c0883848a594f0270d919e
<mask token>

<mask token>


def test_Step_1():
    log.info('step-1 Router reboot CSRF at /strtblupgrade.cgi')
    Authorization = 'Basic ' + base64.b64encode(user + ':' + passwd)
    headers = {'Host': hostip, 'Cache-Control': 'max-age=0',
        'Authorization': Authorization, 'Upgrade-Insecure-Requests': '1',
        'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
        , 'Content-Type': 'application/x-www-form-urlencoded',
        'Accept-Encoding': 'gzip, deflate', 'Accept-Language':
        'zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4'}
    try:
        r = requests.get('http://' + hostip + '/strtblupgrade.cgi', headers
            =headers)
        log.info(r.status_code)
    except:
        time.sleep(1)


<mask token>

<mask token>


def test_Step_1():
    log.info('step-1 Router reboot CSRF at /strtblupgrade.cgi')
    Authorization = 'Basic ' + base64.b64encode(user + ':' + passwd)
    headers = {'Host': hostip, 'Cache-Control': 'max-age=0',
        'Authorization': Authorization, 'Upgrade-Insecure-Requests': '1',
        'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
        , 'Content-Type': 'application/x-www-form-urlencoded',
        'Accept-Encoding': 'gzip, deflate', 'Accept-Language':
        'zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4'}
    try:
        r = requests.get('http://' + hostip + '/strtblupgrade.cgi', headers
            =headers)
        log.info(r.status_code)
    except:
        time.sleep(1)


def test_Step_2():
    log.info('step-2 Make sure the Web GUI should not crash')
    url = ('http://' + user + ':' + passwd + '@' + hostip + '/' +
        urlDevicecontrol)
    str = check_DUTnocrash(url)
    assert str == 'pass', 'This action should work.'

<mask token>
from API._API import *


def test_Step_1():
    log.info('step-1 Router reboot CSRF at /strtblupgrade.cgi')
    Authorization = 'Basic ' + base64.b64encode(user + ':' + passwd)
    headers = {'Host': hostip, 'Cache-Control': 'max-age=0',
        'Authorization': Authorization, 'Upgrade-Insecure-Requests': '1',
        'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
        , 'Content-Type': 'application/x-www-form-urlencoded',
        'Accept-Encoding': 'gzip, deflate', 'Accept-Language':
        'zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4'}
    try:
        r = requests.get('http://' + hostip + '/strtblupgrade.cgi', headers
            =headers)
        log.info(r.status_code)
    except:
        time.sleep(1)


def test_Step_2():
    log.info('step-2 Make sure the Web GUI should not crash')
    url = ('http://' + user + ':' + passwd + '@' + hostip + '/' +
        urlDevicecontrol)
    str = check_DUTnocrash(url)
    assert str == 'pass', 'This action should work.'

'''	[PSV-2017-0339] Router reboot CSRF at /strtblupgrade.cgi '''
''' anthor Cloud 2018-01-04'''
'''v1.0 '''
from API._API import *

# #def test_step_0():
    # #log.info( 'step-0-0 dut loaddrfault wait 160s')
    # #aploaddefault()
    # #log.info( "step-0-1 AP Genie over leap done")
    # #Genie_overleap()
#    log.info( "step-0-2 disable changed-url token")
#    Disable_changedToken()

def test_Step_1():
    log.info('step-1 Router reboot CSRF at /strtblupgrade.cgi')
    Authorization = 'Basic ' + base64.b64encode(user + ':' + passwd)
    headers = {
        'Host': hostip,
        'Cache-Control': 'max-age=0',
        'Authorization': Authorization,
        'Upgrade-Insecure-Requests': '1',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',
        'Content-Type': 'application/x-www-form-urlencoded',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4',
    }
    try:
        r = requests.get('http://' + hostip + '/strtblupgrade.cgi', headers=headers)
        log.info(r.status_code)
    except:
        time.sleep(1)

def test_Step_2():
    log.info( 'step-2 Make sure the Web GUI should not crash')
    url = "http://" + user + ':' + passwd + "@" + hostip + '/' + urlDevicecontrol
    str = check_DUTnocrash(url)
    assert str == 'pass', "This action should work."