Manually ssh registration for coreserver with python

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

Manually ssh registration for coreserver with python
Getting Started with Python for PHPer-Classes
Getting Started with Python for PHPer-Functions
Easy keyword extraction with TermExtract for Python
INSERT into MySQL with Python [For beginners]
Use DeepL with python (for dissertation translation)
Memo to ask for KPI with python
Amplify images for machine learning with python
Tips for dealing with binaries in Python
Tips for using python + caffe with TSUBAME
[Shakyo] Encounter with Python for machine learning
Limit ssh with iptables for each user
Process multiple lists with for in Python
Connect with mysql.connector with ssh tunnel in Python 3.7
Getting Started with Python for PHPer-Super Basics
Debug for mysql connection with python mysql.connector
[Python] Read images with OpenCV (for beginners)
WebApi creation with Python (CRUD creation) For beginners
[ev3dev × Python] SSH Control (remote control with keyboard)
Preparation for scraping with python [Chocolate flavor]
[For beginners] Try web scraping with Python
2016-10-30 else for Python3> for:
python [for myself]
FizzBuzz with Python3
Scraping with Python
Statistics with python
Causal reasoning and causal search with Python (for beginners)
Get a ticket for a theme park with python
Scraping with Python
Python with Go
[Translation] Getting Started with Rust for Python Programmers
Create a LINE BOT with Minette for Python
Building an Anaconda environment for Python with pyenv
Play with Lambda layer (python) for about 5 minutes
Use logger with Python for the time being
Twilio with Python
Procedure for creating a LineBot made with Python
Integrate with Python
Wrap C with Cython for use from Python
Move THORLABS automatic stage with Python [for research]
Play with 2016-Python
AES256 with python
~ Tips for Python beginners from Pythonista with love ① ~
Tested with Python
python starts with ()
Django with Python Tools 2.2 for Visual Studio (PTVS 2.2)
[Python] Collect images with Icrawler for machine learning [1000 images]
Image Processing with Python Environment Setup for Windows
Note for formatting numbers with python format function
with syntax (Python)
Commands for creating a python3 environment with virtualenv
Bingo with python
Zundokokiyoshi with python
Wrap C ++ with Cython for use from Python
Memo for editing scenes with Blender python (W.I.P.)
~ Tips for Python beginners from Pythonista with love ② ~
[Introduction for beginners] Working with MySQL in Python
Excel with Python
Microcomputer with Python
Settings for getting started with MongoDB in python
Cast with python