首页 > Web开发 > 详细

Penetration Test - Using_Scripting_in_Pen_Testing(4)

时间:2020-12-05 22:38:33      阅读:30      评论:0      收藏:0      [点我收藏+]

PowerShell scripts

Run PowerShell on Windows as a administrator. And set the execution policy.

Set-ExecutionPolicy Unrestricted

技术分享图片

Following is a simple PowerShell script to scan ports.

$port = 80
$subnet = "10.0.0"
$range = 1..254
foreach ($r in $range)
{
$ip = "{0}.{1}" -F $subnet,$r
if(Test-Connection -BufferSize 32 -Count 1 -Quiet -ComputerName $ip)
  {
    $socket = new-object System.Net.Sockets.TcpClient($ip, $port)
    if($socket.Connected)
      {
        "$port open on $ip"
        $socket.Close()
      }
  }
}

技术分享图片

QUICK REVIEW
  • PowerShell is currently open source and available for multiple operating systems.
  • PowerShell scripts are disabled in Windows by default

Penetration Test - Using_Scripting_in_Pen_Testing(4)

原文:https://www.cnblogs.com/keepmoving1113/p/14090769.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!