Skip to content

Commit

Permalink
Added a malware database to detect bad programs on the system (Window…
Browse files Browse the repository at this point in the history
…s only)

Added 204 toolbars to malware list (Windows only)
Added support to Linux and others mono compatible systems
Added a 'build.bat' file to compile project under Windows (Visual Studio required)
Added a 'Makefile' file to compile project under Linux systems using Mono (mono-complete required)
Changed program will now be executed using 64bit process under 64bit systems, otherwise 32bit will be used
Changed GUI update timer interval to 1s rather than 500ms
Changed uptime values are now represented by: days.hours:minutes:seconds
Changed controls postion to bottom left instead of top right
Changed page title build date to use CurrentCulture instead of InvariantCulture
Changed rewrite whole reports using HtmlTextWriter wich use a StringBuilder instead a single string with concatenation
Changed program will now run with less privileges (from full to admin)
Improved report generation performance
Removed Service type from report
  • Loading branch information
sn4k3 committed Apr 15, 2015
1 parent 7b16a33 commit fc25b42
Show file tree
Hide file tree
Showing 36 changed files with 1,586 additions and 375 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

# 1.4.0.0
## 16/04/2015

* Added a malware database to detect bad programs on the system (Windows only)
* Added 204 toolbars to malware list (Windows only)
* Added support to Linux and others mono compatible systems
* Added a 'build.bat' file to compile project under Windows (Visual Studio required)
* Added a 'Makefile' file to compile project under Linux systems using Mono (mono-complete required)
* Changed program will now be executed using 64bit process under 64bit systems, otherwise 32bit will be used
* Changed GUI update timer interval to 1s rather than 500ms
* Changed uptime values are now represented by: days.hours:minutes:seconds
* Changed controls postion to bottom left instead of top right
* Changed page title build date to use CurrentCulture instead of InvariantCulture
* Changed rewrite whole reports using HtmlTextWriter wich use a StringBuilder instead a single string with concatenation
* Changed program will now run with less privileges (from full to admin)
* Improved report generation performance
* Removed Service type from report


# 1.3.0.0
## 11/04/2015

Expand Down
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# SystemInfoSnapshot
# Author: Tiago Conceição
# http://systeminfosnapshot.com
#
# Makefile - build and compile project
#

# Project file
PROJECTFILE=SystemInfoSnapshot.sln

# Configuration to use: Release or Debug
CONFIGURATION="Release"
#CONFIGURATION="Debug"

# The compiler to use.
CC=xbuild

# Properties will be the options pass to the compiler.
PROPERTIES = \
/property:Configuration=$(CONFIGURATION)

all: app

app:
$(CC) $(PROPERTIES) $(PROJFILE)

rebuild: clean app

clean:
$(CC) $(PROPERTIES) /target:clean $(PROJECTFILE)

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ Report will be generated and the html file will show on explorer after completio
2. "SystemInfoSnapshot.exe -s -o" - Generate, show and open the report in the explorer and the default browser without showing the GUI.


