kali2406
asked on
Coldfusion 10 SystemCommand, cfexecute, .exe
I want to run the .exe file, but the hosting block cfexecute
We do not allow the "cfexecute" tag to be enabled on our shared servers for security reasons.
Search for solutions on the Internet, I found a project systemcommand.jar
java -version (Used to test the code)
Example 1 (SystemCommand_1) Code works
Download
https://docs.google.com/file/d/0B65h04x-wff-ekFIaEMzOWRveDg/edit
Example 2 (SystemCommand_2) Code works
http://blog.stannard.net.au/2007/9/21/executing-system-commands-with-coldfusion/
Download
https://docs.google.com/file/d/0B65h04x-wff-b3M3dEZaaF9zVnc/edit
Example 3 (SystemCommand_3) Why the code does not work
http://blog.stannard.net.au/2008/03/26/executing-system-commands-with-coldfusion-2/
http://systemcommand.riaforge.org/
https://github.com/joshuairl/SystemCommand
Application.cfc
test.cfm
Download
https://docs.google.com/file/d/0B65h04x-wff-WWNJYUR5Z0M4LUE/edit
We do not allow the "cfexecute" tag to be enabled on our shared servers for security reasons.
Search for solutions on the Internet, I found a project systemcommand.jar
java -version (Used to test the code)
Example 1 (SystemCommand_1) Code works
<cfset cmd = "java -version">
<cfset runtime = createObject("java", "java.lang.Runtime")>
<cfset process = runtime.getRuntime().exec(cmd)>
<cfdump var="#process#"/>
Download
https://docs.google.com/file/d/0B65h04x-wff-ekFIaEMzOWRveDg/edit
Example 2 (SystemCommand_2) Code works
http://blog.stannard.net.au/2007/9/21/executing-system-commands-with-coldfusion/
<cfset command = "java -version">
<cfset syscmd = createObject("component","SystemCommand").init()>
<cfset result = syscmd.execute(command)>
<cfdump var="#result#">
Download
https://docs.google.com/file/d/0B65h04x-wff-b3M3dEZaaF9zVnc/edit
Example 3 (SystemCommand_3) Why the code does not work
http://blog.stannard.net.au/2008/03/26/executing-system-commands-with-coldfusion-2/
http://systemcommand.riaforge.org/
https://github.com/joshuairl/SystemCommand
Application.cfc
component output="false" displayname="" {
this.javaSettings.loadPaths = [expandPath(".\systemcommand.jar")];
this.javaSettings.loadColdFusionClassPath=false;
this.javaSettings.reloadOnChange=true;
}
test.cfm
<cfset command = "java -version">
<cfset syscmd = createObject("java","au.com.webcode.util.SystemCommand").init()>
<cfset result = syscmd.execute(command)>
<cfoutput>
Command: #result.getCommand()#<br />
ExitValue: #result.getExitValue()#<br />
Error Output: #result.getErrorOutput()#<br />
Standard Output: #result.getStandardOutput()#<br />
</cfoutput>
Download
https://docs.google.com/file/d/0B65h04x-wff-WWNJYUR5Z0M4LUE/edit
You can zip your exe up and that will make it possible to be downloaded, unzipped on the clients computer and then execute the exe.
ASKER
Fixed downloading
https://docs.google.com/file/d/0B65h04x-wff-Q0VNWG5xUkZxMmM/edit
I want to generate a Web Page Screenshot on my remote server (hosting)
I use the WebKit PhantomJS.exe
Sample pages that use PhantomJS
http://ctrlq.org/screenshots/
http://screener.brachium-system.net/
I want to use to generate screenshots Command System
http://systemcommand.riaforge.org/
https://docs.google.com/file/d/0B65h04x-wff-Q0VNWG5xUkZxMmM/edit
I want to generate a Web Page Screenshot on my remote server (hosting)
I use the WebKit PhantomJS.exe
Sample pages that use PhantomJS
http://ctrlq.org/screenshots/
http://screener.brachium-system.net/
I want to use to generate screenshots Command System
http://systemcommand.riaforge.org/
Can you post the full error message you are getting?
ASKER
Object Instantiation Exception.
Class not found: au.com.webcode.util.System Command
The error occurred in C:/ColdFusion10/cfusion/ww wroot/Syst emCommand_ 3/test.cfm : line 3
1 :
2 : <cfset command = "java -version">
3 : <cfset syscmd = createObject("java","au.co m.webcode. util.Syste mCommand") .init()>
4 : <cfset result = syscmd.execute(command)>
Class not found: au.com.webcode.util.System
The error occurred in C:/ColdFusion10/cfusion/ww
1 :
2 : <cfset command = "java -version">
3 : <cfset syscmd = createObject("java","au.co
4 : <cfset result = syscmd.execute(command)>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm surprised that works at all. cfexecute is simply a wrapper for Runtime.exec. You may not want to plan on this as a long term solution, since your host could easily disable it too ...