Created
May 20, 2021 18:13
-
-
Save ziot/dafeb296a7ec99363c5397e1149a3a59 to your computer and use it in GitHub Desktop.
Script we used to validate angles for the private key, as well extract characters out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from PIL import Image, ImageDraw, ImageFont | |
height = 8192 | |
width = 8192 | |
im = Image.open('pkey2.png') | |
draw = ImageDraw.Draw(im) | |
font = ImageFont.truetype("verdana.ttf", 13) | |
prevSet = [-188, 184] | |
prevSetX, prevSetY = [3474,7870] | |
set = [] | |
sets = [[-188,184],[-160,156],[-188,208],[-180,168],[-176,208],[-204,188],[-192,208],[-204,188],[-164,180],[-192,188],[-208,204],[-172,208],[-160,176],[-164,160],[-208,204],[-160,208],[-172,180],[-180,208],[-164,164],[-172,164],[-208,188],[-156,208],[-204,176],[-172,208],[-188,168],[-160,208],[-204,184],[-164,208],[-172,184],[-208,204],[-168,208],[-204,188],[-168,188],[-208,204],[-188,188],[-160,176],[-184,208],[-180,172],[-168,192],[-208,204],[-184,188],[-184,188],[-208,180],[-208,204],[-164,208],[-184,184],[-192,208],[-204,180],[-188,156],[-208,188],[-160,156],[-208,204],[-188,172],[-184,172],[-208,172],[-176,208],[-188,184],[-172,176],[-184,208],[-204,188],[-164,168],[-184,164],[-208,176],[-172,180],[-180,208],[-184,176],[-168,208],[-204,168],[-208,180],[-208,204],[-180,180],[-208,188],[-172,188],[-168,208],[-204,188],[-192,160],[-156,208],[-188,192],[-176,164],[-208,204],[-184,160],[-164,208],[-180,164],[-188,208],[-204,184],[-176,208],[-176,208],[-204,188],[-164,172],[-160,208],[-176,172],[-192,156],[-208,204],[-188,208],[-180,180],[-176,208],[-204,176],[-208,180],[-160,208],[-204,172],[-188,208],[-180,208],[-204,184],[-192,188],[-172,208],[-188,172],[-192,168]] | |
colors = ["green","purple","yellow","orange","pink","blue"] | |
out = [] | |
for idx,set in enumerate(sets): | |
fail = False | |
setX = prevSetX + set[0] | |
setY = prevSetY - set[1] | |
charX = int((set[0]/4)+96) | |
charY = int(-1*(set[1]/4)+96) | |
out.append(chr(charX)) | |
out.append(chr(charY)) | |
finalSetX = setX % 8192 | |
finalSetY = setY % 8192 | |
if finalSetX != setX or finalSetY != setY: | |
if finalSetY != setY: | |
if finalSetY < setY: | |
finalSetY = finalSetY-6 | |
else: | |
finalSetY = finalSetY+6 | |
else: | |
if finalSetX < setX: | |
finalSetX = finalSetX-6 | |
else: | |
finalSetX = finalSetX+6 | |
setX = finalSetX | |
setY = finalSetY | |
if fail: | |
textBorderColor = "red" | |
textColor = "white" | |
else: | |
textBorderColor = "green" | |
textColor = "white" | |
lineColor = colors[idx%len(colors)] | |
draw.line((prevSetX, prevSetY, setX, setY), fill=lineColor, width=2) | |
text = "{0} ({1}, {2})".format(str(idx), setX, setY) | |
draw.text((setX-1, setY-1), text, font=font, fill=textBorderColor) | |
draw.text((setX+1, setY-1), text, font=font, fill=textBorderColor) | |
draw.text((setX-1, setY+1), text, font=font, fill=textBorderColor) | |
draw.text((setX+1, setY+1), text, font=font, fill=textBorderColor) | |
draw.text((setX,setY), text, font = font, fill=textColor) | |
draw.line((setX, setY, setX, setY), fill="purple", width=1) | |
prevSetX, prevSetY = setX, setY | |
im.save('test.png') | |
print("".join(out)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment