<commit_before># Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.

from lib.common.abstracts import Package

class IE(Package):
    """Internet Explorer analysis package."""
    PATHS = [
        ("ProgramFiles", "Internet Explorer", "iexplore.exe"),
    ]

    def start(self, url):
        iexplore = self.get_path("Internet Explorer")
        return self.execute(iexplore, args=[url])<commit_msg>tweak internet explorer so to avoid popups<commit_after># Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.

from _winreg import OpenKey, SetValueEx, CloseKey
from _winreg import HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER
from _winreg import KEY_SET_VALUE, REG_DWORD, REG_SZ

from lib.common.abstracts import Package
from lib.common.exceptions import CuckooPackageError

class IE(Package):
    """Internet Explorer analysis package."""
    PATHS = [
        ("ProgramFiles", "Internet Explorer", "iexplore.exe"),
    ]

    REGKEYS = [
        {
            "key": HKEY_CURRENT_USER,
            "subkey": "Software\\Microsoft\\Internet Explorer\\Main",
            "values": {
                # "Would you like Internet Explorer as default browser?"
                "Check_Associations": "no",
            },
        },
        {
            "key": HKEY_CURRENT_USER,
            "subkey": "Software\\Microsoft\\Internet Explorer\\Security",
            "values": {
                "Safety Warning Level": "Low",
                "Sending_Security": "Low",
                "Viewing_Security": "Low",
            },
        },
        {
            "key": HKEY_LOCAL_MACHINE,
            "subkey": "Software\\Microsoft\\Internet Explorer\\Main",
            "values": {
                # Disable Security Settings Check.
                "DisableSecuritySettingsCheck": 1,
            },
        },
        {
            "key": HKEY_CURRENT_USER,
            "subkey": "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
            "values": {
                # "You are about to be redirected to a connection that is not secure."
                "WarnOnHTTPSToHTTPRedirect": 0,

                # "You are about to view pages over a secure connection."
                "WarnOnZoneCrossing": 0,
            },
        },
    ]

    def init_iexplore(self):
        """Sets various Internet Explorer related registry settings in case
        the user has not taken care of it already."""
        for row in self.REGKEYS:
            key_handle = OpenKey(row["key"], row["subkey"], 0, KEY_SET_VALUE)

            for key, value in row["values"].items():
                if isinstance(value, str):
                    SetValueEx(key_handle, key, 0, REG_SZ, value)
                elif isinstance(value, int):
                    SetValueEx(key_handle, key, 0, REG_DWORD, value)
                else:
                    raise CuckooPackageError("Invalid value type: %r" % value)

            CloseKey(key_handle)

    def start(self, url):
        self.init_iexplore()

        iexplore = self.get_path("Internet Explorer")
        return self.execute(iexplore, args=[url])
{'fraction_non_alphanumeric': 0.10812443370582905, 'fraction_numerical': 0.006644518272425249, 'mean_word_length': 2.101123595505618, 'pattern_counts': {'":': 19, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3855111', 'n_tokens_mistral': 981, 'n_tokens_neox': 901, 'n_words': 251}