Menu

02 March 2010

[LUG@IITD:6582] Re: any stable software for ssh over jabber

Thanks Everyone, and specially Chetan, My Problem got solved.
http://eggsonbread.com/2009/12/16/jabber-sh-%E2%80%94-sh-console-via-xmppjabber-gtalk/ is the solution.
Now I can control my system from anywhere. one of the most beautiful software.

On Tue, Mar 2, 2010 at 9:09 AM, chetan.mlist <chetan.mlist@gmail.com> wrote:

On Feb 27, 8:44 pm, narendra sisodiya <narendra.sisod...@gmail.com>
wrote:

> I have two laptop. both are in different city. One is connected to Reliance
> USB internet and other is connected via Tata Indicom. (both can open
> google.com , yup it means both are on Internet and hidden somewhere by some
> methods,, fundas of external ips etc)

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 
#!/usr/bin/env ruby
 
# Jabber-SH — SH console via XMPP/Jabber (GTalk)
#
# Jabber-SH allows you to administrate a remote computer via a command line
# through a Jabber client. It’s like SSH via GoogleTalk! :)
# This is just a hack but it might be usefull sometime to run basic commands
# on a machine that is not accessible via ssh.
#
# Philippe Creux. pcreux/AT/gmail/DOT/com
 
# Jabber-SH connects to Jabber using the BOT_LOGIN and BOT_PASSWORD details.
BOT_LOGIN = "A_JABBER_SH_ACCOUNT@gmail.com"
BOT_PASSWORD = "A_JABBER_SH_PASSWORD"
 
# Jabber-SH answers some random epigram via 'fortune' to any message sent to him.
# The user CLIENT_LOGIN logs into the console by sending the CLIENT_PASSPHRASE.
CLIENT_LOGIN = "YOUR_EVERYDAY_ACCOUNT@gmail.com"
CLIENT_PASSPHRASE = "A_PASSPHRASE_TO_LOGIN"
 
require 'rubygems'
require 'xmpp4r-simple'
require 'session'
 
puts "Connecting"
if messenger = Jabber::Simple.new(BOT_LOGIN, BOT_PASSWORD)
  puts "Connected"
else
  puts "Ooops - Can't connect"
end
 
@sh = nil
 
while true
  messenger.received_messages do |msg|
    puts "Received #{msg.body} from #{msg.from}"
    if msg && msg.from.to_s.include?(CLIENT_LOGIN)
      if msg.body == CLIENT_PASSPHRASE
        if @sh == nil
          @sh = Session::new
          message = "Now logged in!"
        else
          @sh.close && @sh = nil
          message = "Logged out..."
        end
        messenger.deliver(msg.from, message)
      else
        if @sh
          stdout, stderr = @sh.execute(msg.body) if msg.body
          messenger.deliver(msg.from, "\n" + stdout.chomp) unless stdout.empty?
          messenger.deliver(msg.from, "\n" + stderr.chomp) unless stderr.empty?
          messenger.deliver(msg.from, @sh.execute('pwd')[0].chomp + "$>")
        else
          messenger.deliver(msg.from, `fortune`)
        end
      end
    end
  end
  sleep 1
end
??
An equivalent in your favourite language may be the answer.
HTH
Chetan

Posted via email from LUG@IITD Community Blog

Post a Comment