Zabbix Run a script to call Exe from my local computer - zabbix

I have some computers and all have RDP enabled. So Id like to link to create a script to call a command from my local computer, like "C:\Windows\system32\mstsc.exe {HOST.CONN}"
but i dont know how to call a .exe from my own computer.
Is this possible?
how i imagine add rdp option

It's an useful idea, but Zabbix is not quite there yet. You would need to use a URL field, but there is no URL field in the Host, only in the Problem. You also need a Custom protocol handler in chrome (or your favourite browser, almost same procedure).
To add an URL field in the menĂ¹ you highlighted, you may use TamperMonkey (client side) or fiddle with the zabbix-web source code (server side). I'd use TamperMonkey because editing the source code will not survive a package upgrade.

Related

IE html anchor tags don't work when referencing local files that were made on other computers

I'm working on a large project, which uses IE (IE11) to display local htm pages. (Yes, IE is required. I can't use a different browser). We aren't using a web server; everything is pulled from the local drive. No http requests are made during this.
We're planning to send parts of it out to remote locations to use on those sites. Atm I'm using a self-extracting rar, so that the htm, js, css, and media files can all be put in the proper locations. After deployment, the file structure on the remote location should mirror that of the Dev system. Everything works fine on the Dev system. However, at the remote sites some of the anchor links stop working. After some testing, it appears that if the file I'm trying to link to originated from a different computer, the link does nothing. But if I were to make a new file, copy everything from the old file to the new file, and replace the old one with the new one, the link works. The files are identical in content, but only the one that originated from the remote site works.
Link
The above would work if foo.htm was created on that computer, but not if it was created on a different computer (such as the Dev computer). This issue appears to occur with .htm/html files, as well as .css and .js files. It might also occur for media files, but I didn't check.
I imagine there is some kind of security setting or something that needs to be changed, but I can't figure out what. We plan to distribute to a lot of sites, so I can't manually fix the problem for every site.
Any idea why this is happening?
Edit: No errors pop up in the console when I click on the links. I didn't check out the network tab, since everything is local, but that might be a thing to try tomorrow. Also, I didn't know about file blocking. I'll check that too. If that were to be the case, how can I unblock the files automatically? This may be deployed to people who don't have a strong grasp of computers.
From the description of the issue, it looks like when you send the zip file to another machine then on that machine file gets blocked.
Below are some ways to unblock the file or to prevent the blocking. You can choose the suitable way as per your requirement.
The easiest way to unblock the file is to, right-click the zip file then click on properties and click on the Unblock Checkbox and click the OK button. Then after try to unzip the file. It will unblock all files together.
You can also try to unblock the zip file by using the PowerShell command below.
dir "folderpath" -Recurse | Unblock-File
Note: Make sure to run the script as an administrator.
Further, you can set a group policy to prevent blocking the file.
Group policy path:
User Configuration-> Administrative Templates-> Windows Components-> Attachment Manager
Policy name: Do not preserve zone information in file attachments
You can double click this policy and disabled it.
Note: Please note this will leave you vulnerable to malware & is not recommended..

Create a web browser link that opens a file in Intellij. Possible?

Example, qbittorent can be made to open links that are of torrent files.
Email clients mailto:
Is it possible to create links in a browser that will open the given file in Intellij? (Not full path, but entire package possibly ).
Idea is that this will be created for bitbucket.
There is an open feature request to add idea:// protocol handler.
At the moment it works on macOS only out of the box. For other platforms you can try the third-party solution or other workarounds from the ticket comments.
There is also a built-in web server providing the REST API to open files.
It will work with the relative paths only when the IDE is already running and the project is open: http://localhost:63342/api/file/relative/to/module/root/path/to/file.kt.
With the JetBrains Toolbox App installed one will be able to use jetbrains:// protocol for navigation, it's work in progress and should be available in 2019.2.
See JBProtocolNavigateCommand.kt for the reference:
// handles URLs of the following types:
// jetbrains://idea/navigate/reference?project=IDEA
// [&reference[X]=com.intellij.navigation.JBProtocolNavigateCommand[.perform][#perform]]+
// [&path[X]=com/intellij/openapi/project/impl/JBProtocolNavigateCommand.kt[:23[:1]]]+
// [&selection[X]=25:5-26:6]+
Sample URL:
jetbrains://idea/navigate/reference?project=IDEA&fqn=com.intellij.openapi.application.JetBrainsProtocolHandler#getParameters
Toolbox URL matches regexp:
"${JetBrainsProtocolHandler.PROTOCOL}([\\w\\-]+)/navigate/reference\\?project=(?<project>[\\w]+)(&fqn[\\d]*=(?<fqn>[\\w.\\-#]+))*(&path[\\d]*=(?<path>[\\w-_/\\\\.]+)(:(?<location1>[\\d]+))?(:(?<location2>[\\d]+))?)*(&selection[\\d]*=(?<line1>[\\d]+):(?<column1>[\\d]+)-(?<line2>[\\d]+):(?<column2>[\\d]+))*"
There will be also UI for copying TBX protocol URLs directly from the editor similar to the Copy Reference action in the context menu. The same will work for IDE settings navigation.
As an update to #CrazyCoder's answer
This works* on Mac currently. (unable to test on anything else personally)
* There are some issues:
There is no context menu option for generating this link from clicking on a line of code
The keybinding (see below) generates the incorrect path, and it needs to be modified manually by either changing the sources root temporarily, or typing the missing path parts by hand.
There is a keybinding you can use to generate the url, under Preferences > Keymap > Copy Path/Reference > Toolbox URL. Note that the cursor location when using the keybinding matters. From what I can tell, if the cursor is at the beginning or end of a line, it generates a url with &path=..., else it generates with &fqn=.... The fqn option will often link to the wrong area of the code, especially when interfaces, libraries, auto-wiring, or anything not a direct vanilla class/object/function is attempted to link to.
I have filed an issue with more details on the broken path generated by the keybinding: https://youtrack.jetbrains.com/issue/IDEA-290640

