Added support for VirusTotal.

This commit is contained in:
2017-05-19 01:13:53 +01:00
parent f384995866
commit 6ff82e7b56
21 changed files with 1040 additions and 92 deletions

View File

@@ -1,3 +1,12 @@
2017-05-19 Natalia Portillo <claunia@claunia.com>
* Context.cs:
* Settings.cs:
* packages.config:
* Workers/VirusTotal.cs:
* osrepodbmgr.Core.csproj:
Added support for VirusTotal.
2017-05-18 Natalia Portillo <claunia@claunia.com>
* DBOps.cs:

View File

@@ -53,6 +53,7 @@ namespace osrepodbmgr.Core
public static bool userExtracting;
public static bool usableDotNetZip;
public static string clamdVersion;
public static bool virusTotalEnabled;
public delegate void UnarChangeStatusDelegate();
public static event UnarChangeStatusDelegate UnarChangeStatus;

View File

@@ -45,6 +45,8 @@ namespace osrepodbmgr.Core
public string ClamdHost;
public ushort ClamdPort;
public bool ClamdIsLocal;
public bool UseVirusTotal;
public string VirusTotalKey;
}
public static class Settings
@@ -152,6 +154,20 @@ namespace osrepodbmgr.Core
else
Current.ClamdIsLocal = false;
if(parsedPreferences.TryGetValue("UseVirusTotal", out obj))
{
Current.ClamdIsLocal = ((NSNumber)obj).ToBool();
}
else
Current.ClamdIsLocal = false;
if(parsedPreferences.TryGetValue("VirusTotalKey", out obj))
{
Current.ClamdHost = ((NSString)obj).ToString();
}
else
Current.ClamdHost = null;
prefsFs.Close();
}
else {
@@ -195,6 +211,8 @@ namespace osrepodbmgr.Core
Current.ClamdHost = (string)key.GetValue("ClamdHost");
Current.ClamdPort = (ushort)key.GetValue("ClamdPort");
Current.ClamdIsLocal = (bool)key.GetValue("ClamdIsLocal");
Current.UseVirusTotal = (bool)key.GetValue("UseVirusTotal");
Current.VirusTotalKey = (string)key.GetValue("VirusTotalKey");
}
break;
default:
@@ -251,6 +269,8 @@ namespace osrepodbmgr.Core
root.Add("ClamdHost", Current.ClamdHost);
root.Add("ClamdPort", Current.ClamdPort);
root.Add("ClamdIsLocal", Current.ClamdIsLocal);
root.Add("UseVirusTotal", Current.UseVirusTotal);
root.Add("VirusTotalKey", Current.VirusTotalKey);
string preferencesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Preferences");
string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.museum.osrepodbmgr.plist");
@@ -280,6 +300,8 @@ namespace osrepodbmgr.Core
key.SetValue("ClamdHost", Current.ClamdHost);
key.SetValue("ClamdPort", Current.ClamdPort);
key.SetValue("ClamdIsLocal", Current.ClamdIsLocal);
key.SetValue("UseVirusTotal", Current.UseVirusTotal);
key.SetValue("VirusTotalKey", Current.VirusTotalKey);
}
break;
default:
@@ -320,6 +342,8 @@ namespace osrepodbmgr.Core
Current.ClamdHost = null;
Current.ClamdPort = 3310;
Current.ClamdIsLocal = false;
Current.UseVirusTotal = false;
Current.VirusTotalKey = null;
}
}
}

View File

