From fa84ba406e4043f67069b8d059c63b92b1adf591 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 27 Apr 2025 02:32:20 +0200 Subject: Nopping... --- xop.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 xop.c (limited to 'xop.c') diff --git a/xop.c b/xop.c new file mode 100755 index 0000000..f2b6748 --- /dev/null +++ b/xop.c @@ -0,0 +1,58 @@ +/// __ _____ _ __ +/// \ \/ / _ \| '_ \ +/// > < (_) | |_) | +/// /_/\_\___/| .__/ +/// |_| +/// +/// Copyright (c) 1997 - Ognjen 'xolatile' Milan Robovic +/// +/// xolatile@chud.cyou - xop - The evil within... +/// +/// This program is free software, free as in freedom and as in free beer, you can redistribute it and/or modify it under the terms of the GNU +/// General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version if you wish... +/// +/// This program is distributed in the hope that it will be useful, but it is probably not, and without any warranty, without even the implied +/// warranty of merchantability or fitness for a particular purpose, because it is pointless. Please see the GNU (Geenoo) General Public License +/// for more details, if you dare, it is a lot of text that nobody wants to read... + +#include "xtandard.h" + +static procedure echo_byte (natural_8 byte) { + output ("0123456789ABCDEF" + byte / 16, 1); + output ("0123456789ABCDEF" + byte % 16, 1); + + output (" ", 1); +} + +integer main (integer argc, character * * argv) { + integer file = 0; + natural_64 size = 0; + natural_8 * buffer = null; + + if (argc != 2) { + return (log_failure); + } + + file = file_open (argv [1], file_flag_read); + size = file_size (argv [1]); + + buffer = allocate (size * sizeof (* buffer)); + + file_read (file, buffer, size); + + file = file_close (file); + + for (natural_64 offset = 0; offset < size; ++offset) { + conditional_print (buffer [offset] == 0x90, "\n/B/1"); + + echo_byte (buffer [offset]); + + conditional_print (buffer [offset] == 0x90, "/-"); + } + + print ("\n"); + + buffer = deallocate (buffer); + + return (log_success); +} -- cgit v1.2.3