Posts

Equifax Security Controls Framework

Equifax have kindly open-sources their Security Controls Framework.  You can access it here: https://controlsframework.equifax.com/home

Learning Platforms and Courses

 We all need to upskill, but that does not need to come with a hefty pricetag. Here are some great resources to give you training and certification: Open Universities Australia Class Central Google Digital Garage Khan Academy edx Academic Earth MIT

Powershell: Why does my Google Sheet formula have a leading single quote?

I was recently writing a simple Powershell script to automatically create data in Google Sheets. I used the excellent post from  James Chambers  to show me the details of the process. The code is simple enough  1. Import-Module UMN-Google 2. Use Set-GSheetData to populate the data It all works until the Hyperlinks I created were being rendered as strings, with leading single quotes. This means they look pretty awful and I dont intend to manually correct them. #defeatsthepurpose. The solution is to force the Set-GSheetData with  -valueInputOption "USER_ENTERED"  which then overrides the default behaviour of setting the values to a string. Simple when you know how.

CISM Exam Prep - Recommended Learning

 I recently (successfully) completed the CISM exam and its a bit of a monster. Here are a few of my takeaways from the experience: * Read the questions very carefully. This can be a (mental) challenge as the time goes by but I found it was the little things in the exam questions that made the difference. * Choose your most effective study technique. Some people like courses, some people like books. I like using sample exams and examing the answers to understand not only the correct answer, but also why the other options were wrong. I have found this approach highly effective over my 20+ certifications across Microsoft, Google, AWS and now ISACA. I used the following study material: https://www.udemy.com/course/certified-information-systems-security-professional-cissp-k (Paid) https://www.udemy.com/course/certified-information-security-manager-cism-tests/ (Paid) https://examposter.com/isaca/cism-certified-information-security-manager/cism-part-01/ (Free) https://www.itexams.com/exam...

JIRA Data Extract into Google Sheets through an API

