博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PHP版本MS17-010检测小脚本
阅读量:6351 次
发布时间:2019-06-22

本文共 4857 字,大约阅读时间需要 16 分钟。

内网渗透的时候有点用处,可以检测MS17-010的漏洞并获取操作系统信息,配合BURP可批量检测,纯socket发包,无需其他扩展。

[+] Vulnerability!'; }else{ echo '[-] No Vulnerability!'; } echo '
[+] OS: '.smbos($host,445)."
";}function get_tree_connect_request($ip,$tree_id){ $ipc='005c5c'.bin2hex($ip).'5c49504324003f3f3f3f3f00'; $ipc_len_hex=bin2hex(pack('s',strlen($ipc)/2)); $data='ff534d4275000000001801280000000000000000000000000000729c'.$tree_id.'c4e104ff00000000000100'.$ipc_len_hex.$ipc; $tree='000000'.bin2hex(pack('s',strlen($data)/2)).$data; $data5=pack('H*',$tree); return $data5;}function ms17010($host,$port){ $tcp='tcp://'.$host.':'.$port; $sock=stream_socket_client($tcp,$errno, $errstr, 3,STREAM_CLIENT_CONNECT); if ($sock){ $data1=pack('H*','00000054ff534d4272000000001801280000000000000000000000000000729c0000c4e1003100024c414e4d414e312e3000024c4d312e325830303200024e54204c414e4d414e20312e3000024e54204c4d20302e313200'); fwrite($sock,$data1); fread($sock, 1024); $data2=pack('H*','0000008fff534d4273000000001801280000000000000000000000000000729c0000c4e10cff000000dfff0200010000000000310000000000d400008054004e544c4d5353500001000000050208a2010001002000000010001000210000002e3431426c7441314e505974624955473057696e646f7773203230303020323139350057696e646f7773203230303020352e3000'); fwrite($sock,$data2); $data2_data=fread($sock, 1024); $user_id=substr(bin2hex($data2_data),64,4); $data3=pack('H*','00000150ff534d4273000000001801280000000000000000000000000000729c'.$user_id.'c4e10cff000000dfff0200010000000000f200000000005cd0008015014e544c4d53535000030000001800180040000000780078005800000002000200d000000000000000d200000020002000d200000000000000f2000000050208a2ec893eacfc70bba9afefe94ef78908d37597e0202fd6177c0dfa65ed233b731faf86b02110137dc50101000000000000004724eed7b8d2017597e0202fd6177c0000000002000a0056004b002d005000430001000a0056004b002d005000430004000a0056004b002d005000430003000a0056004b002d00500043000700080036494bf1d7b8d20100000000000000002e003400310042006c007400410031004e005000590074006200490055004700300057696e646f7773203230303020323139350057696e646f7773203230303020352e3000'); fwrite($sock,$data3); fread($sock, 1024); $data4=pack('H*','00000063ff534d4273000000001801200000000000000000000000000000729c0000c4e10dff000000dfff02000100000000000000000000000000400000002600002e0057696e646f7773203230303020323139350057696e646f7773203230303020352e3000'); fwrite($sock,$data4); $data4_data=fread($sock, 1024); $newuser_id=substr(bin2hex($data4_data),64,4); $data5=get_tree_connect_request($host,$newuser_id); fwrite($sock,$data5); fread($sock, 1024); $poc=pack('H*','0000004aff534d422500000000180128000000000000000000000000'.$user_id.'729c'.$newuser_id.'c4e11000000000ffffffff0000000000000000000000004a0000004a0002002300000007005c504950455c00'); fwrite($sock,$poc); $poc_data=fread($sock, 1024); if(substr(bin2hex($poc_data),18,8) == '050200c0'){ return true; }else{ return false; } }}function smbos($host,$port){ $tcp='tcp://'.$host.':'.$port; $sock=stream_socket_client($tcp,$errno, $errstr, 3,STREAM_CLIENT_CONNECT); if ($sock){ $payload1=pack('H*','00000085ff534d4272000000001853c80000000000000000000000000000fffe00000000006200025043204e4554574f524b2050524f4752414d20312e3000024c414e4d414e312e30000257696e646f777320666f7220576f726b67726f75707320332e316100024c4d312e325830303200024c414e4d414e322e3100024e54204c4d20302e313200'); $payload2=pack('H*','0000010aff534d4273000000001807c80000000000000000000000000000fffe000040000cff000a01044132000000000000004a0000000000d40000a0cf00604806062b0601050502a03e303ca00e300c060a2b06010401823702020aa22a04284e544c4d5353500001000000078208a2000000000000000000000000000000000502ce0e0000000f00570069006e0064006f0077007300200053006500720076006500720020003200300030003300200033003700390030002000530065007200760069006300650020005000610063006b002000320000000000570069006e0064006f0077007300200053006500720076006500720020003200300030003300200035002e00320000000000'); fwrite($sock,$payload1); $out1=fread($sock, 1024); fwrite($sock,$payload2); $out2=fread($sock, 1024); $blob_len_arr=unpack('s',substr($out2,36+7,2)); $osarr=explode(chr(0),iconv('UTF-16LE','UTF-8',substr($out2,36+11+$blob_len_arr[1]))); return $osarr[0].'|'.$osarr[1]; }}?>

用法很简单:

贴张图:

转载于:https://www.cnblogs.com/hookjoy/p/8137917.html

你可能感兴趣的文章
Jersey+mybatis实现web项目第一篇
查看>>
C++形参中const char * 与 char * 的区别
查看>>
espresso 2.0.4 Apple Xcode 4.4.1 coteditor 价格
查看>>
Object-C中emoji与json的问题
查看>>
一、Lambda表达式
查看>>
linux 命令
查看>>
大二下周总结四
查看>>
转 常见视频编码方式以及封装格式
查看>>
灾后重建
查看>>
Nothing 和 Is
查看>>
第一个sprint冲刺第三天
查看>>
cocos creator 底部按钮touch延迟
查看>>
vue中的input使用e.target.value赋值的问题
查看>>
数据库跨库访问问题
查看>>
关于FindComponent的使用,简化一些过程
查看>>
jq动态生成数据后绑定事件
查看>>
||和 && 符号的赋值运用(转)
查看>>
post提交返回json格式
查看>>
Java.lang 包中的Void类型
查看>>
正确理解linux grep 的姿势
查看>>