Пример #1
0
        /// <summary>
        /// Deserialize NetPacket
        /// </summary>
        /// <param name="obj">Data bytes</param>
        private void UnsealPacket(object obj)
        {
            NetPacket packet = new NetPacket();

            packet.Deserialize(obj as byte[]);
            switch (packet.Header.Type)
            {
            case NetPacket.PacketType.Command:
                this.ParseCommand(packet.Data);
                break;

            default:
                if (this.OnClientDataReceived != null)
                {
                    NetEventArgs e = new NetEventArgs(packet);
                    this.OnClientDataReceived(this._tcpClient, e);
                }
                break;
            }
        }
Пример #2
0
 void _client_OnError(object sender, NetEventArgs e)
 {
     this._neuroLog.WriteFormat("Tcp Message", "Error.\nMessage: {0}\n\nStack Trace:\n", e.Exception.Message, e.Exception.StackTrace);
     this.UpdateTerminal(Color.OrangeRed, "[C]: Error, " + e.Exception.Message);
     if (!this._client.Connected)
     {
         this.connTimer.Interval = (int)Math.Exp(this.e_power);//(int)(this.connTimer.Interval * 1.5f);
         this.e_power += 0.2;
         try
         {
             this.BeginInvoke(new MethodInvoker(delegate { this.connTimer.Enabled = true; }));
         }
         catch (Exception) { }
     }
 }
Пример #3
0
 void _client_OnStatusChanged(object sender, NetEventArgs e)
 {
     this._neuroLog.WriteFormat("Tcp Message", "Status Changed.\n{0}", e.Message);
     this.UpdateTerminal(Color.YellowGreen, "[C]: Client Status, " + e.Message);
 }
Пример #4
0
 void _client_OnDataReceived(object sender, NetEventArgs e)
 {
     this._neuroLog.WriteFormat("Tcp Message", "Data Received\nType: {0}\nData:\n{1}", e.Packet.Header.Type, e.Packet.Data);
     switch (e.Packet.Header.Type)
     {
         case NetPacket.PacketType.Print:
             this.UpdateTerminal(Color.AliceBlue, "[" + this._client.GetSenderName(e.Packet) + "]: Data received, " + UTF8Encoding.UTF8.GetString(e.Packet.Data));
             break;
         case NetPacket.PacketType.Custom:
             this._actionCenter.InitiateAction(e.Packet.Header.Source, e.Packet.Data);
             break;
         default:
             this.UpdateTerminal(Color.AliceBlue, "[" + this._client.GetSenderName(e.Packet) + "]: Data received. Period.");
             break;
     }
 }
Пример #5
0
 void _client_OnDisconnect(object sender, NetEventArgs e)
 {
     this._neuroLog.Write("Tcp Message", "Disconnected, " + e.Message);
     this.UpdateTerminal(Color.Red, "[C]: Disconnected, " + e.Message);
 }
Пример #6
0
 void _server_OnStatusChanged(object sender, NetEventArgs e)
 {
     //this.tabControl.TabPages[this._server.GetReceiverName(e.Packet)].Text = "A";
     this._neuroLog.Write("Status Changed", e.Message);
     this.UpdateTerminal(this.textLog, Color.YellowGreen, "[S]: Status Changed, " + e.Message);
 }
Пример #7
0
 void _client_OnConnectionSuccess(object sender, NetEventArgs e)
 {
     this._neuroLog.Write("Tcp Message", "Connection Success");
     this.UpdateTerminal(Color.Green, "[C]: Connected to Overmind.");
     this.connTimer.Interval = 5000;
     this.UpdateTerminal(Color.PaleTurquoise, string.Format("[C]: Sending name change request as {0}'", this._paramName));
     this._neuroLog.WriteFormat("Tcp Write", "PacketType: Command\nTcpCommand: Name\nName: {0}", this._paramName);
     this._client.BeginWriteToClient(0, NetPacket.PacketType.Command, new TcpCommand(TcpCommand.Command.Name, UTF8Encoding.UTF8.GetBytes(this._paramName)).Serialize());
     // Start Hooks
     if (this._onceStartedHook == false)
     {
         this._onceStartedHook = true;
         this.BeginInvoke(new MethodInvoker(delegate { this.StartHooks(); this.captureTimer.Enabled = true; }));
     }
 }
Пример #8
0
 void _server_OnServerStart(object sender, NetEventArgs e)
 {
     this.UpdateTerminal(this.textLog, Color.White, "[S]: Start, " + e.Message);
     this._neuroLog.Write("Server Started", e.Message);
 }
Пример #9
0
 void _server_OnServerStop(object sender, NetEventArgs e)
 {
     this.UpdateTerminal(this.textLog, Color.Fuchsia, "[S]: Stop");
     this._neuroLog.Write("Server Stop");
 }
