예제 #1
0
    def tests_invalid_input(self):
        """ Tests check_template when given invalid input. """

        template = 2

        with self.assertRaises(phishingpage.ArgumentIsNotAString):
            phishingpage.check_template(template)
예제 #2
0
    def tests_invalid_template_input(self):
        """ Tests check_template when given invalid template as an input. """

        template = "no template"

        with self.assertRaises(phishingpage.TemplateNotAvailable):
            phishingpage.check_template(template)
예제 #3
0
    def tests_invalid_template_input(self):
        """ Tests check_template when given invalid template as an input. """

        template = "no template"

        with self.assertRaises(phishingpage.TemplateNotAvailable):
            phishingpage.check_template(template)
예제 #4
0
    def tests_invalid_input(self):
        """ Tests check_template when given invalid input. """

        template = 2

        with self.assertRaises(phishingpage.ArgumentIsNotAString):
            phishingpage.check_template(template)
예제 #5
0
    def test_not_locally_present(self):
        """ Tests check_template when no directory is locally present. """

        template = "linksys"

        self.assertEqual(phishingpage.check_template(template), False,
                         "Failed to check a template with no directory!")
예제 #6
0
    def test_not_locally_present(self):
        """ Tests check_template when no directory is locally present. """

        template = "linksys"

        self.assertEqual(phishingpage.check_template(template), False,
                         "Failed to check a template with no directory!")
예제 #7
0
    def test_all_files_locally_present(self):
        """ Tests check_template when all files are locally present. """

        template = "linksys"
        path = phishingpage.get_path(template)

        # download the template
        phishingpage.grab_online(template)

        self.assertEqual(phishingpage.check_template(template), True,
                         "Failed to check valid template with all files!")
        shutil.rmtree(path)
예제 #8
0
    def test_all_files_locally_present(self):
        """ Tests check_template when all files are locally present. """

        template = "linksys"
        path = phishingpage.get_path(template)

        # download the template
        phishingpage.grab_online(template)

        self.assertEqual(phishingpage.check_template(template), True,
                         "Failed to check valid template with all files!")
        shutil.rmtree(path)
예제 #9
0
    def test_some_files_locally_present(self):
        """
        Tests check_template when some of the files are locally present.
        """

        template = "linksys"
        path = phishingpage.get_path(template)

        # download the template
        phishingpage.grab_online(template)

        # remove a file
        os.remove(path + "/index.html")

        self.assertEqual(phishingpage.check_template(template), False,
                         "Failed to check a template with some files!")
        shutil.rmtree(path)
예제 #10
0
    def test_some_files_locally_present(self):
        """
        Tests check_template when some of the files are locally present.
        """

        template = "linksys"
        path = phishingpage.get_path(template)

        # download the template
        phishingpage.grab_online(template)

        # remove a file
        os.remove(path + "/index.html")

        self.assertEqual(phishingpage.check_template(template), False,
                         "Failed to check a template with some files!")
        shutil.rmtree(path)
예제 #11
0
    def test_no_files_locally_present(self):
        """
        Tests check_template when only an empty directory is locally
        present.
        """

        template = "linksys"
        path = phishingpage.get_path(template)

        # download the template
        phishingpage.grab_online(template)

        # remove all the files
        os.remove(path + "/index.html")
        os.remove(path + "/Linksys_logo.png")

        self.assertEqual(phishingpage.check_template(template), False,
                         "Failed to check a template with no files!")
        shutil.rmtree(path)
예제 #12
0
    def test_no_files_locally_present(self):
        """
        Tests check_template when only an empty directory is locally
        present.
        """

        template = "linksys"
        path = phishingpage.get_path(template)

        # download the template
        phishingpage.grab_online(template)

        # remove all the files
        os.remove(path + "/index.html")
        os.remove(path + "/Linksys_logo.png")

        self.assertEqual(phishingpage.check_template(template), False,
                         "Failed to check a template with no files!")
        shutil.rmtree(path)
예제 #13
0
        proc = Popen(['airmon-ng', 'check', 'kill'], stdout=PIPE, stderr=DN)

    # Get hostapd if needed
    get_hostapd()

    # get dnsmasq if needed
    get_dnsmasq()

    # get template_database
    template_database = phishingpage.get_template_database()

    # check to see if the template is local
    if not template_database[TEMPLATE_NAME] is None:

        # if template is incomplete locally, delete and ask for a download
        if not phishingpage.check_template(TEMPLATE_NAME):

            # clean up the previous download
            phishingpage.clean_template(TEMPLATE_NAME)

            # get user's response
            response = raw_input("Template is available online. Do you want"\
            " to download it now? [y/n] ")

            # in case the user agrees to download
            if response == "Y" or response == "y":
                # display download info to the user
                print "[" + G + "+" + W + "] Downloading the template..."

                # download the content
                phishingpage.grab_online(TEMPLATE_NAME)
예제 #14
0
    # Kill any possible programs that may interfere with the wireless card
    # Only for systems with airmon-ng installed
    if os.path.isfile('/usr/sbin/airmon-ng'):
        proc = Popen(['airmon-ng', 'check', 'kill'], stdout=PIPE, stderr=DN)

    # Get hostapd if needed
    get_hostapd()

    # get template_database
    template_database = phishingpage.get_template_database()

    # check to see if the template is local
    if not template_database[TEMPLATE_NAME] is None:

        # if template is incomplete locally, delete and ask for a download
        if not phishingpage.check_template(TEMPLATE_NAME):

            # clean up the previous download
            phishingpage.clean_template(TEMPLATE_NAME)

            # get user's response
            response = raw_input("Template is available online. Do you want"\
            " to download it now? [y/n] ")

            # in case the user agrees to download
            if response == "Y" or response == "y":
                # display download info to the user
                print "[" + G + "+" + W + "] Downloading the template..."

                # download the content
                phishingpage.grab_online(TEMPLATE_NAME)