Example #1
0
        /// <summary>
        /// Checks if the connected socket on the other end is our Reloaded Assembler
        /// by sending a 0x00 message type and expecting a string.
        /// </summary>
        private static bool CheckAssembler()
        {
            // Check Data
            MessageStruct checkAssembler = new MessageStruct
            {
                MessageType = (ushort)MessageTypes.ReportAssembler,
                Data        = new byte[] { 0x00 }
            };

            // Send check to server
            MessageStruct response = _assemblerClient.ClientSocket.SendData(checkAssembler, true);

            // Check returned string.
            string checkString = Encoding.ASCII.GetString(response.Data);

            // Check the identification string for our assembler.
            if (checkString == ReloadedCheckMessage)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// Assembles a supplied set of FASM assembler compatible mnemonics
        /// (X86, X64) and returns the result back to the user.
        /// </summary>
        /// <param name="mnemonics">The successfully assembled X86, X64 or other compatible mnemonics.</param>
        /// <returns>0x90 (nop) if the assembly operation fails, else the successfully assembled bytes.</returns>
        public static byte[] Assemble(string[] mnemonics)
        {
            // Build Message to Assemble Mnemonics.
            MessageStruct assemblyRequest = new MessageStruct
            {
                MessageType = (ushort)MessageTypes.Assemble,
                Data        = SerializeObject(mnemonics)
            };

            // Request & Retrieve | MessageStruct Data
            MessageStruct response = _assemblerClient.ClientSocket.SendData(assemblyRequest, true);

            return(response.Data);
        }