diff options
| author | root <root@annapurna.annapurna.fitness> | 2025-07-09 16:06:10 +0200 |
|---|---|---|
| committer | root <root@annapurna.annapurna.fitness> | 2025-07-09 16:06:10 +0200 |
| commit | 72cb72a14dd0f64b1cd861057b61266dfc10bb76 (patch) | |
| tree | 9f0988b12bbede1436583e5d9ddd40314d4d3582 /logical_operators/not.py | |
initial commit
Diffstat (limited to 'logical_operators/not.py')
| -rw-r--r-- | logical_operators/not.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/logical_operators/not.py b/logical_operators/not.py new file mode 100644 index 0000000..e010561 --- /dev/null +++ b/logical_operators/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.") |
