• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Is there a way to execute shell commands from HTML?

PowerMacG5

Diamond Member
I have a linux (Slackware 8.1) router that is running snort. It also has snortsnarf to create the visual representation of the snort logs. Now, I have snortnsarf being run from cron.daily, but I want to create a link on my router's home page to generate a snortsnarf page too. It's fine going to console, and executing it myself, but would prefer to have a link on my router's home page to generate an up to date report. I know in C++, I can execute shell commands from a program by saying system("command") (where command is the shell command I want to execute), is there some way to do that in HTML?
 
I don't believe so, as plain HTML is "static". You might be able to embed it in html by writing a cgi script in perl and doing a <!--#include vritual="name of script"-->. You can also do it fairly easily in php using the exec command.
 
You can probably do it in Windows through an IE security hole 😛 but the easiest way in linux is with a perl or PHP cgi-bin program. At least with perl you can link directly to the script file to run it (once its permission is set to 755).
 
Can you give me an example of a the file with the script? Say I want to execute the prgram that is /usr/sbin/snortsnarf. What would be the script for it?
 
i don't think you have to use perl, if you know how to program in shell, then you can use that too as a cgi, just include the right shell after the shebang (ie #!/bin/bash). I don't know if you can actually trigger snortsnarf to run that way, just saying you don't have to go to perl if you don't know it as opposed to using bash or another shell.
 
Last edited:
Back
Top