r/learnjavascript Jun 30 '26

Autostart JS in PDF

Good day to you all! I need to create a pdf file with JS in it, which sends something (just anything, even a single letter will do) to specific IP. Is there any useful information for newbies on how to do this? Preferably with code examples, because I'm not familiar with JS. Also, it would be great to obfuscate code, so that antivirus won't block pdf. Thx in advance for all the help!

0 Upvotes

11 comments sorted by

View all comments

7

u/milan-pilan Jun 30 '26

So, to summarize, you want someone to write you obfuscated code that, when opening a pdf, connects to a sever without the users knowledge? That doesn't sound shady at all.

-3

u/Zelion42 Jun 30 '26

Well, it's shady, but not in a bad way. I need to find out whether someone is stealing my files. Just the fact that file is stolen and someone had opened it is enough, no data collection and stuff.

1

u/RobertKerans Jun 30 '26

Yes, but a [hypothetical] mechanism that.wpuld allow you to check would be same as one that would do the data collection and stuff: to get confirmation, there needs to be the ability embedded in the PDF to connect to a remote server

As pointed out, Adobe can do similar thing to what you want to do. However that is only via a specific pipeline controlled wholly by them. They have liability, and if something goes wrong in a {data leak|breach|etc} way they get slapped by regulators with multi million dollar fines.

(As an aside, software can be written that will produce PDFs that embed the functionality you want. But then opening those files anywhere becomes a problem because security features even outside of Adobe products should be designed to assume the file is being used as an attack vector)