kali linux 渗透技术学习笔记 2.信息收集——测试网络范围

测试网络范围

通过测试网络范围内地IP地址或域名,可以确定是否有人入侵自己的网络并损害系统。kali提供了DMitry和Scapy工具 ,DMitry工具用来查询目标网络中的IP地址或域名信息Scapy用来扫描网络及修谈数据包。


域名查询工具 

DMitry

DMitry是一个用来查询IP或域名WHOIS信息的。WHOIS是用来查询域名是否已经被注册以及注册域名的详细信息的数据库。使用此工具可以查询到域名的注册商和过期时间等。

官方用途说明:

DMitry(Deepmagic信息收集工具)是用C编码的UNIX /(GNU)Linux命令行应用程序.DMitry能够收集尽可能多的关于主机的信息。基本功能可以收集可能的子域,电子邮件地址,正常运行时间信息,tcp端口扫描,whois查找等。

以下是当前功能的列表:

  • 一个开源项目。
  • 执行Internet编号whois查找。
  • 检索可能的正常运行时间数据,系统和服务器数据。
  • 在目标主机上执行子域搜索。
  • 在目标主机上执行电子邮件地址搜索。
  • 在主机目标上执行TCP端口扫描。
  • 模块化程序,允许用户指定的模块

来源:https://tools.kali.org/information-gathering/dmitry

实例:dmitry -wnpb baidu.com; dmitry -wnpb rzchina.net 这里我做了两个个实验

fxy@kali ~                                                                                                                                                                                              [19:25:25] 
> $ dmitry -wnpb baidu.com                                                                                                                                                                                        
Deepmagic Information Gathering Tool
"There be some deep magic going on"

HostIP:220.181.57.216 //主机IP
HostName:baidu.com    //主机名

Gathered Inic-whois information for baidu.com
---------------------------------
   Domain Name: BAIDU.COM                            //域名
   Registry Domain ID: 11181110_DOMAIN_COM-VRSN      //注册域名ID
   Registrar WHOIS Server: whois.markmonitor.com     //注册商WHOIS服务器
   Registrar URL: http://www.markmonitor.com         //注册商网址
   Updated Date: 2019-01-25T04:08:55Z                //更新时间
   Creation Date: 1999-10-11T11:05:17Z               //注册时间
   Registry Expiry Date: 2026-10-11T11:05:17Z        //到期时间
   Registrar: MarkMonitor Inc.                       //注册商
   Registrar IANA ID: 292                          //注册商IANA(互联网号码分配局) ID
   Registrar Abuse Contact Email: abusecomplaints@markmonitor.com //注册商e-mail
   Registrar Abuse Contact Phone: +1.2083895740                //注册商电话
   Domain Status: clientDeleteProhibited              //域状态 禁止删除客户端https://icann.org/epp#clientDeleteProhibited
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
   Domain Status: serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited
   Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited
   Domain Status: serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited
   Name Server: NS1.BAIDU.COM       //名称服务器
   Name Server: NS2.BAIDU.COM
   Name Server: NS3.BAIDU.COM
   Name Server: NS4.BAIDU.COM
   Name Server: NS7.BAIDU.COM
   DNSSEC: unsigned          //域名系统安全扩展
   URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2019-04-12T11:26:15Z <<<

××× 这里是关于whois的更多提示内容,省略×××

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.

Gathered Netcraft information for baidu.com
---------------------------------

Retrieving Netcraft.com information for baidu.com
Netcraft.com Information gathered

Gathered TCP Port information for 220.181.57.216
---------------------------------

 Port		State

80/tcp		open            //查到的部分端口信息

Portscan Finished: Scanned 150 ports, 69 ports were in state closed


All scans completed, exiting
fxy@kali ~                                                                                                                                                                                              [19:31:08] 
> $ dmitry -wnpb rzchina.net                                                                                                                                                                                      
Deepmagic Information Gathering Tool
"There be some deep magic going on"

HostIP:180.178.61.83
HostName:rzchina.net

Gathered Inic-whois information for rzchina.net
---------------------------------
   Domain Name: RZCHINA.NET
   Registry Domain ID: 965877923_DOMAIN_NET-VRSN
   Registrar WHOIS Server: whois.bizcn.com
   Registrar URL: http://www.bizcn.com
   Updated Date: 2017-05-02T01:50:14Z
   Creation Date: 2007-05-09T10:08:08Z
   Registry Expiry Date: 2019-05-09T10:08:08Z
   Registrar: Bizcn.com, Inc.
   Registrar IANA ID: 471
   Registrar Abuse Contact Email:
   Registrar Abuse Contact Phone:
   Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Name Server: DNS1.BIZMOTO.COM
   Name Server: DNS2.BIZMOTO.COM
   DNSSEC: unsigned
   URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2019-04-12T11:31:17Z <<<

