Esempio n. 1
0
def add_cookies(request):
    """
    Cookies storing into Archery Database.
    :param request:
    :return:
    """
    username = request.user.username
    if request.method == 'POST':
        target_url = request.POST.get('url')
        target_cookies = request.POST.get('cookies')
        all_cookie_url = cookie_db.objects.filter(
            Q(url__icontains=target_url, username=username))
        for da in all_cookie_url:
            global cookies
            cookies = da.url

        if cookies == target_url:
            cookie_db.objects.filter(
                Q(url__icontains=target_url,
                  username=username)).update(cookie=target_cookies)
            return HttpResponseRedirect(reverse('webscanners:index'))
        else:
            data_dump = cookie_db(url=target_url,
                                  cookie=target_cookies,
                                  username=username)
            data_dump.save()
            return HttpResponseRedirect(reverse('webscanners:index'))

    return render(request, 'cookie_add.html')
Esempio n. 2
0
def sel_login(request):
    action_vul = request.POST.get("action", )
    url_da = request.POST.get("url_login", )
    print action_vul
    print url_da
    if action_vul == "open_page":
        global driver
        driver = webdriver.Firefox()
        slem(driver, url_da)

    elif action_vul == "save_cookie":
        save_cookie(driver)
        read_f = open('cookies.txt', 'r')

        # chk_url = cookie_db.objects.filter(url=new_uri)
        # for da in chk_url:
        #     print "check url:", da.url
        #     if da.url == new_uri:
        #         chk_url.delete()
        #         print "check url delete"
        del_all_cookie = cookie_db.objects.all()
        del_all_cookie.delete()

        print "url from cookie : ", new_uri

        for cookie_data in read_f:
            print "Cookies from text :", cookie_data
            cookie_save = cookie_db(url=new_uri, cookie=cookie_data)
            cookie_save.save()

        messages.add_message(request, messages.SUCCESS, 'Cookies stored')

    return HttpResponseRedirect('/webscanners/')
Esempio n. 3
0
def sel_login(request):
    """
    Lgoin perfrom using Selenium.
    :param request:
    :return:
    """
    action_vul = request.POST.get("action", )
    url_da = request.POST.get("url_login", )
    print action_vul
    print url_da
    if action_vul == "open_page":
        global driver
        driver = webdriver.Firefox()
        slem(driver, url_da)
    elif action_vul == "save_cookie":
        save_cookie(driver)
        read_f = open('cookies.txt', 'r')
        del_all_cookie = cookie_db.objects.all()
        del_all_cookie.delete()
        print "url from cookie : ", new_uri
        for cookie_data in read_f:
            print "Cookies from text :", cookie_data
            cookie_save = cookie_db(url=new_uri, cookie=cookie_data)
            cookie_save.save()
        messages.add_message(request, messages.SUCCESS, 'Cookies stored')

    return HttpResponseRedirect('/webscanners/')
Esempio n. 4
0
    def post(self, request):
        target_url = request.POST.get("url")
        target_cookies = request.POST.get("cookies")
        all_cookie_url = cookie_db.objects.filter(Q(url__icontains=target_url))
        for da in all_cookie_url:
            global cookies
            cookies = da.url

        if cookies == target_url:
            cookie_db.objects.filter(
                Q(url__icontains=target_url)).update(cookie=target_cookies)
            return HttpResponseRedirect(reverse("webscanners:index"))
        else:
            data_dump = cookie_db(url=target_url, cookie=target_cookies)
            data_dump.save()
            return HttpResponseRedirect(reverse("webscanners:index"))
Esempio n. 5
0
def sel_login(request):
    """
    Lgoin perfrom using Selenium.
    :param request:
    :return:
    """
    action_vul = request.POST.get("action", )
    url_da = request.POST.get("url_login", )
    # print(url_da)
    if action_vul == "open_page":
        global driver
        driver = webdriver.Firefox()
        slem(driver, url_da)
    elif action_vul == "save_cookie":
        save_cookie(driver)
        read_f = open('cookies.txt', 'r')

        for cookie_data in read_f:

            # cookie_save = cookie_db(url=new_uri, cookie=cookie_data)
            # cookie_save.save()

            # target_url = request.POST.get('url')
            # target_cookies = request.POST.get('cookies')
            print(cookie_data)
            all_cookie_url = cookie_db.objects.filter(
                Q(url__icontains=new_uri))
            for da in all_cookie_url:
                global cookies
                cookies = da.url

            if cookies == new_uri:
                cookie_db.objects.filter(
                    Q(url__icontains=new_uri)).update(cookie=cookie_data)
                return HttpResponseRedirect("/zapscanner/")
            else:
                data_dump = cookie_db(url=new_uri, cookie=cookie_data)
                data_dump.save()
                return HttpResponseRedirect("/zapscanner/")
        messages.add_message(request, messages.SUCCESS, 'Cookies stored')

        return HttpResponseRedirect('/zapscanner/')
    return render(request, 'webscanner.html')
Esempio n. 6
0
def sel_login(request):
    """
    Lgoin perfrom using Selenium.
    :param request:
    :return:
    """
    username = request.user.username
    action_vul = request.POST.get("action", )
    url_da = request.POST.get("url_login", )
    if action_vul == "open_page":
        global driver
        driver = webdriver.Firefox()
        slem(driver, url_da)
    elif action_vul == "save_cookie":
        save_cookie(driver)
        read_f = open('cookies.txt', 'r')

        for cookie_data in read_f:

            print(cookie_data)
            all_cookie_url = cookie_db.objects.filter(
                Q(url__icontains=new_uri, username=username))
            for da in all_cookie_url:
                global cookies
                cookies = da.url

            if cookies == new_uri:
                cookie_db.objects.filter(
                    Q(url__icontains=new_uri,
                      username=username)).update(cookie=cookie_data)
                return HttpResponseRedirect(reverse('webscanners:index'))
            else:
                data_dump = cookie_db(
                    url=new_uri,
                    cookie=cookie_data,
                    username=username,
                )
                data_dump.save()
                return HttpResponseRedirect(reverse('webscanners:index'))
        # messages.add_message(request, messages.SUCCESS, 'Cookies stored')

        return HttpResponseRedirect(reverse('webscanners:index'))
    return render(request, 'webscanner.html')
Esempio n. 7
0
def add_cookies(request):

    if request.method == 'POST':
        target_url = request.POST.get('url')
        target_cookies = request.POST.get('cookies')
        all_cookie_url = cookie_db.objects.filter(Q(url__icontains=target_url))
        for da in all_cookie_url:
            global cookies
            cookies = da.url

        if cookies == target_url:
            print "updateeeeeeeee"
            cookie_db.objects.filter(Q(url__icontains=target_url)).update(cookie=target_cookies)
            return HttpResponseRedirect("/webscanners/")
        else:
            data_dump = cookie_db(url=target_url, cookie=target_cookies)
            data_dump.save()
            return HttpResponseRedirect("/webscanners/")

    return render(request, 'cookie_add.html')