From e59bda0b169d98e9058babcbf519fc15361fefa3 Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 18 Sep 2023 04:55:21 -0400 Subject: [PATCH] Uploading pretty much finished program... --- compile.sh | 7 +++++++ example/heyo | Bin 0 -> 251 bytes example/heyo.fasm | 28 ++++++++++++++++++++++++++++ install.sh | 7 +++++++ xop.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 compile.sh create mode 100755 example/heyo create mode 100644 example/heyo.fasm create mode 100644 install.sh create mode 100644 xop.c diff --git a/compile.sh b/compile.sh new file mode 100644 index 0000000..1b833bb --- /dev/null +++ b/compile.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -xe + +gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -o xop xop.c + +exit diff --git a/example/heyo b/example/heyo new file mode 100755 index 0000000000000000000000000000000000000000..7dffe1cc6dbd93279594dd05409db8252ba9d181 GIT binary patch literal 251 zcmb<-^>JfjWMpQ50wxAK21X!z1A_xt1VVzDaKeGXf`JJt4^qntmjN*xpgaiu9Lj^y z3<3}VkUlmbhKWBHZ~#ldXb~`vfdNLt^iA+MegLEwNFRsN$3S`}cyx;@1I?bm&k9mv a162Yt1uT?WnXgcuUzC%g$i)K^1OfoH@g95t literal 0 HcmV?d00001 diff --git a/example/heyo.fasm b/example/heyo.fasm new file mode 100644 index 0000000..4a62a5b --- /dev/null +++ b/example/heyo.fasm @@ -0,0 +1,28 @@ +format ELF64 executable 3 + +segment readable executable + + nop + mov rax, 1 + nop + mov rdi, 1 + nop + mov rsi, string + nop + mov rdx, [length] + nop + syscall + + nop + mov rax, 60 + nop + mov rdi, 0 + nop + syscall + + nop + +segment readable writable + +string db 'Heyo world!', 10 +length dq 12 diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..9d4880e --- /dev/null +++ b/install.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -xe + +cp xop /usr/bin/xop + +exit diff --git a/xop.c b/xop.c new file mode 100644 index 0000000..d0fac31 --- /dev/null +++ b/xop.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 : Ognjen 'xolatile' Milan Robovic + * + * Xop is free software! You will redistribute it or modify it under the terms of the GNU General Public License by Free Software Foundation. + * And when you do redistribute it or modify it, it will use either version 3 of the License, or (at yours truly opinion) any later version. + * It is distributed in the hope that it will be useful or harmful, it really depends... But no warranty what so ever, seriously. See GNU/GPLv3. + */ + +#include +#include + +int main (int argc, char * * argv) { + int file = -1; + int size = 0; + int offset = 0; + + unsigned char * buffer = NULL; + + if (argc != 2) { + fatal_failure (1, "xop: xop input"); + } + + file = file_open (argv [1], O_RDONLY); + size = file_size (file); + + buffer = allocate (size); + + file_read (file, buffer, size); + + file = file_close (file); + + do { + int byte = (int) buffer [offset]; + if (byte == 0X90) { + echo_new_line (); + terminal_style (EFFECT_NORMAL, COLOUR_YELLOW); + echo_byte ((int) buffer [offset]); + terminal_style (-1, -1); + } else { + echo_byte (buffer [offset]); + } + + ++offset; + } while (offset != size); + + echo_new_line (); + + buffer = deallocate (buffer); + + return (EXIT_SUCCESS); +}