"unsafely-treat-insecure-origin-as-secure" flag is not working on Chrome

I am using geo-location for a site running locally on my machine using HTTP on Chrome. However this does not work as I am running on HTTP as opposed to HTTPS.
On the console it says:
getCurrentPosition() and watchPosition() no longer work on insecure origins.
To use this feature, you should consider switching your application to a
secure origin, such as HTTPS. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins
for more details.
Accoriding to Deprecating Powerful Features on Insecure Origins its says to start chrome using --unsafely-treat-insecure-origin-as-secure="http://example.com" flag. The command I ran was similar to:
chrome.exe --unsafely-treat-insecure-origin-as-secure="http://hello.app"
However, the same error message still appears.
How can I fix this issue.
None of the solutions worked for me.
I achieved this by following steps.
Type chrome://flags/#unsafely-treat-insecure-origin-as-secure in the address bar.
Add the origin which you need to treat as secure as shown in the below image.
Relaunch chrome.
You must have missed some steps. Try to follow this
Go to File Explorer then paste this to address bar >> C:\Program Files (x86)\Google\Chrome\Application (or just go to where you can find your chrome.exe)
Right click chrome.exe > send to > Desktop (Create Shortcut)
Go to your desktop then find the chrome shortcut you've created.
Rename it to ChromeForTesting (this step is optional)
Right click the shortcut, then Click Properties
At the "Target", paste the following at the end of the link
--user-data-dir=/tmp/foo --unsafely-treat-insecure-origin-as-secure=http://example.com
so Target should look somewhat similar to this
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=/tmp/foo --unsafely-treat-insecure-origin-as-secure=http://example.com
Click Ok..
During testing close all of your opened google chrome browser.
Then double click ChromeForTesting shortcut (the one you've created), when a prompt appears, just click ok..
EDIT: If the steps above does not work for you, you might be using Chrome V63, update it to V64 above cause this flag is messed up in V63.
P.S. If it's still not working follow these extra steps
At your drive C, create a folder and name it "ChromeTempFiles".
Then in your --user-data-dir= you change the value into "C:\ChromeTempFiles"
Add these to your target as well
--allow-running-insecure-content --reduce-security-for-testing
so your target should look like this now
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\ChromeTempFiles --unsafely-treat-insecure-origin-as-secure=http://example.com --allow-running-insecure-content --reduce-security-for-testing
You should also use a temproary fresh profile for that session. something like this:
chrome.exe --user-data-dir=/test/only/profile/dir --unsafely-treat-insecure-origin-as-secure="http://example.com"
Just an update to this for Chrome 70. This works perfectly
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\ChromeTempFiles --allow-running-insecure-content
Now does anybody know if there is an equivalent for firefox?
For Chromium 44 use
--unsafety-treat-insecure-origin-as-secure=http://192.168.0.101:3000
instead
--unsafely-treat-insecure-origin-as-secure=http://192.168.0.101:3000
See that bug
In Google Chrome, you simply type into the address bar, "chrome://flags", and search for, "--unsafely-treat-insecure-origin-as-secure", enable that flag, and enter into the field below (multiples may be entered separated by a comma) the domain you wish to treat as secure. This may or may not compromise your security, but I would assume not as getCurrentPosition() and watchPosition() are somewhat recently deprecated features. this works for publicly served domains, as well.
With Chrome 79 this setting doesn't work no matter what.
What I ended up doing was to configure the domain on a VPS to show some test webpage and then generate a valid certificate for it using Let's Encrypt's certbot.
Then I copied that certificate to my machine and it's now valid.

Can you run multiple Chrome instances with different proxies?

I'm trying to run multiple instances of of Chrome with different proxies. Searching the web I've found that chrome supposedly supports 'chrome.exe --proxy-server="proxy:port" ' from the command line. But I've tried that and it doesn't work.
Is there any way to run multiple instances of Chrome with different proxies?
Thanks!
The answer from gengkev is correct. For all users combing from search engines who need a quick "copy and paste" solution, use this link target (windows):
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-server="http://proxy01.your.proxy:3128" --user-data-dir="%LOCALAPPDATA%\Google\Chrome-proxy01\User Data"
Chrome will create this new folder "Chrome-proxy01" on its own. With this you can have multiple chrome shortcuts using different proxy servers.
If you're running more than one instance of chrome with different flags, I think you need to specify different paths to --user-data-dir.
As mentioned in the previous answer, the way to do that is to:
Pass a --proxy-server parameter
Pass a different user data directory path for every launch with a different proxy server
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-server="http://proxy01.your.proxy:3128" --user-data-dir="%LOCALAPPDATA%\Google\Chrome-proxy01\User Data"
Where %LOCALAPPDATA%\Google\Chrome-proxy01\User Data folder needs to be unique for any new instance that uses a different proxy. So use %LOCALAPPDATA%\Google\Chrome-proxy02\User Data for the second launch, %LOCALAPPDATA%\Google\Chrome-proxy03\User Data for the third launch etc.
I would also highly advise to use the --no-first-run flag to get rid of the annoying popup that asks you whether you want to set chrome as your default browser every time you launch it with a new data directory
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-server="http://proxy01.your.proxy:3128" --user-data-dir="%LOCALAPPDATA%\Google\Chrome-proxy01\User Data" --no-first-run
Yes, you can run it. To do so:
Install the extension SwitchyOmega in the profiles that you want to use proxy.
Create a profile with your desired name and enter the details of the proxy that you wish to use.
Save the changes using apply changes button.
Switch to your proxy using the extension button present on the top right corner of the chrome.
In addition I am also attaching extension screenshot:
As of 2014-10-05, the easiest way to run multiple versions or instances of Chrome is to use Google Chrome Portable, downloaded from:
http://portableapps.com/apps/internet/google_chrome_portable
Currently I'm running 4 separate instances of Google Chrome v37.0.2062.124. One instance is installed and three other instances of Google Chrome are portable.
Here's how my Windows 7 Taskbar looks like when all 4 instances of Chrome are opened:
http://image.bayimg.com/a024621496637cbdc2ad85324ed5e8e07b9f5453.jpg
If you want to change Google Chrome icon that is shown on the Windows Taskbar once Google Chrome is started, then you should follow this link:
https://superuser.com/questions/613851/is-it-possible-to-customize-taskbar-icons-if-so-how
The answer is given in comments: you need to change icons that are stored in chrome.dll using Resource Tuner (use Trial version) or Resource Hacker (free).
When you run totally separate instances of Chrome, you can make those separate Chrome instances use different proxies through Chrome settings of that particular instance of Chrome.
You can make multiple "people" (settings > manage other people > add person). You can then open a instance for each person(you don't have to login to google for the other "people"). Then you can configure a proxy for that instance.
To get the menu that's shown in the picture just click on your profile icon on the top right.

Run a program from a local webpage

I'm trying to use a webpage as an entry point for a kiosk. The HTML will be run in local, I need two things:
<a href="c:\Users\Admin\Documents">...
Which works like a charm
And..
<a href="c:\Program Files\Windows Live\Mail\wlmail.exe">...
(program just an example, all programs are the same)
Which works but.. it prompts to download the file then you are prompted to start it.. Is there any way to do this directly, like click and bam you opened notepad.exe? Maybe using a Java applet?
EDIT:
I know it can't be done remotely, I'm talking about local files.
The file will be accessed as c:\myhtml.html
And will open ONLY already installed files, nothing from the web.
If i get your question right , the closest thing to get what you want would be using *.hta which is a HTML Application that runs outside the browser window just like a normal app.
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script>
Bit more info here:
http://www.kunal-chowdhury.com/2010/09/how-to-execute-local-file-using-html.html
The right way to implement this is by creating custom protocol in Windows. Details in the MSDN article "Registering an Application to a URI Scheme"
No, this is security issue, browsers don't allow it because it could be security risk to run apps without prompt, just by clicking on the link.
There are several technologies like java WebStart and ASP ClickOnce - they will install the app more or less automatically, signing the application helps too - the messages the user gets look less scary.
Correct me if I didn't understand you. If you're running the web page locally (http:\127.0.0.1) and want to execute a program in the same machine, it will depend on the technology that you're using, for example in php you could use exec() to execute a program on user input but it will run on the server side.