diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-10-12 23:45:34 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-10-13 00:12:22 +0200 |
commit | 9bf4f3141894efff970be9b9ae93c23db821b4fb (patch) | |
tree | eaa9d4375061871db9659dc030768c72ccbe9daf /examples/py-machine-learning | |
parent | 4069816d69b1586a518f07a8969ac1f8c69cff55 (diff) |
Removed example py-ja3-checker.
* renamed sklearn-ml.py to sklearn-random-forest.py (there is more to come!)
* force all protocol classes to lower case
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/py-machine-learning')
-rwxr-xr-x | examples/py-machine-learning/sklearn-random-forest.py (renamed from examples/py-machine-learning/sklearn-ml.py) | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/py-machine-learning/sklearn-ml.py b/examples/py-machine-learning/sklearn-random-forest.py index 2a2569651..2c4a2251b 100755 --- a/examples/py-machine-learning/sklearn-ml.py +++ b/examples/py-machine-learning/sklearn-random-forest.py @@ -159,7 +159,7 @@ def onJsonLineRecvd(json_dict, instance, current_flow, global_user_data): probs = probs[:-2] print('DPI Engine detected: {}{:>24}{}, Predicted: {}{:>24}{}, Score: {}, Probabilities: {}'.format( - color_start, json_dict['ndpi']['proto'], color_end, + color_start, json_dict['ndpi']['proto'].lower(), color_end, color_start, y_text, color_end, s, probs)) except Exception as err: print('Got exception `{}\'\nfor json: {}'.format(err, json_dict)) @@ -219,6 +219,9 @@ if __name__ == '__main__': numpy.set_printoptions(formatter={'float_kind': "{:.1f}".format}, sign=' ') numpy.seterr(divide = 'ignore') + for i in range(len(args.proto_class)): + args.proto_class[i] = args.proto_class[i].lower() + sys.stderr.write('Learning via CSV..\n') with open(args.csv, newline='\n') as csvfile: reader = csv.DictReader(csvfile, delimiter=',', quotechar='"') @@ -232,7 +235,6 @@ if __name__ == '__main__': for line in reader: try: - #if isProtoClass(args.proto_class, line['proto']) > 0: X += getRelevantFeaturesCSV(line) y += [isProtoClass(args.proto_class, line['proto'])] except RuntimeError as err: |