From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Esben Stien Newsgroups: gmane.emacs.help Subject: SSH URL Date: Sat, 29 Mar 2014 20:40:18 +0100 Message-ID: <87r45kiyjh.fsf@quasar.esben-stien.name> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1396122060 24757 80.91.229.3 (29 Mar 2014 19:41:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Mar 2014 19:41:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 29 20:40:51 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WTz7a-00035k-OJ for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Mar 2014 20:40:50 +0100 Original-Received: from localhost ([::1]:40758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTz7a-0005bo-2c for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Mar 2014 15:40:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTz7F-0005aX-Ar for help-gnu-emacs@gnu.org; Sat, 29 Mar 2014 15:40:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTz77-000409-Qr for help-gnu-emacs@gnu.org; Sat, 29 Mar 2014 15:40:29 -0400 Original-Received: from nmsh1.e.nsc.no ([193.213.121.72]:56605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTz77-0003zs-GZ for help-gnu-emacs@gnu.org; Sat, 29 Mar 2014 15:40:21 -0400 X-Auth: executiv@online.no Original-Received: from quasar.esben-stien.name (cm-84.210.71.233.getinternet.no [84.210.71.233]) (authenticated bits=0) by nmsh1.nsc.no (8.14.7/8.14.7) with ESMTP id s2TJeJ0D023318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NOT) for ; Sat, 29 Mar 2014 20:40:19 +0100 (MET) X-Home-Page: http://www.esben-stien.name User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 193.213.121.72 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96844 Archived-At: In Emacs, I usually open ssh sessions like this: cd /ssh:foo@baz:~ Is there any way in Emacs to open up SSH URLs', like this?: ssh://foo:bar@baz Here's the password included and this is the way I receive SSH urls. I understand the security aspects of this but I don't care about that with this project. I use PKI normally, though. I use the following python script that accepts SSH urls, but I'd rather use my beloved emacs. #!/usr/bin/env python import pexpect import struct, fcntl, os, sys, signal import urlparse def sigwinch_passthrough (sig, data): # Check for buggy platforms (see pexpect.setwinsize()). if 'TIOCGWINSZ' in dir(termios): TIOCGWINSZ = termios.TIOCGWINSZ else: TIOCGWINSZ = 1074295912 # assume s = struct.pack ("HHHH", 0, 0, 0, 0) a = struct.unpack ('HHHH', fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ , s)) global global_pexpect_instance global_pexpect_instance.setwinsize(a[0],a[1]) url = urlparse.urlparse(sys.argv[1]); ssh_newkey = 'Are you sure you want to continue connecting' p=pexpect.spawn('ssh'+' '+url.username+':'+url.password+'@'+url.hostname) i=p.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT],1) if i==0: print "I say yes" p.sendline('yes') i=p.expect([ssh_newkey,'password:',pexpect.EOF]) if i==1: #print "I give password", p.sendline(url.password) elif i==2: print "I either got key or connection timeout" pass elif i==3: #timeout pass p.sendline("\r") global global_pexpect_instance global_pexpect_instance = p signal.signal(signal.SIGWINCH, sigwinch_passthrough) try: p.interact() sys.exit(0) except: sys.exit(1) -- Esben Stien is b0ef@e s a http://www. s t n m irc://irc. b - i . e/%23contact sip:b0ef@ e e jid:b0ef@ n n