Needed to connect to ftp or mysql from home or on the go.
I referred to this article.
[Python] Automate SSH registration for CORESERVER
In my case, it seemed difficult to do automation, so when executing it, manually from the terminal,
python
python login.py
I am typing like this.
python
# coding: utf-8
# userid, passwd,Set 3 core server domains according to your environment
import urllib
def get_ip():
f = urllib.urlopen('http://dyn.value-domain.com/cgi-bin/dyn.fcg?ip')
ip = f.read()
return ip
def regist_host(ip, url):
userid = '********' #Please enter your user ID
passwd = '********' #Please enter your password
keyword = u'SSH registration'
encoding = 'shift-jis'
p = [
('id', userid),
('pass', passwd),
('remote_host', ip),
('ssh2', keyword.encode(encoding)),
]
params = urllib.urlencode(p)
#print params
up = urllib.urlopen(url, params)
#print up.read()
if __name__ == '__main__':
url = 'https://ss1.coressl.jp/www.****.coreserver.jp/jp/admin.cgi' #Please enter the domain of the core server
ip = get_ip()
regist_host(ip, url)
Recommended Posts