Execute a shell (script) from Chromium? - linux

Is there a way to launch a bash/ksh shell, or execute a shell script from Chromium? Is there a setting to tweak, a plungin to add, a workaround besides php and a local server?
Sorry if this is a duplicate. I assumed I would find an answer here, but only see answers about launching Chromium using a script or complete workarounds avoiding my question, with a local server and JavaScript/PHP. I have an Apache server available and can do the coding, but rather not.
I could do this in Internet Explorer on Windows (or used to be able to launch a .bat script there. I haven't used IE in a long time), why not in Chromium on Linux?
I understand the security concerns and sandbox in the browser, but in this case the browser never goes outside a firewall and I just want to launch a script from Chromium.
Thank you for your thoughtful replies.

Related

Opening a website automatically using secure code

I want to open a website(say www.google.com) automatically whenever I am logon. This can be achieved through batch script and VBA macros but it can not be implemented on organisational level due to security concerns.
Is there any secure way to open a particular website using some piece of code.
Please let me know. Thanks in advance.
Regards,
Shrikant Salunke
There are lots of ways to do this, but I'm not sure exactly when you mean by "whenever I am logon".
Basically, if you want the most portable, multilingual way to open a web page with a program you are going to be passing a shell command that looks like this (following your example)
open https://www.google.com
This will open the specified URL (I think it must be a complete URL - including scheme) on the default browser.
Now the "when I am logon" part is what could make things complicated.
If by "when I am logon" you mean whenever you open your browser, then you don't even need to do this you can just reset your browser's homepage.
If you mean whenever you logon to your proxy, you just have to make sure that the first proxy request you send contains the correct request URI. In the case of google the correct URI would be google.com:443. The URI will have the format <hostname>:<portnumber>. The default HTTPS port number is 443. The default HTTP port number is 80.
If you mean whenever you logon to your system then you just need to execute the command open https://www.google.com within a login shell script. Login scripts are system dependent but you may refer to this post if you use a Unix-like or Posix compliant OS. If you use Windows I don't know how to help you but I'm sure there's a way to do it.
If you mean whenever you log into some program you wrote then things get really easy. You just have to make a call to that open command. Almost every language has a built in method for interacting with a shell. You just have to find that method in whatever platform you're using.
I honestly don't know if this will be helpful but good luck!
Edit
How to Run a Batch Shell Script Securely
What you need to do is run the script with a different trustlevel. Since you're using Batch you can do this by executing your script using the runas command (docs). This command allows you to adjust the trustlevel under which the script is executed without changing users. By changing the privileges of the executable, you can prevent it doing anything malicious. All it needs is enough "trust" to execute the open command.
If you need this fully automated throughout your organization, you can wrap your Batch file in a second Batch file that will call the runas command. This wrapper script will not run with reduced privileges but it also won't interact with the internet so you don't have to worry about it as much. You would be able to execute the wrapper script as a login script, and then everything should work.
Honestly I'm not a Windows person but I hope this helps!

AutoHotkey Run command issue in Windows 8.1

this is my first time on such a prestidigious site, so please welcome me by assisting me. I am doing independent development and am primarily a music designer. So that is why I may not sound like a real pro coder but nevertheless truly love creating my music through automative processes.
My present issue is this:
Windows 8.1 Pro
AutoHotkey 1.0.48.5 32bit (running as Admin)
Everytime I attempt to use the command 'RUN' with an .ahk target, I get the expected result except that the .ahk residing folder is opened by MS Explorer. I suspect that something like the fact that AutoHokey is an unsigned app, windows does not want it to run flawlessly. I am now trying a number of Administrative Tool Services disabling, but with no success yet.
RUN C\:XZN\Mecanisms\AnyAHK_script.ahk
;;or
RUN AnyAHK_script.ahk, C\:XZN\Mecanisms
;;or
RUN C\:XZN\Mecanisms\BactchfileLaunchingAboveScript.bat
;;or
RUN AnyAHK_script.ahk, C\:XZN\Mecanisms
Would there be a workaround this at the OS settings level or another way to run/start an .ahk file?
I tried the 'Comspec' approach as well as running an .ahk from within a batchfile, but the .ahk always get intercepted whenever it contains a 'RUN' command requesting an .ahk target.
Thanks.
You are using outdated version of AutoHotkey which is more than 5 years old. Always use AutoHotkey and its documenatation from http://ahkscript.org/ (current uptodate version, new official website)! AutoHotkey and its documentation from autohotkey.com is outdated and you may have some problems using them!
One thing to try if you only have this problem on win 8 is to Enable interaction with administrative programs http://www.autohotkey.com/board/topic/70449-enable-interaction-with-administrative-programs/
That script modifies the executable file's embedded manifest, then creates and installs a self-signed certificate and uses it to sign the file. The executable will not run on any other system, unless you install the certificate used to sign the file.
But lets see some script code that way we have something to test with and can better help you out...

Firefox/Chrome Shell for Ubuntu

I have googled my tail off - but can't seem to find what I am looking for. In Ubuntu (or any Linux distro for that matter) is there a way to set the GUI shell to only be Firefox or Chrome. Meaning - I don't need an entire desktop environment - just the one application.
I am pretty much trying to figure out a Linux equivalent to changing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon from explorer.exe to firefox.exe.
By default, distributions are setup the way that a display manager is fired up right after the X server. For Gnome, that would be GDM, for KDE that would be KDM etc. What you need to do is to replace a Window manager with a custom application, which in your case is a web browser. Generally, you can achieve this by putting your command(s) into ~/.xinitrc and ~/.xsession files, for example:
#!/usr/bin/env bash
firefox &
For Ubuntu, this process is explained in details here. Other distros are quite similar.
Hope it helps. Good Luck!

How to execute a setup from an application to update it?

I'am currently writing an application that has to search on a web site if an update exists for this application. If it is the case the application download a setup file (created with inosetup) and then execute it.
My application is written in C++. And I do not arrive to do this process. I'am trying to call the setup using system(). If the command is system("mysetup") I cannot obtain what I want because the setup cannot replace the exe (currently running). So, I have tried to use system("cmd /C mysetup"), system("cmd/C start /min mysetup"), system ("cmd /C start /min /separate mysetup") without success. In these cases, the fact to stop the application also stop the setup. So I suppose that the setup is considered as a child process.
I have seen in some posts that it might be possible to use execcl(). But this function is in unistd.h. And this library is a little bit to specific for my needs (I need to be able to run on virtualized windows).
So do you have a way to do what I want?
Thanks for your help
OK,
A colleague to me gave me the solution. As we are using QT a QProcess::startDetached does exactly what I want.

Execute a batch script from Firefox

I have written an intranet application from which you can directly connect to a virtual machine by clicking on a RDP-button. The click calls a .bat file, which opens the connection.
With IE, this is no problem, as you can choose to directly execute the batch file. But with Firefox, I can only download the script, and have to start it manually afterwards. Is there a way to trust the intranet domain (about:config?) so Firefox allows it to execute scripts directly? Or is there an even better (easier) way to start an RDP connection from Firefox?
You can easily register a custom protocol handler such as "myrdp://somedata" to run the app that opens the VM (This would probably work with a .bat, it works with a WSH script, better a small exe)
IE/FF support this functionality and allow you to then simply <a href="myrdp://somedata" ..>
You could also try to set up your firefox to automatically open the .rdp files with the default rdp client. This way the files will be downloaded in a temp dir and immediately started up.
You can do this in Firefox's preferences. Hope this helps )

Resources