コード例 #1
0
 // Run Nonce Get
 private void btn6_Click(object sender, EventArgs e)
 {
     dump_DST_nodeid = textBox3.Text;
     dump_DST_nodeid = Regex.Replace(dump_DST_nodeid, " ", "");
     char[] buf = dump_DST_nodeid.ToCharArray();
     //byte[] real_dst = new byte[1];
     StringToHex.String_to_Hex(buf, real_dst_for_enc, buf.Length);
     Send_command.RunCommand_Nonsecurity(controller, real_dst_for_enc, nonce_get_command);
 }
コード例 #2
0
        // 4. Run command (non-security)
        private void btn4_Click(object sender, EventArgs e)
        {
            dump_DST_nodeid = textBox2.Text;
            dump_DST_nodeid = Regex.Replace(dump_DST_nodeid, " ", "");
            char[] buf      = dump_DST_nodeid.ToCharArray();
            byte[] real_dst = new byte[1];
            StringToHex.String_to_Hex(buf, real_dst, buf.Length);

            dump_command = textBox1.Text;
            dump_command = Regex.Replace(dump_command, " ", "");
            char[] buf1         = dump_command.ToCharArray();
            byte[] real_command = new byte[buf1.Length / 2];
            StringToHex.String_to_Hex(buf1, real_command, buf1.Length);

            dump_DST_nodeid = null;
            dump_command    = null;

            Send_command.RunCommand_Nonsecurity(controller, real_dst, real_command);
        }
コード例 #3
0
        //Dos Attack
        private void btn4_Click(object sender, EventArgs e)
        {
            dump_DST_nodeid = textBox2.Text;
            dump_DST_nodeid = Regex.Replace(dump_DST_nodeid, " ", "");
            char[] buf      = dump_DST_nodeid.ToCharArray();
            byte[] real_dst = new byte[1];
            StringToHex.String_to_Hex(buf, real_dst, buf.Length);

            dump_command = textBox1.Text;
            dump_command = Regex.Replace(dump_command, " ", "");
            char[] buf1         = dump_command.ToCharArray();
            byte[] real_command = new byte[buf1.Length / 2];
            StringToHex.String_to_Hex_For_Dos(buf1, real_command, buf1.Length);

            dump_DST_nodeid = null;
            dump_command    = null;

            if (real_command.Length < 40)
            {
                Send_command.RunCommand_Nonsecurity(controller, real_dst, real_command);
            }
            else
            {
                byte[] segment_complete = new byte[2];
                byte[] Seg_Command      = new byte[42];
                int    cnt = 0;
                int    len = real_command.Length;

                do
                {
                    if (cnt == 0) // first packet
                    {
                        Seg_Command[0] = First_Segment[0];
                        Seg_Command[1] = First_Segment[1];
                        // len = len - 40
                        for (int i = 0; i < 40; i++)
                        {
                            Seg_Command[i + 2] = real_command[i];
                        }
                        len = len - 40;
                        Send_command.RunCommand_Nonsecurity(controller, real_dst, Seg_Command);
                        Array.Clear(Seg_Command, 0, Seg_Command.Length);
                    }
                    else // subsequent packet
                    {
                        Seg_Command[0] = Subsequent_Segment[0];
                        Seg_Command[1] = Subsequent_Segment[1];

                        // 1) len >= 40
                        // 2) len < 40
                        if (len >= 40)
                        {
                            for (int i = 0; i < 40; i++)
                            {
                                Seg_Command[i + 2] = real_command[i + (cnt * 40)];
                            }
                            len = len - 40;
                            Send_command.RunCommand_Nonsecurity(controller, real_dst, Seg_Command);
                            Array.Clear(Seg_Command, 0, Seg_Command.Length);
                        }
                        else
                        {
                            byte[] Seg_Command2 = new byte[len + 2];
                            Seg_Command2[0] = Subsequent_Segment[0];
                            Seg_Command2[1] = Subsequent_Segment[1];
                            for (int i = 0; i < len; i++)
                            {
                                Seg_Command2[i + 2] = real_command[i + (cnt * 40)];
                            }
                            len = 0;
                            Send_command.RunCommand_Nonsecurity(controller, real_dst, Seg_Command2);
                            Array.Clear(Seg_Command2, 0, Seg_Command2.Length);
                        }
                    }
                    cnt++;
                } while (len != 0);
                segment_complete[0] = Segment_Complete[0];
                segment_complete[1] = Segment_Complete[1];
                Send_command.RunCommand_Nonsecurity(controller, real_dst, segment_complete);
                cnt = 0;
            }
        }