---------------------------------

Retrieving Netcraft.com information for rzchina.net
Netcraft.com Information gathered

Gathered TCP Port information for 180.178.61.83
---------------------------------

 Port		State

21/tcp		open
>> 220 Welcome

22/tcp		open
>> SSH-2.0-OpenSSH_4.3

80/tcp		open

Portscan Finished: Scanned 150 ports, 141 ports were in state closed


All scans completed, exiting
常用选项
-w进行域whois查找
-n检查netcraft信息
-p进行tcp端口扫描
-b读入从扫描端口收到的横幅

官方提供完整选项:

dmitry:无效选项 - 'h' 
用法:dmitry [-winsepfb] [-t 0-9] [-o%host .txt] host 
-o 将输出保存到%host.txt或由-o file指定的文件
-i 对主机的IP地址
-w 对主机的域名执行whois查找
-n 检索主机上的Netcraft.com信息
-s 执行可能的子域搜索
-e 执行搜索可能的电子邮件地址
-p 在主机上执行TCP端口扫描
* -f 在主机上执行TCP端口扫描,显示输出报告过滤端口
* -b读入从扫描端口收到的横幅
* -t 0-9设置扫描TCP端口时的TTL(默认值为2)*需要-p标记为传递

虽然DMitry可以获得IP或域名信息,但是不能判断网络范围,所以可以将IP地址转换为子网掩码的格式、CIDR格式和思科反向子网掩码的格式等。kali中使用netmask可以进行转换。

实例:netmask -s 220.181.57.216 上文获取的

fxy@kali ~/文档/txt                                                                                                                                                                                       [20:03:32] 
> $ netmask -s 220.181.57.216                                                                                                                                                                                     
 220.181.57.216/255.255.255.255
fxy@kali ~/文档/txt                                                                                                                                                                                       [19:57:53] 
> $ netmask -h                                                                                                                                                                                                    
This is netmask, an address netmask generation utility
Usage: netmask spec [spec ...]
  -h, --help			Print a summary of the options
  -v, --version			Print the version number
  -d, --debug			Print status/progress information
  -s, --standard		Output address/netmask pairs
  -c, --cidr			Output CIDR format address lists
  -i, --cisco			Output Cisco style address lists
  -r, --range			Output ip address ranges
  -x, --hex			Output address/netmask pairs in hex
  -o, --octal			Output address/netmask pairs in octal
  -b, --binary			Output address/netmask pairs in binary
  -n, --nodns			Disable DNS lookups for addresses
  -f, --files			Treat arguments as input files
Definitions:
  a spec can be any of:
    address
    address:address
    address:+address
    address/mask
  an address can be any of:
    N		decimal number
    0N		octal number
    0xN		hex number
    N.N.N.N	dotted quad
    hostname	dns domain name
  a mask is the number of bits set to one from the left

 

 


路由跟踪工具

Scapy

Scapy是一款强大的交互式数据包处理工具、数据包生成工具、网络扫描器、网络发现工具和包嗅探工具。他提供多种类别的生成数据包或数据包集合、对数据包进行操作、发送数据包、包嗅探、应答、反馈匹配等功能。

这里以使用Scapy实现多行并行跟踪路由功能为例:

必须用root权限打开才可以正常使用,如果出于安全性使用非root用户登录的话可以 sudo scapy或采取下面链接给出的意见:https://stackoverflow.com/questions/22421290/scapy-operation-not-permitted-when-sending-packets

(1)启用scapy

 (2) 使用sr()函数实现发送和接收数据包。

(3) 使用表的形式查看数据包

(4) 查看TCP路由跟踪信息

可以单独查找,也可以查找一个列表,其中SA表示服务区。

(5) 使用res.graph()以图形显示路由跟踪结果

这里当使用scapy 2.4版本的时候可能报错所以只需使用语句:res.graph(ASres=AS_resolver_radb() ,type="svg") 或 res.graph(target="> /home/root/图片/graph.svg", ASres=AS_resolver_radb() ,type="svg")来代替res.graph()即可

res.trace3D()可以制作3d图片,不过需要vpython的支持

(6) exit()退出


博主还在学习kali的相关内容,如有错误,还请各位指出,谢谢支持。 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值