# Requirements
# Requirements for Windows
* Windows Vista or above (Vista, Server 2008, 7, Server 2012, 8, 8.1, 10)
* [Microsoft .NET Framework 4.5](http://www.microsoft.com/en-us/download/details.aspx?id=30653) (Already pre-installed on Windows 8 and 8.1)

# Requirements for Linux
* Any capable Linux or OS X with mono installed
* The [mono-complete](http://www.mono-project.com/docs/getting-started/install/linux) package

Small and lightweight application with just one executable file.
No installation needed, this software is portable and free!

Expand Down
23 changes: 22 additions & 1 deletion SystemInfoSnapshot/ApplicationArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ namespace SystemInfoSnapshot
/// </summary>
public sealed class ApplicationArguments
{
#region Singleton
/// <summary>
/// A instance of this class
/// </summary>
private static ApplicationArguments _instance;

/// <summary>
/// Gets the singleton instance of this class
/// </summary>
public static ApplicationArguments Instance
{
get { return _instance ?? (_instance = new ApplicationArguments()); }
}
#endregion

#region Properties
/// <summary>
/// Gets if Null mode as passed as argument.
/// </summary>
Expand All @@ -35,7 +51,9 @@ public sealed class ApplicationArguments
/// Gets if the reports will be generated under a single thread.
/// </summary>
public bool UseSingleThread { get; private set; }
#endregion

#region Arguments Variable
/// <summary>
/// Variable - Arguments list
/// </summary>
Expand All @@ -46,11 +64,13 @@ public sealed class ApplicationArguments
{"OpenReport", new []{"-o", "/o", "--open-report"}},
{"UseSingleThread", new []{"-st", "/st", "--single-thread"}}
};
#endregion

#region Constructor
/// <summary>
/// Constructor. Auto initalize arguments.
/// </summary>
public ApplicationArguments()
private ApplicationArguments()
{
var args = Environment.GetCommandLineArgs().ToList();

Expand All @@ -67,5 +87,6 @@ public ApplicationArguments()
}
}
}
#endregion
}
}
10 changes: 8 additions & 2 deletions SystemInfoSnapshot/Autoruns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public sealed class AutorunEntry

public AutorunEntry()
{
IsValidFile = true;
}
}
public string ExecutableFile { get; private set; }
Expand Down Expand Up @@ -153,9 +154,14 @@ public void BuildEntries()
argc++;
entry.LunchString = args[argc];

if (!entry.ImagePath.StartsWith("File not found:"))
if (entry.ImagePath.StartsWith("File not found:"))
{
entry.IsValidFile = true;
entry.IsValidFile = false;
}
if (entry.ImagePath.EndsWith("SystemInfoSnapshot.sys"))
{
i--;
continue;
}

AutorunEntries.Add(entry);
Expand Down
90 changes: 90 additions & 0 deletions SystemInfoSnapshot/Components/HtmlTextWritterEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* SystemInfoSnapshot
* Author: Tiago Conceição
*
* http://systeminfosnapshot.com/
* https://github.com/sn4k3/SystemInfoSnapshot
*/
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web.UI;

namespace SystemInfoSnapshot.Components
{
public class HtmlTextWriterEx : HtmlTextWriter
{
private Dictionary<HtmlTextWriterAttribute, List<string>> _attrValues = new Dictionary<HtmlTextWriterAttribute, List<string>>();
private readonly HtmlTextWriterAttribute[] _allowedMultiValueAttrs = { HtmlTextWriterAttribute.Class, HtmlTextWriterAttribute.Style };

public HtmlTextWriterEx(TextWriter writer) : base(writer) { }

public override void AddAttribute(HtmlTextWriterAttribute key, string value)
{
if (_allowedMultiValueAttrs.Contains(key))
{
if (!_attrValues.ContainsKey(key))
_attrValues.Add(key, new List<string>());

_attrValues[key].Add(value);
}
else
{
base.AddAttribute(key, value);
}
}

public bool RemoveAttribute(HtmlTextWriterAttribute key, string value)
{
return _allowedMultiValueAttrs.Contains(key) && _attrValues.Remove(key);
}

public override void RenderBeginTag(HtmlTextWriterTag tagKey)
{
AddMultiValuesAttrs();
base.RenderBeginTag(tagKey);
}

public override void RenderBeginTag(string tagName)
{
AddMultiValuesAttrs();
base.RenderBeginTag(tagName);
}

public void RenderTag(HtmlTextWriterTag tagKey, string html)
{
RenderBeginTag(tagKey);
if (!string.IsNullOrEmpty(html))
Write(html);
RenderEndTag();
}

public void RenderTag(string tagKey, string html)
{
RenderBeginTag(tagKey);
Write(html);
RenderEndTag();
}

public void RenderTag(HtmlTextWriterTag tagKey, HtmlTextWriterAttribute attribute, string attributeVal, string html)
{
AddAttribute(attribute, attributeVal);
RenderTag(tagKey, html);
}

public void RenderTag(HtmlTextWriterTag tagKey, string attribute, string attributeVal, string html)
{
AddAttribute(attribute, attributeVal);
RenderTag(tagKey, html);
}


private void AddMultiValuesAttrs()
{
foreach (var key in _attrValues.Keys)
AddAttribute(key.ToString(), string.Join(" ", _attrValues[key].ToArray()));

_attrValues = new Dictionary<HtmlTextWriterAttribute, List<string>>();
}
}
}
3 changes: 0 additions & 3 deletions SystemInfoSnapshot/Devices.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;

