From 11a62e71e9b0f8010d075fa953440eea24743bb1 Mon Sep 17 00:00:00 2001 From: dzonerzy Date: Thu, 13 Jul 2023 16:29:58 +0200 Subject: [PATCH] first release --- .gitignore | 3 + Makefile | 8 ++ res/dzonerzy.jpg | Bin 0 -> 16012 bytes src/Makefile | 50 +++++++ src/challenge.o | Bin 0 -> 23512 bytes src/libdzonerzy.so.c | 261 +++++++++++++++++++++++++++++++++ src/libdzonerzy.so.h | 282 ++++++++++++++++++++++++++++++++++++ src/res.h | 1 + tools/Makefile | 13 ++ tools/bin/.gitkeep | 0 tools/embed/embed.c | 333 +++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 951 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 res/dzonerzy.jpg create mode 100644 src/Makefile create mode 100644 src/challenge.o create mode 100644 src/libdzonerzy.so.c create mode 100644 src/libdzonerzy.so.h create mode 100644 src/res.h create mode 100644 tools/Makefile create mode 100644 tools/bin/.gitkeep create mode 100644 tools/embed/embed.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..121877a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vscode +dist +src/challenge.c \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f31d8a8 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +include tools/Makefile +include src/Makefile + +default: all + +all: embed libdzonerzy libdzonerzy-gen + +clean: clean-tools clean-libdzonerzy \ No newline at end of file diff --git a/res/dzonerzy.jpg b/res/dzonerzy.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2c20f97f36af221b0304bfdc68dbf5f188d6e595 GIT binary patch literal 16012 zcmbul1yEd3vo1Qg!{F}j46ec5-CcuAfCLTh?(RP!QHu&{O8(;A! z_3HK1?Dfr(UTbx4`MPJnFTZaCfO1l@QUC}D0008~0le=*=F5tU8>^@(OUWuo{%e4Y zw>NiigJuH&92`Hns!5BH>FDZ_0sap$HFt9sRZ&s+KdSyOc=z+Kb^u_W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?cDNyA z@&ve&Zv})%ivzQa3k^jFzy^)-!wKpsx&XGZtmuN0AD1YnlEq~=a`?|=YUc+a|A^~A z!%ZmYGZN1Nco@5@Y~^==qg8D?KP0m~4oQh#)c!7Zg`3&uoQnyZF_}3HGoEg>HdEJ9 z#6+xq9P0LCwS{*;rGBA~g0oo3IJ-+BICh2_?2@bSn~VGuF=e4;$_uP-Wvgrr$8l)A z`61;J95K1dWnxq$ZqJ{>*6nd%w*W;rDwczyqI=zj|oruD)RQ`^zvVq7**U0+zaUHj1ivYZINnj z1mTMlrx{_bLIVfrJ?y!b=6qposfBugF(&xt15~dxLQ0t;g!TXjanNY%X-4CK@eAcQ zjMB+l2wOfa+d4Tueb?KzIB6h>3}4}I-dnr@U5NC`wHCEl10cI%Ma-^h+v!60GJTsl zgVje&j2dmWO%s%C`-ERLz^tjBgMnvi*PVEMu0Tt{KwQaITLDL|4AYi;a!)SxK|bDOE%HEx z%QA__-f@C&SDir8j*NwCbJq57D6}s77+Z_GTWh(=D>9uk;iu1!9iW^u{MFBla?-X5 zoW{Eh6E@SXMtf(4kk2t2N>ZOf?D`gs)2jw3n;D%u%F^MON-x{GwjE8}y?n!m6}2IM9Ycw`T8XFqE`% zRz7Fig`Aw!4L`2M7>h}Y;$iQXi<7lON=X+Q-^)$lA7}N1Kf|M%?DqtwN+@)Qlzb+3 zv<~lWr7e1!G{-g^5GhluL6p)m9A3}LS^tv4#z)k3dh#y;W=fElH~-9P9)U pRAgL;X6UhkE|dQ(kO!Bi!K8#bUP8jawD6i4&S5h6=;yt!{4bGhqUitt literal 0 HcmV?d00001 diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..df43b80 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,50 @@ +CC = $(shell which gcc) +PANDOC = $(shell which pandoc) +OBJDUMP = $(shell which objdump) +OBJCOPY = $(shell which objcopy) +READELF = $(shell which readelf) + +OUTPUT = libdzonerzy.so + +SRC_INC_DIR = src/include +CFLAGS = -Wno-error=unused-parameter -Wno-error=unused-const-variable -std=c99 -O0 -shared -fPIC -I$(SRC_INC_DIR) -Wno-int-conversion -Wno-div-by-zero +LDFLAGS = + +EMBED_TOOL = tools/bin/embed +EMBED_ARGS = -f=h + +DIST = dist +SRC_DIR = src +RAW_DIST = dist/raw +SITE_DIST = dist/site + +AWK_UTIL = awk '/^\s*\[[0-9]+\]\s+([^\.].+)/ {print $$2}' +AWK_UTIL_NOCRLF = awk '/^\s*\[[0-9]+\]\s+([^\.].+)/ {printf $$2" "}' + +PANDOC_ARGS = --standalone --table-of-contents --section-divs --email-obfuscation=references --css=main.css --include-after-body=$(RAW_DIST)/footer.html + +libdzonerzy: + @echo "/* DO NOT EDIT THIS FILE - it is machine generated */" > $(SRC_DIR)/res.h + @mkdir -p $(DIST) + @mkdir -p $(RAW_DIST) + @mkdir -p $(SITE_DIST) + @$(foreach file, $(wildcard res/*), $(EMBED_TOOL) -i $(file) -o $(SRC_INC_DIR)/$(notdir $(file)).h $(EMBED_ARGS);) + @ls $(SRC_INC_DIR)/*.h | xargs -n1 basename | sed 's/^/#include /' >> $(SRC_DIR)/res.h + $(CC) $(CFLAGS) $(LDFLAGS) -o $(DIST)/$(OUTPUT) $(SRC_DIR)/libdzonerzy.so.c $(SRC_DIR)/challenge.o + +libdzonerzy-dump: + @$(READELF) -S -W $(DIST)/$(OUTPUT) | $(AWK_UTIL) | xargs dirname {} | sort | uniq | xargs -I{} mkdir -p $(RAW_DIST)/{} + @$(foreach fn, $(shell $(READELF) -S -W $(DIST)/$(OUTPUT) | $(AWK_UTIL_NOCRLF)), $(OBJCOPY) $(DIST)/$(OUTPUT) --dump-section $(fn)=/dev/stdout | cat | head -c -1 > $(RAW_DIST)/$(fn);) + +libdzonerzy-gen: libdzonerzy-dump + @mkdir -p $(SITE_DIST)/assets/ + @$(foreach page, $(wildcard $(RAW_DIST)/pages/*), $(PANDOC) $(PANDOC_ARGS) --from=markdown --to=html --output=$(shell echo $(SITE_DIST)/$(notdir $(page)) | sed 's/\.md/\.html/') $(page);) + @cp $(RAW_DIST)/main.css $(SITE_DIST)/main.css + @cp $(RAW_DIST)/sitemap.xml $(SITE_DIST)/sitemap.xml + @cp -r $(RAW_DIST)/embed/* $(SITE_DIST)/assets/ + @chmod -R 666 $(SITE_DIST)/* + +clean-libdzonerzy: + @echo "/* DO NOT EDIT THIS FILE - it is machine generated */" > $(SRC_DIR)/res.h + rm -rf $(DIST) + rm -f $(SRC_INC_DIR)/*.h \ No newline at end of file diff --git a/src/challenge.o b/src/challenge.o new file mode 100644 index 0000000000000000000000000000000000000000..173554900c8811583ede5a1c906d9021e1cf3110 GIT binary patch literal 23512 zcmds#KA%Z%hiI zz*T=O){Q^tiKD?c$3a6MHtI$s{iZf`@NAEsjHGpASw)->mZF=*UOyujCH_#hsi}c;{9Gu6$ZXN$cXww319dq~8%ZAQy4i0B(sq`Ql&Z7LVlmX=oR30sq;T#7Dfb`w9FcD^BcAsZz(3g?E#*PhF4`p#iK;RuxN?mSmzP(SJ zUBAyt7kjM#MPV$F_6Hi@0fLp5{bnUI(D*}9Y1wU7eDOtzbVj_a|3`4j=e7$+K{x*A zO+1R5$QlCK+q^FHOJhg<3#mI~?3!_wZbm2I!*Vi|uO{xlp*A_ZyWzUQuDazEXayQS zhQC&|We&95@*bSWSDS}G%VZ#l^b>)`{{xDZma!&zD84a~ekjl~%si_KGcU$y6&2cg(&2uW!xd=zr4ba@V`{qeCtDo` zbMv6IuQeGtea1QxHZ~s7jrtzlDDLWv9EBiY7Bp|UWaNmoqCE20d8{U&1j~+=S_T!E z613D}N#;QXE_5w53o3BbQa8!UL|M69R&r$}M^sv2N$k>%$nj*PPcQ9(v*UWQVJDc; zeGoJ(zObg6i$f0tZ2Wp~;VcHZXHB_nI!?5pXSCwEeI4C&v=>O3p7dWg6-|P@{Ep71 z83O|YBjCKVsQ_v?^K>@Nfm)7PD}w+(?Y1>(%9LgLk%AnI-821cC}es z1~nYt&Zgy18*kQbf*Mq`R4HVN=Je*KR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4V8 zNAvAs_z8x86MsbxMa_3F!ym*&)ImOoi>L!{WB7fzxH`yZT<*+wGW?DS&hjT2{@fML z^5H9;`5zhnjCin6`)wwEGY3WGhZz2No+(b`Ctc&r_c6TiT4(v43?DnuS-yecM;U(4 zBxgH&89w7WXZh_6&zbBjA7^+k!;7Xk+cE#u6*Q^iHEF7|d@I8*zsXrX!tnbU{@FBV zJ9!~zK9}K9!SQ(&rx5wvm}i+W^TnKH35yCce8t51Dshy2t2l2^xcq)@hswosQiqLW zOoJslKCk|g5g-WX{ zD`Qol3E!5*Lhz0CH1o?QalWRiJ_KK`)x>J!8-&H!+LG0^(Mp;3V0?dLB@guQBN_2n zJZL2>YM+SbDcK-CzLBRIPG8th;Xz_mmfd0B9GiRo6u+W@(EI{-DSOcT#F z@?0KO|9E+#O;vw}&=km_^MWzc+X4|5ZyZ`Ji}CL;rY*tNvF2Lz^?;WiK1% zSZCt)9Bh*Q<#83X$oilVRK73t?F{RxYz;7sOYQ%iLO&1M>_x^e*=DGqO;x{3=pT}T z;;8B;fIIbH&E1wltI)woF|KTdEb-`KQct|d?-0>j5jr}4+jRK0dlGgyd!HLXzT XFy$2fx3;ssh64*lzAv}VX#f8| + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +*/ + +#define _POSIX_C_SOURCE 200809L +#include "libdzonerzy.so.h" +#include "res.h" + +// this is a shared object library + +#define MAIN_CSS \ + CSS_COMMENT("main.css") \ + CSS_NEWLINE() \ + CSS_SELECTOR("html,body") \ + CSS_PROPERTY("margin", "0") \ + CSS_PROPERTY("padding", "0") \ + CSS_PROPERTY("width", "100%") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("body") \ + CSS_PROPERTY("font-family", "monospace") \ + CSS_PROPERTY("font-size", "1.23em") \ + CSS_PROPERTY("background-color", "#ddd") \ + CSS_PROPERTY("display", "flex") \ + CSS_PROPERTY("flex-direction", "column") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("#title-block-header, #TOC") \ + CSS_PROPERTY("border", "1px solid #222") \ + CSS_PROPERTY("border-radius", "15px") \ + CSS_PROPERTY("background-color", "#ccc") \ + CSS_PROPERTY("color", "#000") \ + CSS_PROPERTY("margin", "1em") \ + CSS_PROPERTY("padding", "1em") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("footer") \ + CSS_PROPERTY("border", "1px solid #222") \ + CSS_PROPERTY("border-radius", "15px") \ + CSS_PROPERTY("background-color", "#ccc") \ + CSS_PROPERTY("color", "#000") \ + CSS_PROPERTY("margin", "1em") \ + CSS_PROPERTY("padding", "1em") \ + CSS_PROPERTY("flex-shrink", "0") \ + CSS_PROPERTY("display", "flex") \ + CSS_PROPERTY("flex-direction", "column") \ + CSS_PROPERTY("justify-content", "center") \ + CSS_PROPERTY("align-items", "center") \ + CSS_PROPERTY("font-size", "0.9em") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("div.hearth") \ + CSS_PROPERTY("display", "flex") \ + CSS_PROPERTY("justify-content", "center") \ + CSS_PROPERTY("align-items", "center") \ + CSS_PROPERTY("margin-left", "0.2em") \ + CSS_PROPERTY("margin-right", "0.2em") \ + CSS_PROPERTY("font-size", "1.5em") \ + CSS_PROPERTY("padding", "0px") \ + CSS_PROPERTY("animation", "bounce 1s infinite") \ + CSS_PROPERTY("color", "#d00000") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("b.author") \ + CSS_PROPERTY("color", "#000") \ + CSS_PROPERTY("text-transform", "uppercase") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("p.author::before") \ + CSS_PROPERTY("text-transform", "lowercase") \ + CSS_PROPERTY("font-weight", "normal") \ + CSS_PROPERTY("content", "'by '") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("p.date::before") \ + CSS_PROPERTY("text-transform", "lowercase") \ + CSS_PROPERTY("font-weight", "normal") \ + CSS_PROPERTY("content", "'written on '") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("p.date") \ + CSS_PROPERTY("text-transform", "capitalize") \ + CSS_PROPERTY("font-weight", "bold") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("p.author") \ + CSS_PROPERTY("text-transform", "uppercase") \ + CSS_PROPERTY("font-weight", "bold") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("h1.title") \ + CSS_PROPERTY("text-align", "center") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("section") \ + CSS_PROPERTY("margin", "1em") \ + CSS_PROPERTY("flex", "1 0 auto") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("h1 h2 h3 h4 h5 h6") \ + CSS_PROPERTY("font-family", "monospace") \ + CSS_PROPERTY("clear", "both") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("img") \ + CSS_PROPERTY("padding", "2px") \ + CSS_PROPERTY("border", "2px dashed #333") \ + CSS_PROPERTY("background-color", "#fff") \ + CSS_PROPERTY("color", "#000") \ + CSS_PROPERTY("height", "12em") \ + CSS_PROPERTY("float", "right") \ + CSS_PROPERTY("clear", "right") \ + CSS_PROPERTY("margin-left", "1em") \ + CSS_PROPERTY("margin-bottom", "1em") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("figcaption") \ + CSS_PROPERTY("display", "none") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("@keyframes bounce") \ + CSS_SELECTOR("from, to") \ + CSS_PROPERTY("transform", "scale(1, 1)") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("25%") \ + CSS_PROPERTY("transform", "scale(0.9, 1.1)") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("50%") \ + CSS_PROPERTY("transform", "scale(1.1, 0.9)") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("75%") \ + CSS_PROPERTY("transform", "scale(0.95, 1.05)") \ + CSS_END_SELECTOR() \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("footer > span") \ + CSS_PROPERTY("display", "flex") \ + CSS_PROPERTY("text-align", "center") \ + CSS_PROPERTY("justify-content", "center") \ + CSS_PROPERTY("align-items", "center") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("pre, code") \ + CSS_PROPERTY("min-width", "60vw") \ + CSS_PROPERTY("max-width", "80vw") \ + CSS_PROPERTY("max-height", "500px") \ + CSS_PROPERTY("overflow", "auto") \ + CSS_PROPERTY("font-size", "1.1em") \ + CSS_PROPERTY("font-family", "monospace") \ + CSS_PROPERTY("border-radius", "0.5em") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("blockquote, pre") \ + CSS_PROPERTY("padding", "1em") \ + CSS_PROPERTY("border", "1px solid #111") \ + CSS_PROPERTY("background-color", "#9a9091") \ + CSS_PROPERTY("color", "#111") \ + CSS_PROPERTY("clear", "both") \ + CSS_PROPERTY("padding-top", "0.25em") \ + CSS_PROPERTY("padding-bottom", "0.25em") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("div.sourceCode") \ + CSS_PROPERTY("display", "flex") \ + CSS_PROPERTY("flex-direction", "column") \ + CSS_PROPERTY("justify-content", "center") \ + CSS_PROPERTY("align-items", "center") \ + CSS_END_SELECTOR() \ + CSS_SELECTOR("pre::-webkit-scrollbar") \ + CSS_PROPERTY("display", "none") \ + CSS_END_SELECTOR() + +#define INDEX_MD \ + MD_META("DZONERZY's Blog", "DZONERZY") \ + MD_META_CUSTOM("Thursday 12 July 2023") \ + MD_NEWLINE() \ + MD_SECTION1("About") \ + MD_IMAGE("Picture of DZONERZY", "assets/dzonerzy.jpg") \ + MD_TEXT("Hello world here is dzonerzy, also known as Daniele Linguaglossa,") \ + MD_TEXT("I'm an offensive security researcher and developer.") \ + MD_NEWLINE() \ + MD_TEXT("I'm the author of this blog, and I'm using it to share my") \ + MD_TEXT("researches and my projects.") \ + MD_NEWLINE() \ + MD_TEXT("I'm also the author of the library that powers this blog, ") \ + MD_TEXT("yes you heard right, this blog is powered by a ") \ + MD_BOLD("shared object") \ + MD_TEXT(" that I wrote in C!") \ + MD_NEWLINE() \ + MD_TEXT("You can find the source code of this blog on my ") \ + MD_LINK("git repository", "https://cgit.libdzonerzy.so/libdzonerzy.so/tree") \ + MD_TEXT(".") \ + MD_NEWLINE() \ + MD_SECTION1("Projects") \ + MD_TEXT("Here is a list of my projects, that I've made in my spare time, some of them are ") \ + MD_TEXT("still in development, but I'm working hard to finish them.") \ + MD_NEWLINE() \ + MD_LIST(MD_BOLD(MD_LINK("libdzonerzy.so", "https://cgit.libdzonerzy.so/libdzonersy.so/tree/"))) \ + MD_TEXT(" -- libdzonerzy.so is a shared object that I wrote in C, it's a library ") \ + MD_TEXT("that I use to power this blog.") \ + MD_NEWLINE() \ + MD_LIST(MD_BOLD(MD_LINK("CaptainHook", "https://cgit.libdzonerzy.so/captainhook/tree/"))) \ + MD_TEXT(" -- CaptainHook is the next-gen hooking framework, it's a library that ") \ + MD_TEXT("allow to hook functions in a very easy way without knowing the function prototype.") \ + MD_NEWLINE() \ + MD_SECTION1("FAQ") \ + MD_TEXT("Here is a list of frequently asked questions, if you have any other questions ") \ + MD_TEXT("feel free to contact me at ") \ + MD_BOLD("dzonerzy[at]gmail.com") \ + MD_TEXT(".") \ + MD_NEWLINE() \ + MD_SECTION4(" ") \ + MD_NEWLINE() \ + MD_LIST(MD_BOLD("Q: ") MD_TEXT("Why this blog is so ugly?")) \ + MD_NEWLINE() \ + MD_TEXT("Because I'm not a web designer, I'm a developer, and I'm not good at ") \ + MD_TEXT("designing things, but I'm working on it, I promise.") \ + MD_NEWLINE() \ + MD_LIST(MD_BOLD("Q: ") MD_TEXT("Why this blog is so fast?")) \ + MD_NEWLINE() \ + MD_TEXT("Actually this is a static website, so it's very fast.") \ + MD_NEWLINE() \ + MD_LIST(MD_BOLD("Q: ") MD_TEXT("What do you do for living?")) \ + MD_NEWLINE() \ + MD_TEXT("I'm the lead offensive security researcher at ") \ + MD_LINK("Sysdig", "https://sysdig.com") \ + MD_TEXT(", a cloud security company.") \ + MD_NEWLINE() \ + MD_LIST(MD_BOLD("Q: ") MD_TEXT("Is Sysdig hiring?")) \ + MD_NEWLINE() \ + MD_TEXT("Yes, we are always looking for new talents, if you are interested in working ") \ + MD_TEXT("with me, feel free to send your resume at ... try to find it :D , ") \ + MD_TEXT("hint (") \ + MD_BOLD("libdzonerzy.so") \ + MD_TEXT(").") \ + MD_NEWLINE() \ + MD_TEXT("Michele is gayyyyyyyyyyyyyyyyyyyyyyyy") + +#define FOOTER_MD \ + MD_RAWTAG("footer", "" \ + "" \ + "Powered by libdzonerzy.so" \ + "" \ + "
" \ + "made with
by dzonerzy
") \ + MD_NEWLINE() + +#define SITEMAP_XML \ + XML_URLSET() \ + XML_URL("https://libdzonerzy.so/index.html") \ + XML_URL("https://libdzonerzy.so/sitemap.xml") \ + XML_END_URLSET() + +int main(int argc, char **argv) +{ + fprintf(stdout, "https://libdzonerzy.so\n"); + return EXIT_SUCCESS; +} + +// resources +SECTION("main.css") +static const char maincss[] = MAIN_CSS; +SECTION("pages/index.md") +static const char indexmd[] = INDEX_MD; +SECTION("footer.html") +static const char footermd[] = FOOTER_MD; +SECTION("sitemap.xml") +static const char sitemapxml[] = SITEMAP_XML; \ No newline at end of file diff --git a/src/libdzonerzy.so.h b/src/libdzonerzy.so.h new file mode 100644 index 0000000..af30960 --- /dev/null +++ b/src/libdzonerzy.so.h @@ -0,0 +1,282 @@ +/* + +Copyright: + (C) 2022-2023 Daniele 'dzonerzy' Linguaglossa - http://libdzonerzy.so + + This file is part of libdzonerzy.so. + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +*/ + +#pragma once +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define EXPORT_SYMBOL(return, name) __attribute__((visibility("default"))) return name +#define HIDE_SYMBOL __attribute__((visibility("hidden"))) + +#define SECTION(x) __attribute__((section(x))) +// section name should be like "articles/article_name.md" +#define ARTICLE(x) SECTION("articles/" x ".md") + +/* CSS macros */ +// comment macros +#define CSS_COMMENT(x) "/* " x " */\n" +// property macros +#define CSS_PROPERTY(n, v) " " n ": " v ";\n" +// property macros with unescaped values +#define CSS_PROPERTY_UNESCAPED(n, v) " " n " : " v ";\n" +// selector macros +#define CSS_SELECTOR(n) n "{\n" +// end selector macros +#define CSS_END_SELECTOR() "}\n" +// rgb macros +#define CSS_RGB(r, g, b) "rgb(" #r "," #g "," #b ")" +// rgba macros +#define CSS_RGBA(r, g, b, a) "rgba(" #r "," #g "," #b "," #a ")" +// hsl macros +#define CSS_HSL(h, s, l) "hsl(" #h "," #s "," #l ")" +// hsla macros +#define CSS_HSLA(h, s, l, a) "hsla(" #h "," #s "," #l "," #a ")" +// url macros +#define CSS_URL(x) "url(" #x ")" +// new line macros +#define CSS_NEWLINE() "\n" + +/* MD macros */ +// meta info +#define MD_META(title, author) "% " title "\n" \ + "% " author "\n" +#define MD_META_CUSTOM(v) "% " v "\n" +#define MD_META_NAMED(p, v) "% " p ": " v "\n" +#define MD_COMMENT(x) "\n" +// section macros from 1 to 4 +#define MD_SECTION1(x) "# " x "\n" +#define MD_SECTION2(x) "## " x "\n" +#define MD_SECTION3(x) "### " x "\n" +#define MD_SECTION4(x) "#### " x "\n" +// bold macros +#define MD_BOLD(x) "**" x "**" +// italic macros +#define MD_ITALIC(x) "*" x "*" +// link macros +#define MD_LINK(x, y) "[" x "](" y ")" +// image macros +#define MD_IMAGE(x, y) "![" x "](" y ")\n\n" +// raw html tag macros +#define MD_RAWTAG(t, c) "<" t ">" c "" +// new line macros +#define MD_NEWLINE() "\n\n" +// code macros +#define MD_CODE(x) "`" x "`" +// code block macros +#define MD_CODEBLOCK(x) "```" x "```" +// code block macros with language +#define MD_CODEBLOCK_LANG(l, c) "```" l "\n" c "\n```" +// text macros +#define MD_TEXT(x) x +// list macros +#define MD_LIST(x) "- " x "\n" + +// XML macros +// urlset macros +#define XML_URLSET() "\n" +// url macros +#define XML_URL(x) " \n" \ + " " x "\n" \ + " " __DATE__ "\n" \ + " \n" +// end urlset macros +#define XML_END_URLSET() "\n" + +/*#define STACK_SIZE 10 * 1024 + +enum Flags +{ + EQ = 1 << 0, + GT = 1 << 1, + LT = 1 << 2, +}; + +typedef struct machine +{ + uint32_t R; + uint32_t SP; + uint32_t FL; + uint8_t *stack; +} machine_t, *pmachine_t; + +#define C_START \ + int fd[2]; \ + char *b = "a"; \ + int fd2; \ + int *m; \ + int a; \ + char *c; \ + int *p; + +#define sys_write(x, y, z) \ + __asm__ __volatile__("syscall" \ + : \ + : "a"(1), "D"(x), "S"(y), "d"(z)) + +#define sys_pipe(x) \ + __asm__ __volatile__("syscall" \ + : \ + : "a"(22), "D"(x)) + +#define sys_close(x) \ + __asm__ __volatile__("syscall" \ + : \ + : "a"(3), "D"(x)) + +#define sys_fork() \ + ({ \ + int ret; \ + __asm__ __volatile__("syscall" \ + : "=a"(ret) \ + : "a"(57)); \ + ret; \ + }) + +#define sys_kill(x, y) \ + __asm__ __volatile__("movl %0, %%edi;" \ + "movl %1, %%esi;" \ + "mov $62, %%rax;" \ + "syscall;" \ + : \ + : "r"(x), "r"(y) \ + : "edi", "esi", "rax") + +// getpid and save to pid variable +#define sys_getpid() \ + ({ \ + int ret; \ + __asm__ __volatile__("syscall" \ + : "=a"(ret) \ + : "a"(39)); \ + ret; \ + }) + +#define sys_open(a1, a2, a3) \ + ({ \ + unsigned long ret; \ + __asm__ __volatile__("syscall" \ + : "=a"(ret) \ + : "a"(2), "D"(a1), "S"(a2), "d"(a3) \ + : "rcx", "r11", "memory"); \ + ret; \ + }) + +#define sys_mmap(a1, a2, a3, a4, a5, a6) \ + ({ \ + unsigned long ret; \ + register long r10 __asm__("r10") = a4; \ + register long r8 __asm__("r8") = a5; \ + register long r9 __asm__("r9") = a6; \ + __asm__ __volatile__("syscall" \ + : "=a"(ret) \ + : "a"(9), "D"(a1), "S"(a2), \ + "d"(a3), "r"(r10), "r"(r8), "r"(r9) \ + : "rcx", "r11", "memory"); \ + ret; \ + }) + +#define sys_munmap(a1, a2) \ + asm volatile("syscall" \ + : \ + : "a"(11), "D"(a1), "S"(a2) \ + : "rcx", "r11", "memory"); + +#define C_SIGPIPE(c) \ + sys_pipe(fd); \ + sys_close(fd[0]); \ + sys_write(fd[1], b, 1); \ + __asm__(".byte " #c); + +#define C_SIGTRAP(c) \ + __asm__("int3"); \ + __asm__(".byte " #c); + +#define C_SIGILL(j1, j2, x, k) \ + __asm__("ud2"); \ + __asm__(".byte " #x); \ + if (k) \ + { \ + __asm__ __volatile__ goto("jmp %l0" \ + : \ + : \ + : \ + : j1); \ + } \ + else \ + { \ + __asm__ __volatile__ goto("jmp %l0" \ + : \ + : \ + : \ + : j2); \ + } + +#define C_SIGFPE(c) \ + __asm__("mov $1, %rax"); \ + __asm__("mov $0, %rbx"); \ + __asm__("div %rbx"); \ + __asm__(".byte " #c); + +#define C_SIGSEGV(c) \ + *(int *)0xffffffffffff = 1; \ + __asm__(".byte " #c); + +#define C_SIGTERM(c) \ + sys_kill(process_pid, SIGTERM); \ + __asm__(".byte " #c); + +#define C_SIGXCPU(c) \ + sys_kill(process_pid, SIGXCPU); \ + __asm__(".byte " #c); + +#define C_SIGSYS(c) \ + sys_kill(process_pid, SIGSYS); \ + __asm__(".byte " #c); + +#define C_SIGBUS(v) \ + __asm__("pushf\norl $0x40000,(%rsp)\npopf"); \ + a = 0xffffff; \ + c = (char *)&a; \ + c++; \ + p = (int *)c; \ + *p = 10; \ + __asm__(".byte " #v); \ + __asm__("pushf\nxorl $0x40000,(%rsp)\npopf"); + +#define C_SIGXFSZ(c) \ + sys_kill(process_pid, SIGXFSZ); \ + __asm__(".byte " #c); + +#define C_END \ + sys_close(fd[0]); \ + sys_close(fd[1]); + +#define OP_ADD 0xd1 +#define OP_SUB 0x71 +#define OP_MUL 0xf7 +#define OP_DIV 0x7f +#define OP_MOD 0x3c +#define OP_XOR 0x5a +#define OP_AND 0x2d +#define OP_OR 0x6e*/ \ No newline at end of file diff --git a/src/res.h b/src/res.h new file mode 100644 index 0000000..aa7489e --- /dev/null +++ b/src/res.h @@ -0,0 +1 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 0000000..e203fa8 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,13 @@ +CC = $(shell which gcc) + +EMBED_CFLAGS = -Wall -Wextra -Werror -pedantic -g -O0 +EMBED_LDFLAGS = +TOOLSFOLDER = tools/bin + +embed: tools/embed/embed.c + $(CC) $(EMBED_CFLAGS) $(EMBED_LDFLAGS) -o $(TOOLSFOLDER)/$@ $^ + +all: embed + +clean-tools: + rm -f $(TOOLSFOLDER)/* \ No newline at end of file diff --git a/tools/bin/.gitkeep b/tools/bin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tools/embed/embed.c b/tools/embed/embed.c new file mode 100644 index 0000000..be1114e --- /dev/null +++ b/tools/embed/embed.c @@ -0,0 +1,333 @@ +/* + +Copyright: + (C) 2022-2023 Daniele 'dzonerzy' Linguaglossa - http://libdzonerzy.so + + This file is part of libdzonerzy.so. + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +*/ + +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include +#include +#include + +#define VERSION "0.0.1" + +typedef struct _embed +{ + char *input; + char *output; + char *format; + int verbose; + int quiet; +} embed_t; + +static void usage(char **argv); +static void version(char **argv); +static int embed(embed_t *args); +static char *clean_filename(char *filename); + +int main(int argc, char **argv) +{ + int c = 0; + embed_t args = {0}; + + while ((c = getopt(argc, argv, "hvi:o:f:Vq")) != -1) + { + switch (c) + { + case 'h': + usage(argv); + exit(EXIT_SUCCESS); + break; + case 'v': + version(argv); + exit(EXIT_SUCCESS); + break; + case 'i': + args.input = optarg; + break; + case 'o': + args.output = optarg; + break; + case 'f': + // check -f=c -f=h handle equal sign and skip it + if (optarg[0] == '=') + { + optarg++; + } + + switch (optarg[0]) + { + case 'c': + args.format = "c"; + break; + case 'h': + + args.format = "h"; + break; + default: + usage(argv); + exit(EXIT_FAILURE); + break; + } + break; + case 'V': + args.verbose = 1; + break; + case 'q': + args.quiet = 1; + break; + default: + usage(argv); + exit(EXIT_FAILURE); + break; + } + } + + return embed(&args); +} + +void usage(char **argv) +{ + char *name = strrchr(argv[0], '/'); + if (name == NULL) + { + name = argv[0]; + } + else + { + name++; + } + + printf("Usage: %s [OPTIONS]\n", name); + printf("Embed a file into a C source file.\n"); + printf("\n"); + printf("Options:\n"); + printf(" -h, --help Print this help and exit\n"); + printf(" -v, --version Print version and exit\n"); + printf(" -i, --input=FILE Input file\n"); + printf(" -o, --output=FILE Output file\n"); + printf(" -f, --format=FORMAT Output format (c, h)\n"); + printf(" -V, --verbose Verbose output\n"); + printf(" -q, --quiet Quiet output\n"); + printf("\n"); +} + +void version(char **argv) +{ + char *name = strrchr(argv[0], '/'); + if (name == NULL) + { + name = argv[0]; + } + else + { + name++; + } + + printf("%s version %s\n", name, VERSION); + printf("\n"); +} + +char *clean_filename(char *filename) +{ + char *p = filename; + while (*p) + { + // replace with _ + // replace symbols with _ + // replace - with _ + // replace . with _ + // all characters to uppercase + + switch (*p) + { + case ' ': + case '-': + case '.': + case '/': + case '\\': + case ':': + case ';': + case ',': + case '\'': + case '"': + case '[': + case ']': + case '{': + case '}': + case '(': + case ')': + case '<': + case '>': + case '?': + case '!': + case '@': + case '#': + case '$': + case '%': + case '^': + case '&': + case '*': + case '+': + case '=': + case '|': + case '`': + case '~': + *p = '_'; + break; + default: + *p = toupper(*p); + break; + } + + p++; + } + + return filename; +} + +int embed(embed_t *args) +{ + if (args->input == NULL) + { + fprintf(stderr, "Input file not specified\n"); + return EXIT_FAILURE; + } + + if (args->output == NULL) + { + fprintf(stderr, "Output file not specified\n"); + return EXIT_FAILURE; + } + + if (args->format == NULL) + { + fprintf(stderr, "Output format not specified\n"); + return EXIT_FAILURE; + } + + if (args->verbose) + { + printf("Input file: %s\n", args->input); + printf("Output file: %s\n", args->output); + printf("Output format: %s\n", args->format); + } + + FILE *input = fopen(args->input, "rb"); + + if (input == NULL) + { + if (!args->quiet) + fprintf(stderr, "Unable to open input file: %s\n", args->input); + return EXIT_FAILURE; + } + + FILE *output = fopen(args->output, "w"); + + if (output == NULL) + { + if (!args->quiet) + fprintf(stderr, "Unable to open output file: %s\n", args->output); + return EXIT_FAILURE; + } + + char *name_only = strdup(args->input); + name_only = strrchr(name_only, '/'); + if (name_only == NULL) + { + name_only = args->input; + } + else + { + name_only++; + } + + char *input_name = strdup(args->input); + input_name = strrchr(input_name, '/'); + if (input_name == NULL) + { + input_name = args->input; + } + else + { + input_name++; + } + + input_name = clean_filename(input_name); + + fprintf(output, "/*\n"); + fprintf(output, " * This file was automatically generated by embed - DO NOT EDIT\n"); + fprintf(output, " * https://libdzonerzy.so\n"); + fprintf(output, " */\n"); + fprintf(output, "\n"); + + if (args->format[0] == 'c') + { + fprintf(output, "__attribute__((section(\"embed/%s\"))) const unsigned char %s[] = {\n", name_only, input_name); + } + else if (args->format[0] == 'h') + { + fprintf(output, "#pragma once\n"); + fprintf(output, "#ifndef %s_H\n", input_name); + fprintf(output, "__attribute__((section(\"embed/%s\"))) const unsigned char %s[] = {\n", name_only, input_name); + } + + int c = 0; + int i = 0; + + while ((c = fgetc(input)) != EOF) + { + if (i == 0) + { + fprintf(output, " "); + } + + fprintf(output, "0x%02X", c); + + if (i < 15) + { + fprintf(output, ", "); + } + else + { + fprintf(output, ",\n"); + i = -1; + } + + i++; + } + + if (i > 0) + { + fprintf(output, "\n"); + } + + fprintf(output, " 0x00,\n"); + fprintf(output, "};\n"); + + if (args->format[0] == 'h') + { + fprintf(output, "#endif /* %s_H */\n", input_name); + } + + fclose(input); + fclose(output); + + if (!args->quiet) + printf("Generated resource '%s'\n", input_name); + + return EXIT_SUCCESS; +} \ No newline at end of file