@@ -0,0 +1,341 @@
//
// Author:
// Natalia Portillo claunia@claunia.com
//
// Copyright (c) 2017, © Claunia.com
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the distribution.
// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
using System;
using VirusTotalNET;
using VirusTotalNET.Results;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using VirusTotalNET.Objects;
using System.Collections.Generic;
using SharpCompress.Compressors.Deflate;
using SharpCompress.Compressors.BZip2;
using SharpCompress.Compressors.LZMA;
using System.Threading;
namespace osrepodbmgr.Core
{
public static partial class Workers
{
static VirusTotal vTotal;
public static bool TestVirusTotal(string key)
{
VirusTotal vt;
FileReport report = null;
try
{
Task.Run(async () =>
{
vt = new VirusTotal(key);
report = await vt.GetFileReport("b82758fc5f737a58078d3c60e2798a70d895443a86aa39adf52dec70e98c2bed");
}).Wait();
}
catch(Exception ex)
{
if(Failed != null)
Failed(ex.InnerException.Message);
return false;
}
return report != null && report.MD5 == "0bf60adb1435639a42b490e7e80d25c7";
}
public static bool InitVirusTotal(string key)
{
VirusTotal vt = null;
FileReport report = null;
try
{
Task.Run(async () =>
{
vt = new VirusTotal(key);
report = await vt.GetFileReport("b82758fc5f737a58078d3c60e2798a70d895443a86aa39adf52dec70e98c2bed");
}).Wait();
}
catch(Exception ex)
{
if(Failed != null)
Failed(ex.InnerException.Message);
return false;
}
if(report != null && report.MD5 == "0bf60adb1435639a42b490e7e80d25c7")
{
vTotal = vt;
Context.virusTotalEnabled = true;
return true;
}
return false;
}
public static void VirusTotalFileFromRepo(DBFile file)
{
try
{
if(!Context.virusTotalEnabled)
{
if(Failed != null)
Failed("VirusTotal is not usable");
return;
}
if(vTotal == null)
{
if(Failed != null)
Failed("VirusTotal is not initalized");
}
FileReport fResult = null;
if(UpdateProgress != null)
UpdateProgress("Requesting existing report to VirusTotal", null, 0, 0);
Task.Run(async () =>
{
fResult = await vTotal.GetFileReport(file.Sha256);
}).Wait();
if(fResult.ResponseCode == VirusTotalNET.ResponseCodes.ReportResponseCode.Error)
{
if(Failed != null)
Failed(fResult.VerboseMsg);
return;
}
if(fResult.ResponseCode == VirusTotalNET.ResponseCodes.ReportResponseCode.Present)
{
if(fResult.Positives > 0)
{
file.HasVirus = true;
if(fResult.Scans != null)
{
foreach(KeyValuePair<string, ScanEngine> engine in fResult.Scans)
{
if(engine.Value.Detected)
{
file.Virus = engine.Value.Result;
file.VirusTotalTime = engine.Value.Update;
dbCore.DBOps.UpdateFile(file);
if(ScanFinished != null)
ScanFinished(file);
return;
}
}
}
}
else
{
// If no scan has been done, mark as false.
// If a positive has already existed don't overwrite it.
file.HasVirus = false;
file.Virus = null;
file.VirusTotalTime = DateTime.UtcNow;
dbCore.DBOps.UpdateFile(file);
if(ScanFinished != null)
ScanFinished(file);
return;
}
}
string repoPath;
AlgoEnum algorithm;
if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
file.Sha256 + ".gz")))
{
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
file.Sha256 + ".gz");
algorithm = AlgoEnum.GZip;
}
else if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
file.Sha256 + ".bz2")))
{
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
file.Sha256 + ".bz2");
algorithm = AlgoEnum.BZip2;
}
else if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
file.Sha256 + ".lzma")))
{
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
file.Sha256 + ".lzma");
algorithm = AlgoEnum.LZMA;
}
else
{
if(Failed != null)
Failed(string.Format("Cannot find file with hash {0} in the repository", file.Sha256));
return;
}
if(UpdateProgress != null)
UpdateProgress("Uncompressing file...", null, 0, 0);
FileStream inFs = new FileStream(repoPath, FileMode.Open, FileAccess.Read);
Stream zStream = null;
switch(algorithm)
{
case AlgoEnum.GZip:
zStream = new GZipStream(inFs, SharpCompress.Compressors.CompressionMode.Decompress);
break;
case AlgoEnum.BZip2:
zStream = new BZip2Stream(inFs, SharpCompress.Compressors.CompressionMode.Decompress);
break;
case AlgoEnum.LZMA:
byte[] properties = new byte[5];
inFs.Read(properties, 0, 5);
inFs.Seek(8, SeekOrigin.Current);
zStream = new LzmaStream(properties, inFs);
break;
}
ScanResult sResult = null;
// Cannot use zStream directly, VirusTotal.NET requests the size *sigh*
string tmpFile = Path.Combine(Settings.Current.TemporaryFolder, Path.GetTempFileName());
FileStream outFs = new FileStream(tmpFile, FileMode.Create, FileAccess.ReadWrite);
zStream.CopyTo(outFs);
zStream.Close();
outFs.Seek(0, SeekOrigin.Begin);
if(UpdateProgress != null)
UpdateProgress("Uploading file to VirusTotal...", null, 0, 0);
Task.Run(async () =>
{
sResult = await vTotal.ScanFile(outFs, file.Sha256); // Keep filename private, sorry!
}).Wait();
outFs.Close();
File.Delete(tmpFile);
if(sResult == null || sResult.ResponseCode == VirusTotalNET.ResponseCodes.ScanResponseCode.Error)
{
if(sResult == null)
{
if(Failed != null)
Failed("Cannot send file to VirusTotal");
}
else
Failed(sResult.VerboseMsg);
return;
}
Task.Run(async () =>
{
fResult = await vTotal.GetFileReport(file.Sha256);
}).Wait();
if(UpdateProgress != null)
UpdateProgress("Waiting for VirusTotal analysis...", null, 0, 0);
while(fResult.ResponseCode == VirusTotalNET.ResponseCodes.ReportResponseCode.StillQueued)
{
// Wait 15 seconds so we fall in the 4 requests/minute
Thread.Sleep(15000);
Task.Run(async () =>
{
fResult = await vTotal.GetFileReport(file.Sha256);
}).Wait();
}
if(fResult.ResponseCode != VirusTotalNET.ResponseCodes.ReportResponseCode.Present)
{
if(Failed != null)
Failed(fResult.VerboseMsg);
return;
}
if(fResult.Positives > 0)
{
file.HasVirus = true;
if(fResult.Scans != null)
{
foreach(KeyValuePair<string, ScanEngine> engine in fResult.Scans)
{
if(engine.Value.Detected)
{
file.Virus = engine.Value.Result;
file.VirusTotalTime = engine.Value.Update;
dbCore.DBOps.UpdateFile(file);
if(ScanFinished != null)
ScanFinished(file);
return;
}
}
}
}
else
{
// If no scan has been done, mark as false.
// If a positive has already existed don't overwrite it.
file.HasVirus = false;
file.Virus = null;
file.VirusTotalTime = DateTime.UtcNow;
dbCore.DBOps.UpdateFile(file);
if(ScanFinished != null)
ScanFinished(file);
return;
}
}
catch(Exception ex)
{
if(Failed != null)
Failed(string.Format("Exception {0} when calling VirusTotal", ex.InnerException.Message));
}
}
}
}

View File

@@ -47,6 +47,11 @@
<Reference Include="nClam">
<HintPath>..\packages\nClam.3.0.0\lib\net45\nClam.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="VirusTotal.NET">
<HintPath>..\packages\VirusTotal.NET.1.5.3\lib\net45\VirusTotal.NET.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -70,6 +75,7 @@
<Compile Include="Workers\Miscellaneous.cs" />
<Compile Include="Workers\DiscImageChef.cs" />
<Compile Include="Workers\Clamd.cs" />
<Compile Include="Workers\VirusTotal.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@@ -6,4 +6,7 @@
<package id="plist-cil" version="1.15.0" targetFramework="net45" />
<package id="SharpCompress" version="0.15.2" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.105.0" targetFramework="net45" />
<package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net45" />
<package id="System.Net.Http" version="4.3.1" targetFramework="net45" />
<package id="VirusTotal.NET" version="1.5.3" targetFramework="net45" />
</packages>

View File

@@ -1,3 +1,8 @@
2017-05-19 Natalia Portillo <claunia@claunia.com>
* Program.cs:
Added support for VirusTotal.
2017-05-18 Natalia Portillo <claunia@claunia.com>
* Program.cs:

View File

@@ -43,6 +43,8 @@ namespace osrepodbmgr.Eto.Desktop
{
if(Core.Settings.Current.UseClamd)
Workers.InitClamd();
if(Core.Settings.Current.UseVirusTotal)
Context.virusTotalEnabled = Workers.InitVirusTotal(Core.Settings.Current.VirusTotalKey);
}
Context.usableDotNetZip = !Platform.Detect.IsMac && !Platform.Detect.IsIos;

View File

@@ -1,3 +1,8 @@
2017-05-19 Natalia Portillo <claunia@claunia.com>
* Program.cs:
Added support for VirusTotal.
2017-05-18 Natalia Portillo <claunia@claunia.com>
* Program.cs:

View File

@@ -43,6 +43,8 @@ namespace osrepodbmgr.Eto.XamMac2
{
if(Core.Settings.Current.UseClamd)
Workers.InitClamd();
if(Core.Settings.Current.UseVirusTotal)
Context.virusTotalEnabled = Workers.InitVirusTotal(Core.Settings.Current.VirusTotalKey);
}
Context.usableDotNetZip = false;
new Application(Platforms.XamMac2).Run(new frmMain());

View File

@@ -1,3 +1,10 @@
2017-05-19 Natalia Portillo <claunia@claunia.com>
* frmMain.xeto.cs:
* dlgSettings.xeto:
* dlgSettings.xeto.cs:
Added support for VirusTotal.
2017-05-18 Natalia Portillo <claunia@claunia.com>
* frmMain.xeto:

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Dialog xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="650" Height="175" xmlns:e="clr-namespace:osrepodbmgr.Core;assembly=osrepodbmgr.Core">
<Dialog xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="650" Height="225" xmlns:e="clr-namespace:osrepodbmgr.Core;assembly=osrepodbmgr.Core">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
@@ -69,6 +69,7 @@
</StackLayout>
<StackLayout Orientation="Vertical">
<CheckBox ID="chkAntivirus" CheckedChanged="OnChkAntivirusToggled" ThreeState="False">Use antivirus?</CheckBox>
<StackLayoutItem HorizontalAlignment="Stretch">
<GroupBox Text="clamd" ID="frmClamd">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
@@ -80,16 +81,16 @@
<Label>Host</Label>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<TextBox ID="txtClamdHost" />
<TextBox ID="txtClamdHost" Enabled="False" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<Label>port</Label>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<NumericUpDown ID="spClamdPort" MaxValue="65535" MinValue="1" Value="3310" />
<NumericUpDown ID="spClamdPort" MaxValue="65535" MinValue="1" Value="3310" Enabled="False" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<Button ID="btnClamdTest" Click="OnBtnClamdTestClicked">Test</Button>
<Button ID="btnClamdTest" Click="OnBtnClamdTestClicked" Enabled="False">Test</Button>
</StackLayoutItem>
</StackLayout>
</StackLayoutItem>
@@ -97,10 +98,36 @@
<Label Visible="False" ID="lblClamdVersion" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<CheckBox ID="chkClamdIsLocal" ThreeState="False">Clamd is local?</CheckBox>
<CheckBox ID="chkClamdIsLocal" ThreeState="False" Enabled="False">Clamd is local?</CheckBox>
</StackLayoutItem>
</StackLayout>
</GroupBox>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<GroupBox Text="VirusTotal" ID="frmVirusTotal">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<CheckBox ID="chkVirusTotal" CheckedChanged="OnChkVirusTotalToggled" ThreeState="False">Use VirusTotal?</CheckBox>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<StackLayout Orientation="Horizontal">
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<Label>API Key</Label>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<TextBox ID="txtVirusTotal" Enabled="False" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<Button ID="btnVirusTotal" Click="OnBtnVirusTotalClicked" Enabled="False">Test</Button>
</StackLayoutItem>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
<Label Visible="False" ID="lblVirusTotal" />
</StackLayoutItem>
</StackLayout>
</GroupBox>
</StackLayoutItem>
</StackLayout>
</StackLayout>
</StackLayoutItem>

View File

@@ -53,6 +53,11 @@ namespace osrepodbmgr.Eto
Button btnClamdTest;
Label lblClamdVersion;
CheckBox chkClamdIsLocal;
GroupBox frmVirusTotal;
CheckBox chkVirusTotal;
TextBox txtVirusTotal;
Button btnVirusTotal;
Label lblVirusTotal;
#pragma warning restore 0649
#endregion XAML UI elements
@@ -83,6 +88,14 @@ namespace osrepodbmgr.Eto
spClamdPort.Value = Core.Settings.Current.ClamdPort;
chkClamdIsLocal.Checked = Core.Settings.Current.ClamdIsLocal;
}
if(Core.Settings.Current.UseAntivirus && Core.Settings.Current.UseVirusTotal)
{
chkVirusTotal.Checked = true;
chkVirusTotal.Enabled = true;
txtVirusTotal.Enabled = true;
txtVirusTotal.Text = Core.Settings.Current.VirusTotalKey;
btnVirusTotal.Enabled = true;
}
}
protected void OnBtnCancelClicked(object sender, EventArgs e)
@@ -105,7 +118,17 @@ namespace osrepodbmgr.Eto
Core.Settings.Current.ClamdPort = 3310;
Core.Settings.Current.ClamdIsLocal = false;
}
Settings.SaveSettings();
if(chkVirusTotal.Checked.Value && chkAntivirus.Checked.Value)
{
Core.Settings.Current.UseVirusTotal = true;
Core.Settings.Current.VirusTotalKey = txtVirusTotal.Text;
Core.Workers.InitVirusTotal(Core.Settings.Current.VirusTotalKey);
}
else
{
Core.Settings.Current.UseVirusTotal = false;
Core.Settings.Current.VirusTotalKey = null;
} Settings.SaveSettings();
Workers.CloseDB();
Workers.InitDB();
Context.clamdVersion = null;
@@ -250,6 +273,7 @@ namespace osrepodbmgr.Eto
protected void OnChkAntivirusToggled(object sender, EventArgs e)
{
frmClamd.Visible = chkAntivirus.Checked.Value;
frmVirusTotal.Visible = chkAntivirus.Checked.Value;
}
protected void OnChkClamdToggled(object sender, EventArgs e)
@@ -294,5 +318,27 @@ namespace osrepodbmgr.Eto
Context.clamdVersion = oldVersion;
lblClamdVersion.Visible = true;
}
protected void OnChkVirusTotalToggled(object sender, EventArgs e)
{
txtVirusTotal.Enabled = chkVirusTotal.Checked.Value;
btnVirusTotal.Enabled = chkVirusTotal.Checked.Value;
lblVirusTotal.Visible = false;
}
protected void OnBtnVirusTotalClicked(object sender, EventArgs e)
{
Workers.Failed += VirusTotalTestFailed;
if(Workers.TestVirusTotal(txtVirusTotal.Text))
{
lblVirusTotal.Visible = true;
lblVirusTotal.Text = "Working!";
}
}
void VirusTotalTestFailed(string text)
{
MessageBox.Show(text, MessageBoxType.Error);
}
}
}

