コード例 #1
0
        private List <PacketSummary> HandleIncomingData(string str)
        {
            List <PacketSummary> packets = new List <PacketSummary>();

            try
            {
                int amountRead = 0;

                while (amountRead < str.Length)
                {
                    int recieveLength = Base64Encoding.DecodeInt32(str.Substring(amountRead, 3));
                    amountRead += 3;

                    string packet = str.Substring(amountRead, recieveLength);

                    PacketSummary summary = new PacketSummary(packet.Substring(0, 2), (packet.Substring(0, 2).Length > 0 ? packet.Substring(2) : ""));
                    packets.Add(summary);

                    amountRead += recieveLength;
                }
            }
            catch { }

            return(packets);
        }
コード例 #2
0
 private void btnToB64_Click(object sender, EventArgs e)
 {
     try
     {
         string value = Base64Encoding.EncodeInt32(int.Parse(txtToB64.Text), 2);
         txtFromB64.Text = value;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #3
0
ファイル: frmHook.cs プロジェクト: Neffex140/JewLogger
        public void ProcessPacketHooking(bool showMessage)
        {
            _hookedIncomingIds.Clear();
            _hookedOutgoingIds.Clear();

            foreach (DataRow row in _incomingDataTable.Rows)
            {
                string headerId = row.Field <string>(0);
                string header   = row.Field <string>(1);

                if (headerId != null && headerId.Length > 0)
                {
                    try
                    {
                        _hookedIncomingIds.Add(int.Parse(headerId));
                        continue;
                    }
                    catch { }
                }

                if (header != null && header.Length > 0)
                {
                    _hookedIncomingIds.Add(Base64Encoding.DecodeInt32(header));
                }
            }

            foreach (DataRow row in _outgoingDataTable.Rows)
            {
                string headerId = row.Field <string>(0);
                string header   = row.Field <string>(1);

                if (headerId != null && headerId.Length > 0)
                {
                    try
                    {
                        _hookedOutgoingIds.Add(int.Parse(headerId));
                        continue;
                    }
                    catch { }
                }

                if (header != null && header.Length > 0)
                {
                    _hookedOutgoingIds.Add(Base64Encoding.DecodeInt32(header));
                }
            }

            if (showMessage)
            {
                MessageBox.Show("Added " + _hookedIncomingIds.Count + " incoming headers and " + _hookedOutgoingIds.Count + " outgoing headers to be hooked.");
            }
        }
コード例 #4
0
ファイル: frmSending.cs プロジェクト: Neffex140/JewLogger
        private void btnSendToServer_Click(object sender, EventArgs e)
        {
            string sendPacket = AddUnreadableCharacters("@" + Base64Encoding.EncodeInt32(txtSendData.Text.Length, 2) + txtSendData.Text);

            byte[] data = Encoding.Default.GetBytes(sendPacket);
            try
            {
                frmMain.Form.TcpForwarder.DestinationState.DestinationSocket.Send(data, data.Length, SocketFlags.None);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #5
0
        private string BuildPacket(PacketSummary packet, string packetData, bool incoming)
        {
            string response;

            if (this._incoming)
            {
                response = packet.Header + packetData;
                response = "@" + Base64Encoding.EncodeInt32(response.Length, 2) + response;
            }
            else
            {
                response = packet.Header + packetData;
            }

            return(response);
        }
コード例 #6
0
 private void btnFromB64_Click(object sender, EventArgs e)
 {
     try
     {
         try
         {
             int value = Base64Encoding.DecodeInt32(txtFromB64.Text);
             txtToB64.Text = value + "";
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #7
0
 public PacketSummary(string Header, string Data)
 {
     this.Header   = Header;
     this.HeaderId = Base64Encoding.DecodeInt32(this.Header);
     this.Data     = Data;
 }