namespace SystemInfoSnapshot
{
Expand Down
19 changes: 19 additions & 0 deletions SystemInfoSnapshot/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* SystemInfoSnapshot
* Author: Tiago Conceição
*
* http://systeminfosnapshot.com/
* https://github.com/sn4k3/SystemInfoSnapshot
*/
using System;

namespace SystemInfoSnapshot.Extensions
{
public static class StringExtensions
{
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
return source.IndexOf(toCheck, comp) >= 0;
}
}
}
2 changes: 1 addition & 1 deletion SystemInfoSnapshot/FrmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions SystemInfoSnapshot/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* http://systeminfosnapshot.com/
* https://github.com/sn4k3/SystemInfoSnapshot
*/

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Windows.Forms;
Expand Down Expand Up @@ -48,7 +48,7 @@ public FrmMain()
};
tmClock.Tick += (sender, args) =>
{
lbStatus.Text = string.Format("Generating the report. Please wait... {0:0.##}s", (DateTime.Now - StartDateTime).TotalSeconds);
lbStatus.Text = string.Format("Generating the report. Please wait... {0:0.##}s", Math.Ceiling((DateTime.Now - StartDateTime).TotalSeconds));
};
}
#endregion
Expand Down
4 changes: 3 additions & 1 deletion SystemInfoSnapshot/HTMLTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public void WriteToFile()
var filename = Filename ?? "SystemInfoSnapshot";
filename += string.Format("_{0}.html", DateTime.Now).Replace(':', '-').Replace('/', '-').Replace(' ', '_');
#if !DEBUG
filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), filename);
var path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

filename = Directory.Exists(path) ? Path.Combine(path, filename) : filename;
#endif
using (var htmlWriter = new StreamWriter(filename))
{
Expand Down
75 changes: 75 additions & 0 deletions SystemInfoSnapshot/Malware/MalwareItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* SystemInfoSnapshot
* Author: Tiago Conceição
*
* http://systeminfosnapshot.com/
* https://github.com/sn4k3/SystemInfoSnapshot
*/
using System;
using System.Linq;
using SystemInfoSnapshot.Extensions;

namespace SystemInfoSnapshot.Malware
{
public sealed class MalwareItem
{
#region Properties
/// <summary>
/// Gets or sets the malware name
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets or sets the malware type
/// </summary>
public MalwareType Type { get; set; }

/// <summary>
/// Gets or sets if this malware must exactly match with a software name or only need to contains all words in it
/// </summary>
public bool ExactMatch { get; set; }
#endregion

#region Constructor
public MalwareItem()
{
}

public MalwareItem(string name, MalwareType type, bool exactMatch = false)
{
Name = name;
Type = type;
ExactMatch = exactMatch;
}
#endregion

# region Overrides
public override string ToString()
{
return string.Format("Name: {0}, Type: {1}", Name, Type);
}

private bool Equals(MalwareItem other)
{
return string.Equals(Name, other.Name);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj is MalwareItem && Equals((MalwareItem) obj);
}

public bool Equals(string name)
{
return ExactMatch ? Name.Equals(name) : Name.Split(' ').All(word => name.Contains(word, StringComparison.OrdinalIgnoreCase));
}

public override int GetHashCode()
{
return (Name != null ? Name.GetHashCode() : 0);
}
#endregion
}
}
Loading

0 comments on commit fc25b42

Please sign in to comment.