View File

@@ -654,13 +654,13 @@ namespace osrepodbmgr.Eto
btnToggleCrack.Enabled = false;
btnScanWithClamd.Enabled = false;
btnCheckInVirusTotal.Enabled = false;
prgProgress.Visible = true;
lblProgress.Visible = true;
prgProgressFiles1.Visible = true;
lblProgressFiles1.Visible = true;
Workers.Failed += ClamdFailed;
Workers.ScanFinished += ClamdFinished;
lblProgress.Text = "Scanning file with clamd.";
prgProgress.Indeterminate = true;
lblProgressFiles1.Text = "Scanning file with clamd.";
prgProgressFiles1.Indeterminate = true;
thdScanFile = new Thread(() => Workers.ClamScanFileFromRepo(file));
thdScanFile.Start();
@@ -675,11 +675,11 @@ namespace osrepodbmgr.Eto
btnToggleCrack.Enabled = true;
btnScanWithClamd.Enabled = true;
btnCheckInVirusTotal.Enabled = true;
prgProgress.Visible = false;
lblProgress.Visible = false;
prgProgressFiles1.Visible = false;
lblProgressFiles1.Visible = false;
Workers.Failed -= ClamdFailed;
Workers.ScanFinished -= ClamdFinished;
lblProgress.Text = "";
lblProgressFiles1.Text = "";
if(thdScanFile != null)
{
thdScanFile.Abort();
@@ -698,9 +698,9 @@ namespace osrepodbmgr.Eto
btnCheckInVirusTotal.Enabled = true;
Workers.Failed -= ClamdFailed;
Workers.ScanFinished -= ClamdFinished;
lblProgress.Text = "";
prgProgress.Visible = false;
lblProgress.Visible = false;
lblProgressFiles1.Text = "";
prgProgressFiles1.Visible = false;
lblProgressFiles1.Visible = false;
if(thdScanFile != null)
thdScanFile = null;
@@ -711,13 +711,88 @@ namespace osrepodbmgr.Eto
protected void OnBtnCheckInVirusTotalClicked(object sender, EventArgs e)
{
if(treeFiles.SelectedItem != null)
{
DBFile file = Workers.GetDBFile(((DBFile)treeFiles.SelectedItem).Sha256);
outIter = (osrepodbmgr.Core.DBFile)treeFiles.SelectedItem;
if(file == null)
{
MessageBox.Show("Cannot get file from database", MessageBoxType.Error);
return;
}
treeFiles.Enabled = false;
btnToggleCrack.Enabled = false;
btnScanWithClamd.Enabled = false;
btnCheckInVirusTotal.Enabled = false;
prgProgressFiles1.Visible = true;
lblProgressFiles1.Visible = true;
Workers.Failed += VirusTotalFailed;
Workers.ScanFinished += VirusTotalFinished;
Workers.UpdateProgress += UpdateVirusProgress;
lblProgressFiles1.Text = "Scanning file with VirusTotal.";
prgProgressFiles1.Indeterminate = true;
thdScanFile = new Thread(() => Workers.VirusTotalFileFromRepo(file));
thdScanFile.Start();
}
}
void VirusTotalFailed(string text)
{
Application.Instance.Invoke(delegate
{
MessageBox.Show(text, MessageBoxType.Error);
treeFiles.Enabled = true;
btnToggleCrack.Enabled = true;
btnScanWithClamd.Enabled = true;
btnCheckInVirusTotal.Enabled = true;
prgProgressFiles1.Visible = false;
Workers.Failed -= VirusTotalFailed;
Workers.ScanFinished -= VirusTotalFinished;
Workers.UpdateProgress -= UpdateVirusProgress;
lblProgressFiles1.Text = "";
if(thdScanFile != null)
{
thdScanFile.Abort();
thdScanFile = null;
}
});
}
void VirusTotalFinished(DBFile file)
{
Application.Instance.Invoke(delegate
{
treeFiles.Enabled = true;
btnToggleCrack.Enabled = true;
btnScanWithClamd.Enabled = true;
btnCheckInVirusTotal.Enabled = true;
Workers.Failed -= VirusTotalFailed;
Workers.ScanFinished -= VirusTotalFinished;
Workers.UpdateProgress -= UpdateVirusProgress;
lblProgressFiles1.Text = "";
prgProgressFiles1.Visible = false;
if(thdScanFile != null)
thdScanFile = null;
lstFiles.Remove(outIter);
AddFile(file);
});
}
public void UpdateVirusProgress(string text, string inner, long current, long maximum)
{
Application.Instance.Invoke(delegate
{
lblProgressFiles1.Text = text;
});
}
protected void OnBtnPopulateFilesClicked(object sender, EventArgs e)
{
// TODO: Implement
btnCheckInVirusTotal.Enabled = false;
tabOSes.Enabled = false;
btnStopFiles.Visible = true;
btnPopulateFiles.Visible = false;

View File

@@ -1,3 +1,13 @@
2017-05-19 Natalia Portillo <claunia@claunia.com>
* Program.cs:
* frmMain.cs:
* dlgSettings.cs:
* gtk-gui/gui.stetic:
* gtk-gui/osrepodbmgr.frmMain.cs:
* gtk-gui/osrepodbmgr.dlgSettings.cs:
Added support for VirusTotal.
2017-05-18 Natalia Portillo <claunia@claunia.com>
* frmMain.cs:

View File

@@ -41,6 +41,8 @@ namespace osrepodbmgr
{
if(Core.Settings.Current.UseClamd)
Workers.InitClamd();
if(Core.Settings.Current.UseVirusTotal)
Context.virusTotalEnabled = Workers.InitVirusTotal(Core.Settings.Current.VirusTotalKey);
}
Application.Init();
frmMain win = new frmMain();

View File

@@ -81,6 +81,19 @@ namespace osrepodbmgr
txtClamdHost.Text = Core.Settings.Current.ClamdHost;
spClamdPort.Value = Core.Settings.Current.ClamdPort;
chkClamdIsLocal.Active = Core.Settings.Current.ClamdIsLocal;
chkClamd.Sensitive = true;
chkClamdIsLocal.Sensitive = true;
txtClamdHost.Sensitive = true;
spClamdPort.Sensitive = true;
btnClamdTest.Sensitive = true;
}
if(Core.Settings.Current.UseAntivirus && Core.Settings.Current.UseVirusTotal)
{
chkVirusTotal.Active = true;
chkVirusTotal.Sensitive = true;
txtVirusTotal.Sensitive = true;
txtVirusTotal.Text = Core.Settings.Current.VirusTotalKey;
btnVirusTotal.Sensitive = true;
}
}
@@ -121,6 +134,17 @@ namespace osrepodbmgr
Core.Settings.Current.ClamdPort = 3310;
Core.Settings.Current.ClamdIsLocal = false;
}
if(chkVirusTotal.Active && chkAntivirus.Active)
{
Core.Settings.Current.UseVirusTotal = true;
Core.Settings.Current.VirusTotalKey = txtVirusTotal.Text;
Core.Workers.InitVirusTotal(Core.Settings.Current.VirusTotalKey);
}
else
{
Core.Settings.Current.UseVirusTotal = false;
Core.Settings.Current.VirusTotalKey = null;
}
Core.Settings.SaveSettings();
Core.Workers.CloseDB();
Core.Workers.InitDB();
@@ -286,6 +310,7 @@ namespace osrepodbmgr
protected void OnChkAntivirusToggled(object sender, EventArgs e)
{
frmClamd.Visible = chkAntivirus.Active;
frmVirusTotal.Visible = chkAntivirus.Active;
}
protected void OnChkClamdToggled(object sender, EventArgs e)
@@ -334,5 +359,29 @@ namespace osrepodbmgr
Context.clamdVersion = oldVersion;
lblClamdVersion.Visible = true;
}
protected void OnChkVirusTotalToggled(object sender, EventArgs e)
{
txtVirusTotal.Sensitive = chkVirusTotal.Active;
btnVirusTotal.Sensitive = chkVirusTotal.Active;
lblVirusTotal.Visible = false;
}
protected void OnBtnVirusTotalClicked(object sender, EventArgs e)
{
Workers.Failed += VirusTotalTestFailed;
if(Workers.TestVirusTotal(txtVirusTotal.Text))
{
lblVirusTotal.Visible = true;
lblVirusTotal.Text = "Working!";
}
}
void VirusTotalTestFailed(string text)
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
dlgMsg.Run();
dlgMsg.Destroy();
}
}
}

