xombra / firefox-showip

Automatically exported from code.google.com/p/firefox-showip
0 stars 0 forks source link

Feature request: PuTTY / ssh auto launch #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

A group of my colleagues use this firefox extension. When talking about it, 
they stated that it would be nice if the IP could be launched directly to an 
SSH session (for server management). After some tweaking, I was able to add 
this feature. I don't if this fits into your overall design of this extension, 
but others may find it handy.

Attached is the modified source.

Simply specify the location of your PuTTY client in the behavior page, and a 
"Connect with SSH" menu item will appear on the pop-up menu beneath "Copy to 
Clipboard".

Original issue reported on code.google.com by maul...@gmail.com on 9 Sep 2010 at 8:11

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

the recommended way is to go to Tools->Showip and add a new entry.
In the URL field put "!/path/to/my/xtermscript.sh"

And in xtermscript.sh I have:

#!/bin/bash
/usr/bin/xterm -e /usr/bin/ssh "$1"

sleep 10

read

Does that work for you?

Original comment by jan.ditt...@gmail.com on 9 Sep 2010 at 10:17

GoogleCodeExporter commented 9 years ago
Hello again,

Yes, your technique does work! It's a little tricker to explain to novices, but 
it works. Thanks for the quick feedback!

Original comment by maul...@gmail.com on 9 Sep 2010 at 10:50

GoogleCodeExporter commented 9 years ago
I took the addon on windows, added a menu option and the linked up this 
function. As you can see I also added a pref dialog so the user can explore to 
the location of putty on the machine.

_putty: function(host){
        if (!host){
            alert('No Host Past?');
            return false;   
        }

        if(!this.prefs.puttypath){
            alert('You havn\'t configured your Putty Path');
            return false;
        }

        var args = ['-ssh','-P','22'];
        if (this.prefs.puttyusername && this.prefs.puttyusername != ''){
            args.push('-l',this.prefs.puttyusername);
        }
        args.push(host);

        this._runProgram(this.prefs.puttypath,args);

    }

if the dev of this addon wants to see all my code, I would be happy to share.

Original comment by mrforsyt...@googlemail.com on 31 Oct 2010 at 12:30

GoogleCodeExporter commented 9 years ago
Sorry.. run program looks like this

_runProgram : function(what,args){

        var file = Components.classes["@mozilla.org/file/local;1"]
            .createInstance(Components.interfaces.nsILocalFile);
        file.initWithPath(what);

        // create an nsIProcess
        var process = Components.classes["@mozilla.org/process/util;1"]
            .createInstance(Components.interfaces.nsIProcess);
        process.init(file);

        var args = args || new Array();

        process.run(false, args, args.length);
        return;
    }

Original comment by mrforsyt...@googlemail.com on 31 Oct 2010 at 12:31

GoogleCodeExporter commented 9 years ago
Hi mrforsythexeter,

It's cool to see that I'm not the only one interested in this. We did end up 
going with Jan's solution. Our biggest concern is being able to receive updates 
from the original author. If this feature becomes popular enough where a GUI 
gets added to the base line, that would be cool. 

Original comment by maul...@gmail.com on 1 Nov 2010 at 3:15

GoogleCodeExporter commented 9 years ago
Hi, I'm still not convinced that this is argument enough for a special case... 
If I start adding everyones pet-tools, it'll get too convoluted. Perhaps I 
should just add a button which creates the correct entry in the action list?

Jan

Original comment by jan.ditt...@gmail.com on 1 Nov 2010 at 8:39

GoogleCodeExporter commented 9 years ago
Jan, I think I would have to agree with you, I've added a lot, like 'whois this 
host' and 'dig this host' choosing your query type, disabled ip v6, and add 
more code to try and handle local files better, but I do find myself supporting 
our 4 users a lot with just these basic additions. The most important feature I 
added, which I would like in the original would be to tag ips with friendly 
names. The reason for this, is its easy to launch my fave tool and pick a saved 
profile when I know the internal friendly name of the server. 

Original comment by mrforsyt...@googlemail.com on 1 Nov 2010 at 10:37

GoogleCodeExporter commented 9 years ago
Could you send a patch? :)

Original comment by jan.ditt...@gmail.com on 5 Mar 2011 at 8:29

GoogleCodeExporter commented 9 years ago
Hi Jan
Im not sure I can just send a patch any more, I have added lots of features so 
a diff will produce a lot of stuff you don't want. Also I have removed IPv6 
From the version I started with. If you still want to see what I have done, I 
would be happy to send you the complete code (or XPI) for you to cherry pick 
from?

Original comment by mrforsyt...@googlemail.com on 5 Mar 2011 at 9:39