Exemple #1
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        this.Resize(600, 100);
        this.Title = "metafang";
        _main      = new VBox();

        HBox title = new HBox();

        title.PackStart(new Label("Login to your Metasploit RPC instance to begin"), true, true, 0);

        _main.PackStart(title, true, true, 0);

        HBox loginInfo = new HBox();

        loginInfo.PackStart(new Label("Host:"), false, false, 20);

        Entry hostEntry = new Entry();

        loginInfo.PackStart(hostEntry, false, false, 0);

        loginInfo.PackStart(new Label("User:"******"Pass:"******"Login");

        login.Clicked += (object sender, EventArgs e) => {
            try {
                //Console.WriteLine ("Creating session");
                _session = new MetasploitSession(userEntry.Text, passEntry.Text, hostEntry.Text);
                //Console.WriteLine ("Creating manager and getting current list of payloads");
                _manager  = new MetasploitManager(_session);
                _payloads = _manager.GetPayloads();
                BuildWorkspace();
            } catch {
                MessageDialog md = new MessageDialog(this,
                                                     DialogFlags.DestroyWithParent,
                                                     MessageType.Error,
                                                     ButtonsType.Close, "Authentication failed. Please ensure your credentials and API URL are correct.");

                md.Run();
                md.Destroy();
            }
        };

        HBox loginBox = new HBox();

        loginBox.PackStart(login, false, false, 300);

        _main.PackStart(loginBox, true, true, 0);

        _main.ShowAll();
        this.Add(_main);
    }