View File

@@ -671,18 +671,18 @@ namespace osrepodbmgr
btnToggleCrack.Sensitive = false;
btnScanWithClamd.Sensitive = false;
btnCheckInVirusTotal.Sensitive = false;
prgProgress.Visible = true;
prgProgressFiles1.Visible = true;
Workers.Failed += ClamdFailed;
Workers.ScanFinished += ClamdFinished;
prgProgress.Text = "Scanning file with clamd.";
prgProgressFiles1.Text = "Scanning file with clamd.";
thdPulseProgress = new Thread(() =>
{
while(true)
{
Application.Invoke(delegate
{
prgProgress.Pulse();
prgProgressFiles1.Pulse();
});
Thread.Sleep(66);
}
@@ -701,10 +701,10 @@ namespace osrepodbmgr
btnToggleCrack.Sensitive = true;
btnScanWithClamd.Sensitive = true;
btnCheckInVirusTotal.Sensitive = true;
prgProgress.Visible = false;
prgProgressFiles1.Visible = false;
Workers.Failed -= ClamdFailed;
Workers.ScanFinished -= ClamdFinished;
prgProgress.Text = "";
prgProgressFiles1.Text = "";
if(thdPulseProgress != null)
{
thdPulseProgress.Abort();
@@ -728,8 +728,8 @@ namespace osrepodbmgr
btnCheckInVirusTotal.Sensitive = true;
Workers.Failed -= ClamdFailed;
Workers.ScanFinished -= ClamdFinished;
prgProgress.Text = "";
prgProgress.Visible = false;
prgProgressFiles1.Text = "";
prgProgressFiles1.Visible = false;
if(thdPulseProgress != null)
{
thdPulseProgress.Abort();
@@ -745,13 +745,111 @@ namespace osrepodbmgr
protected void OnBtnCheckInVirusTotalClicked(object sender, EventArgs e)
{
if(treeFiles.Selection.GetSelected(out outIter))
{
DBFile file = Workers.GetDBFile((string)fileView.GetValue(outIter, 0));
if(file == null)
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
"Cannot get file from database");
dlgMsg.Run();
dlgMsg.Destroy();
return;
}
treeFiles.Sensitive = false;
btnToggleCrack.Sensitive = false;
btnScanWithClamd.Sensitive = false;
btnCheckInVirusTotal.Sensitive = false;
prgProgressFiles1.Visible = true;
Workers.Failed += VirusTotalFailed;
Workers.ScanFinished += VirusTotalFinished;
Workers.UpdateProgress += UpdateVirusProgress;
prgProgressFiles1.Text = "Scanning file with VirusTotal.";
thdPulseProgress = new Thread(() =>
{
while(true)
{
Application.Invoke(delegate
{
prgProgressFiles1.Pulse();
});
Thread.Sleep(66);
}
});
thdScanFile = new Thread(() => Workers.VirusTotalFileFromRepo(file));
thdScanFile.Start();
}
}
void VirusTotalFailed(string text)
{
Application.Invoke(delegate
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
dlgMsg.Run();
dlgMsg.Destroy();
treeFiles.Sensitive = true;
btnToggleCrack.Sensitive = true;
btnScanWithClamd.Sensitive = true;
btnCheckInVirusTotal.Sensitive = true;
prgProgressFiles1.Visible = false;
Workers.Failed -= VirusTotalFailed;
Workers.ScanFinished -= VirusTotalFinished;
Workers.UpdateProgress -= UpdateVirusProgress;
prgProgressFiles1.Text = "";
if(thdPulseProgress != null)
{
thdPulseProgress.Abort();
thdPulseProgress = null;
}
if(thdScanFile != null)
{
thdScanFile.Abort();
thdScanFile = null;
}
});
}
void VirusTotalFinished(DBFile file)
{
Application.Invoke(delegate
{
treeFiles.Sensitive = true;
btnToggleCrack.Sensitive = true;
btnScanWithClamd.Sensitive = true;
btnCheckInVirusTotal.Sensitive = true;
Workers.Failed -= VirusTotalFailed;
Workers.ScanFinished -= VirusTotalFinished;
Workers.UpdateProgress -= UpdateVirusProgress;
prgProgressFiles1.Text = "";
prgProgressFiles1.Visible = false;
if(thdPulseProgress != null)
{
thdPulseProgress.Abort();
thdPulseProgress = null;
}
if(thdScanFile != null)
thdScanFile = null;
fileView.Remove(ref outIter);
AddFile(file);
});
}
public void UpdateVirusProgress(string text, string inner, long current, long maximum)
{
Application.Invoke(delegate
{
prgProgressFiles1.Text = text;
});
}
protected void OnBtnPopulateFilesClicked(object sender, EventArgs e)
{
// TODO: Implement
btnCheckInVirusTotal.Sensitive = false;
notebook1.GetNthPage(0).Sensitive = false;
btnStopFiles.Visible = true;
btnPopulateFiles.Visible = false;

View File

@@ -967,7 +967,7 @@ QNX/QNX/20090229/source.zip</property>
</widget>
</child>
</widget>
<widget class="Gtk.Dialog" id="osrepodbmgr.dlgSettings" design-size="680 250">
<widget class="Gtk.Dialog" id="osrepodbmgr.dlgSettings" design-size="680 320">
<property name="MemberName" />
<property name="Title" translatable="yes">Settings</property>
<property name="WindowPosition">CenterOnParent</property>
@@ -1326,6 +1326,7 @@ QNX/QNX/20090229/source.zip</property>
<child>
<widget class="Gtk.Entry" id="txtClamdHost">
<property name="MemberName" />
<property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="IsEditable">True</property>
<property name="InvisibleChar">●</property>
@@ -1350,6 +1351,7 @@ QNX/QNX/20090229/source.zip</property>
<child>
<widget class="Gtk.SpinButton" id="spClamdPort">
<property name="MemberName" />
<property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Lower">1</property>
<property name="Upper">65535</property>
@@ -1369,6 +1371,7 @@ QNX/QNX/20090229/source.zip</property>
<child>
<widget class="Gtk.Button" id="btnClamdTest">
<property name="MemberName" />
<property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
<property name="Label" translatable="yes">Test</property>
@@ -1405,6 +1408,7 @@ QNX/QNX/20090229/source.zip</property>
<child>
<widget class="Gtk.CheckButton" id="chkClamdIsLocal">
<property name="MemberName" />
<property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">Clamd is local?</property>
<property name="DrawIndicator">True</property>
@@ -1423,7 +1427,7 @@ QNX/QNX/20090229/source.zip</property>
</widget>
</child>
<child>
<widget class="Gtk.Label" id="GtkLabel7">
<widget class="Gtk.Label" id="GtkLabel8">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">&lt;b&gt;clamd&lt;/b&gt;</property>
<property name="UseMarkup">True</property>
@@ -1440,6 +1444,126 @@ QNX/QNX/20090229/source.zip</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Frame" id="frmVirusTotal">
<property name="MemberName" />
<property name="ShadowType">None</property>
<child>
<widget class="Gtk.Alignment" id="GtkAlignment7">
<property name="MemberName" />
<property name="Xalign">0</property>
<property name="Yalign">0</property>
<property name="LeftPadding">12</property>
<child>
<widget class="Gtk.VBox" id="vbox7">
<property name="MemberName" />
<property name="Spacing">6</property>
<child>
<widget class="Gtk.CheckButton" id="chkVirusTotal">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">Use VirusTotal?</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<signal name="Toggled" handler="OnChkVirusTotalToggled" />
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.HBox" id="hbox4">
<property name="MemberName" />
<property name="Spacing">6</property>
<child>
<widget class="Gtk.Label" id="label6">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">API Key</property>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Entry" id="txtVirusTotal">
<property name="MemberName" />
<property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="IsEditable">True</property>
<property name="InvisibleChar">●</property>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">True</property>
</packing>
</child>
<child>
<widget class="Gtk.Button" id="btnVirusTotal">
<property name="MemberName" />
<property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
<property name="Label" translatable="yes">Test</property>
<property name="UseUnderline">True</property>
<signal name="Clicked" handler="OnBtnVirusTotalClicked" />
</widget>
<packing>
<property name="Position">2</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Label" id="lblVirusTotal">
<property name="MemberName" />
<property name="Visible">False</property>
<property name="LabelProp" translatable="yes">label5</property>
</widget>
<packing>
<property name="Position">2</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="Gtk.Label" id="GtkLabel12">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">&lt;b&gt;VirusTotal&lt;/b&gt;</property>
<property name="UseMarkup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="Position">2</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="Position">1</property>
@@ -12591,7 +12715,7 @@ QNX/QNX/20090229/source.zip</property>
<widget class="Gtk.Notebook" id="notebook1">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="CurrentPage">1</property>
<property name="CurrentPage">0</property>
<child>
<widget class="Gtk.VBox" id="vbox3">
<property name="MemberName" />

View File

@@ -76,7 +76,27 @@ namespace osrepodbmgr
private global::Gtk.CheckButton chkClamdIsLocal;
private global::Gtk.Label GtkLabel7;
private global::Gtk.Label GtkLabel8;
private global::Gtk.Frame frame2;
private global::Gtk.Alignment GtkAlignment7;
private global::Gtk.VBox vbox7;
private global::Gtk.CheckButton chkVirusTotal;
private global::Gtk.HBox hbox4;
private global::Gtk.Label label6;
private global::Gtk.Entry txtVirusTotal;
private global::Gtk.Button btnVirusTotal;
private global::Gtk.Label lblVirusTotal;
private global::Gtk.Label GtkLabel12;
private global::Gtk.HBox hbox18;
@@ -364,6 +384,7 @@ namespace osrepodbmgr
w29.Fill = false;
// Container child hbox3.Gtk.Box+BoxChild
this.txtClamdHost = new global::Gtk.Entry();
this.txtClamdHost.Sensitive = false;
this.txtClamdHost.CanFocus = true;
this.txtClamdHost.Name = "txtClamdHost";
this.txtClamdHost.IsEditable = true;
@@ -382,6 +403,7 @@ namespace osrepodbmgr
w31.Fill = false;
// Container child hbox3.Gtk.Box+BoxChild
this.spClamdPort = new global::Gtk.SpinButton(1, 65535, 1);
this.spClamdPort.Sensitive = false;
this.spClamdPort.CanFocus = true;
this.spClamdPort.Name = "spClamdPort";
this.spClamdPort.Adjustment.PageIncrement = 10;
@@ -395,6 +417,7 @@ namespace osrepodbmgr
w32.Fill = false;
// Container child hbox3.Gtk.Box+BoxChild
this.btnClamdTest = new global::Gtk.Button();
this.btnClamdTest.Sensitive = false;
this.btnClamdTest.CanFocus = true;
this.btnClamdTest.Name = "btnClamdTest";
this.btnClamdTest.UseUnderline = true;
@@ -420,6 +443,7 @@ namespace osrepodbmgr
w35.Fill = false;
// Container child vbox6.Gtk.Box+BoxChild
this.chkClamdIsLocal = new global::Gtk.CheckButton();
this.chkClamdIsLocal.Sensitive = false;
this.chkClamdIsLocal.CanFocus = true;
this.chkClamdIsLocal.Name = "chkClamdIsLocal";
this.chkClamdIsLocal.Label = global::Mono.Unix.Catalog.GetString("Clamd is local?");
@@ -432,26 +456,111 @@ namespace osrepodbmgr
w36.Fill = false;
this.GtkAlignment6.Add(this.vbox6);
this.frmClamd.Add(this.GtkAlignment6);
this.GtkLabel7 = new global::Gtk.Label();
this.GtkLabel7.Name = "GtkLabel7";
this.GtkLabel7.LabelProp = global::Mono.Unix.Catalog.GetString("<b>clamd</b>");
this.GtkLabel7.UseMarkup = true;
this.frmClamd.LabelWidget = this.GtkLabel7;
this.GtkLabel8 = new global::Gtk.Label();
this.GtkLabel8.Name = "GtkLabel8";
this.GtkLabel8.LabelProp = global::Mono.Unix.Catalog.GetString("<b>clamd</b>");
this.GtkLabel8.UseMarkup = true;
this.frmClamd.LabelWidget = this.GtkLabel8;
this.vbox4.Add(this.frmClamd);
global::Gtk.Box.BoxChild w39 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.frmClamd]));
w39.Position = 1;
w39.Expand = false;
w39.Fill = false;
this.hbox2.Add(this.vbox4);
global::Gtk.Box.BoxChild w40 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.vbox4]));
w40.Position = 1;
// Container child vbox4.Gtk.Box+BoxChild
this.frame2 = new global::Gtk.Frame();
this.frame2.Name = "frame2";
this.frame2.ShadowType = ((global::Gtk.ShadowType)(0));
// Container child frame2.Gtk.Container+ContainerChild
this.GtkAlignment7 = new global::Gtk.Alignment(0F, 0F, 1F, 1F);
this.GtkAlignment7.Name = "GtkAlignment7";
this.GtkAlignment7.LeftPadding = ((uint)(12));
// Container child GtkAlignment7.Gtk.Container+ContainerChild
this.vbox7 = new global::Gtk.VBox();
this.vbox7.Name = "vbox7";
this.vbox7.Spacing = 6;
// Container child vbox7.Gtk.Box+BoxChild
this.chkVirusTotal = new global::Gtk.CheckButton();
this.chkVirusTotal.CanFocus = true;
this.chkVirusTotal.Name = "chkVirusTotal";
this.chkVirusTotal.Label = global::Mono.Unix.Catalog.GetString("Use VirusTotal?");
this.chkVirusTotal.DrawIndicator = true;
this.chkVirusTotal.UseUnderline = true;
this.vbox7.Add(this.chkVirusTotal);
global::Gtk.Box.BoxChild w40 = ((global::Gtk.Box.BoxChild)(this.vbox7[this.chkVirusTotal]));
w40.Position = 0;
w40.Expand = false;
w40.Fill = false;
w1.Add(this.hbox2);
global::Gtk.Box.BoxChild w41 = ((global::Gtk.Box.BoxChild)(w1[this.hbox2]));
// Container child vbox7.Gtk.Box+BoxChild
this.hbox4 = new global::Gtk.HBox();
this.hbox4.Name = "hbox4";
this.hbox4.Spacing = 6;
// Container child hbox4.Gtk.Box+BoxChild
this.label6 = new global::Gtk.Label();
this.label6.Name = "label6";
this.label6.LabelProp = global::Mono.Unix.Catalog.GetString("API Key");
this.hbox4.Add(this.label6);
global::Gtk.Box.BoxChild w41 = ((global::Gtk.Box.BoxChild)(this.hbox4[this.label6]));
w41.Position = 0;
w41.Expand = false;
w41.Fill = false;
// Container child hbox4.Gtk.Box+BoxChild
this.txtVirusTotal = new global::Gtk.Entry();
this.txtVirusTotal.Sensitive = false;
this.txtVirusTotal.CanFocus = true;
this.txtVirusTotal.Name = "txtVirusTotal";
this.txtVirusTotal.IsEditable = true;
this.txtVirusTotal.InvisibleChar = '●';
this.hbox4.Add(this.txtVirusTotal);
global::Gtk.Box.BoxChild w42 = ((global::Gtk.Box.BoxChild)(this.hbox4[this.txtVirusTotal]));
w42.Position = 1;
// Container child hbox4.Gtk.Box+BoxChild
this.btnVirusTotal = new global::Gtk.Button();
this.btnVirusTotal.Sensitive = false;
this.btnVirusTotal.CanFocus = true;
this.btnVirusTotal.Name = "btnVirusTotal";
this.btnVirusTotal.UseUnderline = true;
this.btnVirusTotal.Label = global::Mono.Unix.Catalog.GetString("Test");
this.hbox4.Add(this.btnVirusTotal);
global::Gtk.Box.BoxChild w43 = ((global::Gtk.Box.BoxChild)(this.hbox4[this.btnVirusTotal]));
w43.Position = 2;
w43.Expand = false;
w43.Fill = false;
this.vbox7.Add(this.hbox4);
global::Gtk.Box.BoxChild w44 = ((global::Gtk.Box.BoxChild)(this.vbox7[this.hbox4]));
w44.Position = 1;
w44.Expand = false;
w44.Fill = false;
// Container child vbox7.Gtk.Box+BoxChild
this.lblVirusTotal = new global::Gtk.Label();
this.lblVirusTotal.Name = "lblVirusTotal";
this.lblVirusTotal.LabelProp = global::Mono.Unix.Catalog.GetString("label5");
this.vbox7.Add(this.lblVirusTotal);
global::Gtk.Box.BoxChild w45 = ((global::Gtk.Box.BoxChild)(this.vbox7[this.lblVirusTotal]));
w45.Position = 2;
w45.Expand = false;
w45.Fill = false;
this.GtkAlignment7.Add(this.vbox7);
this.frame2.Add(this.GtkAlignment7);
this.GtkLabel12 = new global::Gtk.Label();
this.GtkLabel12.Name = "GtkLabel12";
this.GtkLabel12.LabelProp = global::Mono.Unix.Catalog.GetString("<b>VirusTotal</b>");
this.GtkLabel12.UseMarkup = true;
this.frame2.LabelWidget = this.GtkLabel12;
this.vbox4.Add(this.frame2);
global::Gtk.Box.BoxChild w48 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.frame2]));
w48.Position = 2;
w48.Expand = false;
w48.Fill = false;
this.hbox2.Add(this.vbox4);
global::Gtk.Box.BoxChild w49 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.vbox4]));
w49.Position = 1;
w49.Expand = false;
w49.Fill = false;
w1.Add(this.hbox2);
global::Gtk.Box.BoxChild w50 = ((global::Gtk.Box.BoxChild)(w1[this.hbox2]));
w50.Position = 0;
w50.Expand = false;
w50.Fill = false;
// Container child vbox5.Gtk.Box+BoxChild
this.hbox18 = new global::Gtk.HBox();
this.hbox18.Name = "hbox18";
@@ -464,10 +573,10 @@ namespace osrepodbmgr
this.btnCancel.UseUnderline = true;
this.btnCancel.Label = "gtk-cancel";
this.hbox18.Add(this.btnCancel);
global::Gtk.Box.BoxChild w42 = ((global::Gtk.Box.BoxChild)(this.hbox18[this.btnCancel]));
w42.Position = 0;
w42.Expand = false;
w42.Fill = false;
global::Gtk.Box.BoxChild w51 = ((global::Gtk.Box.BoxChild)(this.hbox18[this.btnCancel]));
w51.Position = 0;
w51.Expand = false;
w51.Fill = false;
// Container child hbox18.Gtk.Box+BoxChild
this.btnApply = new global::Gtk.Button();
this.btnApply.CanFocus = true;
@@ -476,19 +585,19 @@ namespace osrepodbmgr
this.btnApply.UseUnderline = true;
this.btnApply.Label = "gtk-apply";
this.hbox18.Add(this.btnApply);
global::Gtk.Box.BoxChild w43 = ((global::Gtk.Box.BoxChild)(this.hbox18[this.btnApply]));
w43.PackType = ((global::Gtk.PackType)(1));
w43.Position = 1;
w43.Expand = false;
w43.Fill = false;
global::Gtk.Box.BoxChild w52 = ((global::Gtk.Box.BoxChild)(this.hbox18[this.btnApply]));
w52.PackType = ((global::Gtk.PackType)(1));
w52.Position = 1;
w52.Expand = false;
w52.Fill = false;
w1.Add(this.hbox18);
global::Gtk.Box.BoxChild w44 = ((global::Gtk.Box.BoxChild)(w1[this.hbox18]));
w44.Position = 1;
w44.Expand = false;
w44.Fill = false;
global::Gtk.Box.BoxChild w53 = ((global::Gtk.Box.BoxChild)(w1[this.hbox18]));
w53.Position = 1;
w53.Expand = false;
w53.Fill = false;
// Internal child osrepodbmgr.dlgSettings.ActionArea
global::Gtk.HButtonBox w45 = this.ActionArea;
w45.Name = "__gtksharp_108_Stetic_TopLevelDialog_ActionArea";
global::Gtk.HButtonBox w54 = this.ActionArea;
w54.Name = "__gtksharp_108_Stetic_TopLevelDialog_ActionArea";
// Container child __gtksharp_108_Stetic_TopLevelDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.btnDialog = new global::Gtk.Button();
this.btnDialog.CanFocus = true;
@@ -496,17 +605,18 @@ namespace osrepodbmgr
this.btnDialog.UseUnderline = true;
this.btnDialog.Label = global::Mono.Unix.Catalog.GetString("GtkButton");
this.AddActionWidget(this.btnDialog, 0);
global::Gtk.ButtonBox.ButtonBoxChild w46 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w45[this.btnDialog]));
w46.Expand = false;
w46.Fill = false;
global::Gtk.ButtonBox.ButtonBoxChild w55 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w54[this.btnDialog]));
w55.Expand = false;
w55.Fill = false;
if((this.Child != null))
{
this.Child.ShowAll();
}
this.DefaultWidth = 680;
this.DefaultHeight = 250;
this.DefaultHeight = 320;
this.lblUnarVersion.Hide();
w45.Hide();
this.lblVirusTotal.Hide();
w54.Hide();
this.Show();
this.btnDatabase.Clicked += new global::System.EventHandler(this.OnBtnDatabaseClicked);
this.btnRepository.Clicked += new global::System.EventHandler(this.OnBtnRepositoryClicked);
@@ -515,6 +625,8 @@ namespace osrepodbmgr
this.chkAntivirus.Toggled += new global::System.EventHandler(this.OnChkAntivirusToggled);
this.chkClamd.Toggled += new global::System.EventHandler(this.OnChkClamdToggled);
this.btnClamdTest.Clicked += new global::System.EventHandler(this.OnBtnClamdTestClicked);
this.chkVirusTotal.Toggled += new global::System.EventHandler(this.OnChkVirusTotalToggled);
this.btnVirusTotal.Clicked += new global::System.EventHandler(this.OnBtnVirusTotalClicked);
this.btnCancel.Clicked += new global::System.EventHandler(this.OnBtnCancelClicked);
this.btnApply.Clicked += new global::System.EventHandler(this.OnBtnApplyClicked);
}

View File

@@ -93,7 +93,7 @@ namespace osrepodbmgr
this.notebook1 = new global::Gtk.Notebook();
this.notebook1.CanFocus = true;
this.notebook1.Name = "notebook1";
this.notebook1.CurrentPage = 1;
this.notebook1.CurrentPage = 0;
// Container child notebook1.Gtk.Notebook+NotebookChild
this.vbox3 = new global::Gtk.VBox();
this.vbox3.Name = "vbox3";