diff options
| -rwxr-xr-x | classification/tools/create_diff.py | 50 | ||||
| -rw-r--r-- | results/classifier/002/001-002 | 5 | ||||
| -rw-r--r-- | results/classifier/003/002-003 | 11 | ||||
| -rw-r--r-- | results/classifier/004/003-004 | 19 | ||||
| -rw-r--r-- | results/classifier/005/004-005 | 7 |
5 files changed, 92 insertions, 0 deletions
diff --git a/classification/tools/create_diff.py b/classification/tools/create_diff.py new file mode 100755 index 000000000..799c26006 --- /dev/null +++ b/classification/tools/create_diff.py @@ -0,0 +1,50 @@ +from os import path, walk +from pathlib import Path +from argparse import ArgumentParser + +root_directory = "../../results/classifier/" + +parser = ArgumentParser(prog='create_diff.py') +parser.add_argument('old') +parser.add_argument('new') +args = parser.parse_args() + +def find_changes(old_directory, new_directory): + old_files = {} + for root, dirs, files in walk(old_directory): + for file in files: + relative_path = Path(root).relative_to(old_directory) + old_files[file] = str(relative_path) + + new_files = {} + for root, dirs, files in walk(new_directory): + for file in files: + relative_path = Path(root).relative_to(new_directory) + new_files[file] = str(relative_path) + + changed_files = [] + for file in old_files: + if file in new_files and old_files[file] != new_files[file]: + changed_files.append({ + 'name': file, + 'old': old_files[file], + 'new': new_files[file] + }) + + return changed_files + +def output_diff(changed_files): + with open(path.join(root_directory, args.new, f"{args.old}-{args.new}"), "w") as file: + file.write(f"{len(changed_files)} changes:\n") + for change in changed_files: + file.write(f"{change['name']}: {change['old']} -> {change['new']}\n") + +def main(): + path_old = path.join(root_directory, args.old) + path_new = path.join(root_directory, args.new) + + result = find_changes(path_old, path_new) + output_diff(result) + +if __name__ == "__main__": + main() diff --git a/results/classifier/002/001-002 b/results/classifier/002/001-002 new file mode 100644 index 000000000..a1ebf9599 --- /dev/null +++ b/results/classifier/002/001-002 @@ -0,0 +1,5 @@ +4 changes: +42226390: instruction -> boot +51610399: instruction -> boot +60339453: other -> boot +67821138: other -> boot diff --git a/results/classifier/003/002-003 b/results/classifier/003/002-003 new file mode 100644 index 000000000..dabc9fa9a --- /dev/null +++ b/results/classifier/003/002-003 @@ -0,0 +1,11 @@ +10 changes: +55961334: instruction -> KVM +62179944: instruction -> network +33802194: instruction -> KVM +05479587: semantic -> network +04472277: other -> KVM +42613410: other -> KVM +43643137: other -> KVM +71456293: mistranslation -> KVM +80615920: mistranslation -> KVM +26430026: mistranslation -> KVM diff --git a/results/classifier/004/003-004 b/results/classifier/004/003-004 new file mode 100644 index 000000000..6564ca9ef --- /dev/null +++ b/results/classifier/004/003-004 @@ -0,0 +1,19 @@ +18 changes: +24190340: instruction -> device +11357571: instruction -> vnc +73660729: instruction -> graphic +30680944: semantic -> graphic +80570214: semantic -> vnc +28596630: semantic -> device +99674399: other -> device +57195159: other -> device +48245039: other -> assembly +57231878: other -> device +14488057: other -> device +42226390: boot -> device +67821138: boot -> device +55961334: KVM -> graphic +42613410: KVM -> vnc +33802194: KVM -> vnc +24930826: mistranslation -> device +22219210: mistranslation -> graphic diff --git a/results/classifier/005/004-005 b/results/classifier/005/004-005 new file mode 100644 index 000000000..c81de0e2b --- /dev/null +++ b/results/classifier/005/004-005 @@ -0,0 +1,7 @@ +6 changes: +26095107: instruction -> device +53568181: semantic -> graphic +96782458: semantic -> other +46572227: semantic -> graphic +48245039: assembly -> device +36568044: mistranslation -> device |