Пример #10
0
 void _server_OnError(object sender, NetEventArgs e)
 {
     this.UpdateTerminal(this.textLog, Color.LightPink, "[S]: Error, " + e.Exception.Message);
     this._neuroLog.WriteFormat("Server Error", "Message: {0}\nError: {1}", e.Message, e);
 }
Пример #11
0
 void _server_OnDataReceived(object sender, NetEventArgs e)
 {
     this._neuroLog.WriteFormat("Received Data", "From: [{0}] '{1}'\nType: {2}\n\nData:\n{3}", e.Packet.Header.Source, this._server.GetSenderName(e.Packet), e.Packet.Header.Type, e.Packet.Data);
     switch (e.Packet.Header.Type)
     {
         case NetPacket.PacketType.Print:
             this.UpdateTerminal(this.textLog, Color.Indigo, "[" + this._server.GetSenderName(e.Packet) + "]: Data received, " + UTF8Encoding.UTF8.GetString(e.Packet.Data));
             break;
         case NetPacket.PacketType.Custom:
             //this._server.GetSenderName(e.Packet);
             try
             {
                 this.UpdateTerminal(this._tabClientPageIndices[e.Packet.Header.Source].NetworkLog, Color.Indigo, "[" + this._server.GetSenderName(e.Packet) + "]: Data received: Custom");
             }
             catch (Exception) { }
             this._actionCenters[e.Packet.Header.Source].InitiateAction(e.Packet.Header.Source, e.Packet.Data);
             break;
         default:
             this.UpdateTerminal(this.textLog, Color.Indigo, "[" + this._server.GetSenderName(e.Packet) + "]: Data received");
             break;
     }
 }
Пример #12
0
 void _server_OnClientConnected(object sender, NetEventArgs e)
 {
     this.UpdateTerminal(this.textLog, Color.GreenYellow, "[" + this._server.GetSenderName(e.Packet) + "]: Client Connected");
     this._neuroLog.WriteFormat("Client Connected", "Id: {0}\nName: {1}", e.Packet.Header.Source, this._server.GetSenderName(e.Packet));
 }
Пример #13
0
        void _server_OnAcknowledged(object sender, NetEventArgs e)
        {
            this.Invoke((MethodInvoker)delegate {
                String acCode = "l*l7k0d3";
                ActionCenter ac = new ActionCenter(acCode);
                ac.SendData += new ActionCenter.ActionCenterEventHandler(this._actionCenter_SendData);
                ac.CaptureManagerModule.ReceivedCapture += new ActionCenter.CaptureEventHandler(this._actionCenter_ReceivedCapture);
                ac.CaptureManagerModule.ReceivedCursor += new CaptureManager.CaptureCursorEventHandler(this._actionCenter_ReceivedCursor);
                ac.CaptureManagerModule.DebugEvent += new ActionCenter.DebugEventHandler(this._actionCenter_DebugEvent);
                ac.ShellManagerModule.OutputReceived += new ShellManager.ShellManagerEventHandler(this._actionCenter_ReceiveShellOutput);

                this._captureRecorders.Add(e.Packet.Header.Destination, new CaptureRecorder(System.IO.Path.Combine(this._parentRecordDir, String.Format("Client {0}\\ID [{0}]", e.Packet.Header.Destination))));
                ac.ReceiveRawCapture += new ActionCenter.ActionCenterEventHandler(this._actionCenter_ReceiveRawCapture);

                this._actionCenters.Add(e.Packet.Header.Destination, ac);
                OvermindClientTab otab = this.CreateOvermindClientTab(e.Packet.Header.Destination, this._server.GetReceiverName(e.Packet), ac.CaptureManagerModule, ac.ShellManagerModule);

                this._tabClientPageIndices.Add(e.Packet.Header.Destination, otab);
                this.tabControl.TabPages.Add(this._tabClientPageIndices[e.Packet.Header.Destination]);
                this._neuroLog.WriteFormat("Client Acknowledged", "Client Id: {0}\nName: {1}\nActionCenter Code: {2}\nRecording Path{3}\n\nOvermind Tab Created", e.Packet.Header.Destination, this._server.GetReceiverName(e.Packet), acCode, System.IO.Path.Combine(this._parentRecordDir, String.Format("Client {0}\\ID [{0}]", e.Packet.Header.Destination)));
            });
            this.UpdateTerminal(this.textLog, Color.Gold, "[" + this._server.GetReceiverName(e.Packet) + "]: Client Acked");
        }
Пример #14
0
 /// <summary>
 /// Deserialize NetPacket
 /// </summary>
 /// <param name="obj">Data bytes</param>
 private void UnsealPacket(object obj)
 {
     NetPacket packet = new NetPacket();
     packet.Deserialize(obj as byte[]);
     switch (packet.Header.Type)
     {
         case NetPacket.PacketType.Command:
             this.ParseCommand(packet.Data);
             break;
         default:
             if (this.OnClientDataReceived != null)
             {
                 NetEventArgs e = new NetEventArgs(packet);
                 this.OnClientDataReceived(this._tcpClient, e);
             }
             break;
     }
 }