From: Esben Stien <b0ef@esben-stien.name>
To: help-gnu-emacs@gnu.org
Subject: SSH URL
Date: Sat, 29 Mar 2014 20:40:18 +0100 [thread overview]
Message-ID: <87r45kiyjh.fsf@quasar.esben-stien.name> (raw)
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
next reply other threads:[~2014-03-29 19:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-29 19:40 Esben Stien [this message]
2014-03-30 2:51 ` SSH URL Stefan Monnier
2014-03-30 17:48 ` Michael Albinus
2014-03-30 18:41 ` Stefan Monnier
2014-03-30 19:26 ` Michael Albinus
2014-04-01 12:57 ` Michael Albinus
2014-04-01 14:29 ` Stefan Monnier
2014-03-31 18:45 ` Esben Stien
2014-04-01 6:38 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r45kiyjh.fsf@quasar.esben-stien.name \
--to=b0ef@esben-stien.name \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.