int main(int argc, char *argv[]) { PE_FILE pe; FILE *dbfile = NULL, *fp = NULL; QWORD ep_offset, pesize; char value[MAX_MSG]; unsigned char *pe_data; if (argc < 2) { usage(); exit(1); } memset(&config, 0, sizeof(config)); parse_options(argc, argv); // opcoes if ((fp = fopen(argv[argc-1], "rb")) == NULL) EXIT_ERROR("file not found or unreadable"); pe_init(&pe, fp); // inicializa o struct pe if (!ispe(&pe)) EXIT_ERROR("invalid PE file"); if (!pe_get_optional(&pe)) EXIT_ERROR("unable to read optional header"); if (!(ep_offset = rva2ofs(&pe, pe.entrypoint))) EXIT_ERROR("unable to get entrypoint offset"); pesize = pe_get_size(&pe); pe_data = (unsigned char *) xmalloc(pesize); //if (fseek(pe.handle, ep, SEEK_SET)) //EXIT_ERROR("unable to seek to entrypoint offset"); if (!fread(pe_data, pesize, 1, pe.handle)) EXIT_ERROR("unable to read entrypoint data"); if (!loaddb(&dbfile)) fprintf(stderr, "warning: without valid database file, %s will search in generic mode only\n", PROGRAM); // packer by signature if (compare_signature(pe_data, ep_offset, dbfile, value)); // generic detection else if (generic_packer(&pe, ep_offset)) snprintf(value, MAX_MSG, "generic"); else snprintf(value, MAX_MSG, "no packer found"); free(pe_data); output("packer", value); if (dbfile) fclose(dbfile); pe_deinit(&pe); return 0; }
/************************************************************************ * dasm * * - dasm is the application main window. * * - everything the main window does is in this routine (for now) and * * where a response is quick it appears in one of its helper functions * * later in this file, otherwise it has been substantial enough to * * warrant its own file and routines........ * * - this is long * ************************************************************************/ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) { HDC hdc; TEXTMETRIC tm; POINT point; lptr scrll; int killcount; g_hMainWnd=hwnd; RECT tmp_rect; switch(message) { case WM_COMMAND: switch(LOWORD(wParam)) { case file_exit: SendMessage(g_hMainWnd,WM_CLOSE,0,0); break; case file_save: savefile_text(hwnd,true,false); break; case get_comment: getcomment(); break; case jump_to: jumpto(); break; case change_oep: changeoep(); break; case save_database: savedb(); break; case load_database: loaddb(); break; case save_asm: savefile_text(hwnd,false,false); break; case block_saveasm: savefile_text(hwnd,false,true); break; case block_savetext: savefile_text(hwnd,true,true); break; case cm_decrypt: decrypterdialog(); break; case file_open: newfile(); break; case view_segment: segviewer(); break; case view_names: namesviewer(); break; case view_imports: importsviewer(); break; case view_exports: exportsviewer(); break; case view_xrefs: xrefsviewer(); break; case make_code: g_scheduler.addtask(user_makecode,priority_userrequest,nlptr,NULL); break; case make_dword: g_scheduler.addtask(user_makedword,priority_userrequest,nlptr,NULL); break; case float_single: g_scheduler.addtask(user_makesingle,priority_userrequest,nlptr,NULL); break; case float_double: g_scheduler.addtask(user_makedouble,priority_userrequest,nlptr,NULL); break; case float_longdouble: g_scheduler.addtask(user_makelongdouble,priority_userrequest,nlptr,NULL); break; case make_word: g_scheduler.addtask(user_makeword,priority_userrequest,nlptr,NULL); break; case make_string: g_scheduler.addtask(user_makestring,priority_userrequest,nlptr,NULL); break; case pascal_string: g_scheduler.addtask(user_pascalstring,priority_userrequest,nlptr,NULL); break; case uc_string: g_scheduler.addtask(user_ucstring,priority_userrequest,nlptr,NULL); break; case up_string: g_scheduler.addtask(user_upstring,priority_userrequest,nlptr,NULL); break; case dos_string: g_scheduler.addtask(user_dosstring,priority_userrequest,nlptr,NULL); break; case general_string: g_scheduler.addtask(user_generalstring,priority_userrequest,nlptr,NULL); break; case argover_dec: g_scheduler.addtask(user_argoverdec,priority_userrequest,nlptr,NULL); break; case arg_single: g_scheduler.addtask(user_argsingle,priority_userrequest,nlptr,NULL); break; case argover_hex: g_scheduler.addtask(user_argoverhex,priority_userrequest,nlptr,NULL); break; case argnegate: g_scheduler.addtask(user_argnegate,priority_userrequest,nlptr,NULL); break; case offset_dseg: g_scheduler.addtask(user_argoveroffsetdseg,priority_userrequest,nlptr,NULL); break; case argover_char: g_scheduler.addtask(user_argoverchar,priority_userrequest,nlptr,NULL); break; case undefine_line: g_scheduler.addtask(user_undefineline,priority_userrequest,nlptr,NULL); break; case undefine_lines: g_scheduler.addtask(user_undefinelines,priority_userrequest,nlptr,NULL); break; case undefine_lines_long: g_scheduler.addtask(user_undefinelines_long,priority_userrequest,nlptr,NULL); break; case block_undefine: g_scheduler.addtask(user_undefineblock,priority_userrequest,nlptr,NULL); break; case block_view: blockview(); break; case block_top: g_scheduler.addtask(user_marktopblock,priority_userrequest,nlptr,NULL); break; case block_bottom: g_scheduler.addtask(user_markbottomblock,priority_userrequest,nlptr,NULL); break; case line_jumpto: g_scheduler.addtask(user_jumpto,priority_userrequest,nlptr,NULL); break; case line_jumptoarg2: g_scheduler.addtask(user_jumptoarg2,priority_userrequest,nlptr,NULL); break; case Name_Location: namelocation(); break; case help_short: DialogBox(g_hInst,MAKEINTRESOURCE(help_shortcuts),hwnd,(DLGPROC)helpshortcuts); break; case help_about: DialogBox(g_hInst,MAKEINTRESOURCE(D_help_about),hwnd,(DLGPROC)habox); break; case Jump_Back: g_scheduler.addtask(user_jumpback,priority_userrequest,nlptr,NULL); break; case main_search: searchengine(); break; case search_again: searchmore(); break; case set_bg_color: g_options.bgcolor=choosecolour(g_options.bgcolor); GetClientRect(g_hMainWnd,&tmp_rect); InvalidateRect(g_hMainWnd,&tmp_rect,true); g_scheduler.addtask(windowupdate,priority_window,nlptr,NULL); break; case set_high_color: g_options.highcolor=choosecolour(g_options.highcolor); GetClientRect(g_hMainWnd,&tmp_rect); InvalidateRect(g_hMainWnd,&tmp_rect,true); g_scheduler.addtask(windowupdate,priority_window,nlptr,NULL); break; case set_text_color: g_options.textcolor=choosecolour(g_options.textcolor); GetClientRect(g_hMainWnd,&tmp_rect); InvalidateRect(g_hMainWnd,&tmp_rect,true); g_scheduler.addtask(windowupdate,priority_window,nlptr,NULL); break; case font_system: g_options.font=systemfont; setupfont(); break; case font_courier: g_options.font=courierfont; setupfont(); break; case font_courier10: g_options.font=courierfont10; setupfont(); break; case font_courier12: g_options.font=courierfont12; setupfont(); break; case font_ansi: g_options.font=ansifont; setupfont(); break; default: return DefWindowProc(hwnd,message,wParam,lParam); } break; case WM_CHAR: if(charinputenabled) switch(wParam) { case 'c': g_scheduler.addtask(user_makecode,priority_userrequest,nlptr,NULL); break; case 'C': g_scheduler.addtask(user_argoverchar,priority_userrequest,nlptr,NULL); break; case 'd': g_scheduler.addtask(user_makedword,priority_userrequest,nlptr,NULL); break; case 'D': g_scheduler.addtask(user_argoverdec,priority_userrequest,nlptr,NULL); break; case 'H': g_scheduler.addtask(user_argoverhex,priority_userrequest,nlptr,NULL); break; case '-': g_scheduler.addtask(user_argnegate,priority_userrequest,nlptr,NULL); break; case 'n': namelocation(); break; case ';': getcomment(); break; case 'o': g_scheduler.addtask(user_argoveroffsetdseg,priority_userrequest,nlptr,NULL); break; case 'p': g_scheduler.addtask(user_pascalstring,priority_userrequest,nlptr,NULL); break; case 's': g_scheduler.addtask(user_makestring,priority_userrequest,nlptr,NULL); break; case 'u': g_scheduler.addtask(user_undefineline,priority_userrequest,nlptr,NULL); break; case 'U': g_scheduler.addtask(user_undefinelines,priority_userrequest,nlptr,NULL); break; case 'w': g_scheduler.addtask(user_makeword,priority_userrequest,nlptr,NULL); break; case 't': g_scheduler.addtask(user_marktopblock,priority_userrequest,nlptr,NULL); break; case 'b': g_scheduler.addtask(user_markbottomblock,priority_userrequest,nlptr,NULL); break; default: break; } break; case WM_LBUTTONDOWN: dio.setpos(HIWORD(lParam)); break; case WM_RBUTTONDOWN: dio.setpos(HIWORD(lParam)); point.x=LOWORD(lParam); point.y=HIWORD(lParam); ClientToScreen(g_hMainWnd,&point); TrackPopupMenu(rmenu,0,point.x,point.y,0,g_hMainWnd,NULL); break; case WM_PAINT: if(!KillThread) DoPaint(hwnd,cxChar,cyChar); else PaintBack(hwnd); ValidateRect(g_hMainWnd,NULL); break; case WM_CLOSE: if(MessageBox(g_hMainWnd,"Are you sure that you want to exit Borg ?\n\rHit Yes To Exit\n\rHit No to Stay","Borg Disassembler", MB_ICONEXCLAMATION|MB_YESNO)==IDNO) break; g_scheduler.stopthread(); g_scheduler.addtask(quitborg,priority_quit,nlptr,NULL); KillThread=true; if(InThread) SetThreadPriority(ThreadHandle,THREAD_PRIORITY_TIME_CRITICAL); DestroyWindow(g_hMainWnd); return 0; case WM_DESTROY: save_reg_entries(); KillThread=true; killcount=0; Sleep(0); SetPriorityClass(ThreadHandle,HIGH_PRIORITY_CLASS); if(InThread) while(TestThread()) { killcount++; if(killcount>2) { // this is a nasty way of getting out. // sometimes the thread just will not exit nicely when its busy. if(TerminateThread(ThreadHandle,1)) { CloseHandle(ThreadHandle); break; } } } DeleteCriticalSection(&g_hCs); PostQuitMessage(0); break; case WM_SIZE: if(wParam==SIZE_MAXIMIZED) g_options.winmax=true; else if (wParam==SIZE_RESTORED) g_options.winmax=false; mainwndsize.top=0; mainwndsize.left=0; mainwndsize.right=LOWORD(lParam); mainwndsize.bottom=HIWORD(lParam); GetWindowRect(hwndStatusBar,&StatusWindowSize); GetWindowRect(g_hMainWnd,&mainwnd); MoveWindow(hwndStatusBar,0,mainwndsize.bottom-StatusWindowSize.bottom+StatusWindowSize.top, mainwndsize.right,StatusWindowSize.bottom-StatusWindowSize.top,true); break; case WM_MOUSEWHEEL: if (GET_KEYSTATE_WPARAM(wParam) & MK_SHIFT) { scrll.assign(0,GET_WHEEL_DELTA_WPARAM(wParam)/WHEEL_DELTA); g_scheduler.addtask(hscroll,priority_userrequest,scrll,NULL); } else { scrll.assign(0,-GET_WHEEL_DELTA_WPARAM(wParam)/WHEEL_DELTA); if(InThread) g_scheduler.addtask(scrolling,priority_userrequest,scrll,NULL); } break; case WM_VSCROLL: switch(LOWORD(wParam)) { case SB_TOP: break; case SB_BOTTOM: break; case SB_LINEUP: scrll.assign(0,-1); if(InThread) g_scheduler.addtask(scrolling,priority_userrequest,scrll,NULL); break; case SB_LINEDOWN: scrll.assign(0,1); if(InThread) g_scheduler.addtask(scrolling,priority_userrequest,scrll,NULL); break; case SB_PAGEUP: scrll.assign(0,-mainwndsize.bottom/cyChar+1); if(InThread) g_scheduler.addtask(scrolling,priority_userrequest,scrll,NULL); break; case SB_PAGEDOWN: scrll.assign(0,mainwndsize.bottom/cyChar-1); if(InThread) g_scheduler.addtask(scrolling,priority_userrequest,scrll,NULL); break; case SB_THUMBPOSITION: scrll.assign(0,HIWORD(wParam)); if(InThread) g_scheduler.addtask(vthumbposition,priority_userrequest,scrll,NULL); break; default: break; } break; case WM_HSCROLL: switch(LOWORD(wParam)) { case SB_LINEUP: scrll.assign(0,-1); g_scheduler.addtask(hscroll,priority_userrequest,scrll,NULL); break; case SB_LINEDOWN: scrll.assign(0,1); g_scheduler.addtask(hscroll,priority_userrequest,scrll,NULL); break; case SB_PAGEUP: scrll.assign(0,-8); g_scheduler.addtask(hscroll,priority_userrequest,scrll,NULL); break; case SB_PAGEDOWN: scrll.assign(0,8); g_scheduler.addtask(hscroll,priority_userrequest,scrll,NULL); break; case SB_THUMBPOSITION: scrll.assign(0,HIWORD(wParam)); if(InThread) g_scheduler.addtask(hthumbposition,priority_userrequest,scrll,NULL); break; default: break; } break; case WM_REPEATNAMEVIEW: namesviewer(); break; case WM_REPEATXREFVIEW: xrefsviewer(); break; // maximises window, used when the reg is read in at the start to maximise // the main window after initialisation of it case WM_MAXITOUT: ShowWindow(g_hMainWnd,SW_MAXIMIZE); break; case WM_CREATE: optionsinit(); hdc=GetDC(hwnd); SelectObject(hdc,GetStockObject(ANSI_FIXED_FONT)); GetTextMetrics(hdc,&tm); cxChar=tm.tmAveCharWidth; cyChar=tm.tmHeight+tm.tmExternalLeading; ReleaseDC(hwnd,hdc); InitializeCriticalSection(&g_hCs); hwndStatusBar=CreateStatusWindow(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|CCS_BOTTOM, "No File Loaded",hwnd,2); GetWindowRect(hwndStatusBar,&StatusWindowSize); GetWindowRect(g_hMainWnd,&mainwnd); SetScrollRange(hwnd,SB_VERT,0,VERTSCROLLRANGE,false); SetScrollPos(hwnd,SB_VERT,0,false); KillThread=false; InThread=false; rmenu=LoadMenu(g_hInst,MAKEINTRESOURCE(right_click_menu)); rmenu=GetSubMenu(rmenu,0); load_reg_entries(); setupfont(); break; case WM_KEYDOWN: if(!charinputenabled) break; switch(wParam) { case VK_HOME: SendMessage(hwnd,WM_VSCROLL,SB_TOP,0L); break; case VK_PRIOR: SendMessage(hwnd,WM_VSCROLL,SB_PAGEUP,0L); break; case VK_NEXT: SendMessage(hwnd,WM_VSCROLL,SB_PAGEDOWN,0L); break; case VK_DOWN: SendMessage(hwnd,WM_VSCROLL,SB_LINEDOWN,0L); break; case VK_UP: SendMessage(hwnd,WM_VSCROLL,SB_LINEUP,0L); break; case VK_LEFT: SendMessage(hwnd,WM_HSCROLL,SB_PAGEUP,0L); break; case VK_RIGHT: SendMessage(hwnd,WM_HSCROLL,SB_PAGEDOWN,0L); break; case VK_RETURN: if(GetKeyState(VK_SHIFT)&0x8000) g_scheduler.addtask(user_jumptoarg2,priority_userrequest,nlptr,NULL); else g_scheduler.addtask(user_jumpto,priority_userrequest,nlptr,NULL); break; case VK_ESCAPE: g_scheduler.addtask(user_jumpback,priority_userrequest,nlptr,NULL); break; case VK_F1: DialogBox(g_hInst,MAKEINTRESOURCE(help_shortcuts),hwnd,(DLGPROC)helpshortcuts); break; case VK_F3: searchmore(); break; default: break; } break; default: return DefWindowProc(hwnd,message,wParam,lParam); } return 0; }
int main(int argc, char *argv[]) { pev_config_t config; PEV_INITIALIZE(&config); if (argc < 2) { usage(); exit(EXIT_FAILURE); } output_set_cmdline(argc, argv); options_t *options = parse_options(argc, argv); // opcoes const char *path = argv[argc-1]; pe_ctx_t ctx; pe_err_e err = pe_load_file(&ctx, path); if (err != LIBPE_E_OK) { pe_error_print(stderr, err); return EXIT_FAILURE; } err = pe_parse(&ctx); if (err != LIBPE_E_OK) { pe_error_print(stderr, err); return EXIT_FAILURE; } if (!pe_is_pe(&ctx)) EXIT_ERROR("not a valid PE file"); const uint64_t ep_offset = pe_rva2ofs(&ctx, ctx.pe.entrypoint); if (ep_offset == 0) EXIT_ERROR("unable to get entrypoint offset"); FILE *dbfile = NULL; if (!loaddb(&dbfile, options)) fprintf(stderr, "warning: without valid database file, %s will search in generic mode only\n", PROGRAM); char value[MAX_MSG]; // TODO(jweyrich): Create a new API to retrieve map_addr. // TODO(jweyrich): Should we use `LIBPE_PTR_ADD(ctx->map_addr, ep_offset)` instead? const unsigned char *pe_data = ctx.map_addr; // packer by signature if (compare_signature(pe_data, ep_offset, dbfile, value, sizeof(value))) ; // generic detection else if (generic_packer(&ctx, ep_offset)) snprintf(value, MAX_MSG, "generic"); else snprintf(value, MAX_MSG, "no packer found"); output_open_document(); output("packer", value); output_close_document(); if (dbfile != NULL) fclose(dbfile); // libera a memoria free_options(options); // free err = pe_unload(&ctx); if (err != LIBPE_E_OK) { pe_error_print(stderr, err); return EXIT_FAILURE; } PEV_FINALIZE(&config); return EXIT_SUCCESS; }
int OnlineSession::run(istream &in, bool interactive) { map<string, int> commands; _prepareCommands(commands); int res = 0; int count = 0; int cmd; string command; string sarg1, sarg2; int iarg1, iarg2, iarg3, iarg4, iarg5, iarg6, iarg7, iarg8; SeriesDistanceMetric *metric; double darg1; GroupableTimeSeriesSet *t; clock_t time; res = 0; while (!in.eof()) { if (res != 0) getout() << "Command returned with status " << res << "." << endl; if (interactive) { int width = getout().width(); getout() << "["; getout().width(3); getout() << count; getout().width(width); getout() << "] > "; getout().flush(); } in >> command; if (command.size() > 0 && !in.eof()) { cmd = commands[command]; } else { cmd = _EXIT; getout() << endl; } time = clock(); try { res = 0; switch (cmd) { case 0: getout() << "Unknown command '" << command << "'. Type 'help' for help." << endl; res = 1; break; case _EXIT: getout() << "Quitting..." << endl; return 0; case _HELP: _print_help(getout()); break; case _DEBUG: in >> iarg1; getout() << "Setting verbosity to " << iarg1 << "." << endl; verbosity = iarg1; break; case _LOAD_TSS: in >> sarg1; getout() << "Loading Time Series Set from file '" << sarg1 << "'." << endl; res = loaddb(sarg1.c_str()); if (res == 0) { getout() << "Dataset successfully loaded. Index: " << datasets.size()-1 << endl; } else { getout() << "Failed to load dataset." << endl; } break; case _SAVE_TSS: in >> iarg1; in >> sarg2; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Saving Time Series Set " << iarg1 << ":" << t->getName() << " to file '" << sarg2 << "'." << endl; res = savedb(iarg1, sarg2.c_str()); if (res == 0) getout() << "Dataset successfully saved." << endl; else getout() << "Failed to save dataset." << endl; break; case _OLOAD_TSS: in >> sarg1; in >> iarg1 >> iarg2 >> iarg3; getout() << "Loading Time Series Set from file '" << sarg1 << "' with N=" << iarg1 << ", L=" << iarg2 << ", and D=" << iarg3 << "." << endl; res = loadolddb(sarg1.c_str(), iarg1, iarg2, iarg3); if (res == 0) { getout() << "Dataset successfully loaded. Index: " << datasets.size()-1 << endl; } else { getout() << "Failed to load dataset." << endl; } break; case _OSAVE_TSS: in >> iarg1; in >> sarg2; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Saving Time Series Set " << iarg1 << ":" << t->getName() << " to file '" << sarg2 << "'." << endl; res = saveolddb(iarg1, sarg2.c_str()); if (res == 0) getout() << "Dataset successfully saved." << endl; else getout() << "Failed to save dataset." << endl; break; case _DROP_TSS: in >> iarg1; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Dropping Time Series Set " << iarg1 << ":" << t->getName() << "." << endl; killdb(iarg1); break; case _RAND_TSS: in >> iarg1 >> iarg2 >> iarg3; getout() << "Generating random Time Series Set with N=" << iarg1 << ", L=" << iarg2 << ", and range=" << iarg3 << "." << endl; res = randdb(iarg3, iarg1, iarg2); if (res == 0) getout() << "Dataset successfully loaded. Index: " << datasets.size()-1 << endl; else getout() << "Failed to load dataset." << endl; break; case _LIST_TSS: res = printdbs(); break; case _NORM_TSS: in >> iarg1; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Normalizing Time Series Set " << iarg1 << ":" << t->getName() << "." << endl; t->normalize(); break; case _KSIM_TSS: in >> iarg1 >> iarg2 >> iarg3 >> iarg4 >> iarg5 >> iarg6; checkIndex(iarg1); checkIndex(iarg2); t = datasets[iarg1]; getout() << "Searching similar sequences for Time Series Set " << iarg1 << ":" << t->getName(); t = datasets[iarg2]; getout() << ", query string at " << iarg3 << " in dataset " << iarg2 << ":" << t->getName(); getout() << " in interval [" << iarg4 << "," << iarg5 << "] with strategy=" << iarg6 << "." << endl; similar(iarg1, iarg2, iarg3, TimeInterval(iarg4, iarg5), iarg6); break; case _OUTLIER_TSS: in >> iarg1 >> iarg2; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Searching for outlier group in dataset " << iarg1 << ":" << t->getName() << " for length=" << iarg2 << "." << endl; outlier(iarg1, iarg2); break; case _TSS_DIST: in >> iarg1 >> iarg2 >> iarg3 >> iarg4; in >> iarg5 >> iarg6 >> iarg7 >> iarg8; in >> sarg1; checkIndex(iarg1); checkIndex(iarg5); metric = getDistMetric(sarg1.c_str()); if (metric == NULL) { getout() << "Unknown method: " << sarg1.c_str() << endl; res = -1; break; } getout() << "Using distance metric " << metric->name << " to find distance:" << endl; getout() << "A: DB:" << iarg1 << ", " << iarg2 << "@[" << iarg3 << "," << iarg4 << "]." << endl; getout() << "B: DB:" << iarg5 << ", " << iarg6 << "@[" << iarg7 << "," << iarg8 << "]." << endl; getout() << "Distance: " << printdist(iarg1, iarg5, iarg2, iarg6, TimeInterval(iarg3, iarg4), TimeInterval(iarg7, iarg8), metric) << endl; break; case _LS_DIST: printDistMetrics(); break; case _GROUP_TSS: in >> iarg1; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Generating new grouping for Time Series Set " << iarg1 << ":" << t->getName() << " with ST " << defaultST << "." << endl; res = initdbgroups(iarg1, defaultST); break; case _GROUP_ST_TSS: in >> iarg1; in >> darg1; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Generating new grouping for Time Series Set " << iarg1 << ":" << t->getName() << " with ST " << darg1 << "." << endl; res = initdbgroups(iarg1, darg1); break; case _LOAD_GROUP_TSS: in >> iarg1; in >> sarg1; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Loading grouping data for Time Series Set " << iarg1 << ":" << t->getName() << " at " << sarg1 << "." << endl; res = loaddbgroups(iarg1, sarg1.c_str()); break; case _SAVE_GROUP_TSS: in >> iarg1; in >> sarg1; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Saving grouping data for Time Series Set " << iarg1 << ":" << t->getName() << " to " << sarg1 << "." << endl; res = savedbgroups(iarg1, sarg1.c_str()); break; case _DROP_GROUP_TSS: in >> iarg1; checkIndex(iarg1); t = datasets[iarg1]; getout() << "Dropping grouping data for Time Series Set " << iarg1 << ":" << t->getName() << "." << endl; res = killdbgroups(iarg1); break; case _DESC_TSS: in >> iarg1; checkIndex(iarg1); res = descdb(iarg1); break; case _PRINT_TSS: in >> iarg1; checkIndex(iarg1); res = printdb(iarg1); break; case _PRINT_INTERVAL: in >> iarg1 >> iarg2 >> iarg3 >> iarg4; checkIndex(iarg1); res = printint(iarg1, iarg2, TimeInterval(iarg3, iarg4)); break; case _SET_DEF_ST: in >> darg1; getout() << "Setting default ST to " << darg1 << "." << endl; res = setST(darg1); break; case _GET_DEF_ST: getout() << "default ST = " << getST() << "." << endl; break; case _SET_DEF_R: in >> iarg1; getout() << "Setting default R constraint to " << iarg1 << "." << endl; res = setR(iarg1); break; case _GET_DEF_R: getout() << "default R = " << getR() << "." << endl; break; } } catch (exception &e) { getout() << "Caught exception attempting operation:" << endl; getout() << e.what() << endl; } time = clock() - time; getout() << "Command used " << ((float)time/CLOCKS_PER_SEC) << " seconds." << endl << endl; count++; } return 0; }