Skip to content

Instantly share code, notes, and snippets.

View michaelhidalgo's full-sized avatar
:octocat:
Focusing

Michael Hidalgo michaelhidalgo

:octocat:
Focusing
View GitHub Profile
var topPanel = "Util - CheckMarx Rule and Guidance Viewer".popupWindow(1000, 600).insert_LogViewer();
//var topPanel = panel.add_Panel(true);
var settingsPanel = topPanel.insert_Above(40,"Settings");
var treeView = topPanel.add_TreeView_with_PropertyGrid().sort();
var codeViewer = topPanel.insert_Right().add_SourceCodeViewer();
var browser = codeViewer.insert_Below().add_WebBrowser();
var cxPortal = new CxPortalWebService();
settingsPanel.add_Label("Server:",2).append_TextBox(cxPortal.Url).align_Right();
var url = @"https://vulnerabilities.teammentor.net/article/bb7f7b3a-a3bc-498a-b4b4-88e7e8b02855";
string response;
using(var client = new WebClient())
{
response = client.DownloadString(url);
}
if (String.IsNullOrEmpty(response)) return;
response = response.Replace("<HEAD>",
string.Format("<HEAD><base href='{0}' target='_blank'>", @"https://vulnerabilities.teammentor.net"));
var url = @"https://vulnerabilities.teammentor.net/html/c4914e51-2609-4edc-8133-31491f1b03c0";
string response;
using(var client = new WebClient())
{
response = client.DownloadString(url);
}
if (String.IsNullOrEmpty(response)) return;
@michaelhidalgo
michaelhidalgo / RestoreArticleIds
Last active August 29, 2015 14:09
This O2 script restores TEAM Mentor article Id from the history record
//using TeamMentor.CoreLib;
//using System.Text;
//O2Ref:C:\Users\Michael Hidalgo\Documents\TM3.5.2\TeamMentor\Publish\Website.3.5\bin\TeamMentor.Schemas.dll
var tmLibraryDir = @"C:\Users\Michael Hidalgo\Documents\Lib_Vulnerabilities-master";
var guidanceExplorerFile =@"C:\Users\Michael Hidalgo\Documents\Lib_Vulnerabilities-master\Vulnerabilities.xml";
//var topPanel = O2Gui.open<Panel>("{name}",700,400);
var topPanel = panel.clear().add_Panel();
var articles = new List<TeamMentor_Article>();
var xmlFiles = tmLibraryDir.files("*.xml",true);
@michaelhidalgo
michaelhidalgo / ArticleVerification
Created November 13, 2014 14:29
This script verifys that the article Id from Metadata is equal to the name of the file.
//using TeamMentor.CoreLib;
//using System.Text;
//O2Ref:C:\Users\Michael Hidalgo\Documents\TM3.5.2\TeamMentor\Publish\Website.3.5\bin\TeamMentor.Schemas.dll
var tmLibraryDir = @"C:\Users\Michael Hidalgo\Documents\Lib_Vulnerabilities-master";
//var topPanel = O2Gui.open<Panel>("{name}",700,400);
var topPanel = panel.clear().add_Panel();
var articles = new List<TeamMentor_Article>();
var xmlFiles = tmLibraryDir.files("*.xml",true);
@michaelhidalgo
michaelhidalgo / gist:bcad8233161b9da8fedc
Created December 5, 2014 22:52
Testing ReDoS for a given Regular Expression
//RegEx Pattern
var pattern =@"^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W]).*$";
Func<String, Boolean> TestValue = (value)=>{
return Regex.IsMatch(value, pattern);
};
//Testing weak password : Length is less than 8 characters
Assert.IsFalse (TestValue("efghij"));
//Testing weak password : Just letters
@michaelhidalgo
michaelhidalgo / O2Script
Created February 3, 2015 16:35
Export articles to a new library.
var defaultServer = "http://localhost:12120";
var userName ="admin";
var passWord ="!!tmadmin";
var path = @"C:\TM3.6\Library_Data\XmlDatabase\TM_Libraries\Lib_UNO-master";
var libraryName = @"ArticlesNotInViews";
var originalLibrary= @"Guidance";
List<String> articleIds = new List<String>();
var teamMentor = defaultServer.connectToServer(true,userName, passWord);
@michaelhidalgo
michaelhidalgo / gist:f46a49e941179ec63fe4
Last active August 29, 2015 14:17
Regular Expression TLD email
using System;
using System.Globalization;
using FluentSharp.CoreLib;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Text.RegularExpressions;
namespace RegExTest
{
[TestClass]
public class RegExTest
{
request = null
analytics_Service = null
Jade_Service = null
blank_credentials_message = 'Invalid Username or Password'
loginSuccess = 0
errorMessage = "TEAM Mentor is unavailable, please contact us at "
class Login_Controller
dependencies: ->
@michaelhidalgo
michaelhidalgo / OpenRedirects
Last active October 27, 2015 20:24
OpenRedirects
static void Main(string[] args)
{
var url = "https://www.gogole.com";
var result = url.IsLocalUrl();
Console.WriteLine(result);
Console.ReadKey();
}