v0.0.4
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "osfp_common.h"
|
||||
#include "osfp.h"
|
||||
#include "osfp_log.h"
|
||||
#include "osfp_fingerprint.h"
|
||||
#include "osfp_score_db.h"
|
||||
|
||||
@@ -163,6 +164,7 @@ unsigned char *fp_file_path;
|
||||
unsigned char *fp_output_file_path;
|
||||
FILE *fingerprinting_output_fp;
|
||||
|
||||
unsigned int debug_enable;
|
||||
unsigned char *if_name;
|
||||
unsigned char *pcap_file_name;
|
||||
unsigned char *bpf_string;
|
||||
@@ -466,6 +468,8 @@ void example_detect(struct osfp_db *osfp_db, Packet *p)
|
||||
printf("Details:\n");
|
||||
printf("%s\n", osfp_result_score_detail_export(result));
|
||||
|
||||
osfp_result_free(result);
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
@@ -483,10 +487,16 @@ void process_packet(char *user, struct pcap_pkthdr *h, u_char *pkt)
|
||||
}
|
||||
|
||||
// only for tcp syn request packet
|
||||
if (!p->tcph->syn || p->tcph->ack) {
|
||||
if (!p->tcph->syn) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (p->tcph->ack) {
|
||||
printf("--------------------------- SYN/ACK\n");
|
||||
} else {
|
||||
printf("--------------------------- SYN\n");
|
||||
}
|
||||
|
||||
if (p->iph) {
|
||||
PrintInet(AF_INET, (const void *)&(p->src.addr_data32[0]), p->srcip, sizeof(p->srcip));
|
||||
PrintInet(AF_INET, (const void *)&(p->dst.addr_data32[0]), p->dstip, sizeof(p->dstip));
|
||||
@@ -508,7 +518,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int r;
|
||||
|
||||
while ((r = getopt(argc, argv, "+f:i:r:o:")) != -1) {
|
||||
while ((r = getopt(argc, argv, "+f:i:r:o:d")) != -1) {
|
||||
switch(r) {
|
||||
case 'f':
|
||||
if (fp_file_path) {
|
||||
@@ -538,6 +548,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
fp_output_file_path = (unsigned char*)optarg;
|
||||
break;
|
||||
case 'd':
|
||||
debug_enable = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
@@ -611,13 +624,16 @@ int main(int argc, char *argv[])
|
||||
fp_file_path = DEFAULT_FP_FILE_PATH;
|
||||
}
|
||||
|
||||
if (debug_enable) {
|
||||
osfp_log_level_set(OSFP_LOG_LEVEL_DEBUG);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
osfp_score_db_debug_print(osfp_db->score_db);
|
||||
|
||||
// loop
|
||||
|
||||
Reference in New Issue
Block a user