diff options
| author | zhuzhenjun <[email protected]> | 2023-10-13 14:08:55 +0800 |
|---|---|---|
| committer | zhuzhenjun <[email protected]> | 2023-10-13 14:08:55 +0800 |
| commit | e62ff39d812c972f2631c36124c81647da5511a0 (patch) | |
| tree | cee4b40d2cae85c76cbd385cc08d9446103f12bc /example | |
| parent | cfaf003d4f32aa55d522e3f09dbd28aa020714a0 (diff) | |
api: MESA_osfp_xx -> osfp_xxv1.3.0
header: MESA_osfp.h -> osfp.h
Diffstat (limited to 'example')
| -rw-r--r-- | example/osfp_example.c | 16 | ||||
| -rw-r--r-- | example/sample.c | 14 |
2 files changed, 15 insertions, 15 deletions
diff --git a/example/osfp_example.c b/example/osfp_example.c index 709ba4f..2a53ac6 100644 --- a/example/osfp_example.c +++ b/example/osfp_example.c @@ -10,7 +10,7 @@ #include <pcap.h> #include "osfp_common.h" -#include "MESA_osfp.h" +#include "osfp.h" #include "osfp_log.h" #include "osfp_fingerprint.h" #include "osfp_score_db.h" @@ -450,9 +450,9 @@ void example_detect(struct osfp_db *osfp_db, Packet *p) osfp_profile_get_cycle(c1); if (iph) { - result = MESA_osfp_ipv4_identify(osfp_db, iph, tcph, tcph_len); + result = osfp_ipv4_identify(osfp_db, iph, tcph, tcph_len); } else if (ip6h) { - result = MESA_osfp_ipv6_identify(osfp_db, ip6h, tcph, tcph_len); + result = osfp_ipv6_identify(osfp_db, ip6h, tcph, tcph_len); } else { goto exit; } @@ -469,19 +469,19 @@ void example_detect(struct osfp_db *osfp_db, Packet *p) result_os_count[result->likely_os_class]++; - char *json = MESA_osfp_result_score_detail_export(result); + char *json = osfp_result_score_detail_export(result); if (1) { printf("Example ipv4 header detect: --------------------------\n"); printf("Connection info: %s:%d -> %s:%d\n", p->srcip, p->sp, p->dstip, p->dp); - printf("Most likely os class: %s\n", MESA_osfp_result_os_name_get(result)); + printf("Most likely os class: %s\n", osfp_result_os_name_get(result)); printf("Details:\n"); printf("%s\n", json); } exit: if (result) { - MESA_osfp_result_free(result); + osfp_result_free(result); } return; } @@ -670,7 +670,7 @@ int main(int argc, char *argv[]) osfp_profile_set(1); - struct osfp_db *osfp_db = MESA_osfp_db_new(fp_file_path); + struct osfp_db *osfp_db = osfp_db_new(fp_file_path); if (osfp_db == NULL) { printf("could not create osfp context. fingerprints file: %s\n", fp_file_path); exit(1); @@ -686,7 +686,7 @@ int main(int argc, char *argv[]) } // destroy osfp db - MESA_osfp_db_free(osfp_db); + osfp_db_free(osfp_db); return 0; } diff --git a/example/sample.c b/example/sample.c index 612ca2b..6313c62 100644 --- a/example/sample.c +++ b/example/sample.c @@ -1,5 +1,5 @@ #include "stdio.h" -#include "MESA_osfp.h" +#include "osfp.h" char iph[] = { 0x45, 0x00, 0x00, 0x34, 0x51, 0xc4, 0x40, 0x00, @@ -22,14 +22,14 @@ int main(int argc, char **argv) struct tcphdr *l4_hdr = (struct tcphdr *)tcph; size_t l4_hdr_len = sizeof(tcph); - struct osfp_db *db = MESA_osfp_db_new(json_file_path); + struct osfp_db *db = osfp_db_new(json_file_path); if (db) { - struct osfp_result *result = MESA_osfp_ipv4_identify(db, l3_hdr, l4_hdr, l4_hdr_len); + struct osfp_result *result = osfp_ipv4_identify(db, l3_hdr, l4_hdr, l4_hdr_len); if (result) { - printf("likely os: %s\n", MESA_osfp_result_os_name_get(result)); - printf("details: \n%s\n", MESA_osfp_result_score_detail_export(result)); - MESA_osfp_result_free(result); + printf("likely os: %s\n", osfp_result_os_name_get(result)); + printf("details: \n%s\n", osfp_result_score_detail_export(result)); + osfp_result_free(result); } - MESA_osfp_db_free(db); + osfp_db_free(db); } } |
