Skip to content

Instantly share code, notes, and snippets.

James Moberg JamoCA

Block or report user

Report or block JamoCA

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JamoCA
JamoCA / Cliboard_to_SQL_Column_as_Tablename.ahk
Last active Aug 22, 2019
AutoHotKey script to prepends a prompted tablename variable to a list of SQL field names or variables from the clipboard.
View Cliboard_to_SQL_Column_as_Tablename.ahk
; 20190822 https://gamesover2600.tumblr.com/post/187192578144/sql-macros-using-autohotkey-windows
; CTRL+Q prepends a tablename to list of SQL field names or variables from the clipboard.
; (Copy the column names from a query and this script will remove extra spaces and prepend user-defined tablename to each column.)
^q::
InputBox, UserInput, Prepend Scope To List, Enter variable scope., ,300 ,125 , , , ,2147483, a
if ErrorLevel
RETURN
else
AutoTrim, on
string = %clipboard%
@JamoCA
JamoCA / Clipboard_to_SQL_List.ahk
Last active Aug 22, 2019
AutoHotKey script to convert a column of clipboard data (copied from Excel, Word, Outlook, text file, etc) to a SQL list for use in a IN() query.
View Clipboard_to_SQL_List.ahk
; 20190822 https://gamesover2600.tumblr.com/post/187192578144/sql-macros-using-autohotkey-windows
^+l:: ;CTRL+Shift+L Takes clipboard and converts tab-delimited data to SQL-compatible comma-delimited row (adds single quotes if data consists of non-numeric values)
StringReplace,clipboard,clipboard,`n,`,,All
StringReplace,clipboard,clipboard,`r,,All
StringGetPos, pos, clipboard, ID`, ; remove "ID" if it is the first item in the list.
if pos = 0
StringRight, clipboard, clipboard, StrLen(clipboard)-3
testString = %clipboard%
StringReplace,testString,testString,`,,,All
testString := testString * 1
@JamoCA
JamoCA / getPeerCertificates.cfm
Created Aug 17, 2019
Samples ColdFusion script to retrieve SSL certificate data to determine expiration date
View getPeerCertificates.cfm
<cfset HostToTest = "letsencrypt.org">
<cfset factory = CreateObject("java", "javax.net.ssl.HttpsURLConnection").getDefaultSSLSocketFactory()>
<cfset socket = factory.createSocket(HostToTest, JavaCast("int",443))>
<cfset socket.startHandshake()>
<cfset certs = socket.getSession().getPeerCertificates()>
<cfif IsArray(certs)>
<cfloop from="1" to="#ArrayLen(certs)#" index="i">
<cfset cert = certs[i]>
<cfoutput>
@JamoCA
JamoCA / worldhostingfarm.com.abuse.txt
Last active Aug 8, 2019
Spammy Feedback Form Abuse from worldhostingfarm.com IP Address
View worldhostingfarm.com.abuse.txt
As of 8/7/2019, I have logged 791 spammy solicitations sent to to my clients feedback forms using
these domains originating from an worldhostingfarm.com (Ireland) using IP address 185.234.219.246.
https://www.abuseipdb.com/check/185.234.219.246
business-capital-advisor.com
business-capital-advisors.com
business-funding-365.com
business-funds-365.com
businesscapital247.com
businesscapitaladvisor365.com
@JamoCA
JamoCA / isValidIPAddress_UDF.cfm
Last active Aug 6, 2019
ColdFusion UDF to test string to determine if valid IP address or not.
View isValidIPAddress_UDF.cfm
<!--- 20190801
ColdFusion UDF to test string to determine if valid IP address or not.
https://www.anujgakhar.com/2008/02/21/validate-ip-address-natively-with-coldfusion/ --->
<cfscript>
function isValidIPAddress(inputString){
var response = false;
var IPAddressUtils = createObject("java","coldfusion.util.IPAddressUtils");
response = javacast("boolean", IPAddressUtils.validateIPAdress( javacast("string", arguments.inputString) ));
if (response and listfind("0.0.0.0,255.255.255.255", javacast("string", arguments.inputString))){
@JamoCA
JamoCA / FutureDate.cfm
Last active Jul 22, 2019
During ColdFusion 2016 server-side date validation, invalidish futuristic years (ie, "star dates") were being identified as "valid dates".
View FutureDate.cfm
<!--- 2019-07-22
Blog Post
https://gamesover2600.tumblr.com/post/186477080549/coldfusion-dates-mdyyyyyyyyy
GitHub Gist
https://gist.github.com/JamoCA/01e14657a47846bb3aa7ca88295b8832
Try it at Trycf.com (or paste online at CFFiddle.org)
https://trycf.com/gist/01e14657a47846bb3aa7ca88295b8832
Reported as "crash/data loss" CF2016 bug to Adobe (7/22/2019 3:15 PM Pacific)
https://tracker.adobe.com/#/view/CF-4204879
--->
@JamoCA
JamoCA / Block-HTML5-Ping-Click-Tracking.cfm
Last active Jun 27, 2019
Blocking HTML5 Ping Requests using ColdFusion
View Block-HTML5-Ping-Click-Tracking.cfm
<!--- 20190627
Block/Track Ping HTTP Requests using ColdFusion
https://gist.github.com/JamoCA/916dbb2d0ca0fe30ca63120bcaccc20f
If you are not expecting or do not need to receive ping requests to your web server, block any
web requests that contain "Ping-To" and/or "Ping-From" HTTP headers on the edge devices (Firewall,
WAF, etc.). If you can't do that, you can still detect it in ColdFusion and abort prior to wasting
any resources processing the request further.
More info:
@JamoCA
JamoCA / Operator_ShortCut_error.cfm
Last active Jun 18, 2019
ColdFusion Operator Shortcut to Return Remainder throws error (depending on spacing)
View Operator_ShortCut_error.cfm
<!---
ColdFusion Operator Shortcut to Return Remainder throws error (depending on character spacing)
5/22/2019: Not sure where this came from; dated ~2017. Operator shortcut throws error in ColdFusion 2016/2018, but not CF10/11.)
Unsure if actually reported to Adobe, but this is when I tweeted it: https://twitter.com/gamesover/status/1131335207427149824
6/18/2019: Appears to be fixed in CF2018??? CF2016 is not end-of-core or end-of-life. Hopefully it gets fixed too.
NOTE: If you manually add spaces around the "%" operator, the error is resolved.
https://gist.github.com/JamoCA/2bd7d96af851df7648c661e97fceaac1
https://trycf.com/gist/2bd7d96af851df7648c661e97fceaac1/acf2016?theme=monokai
@JamoCA
JamoCA / Unicode_Email_URL.cfm
Last active Jun 18, 2019
Test to determine if unicode entered in either email or URL is "valid" when using ColdFusion.
View Unicode_Email_URL.cfm
<h1>ColdFusion Unicode Email/URL Validation Test</h1>
<p><b>Adobe Bug ID:</b> <a href="https://tracker.adobe.com/#/view/CF-4204516" rel="nofollow noopener noreferrer">CF-4204516</a><br>
<b>TryCF:</b> <a href="https://www.trycf.com/gist/4f9951753f2fe3ed79ef5d7945d2f926" rel="nofollow noopener noreferrer">Link</a><br>
<b>GIST:</b> <a href="https://gist.github.com/JamoCA/4f9951753f2fe3ed79ef5d7945d2f926" rel="nofollow noopener noreferrer">Link</a></p>
<cfscript>
function testJavaURL(u){
var response = true;
var test = {};
var jURL = CreateObject("java", "java.net.URL");
@JamoCA
JamoCA / normalizeUTF.cfc
Created Jun 14, 2019
ColdFusion script to normalize UTF characters by combining character sequences into a single character
View normalizeUTF.cfc
<cfscript>
/* NFKC: UTF Compatibility Decomposition, followed by Canonical Composition */
/* Recommend using Junidecode https://gist.github.com/JamoCA/6565bd4e2526b7c177a5f0cde3980d1c */
function normalizeUTF(inputString){
var normalizer = createObject( "java", "java.text.Normalizer" );
var normalizerForm = createObject( "java", "java.text.Normalizer$Form" );
return normalizer.normalize( javaCast( "string", arguments.inputString ), normalizerForm.NFKC );
}
</cfscript>
You can’t perform that action at this time.