Only in ../../nmap/luis/ipv6tests: common.pyc diff -u ./c_struct.py ../../nmap/luis/ipv6tests/c_struct.py --- ./c_struct.py 2015-02-20 12:39:26.682950876 +0100 +++ ../../nmap/luis/ipv6tests/c_struct.py 2015-02-20 12:33:42.730947511 +0100 @@ -48,7 +48,7 @@ return "{" + ", ".join(c_quote_or_null(x) for x in osclass) + "}" -def save_model_c_struct(f, model): +def save_model_c_struct_cc(f, model): """Write a liblinear model as a C struct.""" if model.model.bias >= 0: w_size = model.model.nr_feature + 1 @@ -167,6 +167,22 @@ f.write("\treturn matches;\n"); f.write("}\n"); +def save_model_c_struct_h(f, model): + if model.model.bias >= 0: + w_size = model.model.nr_feature + 1 + else: + w_size = model.model.nr_feature + f.write("#ifndef _FPMODEL_H_\n") + f.write("#define _FPMODEL_H_\n") + f.write("\n") + f.write("extern struct model FPModel;\n") + f.write("extern double FPscale[][2];\n") + f.write("extern double FPmean[][%d];\n" % w_size) + f.write("extern double FPvariance[][%d];\n" % w_size) + f.write("extern FingerMatch FPmatches[];\n") + f.write("\n") + f.write("#endif\n") + opts, args = getopt.gnu_getopt(sys.argv[1:], "hm:", ["help", "model="]) for o, a in opts: if o == "-h" or o == "--help": @@ -181,4 +197,11 @@ model = parse.parse_model_file(options.model_filename) -save_model_c_struct(sys.stdout, model) +cc_file = open('FPModel.cc', 'w') +h_file = open('FPModel.h', 'w') + +save_model_c_struct_cc(cc_file, model) +save_model_c_struct_h(h_file, model) + +cc_file.close() +h_file.close() Only in ../../nmap/luis/ipv6tests: gen_model.sh Only in ../../nmap/luis/ipv6tests: impute.pyc Common subdirectories: ./liblinear-1.8 and ../../nmap/luis/ipv6tests/liblinear-1.8 diff -u ./nmap.set ../../nmap/luis/ipv6tests/nmap.set --- ./nmap.set 2015-02-20 12:39:26.542950874 +0100 +++ ../../nmap/luis/ipv6tests/nmap.set 2015-02-20 12:33:43.086947515 +0100 @@ -40,6 +40,7 @@ $IPV6 * [ PLEN TC + HLIM ] TCP_ISR Only in ../../nmap/luis/ipv6tests: parse.pyc Common subdirectories: ./results and ../../nmap/luis/ipv6tests/results diff -u ./vectorize.py ../../nmap/luis/ipv6tests/vectorize.py --- ./vectorize.py 2015-02-20 12:39:26.546950875 +0100 +++ ../../nmap/luis/ipv6tests/vectorize.py 2015-02-20 12:33:43.326947517 +0100 @@ -89,6 +89,20 @@ return UNKNOWN return ip.tc +def vectorize_hlim(ip, rs): + if ip is None: + return UNKNOWN + if ip.hlim > 128: + return 1 # class of 255 + elif ip.hlim > 64: + return 2 # class of 128 + elif ip.hlim > 32: + return 3 # class of 64 + elif ip.hlim > 0: + return 4 # class of 32 + else: + return -1 + def vectorize_tcp_window(ip, rs): tcp = find_tcp(ip) if tcp is None: @@ -201,6 +215,7 @@ INDIVIDUAL_TESTS = { "PLEN": vectorize_plen, "TC": vectorize_tc, + "HLIM": vectorize_hlim, "TCP_WINDOW": vectorize_tcp_window, "TCP_URGP": vectorize_tcp_urgp, "TCP_FLAG_F": make_vectorize_tcp_flag(1 << 0), Only in ../../nmap/luis/ipv6tests: vectorize.pyc