static uint32 idaapi graph_list(slist_t * sl,uint32 n, options_t * opt) { slist_t * sl1 = NULL; slist_t * sl2 = NULL; msg ("parsing second function...\n"); sl2 = parse_second_fct(ui_access_sig(sl, n)->msig->startEA, sl->file, opt); if (!sl2) { msg("Error: FCT2 parsing failed.\n"); return 0; } msg ("parsing first function...\n"); sl1 = parse_fct(ui_access_sig(sl, n)->startEA, dto.graph.s_showpref); if (!sl1) { msg("Error: FCT1 parsing failed.\n"); siglist_free(sl2); return 0; } sl1->sigs[0]->nfile = 1; sl2->sigs[0]->nfile = 2; msg ("diffing functions...\n"); generate_diff(NULL, sl1, sl2, NULL, false, NULL); pgraph_display(sl1, sl2); msg ("done!\n"); return 1; }
static void run_first_instance() { char * file; slist_t * sl1 = NULL; slist_t * sl2 = NULL; int ret; msg ("\n---------------------------------------------------\n" "PatchDiff Plugin v2.0.10\n" "Copyright (c) 2010-2011, Nicolas Pouvesle\n" "Copyright (C) 2007-2009, Tenable Network Security, Inc\n" "---------------------------------------------------\n\n"); ret = backup_load_results(&d_engine, d_opt); if (ret == 1) { display_results(d_engine); return; } else if (ret == -1) { return; } show_wait_box ("PatchDiff is in progress ..."); msg ("Scanning for functions ...\n"); msg ("parsing second idb...\n"); sl2 = parse_second_idb(&file, d_opt); if (!sl2) { msg("Error: IDB2 parsing cancelled or failed.\n"); hide_wait_box(); return; } msg ("parsing first idb...\n"); sl1 = parse_idb (); if (!sl1) { msg("Error: IDB1 parsing failed.\n"); siglist_free(sl2); hide_wait_box(); return; } msg ("diffing...\n"); generate_diff(&d_engine, sl1, sl2, file, true, d_opt); msg ("done!\n"); hide_wait_box(); if (sl1) siglist_partial_free(sl1); if (sl2) siglist_partial_free(sl2); }
void propagate_match(deng_t * eng, psig_t * s1, psig_t * s2, int options) { size_t i; deng_t * d = NULL; slist_t * l1, * l2; if (options) { show_wait_box ("PatchDiff is in progress ..."); l1 = siglist_init(eng->ulist->num, eng->ulist->file); l2 = siglist_init(eng->ulist->num, eng->ulist->file); for (i=0; i<eng->ulist->num; i++) if (!eng->ulist->sigs[i]->msig) { if (eng->ulist->sigs[i]->nfile == 1) siglist_add(l1, eng->ulist->sigs[i]); else siglist_add(l2, eng->ulist->sigs[i]); } generate_diff(&d, l1, l2, eng->ulist->file, false, NULL); siglist_partial_free(l1); siglist_partial_free(l2); hide_wait_box(); } i = 0; while (i<eng->ulist->num) { s1 = eng->ulist->sigs[i]; s2 = s1->msig; if (!s2) i++; else { if (s1->nfile == 1) { if (sig_equal(s1, s2, DIFF_EQUAL_SIG_HASH)) siglist_add(eng->ilist, s1); else siglist_add(eng->mlist, s1); } siglist_remove(eng->ulist, i); } } }