Skip to content

Instantly share code, notes, and snippets.

@aliaspooryorik
aliaspooryorik / go-example1
Last active August 18, 2017 17:19
Go : Example 1
package main
import (
"fmt"
)
func main() {
text := `The quick brown fox jumps over the lazy dog`
vowels, spaces, constants := 0, 0, 0
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/momentjs/2.14.1/moment-with-locales.min.js"></script>
<script src="https://cdn.jsdelivr.net/momentjs/2.14.1/locales.min.js"></script>
@aliaspooryorik
aliaspooryorik / gist:9e23bd0ce7392bf1caa32d3a78110f9e
Created September 27, 2017 14:49
Parse datetime strings in ACF using Java 8
<cfscript>
s = "2017-08-17T14:34:46.260-0400";
//x = parsedateTime("2017-08-17T14:34:46.260-0400", "pop" ) ;
DateTimeFormatter = createObject("java", "java.time.format.DateTimeFormatter");
parseFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
LocalDateTime = createObject("java", "java.time.LocalDateTime");
dateTime = LocalDateTime.from(parseFormat.parse(s));
@aliaspooryorik
aliaspooryorik / callStackGet.cfm
Created January 11, 2018 15:03
callStackGet - stolen from Ryan Guill
private function expect (required any testValue, required any targetValue, string message = "") {
arguments.message &= "<br /> expected [" & encodeForHtml(toString(arguments.targetValue)) & "] <br /> but received [" & encodeForHtml(toString(testValue)) & "] <br />";
if (arguments.testValue != arguments.targetValue) {
var cs = callStackGet();
var lineRef = "";
for (var line in cs) {
if (structKeyExists(line, "Function") && line["Function"] == getFunctionCalledName()) {
continue;
}
public class MyClass {
public static void main(String args[]) {
int x=10;
for (int i=0; i != 100; i++) {
int a = x+i;
}
System.out.println("X is = " + x);
System.out.println("A is = " + a);
<SAMLResponse>
<Issuer>https://idp.com/</Issuer>
<Assertion ID="_id1234">
<Subject>
<NameID>[email protected]<!---->.evil.com</NameID>
</Subject>
</Assertion>
<Signature>
<SignedInfo>
<CanonicalizationMethod Algorithm="xml-c14n11"/>
@aliaspooryorik
aliaspooryorik / EvilSAMLCheck.cfm
Last active March 21, 2018 14:35
EvilSAMLCheck
<!---
SEE: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations
Testing if SAML comment injection can be used to chnage XmlText without changing the signature
--->
<cfhttp url="https://gist.githubusercontent.com/aliaspooryorik/5c72724d5c3614f5e31d10d47dd3e52f/raw/be3631a275fcdfcc1dc882bdeeeb947118e19268/EvilSAMLtest.xml" result="saml"></cfhttp>
<cfset xml = XmlParse(saml.filecontent)>
<cfdump var="#XmlSearch(xml, "SAMLResponse/Assertion/Subject/NameID")#">
@aliaspooryorik
aliaspooryorik / EvilSAMLTest2.xml
Created March 21, 2018 14:11
EvilSAMLTest2.xml
<SAMLResponse>
<Issuer>https://idp.com/</Issuer>
<Assertion ID="_id1234">
<Subject>
<NameID>[email protected]<!--hack-->.evil.com</NameID>
</Subject>
</Assertion>
<Signature>
<SignedInfo>
<CanonicalizationMethod Algorithm="xml-c14n11"/>
@aliaspooryorik
aliaspooryorik / humaniseSeconds.cfm
Last active April 12, 2018 14:02
humaniseSeconds
<cfscript>
// Kudos to Jamie Purchase
function humaniseSeconds(seconds) {
var result = [];
var parts = createObject("java", "java.util.LinkedHashMap").init();
parts["week"] = (3600 * 24) * 7;
parts["day"] = (3600 * 24);
parts["hour"] = 60 * 60;
parts["minute"] = 60;
@aliaspooryorik
aliaspooryorik / queryreduce.cfm
Last active April 13, 2018 13:10
query group count
<cfscript>
foo = queryNew(
"id,name,group",
"Integer,Varchar,varchar",
[
[1,"One", "A"],
[2,"Two", "A"],
[3,"Three", "B"],
[4,"Four", "C"],