Bash whoisスクリプトは*を使用して地域情報を呼び出しますか? [コピー]

Bash whoisスクリプトは*を使用して地域情報を呼び出しますか? [コピー]

スクリプトで非常に奇妙な出力が表示されます。以下は、端末で単独で実行される行です。

root@KaliTestBox:~/Desktop/dns1# echo $(whois 13.66.39.88 |head -n 40 |tail -n 28 |tr '\n' ' ')

しかし、出力は何とか「ls」を実行しますか? CSVで使用されている改行文字を削除するときは、ブロック引用符を使用してください。すべての内容が太字で表示され、「ls」は2回実行されますか?私は理解できません。実際のフイズはその下にあります。

編集:これを見てください。 *に関連していますが、コマンドラインに入れるだけでは機能しませんか?私はまだタイトルを投稿して変更しています。スクリプトのアスタリスクがディレクトリの内容をダンプするのはなぜですか?このようなことには安全上の危険はありませんか?

> root@KaliTestBox:~/Desktop/dns1# echo $(whois 13.66.39.88 |head -n 40 |tail -n 28 |tr '\n' ' ')

NetRange: 13.64.0.0 - 13.107.255.255 CIDR: 13.96.0.0/13, 13.104.0.0/14, 13.64.0.0/11 NetName: MSFT NetHandle: NET-13-64-0-0-1 Parent: NET13 (NET-13-0-0-0-0) NetType: Direct Assignment OriginAS: Organization: Microsoft Corporation (MSFT) RegDate: 2015-03-26 Updated: 2015-03-26 Ref: https://rdap.arin.net/registry/ip/13.64.0.0 OrgName: Microsoft Corporation OrgId: MSFT Address: One Microsoft Way City: Redmond StateProv: WA PostalCode: 98052 Country: US RegDate: 1998-07-09 Updated: 2017-01-28 Comment: To report suspected security issues specific to traffic emanating from Microsoft online services, including the distribution of malicious content or other illicit or illegal material through a Microsoft online service, please submit reports to: Comment: **Akamai Akamai1 Akamai DNS.rtf Akamai_hosts_4-30.txt Akamai_hosts_cleaned complete-domainlist-4-30.txt dns2 dnschecker.sh dnsCSV dnsCSV1 dnsCSV.7z dnsCSVexternal dnsCSVfail DNS Exp1.7z dnsExport2.7z dnsExternal1.txt dnslist1 dnslistProd DNSlist.txt exeternalNmap1.txt externalNmapOutput externalNmapProd ipsExternal1.txt ipsExternal2.txt LVSIDEV.txt LVSIP.txt LVSIRED.txt LVS.txt LV_Website_Management.xlsx MarkMon_12-27-2018.xls prodAkamai1Url prodAkamaiUrl1 rvCSV rvCSVerror rvdns.sh test test1 test2 test3 test4 test5 test6 test7 whoischeck.sh whoisCSV whoisCSV3-25** https://cert.microsoft.com. Comment: Comment: For SPAM and other abuse issues, such as Microsoft Accounts, please contact: Comment: **Akamai Akamai1 Akamai DNS.rtf Akamai_hosts_4-30.txt Akamai_hosts_cleaned complete-domainlist-4-30.txt dns2 dnschecker.sh dnsCSV dnsCSV1 dnsCSV.7z dnsCSVexternal dnsCSVfail DNS Exp1.7z dnsExport2.7z dnsExternal1.txt dnslist1 dnslistProd DNSlist.txt exeternalNmap1.txt externalNmapOutput externalNmapProd ipsExternal1.txt ipsExternal2.txt LVSIDEV.txt LVSIP.txt LVSIRED.txt LVS.txt LV_Website_Management.xlsx MarkMon_12-27-2018.xls prodAkamai1Url prodAkamaiUrl1 rvCSV rvCSVerror rvdns.sh test test1 test2 test3 test4 test5 test6 test7 whoischeck.sh whoisCSV whoisCSV3-25** [email protected].

ドメイン名クエリ出力:

#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/resources/registry/whois/tou/
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
#
# Copyright 1997-2019, American Registry for Internet Numbers, Ltd.
#


NetRange:       13.64.0.0 - 13.107.255.255
CIDR:           13.104.0.0/14, 13.64.0.0/11, 13.96.0.0/13
NetName:        MSFT
NetHandle:      NET-13-64-0-0-1
Parent:         NET13 (NET-13-0-0-0-0)
NetType:        Direct Assignment
OriginAS:       
Organization:   Microsoft Corporation (MSFT)
RegDate:        2015-03-26
Updated:        2015-03-26
Ref:            https://rdap.arin.net/registry/ip/13.64.0.0



OrgName:        Microsoft Corporation
OrgId:          MSFT
Address:        One Microsoft Way
City:           Redmond
StateProv:      WA
PostalCode:     98052
Country:        US
RegDate:        1998-07-09
Updated:        2017-01-28
Comment:        To report suspected security issues specific to traffic emanating from Microsoft online services, including the distribution of malicious content or other illicit or illegal material through a Microsoft online service, please submit reports to:
Comment:        * https://cert.microsoft.com.  
Comment:        
Comment:        For SPAM and other abuse issues, such as Microsoft Accounts, please contact:
Comment:        * [email protected].  
Comment:        
Comment:        To report security vulnerabilities in Microsoft products and services, please contact:
Comment:        * [email protected].  
Comment:        
Comment:        For legal and law enforcement-related requests, please contact:
Comment:        * [email protected]
Comment:        
Comment:        For routing, peering or DNS issues, please 
Comment:        contact:
Comment:        * [email protected]
Ref:            https://rdap.arin.net/registry/entity/MSFT


OrgAbuseHandle: MAC74-ARIN
OrgAbuseName:   Microsoft Abuse Contact
OrgAbusePhone:  +1-425-882-8080 
OrgAbuseEmail:  [email protected]
OrgAbuseRef:    https://rdap.arin.net/registry/entity/MAC74-ARIN

OrgTechHandle: MRPD-ARIN
OrgTechName:   Microsoft Routing, Peering, and DNS
OrgTechPhone:  +1-425-882-8080 
OrgTechEmail:  [email protected]
OrgTechRef:    https://rdap.arin.net/registry/entity/MRPD-ARIN


#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/resources/registry/whois/tou/
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
#
# Copyright 1997-2019, American Registry for Internet Numbers, Ltd.

ベストアンサー1

echo $(somecommand)出力を見る必要はありませんsomecommand。必要なだけでsomecommand十分です。通常、他のコマンドの出力を表示するためには使用されず、echoここでは必要ありません。

あなたの場合でも起こるのは、$(...)引用符なしでコマンド置換(ビット)を使用していることです。これにより、次の2つのことが発生します。

  1. シェルは拡張結果(パイプの出力)を次に分割します。性格内容に基づいています$IFS。デフォルトでは、これはスペースで区切られた各文字列が単語になることを意味します。

  2. トークン化ステップで生成された各単語は、ファイル名の生成(「globbing」)を経ます。これは、たとえば、単語が有効なファイル名パターンである場合*(出力で複数回発生する場合whois)、シェルはそれをファイルシステムで使用可能なファイル名と一致させようとすることを意味します。

つまり、以前と同じ効果が得られます。

echo *

しかし、ここで重要なのは、echoパイプの出力をまったく見る必要がないということです。ただ削除しechoてください$(...)

whois 13.66.39.88 | head -n 40 | tail -n 28 | tr '\n' ' '

おすすめ記事