Automatically disable greasemonkey when on my corporate LAN

38 views
Skip to first unread message

ppgs

unread,
Jul 20, 2012, 8:18:29 AM7/20/12
to greasemon...@googlegroups.com
I use the same laptop alternatively on my company LAN or my home LAN.

I would like to automatically disable greasemonkey when on my corporate LAN.

Could you add an option so that greasemonkey disables itself when detecting my corporate LAN. I can provide a range of IP addresses corresponding to my company LAN.


Anthony Lieuallen

unread,
Jul 20, 2012, 11:32:03 AM7/20/12
to greasemon...@googlegroups.com
On Fri, Jul 20, 2012 at 8:18 AM, ppgs <lette...@gmail.com> wrote:
Could you add an option so that greasemonkey disables itself when detecting my corporate LAN. I can provide a range of IP addresses corresponding to my company LAN.

I personally would be surprised if such a niche feature ever gets implemented.  It would be possible to build your own extension which performs this for only you, however.

Hans Henrik Bergan

unread,
Jul 20, 2012, 2:20:52 PM7/20/12
to greasemon...@googlegroups.com
i think you should consider using Firefox Profile Manager instead.

but if there is a specific script you dont want to run if your IP is within a range,
i guess you can add something like this at the top of the script

if(java.net.InetAddress.getLocalHost().getHostAddress().toString().match(/$192.168/)
{
throw "stopping script";

mike cupcake

unread,
Jul 20, 2012, 4:21:39 PM7/20/12
to greasemon...@googlegroups.com
On Friday, July 20, 2012 7:20:52 PM UTC+1, Hans Henrik Bergan wrote:
if(java.net.InetAddress.getLocalHost().getHostAddress().toString().match(/$192.168/)
{
throw "stopping script";
}

isn't that Java, not Javascript?  I don't believe Javascript can access the machine's IP address directly.

Dave Land

unread,
Jul 20, 2012, 5:35:33 PM7/20/12
to greasemon...@googlegroups.com
Exactly. If there's a service available on the OP's corporate LAN that will return his machine's LAN IP address, then he can use that info to bail out of the script.

Another approach would be to make a request to any service that is available only on the private network. If the request succeeds, bail out of the script, because you're on the LAN. This might require some fancier coding because the request to the LAN-based service would constitute XSS from the perspective of whatever page is being loaded by the browser.

Otherwise, there's no known way that I can discover for JavaScript within a browser to return the local machine's IP address.

Dave

Sam Larison

unread,
Jul 20, 2012, 5:42:31 PM7/20/12
to greasemon...@googlegroups.com
If your company blocks facebook you could also test that way.

I am in favor of the separate profiles proposal, just run 

firefox.exe -P

You can also create shortcuts to different profiles:

firefox.exe -no-remote -P profile_name

You might consider using a firewall rule to block greasemonkey from doing what you don't want it to do on the work network (update checks?).

--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.

ArmEagle

unread,
Jul 20, 2012, 6:15:42 PM7/20/12
to greasemon...@googlegroups.com
Or you could just use a site like whatismyipaddress and put functionality
in an include script that you can use in all your other scripts to disable
them.

Klaus Johannes Rusch

unread,
Jul 20, 2012, 8:00:04 PM7/20/12
to greasemon...@googlegroups.com
On 20.07.2012 23:35, Dave Land wrote:
> Another approach would be to make a request to any service that is
> available only on the private network. If the request succeeds, bail
> out of the script, because you're on the LAN. This might require some
> fancier coding because the request to the LAN-based service would
> constitute XSS from the perspective of whatever page is being loaded
> by the browser.
var i = new Image();
i.onload = function () {
// executes only if resource on the LAN is accessible
};
i.onerror = function () {
// executes only if resource on the LAN is accessible
};
i.src = "http://lan.example.com/someresource";

Note that the error path will also be chosen when connected to the LAN
but unable to access the resource.

--
Klaus Johannes Rusch
klaus...@atmedia.net
http://klausrusch.atmedia.net/

Reply all
Reply to author
Forward
0 new messages