diff -u /home/alegen/repos/ipv6tests/c_struct.py ./c_struct.py --- /home/alegen/repos/ipv6tests/c_struct.py 2015-02-25 16:41:30.948037425 +0100 +++ ./c_struct.py 2015-03-11 09:24:52.970847077 +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 .: gen_model.sh Common subdirectories: /home/alegen/repos/ipv6tests/liblinear-1.8 and ./liblinear-1.8 diff -u /home/alegen/repos/ipv6tests/nmap.set ./nmap.set --- /home/alegen/repos/ipv6tests/nmap.set 2015-02-25 16:41:30.692037425 +0100 +++ ./nmap.set 2015-03-11 09:29:58.379465874 +0100 @@ -40,6 +40,7 @@ $IPV6 * [ PLEN TC + HLIM ] TCP_ISR diff -u /home/alegen/repos/ipv6tests/parse.py ./parse.py --- /home/alegen/repos/ipv6tests/parse.py 2015-02-25 16:41:30.720037425 +0100 +++ ./parse.py 2015-03-11 09:24:53.182953072 +0100 @@ -170,6 +170,7 @@ self.desc = OSDescription() self.flow_label = None + self.scan_line = {} self.responses = {} self.timed_responses = {} @@ -251,7 +252,13 @@ fp = parse_nmapfp_raw(s) for probe_name, tests in fp: if probe_name == "SCAN": - continue + for test_name, test_value in tests: + if test_value: # pythonic check for empty string + # convert integer values from strings to ints + # keep rest as strings + self.scan_line[test_name] = int(test_value) \ + if test_name in ['OT', 'CT', 'CU', 'DS'] \ + else test_value if probe_name == "EXTRA": for test_name, test_value in tests: if test_name == "FL": Common subdirectories: /home/alegen/repos/ipv6tests/results and ./results Only in /home/alegen/repos/ipv6tests: .svn diff -u /home/alegen/repos/ipv6tests/vectorize.py ./vectorize.py --- /home/alegen/repos/ipv6tests/vectorize.py 2015-02-25 16:41:30.696037425 +0100 +++ ./vectorize.py 2015-03-11 10:10:23.519944709 +0100 @@ -78,7 +78,6 @@ return None return packet.getlayer(TCP) - def vectorize_plen(ip, rs): if ip is None: return UNKNOWN @@ -89,6 +88,15 @@ return UNKNOWN return ip.tc +def vectorize_hlim(ip, rs): + if ip is None: + return UNKNOWN + hlim = ip.hlim + # check for the DS value in the fingerprint SCAN line + if 'DS' in rs.scan_line and rs.scan_line['DS'] > 0: + hlim += rs.scan_line['DS'] - 1 + return hlim + def vectorize_tcp_window(ip, rs): tcp = find_tcp(ip) if tcp is None: @@ -201,6 +209,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),