Beispiel #1
0
 static void Main()
 {
     DriverIO.initialize();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new MainWindow());
 }
 private void btnRecord_Click(object sender, EventArgs e)
 {
     if (btnRecord.Text == "Start recording")
     {
         if (DriverIO.startLogging(txtRecord.Text))
         {
             btnRecord.Text = "Stop recording";
         }
         else
         {
             MessageBox.Show("Starting recording failed");
         }
     }
     else
     {
         if (DriverIO.stopLogging())
         {
             btnRecord.Text = "Start recording";
         }
         else
         {
             MessageBox.Show("Stopping recording failed");
         }
     }
 }
 private void btnHook_Click(object sender, EventArgs e)
 {
     if (btnHook.Text == "Hook")
     {
         if (DriverIO.hook())
         {
             btnHook.Text = "Unhook";
         }
         else
         {
             MessageBox.Show("Hooking failed");
         }
     }
     else
     {
         if (DriverIO.unhook())
         {
             btnHook.Text = "Hook";
         }
         else
         {
             MessageBox.Show("Unhooking failed");
         }
     }
 }
        private void table_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex > 5)
            {
                try
                {
                    HV_HOOKING_HCALL_CONF_SET conf;
                    //conf.hypercall = (uint)Int32.Parse(table.Rows[e.RowIndex].Cells[0].Value.ToString());
                    conf.hypercall  = Convert.ToUInt32(table.Rows[e.RowIndex].Cells[0].Value.ToString().Substring(2), 16);
                    conf.breakpoint = 0;
                    conf.dbgPrint   = 0;
                    conf.log        = 0;
                    conf.bufferSize = 0x1000;

                    if (e.ColumnIndex == 6)
                    {
                        conf.breakpoint = 1;
                    }
                    if (e.ColumnIndex == 7)
                    {
                        conf.dbgPrint = 1;
                    }
                    if (e.ColumnIndex == 8)
                    {
                        conf.log        = 1;
                        conf.bufferSize = 0x1000;
                    }

                    DriverIO.setConf(conf);
                }
                catch (Exception) { }
            }
        }
        private void btnAllDbg_Click(object sender, EventArgs e)
        {
            HV_HOOKING_HCALL_CONF_SET conf;

            conf.hypercall  = 0;
            conf.breakpoint = 0;
            conf.dbgPrint   = 1;
            conf.log        = 0;
            conf.bufferSize = 0x1000;
            DriverIO.setConf(conf);
        }
