putty源码阅读----plink

一直对ssh协议的各种客户端实现比较入迷,遍寻了很多ssh协议实现也用了很多的库,发现依赖太多
putty是最纯洁依赖第三方几乎为0的客户端实现,先从plink处开始入手.

1.putty目录

才刚开始看其源码,所以先上其目录结构

.
|-- Buildscr                          #编译一个putyy的目录结构,暂时没有看懂用什么编译
|-- Buildscr.cv                       #编译一个putyy的目录结构,暂时没有看懂用什么编译
|-- CHECKLST.txt
|-- LATEST.VER
|-- LICENCE
|-- Makefile.am
|-- Makefile.in
|-- README
|-- Recipe
|-- aclocal.m4
|-- ar-lib
|-- be_all.c
|-- be_all_s.c
|-- be_none.c
|-- be_nos_s.c
|-- be_nossh.c
|-- be_ssh.c
|-- callback.c
|-- charset
|   |-- README
|   |-- charset.h
|   |-- enum.c
|   |-- fromucs.c
|   |-- internal.h
|   |-- localenc.c
|   |-- macenc.c
|   |-- mimeenc.c
|   |-- sbcs.c
|   |-- sbcs.dat
|   |-- sbcsdat.c
|   |-- sbcsgen.pl
|   |-- slookup.c
|   |-- toucs.c
|   |-- utf8.c
|   `-- xenc.c
|-- cmdgen.c
|-- cmdline.c
|-- compile
|-- conf.c
|-- config.c
|-- configure
|-- configure.ac
|-- contrib
|   |-- cygtermd
|   |   |-- Makefile
|   |   |-- README
|   |   |-- main.c
|   |   |-- malloc.c
|   |   |-- malloc.h
|   |   |-- pty.c
|   |   |-- pty.h
|   |   |-- sel.c
|   |   |-- sel.h
|   |   |-- telnet.c
|   |   `-- telnet.h
|   |-- encodelib.py
|   |-- kh2reg.py
|   |-- logparse.pl
|   |-- nice-ibeam.cur
|   `-- samplekex.py
|-- cproxy.c
|-- depcomp
|-- dialog.c
|-- dialog.h
|-- doc
|   |-- AppendixA.html
|   |-- AppendixB.html
|   |-- AppendixC.html
|   |-- AppendixD.html
|   |-- AppendixE.html
|   |-- AppendixF.html
|   |-- Chapter1.html
|   |-- Chapter10.html
|   |-- Chapter2.html
|   |-- Chapter3.html
|   |-- Chapter4.html
|   |-- Chapter5.html
|   |-- Chapter6.html
|   |-- Chapter7.html
|   |-- Chapter8.html
|   |-- Chapter9.html
|   |-- IndexPage.html
|   |-- Makefile
|   |-- blurb.but
|   |-- chm.but
|   |-- chm.css
|   |-- config.but
|   |-- errors.but
|   |-- faq.but
|   |-- feedback.but
|   |-- gs.but
|   |-- index.but
|   |-- index.html
|   |-- intro.but
|   |-- licence.but
|   |-- man-pg.but
|   |-- man-pl.but
|   |-- man-pscp.but
|   |-- man-psft.but
|   |-- man-ptel.but
|   |-- man-pter.but
|   |-- man-putt.but
|   |-- mancfg.but
|   |-- manpages.but
|   |-- pageant.but
|   |-- pgpkeys.but
|   |-- plink.1
|   |-- plink.but
|   |-- pscp.1
|   |-- pscp.but
|   |-- psftp.1
|   |-- psftp.but
|   |-- pterm.1
|   |-- pubkey.but
|   |-- putty.1
|   |-- putty.cnt
|   |-- putty.hlp
|   |-- puttydoc.txt
|   |-- puttygen.1
|   |-- puttytel.1
|   |-- site.but
|   |-- sshnames.but
|   |-- udp.but
|   |-- using.but
|   |-- vids.but
|   `-- vstr.but
|-- errsock.c
|-- icons
|   |-- Makefile
|   |-- cicon.pl
|   |-- icon.pl
|   `-- mkicon.py
|-- import.c
|-- install-sh
|-- int64.c
|-- int64.h
|-- ldisc.c
|-- ldisc.h
|-- ldiscucs.c
|-- logging.c
|-- macosx
|   |-- Makefile
|   |-- README.OSX
|   |-- info.plist
|   |-- osx.h
|   |-- osxclass.h
|   |-- osxctrls.m
|   |-- osxdlg.m
|   |-- osxmain.m
|   |-- osxsel.m
|   |-- osxwin.m
|   `-- putty.icns
|-- minibidi.c
|-- misc.c
|-- misc.h
|-- miscucs.c
|-- missing
|-- mkauto.sh
|-- mkfiles.pl
|-- mksrcarc.sh
|-- mkunxarc.sh
|-- network.h
|-- nocproxy.c
|-- nogss.c
|-- noprint.c
|-- noshare.c
|-- noterm.c
|-- notiming.c
|-- pgssapi.c
|-- pgssapi.h
|-- pinger.c
|-- portfwd.c
|-- pproxy.c
|-- proxy.c
|-- proxy.h
|-- pscp.c
|-- psftp.c
|-- psftp.h
|-- putty.h
|-- puttymem.h
|-- puttyps.h
|-- raw.c
|-- resource.h
|-- rlogin.c
|-- sercfg.c
|-- settings.c
|-- sftp.c
|-- sftp.h
|-- sign.sh
|-- ssh.c
|-- ssh.h
|-- sshaes.c
|-- ssharcf.c
|-- sshblowf.c
|-- sshbn.c
|-- sshbn.h
|-- sshcrc.c
|-- sshcrcda.c
|-- sshdes.c
|-- sshdh.c
|-- sshdss.c
|-- sshdssg.c
|-- sshgss.h
|-- sshgssc.c
|-- sshgssc.h
|-- sshmd5.c
|-- sshnogss.c
|-- sshprime.c
|-- sshpubk.c
|-- sshrand.c
|-- sshrsa.c
|-- sshrsag.c
|-- sshsh256.c
|-- sshsh512.c
|-- sshsha.c
|-- sshshare.c
|-- sshzlib.c
|-- storage.h
|-- telnet.c
|-- terminal.c
|-- terminal.h
|-- testback.c
|-- testdata
|   |-- bignum.py
|   |-- colours.txt
|   |-- lattrs.txt
|   |-- scocols.txt
|   |-- utf8.txt
|   `-- vt100.txt
|-- time.c
|-- timing.c
|-- tree234.c
|-- tree234.h
|-- unix
|   |-- Makefile
|   |-- Makefile.gtk
|   |-- Makefile.ux
|   |-- charset
|   |-- config.log
|   |-- config.status
|   |-- configure
|   |-- gtkcfg.c
|   |-- gtkcols.c
|   |-- gtkcols.h
|   |-- gtkdlg.c
|   |-- gtkfont.c
|   |-- gtkfont.h
|   |-- gtkwin.c
|   |-- pscp
|   |-- psftp
|   |-- puttygen
|   |-- stamp-h1
|   |-- unix
|   |-- unix.h
|   |-- ux_x11.c
|   |-- uxagentc.c
|   |-- uxcfg.c
|   |-- uxconfig.h
|   |-- uxcons.c
|   |-- uxgen.c
|   |-- uxgss.c
|   |-- uxmisc.c
|   |-- uxnet.c
|   |-- uxnoise.c
|   |-- uxpeer.c
|   |-- uxplink.c
|   |-- uxprint.c
|   |-- uxproxy.c
|   |-- uxpterm.c
|   |-- uxpty.c
|   |-- uxputty.c
|   |-- uxsel.c
|   |-- uxser.c
|   |-- uxsftp.c
|   |-- uxshare.c
|   |-- uxsignal.c
|   |-- uxstore.c
|   |-- uxucs.c
|   |-- xkeysym.c
|   |-- xpmptcfg.c
|   |-- xpmpterm.c
|   |-- xpmpucfg.c
|   `-- xpmputty.c
|-- uxconfig.in
|-- version.c
|-- version.h
|-- wcwidth.c
|-- wildcard.c
|-- windows
|   |-- DEVCPP
|   |   |-- pageant
|   |   |   `-- pageant.dev
|   |   |-- plink
|   |   |   `-- plink.dev
|   |   |-- pscp
|   |   |   `-- pscp.dev
|   |   |-- psftp
|   |   |   `-- psftp.dev
|   |   |-- putty
|   |   |   `-- putty.dev
|   |   |-- puttygen
|   |   |   `-- puttygen.dev
|   |   `-- puttytel
|   |       `-- puttytel.dev
|   |-- MSVC
|   |   |-- pageant
|   |   |   `-- pageant.dsp
|   |   |-- plink
|   |   |   `-- plink.dsp
|   |   |-- pscp
|   |   |   `-- pscp.dsp
|   |   |-- psftp
|   |   |   `-- psftp.dsp
|   |   |-- putty
|   |   |   `-- putty.dsp
|   |   |-- putty.dsw
|   |   |-- puttygen
|   |   |   `-- puttygen.dsp
|   |   `-- puttytel
|   |       `-- puttytel.dsp
|   |-- Makefile.bor
|   |-- Makefile.cyg
|   |-- Makefile.lcc
|   |-- Makefile.vc
|   |-- README.txt
|   |-- VS2010
|   |   |-- pageant
|   |   |   |-- pageant.vcxproj
|   |   |   `-- pageant.vcxproj.filters
|   |   |-- plink
|   |   |   |-- plink.vcxproj
|   |   |   `-- plink.vcxproj.filters
|   |   |-- pscp
|   |   |   |-- pscp.vcxproj
|   |   |   `-- pscp.vcxproj.filters
|   |   |-- psftp
|   |   |   |-- psftp.vcxproj
|   |   |   `-- psftp.vcxproj.filters
|   |   |-- putty
|   |   |   |-- putty.vcxproj
|   |   |   `-- putty.vcxproj.filters
|   |   |-- putty.sln
|   |   |-- puttygen
|   |   |   |-- puttygen.vcxproj
|   |   |   `-- puttygen.vcxproj.filters
|   |   `-- puttytel
|   |       |-- puttytel.vcxproj
|   |       `-- puttytel.vcxproj.filters
|   |-- VS2012
|   |   |-- pageant
|   |   |   |-- pageant.vcxproj
|   |   |   `-- pageant.vcxproj.filters
|   |   |-- plink
|   |   |   |-- plink.vcxproj
|   |   |   `-- plink.vcxproj.filters
|   |   |-- pscp
|   |   |   |-- pscp.vcxproj
|   |   |   `-- pscp.vcxproj.filters
|   |   |-- psftp
|   |   |   |-- psftp.vcxproj
|   |   |   `-- psftp.vcxproj.filters
|   |   |-- putty
|   |   |   |-- putty.vcxproj
|   |   |   `-- putty.vcxproj.filters
|   |   |-- putty.sln
|   |   |-- puttygen
|   |   |   |-- puttygen.vcxproj
|   |   |   `-- puttygen.vcxproj.filters
|   |   `-- puttytel
|   |       |-- puttytel.vcxproj
|   |       `-- puttytel.vcxproj.filters
|   |-- pageant.ico
|   |-- pageant.mft
|   |-- pageant.rc
|   |-- pageants.ico
|   |-- plink.rc
|   |-- pscp.ico
|   |-- pscp.rc
|   |-- psftp.rc
|   |-- putty.ico
|   |-- putty.iss
|   |-- putty.mft
|   |-- putty.rc
|   |-- puttycfg.ico
|   |-- puttygen.ico
|   |-- puttygen.mft
|   |-- puttygen.rc
|   |-- puttyins.ico
|   |-- puttytel.rc
|   |-- rcstuff.h
|   |-- sizetip.c
|   |-- version.rc2
|   |-- website.url
|   |-- win_res.h
|   |-- win_res.rc2
|   |-- wincfg.c
|   |-- wincons.c
|   |-- winctrls.c
|   |-- windefs.c
|   |-- windlg.c
|   |-- window.c
|   |-- wingss.c
|   |-- winhandl.c
|   |-- winhelp.c
|   |-- winhelp.h
|   |-- winhsock.c
|   |-- winjump.c
|   |-- winmisc.c
|   |-- winnet.c
|   |-- winnoise.c
|   |-- winnojmp.c
|   |-- winnpc.c
|   |-- winnps.c
|   |-- winpgen.c
|   |-- winpgnt.c
|   |-- winpgntc.c
|   |-- winplink.c
|   |-- winprint.c
|   |-- winproxy.c
|   |-- winsecur.c
|   |-- winsecur.h
|   |-- winser.c
|   |-- winsftp.c
|   |-- winshare.c
|   |-- winstore.c
|   |-- winstuff.h
|   |-- wintime.c
|   |-- winucs.c
|   |-- winutils.c
|   `-- winx11.c
`-- x11fwd.c
原文地址:https://www.cnblogs.com/luomgf/p/4977300.html