예제 #1
0
def addItem(request):
    if request.method == 'GET':
        return JSONResponse("GET")

    if request.method == 'POST':
        data = JSONParser().parse(request)
        flg_key = data.has_key('key')
        if not flg_key:
            return JSONResponse('key is empty!')

        access_key = data['key']
        if cmp(access_key, "test"):
            return JSONResponse("access key error.")

        flg_domain = data.has_key('domain')
        if not flg_domain:
            result = {"error": "-1", "errmsg": "domain is empty"}
            return HttpResponse(json.dumps(result, ensure_ascii=False),
                                content_type="application/json,charset=utf-8")

        from jsonrpc.proxy import ServiceProxy
        s = ServiceProxy('http://localhost:5000/json/')
        import awvs
        ins = awvs.AWVS()
        ins.auth({"email": "name", "password": "******"})
        ins.addTask(['lua.ren\n', 'candylab.net\n'])

        result = {"error": "0", "errmsg": "none"}
        return HttpResponse(json.dumps(result, ensure_ascii=False),
                            content_type="application/json,charset=utf-8")
예제 #2
0
def test_4(setup_module):
    print('Test_4 called.\n')
    import awvs
    ins = awvs.AWVS("test.com")

    print ins.domain
    print ins.send(5)
    assert 2 == 1 + 1
예제 #3
0
def test_6(setup_module):
    print('Test_6 called.\n')
    print("==================")
    import awvs
    ins = awvs.AWVS("testcase.com")
    ins.auth({"email": "name", "password": "******"})
    print ins.domain
    assert 1 == 1
예제 #4
0
def test_7(setup_module):
    print('Test_7 called.\n')
    print("==================")
    import awvs
    ins = awvs.AWVS("test1.com")
    ins.auth({"email": "name", "password": "******"})
    ins.addTask(['lua.ren\n', 'candylab.net\n'])
    print ins.domain
    assert 1 == 1
예제 #5
0
def test_4(setup_module):
    print('Test_4 called.\n')
    print("==================")
    import awvs
    ins = awvs.AWVS("testcase.com")
    print ins.domain
    print("*********")
    print(ins.send(1))
    ins.addTask(['lua.ren\n', 'candylab.net\n'])
    print("*********")
    assert 2 == 1 + 1
예제 #6
0
def whats_the_time(request, name='Lester'):
    import awvs
    ins = awvs.AWVS("test.com")
    ret = ins.send(5)

    return "Hello %s" % ins.domain
예제 #7
0
def auto_scanner(request, domain='lua.ren'):
    import awvs
    ins = awvs.AWVS("testcase.com")
    ins.auth({"email": "name", "password": "******"})
    ins.addTask(['lua.ren\n', 'candylab.net\n'])
    return "candylab", "abc"