/* static */ void wxLog::OnLog(wxLogLevel level, const wxString& msg, time_t t) { wxLogRecordInfo info; info.timestamp = t; #if wxUSE_THREADS info.threadId = wxThread::GetCurrentId(); #endif // wxUSE_THREADS OnLog(level, msg, info); }
qtDLGNanomite::qtDLGNanomite(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags), m_IsRestart(false) { setupUi(this); setAcceptDrops(true); QApplication::setStyle(new QPlastiqueStyle); QFontDatabase::addApplicationFont(":/Fonts/Fonts/consola.ttf"); this->setStyleSheet(clsHelperClass::LoadStyleSheet()); qRegisterMetaType<DWORD>("DWORD"); qRegisterMetaType<quint64>("quint64"); qRegisterMetaType<BPStruct>("BPStruct"); qRegisterMetaType<HANDLE>("HANDLE"); clsAPIImport::LoadFunctions(); coreBPManager = new clsBreakpointManager; coreDebugger = new clsDebugger(coreBPManager); coreDisAs = new clsDisassembler; PEManager = new clsPEManager; dlgDetInfo = new qtDLGDetailInfo(this,Qt::Window); dlgDbgStr = new qtDLGDebugStrings(this,Qt::Window); dlgBPManager = new qtDLGBreakPointManager(this,Qt::Window); dlgTraceWindow = new qtDLGTrace(this,Qt::Window); dlgPatchManager = new qtDLGPatchManager(this,Qt::Window); dlgBookmark = new qtDLGBookmark(this, Qt::Window); qtNanomiteDisAsColor = new qtNanomiteDisAsColorSettings; qtDLGMyWindow = this; lExceptionCount = 0; LoadWidgets(); settings->CheckIfFirstRun(); settings->LoadDebuggerSettings(coreDebugger); settings->LoadDisassemblerColor(qtNanomiteDisAsColor); settings->LoadRecentDebuggedFiles(m_recentDebuggedFiles); LoadRecentFileMenu(true); DisAsGUI = new qtDLGDisassembler(this); this->setCentralWidget(DisAsGUI); // Callbacks from Debugger Thread to GUI connect(coreDebugger,SIGNAL(OnThread(DWORD,DWORD,quint64,bool,DWORD,bool)), dlgDetInfo,SLOT(OnThread(DWORD,DWORD,quint64,bool,DWORD,bool)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnPID(DWORD,QString,DWORD,quint64,bool)), dlgDetInfo,SLOT(OnPID(DWORD,QString,DWORD,quint64,bool)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnException(QString,QString,quint64,quint64,DWORD,DWORD)), dlgDetInfo,SLOT(OnException(QString,QString,quint64,quint64,DWORD,DWORD)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnDbgString(QString,DWORD)), dlgDbgStr,SLOT(OnDbgString(QString,DWORD)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnDll(QString,DWORD,quint64,bool)), dlgDetInfo,SLOT(OnDll(QString,DWORD,quint64,bool)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnLog(QString)), logView,SLOT(OnLog(QString)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(AskForException(DWORD)),this,SLOT(AskForException(DWORD)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnDebuggerBreak()),this,SLOT(OnDebuggerBreak()),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnDebuggerTerminated()),this,SLOT(OnDebuggerTerminated()),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),dlgBPManager,SLOT(UpdateCompleter(QString,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),dlgBookmark,SLOT(UpdateBookmarks(QString,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(UpdateOffsetsPatches(HANDLE,int)),dlgPatchManager,SLOT(UpdateOffsetPatch(HANDLE,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(UpdateOffsetsPatches(HANDLE,int)),dlgBookmark,SLOT(BookmarkUpdateOffsets(HANDLE,int)),Qt::QueuedConnection); connect(coreBPManager,SIGNAL(OnBreakpointAdded(BPStruct,int)),dlgBPManager,SLOT(OnUpdate(BPStruct,int)),Qt::QueuedConnection); connect(coreBPManager,SIGNAL(OnBreakpointDeleted(quint64)),dlgBPManager,SLOT(OnDelete(quint64)),Qt::QueuedConnection); // Callbacks from Debugger to PEManager connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),PEManager,SLOT(InsertPIDForFile(QString,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(DeletePEManagerObject(QString,int)),PEManager,SLOT(CloseFile(QString,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(CleanPEManager()),PEManager,SLOT(CleanPEManager()),Qt::QueuedConnection); // Actions for the MainMenu and Toolbar connect(actionFile_OpenNew, SIGNAL(triggered()), this, SLOT(action_FileOpenNewFile())); connect(actionFile_AttachTo, SIGNAL(triggered()), this, SLOT(action_FileAttachTo())); connect(actionFile_Detach, SIGNAL(triggered()), this, SLOT(action_FileDetach())); connect(actionFile_Exit, SIGNAL(triggered()), this, SLOT(action_FileTerminateGUI())); connect(actionFile_Load, SIGNAL(triggered()), this, SLOT(action_FileLoad())); connect(actionFile_Save, SIGNAL(triggered()), this, SLOT(action_FileSave())); connect(actionDebug_Start, SIGNAL(triggered()), this, SLOT(action_DebugStart())); connect(actionDebug_Stop, SIGNAL(triggered()), this, SLOT(action_DebugStop())); connect(actionDebug_Restart, SIGNAL(triggered()), this, SLOT(action_DebugRestart())); connect(actionDebug_Suspend, SIGNAL(triggered()), this, SLOT(action_DebugSuspend())); connect(actionDebug_Step_In, SIGNAL(triggered()), this, SLOT(action_DebugStepIn())); connect(actionDebug_Step_Out, SIGNAL(triggered()), this, SLOT(action_DebugStepOut())); connect(actionDebug_Step_Over, SIGNAL(triggered()), this, SLOT(action_DebugStepOver())); connect(actionOptions_About, SIGNAL(triggered()), this, SLOT(action_OptionsAbout())); connect(actionOptions_Options, SIGNAL(triggered()), this, SLOT(action_OptionsOptions())); connect(actionOptions_Update, SIGNAL(triggered()), this, SLOT(action_OptionsUpdate())); connect(actionWindow_Detail_Information, SIGNAL(triggered()), this, SLOT(action_WindowDetailInformation())); connect(actionWindow_Breakpoint_Manager, SIGNAL(triggered()), this, SLOT(action_WindowBreakpointManager())); connect(actionWindow_Show_Patches, SIGNAL(triggered()), this, SLOT(action_WindowPatches())); connect(actionWindow_Show_Memory, SIGNAL(triggered()), this, SLOT(action_WindowShowMemory())); connect(actionWindow_Show_Heap, SIGNAL(triggered()), this, SLOT(action_WindowShowHeap())); connect(actionWindow_Show_Strings, SIGNAL(triggered()), this, SLOT(action_WindowShowStrings())); connect(actionWindow_Show_Debug_Output, SIGNAL(triggered()), this, SLOT(action_WindowShowDebugOutput())); connect(actionWindow_Show_Handles, SIGNAL(triggered()), this, SLOT(action_WindowShowHandles())); connect(actionWindow_Show_Windows, SIGNAL(triggered()), this, SLOT(action_WindowShowWindows())); connect(actionWindow_Show_Functions, SIGNAL(triggered()), this, SLOT(action_WindowShowFunctions())); connect(actionWindow_Show_Privileges, SIGNAL(triggered()), this, SLOT(action_WindowShowPrivileges())); connect(actionWindow_Show_Bookmarks, SIGNAL(triggered()), this, SLOT(action_WindowShowBookmarks())); connect(action_Debug_Run_to_UserCode,SIGNAL(triggered()), this, SLOT(action_DebugRunToUserCode())); connect(actionDebug_Trace_Start, SIGNAL(triggered()), this, SLOT(action_DebugTraceStart())); connect(actionDebug_Trace_Stop, SIGNAL(triggered()), this, SLOT(action_DebugTraceStop())); connect(actionDebug_Trace_Show, SIGNAL(triggered()), this, SLOT(action_DebugTraceShow())); connect(actionWindow_Show_PEEditor, SIGNAL(triggered()), this, SLOT(action_WindowShowPEEditor())); // Callbacks to display disassembly connect(dlgTraceWindow,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); connect(cpuRegView,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); connect(dlgDetInfo,SIGNAL(ShowInDisassembler(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); connect(coreDisAs,SIGNAL(DisAsFinished(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64)),Qt::QueuedConnection); connect(dlgBPManager,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); connect(dlgBookmark,SIGNAL(ShowInDisassembler(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); // Callbacks from PatchManager to GUI connect(dlgPatchManager,SIGNAL(OnReloadDebugger()),this,SLOT(OnDebuggerBreak())); // Callbacks from Disassembler GUI to GUI connect(DisAsGUI,SIGNAL(OnDebuggerBreak()),this,SLOT(OnDebuggerBreak())); // Callbacks to StateBar connect(dlgTraceWindow,SIGNAL(OnUpdateStatusBar(int,quint64)),this,SLOT(UpdateStateBar(int,quint64))); actionDebug_Trace_Stop->setDisabled(true); ParseCommandLineArgs(); }
/** * \fn Log::~Log() * \brief Logging destructor, this is where the files are actually written and messages are logged */ Log::~Log() { Flux::string LogColor = Config ? Config->LogColor : "\033[0m"; Flux::string message = Flux::Sanitize(this->buffer.str()); std::stringstream logstream; if(this->u && !this->c) message = this->u->nick + " " + message; if(this->u && this->c) message = this->u->nick + " used " + this->c->name + " " + message; EventResult result; FOREACH_RESULT(I_OnLog, OnLog(this), result); if(result != EVENT_CONTINUE) return; switch(type) { case LOG_SILENT: case LOG_NORMAL: logstream << TimeStamp() << " " << message; this->ToFile(logstream); break; case LOG_THREAD: if(protocoldebug) { logstream << TimeStamp() << " [THREAD] " << message; this->ToFile(logstream); } break; case LOG_DEBUG: if(protocoldebug) { logstream << TimeStamp() << " " << message; this->ToFile(logstream); } break; case LOG_DEVEL: if(!protocoldebug && dev) { logstream << TimeStamp() << message; this->ToFile(logstream); } break; case LOG_RAWIO: if(protocoldebug) { logstream << TimeStamp() << " " << message; this->ToFile(logstream); } break; case LOG_CRITICAL: logstream << "\033[22;31m" << TimeStamp() << " [CRITICAL] " << message << LogColor; this->ToFile(logstream); break; case LOG_WARN: logstream << TimeStamp() << " \033[22;33m[WARNING]" << LogColor << " " << message; this->ToFile(logstream); break; case LOG_MEMORY: if(memdebug) std::cout << TimeStamp() << " [MEMORY] " << message << std::endl; return; // ignore everything else, it doesn't matter case LOG_TERMINAL: if(InTerm()) std::cout << this->buffer.str() << std::endl; return; default: Log(LOG_WARN) << "Wtf log case is this?"; Log(LOG_TERMINAL) << "\033[22;33m[UNDEFINED]" << LogColor << " " << message; } }