Compare commits

...

6 Commits

Author SHA1 Message Date
Dani Santos a70d401e07 typo in README 7 days ago
Dani Santos c5a078bbcf version 4.2.2.0 1 week ago
Dani Santos 538dad9e34 Version 4.2.1.0 1 month ago
Dani Santos a0213f1fe7 Version 4.2 1 year ago
Dani Santos 1fcabbd8b6 Version 4.1 2 years ago
Dani Santos edb22d5190 Version 4.0.5 2 years ago
  1. 84
      README.md
  2. BIN
      bin/BaseLibrary.dll
  3. BIN
      bin/XescSDK.dll
  4. 12
      bin/XescSDK.runtimeconfig.json
  5. 32
      bin/XvirusSDK.deps.json
  6. BIN
      bin/XvirusSDK.dll
  7. 1
      bin/settings.json
  8. 10
      example/.gitignore
  9. BIN
      example/.vs/Example/DesignTimeBuild/.dtbcache.v2
  10. BIN
      example/.vs/Example/v17/.futdcache.v1
  11. BIN
      example/.vs/Example/v17/.suo
  12. 6
      example/Example.csproj

84
README.md

@ -1,43 +1,86 @@
# Xvirus SDK 4.0.4 # Xvirus SDK C#
Xvirus SDK 4.0.4 C# bindings. Xvirus SDK 4.2.2 C# bindings.
## Table of Contents ## Table of Contents
- [Xvirus SDK 4.0.4](#xvirus-sdk-40) - [Xvirus SDK C#](#xvirus-sdk-c)
- [Table of Contents](#table-of-contents) - [Table of Contents](#table-of-contents)
- [Minimum Requirements](#minimum-requirements) - [Minimum Requirements](#minimum-requirements)
- [Changelog](#changelog) - [Changelog](#changelog)
- [Known Issues](#known-issues) - [Known Issues](#known-issues)
- [Get Started](#get-started) - [Get Started](#get-started)
- [Avaiable Functions](#avaiable-functions) - [Avaiable Functions](#avaiable-functions)
- [Model](#model)
- [Settings](#settings) - [Settings](#settings)
- [Exceptions](#exceptions)
## Minimum Requirements ## Minimum Requirements
To run Xvirus SDK you need: To use Xvirus C# SDK you need:
- .NET 5 Runtime - [download](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-5.0.11-windows-x64-installer) - .NET 7 SDK - [download](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
The following Operating Systems are supported:
- Windows:
- Windows 10 1607
- Windows 11 22000
- Windows Server 2012
- Windows Server Core 2012
- Linux (glibc 2.17):
- Alpine Linux 3.15
- CentOS 7
- Debian 10
- Fedora 36
- openSUSE 15
- Oracle Linux 7
- Red Hat Enterprise Linux 7
- SUSE Enterprise Linux (SLES) 12 SP2
- Ubuntu 18.04
## Changelog ## Changelog
- Completely redone in .NET 5 - Version **4.2.2**:
- Now supports Linux (CLI and C# bindings only) - Optimized scanning speed of PDF files
- Added XvirusAI scan engine (BETA) - ScanResult now returns the file path
- Scan speed is up to 2x faster - Added new ScanFolder() and ScanFolderString() functions
- Fixed memory usage spike when scanning large files
- Removed file size limit for scanned files by default - Version **4.2.1**:
- The checkUpdate function can now check for SDK updates - Optimized scanning speed of big files
- Added 3 new settings "EnableAIScan", "MaxScanLength" and "DatabaseVersion" - Optimized scanning speed in Linux version
- Version **4.2**:
- Reduced glibc minimum version to 2.17 on Linux
- Added "Logging()" function to enable/disable logging
- Added "BaseFolder()" function to set a custom base folder
- Added new setting "DatabaseFolder" to set the Database folder path
- Fixed C++ binding will return "Success=false" correctly when failing to scan a file
- Version **4.1**:
- Upgraded from .NET 5 to .NET 7
- C++ bindings now also support Linux
- Changed how exceptions are handled in C++ bindings
- Version **4.0**:
- Completely redone in .NET 5
- Now supports Linux (CLI and C# bindings only)
- Added XvirusAI scan engine (BETA)
- Scan speed is up to 2x faster
- Fixed memory usage spike when scanning large files
- Removed file size limit for scanned files by default
- The checkUpdate function can now check for SDK updates
- Added 3 new settings "EnableAIScan", "MaxScanLength" and "DatabaseVersion"
## Known Issues ## Known Issues
- XvirusAI engine is still in BETA. It is not recomended to use in production yet. - XvirusAI engine is still in BETA. It is not recomended to use in production yet.
- XvirusAI engine does not work in C++ bindings.
- The checkUpdate function can now check for SDK updates but can't update it - The checkUpdate function can now check for SDK updates but can't update it
## Get Started ## Get Started
The "`example`" folder contains an example project on how to import and use Xvirus SDK in C# (.NET Core 5). The "`example`" folder contains an example project on how to import and use Xvirus SDK in C# (.NET 7).
You can run it by building it and then running executable file in the output folder. You can run it by building it and then running executable file in the output folder.
@ -48,7 +91,7 @@ You have the following functions available:
- **Load** - Loads Xvirus Scan Engine into memory, if set `force`=true it will reload the scan engine, even if it is already loaded. - **Load** - Loads Xvirus Scan Engine into memory, if set `force`=true it will reload the scan engine, even if it is already loaded.
- **Unload** - Unloads Xvirus Scan Engine from memory. - **Unload** - Unloads Xvirus Scan Engine from memory.
- **Scan** - Scans the file located at `filepath`. It will return a [`ScanResult`](#Model). - **Scan** - Scans the file located at `filepath`. It will return a [`ScanResult`](#Model).
- **ScanAsString** - Scans the file located at `filepath`. It will return one of the following strings: - **ScanString** - Scans the file located at `filepath`. It will return one of the following strings:
- "**Safe**" - If no malware is detected. - "**Safe**" - If no malware is detected.
- "**Malware**" - If malware is detected but the name isn't known. - "**Malware**" - If malware is detected but the name isn't known.
- **_Malware Name_** - If it is malware from a known family (example: "Trojan.Downloader"). - **_Malware Name_** - If it is malware from a known family (example: "Trojan.Downloader").
@ -56,17 +99,21 @@ You have the following functions available:
- "**File not found!**" - If no file is found in the submited path. - "**File not found!**" - If no file is found in the submited path.
- "**File too big!**" - If the file size is bigger than the set limit. - "**File too big!**" - If the file size is bigger than the set limit.
- "**Could not get file hash!**" - There was an error calculating the hash of the file. - "**Could not get file hash!**" - There was an error calculating the hash of the file.
- **ScanFolder** - Scans all the files inside the folder at `folderpath`. It will return an IEnumerable of [`ScanResult`](#Model).
- **ScanFolderString** - Scans all the files inside the folder at `folderpath`. It will return the scan result message for each file scanned.
- **CheckUpdates** - Checks and updates the databases and AI engine to the most recent versions. If `checkSDKUpdates`=true then it will also check for SDK updates. If `loadDBAfterUpdate`=true then it will reload the Xvirus Scan Engine after the update is done. It can return the following strings: - **CheckUpdates** - Checks and updates the databases and AI engine to the most recent versions. If `checkSDKUpdates`=true then it will also check for SDK updates. If `loadDBAfterUpdate`=true then it will reload the Xvirus Scan Engine after the update is done. It can return the following strings:
- "**There is a new SDK version available!**" - "**There is a new SDK version available!**"
- "**Database was updated!**" - "**Database was updated!**"
- "**Database is up-to-date!**" - "**Database is up-to-date!**"
- **GetSettings** - returns object representation of the `settings.json` file. - **GetSettings** - returns object representation of the `settings.json` file.
- **GetSettingsAsString** - returns a string representation of the `settings.json` file. - **GetSettingsAsString** - returns a string representation of the `settings.json` file.
- **Logging** - Sets and returns if `Logging` is enabled. If no `enableLogging` value is provided it will only return.
- **BaseFolder** - Sets and returns the `BaseFolder` path. If no `baseFolder` value is provided it will only return.
- **Version** - returns the version of the SDK/CLI. - **Version** - returns the version of the SDK/CLI.
## Model ## Model
The `scan` function returns a class `ScanResult` with the following properties: The `scan` and `scanFolder` functions return a class `ScanResult` with the following properties:
```c# ```c#
public class ScanResult public class ScanResult
@ -74,16 +121,18 @@ public class ScanResult
public bool IsMalware { get; set; } // true if malware public bool IsMalware { get; set; } // true if malware
public string Name { get; set; } // detection name public string Name { get; set; } // detection name
public double MalwareScore { get; set; } // between 0 and 1, higher score means more likely to be malware, -1 if there was an error public double MalwareScore { get; set; } // between 0 and 1, higher score means more likely to be malware, -1 if there was an error
public string Path { get; set; } // file path
} }
``` ```
## Settings ## Settings
Settings are located in the "`settings.json`" file in the root folder of the SDK. There are 4 avaiable options: Settings are located in the "`settings.json`" file in the root folder of the SDK. There are 5 avaiable options:
- **EnableHeuristics** - Enables heuristics scanning of files. Default: _true_ - **EnableHeuristics** - Enables heuristics scanning of files. Default: _true_
- **EnableAIScan** - Enables XvirusAI scan engine. This feature is still in BETA. Default: _false_ - **EnableAIScan** - Enables XvirusAI scan engine. This feature is still in BETA. Default: _false_
- **MaxScanLength** - Maximum file size to be scanned in bytes. If set "null" then there is no limit. Default: _null_ - **MaxScanLength** - Maximum file size to be scanned in bytes. If set "null" then there is no limit. Default: _null_
- **DatabaseFolder** - Path to the database folder, it accepts both relative and absolute paths. Default: _"Database"_
- **DatabaseVersion** - KeyValue list of database files version. This is updated automatically when using the "checkUpdate()" function. - **DatabaseVersion** - KeyValue list of database files version. This is updated automatically when using the "checkUpdate()" function.
Example of a `settings.json` file: Example of a `settings.json` file:
@ -93,6 +142,7 @@ Example of a `settings.json` file:
"EnableHeuristics": true, "EnableHeuristics": true,
"EnableAIScan": false, "EnableAIScan": false,
"MaxScanLength": null, "MaxScanLength": null,
"DatabaseFolder": "Database",
"DatabaseVersion": { "DatabaseVersion": {
"AIModel": 0, "AIModel": 0,
"MainDB": 0, "MainDB": 0,

BIN
bin/BaseLibrary.dll

Binary file not shown.

BIN
bin/XescSDK.dll

Binary file not shown.

12
bin/XescSDK.runtimeconfig.json

@ -1,12 +0,0 @@
{
"runtimeOptions": {
"tfm": "net5.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "5.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
}
}
}

32
bin/XescSDK.deps.json → bin/XvirusSDK.deps.json

@ -1,19 +1,17 @@
{ {
"runtimeTarget": { "runtimeTarget": {
"name": ".NETCoreApp,Version=v5.0", "name": ".NETCoreApp,Version=v7.0",
"signature": "" "signature": ""
}, },
"compilationOptions": {}, "compilationOptions": {},
"targets": { "targets": {
".NETCoreApp,Version=v5.0": { ".NETCoreApp,Version=v7.0": {
"XescSDK/4.0.4": { "XvirusSDK/4.2.2.0": {
"dependencies": { "dependencies": {
"Microsoft.ML": "1.7.1", "BaseLibrary": "1.0.0"
"Microsoft.ML.FastTree": "1.7.1",
"PeNet": "1.6.1"
}, },
"runtime": { "runtime": {
"XescSDK.dll": {} "XvirusSDK.dll": {}
} }
}, },
"Microsoft.CSharp/4.3.0": { "Microsoft.CSharp/4.3.0": {
@ -1035,11 +1033,24 @@
"fileVersion": "1.3.12.62151" "fileVersion": "1.3.12.62151"
} }
} }
},
"BaseLibrary/1.0.0": {
"dependencies": {
"Microsoft.ML": "1.7.1",
"Microsoft.ML.FastTree": "1.7.1",
"PeNet": "1.6.1"
},
"runtime": {
"BaseLibrary.dll": {
"assemblyVersion": "1.0.0",
"fileVersion": "1.0.0.0"
}
}
} }
} }
}, },
"libraries": { "libraries": {
"XescSDK/4.0.4": { "XvirusSDK/4.2.2.0": {
"type": "project", "type": "project",
"serviceable": false, "serviceable": false,
"sha512": "" "sha512": ""
@ -1743,6 +1754,11 @@
"sha512": "sha512-CQETcfKyEq6Uki9pExNZI5sEHeKqdt9Fc4pdLHu1mgaboQp0aI4W45M+UUnG6Zc2hxWTDmbD2AFVKA1wjU19YA==", "sha512": "sha512-CQETcfKyEq6Uki9pExNZI5sEHeKqdt9Fc4pdLHu1mgaboQp0aI4W45M+UUnG6Zc2hxWTDmbD2AFVKA1wjU19YA==",
"path": "xunit.skippablefact/1.3.12", "path": "xunit.skippablefact/1.3.12",
"hashPath": "xunit.skippablefact.1.3.12.nupkg.sha512" "hashPath": "xunit.skippablefact.1.3.12.nupkg.sha512"
},
"BaseLibrary/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
} }
} }
} }

BIN
bin/XvirusSDK.dll

Binary file not shown.

1
bin/settings.json

@ -2,6 +2,7 @@
"EnableHeuristics": true, "EnableHeuristics": true,
"EnableAIScan": false, "EnableAIScan": false,
"MaxScanLength": null, "MaxScanLength": null,
"DatabaseFolder": "Database",
"DatabaseVersion": { "DatabaseVersion": {
"AIModel": 0, "AIModel": 0,
"MainDB": 0, "MainDB": 0,

10
example/.gitignore

@ -0,0 +1,10 @@
*.suo
*.user
*.sln.docstates
.vs/
bin/
obj/
x64/
debug/
release/

BIN
example/.vs/Example/DesignTimeBuild/.dtbcache.v2

Binary file not shown.

BIN
example/.vs/Example/v17/.futdcache.v1

Binary file not shown.

BIN
example/.vs/Example/v17/.suo

Binary file not shown.

6
example/Example.csproj

@ -2,12 +2,12 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="XescSDK"> <Reference Include="XvirusSDK">
<HintPath>..\bin\XescSDK.dll</HintPath> <HintPath>..\bin\XvirusSDK.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

Loading…
Cancel
Save