Beispiel #6
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                uint   callnr   = UInt32.Parse(txtCallnr.Text);
                uint   count    = UInt32.Parse(txtCount.Text);
                uint   start    = UInt32.Parse(txtStart.Text);
                uint   outSize  = UInt32.Parse(txtOutSize.Text);
                long   inputInt = HypercallConversions.hypercallInput(callnr, optFast.Checked, count, start);
                long   output;
                byte[] outputBuffer = new byte[outSize];

                byte[] inputBuffer = new byte[hexBoxIn.ByteProvider.Length];
                for (int x = 0; x < inputBuffer.Length; x++)
                {
                    inputBuffer[x] = hexBoxIn.ByteProvider.ReadByte(x);
                }

                if (optFast.Checked && inputBuffer.Length != 0x10)
                {
                    MessageBox.Show("Fast hypercall input has to be 16 bytes (two 8 byte registers");
                    return;
                }

                if (DriverIO.hypercall(inputInt, inputBuffer, (uint)inputBuffer.Length, out output, out outputBuffer, outSize))
                {
                    txtResultStatus.Text = (output & 0xFFFF).ToString();
                    if ((output & 0xFFFF) > 0 || optFast.Checked)
                    {
                        hexBoxOut.ByteProvider = new DynamicByteProvider(new byte[0]);
                        hexBoxOut.Visible      = false;
                    }
                    else
                    {
                        hexBoxOut.ByteProvider = new DynamicByteProvider(outputBuffer);
                        hexBoxOut.Visible      = true;
                    }
                }
                else
                {
                    hexBoxOut.ByteProvider = new DynamicByteProvider(new byte[0]);
                    hexBoxOut.Visible      = false;
                    txtResultStatus.Text   = "";
                    MessageBox.Show("Making hypercall failed!");
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
 private void refreshStats(Object source, ElapsedEventArgs e)
 {
     HV_HOOKING_HCALL_STATS[] stats = DriverIO.getStats();
     if (stats != null)
     {
         for (int x = 0; x < table.Rows.Count; x++)
         {
             //int idx = (int)table.Rows[x].Cells[0].Value;
             int idx = Convert.ToInt32(table.Rows[x].Cells[0].Value.ToString().Substring(2), 16);
             table.Rows[x].Cells[1].Value = stats[idx].count;
             table.Rows[x].Cells[2].Value = stats[idx].lastProcessID;
             table.Rows[x].Cells[3].Value = stats[idx].lastElementCount;
             table.Rows[x].Cells[4].Value = stats[idx].fast > 0;
             table.Rows[x].Cells[5].Value = stats[idx].slow > 0;
         }
         applyFilters();
         return;
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            int total = 0;

            for (int x = 0; x < table.Rows.Count; x++)
            {
                if (table.Rows[x].Selected)
                {
                    total++;
                }
            }

            for (int x = 0; x < table.Rows.Count; x++)
            {
                if (table.Rows[x].Selected)
                {
                    int idx = Int32.Parse(table.Rows[x].Cells[0].Value.ToString());
                    lblCount.Text = total.ToString() + " left (ID=" + idx + ")";
                    lblCount.Refresh();
                    HV_MUTATION_CONF conf;
                    conf.target     = 0;
                    conf.dbgMsg     = (byte)(chkFuzzDbg.Checked ? 1 : 0);
                    conf.type       = getFuzzType();
                    conf.seed       = UInt32.Parse(txtFuzzSeed.Text);
                    conf.minChanges = UInt32.Parse(txtFuzzMin.Text);
                    conf.maxChanges = UInt32.Parse(txtFuzzMax.Text);
                    conf.maxLength  = UInt32.Parse(txtFuzzMaxPos.Text);
                    conf.count      = getFuzzCount((uint)(calls[idx].input.Length));

                    if (DriverIO.hypercallFuzz((long)calls[idx].code, calls[idx].input, conf.maxLength, conf))
                    {
                        total--;
                    }
                    else
                    {
                        lblCount.Text = "FAILED";
                        return;
                    }
                }
            }
            lblCount.Text = "DONE";
        }
Beispiel #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            uint callnr   = UInt32.Parse(txtCallnr.Text);
            uint count    = UInt32.Parse(txtCount.Text);
            uint start    = UInt32.Parse(txtStart.Text);
            long inputInt = HypercallConversions.hypercallInput(callnr, optFast.Checked, count, start);

            byte[] inputBuffer = new byte[hexBoxIn.ByteProvider.Length];
            for (int x = 0; x < inputBuffer.Length; x++)
            {
                inputBuffer[x] = hexBoxIn.ByteProvider.ReadByte(x);
            }

            HV_MUTATION_CONF conf;

            conf.target     = 0;
            conf.dbgMsg     = (byte)(chkFuzzDbg.Checked ? 1 : 0);
            conf.type       = getFuzzType();
            conf.seed       = UInt32.Parse(txtFuzzSeed.Text);
            conf.minChanges = UInt32.Parse(txtFuzzMin.Text);
            conf.maxChanges = UInt32.Parse(txtFuzzMax.Text);
            conf.maxLength  = (uint)inputBuffer.Length;
            conf.count      = getFuzzCount((uint)inputBuffer.Length);

            if (optFast.Checked && inputBuffer.Length != 0x10)
            {
                MessageBox.Show("Fast hypercall input has to be 16 bytes (two 8 byte registers");
                return;
            }

            if (DriverIO.hypercallFuzz(inputInt, inputBuffer, (uint)inputBuffer.Length, conf))
            {
                MessageBox.Show("DONE");
            }
            else
            {
                MessageBox.Show("FAILED");
            }
        }
 private void btnClear_Click(object sender, EventArgs e)
 {
     DriverIO.clearStats();
 }