From 20dbeb2f38684c65ff0a4b99012c161295708e88 Mon Sep 17 00:00:00 2001 From: AL-LCL Date: Fri, 19 May 2023 11:01:49 +0200 Subject: NeoRAT --- domestic/utility/text_to_ascii.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 domestic/utility/text_to_ascii.py (limited to 'domestic/utility/text_to_ascii.py') diff --git a/domestic/utility/text_to_ascii.py b/domestic/utility/text_to_ascii.py new file mode 100644 index 0000000..0b6d634 --- /dev/null +++ b/domestic/utility/text_to_ascii.py @@ -0,0 +1,17 @@ +import numpy + +from PIL import Image, ImageDraw, ImageFont + + +def text_to_ascii(text): + myfont = ImageFont.truetype('arial.ttf', 18) + size = myfont.getsize(text) + img = Image.new('1', size, 'black') + draw = ImageDraw.Draw(img) + draw.text((0, 0), text, 'white', font=myfont) + pixels = numpy.array(img, dtype=numpy.uint8) + chars = numpy.array([' ', '%'], dtype='U1')[pixels] + strings = [line for line in chars.view('U' + str(chars.shape[1])).flatten() if not line.isspace()] + result = '\n'.join(strings) + + return result \ No newline at end of file -- cgit v1.2.3