使用netcat(瑞士軍刀)進(jìn)行文件傳輸
nc(netcat)被譽(yù)為網(wǎng)絡(luò)工具中的“瑞士軍刀”,體積雖小但功能強(qiáng)大,nc最簡(jiǎn)單的功能是端口掃描,這里我主要筆記一下它作為文件傳輸?shù)拿钣谩?br />
首先看一下幫助信息。
$ nc -h OpenBSD netcat (Debian patchlevel 1.105-7ubuntu1) This is nc from the netcat-openbsd package. An alternative nc is available in the netcat-traditional package. usage: nc [-46bCDdhjklnrStUuvZz] [-I length] [-i interval] [-O length] [-P proxy_username] [-p source_port] [-q seconds] [-s source] [-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [destination] [port] Command Summary: -4 Use IPv4 -6 Use IPv6 -b Allow broadcast -C Send CRLF as line-ending -D Enable the debug socket option -d Detach from stdin -h This help text -I length TCP receive buffer length -i secs Delay interval for lines sent, ports scanned -j Use jumbo frame -k Keep inbound sockets open for multiple connects -l Listen mode, for inbound connects -n Suppress name/port resolutions -O length TCP send buffer length -P proxyuser Username for proxy authentication -p port Specify local port for remote connects -q secs quit after EOF on stdin and delay of secs -r Randomize remote ports -S Enable the TCP MD5 signature option -s addr Local source address -T toskeyword Set IP Type of Service -t Answer TELNET negotiation -U Use UNIX domain socket -u UDP mode -V rtable Specify alternate routing table -v Verbose -w secs Timeout for connects and final net reads -X proto Proxy protocol: "4", "5" (SOCKS) or "connect" -x addr[:port] Specify proxy address and port -Z DCCP mode -z Zero-I/O mode [used for scanning] Port numbers can be individual or ranges: lo-hi [inclusive]
端口掃描:
$ nc -z -v -n 127.0.0.1 20-100 ... Connection to 127.0.0.1 80 port [tcp/*] succeeded! ...
簡(jiǎn)單文件傳輸:
客戶端:
$ nc -l 192.168.1.11 1234 > passwd.txt &
服務(wù)端:
$ nc 192.168.1.11 1234 < /etc/passwd
也可以是
cat /etc/passwd | nc 192.168.1.11 1234
服務(wù)端ip是192.169.1.11,端口是1234
如此,當(dāng)兩臺(tái)linux機(jī)器需要簡(jiǎn)單傳輸文件時(shí),再好不過(guò)了~
相關(guān)文章
Shell腳本判斷進(jìn)程是否存在的實(shí)現(xiàn)示例
本文主要介紹了Shell腳本判斷進(jìn)程是否存在的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-06-06bash scp command not found的解決方法
今天在一系統(tǒng)上運(yùn)行bash scp提示command not found,經(jīng)過(guò)如下方法解決了,需要的朋友可以參考下2013-03-03shell實(shí)現(xiàn)自動(dòng)adsl撥號(hào)并檢測(cè)連接狀況腳本分享
這篇文章主要介紹了shell實(shí)現(xiàn)自動(dòng)adsl撥號(hào)并檢測(cè)連接狀況腳本分享,本文給出了兩個(gè)腳本,一個(gè)是自動(dòng)撥號(hào)腳本,一個(gè)是檢測(cè)連接狀態(tài)腳本,需要的朋友可以參考下2014-12-12Shell腳本統(tǒng)計(jì)當(dāng)前目錄下目錄和文件的數(shù)量
這篇文章主要介紹了Shell腳本統(tǒng)計(jì)當(dāng)前目錄下目錄和文件的數(shù)量,Linux下如何統(tǒng)計(jì)當(dāng)前目錄下文件有多少個(gè),目錄又有多少個(gè)呢,使用本文腳本即可實(shí)現(xiàn),需要的朋友可以參考下2014-12-12VPS自動(dòng)備份數(shù)據(jù)庫(kù)到FTP的腳本代碼
示例的文件目錄結(jié)構(gòu):我在/home下操作,自動(dòng)腳本名稱為backup.sh(放置于/home目錄下),VPS本地本分目錄為/home/backup2013-01-01Linux下使用expect命令編寫自動(dòng)化交互腳本
今天小編就為大家分享一篇關(guān)于Linux下使用expect命令編寫自動(dòng)化交互腳本,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2018-11-11