Skip to content

Instantly share code, notes, and snippets.

@EntityReborn
EntityReborn / Get-MsdnKeys.ps1
Created August 12, 2016 15:50 — forked from Jaykul/Get-MsdnKeys.ps1
PowerShell + Selenium Demo: Getting Started, and reusing cookies with Invoke-Request
# It might work in 4, but I'm not testing there. Lower you'll have to tweak code
#requires -Version 5.0
param(
# Your Live ID for MSDN login
[Parameter(Mandatory)]
[PSCredential]
[System.Management.Automation.CredentialAttribute()]
$Credential,
# Pick a browser to use. Defaults to Firefox (which doesn't seem to require an external Driver file)
. .\Config.ps1 # $username = 'blah'\n$password = 'blah'
Add-Type -Path .\WebDriver.dll
$msdn = 'https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=13&ct=1470967868&rver=6.7.6640.0&wp=mcmbi&wlcxt=msdn%24msdn%24msdn&wreply=https%3a%2f%2fmsdn.microsoft.com%2fen-us%2fsubscriptions%2fdownloads%2f&lc=1033&id=254354&mkt=en-us'
$driverService = [OpenQA.Selenium.PhantomJS.PhantomJSDriverService]::CreateDefaultService()
$driverService.HideCommandPromptWindow = true;
$selenium = [OpenQA.Selenium.PhantomJS.PhantomJSDriver]::new($driverService)
$selenium.Navigate().GoToUrl($msdn)
#!/bin/bash
#Guacamole 0.9.0 Installation Script
#Versioning Variables
guacamoleclientdownload = "http://sourceforge.net/projects/guacamole/files/current/binary/guacamole-0.9.0.war"
guacamoleserverdownload = "http://sourceforge.net/projects/guacamole/files/current/source/guacamole-server-0.9.0.tar.gz"
guacamoleservertar = "guacamole-server-0.9.0.tar.gz"
guacamoleserversource = "guacamole-server-0.9.0"
guacamoleclientwar = "guacamole-0.9.0.war"
[general]
name = CHAPI# human friendly name
modulefile = chapi.py# Actual module to import to load plugins
enabled = True

Developing an extension

Extensions provide a means of adding functionality to CommandHelper and the MethodScript engine. While the API used is under construction still, it is still deemed stable enough for production use. Any breakages will be minimal, and deprecation will be used where it applies.

An extension currently consists of three core parts:

  1. The lifecycle class, which takes care of the life and identity of the extension.
  2. Events, which add new events that MScript can use, and
  3. Functions, which add new functionality to MScript. These can make use of the optimization engine as well, to be integrated with the MScript compilation process.

Developing an extension

Extensions provide a means of adding functionality to CommandHelper and the MethodScript engine. While the API used is under construction still, it is still deemed stable enough for production use. Any breakages will be minimal, and deprecation will be used where it applies.

An extension currently consists of three core parts:

  1. The lifecycle class, which takes care of the life and identity of the extension.
  2. Events, which add new events that MScript can use, and
  3. Functions, which add new functionality to MScript. These can make use of the optimization engine as well, to be integrated with the MScript compilation process.
import _winreg
def DecodeKey(rpk):
rpkOffset = 52
i = 28
szPossibleChars = "BCDFGHJKMPQRTVWXY2346789"
szProductKey = ""
while i >= 0:
dwAccumulator = 0

#Example Extension/Extension Skeleton

This maven project is a sample extension layout that provides a basic framework, with all the proper checks in place as well as a few utilities to get you started. It is built with NetBeans and Maven in mind, although other configurations might be possible, with less functionality (compile time errors, etc).

##Usage ###Standalone use This method makes for a simpler way to get up and running, but requires you to clone the original repo for each project.

  1. Clone this repo from where it's hosted.
  2. Remove the .git folder. Can't skip this one!

##Event:

http_request

@event data:

headers: (assoc. array)
    name: (array)
        value, 

value,

body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {