showcomments icon indicating copy to clipboard operation
showcomments copied to clipboard

Filter only user comments

Open karpiyon opened this issue 1 year ago • 0 comments

I modified you code a bit and added some filters. While not really 'only user comments' it does a good filtering job. I filter by phrases, exact phrases and remove all single letter comments:

I added this before I add a new item to add_row, e.g:

            if cmt and self.is_ignore_comment(cmt):
                cmt = None
            if cmt:
                item_index = self.add_row(item_index, ea, cmt, "Regular", function_name)
                if cmt not in allCmt:
                    allCmt.append(cmt)   

....

    def is_ignore_comment(self, cmt):
        ignoreList = ["items in the array", "adjectives bitfield", "attributes", "balse class attributes", "Block", "catch code", "funclet", "ip2state", "Microsoft", "base class", "Trap to Debugger", "ALLOC", "SAVE", "PUSH", "NONVOL", "FuncInfo", "items in ", "_int16", "_int64", "_Cnd_t", "_Cvtvec", "_Mtx_t", "Buf1", "BufferCount", "Catchable", "void *", "unwind map", "_SET_", "try block map", "throw info for", "switch", "state -", "StackCookie", "_Thrd_", "AccessMode", "address of catchable", "AddressOfRaw", "bDaclDefault", "jumptable", "internal runtime", "frame offset", "num unwind entries", "offset of this vtable", "pException", "to class hierar", "reference to ", "state ", "throw info for", "type descriptor", "vftable displacement", "void(", "_Collvec", "Algid", "blnherit", "cbKey", "cbMulti", "cch", "CompareF", "ConditionV", "ContextP", "continuation addr", "ControlP", "disp frame", "vftable", "wdDe", "dwExp", "dwF", "ea 0x", "lpNum", "lpOpt", "lpO", "lpB", "lpP", "lpR", "lpS", "lpT", "lpV", "lpU", "lpW", "mdisp", "mbstate", "member disp", "MFC", "num_hundler", "argp", "backlog", "bAlert", "bDac", "bInit", "catchable", "Buffer", "CompletionKey", "CriticalSec", "descriptor", "::", "StackSize", "Radix", "pvR", "pvD", "psz", "ProcessorF", "offset of const", "num_handler", "jumptable", "Failf", "Handle", "cbData", "nPort", "nMask", "destructor of", "catch object", "DLL", "CreationDisp", "dAcc", "rCode", "lCode", "ySpec", "dwL", "dwM", "dwO", "dwN", "ElementC", "ElementS" "EndP", "void", "struct", "Stream", "String2", "Str2", "Str1", "SizeOf", "size_", "size of", "signed", "wchar_t", "num_", "list of", "Import Name", "der Chain", "ordinal", "frame han", "wchar", "int *", "Process Check", "char *", "fd_set", "RtlF", "Import Address"]
        
        ingoreExactLsit = ["C", "Val", "uSize", "to", "tolen", "Tm", "timeout", "Time stamp", "ThrdAddr", "this", "addrlen", "af", "Src", "Size", "addr", "ArgList", "Alignment", "Arguments", "base", "Base", "bool", "bstrString", "buf", "Buf", "hModule", "int", "pThrowInfo", "signature", "SRWLock", "Stat", "Time", "type", "Y", "xtime *", "X", "s", "signature", "Buf2", "Buffer", "Category", "cbBuffer", "cbInput", "Ch", "char", "char *", "Character", "cmd", "CodePage", "Context", "Count", "MaxCount", "Condition", "ContextRecord", "Control", "cp", "Destination", "String", "Str", "Source", "protocol", "Address", "Signal", "Sign", "samDesired", "Security"]
        
        if cmt and any(ignore in cmt for ignore in ignoreList) or any(ignore == cmt for ignore in ingoreExactLsit) or self.has_only_one_word(cmt):
            return True
        return False    

karpiyon avatar Nov 21 '24 17:11 karpiyon