{"id":16967911,"url":"https://github.com/skyf0l/dread-asm","last_synced_at":"2025-03-21T18:18:33.840Z","repository":{"id":232007933,"uuid":"783224463","full_name":"skyf0l/Dread-ASM","owner":"skyf0l","description":"The all-in-one assembly language that can be natively executed on all modern satellites!","archived":false,"fork":false,"pushed_at":"2024-04-07T10:17:33.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T13:11:52.976Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skyf0l.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-07T09:34:23.000Z","updated_at":"2024-04-09T07:23:51.000Z","dependencies_parsed_at":"2024-04-07T11:26:15.698Z","dependency_job_id":"686783df-f48d-4919-ba24-fe29a41674df","html_url":"https://github.com/skyf0l/Dread-ASM","commit_stats":null,"previous_names":["skyf0l/dread-asm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FDread-ASM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FDread-ASM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FDread-ASM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FDread-ASM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skyf0l","download_url":"https://codeload.github.com/skyf0l/Dread-ASM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244844531,"owners_count":20519790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T00:10:12.515Z","updated_at":"2025-03-21T18:18:33.813Z","avatar_url":"https://github.com/skyf0l.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dread-ASM\n\nThe all-in-one assembly language that can be natively executed on all modern satellites!\n\nThe Dread-ASM is a custom assembly language created by [DreadFog](https://github.com/DreadFog) for the [THCon CTF 2024](https://thcon.party/). Here is my implementation of the Dread-ASM interpreter in Python.\n\n## Challenge\n\n### Dread-ASM - Part 1\n\n```console\n$ python Dread-ASM.py chall1.dreadasm\nBuffer content: b'THCON{1nT3rPR3ter5_4r3_FUN!!!!!}'\n```\n\nThe flag is `THCON{1nT3rPR3ter5_4r3_FUN!!!!!}`.\n\n### Dread-ASM - Part 2\n\n```console\n$ python Dread-ASM.py chall2.dreadasm\nEnter a number: 10\nBuffer content: b\"This is not the flag, i'm sorry!\"\n$ python Dread-ASM.py chall2.dreadasm\nEnter a number: 84\nEnter a number: 42\nBuffer content: b\"This is not the flag, i'm sorry!\"\n$ python Dread-ASM.py chall2.dreadasm 84 72 67 79 78 123 121 48 117 95 71 117 51 53 115 51 100 95 109 51 95 99 48 82 114 51 99 55 108 89 33 125\nBuffer content: b\"Congratulations! It's the flag!!\"\n```\n\nThe flag is `THCON{y0u_Gu35s3d_m3_c0Rr3c7lY!}` (from ASCII values).\n\n## Architecture\n\nLuckily, one of the developers has kept the manual referencing all the opcodes.\n\nHere is the manual:\n\n```plaintext\n## Version: 0.7.0\n\n### Registers\n\nthe usual RIP to count instructions\nR0 and R1 registers for calculus\nLCT is the loop count register. It keeps the index of the current loop within the program\nPTR is a register that keeps a pointer to one of the cells of the buffer\n\n### The holy buffer\n\nThis super duper cool architecture has a whole 32\\*8 bit buffer, capable of holding up to 32 8-bit integers! Some may argue that it isn't enough, but it's only because their code isn't optimized enough!\n\n### Basic operations\n\nADD R1 R2 : R1 \u003c- (R1 + R2) % 0xff\nMOV R1 cst : R1 \u003c- cst\nXOR R1 R2 : R1 \u003c- R1 ^ (R2 + 3) % 0xff and no, this is not a bug, it's a feature!\nCMP R1 R2 : classic comparison between R1 and R2\nCLP cst: classic comparison between LCT and cst\n\n### Flow control\n\nthree flags : is_bigger, is_equal and is_smaller\nJRA cst : rip \u003c- rip + cst ; you can read this opcode \"jump relative always\"\nJRG cst : rip \u003c- rip + cst if is_bigger flag set ; it reads \"jump relative greater\"\nJRE cst : rip \u003c- rip + cst if is_equal flag set ; it reads \"jump relative equal\"\nJRL cst : rip \u003c- rip + cst if is_smaller flag set ; it reads \"jump relative lower\"\nINL cst: LCT = cst\nICL : LCT += 1\nSPL: PTR = LCT\n\n### Pointers and data\n\nLDA : R0 \u003c- buf[PTR]\nIPT : PTR \u003c- (PTR + 3) % 32 ; The boss Jeb really wanted this feature, so here it is --'\nLPT RI : RI \u003c- PTR\nSTD RI : buf[PTR] \u003c- RI\n\n### Additional properties\n\nThe buffer is initialized with only zeroes.\nAll registers are initialized with a value equal to 1, except rip which starts at 0.\nThe comparison flags are set to True by default\n\n## Version 1.0.0\n\n### Registers\n\nR2 joins the party as a calculus buffer! It is also initialized to 1\n\n### User input\n\nRDV : R0 \u003c- int(user_input)\nPBF : print the buffer\n\n### Execution termination\n\nHLT : exit the program\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyf0l%2Fdread-asm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyf0l%2Fdread-asm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyf0l%2Fdread-asm/lists"}