{"id":18550347,"url":"https://github.com/amaitou/xorcry","last_synced_at":"2025-07-30T14:05:47.741Z","repository":{"id":37650944,"uuid":"349384407","full_name":"amaitou/Xorcry","owner":"amaitou","description":"Simple encryption tool designed to perform a bitwise XOR operation (XORing) on the contents of files with specific extensions in a given directory or file path. The XOR operation is executed using a user-defined key to encrypt the data.","archived":false,"fork":false,"pushed_at":"2024-07-26T23:20:55.000Z","size":46,"stargazers_count":20,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T12:39:50.680Z","etag":null,"topics":["crypter","cryptography","python3","ransomware","xor","xor-cipher"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amaitou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2021-03-19T10:29:30.000Z","updated_at":"2024-11-18T06:13:11.000Z","dependencies_parsed_at":"2024-04-19T17:44:30.564Z","dependency_job_id":"eb308256-c4fa-42c4-8e58-8e7954b2d5ce","html_url":"https://github.com/amaitou/Xorcry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaitou%2FXorcry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaitou%2FXorcry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaitou%2FXorcry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amaitou%2FXorcry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amaitou","download_url":"https://codeload.github.com/amaitou/Xorcry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248123477,"owners_count":21051479,"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":["crypter","cryptography","python3","ransomware","xor","xor-cipher"],"created_at":"2024-11-06T21:04:17.887Z","updated_at":"2025-04-09T22:31:15.510Z","avatar_url":"https://github.com/amaitou.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"------------------\n![maxresdefault](https://user-images.githubusercontent.com/49293816/188544424-4b56d278-b797-42bc-87e1-60c4adfdd1b9.jpg)\n\n------------------\n# Xorcry\n\nXorcry is an open-source ransomware written in python3 to explain how actually a ransomware or a crypter with a given cryptography algorithm do works.\n\nBefore using this script, specify the path that you want to encrypt\n\n```python\nself.path = \"\u003cyour specific path\u003e\"\n```\n\n# Why?\n\nas a curious person, I really love to understand how things get to work deeply, and one of the questions that I've been asking for a long time was how does the ransomware work? after a lot of disappointing research to give my question a clear answer, I started diving into cryptography algorithms and malware understanding, so without any further ado let's leave this boring introduction aside a bit and go with the cool part.\n\n## How Does Xorcry Work?\n\nfirst of all, you must make sure that I did this tool only for educational purposes, secondly, if you are a cryptographer you will find this writeup boring you.\n\nthere are a lot of cryptography algorithms you can use to make ransomware but I'm not going to explain them for the reason that I didn't use any known crypto algorithm, in fact, what I  did is reading files as binary and xor them with a given key and this is what called **xor cipher**, but wait, I said **xor cipher** hmmm what is this? well, this will be our next topic.\n\n## Xor Cipher\n\nI'll assume that you have a background about Logic gates and what are they, but if you don't I  want you to take a deep look at this\narticle from Wikipedia :\n\nhttps://en.wikipedia.org/wiki/Logic_gate\n\nwell as you noticed  In **xor** operation, the output is true when the inputs differ. In other words, **xor** operation means either one but not both or none.\n\nBelow you can find the principles of **xor** (^ denotes the **xor** operation):\n\n```\n0 ^ 0 = 0\n0 ^ 1 = 1\n1 ^ 0 = 1\n1 ^ 1 = 0\n```\n\n**xor** cipher employs the **xor** logical operation in order to encrypt data. First, a random key is generated or is chosen by you. Then, **xor** operation is performed using the key so that an encrypted data is created. In order to decrypt, the same key should be used and **xor** operation should be run again.\n\n**xor** operation uses the same key for both encryption and decryption operations. That is why it is known as a symmetric encryption.\n\n## Code Explaining\n\nbefore covering the code explaining, I'll assume again that you have the basics of the programming language Python in order to understand The rest of the code because I will cover only the most important function which is :\n\n```python\ndef encrypt(self , f) :\n\n\t\t''' If the file's extension is one of the list declared above then start XoRing '''\n\n\t\tif self.check_ex(f) :\n\n\t\t\ttry :\n\t\t\t\twith open(f , mode = \"rb\") as _file :\n\t\t\t\t\trd = bytearray(_file.read())\n\t\t\t\tfor n , v in enumerate(rd) :\n\t\t\t\t\trd[n] = v ^ self.key\n\t\t\t\twith open(f , mode = \"wb\") as _nf :\n\t\t\t\t\t_nf.write(rd)\n\n\t\t\t\t''' This exception is especially for file permissions '''\n\n\t\t\texcept :\n\t\t\t\tpass\n```\n\nthe first line I will talk about is the operation of reading the file we want to encrypt in binary mode and declare a variable where we will put the binary data as a list using the built-in function _bytearray()_, I found this article useful for those who want to understand how does the *bytearray()* work :\n\nhttps://www.geeksforgeeks.org/python-bytearray-function/\n\nafter that, there is a for loop to edit the list by performing **xor** operation for each element in the list with the given key and finally rewrite the file we have opened previously with the new encrypted data.\n\n## Contact Me\n\nFor Any Questions You Can Find Me on This Platforms :\n\n* [Twitter][_1]\n\n[_1]: https://twitter.com/amait0u\n\n# Disclaimer\nThis program must be used for legal purposes! I am not responsible for anything you do with it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famaitou%2Fxorcry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famaitou%2Fxorcry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famaitou%2Fxorcry/lists"}