-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
2,899 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Kudu.Contracts.Scan | ||
{ | ||
public interface IScanManager | ||
{ | ||
Task<ScanRequestResult> StartScan( | ||
String timeout, | ||
String mainScanDirPath, | ||
String id, | ||
String host, | ||
Boolean checkModified); | ||
|
||
Task<ScanStatusResult> GetScanStatus( | ||
String scanId, | ||
String mainScanDirPath); | ||
|
||
Task<ScanReport> GetScanResultFile( | ||
String scanId, | ||
String mainScanDirPath); | ||
|
||
IEnumerable<ScanOverviewResult> GetResults(String mainScanDir); | ||
|
||
void StopScan(String mainScanDirPath); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Kudu.Contracts.Scan | ||
{ | ||
public class InfectedFileObject | ||
{ | ||
[JsonProperty(PropertyName = "name")] | ||
public String Name { get; set; } | ||
|
||
[JsonProperty(PropertyName = "threat_detected")] | ||
public String ThreatDetected { get; set; } | ||
|
||
public InfectedFileObject(string name, string threat) | ||
{ | ||
this.Name = name; | ||
this.ThreatDetected = threat; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Kudu.Contracts.Scan | ||
{ | ||
public class ScanDetail | ||
{ | ||
[JsonProperty(PropertyName = "total_scanned")] | ||
public String TotalScanned { get; set; } | ||
|
||
[JsonProperty(PropertyName = "total_infected")] | ||
public String TotalInfected { get; set; } | ||
|
||
[JsonProperty(PropertyName = "time_taken")] | ||
public String TimeTaken { get; set; } | ||
|
||
[JsonProperty(PropertyName = "safe_files")] | ||
public List<String> SafeFiles { get; set; } | ||
|
||
[JsonProperty(PropertyName = "infected_files")] | ||
public List<InfectedFileObject> InfectedFiles { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Kudu.Contracts.Infrastructure; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Kudu.Contracts.Scan | ||
{ | ||
|
||
public class ScanOverviewResult : INamedObject | ||
{ | ||
[JsonProperty(PropertyName = "status_info")] | ||
public ScanStatusResult Status { get; set; } | ||
|
||
[JsonProperty(PropertyName = "scan_results_url")] | ||
public String ScanResultsUrl { get; set; } | ||
|
||
/* [JsonIgnore] | ||
public DateTime ReceivedTime { get; set; }*/ | ||
|
||
[JsonIgnore] | ||
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "to provide ARM spceific name")] | ||
string INamedObject.Name { get { return Status.Id; } } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Kudu.Contracts.Infrastructure; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Kudu.Contracts.Scan | ||
{ | ||
public class ScanReport : INamedObject | ||
{ | ||
[JsonProperty(PropertyName = "report")] | ||
public ScanDetail Report { get; set; } | ||
|
||
[JsonIgnore] | ||
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "to provide ARM spceific name")] | ||
string INamedObject.Name { get { return Id; } } | ||
|
||
[JsonProperty(PropertyName = "timestamp")] | ||
public DateTime Timestamp { get; set; } | ||
|
||
[JsonIgnore] | ||
public String Id { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Kudu.Contracts.Scan | ||
{ | ||
public enum ScanRequestResult | ||
{ | ||
RunningAynschronously, | ||
RanSynchronously, | ||
Pending, | ||
AsyncScanFailed, | ||
NoFileModifications, | ||
ScanAlreadyInProgress | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Kudu.Contracts.Scan | ||
{ | ||
public enum ScanStatus | ||
{ | ||
Starting, | ||
Executing, | ||
Failed, | ||
TimeoutFailure, | ||
Success, | ||
ForceStopped | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Kudu.Contracts.Infrastructure; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Kudu.Contracts.Scan | ||
{ | ||
public class ScanStatusResult : INamedObject | ||
{ | ||
[JsonProperty(PropertyName = "id")] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty(PropertyName = "status")] | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public ScanStatus Status { get; set; } | ||
|
||
[JsonIgnore] | ||
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "to provide ARM spceific name")] | ||
string INamedObject.Name { get { return Id; } } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Kudu.Contracts.Infrastructure; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Kudu.Contracts.Scan | ||
{ | ||
public class ScanUrl : INamedObject | ||
{ | ||
[JsonProperty(PropertyName = "track_url")] | ||
public String TrackingURL { get; set; } | ||
|
||
[JsonProperty(PropertyName = "result_url")] | ||
public String ResultURL { get; set; } | ||
|
||
[JsonIgnore] | ||
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "to provide ARM spceific name")] | ||
string INamedObject.Name { get { return Id; } } | ||
|
||
[JsonProperty(PropertyName = "id")] | ||
public String Id { get; set; } | ||
|
||
[JsonProperty(PropertyName = "message")] | ||
public String Message { get; set; } | ||
|
||
public ScanUrl(string trackingURL, string resultURL, string id, string msg) | ||
{ | ||
TrackingURL = trackingURL; | ||
ResultURL = resultURL; | ||
Id = id; | ||
Message = msg; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.