show ssh key

show ssh key

import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show ssh key",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

  "ins_api": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show ssh key",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_sessions": {
            "ROW_sessions": {
              "key_type": "rsa",
              "key_time": "Fri Jul 27 13:52:00 2018\n",
              "key_data": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCNzYWmJ2zvhLICH52vHdYKjqI+VUcLuRzfnqdD13KfJcG0s/u2iJR/AdUEdZl3gnNnmb20QRMW2wITkIJ1sFXOKPyluDz7NLoKH1WxWOG9YR39El0bf39Ae4JFeGTz8VYY8H6N3f4Xuuko5VHSiX+iJd+1LUTfteMm4vFl0w836Q==\n",
              "key_bitcount": "1024",
              "key_fingerprint": "SHA256:L+AcQ6uPvZzF0bxRdR1zka5kL7zsdn0tFlGIh54DALQ"
            }
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show ssh key command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show ssh key
**
rsa Keys generated:Fri Jul 27 13:52:00 2018

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCNzYWmJ2zvhLICH52vHdYKjqI+VUcLuRzfnqdD13KfJcG0s/u2iJR/AdUEdZl3gnNnmb20QRMW2wITkIJ1sFXOKPyluDz7NLoKH1WxWOG9YR39El0bf
39Ae4JFeGTz8VYY8H6N3f4Xuuko5VHSiX+iJd+1LUTfteMm4vFl0w836Q==

bitcount:1024
fingerprint:
SHA256:L+AcQ6uPvZzF0bxRdR1zka5kL7zsdn0tFlGIh54DALQ
**
could not retrieve dsa key information
**
could not retrieve ecdsa key information
**












show ssh key rsa

show ssh key rsa

import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show ssh key rsa",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

  "ins_api": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": " show ssh key rsa",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_sessions": {
            "ROW_sessions": {
              "key_type": "rsa",
              "key_time": "Fri Jul 27 13:52:00 2018\n",
              "key_data": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCNzYWmJ2zvhLICH52vHdYKjqI+VUcLuRzfnqdD13KfJcG0s/u2iJR/AdUEdZl3gnNnmb20QRMW2wITkIJ1sFXOKPyluDz7NLoKH1WxWOG9YR39El0bf39Ae4JFeGTz8VYY8H6N3f4Xuuko5VHSiX+iJd+1LUTfteMm4vFl0w836Q==\n",
              "key_bitcount": "1024",
              "key_fingerprint": "SHA256:L+AcQ6uPvZzF0bxRdR1zka5kL7zsdn0tFlGIh54DALQ"
            }
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show ssh key rsa command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show ssh key rsa
**
rsa Keys generated:Fri Jul 27 13:52:00 2018

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCNzYWmJ2zvhLICH52vHdYKjqI+VUcLuRzfnqdD13KfJcG0s/u2iJR/AdUEdZl3gnNnmb20QRMW2wITkIJ1sFXOKPyluDz7NLoKH1WxWOG9YR39El0bf
39Ae4JFeGTz8VYY8H6N3f4Xuuko5VHSiX+iJd+1LUTfteMm4vFl0w836Q==

bitcount:1024
fingerprint:
SHA256:L+AcQ6uPvZzF0bxRdR1zka5kL7zsdn0tFlGIh54DALQ
**

















show ssh key dsa

show ssh key dsa

import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show ssh key dsa",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

  "ins_api": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "body": "",
        "input": " show ssh key dsa",
        "msg": "Success",
        "code": "200"
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show ssh key dsa command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show ssh key dsa
**
dsa keys not present, please generate them first
**












show ssh server

show ssh server

import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show ssh server",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

  "ins_api": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show ssh server",
        "msg": "Success",
        "code": "200",
        "body": {
          "operation_status": {
            "o_status": "enabled"
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show ssh server command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show ssh server
ssh version 2 is enabled