From df59764861742648ccc1dd27388cd95703d3080a Mon Sep 17 00:00:00 2001 From: root Date: Wed, 9 Jul 2025 16:07:39 +0200 Subject: changed folder structure & deleted useless files --- and.py | 18 ++++++++++++++++++ logical_operators/.DS_Store | Bin 6148 -> 0 bytes logical_operators/and.py | 18 ------------------ logical_operators/not.py | 16 ---------------- logical_operators/or.py | 18 ------------------ logical_operators/xor.py | 23 ----------------------- not.py | 16 ++++++++++++++++ or.py | 18 ++++++++++++++++++ xor.py | 23 +++++++++++++++++++++++ 9 files changed, 75 insertions(+), 75 deletions(-) create mode 100644 and.py delete mode 100644 logical_operators/.DS_Store delete mode 100644 logical_operators/and.py delete mode 100644 logical_operators/not.py delete mode 100644 logical_operators/or.py delete mode 100644 logical_operators/xor.py create mode 100644 not.py create mode 100644 or.py create mode 100644 xor.py diff --git a/and.py b/and.py new file mode 100644 index 0000000..7e6a352 --- /dev/null +++ b/and.py @@ -0,0 +1,18 @@ +from sys import argv + +# Read two files as byte arrays +file1_b = bytearray(open(argv[1], 'rb').read()) +file2_b = bytearray(open(argv[2], 'rb').read()) + +# Set the length to be the smaller one +size = len(file1_b) if len(file1_b) < len(file2_b) else len(file2_b) +andd_byte_array = bytearray(size) + +# AND between the files +for i in range(size): + andd_byte_array[i] = file1_b[i] & file2_b[i] + +# Write the ANDd bytes to the output file +open(argv[3], 'wb').write(andd_byte_array) + +print(f"[*] {argv[1]} AND {argv[2]}\n[*] Saved to \033[1;33m{argv[3]}\033[1;m.") diff --git a/logical_operators/.DS_Store b/logical_operators/.DS_Store deleted file mode 100644 index a98982f..0000000 Binary files a/logical_operators/.DS_Store and /dev/null differ diff --git a/logical_operators/and.py b/logical_operators/and.py deleted file mode 100644 index 7e6a352..0000000 --- a/logical_operators/and.py +++ /dev/null @@ -1,18 +0,0 @@ -from sys import argv - -# Read two files as byte arrays -file1_b = bytearray(open(argv[1], 'rb').read()) -file2_b = bytearray(open(argv[2], 'rb').read()) - -# Set the length to be the smaller one -size = len(file1_b) if len(file1_b) < len(file2_b) else len(file2_b) -andd_byte_array = bytearray(size) - -# AND between the files -for i in range(size): - andd_byte_array[i] = file1_b[i] & file2_b[i] - -# Write the ANDd bytes to the output file -open(argv[3], 'wb').write(andd_byte_array) - -print(f"[*] {argv[1]} AND {argv[2]}\n[*] Saved to \033[1;33m{argv[3]}\033[1;m.") diff --git a/logical_operators/not.py b/logical_operators/not.py deleted file mode 100644 index e010561..0000000 --- a/logical_operators/not.py +++ /dev/null @@ -1,16 +0,0 @@ -from sys import argv - -# Read two file as byte array -file_b = bytearray(open(argv[1], 'rb').read()) - -size = len(file_b) -notd_byte_array = bytearray(size) - -# NOT the file -for i in range(size): - notd_byte_array[i] = file_b[i] ^ 255 - -# Write the NOTd bytes to the output file -open(argv[2], 'wb').write(notd_byte_array) - -print (f"[*] NOT {argv[1]}\n[*] Saved to \033[1;33m{argv[2]}\033[1;m.") diff --git a/logical_operators/or.py b/logical_operators/or.py deleted file mode 100644 index acc8c62..0000000 --- a/logical_operators/or.py +++ /dev/null @@ -1,18 +0,0 @@ -from sys import argv - -# Read two files as byte arrays -file1_b = bytearray(open(argv[1], 'rb').read()) -file2_b = bytearray(open(argv[2], 'rb').read()) - -# Set the length to be the smaller one -size = len(file1_b) if len(file1_b) < len(file2_b) else len(file2_b) -ord_byte_array = bytearray(size) - -# OR between the files -for i in range(size): - ord_byte_array[i] = file1_b[i] | file2_b[i] - -# Write the ANDd bytes to the output file -open(argv[3], 'wb').write(ord_byte_array) - -print (f"[*] {argv[1]} OR {argv[2]}\n[*] Saved to \033[1;33m{argv[3]}\033[1;m.") diff --git a/logical_operators/xor.py b/logical_operators/xor.py deleted file mode 100644 index 17bd630..0000000 --- a/logical_operators/xor.py +++ /dev/null @@ -1,23 +0,0 @@ -from sys import argv -""" -0 + 0 -> 1 -1 + 1 -> 1 -0 + 1 -> 0 -1 + 0 -> 0 -""" -# Read two files as byte arrays -file1_b = bytearray(open(argv[1], 'rb').read()) -file2_b = bytearray(open(argv[2], 'rb').read()) - -# Set the length to be the smaller one -size = min(len(file1_b), len(file2_b)) -xord_byte_array = bytearray(size) - -# XOR between the files -for i in range(size): - xord_byte_array[i] = file1_b[i] ^ file2_b[i] - -# Write the XORd bytes to the output file -open(argv[3], 'wb').write(xord_byte_array) - -print(f'[*] {argv[1]} XOR {argv[2]}\n[*] Saved to \033[1;33m{argv[3]}\033[1;m.') \ No newline at end of file diff --git a/not.py b/not.py new file mode 100644 index 0000000..e010561 --- /dev/null +++ b/not.py @@ -0,0 +1,16 @@ +from sys import argv + +# Read two file as byte array +file_b = bytearray(open(argv[1], 'rb').read()) + +size = len(file_b) +notd_byte_array = bytearray(size) + +# NOT the file +for i in range(size): + notd_byte_array[i] = file_b[i] ^ 255 + +# Write the NOTd bytes to the output file +open(argv[2], 'wb').write(notd_byte_array) + +print (f"[*] NOT {argv[1]}\n[*] Saved to \033[1;33m{argv[2]}\033[1;m.") diff --git a/or.py b/or.py new file mode 100644 index 0000000..acc8c62 --- /dev/null +++ b/or.py @@ -0,0 +1,18 @@ +from sys import argv + +# Read two files as byte arrays +file1_b = bytearray(open(argv[1], 'rb').read()) +file2_b = bytearray(open(argv[2], 'rb').read()) + +# Set the length to be the smaller one +size = len(file1_b) if len(file1_b) < len(file2_b) else len(file2_b) +ord_byte_array = bytearray(size) + +# OR between the files +for i in range(size): + ord_byte_array[i] = file1_b[i] | file2_b[i] + +# Write the ANDd bytes to the output file +open(argv[3], 'wb').write(ord_byte_array) + +print (f"[*] {argv[1]} OR {argv[2]}\n[*] Saved to \033[1;33m{argv[3]}\033[1;m.") diff --git a/xor.py b/xor.py new file mode 100644 index 0000000..17bd630 --- /dev/null +++ b/xor.py @@ -0,0 +1,23 @@ +from sys import argv +""" +0 + 0 -> 1 +1 + 1 -> 1 +0 + 1 -> 0 +1 + 0 -> 0 +""" +# Read two files as byte arrays +file1_b = bytearray(open(argv[1], 'rb').read()) +file2_b = bytearray(open(argv[2], 'rb').read()) + +# Set the length to be the smaller one +size = min(len(file1_b), len(file2_b)) +xord_byte_array = bytearray(size) + +# XOR between the files +for i in range(size): + xord_byte_array[i] = file1_b[i] ^ file2_b[i] + +# Write the XORd bytes to the output file +open(argv[3], 'wb').write(xord_byte_array) + +print(f'[*] {argv[1]} XOR {argv[2]}\n[*] Saved to \033[1;33m{argv[3]}\033[1;m.') \ No newline at end of file -- cgit v1.2.3