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
@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 / 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 / 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);
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;
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 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();