├── LICENSE ├── PAYLOAD.js ├── README.md ├── hackme.py ├── img ├── PDF HackMe J5.png ├── banner.jpg └── example.jpg ├── requirements.txt └── sample.pdf /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Evil feoniX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PAYLOAD.js: -------------------------------------------------------------------------------- 1 | PAYLOAD() 2 | 3 | function PAYLOAD(){ 4 | var authors = "EvilFeonix"; 5 | var tools = "PDF-HackMe-J5"; 6 | alert("Welcome To "+tools+", Created by "+authors+"!"); 7 | alert("this is a python based-embedding script that allows you to simply craft your own malicious JavaScript payload to a PDF file"); 8 | console.log(authors); 9 | console.log(tools); 10 | } 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg) 2 | 3 |
4 | 5 | 6 | # PDF HackMe 7 | 8 | ![Script](https://github.com/evilfeonix/PDF-HackMe/blog/main/img/banner.jpg) 9 | 10 |
11 | 12 | Our all in one PDF hacking script! created by evilfeonix.\ 13 | this our PDF hacking script allow user to encrypt their PDF as well as to decrypt them, crack encrypted PDF, change PDF metadata, inject malicious JavaScript code into PDF file, check if a pdf file is infected with malicious javascript code 14 | 15 | 16 | 17 | 19 | 20 | 24 | 25 | # Tested 26 | 1. Termux 27 | 2. Window 28 | 3. Kali Linux 29 | 30 | # Features 31 | 1. Encrypt and decrypt PDF file 32 | 1. Allow Cracking encrypted PDF file 33 | 1. Allow changing metadata of a PDF file 34 | 2. Allow embedding of javascript code into PDF file. 35 | 2. Allow Chacking if javascript code was embedded to PDF file. 36 | 3. Simple and easy-to-use command-line interface (CLI). 37 | 5. No need for internet connection. 38 | 39 | # Requirements 40 | - Python 3.X 41 | - PyPDF2 and Colorama Library 42 | - Grant Access to Android Storage 43 | 44 | # Installations 45 | ### In Termux: 46 | Download and install termux app from their official webpage, launch ther termux app and enter the below commands. 47 | ``` 48 | termux-setup-storage 49 | ``` 50 | ``` 51 | apt update && apt upgrade 52 | ``` 53 | ``` 54 | apt install git 55 | ``` 56 | ``` 57 | apt install python3 58 | ``` 59 | ``` 60 | git clone https://github.com/evilfeonix/PDF-HackMe.git 61 | ``` 62 | ``` 63 | cd PDF-HackMe 64 | ``` 65 | ``` 66 | pip install -r requirements.txt 67 | ``` 68 | ``` 69 | python3 hackme.py 70 | ``` 71 | 72 | ### In Kali Linux: 73 | Download and install Kali from their official webpage, in the kali terminal, enter the below commands. 74 | ``` 75 | git clone https://github.com/evilfeonix/PDF-HackMe.git 76 | ``` 77 | ``` 78 | cd PDF-HackMe 79 | ``` 80 | ``` 81 | pip install -r requirements.txt 82 | ``` 83 | ``` 84 | python3 hackme.py 85 | ``` 86 | 87 | # Watch full Video 88 | ![Screen Shot](https://github.com/evilfeonix/PDF-HackMe/blog/main/img/example.jpg) 89 | 90 | # Important Note 91 | 92 | > **Make sure you fucking have necessary permission to access the `/storage/emulated/0/` directory. If you are running Termux as non-root user, you gonna need to use the `termux-setup-storage` command in order to grant access to the storage directory.** 93 | 94 | > **Note that the creators of this tool are not responsible for any misuse or damage caused by its usage.** 95 | 96 | 97 | # License 98 | 99 | _**PDF HackMe** is released under the MIT License. See License for details_ 100 | 101 | # Follow Us 102 | github: https://github.com/evilfeonix \ 103 | website: https://evilfeonix.github.io \ 104 | web-blog: https://evilfeonix.github.io/blog \ 105 | youtube: https://www.youtube.com/@evilfeonix \ 106 | linkedin: https://www.linkedin.com/in/evilfeonix \ 107 | 108 |
109 | Happy PDF Hacking! 110 |
111 | -------------------------------------------------------------------------------- /hackme.py: -------------------------------------------------------------------------------- 1 | # Versoin: 1.2 2 | # Author: evilfeonix 3 | # Name: PDF HackMe J5 4 | # Email: evilfeonix@gmail.com 5 | # Modified: 16 - MARCH - 2025 6 | # Created: 12 - JANUARY - 2025 7 | # Website: https://evilfeonix.github.io 8 | 9 | # all in one PDF file hacking script, 10 | # which include encrypting and decrypting PDF, cracking PDF decryption key, 11 | # changing PDF file metadata, injecting JavaScript malicious code into PDF file, 12 | # and finally check if a pdf file is infected with malicious javascript code 13 | 14 | import re, os, sys, time, argparse 15 | 16 | try: 17 | import webbrowser 18 | from colorama import Fore 19 | from PyPDF2 import PdfWriter, PdfReader 20 | except: 21 | print(f' ') 22 | print(f'{Fore.RED}[-] Run: pip install -r requirements.txt') 23 | print(f'{Fore.WHITE}') 24 | os.sys.exit() 25 | 26 | def exitME(): 27 | print(f"") 28 | print(f"{Fore.RED}===========================================================") 29 | print(f" {Fore.CYAN}Thanks for using our PDF hacking script{Fore.RED} ") 30 | print(f"==========================================================={Fore.WHITE}") 31 | os.sys.exit(0) 32 | 33 | 34 | def banner(): 35 | os.system("cls || clearS") 36 | return f"""{Fore.RED} 37 | ____ ____ _____ _ _ {Fore.CYAN}v[1.2]{Fore.RED} _ __ __ 38 | | _ \| _ \| ___| | | | | __ _ ___| | _| \/ | ___ 39 | | |_) | | | | |_ _____| |_| |/ _` |/ __| |/ / |\/| |/ _ \\ 40 | | __/| |_| | _|_____| _ | (_| | (__| <| | | | __/ 41 | |_| |____/|_| |_| |_|\__,_|\___|_|\_\_| |_|\___| 42 | _ ____ 43 | {Fore.GREEN}Coded by {Fore.CYAN}EvilFeonix {Fore.RED} | | ___| 44 | {Fore.GREEN}evilfeonix@gmail.com{Fore.RED} _ | |___ \\ 45 | {Fore.GREEN}https://evilfeonix.github.io{Fore.RED} | |_| |___) | 46 | \___/|____/{Fore.WHITE} 47 | [+]{Fore.GREEN} All in one PDF hacking script{Fore.WHITE} [+] {Fore.RED} 48 | ==========================================================={Fore.WHITE}""" 49 | 50 | def aboutME(): 51 | time.sleep(1) 52 | print(banner()) 53 | print(f"\n {Fore.CYAN}Version :: {Fore.WHITE}v[1.2] ") 54 | print(f" {Fore.CYAN}Tool Name :: {Fore.WHITE}WiFi-Crack ") 55 | print(f" {Fore.CYAN}Author :: {Fore.WHITE}evilfeonix ") 56 | print(f" {Fore.CYAN}Github :: {Fore.WHITE}Digital Firebird ") 57 | print(f" {Fore.CYAN}Youtube :: {Fore.WHITE}Digital Firebird ") 58 | print(f" {Fore.CYAN}Latest Update :: {Fore.WHITE}15 - March - 2025 ") 59 | print(f" ") 60 | print(f" [+] {Fore.CYAN}Subscribe To Our YouTube Channel{Fore.WHITE} [+]{Fore.RED}") 61 | print(f"==========================================================={Fore.WHITE}\n") 62 | print(f" {Fore.CYAN}About this Program{Fore.WHITE} ") 63 | print(f" This is a program written in python, this program allow") 64 | print(f" Hacking PDF file, some features of this program include") 65 | print(f" Encrypting PDF as well as decryption it") 66 | print(f" Changing PDF metadatas (eg.title, author, and more!)") 67 | print(f" Cracking enctypted PDF to identified the decryption key") 68 | print(f" Injecting malicious javascript code into PDF file") 69 | print(f" And finally, identifies if a PDF is infected with JS code{Fore.RED}") 70 | print(f"\n==========================================================={Fore.WHITE}") 71 | 72 | def HackMe(inPDF,outPDF): 73 | write_pdf = PdfWriter() 74 | 75 | try:read_pdf = PdfReader(inPDF) 76 | except FileNotFoundError: 77 | print(f"{Fore.RED}[-] We can't find this file: {inPDF}{Fore.WHITE}") 78 | print(f'{Fore.WHITE}') 79 | os.sys.exit() 80 | 81 | js = input(f"{Fore.CYAN}[+] Enter path to javascript file: {Fore.WHITE}") 82 | try:js_file = open(js,'r') 83 | except FileNotFoundError: 84 | print(f"{Fore.RED}[-] We can't find this file: {js}{Fore.WHITE}") 85 | print(f'{Fore.WHITE}') 86 | os.sys.exit() 87 | 88 | js_code = js_file.read() # alert; console.log 89 | js_payload = re.sub(r'([a-zA-Z0-9_]+)\(',r'app.\1(',js_code) # app.alert; console.app.log 90 | js_payload = re.sub(r'(\w+)\.app.(\w+)\(',r'app.\1.\2(',js_payload) # console.app.log ~to~ app.console.log 91 | js_file.close 92 | 93 | import PyPDF2 94 | write_pdf.add_js(js_payload) 95 | 96 | try: 97 | page_len = len(read_pdf.pages) # knows if given PDF file was already encrypted 98 | for idx in range(page_len): 99 | page = read_pdf.pages[idx] 100 | write_pdf.add_page(page) 101 | except PyPDF2.errors.FileNotDecryptedError: 102 | print(f"{Fore.CYAN}[!] This PDF file was encrypted! {Fore.WHITE}") 103 | print(f"{Fore.CYAN}[!] Decrypt this PDF before we can inject your own malicious JS code! {Fore.WHITE}") 104 | os.sys.exit(1) 105 | 106 | # write_pdf.encrypt(user_password=user_pswd,owner_password=owner_pswd,permissions_flag=0b0100) 107 | 108 | with open(outPDF,"wb") as new_pdf: 109 | write_pdf.write(new_pdf) 110 | 111 | time.sleep(1) 112 | print(f"{Fore.GREEN}[*] We successfully inject your own malicious JS code into this PDF.{Fore.WHITE}") 113 | 114 | def j52PDF(inPDF,outPDF): 115 | HackMe(inPDF,outPDF) 116 | 117 | def PDFmetadata(inPDF,outPDF): 118 | write_pdf = PdfWriter() 119 | 120 | try:read_pdf = PdfReader(inPDF) 121 | except FileNotFoundError: 122 | print(f"{Fore.RED}[-] We can't find this file: {inPDF}{Fore.WHITE}") 123 | print(f'{Fore.WHITE}') 124 | os.sys.exit() 125 | 126 | 127 | try: 128 | import PyPDF2 129 | page_len = len(read_pdf.pages) # knows if given PDF file was already encrypted 130 | for idx in range(page_len): 131 | page = read_pdf.pages[idx] 132 | write_pdf.add_page(page) 133 | except PyPDF2.errors.FileNotDecryptedError: 134 | print(f"{Fore.CYAN}[!] This PDF file was encrypted already! {Fore.WHITE}") 135 | print(f"{Fore.CYAN}[!] Decrypt this PDF before we can change it metadata! {Fore.WHITE}") 136 | os.sys.exit(1) 137 | 138 | title = input(f"{Fore.CYAN}[+] Change PDF title: {Fore.WHITE}") 139 | author = input(f"{Fore.CYAN}[+] Enter author name (ur name): {Fore.WHITE}") 140 | subject = input(f"{Fore.CYAN}[+] Enter PDF subject to change: {Fore.WHITE}") 141 | keyword = input(f"{Fore.CYAN}[+] Enter PDF keywords to change: {Fore.WHITE}") 142 | created = input(f"{Fore.CYAN}[+] Set created date (d/m/yy, h:m:s AM/PM): {Fore.WHITE}") 143 | modified = input(f"{Fore.CYAN}[+] Set modification date (d/m/yy, h:m:s AM/PM): {Fore.WHITE}") 144 | 145 | write_pdf.add_metadata({ 146 | "/Title":title, 147 | "/Author":author, 148 | "/Subject":subject, 149 | "/Keywords":keyword, 150 | "/Created":created, 151 | "/Modified":modified, 152 | "/Application":"PDF HackMe J5 by evilfeonix", 153 | }) 154 | 155 | with open(outPDF,"wb") as new_pdf: 156 | write_pdf.write(new_pdf) 157 | 158 | time.sleep(1) 159 | print(f"{Fore.GREEN}[*] We successfully change this PDF metadata.{Fore.WHITE}") 160 | 161 | 162 | def enctyptPDF(inPDF,outPDF): 163 | write_pdf = PdfWriter() 164 | 165 | try:read_pdf = PdfReader(inPDF) 166 | except FileNotFoundError: 167 | print(f"{Fore.RED}[-] We can't find this file: {inPDF}{Fore.WHITE}") 168 | print(f'{Fore.WHITE}') 169 | os.sys.exit() 170 | 171 | import PyPDF2 172 | user_pswd = input(f"{Fore.CYAN}[+] Enter encryption key: {Fore.WHITE}") 173 | 174 | try: 175 | page_len = len(read_pdf.pages) # knows if given PDF file was already encrypted 176 | for idx in range(page_len): 177 | page = read_pdf.pages[idx] 178 | write_pdf.add_page(page) 179 | except PyPDF2.errors.FileNotDecryptedError: 180 | print(f"{Fore.CYAN}[!] This PDF file was encrypted already! {Fore.WHITE}") 181 | os.sys.exit(1) 182 | 183 | write_pdf.encrypt(user_pswd) 184 | with open(outPDF,"wb") as inPDF: 185 | write_pdf.write(inPDF) 186 | 187 | time.sleep(1) 188 | print(f"{Fore.CYAN}[*] We haved successfully encrypt this PDF.{Fore.WHITE}") 189 | 190 | 191 | def decryptPDF(inPDF,outPDF): 192 | write_pdf = PdfWriter() 193 | 194 | try:read_pdf = PdfReader(inPDF) 195 | except FileNotFoundError: 196 | print(f"{Fore.RED}[-] We can't find this file: {inPDF}{Fore.WHITE}") 197 | print(f'{Fore.WHITE}') 198 | os.sys.exit() 199 | 200 | user_pswd = input(f"{Fore.CYAN}[+] Enter decryption key: {Fore.WHITE}") 201 | 202 | import PyPDF2 203 | if read_pdf.is_encrypted: 204 | read_pdf.decrypt(user_pswd) 205 | try: 206 | page_len = len(read_pdf.pages) 207 | for idx in range(page_len): 208 | page = read_pdf.pages[idx] 209 | write_pdf.add_page(page) 210 | except PyPDF2.errors.FileNotDecryptedError: 211 | print(f"{Fore.RED}[-] Incorrect PDF password {user_pswd}{Fore.WHITE}") 212 | os.sys.exit(1) 213 | else: 214 | print(f"{Fore.CYAN}[!] This PDF file was not encrypted{Fore.WHITE}") 215 | os.sys.exit(1) 216 | 217 | with open(outPDF,"wb") as inPDF: 218 | write_pdf.write(inPDF) 219 | 220 | time.sleep(2) 221 | print(f"{Fore.CYAN}[*] We haved successfully decrypt this PDF.{Fore.WHITE}") 222 | 223 | 224 | 225 | def check(inPDF,outPDF): 226 | try: 227 | with open(inPDF,"r") as f: 228 | pass 229 | except: 230 | print(f"{Fore.RED}[-] We can't find this file: {inPDF}{Fore.WHITE}") 231 | os.sys.exit(1) 232 | 233 | with open(inPDF,"rb") as f: 234 | pswds = f.read() 235 | 236 | if b"/JavaScript" in pswds or b"/JS (" in pswds or b"/JS <" in pswds: 237 | print(f"{Fore.RED}[!] This PDF file was infected with malicious javascript code{Fore.WHITE}") 238 | print(f"{Fore.RED}[!] Be curefull with this PDF, otherwise! u fall victim of unknown hacker{Fore.WHITE}") 239 | else: 240 | print(f"{Fore.GREEN}[*] This PDF is saved, no malicious javascript code is injected!{Fore.WHITE}") 241 | # print(pswds) 242 | 243 | 244 | def crackPass(inPDF,outPDF): 245 | write_pdf = PdfWriter() 246 | 247 | try:read_pdf = PdfReader(inPDF) 248 | except FileNotFoundError: 249 | print(f"{Fore.RED}[-] We can't find this file: {inPDF}{Fore.WHITE}") 250 | print(f'{Fore.WHITE}') 251 | os.sys.exit(1) 252 | 253 | passFile = input(f"{Fore.CYAN}[+] Enter path to wordlist: {Fore.WHITE}") 254 | try: 255 | with open(passFile,"r") as f: 256 | pass 257 | except: 258 | print(f"{Fore.RED}[-] We can't find this file: {passFile}{Fore.WHITE}") 259 | os.sys.exit(1) 260 | 261 | with open(passFile,"r") as f: 262 | pswds = f.readlines() 263 | 264 | for pswd in pswds: 265 | pswd=pswd.strip() 266 | import PyPDF2 267 | if read_pdf.is_encrypted: 268 | read_pdf.decrypt(pswd) 269 | try: 270 | page_len = len(read_pdf.pages) 271 | for idx in range(page_len): 272 | page = read_pdf.pages[idx] 273 | write_pdf.add_page(page) 274 | 275 | time.sleep(1) 276 | print(f"{Fore.GREEN}\n[*] This PDF has been successfully cracked!{Fore.WHITE}") 277 | print(f"{Fore.GREEN}[*] Password is: {pswd}{Fore.WHITE}") 278 | os.sys.exit(0) 279 | except PyPDF2.errors.FileNotDecryptedError: 280 | print(f"{Fore.RED}[-] Password Not Match: {pswd}") 281 | 282 | else: 283 | print(f"{Fore.RED}[!] This PDF file was not encrypted{Fore.WHITE}") 284 | os.sys.exit(1) 285 | 286 | print(f"{Fore.CYAN}[!] This PDF password was not found in wordlist{Fore.WHITE}") 287 | os.sys.exit(0) 288 | 289 | with open(outPDF,"wb") as inPDF: 290 | write_pdf.write(inPDF) 291 | 292 | def main(): 293 | 294 | time.sleep(1) 295 | print(banner()) 296 | 297 | print(f""" 298 | [00] {Fore.CYAN}Exit program{Fore.WHITE} 299 | [01] {Fore.CYAN}About program{Fore.WHITE} 300 | [02] {Fore.CYAN}Encrypt your PDF{Fore.WHITE} 301 | [03] {Fore.CYAN}Decrypt your PDF{Fore.WHITE} 302 | [04] {Fore.CYAN}Change PDF metadata{Fore.WHITE} 303 | [05]{Fore.CYAN} Crack encrypted PDF{Fore.WHITE} 304 | [06] {Fore.CYAN}Inject JS code to PDF{Fore.WHITE} 305 | [07] {Fore.CYAN}Check if PDF is infected{Fore.WHITE} 306 | """) 307 | 308 | act=input(f"{Fore.CYAN}[+] How can we help you today:{Fore.WHITE} ") 309 | 310 | if act in ["0","00"]: 311 | exitME() 312 | elif act in ["1","01"]: 313 | aboutME() 314 | elif act in ["2","02"]: 315 | input_pdf = input(f"{Fore.CYAN}[+] Enter path to PDF:{Fore.WHITE} ") 316 | enctyptPDF(input_pdf,input_pdf) 317 | elif act in ["3","03"]: 318 | input_pdf = input(f"{Fore.CYAN}[+] Enter path to PDF:{Fore.WHITE} ") 319 | decryptPDF(input_pdf,input_pdf) 320 | elif act in ["4","04"]: 321 | input_pdf = input(f"{Fore.CYAN}[+] Enter path to PDF:{Fore.WHITE} ") 322 | PDFmetadata(input_pdf,input_pdf) 323 | elif act in ["5","05"]: 324 | input_pdf = input(f"{Fore.CYAN}[+] Enter path to PDF:{Fore.WHITE} ") 325 | crackPass(input_pdf,input_pdf) 326 | elif act in ["6","06"]: 327 | input_pdf = input(f"{Fore.CYAN}[+] Enter path to PDF:{Fore.WHITE} ") 328 | j52PDF(input_pdf,input_pdf) 329 | elif act in ["7","07"]: 330 | input_pdf = input(f"{Fore.CYAN}[+] Enter path to PDF:{Fore.WHITE} ") 331 | check(input_pdf,input_pdf) 332 | else: 333 | print(f"{Fore.RED}[-] Invalid choice{Fore.WHITE}") 334 | print(f"{Fore.RED}[-] Please choose from the above mentioned{Fore.WHITE}") 335 | 336 | 337 | act = input(f"\n{Fore.CYAN}[+] Will you like to perform any action: {Fore.WHITE}") 338 | if act.lower() in ["y","yes"]: 339 | main() 340 | exitME() 341 | 342 | 343 | 344 | if __name__ == "__main__": 345 | main() 346 | 347 | -------------------------------------------------------------------------------- /img/PDF HackMe J5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilfeonix/PDF-HackMe-J5/63413b5f08f96d651f260254f086d08f0253781a/img/PDF HackMe J5.png -------------------------------------------------------------------------------- /img/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilfeonix/PDF-HackMe-J5/63413b5f08f96d651f260254f086d08f0253781a/img/banner.jpg -------------------------------------------------------------------------------- /img/example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilfeonix/PDF-HackMe-J5/63413b5f08f96d651f260254f086d08f0253781a/img/example.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | PyPDF2 2 | colorama 3 | pyfiglet -------------------------------------------------------------------------------- /sample.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evilfeonix/PDF-HackMe-J5/63413b5f08f96d651f260254f086d08f0253781a/sample.pdf --------------------------------------------------------------------------------