(sigs)
| 199 | |
| 200 | |
| 201 | def nmap_search(sigs): |
| 202 | # type: (Dict) -> Tuple[Union[int, float], List] |
| 203 | guess = 0, [] # type: Tuple[Union[int, float], List] |
| 204 | conf.nmap_kdb = cast(NmapKnowledgeBase, conf.nmap_kdb) |
| 205 | for osval, fprint in conf.nmap_kdb.get_base(): |
| 206 | score = 0.0 |
| 207 | for test, values in fprint.items(): |
| 208 | if test in sigs: |
| 209 | score += nmap_match_one_sig(sigs[test], values) |
| 210 | score /= len(sigs) |
| 211 | if score > guess[0]: |
| 212 | guess = score, [osval] |
| 213 | elif score == guess[0]: |
| 214 | guess[1].append(osval) |
| 215 | return guess |
| 216 | |
| 217 | |
| 218 | @conf.commands.register |
no test coverage detected