Python pysftp: bypass ssh host key verification








import pysftp

cnopts = pysftp.CnOpts();

# set hostkeys to None to disable ssh key verification
cnopts.hostkeys = None
try:
   sftp = pysftp.Connection(host='sftp.yourdomain.org', username='sftp-user', password='password', port=22, cnopts=cnopts)
   print(sftp.pwd)
finally:
   if sftp:
       sftp.close()



Windows Batch Script: remove trailing slash from a path string








set "a=C:\Users\wx\Downloads\"
if "%a:~-1%"=="\" set "a=%a:~0,-1%"
if "%a:~-1%"=="/" set "a=%a:~0,-1%"
echo %a%



see also




Windows Batch Script: parse arguments








@echo off
setlocal EnableExtensions EnableDelayedExpansion

set verbose=false
set value=

:loop
if "%~1"=="" (
    if "%~1"=="--help" (
        call :help
        exit /b 0
    )
    if "%~1"=="--value" (
        set value=%~2
        shift
        shift
        goto :loop
    )
    if "%~1"=="--verbose" (
        set verbose=true
        shift
        goto :loop
    )
    shift
    goto :loop
)


see also