只有更深入的了解PowerShell基础及用法,才能更好地检测恶意代码
一.Powershell初识
1.基础概念
2.为什么强大?
3.控制台和快捷键
4.数学运算
二.Powershell管道和重定向
1.管道
2.重定向
三.Powershell执行外部命令及命令集
1.外部命令
2.命令集
四.Powershell别名使用
1.别名基本用法
2.自定义别名
五.Powershell变量基础
1.基础用法
2.变量操作
3.自动化变量
4.环境变量
六.Powershell调用脚本程序
1.脚本文件执行策略
2.调用脚本程序
七.总结
作者的github资源:
逆向分析:
https://github.com/eastmountyxz/
SystemSecurity-ReverseAnalysis
网络安全:
https://github.com/eastmountyxz/
NetworkSecuritySelf-study
$psversiontableget-service清楚命令的历史记录PgUp PgDn 翻页Enter 执行当前命令End 将光标移动至当前命令的末尾Del 从右开始删除输入的命令字符Esc 清空当前命令行F2 自动补充历史命令至指定字符处F4 删除命令行至光标右边指定字符处F7 对话框显示命令行历史记录F8 检索包含指定字符的命令行历史记录F9 根据命令行的历史记录编号选择命令,历史记录编号可以通过F7查看左右移动光标切换命令行的历史记录Home 光标移至命令行字符最左端Backspace 从右删除命令行字符取消正在执行的命令Tab 自动补齐命令或文件名
PS C:\Users\yxz> 2+46PS C:\Users\yxz> 4-22PS C:\Users\yxz> 4*312PS C:\Users\yxz> 9%21PS C:\Users\yxz> (1+3*5)/28PS C:\Users\yxz> 1gb/1mb1024PS C:\Users\yxz> 1gb/1mb*18kb18874368PS C:\Users\yxz> 1gb -gt 1mbTruePS C:\Users\yxz> 0xabcd43981
linux:lscmd:dir
ls | format-table name, models | format-table name, mode > demo.txttype demo.txt
netstat -anoipconfigroute printstart notepadnotepad
$env:pathget-commandget-help get-commandget-processget-aliasget-historyget-dateget-commandgcm
get-childitemlsdir
get-help get-childitemget-alias -name lsget-alias -name dir
get-alias | where{$_.definition.startswith("Remove")}get-alias | group-object definition | sort -descending Countset-alias -name pad -value notepaddel alias:padexport-alias demo.psdirtype demo.ps
import-alias -force demo.ps$name='eastmount'$name$age=28$age
{"I am a" var ()}="yxz"{"I am a" var ()}n=(7*6+8)/2n=3.14
$n=ls$n1=$n2=$n3=25$n1,$n2,$n3
$a=2$b=10$c=a+b$a,$b,$c
$num1=10$num2=20$temp=$num1$num1=$num2$num2=$temp$num1,$num2
$num1=10$num2=20$num1,$num2=$num2,$num1$num1,$num2
ls variable:ls variable:num*ls variable:num1
test-path variable:num1test-path variable:num0
del variable:num1test-path variable:num1
clear-variableremove-variablenew-variable
$homepid$
ls env:$env:windir$env:name='eastmount'ls env:na*
del env:namels env:na*
$env:OS$env:OS="Linux"$env:OS
[environment]::setenvironmentvariable("PATH","E:\","User")[environment]::getenvironmentvariable("PATH","User")
get-executionpolicyget-help set-executionpolicyset-executionpolicy RemoteSigned@echo offecho hello world
cd desktop.\demo.bat
msgbox "CSDN Eastmount"cd desktop.\demo.vbs
$number=49switch($number){{($_ -lt 50) -and ($_ -gt 40)} {"此数值大于50且小于40"}50 {"此数值等于50"}{$_ -gt 50} {"此数值大于50"}}
@echo offpowershell "&'C:\Users\yxz\Desktop\demo.ps1'"
cd desktop.\demo.bat
start demo.batdemo.bat
一.Powershell初识
二.Powershell管道和重定向
三.Powershell执行外部命令及命令集
四.Powershell别名使用
五.Powershell变量基础
六.Powershell调用脚本程序
[1] https://www.bilibili.com/video/av66327436 [推荐B站老师视频]
[2]《安全之路Web渗透技术及实战案例解析》陈小兵老师
[3] https://baike.baidu.com/item/Windows Power Shell/693789
[4] https://www.pstips.net/powershell-piping-and-routing.html
[5] https://www.pstips.net/using-the-powershell-pipeline.html
[6] 微软官方PowerShell文档
前文回顾(下面的超链接可以点击喔):
[系统安全] 四十.Powershell恶意代码检测系列 (1)Powershell基础入门及管道和变量的用法