# 安装Docker部分(略)
# 更新docker源为中国国内源。
在/etc/docker下编辑或新建daemon.json:
vi /etc/docker/daemon.json
添加内容:
{
"registry-mirrors": [
"https://kfwkfulq.mirror.aliyuncs.com",
"https://2lqq34jg.mirror.aliyuncs.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"
],
"dns": ["114.114.114.114","8.8.8.8"]
}
# 拉取Docker Kali镜像
docker pull kalilinux/kali-linux-docker
PS:遇到报错
Error response from daemon: pull access denied for kalilinux/kali-linux-docker, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
解决方案,添加和修改了daemon.json文件的加速器后,需要重启docker服务
service docker restart
# 创建kali容器
docker run -id -v /data_backup/kali_linux/_data:/root --restart=always --name=kali2020 -p 2222:22 -p 4444:4500 a1765e8e381e
-v 指定家目录让一些想保留的数据存储在本地目录下
-p 映射kali22端口到外面的2222
4500端口(用于shell 反弹Metasploit)
最后一串是images的名字
# 修改root口令
password root
# 备份及替换本地源
cp /etc/apt/sources.list{,.bak}
>> 加入下面信息(选择一个适合你的即可,我这里用的阿里云)
# 中科大
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
# 阿里云
deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
# 清华大学
deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
# 163
deb http://mirrors.163.com/debian wheezy main non-free contrib
deb-src http://mirrors.163.com/debian wheezy main non-free contrib
deb http://mirrors.163.com/debian wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.163.com/debian wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.163.com/debian-security wheezy/updates main non-free contrib
# 东软大学
deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
# 官方源
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
# 更新软件列表
apt-get update && apt-get upgrade
PS:如果没有执行上面这句,直接开始安装工具,就会有如下提示
E:Package 'Vim' has no installation candidate
# 安装常用工具
apt-get -y install vim git python net-tools openssh-server
# 修改ssh配置文件,允许root远程登陆
/etc/ssh/sshd_config
>> 修改如下内容
PermitRootLogin yes
PS: 这里建议利用物理机防火墙,限定死允许远程过来的IP主机地址。防止别人利用Root账号
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.X.X" port protocol="tcp" port="2222" accept"
firewall-cmd --list-rich-rule
# kali metasploit安装
apt-get install metasploit-framework
# 启动数据库
/etc/init.d/postgresql start; OR service postgresql start
# 数据库自启动
update-rc.d postgresql enable
# 初始化数据库
msfdb init
# 启动MSF
msfconsole OR msfconsole -q (静默启动,不显示logo)
msf中查看数据库连接状态:
db_status
【信息收集】
# 安装 dig nslookup whois 工具
apt-get install dnsutils whois
1. 区域传送
2. Netcraft工具 # 可以看到主机曾用IP地址和OS
3. Wayback回溯网页历史快照 # 回溯网站以前版本的静态副本
4. Google高级搜索选项
5.Recon-ng信息收集工具
>>> 创建工作台
recon-ng -w <名字>
>>> 安装模块
marketplace refresh # 更新模块列表
marketplace search hackertarget # 搜索 hackertarget 模块,可以发现支持模糊搜索
marketplace install recon/domains-hosts/hackertarget # 复制模块名,安装
>>> 加载模块
modules load recon/domains-hosts/hackertarget
[recon-ng][loki_test][hackertarget] > info # 查询模块基本信息
[recon-ng][loki_test][hackertarget] > options set SOURCE XXX.com # 设置选项参数
[recon-ng][loki_test][hackertarget] > run # 执行
[recon-ng][loki_test][hackertarget] > show hosts # 查看所有结果
>>> 清空表信息
db delete hosts x-x 删除表内id多少到多少条
6.Maltego # 可视化信息收集工具
参考资料:
https://www.secshi.com/40391.html