function callJIRAPI() { // first, clear the sheet contents           var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet() var range = sheet.getRange("A1:G100"); range.clearContent(); // create the auth token for the API request to JIRA var pair = "firstname.lastname@mydomain.com:<My API Key from JIRA>" var base64 = Utilities.base64Encode(pair) var authHeader = "Basic " + base64 var url = "https://mydomain.atlassian.net/rest/api/3/search?jql=<JQL Query here>" // execute the query and parse the result as JSON var response = UrlFetchApp.fetch(url, { headers: { Authorization: authHeader, ContentType: 'application/json' } }); var dataSet = JSON.parse(response.getContentText()); // Create an array to store the results and push the column headers. These should match to the columns extracted below var rows = [] rows.push(["JiraID","CreatedBy","AssignedTo","Du...

Extract user details into Excel from JIRA API in Powershell

Function Get-JIRAExtract { Param( [Parameter( Mandatory=$true, HelpMessage="JIRA id of the user")] [string]$assigneeId, [Parameter( Mandatory=$true, HelpMessage="Name of user.")] [string]$assigneeName, [Parameter( Mandatory=$false, HelpMessage="Target Folder.")] [string]$targetFolder = "c:\temp2" ) try { $token = "xxx" $pair = "fname.lname@company.com:$token" $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair) $base64 = [System.Convert]::ToBase64String($bytes) $basicAuthValue = "Basic $base64" $headers = @{ Authorization = $basicAuthValue } $url = "https://mycompany.atlassian.net/rest/api/3/search?maxResults=1000&jql=assignee%20in%20($assigneeId)AND created >= -24w AND status in ('Complete', 'In Progress', 'Resolved', 'Closed')" Write-Host "Call url $url" $json = Invoke-RestMethod -Uri $url -Method Get -Headers $headers...

How can I call a JIRA api through Powershell?

 Navigate to https://id.atlassian.com/manage-profile/security/api-tokens and create an API token Then use the following code: $pair = "me@example.com:<My token here>" $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair) $base64 = [System.Convert]::ToBase64String($bytes) $basicAuthValue = "Basic $base64" $headers = @{ Authorization = $basicAuthValue } $json = Invoke-RestMethod -Uri "https://<mydomain>.atlassian.net/rest/api/3/search?jql= <jql here>" -Method Get -Headers $headers

How can I call OWASP ZAP from the command line?

 Adding Dynamic Application Security testing to your CI/CD pipeline can help you identify potential security threats earlier in the development cycle (did someone say 'Shift Left'?). There are many tools available to assist (SonarQube is very popular) but ZAP  (from our friends at OWASP) gives insight into common vulnerabilities. To execute it from a COMMAND line 1. install JAVA 2. download the solution from  here 3. navigate to your install folder on your drive (I used to the default "C:\Program Files\OWASP\Zed Proxy Attack"). 4. Release the hounds java -jar {YOUR ZAP VERSION} -cmd -quickurl {YOUR API TO QUERY} -quickprogress -quickout {FILE LOCATION TO STORE THE RESULTS} -nostdout My example is as follows: java -jar zap-2.11.0.jar -cmd -quickurl http://localhost/api/values -quickprogress -quickout "c:\temp\out.json" -nostdout

How do I add a custom background in Microsoft Teams?

 Teams has become one of the de-facto platforms for modern workplace communication. To personalize your virtual meeting space, copy your favourite image to %APPDATA%\Microsoft\Teams\Backgrounds\Uploads and relaunch Teams. Your images are now available for selection as backgrounds.

A quick way to create dummy text using MSWord

 While creating a sample page, I needed to populate some sample text quickly without using any documents from the office. I started random typing, but I quickly remembered the built in marcos in Word for just such a purpose. If you type in =lorem() and press enter, you get one line of Lorem Ipsum if you type in  =lorem(10) and press enter, you get 10 lines. If you prefer English to Latin, then type in  =rand(10) and press enter for 10 lines of 'random' text (not really random, but its text that is readable that I did not have to type) 

Confluence: How to create a 'DRAFT' watermark using CSS

Image
I added the following to my Confluence page: To do it, I put the following text in an HTML block at the top of the page: <style> .watermark {     opacity: 0.5;     color: BLACK;     position: fixed;     top: 45%;     left: 50%; font-size: 110px; font-weight: 100;     background: yellow; padding-left: 50px; padding-right: 50px; } .rotate {   transform: rotate(-45deg);   /* Legacy vendor prefixes that you probably don't need... */   /* Safari */   -webkit-transform: rotate(-45deg);   /* Firefox */   -moz-transform: rotate(-45deg);   /* IE */   -ms-transform: rotate(-45deg);   /* Opera */   -o-transform: rotate(-45deg);   /* Internet Explorer */   filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); } </style> <div class="watermark rotate ">Draft</div> It seems to work well across browser too.

Confluence: Buttons to toggle expander controls

While writing a simple page in Confluence, I used expander controls to help manage real estate. To help users, I added two buttons (expand all, collapse all) to enhance the user experience. After a little experimentation, I deceided to use the OOTB icons as the trigger for the logic. A simple piece of JavaScript to check for the "chevron right" class in the anchor controls, and process the logic accordingly. Here is the script (to be placed in an HTML control on the page) <script language="JavaScript"> function expandUI(isClosed) { var a = document.getElementsByClassName("expand-control");   var b = document.getElementsByClassName("expand-icon") for (let i = 0; i < a.length; i++){ if (b[i].classList.contains("aui-iconfont-chevron-right") == isClosed) { a[i].click(); } } } // make sure the page loads with the expanders expanded window.addEventListener("load", function(){ expandUI(true); }); ...

Developer Training for PCI Compliance

In my current role, I have been tasked with providing 'Developer Training' as part of our PCI Compliance Audit. The challenge with this task is finding a solution that is acceptable to the Auditor, but not cost prohibitive. Using an external training company is an easy way but its very expensive and does not help when new starters come on board. Another option is to provide internal training (did someone say WebGoat ?), but that can be a challenge with logistics and timing. The solution we eventually deceided on was creating a Quiz using Office 365 Forms, which was based on the OWASP Top 10 and OWASP Secure Coding Practices. Access is restricted to users within the organisation and the results cannot be tampered with. Its a simple, cost effective, extendable solution to an otherwise complicate problem. The next step is to create a suitable quiz to challenge a developers knowledge ........

PowerShell: How can I list/document all the items in my azure subscription?

The following script will create an Excel file with each Resource Group as a tab. First, I created a password file to reference from the script (no passwords in clear text please) "xxxx" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\Temp\Password.txt"  Here is the function - it will create seperate CSV files per resource group and then merge them intoa a single Excel file at the end. BTW, you may want to change the hard coded directories, username and filenames as required..... enjoy # create a function to merge the csv files we have created Function Merge-CSVFiles  {                  Param(                                  $CSVPath = "C:\csv\", ## Soruce CSV Folder                                ...

Visual Studio: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project

I encountered this issue when trying to compile some old code. I tried to download the SDK, but there are no active links. My resolution was to install Visual C++' support in Visual Studio 2015 by re-running the installer.​ Its like killing a fly with a hand-grenade (3GB install), but as least it resolved the problem.

IE11 - Critical Error: Object doesn't support property or method 'addEventListener'

Add this code within the body tag and all is good.  <script type="text/javascript">         /* IE11 Fix */         if (typeof (UserAgentInfo) != 'undefined' && !window.addEventListener) {             UserAgentInfo.strBrowser = 1;         }     </script>​

Backup-SPSite : You must specify a filename for the backup file.

I followed the backup instructions from  here  to backup my site collection but I encountered the following error: You must specify a filename for the backup file That was strange as I have set the -Path parameter. The resolution is that the path MUST BE VALID . In my case , I was missing an underscore.

SharePoint 2010: Unable to open Central Administration

I have been trying to install a SharePoint 2010 development environment on my local Windows 10 laptop (dont ask why) and I have finally been able to load Central Admin. Here are the issues I encountered: 1. Ensure you have Windows 10 Pro - you will need to activate Windows Auth before you install 2. Run the following script if Central Admin is start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ManagementScriptingTools;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibili...

SharePoint 2010 on Windows 10: Solving COMException / Unknown error (0x80005000)

Image
This is not a problem I expected to solve, but it happened anyway. A client is using SharePoint 2010 and I need a local development farm. I started with the usual configuration requirements: Add <Setting Id="AllowWindowsClientInstall" Value="True"/> to the Setup config Created a script to make a new configuration database so that I dont have to join a domain $secpasswd = ConvertTo-SecureString "MyVerySecurePassword" -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential ("mydomain\administrator", $secpasswd) $guid = [guid]::NewGuid(); $database = "spconfig_$guid" New-SPConfigurationDatabase -DatabaseName $database -DatabaseServer myservername\SharePoint -FarmCredentials $mycreds -Passphrase (ConvertTo-SecureString "MyVerySecurePassword" -AsPlainText -force) The PowerShell script was generating the error. The solution is simple - you need to enable IIS 6.0 Management Compat...

C#: How do I call an API from a console application?

I have used the following code to call an API and pass in some parameters in the request header. Have a read  here  about the Encoding.GetEncoding(1252) . private static string ExecuteAPI(string url, Dictionary<string, string> parameters, string method = "POST", string body = " ", int timeOut = 180000) {     var request = (HttpWebRequest)WebRequest.Create(url);     request.Method = method;     foreach (var param in parameters)     {         request.Headers.Add(param.Key, param.Value);     }     if ((method == "POST") || (method == "PUT"))     {         if (!string.IsNullOrEmpty(body))         {             var requestBody = Encoding.UTF8.GetBytes(body);             request.ContentLength = requestBody.Length;             request.ContentT...