Giter VIP home page Giter VIP logo

stellarbear / yarasharp Goto Github PK

View Code? Open in Web Editor NEW
34.0 10.0 8.0 24.34 MB

C# wrapper around the Yara pattern matching library

License: MIT License

C++ 3.05% Makefile 0.26% C 88.91% Shell 0.01% M4 0.51% Python 0.41% Batchfile 0.32% Yacc 3.77% Lex 1.91% Objective-C 0.15% Roff 0.25% C# 0.33% PowerShell 0.04% YARA 0.09%
yara yara-scanner wrapper-api wrapper-library yara-forensics wrapper libyara async-scanning net csharp

yarasharp's People

Contributors

chrisdavies-msft avatar stellarbear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yarasharp's Issues

No documents

I would like to add rules or patterns, but couldn't find any refs. My boss told me to use this library for full-text search engine. So I just want to search a txt file for search words.

I guess I can add some rules below...

YSRules rules = compiler.GetRules();

Missing Nuget Packages / Config File for Visual Studio

Trying to recompile the project to target .net 3.5, but can't locate four dependencies and not sure where to find them after searching everywhere.

Is there a nuget service I should be using to find:
YARA.Jansson.x64 / YARA.Jansson.x86
YARA.OpenSSL.x64 / YARA.OpenSSL.x86

Or are these just normal Jansson/OpenSLL projects that have been renamed/recompiled?

AccessViolationException

I'm attempting to use the library via a simple example:

YSInstance YSInstance = new YSInstance();

Dictionary<string, object> CONST_YS_EXTERNAL_VALUES = 
            new Dictionary<string, object>()
                {
                    { "filename", string.Empty },
                    { "filepath", string.Empty },
                    { "extension", string.Empty }
                };

//	Get list of YARA rules
List<string> ruleFilenames = 
                    Directory.GetFiles(@"F:\Configuration\Yara", "*.yara", SearchOption.AllDirectories).ToList();

YSRules reviewRules = null;

using (YSContext context = new YSContext())
{
    //	Compiling rules
    using (YSCompiler compiler = YSInstance.CompileFromFiles(ruleFilenames, CONST_YS_EXTERNAL_VALUES))
    {
        //  Get compiled rules
        reviewRules = compiler.GetRules();

        YSReport errors = compiler.GetErrors();
        YSReport warnings = compiler.GetWarnings();
    }
}

string[] list = new string[] { "Flare", "Something", "blah blah", "offensive" };
foreach (var TmpVal in list)
{
    byte[] commTextBytes = ASCIIEncoding.ASCII.GetBytes(TmpVal);

    List<YSMatches> Matches =
        YSInstance.ScanMemory(commTextBytes,
                                                  poReviewRules,
                                                  CONST_YS_EXTERNAL_VALUES,
                                                  1000);
}

But when I call "ScanMemory()", I get the following result:

System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

Have you seen this before?

Memory Leaks - Instance.cpp

Hi,
in Instance.cpp an exception can be thrown, as a result the "delete PScanner;" will not be called
adding try...catch...finally... or try...finally... should fix the issue

in case of an exception the YSScanner is not disposed

	List<YSMatches^>^ YSInstance::ScanProcess(int pID, YSRules^ rules, Dictionary<String^, Object^>^ externalVariables, int timeout)
	{
		YSScanner^ PScanner = gcnew YSScanner(rules, externalVariables, timeout);
		try{
			List<YSMatches^>^ results = PScanner->ScanProcess(pID);
			return results;
		}
		catch (System::Exception^ e){
			throw e;
		}
		finally{
			delete PScanner;
		}

	}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.