Tweets from pichat

PichatFollow my new user account @markseu
About 2 months, 3 weeks ago from Pichat (Pichat Software)

Tweets from 600infos

600infosI HAVE NYANED FOR 888.4 SECONDS! http://t.co/JQYOZebv via @nyannyancat
About 3 months, 3 weeks ago from 600infos (Wolf)

plink tunnel

create_a_new_directory_at_your_Quick-Launch.bat
@echo off

REM ############################################################################
REM 
REM plink_tunnel.cmd
REM Version 0.0.3 27.02.2009 Mark Wolfgruber
REM 
REM open a tcp tunnel over ssh
REM 
REM ############################################################################
 
:presettings
rem If you want you can define the presettings here
rem ATTENTION Password is allways not encrypted
rem save passwords here on your own risk!
rem Ports only available from 1 to 65535 
 
goto define_vars
 
  set __ssh_port__=22
  set __remote_host__=172.17.1.30
  set __remote_port__=443
  set __local_port__=44301
  set __username__=root
  set __pw__=my1stPASSWORD
 
  if "%__ssh_port__%"=="" set __ssh_port__=22
  if "%__remote_host__%"=="" set __remote_host__=IP_or_SERVERNAME
  if "%__remote_port__%"=="" set __remote_port__=3389
  if "%__local_port__%"=="" set __local_port__=33891
  if "%__username__%"=="" set __username__=%USERNAME%
 
:define_vars
  set __plink__=%ProgramFiles%\PuTTY\PLINK.EXE
  if not exist "%__plink__%" (
    echo.
    echo ERROR can not find %__plink__%
    echo.
    pause
    goto end
  )
 
:menu 
 
  set __choice__=
  cls
  echo.
  echo Open a tunnel Session via ssh
  echo =============================
  echo.
  echo active settings: 
  echo    remote Host [%__remote_host__%] (ssh Port: %__ssh_port__%) 
  echo    remote Application Port [%__remote_port__%]
  echo    local Port [%__local_port__%]
  echo    Username [%__username__%]
 
  echo.
  echo Mainmenu
  echo --------
  echo.
  echo O = open tunnel
  echo M = modify or set settings
  echo A = active ports on localhost 
  echo.  
  echo L = load settings  
  echo S = save settings
  echo.  
  echo E = End and Exit
  echo.  
 
  set /P __choice__=Your Choice [%__choice__%]: 
 
  if "%__choice__%"=="m" set __choice__=M
  if "%__choice__%"=="M" call :modify_settings
 
  if "%__choice__%"=="a" set __choice__=A
  if "%__choice__%"=="A" call :show_open_ports
 
  if "%__choice__%"=="l" set __choice__=L
  if "%__choice__%"=="L" call :load_settings
 
  if "%__choice__%"=="s" set __choice__=S
  if "%__choice__%"=="S" call :save_settings
 
  if "%__choice__%"=="e" set __choice__=E
  if "%__choice__%"=="E" goto end
 
  if "%__choice__%"=="o" set __choice__=O
  if "%__choice__%"=="O" (
    call :check_pw  
    if "%__ssh_port__%"=="" (
      echo no ssh setting set or loaded...
      pause
      set __choice__=
      )
    if "%__remote_host__%"=="" (
      echo no remote host setting set or loaded...
      pause
      set __choice__=
      )
    if "%__remote_port__%"=="" (
      echo no remote port setting set or loaded...
      pause
      set __choice__=
      )
    if "%__local_port__%"=="" (
      echo no local port setting set or loaded...
      pause
      set __choice__=
      )
    if "%__username__%"=="" (
      echo no username setting set or loaded...
      pause
      set __choice__=
      )
    if "%__pw__%"=="" (
      echo no password set or loaded...
      pause
      set __choice__=
      )
    )
   if "%__choice__%"=="O" call :open_tunnel
 
goto menu

REM ############################################################################
 
:functions
 
:header   
  cls
  echo.
  echo Open a tunnel Session via ssh
  echo =============================
  echo.
  goto :EOF
 
:modify_settings   
  call :header
  set /P __remote_host__=remote Host [%__remote_host__%]: 
  set /P __ssh_port__=ssh Port [%__ssh_port__%]: 
  set /P __remote_port__=remote Application Port [%__remote_port__%]: 
  set /P __local_port__=local Port [%__local_port__%]: 
  set /P __username__=Username [%__username__%]: 
  set /P __pw__=Password [%__pw__%]: 
  goto :EOF
 
:show_open_ports
  cls
  netstat -a -n  | findstr /i "LISTENING ABHÖREN" | more
  pause
  goto :EOF
 
:open_tunnel
  start "Tunnel localhost:%__local_port__% -> %__remote_host__%:%__remote_port__%" "%__plink__%" -v -ssh -2 -N -batch -L %__local_port__%:%__remote_host__%:%__remote_port__% -l %__username__% %__remote_host__% -P %__ssh_port__% -pw %__pw__% 
  goto :EOF
 
:load_settings
  call :header
  echo This is a future function
 
  if "%__dat_file__%"=="" for /F "tokens=1* delims=" %%A in ('dir /s/b/od "%APPDATA%\tunnel_*.dat"') do set __dat_file__=%%A
 
  echo Folder/Files to display (use ? or * as Wildcard)
  echo %__dat_file__%
  set /P __dat_file__=type new path\file or press ENTER:
 
  for /F "eol=# tokens=1,2,3,4,5,6,7,8,9* delims=:#" %%A in ('type "%__dat_file__%"') do (
    set __remote_host__=%%A
    set __ssh_port__=%%B
    set __remote_port__=%%C
    set __local_port__=%%D
    set __username__=%%E
    set __pw__=%%F
    if "%__pw__%"=="#" set __pw__=
    if "%__pw__%"==" " set __pw__=
   ) 
  echo.
  call :check_pw  
  rem pause
  goto :EOF
 
:check_pw
  if "%__pw__%"=="" (
    echo Password is not set!
    set /P __pw__=Set Password: 
  )
  goto :EOF
 
:save_settings
  call :header
  echo This is a future function
 
 
  set __dat_file__=%APPDATA%\tunnel_%__remote_host__%-%__remote_port__%.dat
  echo File to save the settings 
  echo %__dat_file__%
  set /P __dat_file__=type new path\file or press ENTER: 
 
  echo %__remote_host__%:%__ssh_port__%:%__remote_port__%:%__local_port__%:%__username__%:# > "%__dat_file__%"
rem  echo %__remote_host__%:%__ssh_port__%:%__remote_port__%:%__local_port__%:%__username__%:%__pw__% > "%__dat_file__%"
 
  echo.
  type "%__dat_file__%"
  echo. 
  echo saved to File "%__dat_file__%"
  echo. 
  pause
  goto :EOF
 
:end
  echo.
  echo Script is terminating ...
  echo.
  pause

Translate
Advertisment
  • more about Pichat on http://www.pichat.net
  • C4 - Tiny chat software
  • http://600infos.de
  •    Counter:  11683  Online:  6  Your IP:  38.107.179.236  DNS:  unknown  Page generated in    0.19 sec.