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”运行两次吗?我不明白。实际的 whois 位于其下方。

编辑:看看这个,它与 * 有关,但是仅仅放入命令行中不起作用?我仍在发布并更改标题:为什么脚本中的星号会转储目录内容?这种事情难道不存在安全隐患吗?

> 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查看其他命令的输出,这里也不需要它。

在您的情况下还发生的情况是您正在使用$(...)不带引号的命令替换(位)。当你这样做时,会发生两件事:

  1. shell 将扩展的结果(管道的输出)拆分为根据 的内容$IFS。默认情况下,这意味着每个以空格分隔的字符串将成为一个单词。

  2. 在分词阶段生成的每个单词都会经历文件名生成(“globbing”)。这意味着如果某个单词是有效的文件名模式,例如*(在输出中出现多次whois),那么 shell 将尝试将其与文件系统中可用的文件名进行匹配。

这意味着您将获得与之前相同的效果

echo *

但这里的要点是您echo根本不需要查看管道的输出。只需删除echo$(...)

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

相关内容