├── PITCHME.yaml ├── devaudit.cmd ├── .7zip ├── 7za.exe └── License.txt ├── .nuget ├── nuget.exe ├── nugetv33.exe ├── NuGet.Core.dll ├── nugetv431.exe ├── Microsoft.Web.XmlTransform.dll └── NuGet-COPYRIGHT.txt ├── Dockerfile ├── DevAudit.AuditLibrary ├── Examples │ ├── devaudit.yaml │ ├── packages.config.example.3 │ ├── bower.json.example │ ├── project.1.csproj │ ├── bower.json.2 │ ├── bower.json.example.3 │ ├── my.cnf │ ├── Properties │ │ └── launchSettings.json │ ├── package.json.1 │ ├── composer.json.example.3 │ ├── composer.json.example.1 │ └── bower.json.example.2 ├── Reporters │ ├── ConsoleReporter.cs │ └── Models │ │ ├── IQServerStatus.cs │ │ └── IQServerApplications.cs ├── Base │ ├── IOperatingSystemPackageSource.cs │ ├── IOperatingSystemEnvironment.cs │ ├── IContainerEnvironment.cs │ ├── IPackage.cs │ ├── IDeveloperPackageSource.cs │ ├── IDataSource.cs │ ├── IArtifact.cs │ ├── IVulnerability.cs │ └── AuditFileInfo.cs ├── DataSources │ ├── Vulnersdotcom │ │ └── Models │ │ │ ├── VulnersSearchQuery.cs │ │ │ └── VulnersAuditQuery.cs │ └── OSSIndex3 │ │ ├── OSSIndexApiv3Query.cs │ │ ├── ObjectBinder.cs │ │ └── PackageURL │ │ └── MalformedPackageUrlException.cs ├── Audit │ ├── AuditProfileRule.cs │ ├── HttpException.cs │ ├── DataSourceInfo.cs │ ├── AuditProfile.cs │ └── Vulnerability.cs ├── DevAudit.AuditLibrary.nuspec ├── Environments │ └── Models │ │ └── ProcessInfo.cs ├── Properties │ └── AssemblyInfo.cs └── Serializers │ └── PackageSourceSerializer.cs ├── run-distro-container.sh ├── Expect.NET ├── Properties │ └── AssemblyInfo.cs ├── IMatch.cs ├── changelog.md ├── IResult.cs ├── ISpawnable.cs ├── Expect.cs ├── IProcess.cs ├── Matchers │ ├── StringContainsMatch.cs │ └── RegexMatch.cs ├── ProcessAdapter.cs └── Match.cs ├── BuildCommon ├── devaudit-linux-replace-assembly-version.sh ├── devaudit-run-linux.sh └── Mono.Common.targets ├── Renci.SshNet ├── Properties │ ├── CommonAssemblyInfo.cs │ └── AssemblyInfo.cs ├── Common │ ├── Array.cs │ ├── AuthenticationEventArgs.cs │ ├── ChannelEventArgs.cs │ ├── ExceptionEventArgs.cs │ ├── ChannelRequestEventArgs.cs │ ├── ChannelDataEventArgs.cs │ ├── ObjectIdentifier.cs │ ├── AuthenticationPasswordChangeEventArgs.cs │ ├── ChannelExtendedDataEventArgs.cs │ ├── ShellDataEventArgs.cs │ ├── AuthenticationBannerEventArgs.cs │ ├── ScpUploadEventArgs.cs │ ├── ScpDownloadEventArgs.cs │ ├── ChannelOpenFailedEventArgs.cs │ ├── PortForwardEventArgs.cs │ ├── ChannelOpenConfirmedEventArgs.cs │ ├── AuthenticationPromptEventArgs.cs │ ├── AuthenticationPrompt.cs │ └── HostKeyEventArgs.cs ├── IClientAuthentication.cs ├── Messages │ ├── Transport │ │ ├── IKeyExchangedAllowed.cs │ │ ├── NewKeysMessage.cs │ │ ├── UnimplementedMessage.cs │ │ └── ServiceAcceptMessage.cs │ ├── ServiceName.cs │ ├── Connection │ │ ├── GlobalRequestName.cs │ │ ├── ChannelOpenFailureReasons.cs │ │ ├── RequestFailureMessage.cs │ │ ├── ChannelOpen │ │ │ ├── ChannelOpenInfo.cs │ │ │ └── SessionChannelOpenInfo.cs │ │ ├── ChannelRequest │ │ │ ├── ShellRequestInfo.cs │ │ │ ├── EndOfWriteRequestInfo.cs │ │ │ ├── KeepAliveRequestInfo.cs │ │ │ └── RequestInfo.cs │ │ ├── ChannelEofMessage.cs │ │ ├── ChannelCloseMessage.cs │ │ ├── ChannelFailureMessage.cs │ │ └── ChannelSuccessMessage.cs │ ├── Authentication │ │ ├── RequestMessageNone.cs │ │ ├── SuccessMessage.cs │ │ ├── FailureMessage.cs │ │ └── InformationResponseMessage.cs │ └── MessageAttribute.cs ├── Security │ ├── Algorithm.cs │ ├── Cryptography │ │ ├── AsymmetricCipher.cs │ │ ├── StreamCipher.cs │ │ └── DigitalSignature.cs │ ├── KeyExchangeDiffieHellmanGroupExchangeSha1.cs │ ├── KeyExchangeDiffieHellmanGroupExchangeSha256.cs │ ├── KeyExchangeDiffieHellmanGroup1Sha1.cs │ ├── HostAlgorithm.cs │ ├── KeyExchangeDiffieHellmanGroup14Sha1.cs │ └── CertificateHostAlgorithm.cs ├── IForwardedPort.cs ├── Compression │ ├── CompressionMode.cs │ ├── Zlib.cs │ ├── ZlibOpenSsh.cs │ └── ZlibStream.cs ├── Sftp │ ├── Responses │ │ ├── ExtendedReplies │ │ │ ├── ExtendedReplyInfo.cs │ │ │ └── StatVfsReplyInfo.cs │ │ ├── SftpExtendedReplyResponse.cs │ │ ├── SftpHandleResponse.cs │ │ ├── SftpAttrsResponse.cs │ │ ├── SftpResponse.cs │ │ ├── SftpDataResponse.cs │ │ ├── SftpVersionResponse.cs │ │ ├── StatVfsResponse.cs │ │ ├── SftpStatusResponse.cs │ │ └── SftpNameResponse.cs │ ├── Flags.cs │ ├── Requests │ │ ├── SftpInitRequest.cs │ │ ├── ExtendedRequests │ │ │ ├── FStatVfsRequest.cs │ │ │ ├── StatVfsRequest.cs │ │ │ └── HardLinkRequest.cs │ │ ├── SftpCloseRequest.cs │ │ ├── SftpFStatRequest.cs │ │ ├── SftpReadDirRequest.cs │ │ ├── SftpExtendedRequest.cs │ │ ├── SftpRmDirRequest.cs │ │ ├── SftpRemoveRequest.cs │ │ ├── SftpStatRequest.cs │ │ ├── SftpLStatRequest.cs │ │ ├── SftpOpenDirRequest.cs │ │ ├── SftpReadLinkRequest.cs │ │ ├── SftpUnblockRequest.cs │ │ ├── SftpRealPathRequest.cs │ │ └── SftpReadRequest.cs │ ├── SftpListDirectoryAsyncResult.cs │ ├── SftpSynchronizeDirectoriesAsyncResult.cs │ ├── SftpUploadAsyncResult.cs │ └── SftpDownloadAsyncResult.cs ├── ProxyTypes.cs ├── AuthenticationResult.cs ├── Channels │ ├── ChannelTypes.cs │ ├── IChannelForwardedTcpip.cs │ ├── ServerChannel.cs │ └── IChannelDirectTcpip.cs ├── Matchers │ ├── StringContainsMatch.cs │ └── RegexMatch.cs ├── IMatch.cs ├── ExpectAsyncResult.cs ├── Abstractions │ ├── ReflectionAbstraction.cs │ ├── DiagnosticAbstraction.cs │ ├── ThreadAbstraction.cs │ └── FileSystemAbstraction.cs ├── IServiceFactory.NET.cs ├── Netconf │ └── INetConfSession.cs ├── ServiceFactory.NET.cs ├── IResult.cs ├── MessageEventArgs.cs ├── CipherInfo.cs ├── HashInfo.cs ├── IAuthenticationMethod.cs └── ISubsystemSession.cs ├── docker ├── tests │ ├── run-mysql-container.sh │ ├── run-httpd-container.sh │ └── run-pgsql-container.sh ├── onbuild │ └── Dockerfile └── mono │ └── Dockerfile ├── devaudit ├── NuGet.Config ├── DevAudit.CommandLine ├── VERIFICATION ├── packages.config ├── DevAudit.CommandLine.nuspec ├── LICENSE ├── Properties │ └── AssemblyInfo.cs └── HtmlOutput.cs ├── DevAudit.Tests.VMRequired ├── packages.config └── Properties │ └── AssemblyInfo.cs ├── test.cmd ├── azure-test-pipeline.yml ├── azure-dev-test-pipeline.yml ├── DevAudit.Tests ├── packages.config ├── Properties │ └── AssemblyInfo.cs └── Environments │ └── GitHubEnvironmentTests.cs └── LICENSE /PITCHME.yaml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /devaudit.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | .\DevAudit.CommandLine\bin\Debug\devaudit.exe %* 3 | :end -------------------------------------------------------------------------------- /.7zip/7za.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype-nexus-community/DevAudit/HEAD/.7zip/7za.exe -------------------------------------------------------------------------------- /.nuget/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype-nexus-community/DevAudit/HEAD/.nuget/nuget.exe -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ossindex/devaudit-onbuild:latest 2 | ENV DOCKER=1 3 | ENTRYPOINT [ "./devaudit"] 4 | -------------------------------------------------------------------------------- /.nuget/nugetv33.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype-nexus-community/DevAudit/HEAD/.nuget/nugetv33.exe -------------------------------------------------------------------------------- /.nuget/NuGet.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype-nexus-community/DevAudit/HEAD/.nuget/NuGet.Core.dll -------------------------------------------------------------------------------- /.nuget/nugetv431.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype-nexus-community/DevAudit/HEAD/.nuget/nugetv431.exe -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/devaudit.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - category: exclude 3 | target: nuget 4 | match_name: log\w* 5 | 6 | -------------------------------------------------------------------------------- /run-distro-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker run -d --name oraclelinux6 oraclelinux:6 /bin/bash -c "while true; do sleep 1; done" -------------------------------------------------------------------------------- /.nuget/Microsoft.Web.XmlTransform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype-nexus-community/DevAudit/HEAD/.nuget/Microsoft.Web.XmlTransform.dll -------------------------------------------------------------------------------- /Expect.NET/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype-nexus-community/DevAudit/HEAD/Expect.NET/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /BuildCommon/devaudit-linux-replace-assembly-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sed -i -r 's/Version\("[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?"\)/Version\("'$2'"\)/' $1 -------------------------------------------------------------------------------- /Renci.SshNet/Properties/CommonAssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype-nexus-community/DevAudit/HEAD/Renci.SshNet/Properties/CommonAssemblyInfo.cs -------------------------------------------------------------------------------- /docker/tests/run-mysql-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=root mysql/mysql-server:latest 3 | ./devaudit mysql -i mysql -r / -c /etc/my.cnf -------------------------------------------------------------------------------- /Renci.SshNet/Common/Array.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Common 2 | { 3 | internal static class Array 4 | { 5 | public static readonly T[] Empty = new T[0]; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /BuildCommon/devaudit-run-linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [[ ${DEVAUDIT_TRACE+x} ]] 3 | then 4 | mono --trace=$DEVAUDIT_TRACE ./devaudit.exe "$@" 5 | else 6 | mono --debug ./devaudit.exe "$@" 7 | fi 8 | -------------------------------------------------------------------------------- /docker/tests/run-httpd-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker run -dit --name httpd-2.2 httpd:2.2 3 | ./devaudit httpd -i httpd-2.2 -r / -c /usr/local/apache2/conf/httpd.conf -b /usr/local/apache2/bin/httpd -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/packages.config.example.3: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Renci.SshNet/IClientAuthentication.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet 2 | { 3 | internal interface IClientAuthentication 4 | { 5 | void Authenticate(IConnectionInfoInternal connectionInfo, ISession session); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /devaudit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [[ ${DEVAUDIT_TRACE+x} ]] 3 | then 4 | mono --trace=$DEVAUDIT_TRACE ./DevAudit.CommandLine/bin/Debug/devaudit.exe "$@" 5 | else 6 | mono --debug ./DevAudit.CommandLine/bin/Debug/devaudit.exe "$@" 7 | fi 8 | -------------------------------------------------------------------------------- /docker/tests/run-pgsql-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker run --name pgsql1 -e POSTGRES_PASSWORD=postgres -d postgres:9.2 3 | ./devaudit pgsql -i pgsql1 -c /var/lib/postgresql/data/postgresql.conf --skip-packages-audit -o AppUser=postgres,OSUser=postgres -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/bower.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ASP.NET", 3 | "private": true, 4 | "dependencies": { 5 | "jquery": "1.6.1", 6 | "jquery-validation": "1.14.0", 7 | "jquery-validation-unobtrusive": "3.2.4", 8 | "semantic-ui": "~2.1.6" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Reporters/ConsoleReporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary.Reporters 8 | { 9 | class ConsoleReporter 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Expect.NET/IMatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ExpectNet 7 | { 8 | public interface IMatch : IResult 9 | { 10 | bool Execute(string text); 11 | string Query { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/IOperatingSystemPackageSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public interface IOperatingSystemPackageSource 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Transport/IKeyExchangedAllowed.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Transport 2 | { 3 | /// 4 | /// Indicates that message that implement this interface is allowed during key exchange phase 5 | /// 6 | public interface IKeyExchangedAllowed 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Expect.NET/changelog.md: -------------------------------------------------------------------------------- 1 | ## Version 2.1.0 2 | Added Expect methods accepting regular expressions. 3 | 4 | ## Version 2.0.1 5 | Changed expected string matching method. Switched from Regex (which may be confusing) to regular string matching. 6 | 7 | ## Version 2.0.0 8 | Redesigned API, fixed problems with VB.NET. 9 | Changes are not backward compatible. 10 | 11 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Reporters/Models/IQServerStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary.Reporters.Models 8 | { 9 | public class IQServerStatus 10 | { 11 | public string statusUrl { get; set; } 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/IOperatingSystemEnvironment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public interface IOperatingSystemEnvironment 10 | { 11 | string GetOSName(); 12 | string GetOSVersion(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Expect.NET/IResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ExpectNet 8 | { 9 | public interface IResult 10 | { 11 | bool IsMatch { get; } 12 | object Result { get; } 13 | string Text { get; } 14 | int? Count { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DevAudit.CommandLine/VERIFICATION: -------------------------------------------------------------------------------- 1 | VERIFICATION 2 | Verification is intended to assist the Chocolatey moderators and community 3 | in verifying that this package's contents are trustworthy. 4 | This package is published by the DevAudit Project itself. Any binaries will be 5 | identical to other package types published by the project, in particular 6 | the DevAudit*.zip and DevAudit*.tar.gz packages on GitHub. -------------------------------------------------------------------------------- /Renci.SshNet/Security/Algorithm.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Security 2 | { 3 | /// 4 | /// Represents the abstract base class from which all implementations of algorithms must inherit. 5 | /// 6 | public abstract class Algorithm 7 | { 8 | /// 9 | /// Gets algorithm name. 10 | /// 11 | public abstract string Name { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Renci.SshNet/IForwardedPort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet 4 | { 5 | /// 6 | /// Supports port forwarding functionality. 7 | /// 8 | public interface IForwardedPort 9 | { 10 | /// 11 | /// The event occurs as the forwarded port is being stopped. 12 | /// 13 | event EventHandler Closing; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Expect.NET/ISpawnable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace ExpectNet 9 | { 10 | public interface ISpawnable 11 | { 12 | void Init(); 13 | 14 | void Write(string command); 15 | 16 | string Read(out bool complete); 17 | 18 | Task ReadAsync(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Expect.NET/Expect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ExpectNet 8 | { 9 | public class Expect 10 | { 11 | public static Session Spawn(ISpawnable spawnable, string line_terminator) 12 | { 13 | spawnable.Init(); 14 | return new Session(spawnable, line_terminator); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/ServiceName.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages 2 | { 3 | /// 4 | /// Specifies list of supported services 5 | /// 6 | public enum ServiceName 7 | { 8 | /// 9 | /// ssh-userauth 10 | /// 11 | UserAuthentication, 12 | 13 | /// 14 | /// ssh-connection 15 | /// 16 | Connection 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/IContainerEnvironment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public interface IContainerEnvironment 10 | { 11 | Tuple GetContainerStatus(string container_id); 12 | bool ExecuteCommandInContainer(string command, string arguments, out string process_output); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/project.1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp2.1 4 | 7.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Expect.NET/IProcess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace ExpectNet 9 | { 10 | interface IProcess 11 | { 12 | ProcessStartInfo StartInfo { get; } 13 | StreamReader StandardOutput { get; } 14 | StreamReader StandardError { get; } 15 | StreamWriter StandardInput { get; } 16 | void Start(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/GlobalRequestName.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// Specifies supported request names. 5 | /// 6 | public enum GlobalRequestName 7 | { 8 | /// 9 | /// tcpip-forward 10 | /// 11 | TcpIpForward, 12 | /// 13 | /// cancel-tcpip-forward 14 | /// 15 | CancelTcpIpForward, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/IPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public interface IPackage 10 | { 11 | 12 | string PackageManager { get; set; } 13 | 14 | string Name { get; set; } 15 | 16 | string Version { get; set; } 17 | 18 | string Group { get; set; } 19 | 20 | string Vendor { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Renci.SshNet/Compression/CompressionMode.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Compression 2 | { 3 | /// 4 | /// Specifies compression modes 5 | /// 6 | public enum CompressionMode 7 | { 8 | /// 9 | /// Specifies that content should be compressed. 10 | /// 11 | Compress = 0, 12 | 13 | /// 14 | /// Specifies that content should be decompressed. 15 | /// 16 | Decompress = 1, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/ExtendedReplies/ExtendedReplyInfo.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Common; 2 | using System; 3 | 4 | namespace Renci.SshNet.Sftp.Responses 5 | { 6 | internal abstract class ExtendedReplyInfo : SshData 7 | { 8 | protected override void LoadData() 9 | { 10 | // skip response id 11 | ReadUInt32(); 12 | } 13 | 14 | protected override void SaveData() 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Renci.SshNet/ProxyTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet 2 | { 3 | /// 4 | /// Specifies the type of proxy client will use to connect to server. 5 | /// 6 | public enum ProxyTypes 7 | { 8 | /// No proxy server. 9 | None, 10 | /// A SOCKS4 proxy server. 11 | Socks4, 12 | /// A SOCKS5 proxy server. 13 | Socks5, 14 | /// A HTTP proxy server. 15 | Http, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Renci.SshNet/Security/Cryptography/AsymmetricCipher.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Security.Cryptography 2 | { 3 | /// 4 | /// Base class for asymmetric cipher implementations. 5 | /// 6 | public abstract class AsymmetricCipher : Cipher 7 | { 8 | /// 9 | /// Gets the minimum data size. 10 | /// 11 | /// 12 | /// The minimum data size. 13 | /// 14 | public override byte MinimumSize 15 | { 16 | get { return 0; } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/DataSources/Vulnersdotcom/Models/VulnersSearchQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public class VulnersSearchQuery 10 | { 11 | public VulnersSearchQuery(string[] id, bool references) 12 | { 13 | this.id = id; 14 | this.references = references; 15 | } 16 | public string[] id { get; set; } 17 | public bool references { get; set; } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeSha1.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Security 2 | { 3 | /// 4 | /// Represents "diffie-hellman-group-exchange-sha1" algorithm implementation. 5 | /// 6 | public class KeyExchangeDiffieHellmanGroupExchangeSha1 : KeyExchangeDiffieHellmanGroupExchangeShaBase 7 | { 8 | /// 9 | /// Gets algorithm name. 10 | /// 11 | public override string Name 12 | { 13 | get { return "diffie-hellman-group-exchange-sha1"; } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Renci.SshNet/AuthenticationResult.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet 2 | { 3 | /// 4 | /// Represents possible authentication methods results 5 | /// 6 | public enum AuthenticationResult 7 | { 8 | /// 9 | /// Authentication was successful. 10 | /// 11 | Success, 12 | /// 13 | /// Authentication completed with partial success. 14 | /// 15 | PartialSuccess, 16 | /// 17 | /// Authentication failed. 18 | /// 19 | Failure 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/bower.json.2: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-app", 3 | "version": "0.0.1", 4 | "main": "public/javascripts/app.js", 5 | "ignore": [ 6 | "**/.*", 7 | "node_modules", 8 | "bower_components" 9 | ], 10 | "dependencies": { 11 | "chaplin": "~0.11.0", 12 | "console-polyfill": "~0.1.0", 13 | "lodash": "~2.1.0", 14 | "jquery": "~2.0.2", 15 | "normalize-css": "~2.1.2" 16 | }, 17 | "overrides": { 18 | "backbone": { 19 | "dependencies": { 20 | "lodash": "*", 21 | "jquery": "*" 22 | }, 23 | "main": "backbone.js" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/DataSources/OSSIndex3/OSSIndexApiv3Query.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace DevAudit.AuditLibrary 4 | { 5 | internal class OSSIndexApiv3Query 6 | { 7 | public List coordinates { get; set; } 8 | 9 | public OSSIndexApiv3Query() 10 | { 11 | coordinates = new List(); 12 | } 13 | 14 | public List getCoordinates() 15 | { 16 | return coordinates; 17 | } 18 | 19 | public void addCoordinate(string coord) 20 | { 21 | coordinates.Add(coord); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/bower.json.example.3: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-app", 3 | "version": "0.0.1", 4 | "main": "public/javascripts/app.js", 5 | "ignore": [ 6 | "**/.*", 7 | "node_modules", 8 | "bower_components" 9 | ], 10 | "dependencies": { 11 | "chaplin": "~0.11.0", 12 | "console-polyfill": "~0.1.0", 13 | "lodash": "~2.1.0", 14 | "jquery": "~2.0.2", 15 | "normalize-css": "~2.1.2" 16 | }, 17 | "overrides": { 18 | "backbone": { 19 | "dependencies": { 20 | "lodash": "*", 21 | "jquery": "*" 22 | }, 23 | "main": "backbone.js" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /docker/onbuild/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ossindex/devaudit-mono:latest 2 | 3 | MAINTAINER Allister Beharry 4 | 5 | ONBUILD RUN mkdir -p /usr/src/app/source /usr/src/app/build/DevAudit.CommandLine /usr/src/app/build/Analyzers /usr/src/app/build/Rules /usr/src/app/build/Examples 6 | ONBUILD WORKDIR /usr/src/app/build 7 | ONBUILD COPY ./DevAudit.CommandLine /usr/src/app/build/DevAudit.CommandLine 8 | ONBUILD COPY ./Examples /usr/src/app/build/Examples 9 | ONBUILD COPY ./DevAudit.CommandLine/chunky.flf /usr/src/app/build 10 | ONBUILD COPY ./LICENSE /usr/src/app/build 11 | ONBUILD COPY ./devaudit /usr/src/app/build 12 | 13 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/SftpExtendedReplyResponse.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Common; 2 | 3 | namespace Renci.SshNet.Sftp.Responses 4 | { 5 | internal class SftpExtendedReplyResponse : SftpResponse 6 | { 7 | public override SftpMessageTypes SftpMessageType 8 | { 9 | get { return SftpMessageTypes.ExtendedReply; } 10 | } 11 | 12 | public SftpExtendedReplyResponse(uint protocolVersion) 13 | : base(protocolVersion) 14 | { 15 | } 16 | 17 | public T GetReply() where T : SshData, new() 18 | { 19 | return OfType(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.nuget/NuGet-COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010-2012 Outercurve Foundation 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /Renci.SshNet/Channels/ChannelTypes.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Renci.SshNet.Channels 3 | { 4 | /// 5 | /// Lists channel types as defined by the protocol. 6 | /// 7 | internal enum ChannelTypes 8 | { 9 | /// 10 | /// session 11 | /// 12 | Session, 13 | /// 14 | /// x11 15 | /// 16 | X11, 17 | /// 18 | /// forwarded-tcpip 19 | /// 20 | ForwardedTcpip, 21 | /// 22 | /// direct-tcpip 23 | /// 24 | DirectTcpip 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DevAudit.Tests.VMRequired/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Expect.NET/Matchers/StringContainsMatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ExpectNet.NET 8 | { 9 | class StringContainsMatch : Match 10 | { 11 | public StringContainsMatch(string query) : base(query) {} 12 | 13 | public override bool Execute(string text) 14 | { 15 | this._IsMatch = text.Contains(Query); 16 | this._Text = text; 17 | this._Result = this._IsMatch ? text : null; 18 | this._Count = this._IsMatch ? 1 : 0; 19 | return this._IsMatch; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Renci.SshNet/Matchers/StringContainsMatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ExpectNet.NET 8 | { 9 | class StringContainsMatch : Match 10 | { 11 | public StringContainsMatch(string query) : base(query) {} 12 | 13 | public override bool Execute(string text) 14 | { 15 | this._IsMatch = text.Contains(Query); 16 | this._Text = text; 17 | this._Result = this._IsMatch ? text : null; 18 | this._Count = this._IsMatch ? 1 : 0; 19 | return this._IsMatch; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/SftpHandleResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Sftp.Responses 2 | { 3 | internal class SftpHandleResponse : SftpResponse 4 | { 5 | public override SftpMessageTypes SftpMessageType 6 | { 7 | get { return SftpMessageTypes.Handle; } 8 | } 9 | 10 | public byte[] Handle { get; private set; } 11 | 12 | public SftpHandleResponse(uint protocolVersion) 13 | : base(protocolVersion) 14 | { 15 | } 16 | 17 | protected override void LoadData() 18 | { 19 | base.LoadData(); 20 | 21 | Handle = ReadBinary(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/SftpAttrsResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Sftp.Responses 2 | { 3 | internal class SftpAttrsResponse : SftpResponse 4 | { 5 | public override SftpMessageTypes SftpMessageType 6 | { 7 | get { return SftpMessageTypes.Attrs; } 8 | } 9 | 10 | public SftpFileAttributes Attributes { get; private set; } 11 | 12 | public SftpAttrsResponse(uint protocolVersion) 13 | : base(protocolVersion) 14 | { 15 | } 16 | 17 | protected override void LoadData() 18 | { 19 | base.LoadData(); 20 | Attributes = ReadAttributes(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | @setlocal 3 | set ERROR_CODE=0 4 | .\.nuget\nuget.exe restore DevAudit.sln 5 | if not %ERRORLEVEL%==0 ( 6 | echo Error restoring NuGet packages for DevAudit.sln. 7 | set ERROR_CODE=1 8 | goto End 9 | ) 10 | 11 | if [%1]==[] ( 12 | packages\xunit.runner.console.2.4.1\tools\net46\xunit.console DevAudit.Tests\bin\Debug\DevAudit.Tests.dll 13 | ) else ( 14 | packages\xunit.runner.console.2.4.1\tools\net46\xunit.console DevAudit.Tests\bin\Debug\DevAudit.Tests.dll %* 15 | ) 16 | 17 | 18 | if not %ERRORLEVEL%==0 ( 19 | echo Error building DevAudit.sln. 20 | set ERROR_CODE=2 21 | goto End 22 | ) 23 | 24 | :End 25 | @endlocal 26 | exit /B %ERROR_CODE% -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/my.cnf: -------------------------------------------------------------------------------- 1 | 2 | [client] 3 | default-character-set=UTF8 4 | 5 | [mysqladmin] 6 | user=root 7 | port=3306 8 | 9 | # The MySQL server 10 | [mysqld] 11 | # set basedir to your installation path 12 | basedir=C:/Bitnami/WAMPST~1.18-/mysql 13 | # set datadir to the location of your data directory 14 | datadir=C:/Bitnami/WAMPST~1.18-/mysql/data 15 | port=3306 16 | character-set-server=UTF8 17 | collation-server=utf8_general_ci 18 | max_allowed_packet=16M 19 | bind-address=127.0.0.1 20 | # The default storage engine that will be used when create new tables when 21 | default-storage-engine=INNODB 22 | 23 | [mysqldump] 24 | max_allowed_packet=16M 25 | 26 | [mysql] 27 | port=3306 28 | 29 | -------------------------------------------------------------------------------- /Renci.SshNet/Security/Cryptography/StreamCipher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Security.Cryptography 4 | { 5 | /// 6 | /// Base class of stream cipher algorithms. 7 | /// 8 | public abstract class StreamCipher : SymmetricCipher 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The key. 14 | /// is null. 15 | protected StreamCipher(byte[] key) 16 | : base(key) 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Renci.SshNet/IMatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Renci.SshNet 7 | { 8 | /// 9 | /// Interface for a matching operation performed against text. 10 | /// 11 | public interface IMatch : IResult 12 | { 13 | /// 14 | /// Execute the match operation against the text. 15 | /// 16 | /// 17 | /// 18 | bool Execute(string text); 19 | /// 20 | /// The query for the match operation. 21 | /// 22 | string Query { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/IDeveloperPackageSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public interface IDeveloperPackageSource 10 | { 11 | string DefaultPackageSourceLockFile { get; } 12 | 13 | string PackageSourceLockFile {get; set;} 14 | 15 | bool PackageVersionIsRange(string version); 16 | 17 | List GetMinimumPackageVersions(string version); 18 | 19 | List GetDeveloperPackages(string name, string version, string vendor = null, string group = null, 20 | string architecture = null); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /docker/mono/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:sid-slim 2 | 3 | #based on Dockerfile by Jo Shields 4 | 5 | MAINTAINER Allister Beharry 6 | 7 | RUN apt-get update \ 8 | && apt-get install -y curl apt-transport-https dirmngr gnupg gnupg2 gnupg1 \ 9 | && rm -rf /var/lib/apt/lists/* 10 | 11 | RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF 12 | 13 | RUN echo "deb https://download.mono-project.com/repo/debian preview-stretch main" | tee /etc/apt/sources.list.d/mono-official-stable.list \ 14 | && apt-get update \ 15 | && apt-get install -y binutils mono-devel ca-certificates-mono \ 16 | && rm -rf /var/lib/apt/lists/* /tmp/* 17 | 18 | -------------------------------------------------------------------------------- /Renci.SshNet/Compression/Zlib.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Compression 2 | { 3 | /// 4 | /// Represents "zlib" compression implementation 5 | /// 6 | internal class Zlib : Compressor 7 | { 8 | /// 9 | /// Gets algorithm name. 10 | /// 11 | public override string Name 12 | { 13 | get { return "zlib"; } 14 | } 15 | 16 | /// 17 | /// Initializes the algorithm 18 | /// 19 | /// The session. 20 | public override void Init(Session session) 21 | { 22 | base.Init(session); 23 | IsActive = true; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Renci.SshNet/ExpectAsyncResult.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Common; 2 | using System; 3 | 4 | namespace Renci.SshNet 5 | { 6 | /// 7 | /// Provides additional information for asynchronous command execution 8 | /// 9 | public class ExpectAsyncResult : AsyncResult 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | /// The async callback. 15 | /// The state. 16 | internal ExpectAsyncResult(AsyncCallback asyncCallback, Object state) 17 | : base(asyncCallback, state) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DevAudit.CommandLine/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Authentication/RequestMessageNone.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Authentication 2 | { 3 | /// 4 | /// Represents "none" SSH_MSG_USERAUTH_REQUEST message. 5 | /// 6 | internal class RequestMessageNone : RequestMessage 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// Name of the service. 12 | /// Authentication username. 13 | public RequestMessageNone(ServiceName serviceName, string username) 14 | : base(serviceName, username, "none") 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/AuthenticationEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Base class for authentication events. 7 | /// 8 | public abstract class AuthenticationEventArgs : EventArgs 9 | { 10 | /// 11 | /// Gets the username. 12 | /// 13 | public string Username { get; private set; } 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The username. 19 | protected AuthenticationEventArgs(string username) 20 | { 21 | Username = username; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ChannelEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Base class for all channel related events. 7 | /// 8 | internal class ChannelEventArgs : EventArgs 9 | { 10 | /// 11 | /// Gets the channel number. 12 | /// 13 | public uint ChannelNumber { get; private set; } 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The channel number. 19 | public ChannelEventArgs(uint channelNumber) 20 | { 21 | ChannelNumber = channelNumber; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Renci.SshNet/Abstractions/ReflectionAbstraction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | #if FEATURE_REFLECTION_TYPEINFO 5 | using System.Reflection; 6 | #endif // FEATURE_REFLECTION_TYPEINFO 7 | 8 | namespace Renci.SshNet.Abstractions 9 | { 10 | internal static class ReflectionAbstraction 11 | { 12 | public static IEnumerable GetCustomAttributes(this Type type, bool inherit) 13 | where T:Attribute 14 | { 15 | #if FEATURE_REFLECTION_TYPEINFO 16 | return type.GetTypeInfo().GetCustomAttributes(inherit); 17 | #else 18 | var attributes = type.GetCustomAttributes(typeof(T), inherit); 19 | return new List(attributes.Cast()); 20 | #endif 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Renci.SshNet/IServiceFactory.NET.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.NetConf; 3 | 4 | namespace Renci.SshNet 5 | { 6 | internal partial interface IServiceFactory 7 | { 8 | /// 9 | /// Creates a new in a given 10 | /// and with the specified operation timeout. 11 | /// 12 | /// The to create the in. 13 | /// The operation timeout. 14 | /// 15 | /// An . 16 | /// 17 | INetConfSession CreateNetConfSession(ISession session, TimeSpan operationTimeout); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/SftpResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Sftp.Responses 4 | { 5 | internal abstract class SftpResponse : SftpMessage 6 | { 7 | public uint ResponseId { get; private set; } 8 | 9 | public uint ProtocolVersion { get; private set; } 10 | 11 | protected SftpResponse(uint protocolVersion) 12 | { 13 | ProtocolVersion = protocolVersion; 14 | } 15 | 16 | protected override void LoadData() 17 | { 18 | base.LoadData(); 19 | 20 | ResponseId = ReadUInt32(); 21 | } 22 | 23 | protected override void SaveData() 24 | { 25 | throw new InvalidOperationException("Response cannot be saved."); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/IDataSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public interface IDataSource 10 | { 11 | #region Public methods 12 | Task>> SearchArtifacts(List packages); 13 | Task>> SearchVulnerabilities(List packages); 14 | bool IsEligibleForTarget(AuditTarget target); 15 | #endregion 16 | 17 | #region Public properties 18 | bool Initialised { get; } 19 | int MaxConcurrentSearches { get; } 20 | DataSourceInfo Info { get; set; } 21 | #endregion 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:53976/", 7 | "sslPort": 44355 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "project.1": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Renci.SshNet/Netconf/INetConfSession.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | 3 | namespace Renci.SshNet.NetConf 4 | { 5 | internal interface INetConfSession : ISubsystemSession 6 | { 7 | /// 8 | /// Gets the NetConf server capabilities. 9 | /// 10 | /// 11 | /// The NetConf server capabilities. 12 | /// 13 | XmlDocument ServerCapabilities { get; } 14 | 15 | /// 16 | /// Gets the NetConf client capabilities. 17 | /// 18 | /// 19 | /// The NetConf client capabilities. 20 | /// 21 | XmlDocument ClientCapabilities { get; } 22 | 23 | XmlDocument SendReceiveRpc(XmlDocument rpc, bool automaticMessageIdHandling); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DevAudit.CommandLine/DevAudit.CommandLine.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DevAudit.CLI 5 | 3.2.0-beta 6 | DevAudit AuditLibrary 7 | Sonatype OSS Index 8 | Sonatype OSS Index 9 | https://github.com/OSSIndex/DevAudit/LICENSE 10 | https://github.com/OSSIndex/DevAudit/ 11 | false 12 | Open-source, cross-platform, multi-purpose security auditing tool - command line interface 13 | Initial NuGet release. 14 | Copyright ©2019 Sonatype 15 | Security Auditing 16 | 17 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Audit/AuditProfileRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using YamlDotNet.Serialization; 8 | 9 | namespace DevAudit.AuditLibrary 10 | { 11 | public class AuditProfileRule 12 | { 13 | [YamlMember(Alias = "title")] 14 | public string Title { get; set; } 15 | 16 | [YamlMember(Alias = "target")] 17 | public string Target { get; set; } 18 | 19 | [YamlMember(Alias = "category")] 20 | public string Category { get; set; } 21 | 22 | [YamlMember(Alias = "match_name")] 23 | public string MatchName { get; set; } 24 | 25 | [YamlMember(Alias = "match_version")] 26 | public string MatchVersion { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/DevAudit.AuditLibrary.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DevAudit.Auditlibrary 5 | 3.2.0-beta 6 | DevAudit AuditLibrary 7 | Sonatype OSS Index 8 | Sonatype OSS Index 9 | https://github.com/OSSIndex/DevAudit/LICENSE 10 | https://github.com/OSSIndex/DevAudit/ 11 | false 12 | Open-source, cross-platform, multi-purpose security auditing tool - core audit library 13 | Initial NuGet release. 14 | Copyright ©2019 Sonatype 15 | Security Auditing 16 | 17 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelOpenFailureReasons.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// List channel open failure reasons defined by the protocol. 5 | /// 6 | internal enum ChannelOpenFailureReasons : uint 7 | { 8 | /// 9 | /// SSH_OPEN_ADMINISTRATIVELY_PROHIBITED 10 | /// 11 | AdministativelyProhibited = 1, 12 | /// 13 | /// SSH_OPEN_CONNECT_FAILED 14 | /// 15 | ConnectFailed = 2, 16 | /// 17 | /// SSH_OPEN_UNKNOWN_CHANNEL_TYPE 18 | /// 19 | UnknownChannelType = 3, 20 | /// 21 | /// SSH_OPEN_RESOURCE_SHORTAGE 22 | /// 23 | ResourceShortage = 4 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/SftpDataResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Sftp.Responses 2 | { 3 | internal class SftpDataResponse : SftpResponse 4 | { 5 | public override SftpMessageTypes SftpMessageType 6 | { 7 | get { return SftpMessageTypes.Data; } 8 | } 9 | 10 | public byte[] Data { get; private set; } 11 | 12 | public bool IsEof { get; private set; } 13 | 14 | public SftpDataResponse(uint protocolVersion) 15 | : base(protocolVersion) 16 | { 17 | } 18 | 19 | protected override void LoadData() 20 | { 21 | base.LoadData(); 22 | 23 | Data = ReadBinary(); 24 | 25 | if (!IsEndOfData) 26 | { 27 | IsEof = ReadBoolean(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ExceptionEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Provides data for the ErrorOccured events. 7 | /// 8 | public class ExceptionEventArgs : EventArgs 9 | { 10 | /// 11 | /// Gets the System.Exception that represents the error that occurred. 12 | /// 13 | public Exception Exception { get; private set; } 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// An System.Exception that represents the error that occurred. 19 | public ExceptionEventArgs(Exception exception) 20 | { 21 | Exception = exception; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Transport/NewKeysMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Transport 2 | { 3 | /// 4 | /// Represents SSH_MSG_NEWKEYS message. 5 | /// 6 | [Message("SSH_MSG_NEWKEYS", 21)] 7 | public class NewKeysMessage : Message, IKeyExchangedAllowed 8 | { 9 | /// 10 | /// Called when type specific data need to be loaded. 11 | /// 12 | protected override void LoadData() 13 | { 14 | } 15 | 16 | /// 17 | /// Called when type specific data need to be saved. 18 | /// 19 | protected override void SaveData() 20 | { 21 | } 22 | 23 | internal override void Process(Session session) 24 | { 25 | session.OnNewKeysReceived(this); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ChannelRequestEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Messages.Connection; 3 | 4 | namespace Renci.SshNet.Common 5 | { 6 | /// 7 | /// Provides data for event. 8 | /// 9 | internal class ChannelRequestEventArgs : EventArgs 10 | { 11 | /// 12 | /// Gets request information. 13 | /// 14 | public RequestInfo Info { get; private set; } 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// Request information. 20 | public ChannelRequestEventArgs(RequestInfo info) 21 | { 22 | Info = info; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Environments/Models/ProcessInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public class ProcessInfo 10 | { 11 | #region Constructors 12 | public ProcessInfo(string user, int pid, string start_time, string cmd_line) 13 | { 14 | this.User = user; 15 | this.Pid = pid; 16 | this.CommandLine = cmd_line; 17 | this.StartTime = start_time; 18 | } 19 | #endregion 20 | 21 | #region Properties 22 | public string User { get; set; } 23 | public int Pid { get; set; } 24 | public string CommandLine { get; set; } 25 | public string StartTime { get; set; } 26 | #endregion 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Expect.NET/Matchers/RegexMatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Re = System.Text.RegularExpressions; 6 | 7 | namespace ExpectNet.NET 8 | { 9 | class RegexMatch : Match 10 | { 11 | private Re.Regex RegEx; 12 | 13 | public RegexMatch(string query) : base(query) 14 | { 15 | this.RegEx = new Re.Regex(query, Re.RegexOptions.Singleline); 16 | } 17 | 18 | public override bool Execute(string text) 19 | { 20 | this._Text = text; 21 | Re.Match m = this.RegEx.Match(text); 22 | this._IsMatch = m.Success; 23 | this._Result = this._IsMatch ? m : null; 24 | this._Count = this._IsMatch ? m.Groups.Count : 0; 25 | return this._IsMatch; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Renci.SshNet/Matchers/RegexMatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Re = System.Text.RegularExpressions; 6 | 7 | namespace ExpectNet.NET 8 | { 9 | class RegexMatch : Match 10 | { 11 | private Re.Regex RegEx; 12 | 13 | public RegexMatch(string query) : base(query) 14 | { 15 | this.RegEx = new Re.Regex(query, Re.RegexOptions.Singleline); 16 | } 17 | 18 | public override bool Execute(string text) 19 | { 20 | this._Text = text; 21 | Re.Match m = this.RegEx.Match(text); 22 | this._IsMatch = m.Success; 23 | this._Result = this._IsMatch ? m : null; 24 | this._Count = this._IsMatch ? m.Groups.Count : 0; 25 | return this._IsMatch; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Authentication/SuccessMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Authentication 2 | { 3 | /// 4 | /// Represents SSH_MSG_USERAUTH_SUCCESS message. 5 | /// 6 | [Message("SSH_MSG_USERAUTH_SUCCESS", 52)] 7 | public class SuccessMessage : Message 8 | { 9 | /// 10 | /// Called when type specific data need to be loaded. 11 | /// 12 | protected override void LoadData() 13 | { 14 | } 15 | 16 | /// 17 | /// Called when type specific data need to be saved. 18 | /// 19 | protected override void SaveData() 20 | { 21 | } 22 | 23 | internal override void Process(Session session) 24 | { 25 | session.OnUserAuthenticationSuccessReceived(this); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/RequestFailureMessage.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Renci.SshNet.Messages.Connection 3 | { 4 | /// 5 | /// Represents SSH_MSG_REQUEST_FAILURE message. 6 | /// 7 | [Message("SSH_MSG_REQUEST_FAILURE", 82)] 8 | public class RequestFailureMessage : Message 9 | { 10 | /// 11 | /// Called when type specific data need to be loaded. 12 | /// 13 | protected override void LoadData() 14 | { 15 | } 16 | 17 | /// 18 | /// Called when type specific data need to be saved. 19 | /// 20 | protected override void SaveData() 21 | { 22 | } 23 | 24 | internal override void Process(Session session) 25 | { 26 | session.OnRequestFailureReceived(this); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ChannelDataEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Common 2 | { 3 | /// 4 | /// Provides data for event. 5 | /// 6 | internal class ChannelDataEventArgs : ChannelEventArgs 7 | { 8 | /// 9 | /// Gets channel data. 10 | /// 11 | public byte[] Data { get; private set; } 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | /// Channel number. 17 | /// Channel data. 18 | public ChannelDataEventArgs(uint channelNumber, byte[] data) 19 | : base(channelNumber) 20 | { 21 | Data = data; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Renci.SshNet/ServiceFactory.NET.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.NetConf; 3 | 4 | namespace Renci.SshNet 5 | { 6 | internal partial class ServiceFactory 7 | { 8 | /// 9 | /// Creates a new in a given 10 | /// and with the specified operation timeout. 11 | /// 12 | /// The to create the in. 13 | /// The operation timeout. 14 | /// 15 | /// An . 16 | /// 17 | public INetConfSession CreateNetConfSession(ISession session, TimeSpan operationTimeout) 18 | { 19 | return new NetConfSession(session, operationTimeout); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Flags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Sftp 4 | { 5 | [Flags] 6 | internal enum Flags 7 | { 8 | None = 0x00000000, 9 | /// 10 | /// SSH_FXF_READ 11 | /// 12 | Read = 0x00000001, 13 | /// 14 | /// SSH_FXF_WRITE 15 | /// 16 | Write = 0x00000002, 17 | /// 18 | /// SSH_FXF_APPEND 19 | /// 20 | Append = 0x00000004, 21 | /// 22 | /// SSH_FXF_CREAT 23 | /// 24 | CreateNewOrOpen = 0x00000008, 25 | /// 26 | /// SSH_FXF_TRUNC 27 | /// 28 | Truncate = 0x00000010, 29 | /// 30 | /// SSH_FXF_EXCL 31 | /// 32 | CreateNew = 0x00000028 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/package.json.1: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phaser3-examples", 3 | "version": "1.0.0", 4 | "description": "Phaser 3 Examples", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/photonstorm/phaser3-examples.git" 12 | }, 13 | "author": "", 14 | "license": "ISC", 15 | "bugs": { 16 | "url": "https://github.com/photonstorm/phaser3-examples/issues" 17 | }, 18 | "homepage": "https://github.com/photonstorm/phaser3-examples#readme", 19 | "devDependencies": { 20 | "http-server": "^0.9.0", 21 | "monaco-editor": "^0.8.0", 22 | }, 23 | "dependencies": { 24 | "directory-tree": "^1.2.0", 25 | "module-ui-DSDEditor": "git+https://FDCV2FAF3EV4567*:x-oauth-basic@github.com/modules-lib/module-ui-DSDEditor.git" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ObjectIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Describes object identifier for DER encoding 7 | /// 8 | public struct ObjectIdentifier 9 | { 10 | /// 11 | /// Gets the object identifier. 12 | /// 13 | public ulong[] Identifiers { get; private set; } 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The identifiers. 19 | public ObjectIdentifier(params ulong[] identifiers) 20 | : this() 21 | { 22 | if (identifiers.Length < 2) 23 | throw new ArgumentException("identifiers"); 24 | 25 | Identifiers = identifiers; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /azure-test-pipeline.yml: -------------------------------------------------------------------------------- 1 | # .NET Desktop 2 | # https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net 3 | 4 | name: Dev.$(Date:yyyyMMdd).$(Rev:.r) 5 | 6 | trigger: 7 | - v3.x 8 | 9 | variables: 10 | solution: 'DevAudit.sln' 11 | buildPlatform: 'Any CPU' 12 | buildConfiguration: 'RuntimeDebug' 13 | 14 | jobs: 15 | - job: Windows 16 | pool: 17 | vmImage: 'VS2017-Win2016' 18 | steps: 19 | - task: NuGetToolInstaller@0 20 | - task: NuGetCommand@2 21 | inputs: 22 | restoreSolution: '$(solution)' 23 | feedsToUse: 'config' 24 | nugetConfigPath: 'NuGet.Config' 25 | 26 | - task: VSBuild@1 27 | inputs: 28 | solution: '$(solution)' 29 | platform: '$(buildPlatform)' 30 | configuration: '$(buildConfiguration)' 31 | 32 | - task: VSTest@2 33 | inputs: 34 | testAssemblyVer2: '$(Build.SourcesDirectory)/DevAudit.Tests/bin/Debug/DevAudit.Tests.dll' -------------------------------------------------------------------------------- /Renci.SshNet/Channels/IChannelForwardedTcpip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using Renci.SshNet.Common; 4 | 5 | namespace Renci.SshNet.Channels 6 | { 7 | /// 8 | /// A "forwarded-tcpip" SSH channel. 9 | /// 10 | internal interface IChannelForwardedTcpip : IDisposable 11 | { 12 | /// 13 | /// Occurs when an exception is thrown while processing channel messages. 14 | /// 15 | event EventHandler Exception; 16 | 17 | /// 18 | /// Binds the channel to the specified endpoint. 19 | /// 20 | /// The endpoint to connect to. 21 | /// The forwarded port for which the channel is opened. 22 | void Bind(IPEndPoint remoteEndpoint, IForwardedPort forwardedPort); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /azure-dev-test-pipeline.yml: -------------------------------------------------------------------------------- 1 | # .NET Desktop 2 | # https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net 3 | 4 | name: Dev.$(Date:yyyyMMdd).$(Rev:.r) 5 | 6 | trigger: 7 | - v3.x 8 | 9 | variables: 10 | solution: 'DevAudit.sln' 11 | buildPlatform: 'Any CPU' 12 | buildConfiguration: 'RuntimeDebug' 13 | 14 | jobs: 15 | - job: Windows 16 | pool: 17 | vmImage: 'VS2017-Win2016' 18 | steps: 19 | - task: NuGetToolInstaller@0 20 | - task: NuGetCommand@2 21 | inputs: 22 | restoreSolution: '$(solution)' 23 | feedsToUse: 'config' 24 | nugetConfigPath: 'NuGet.Config' 25 | 26 | - task: VSBuild@1 27 | inputs: 28 | solution: '$(solution)' 29 | platform: '$(buildPlatform)' 30 | configuration: '$(buildConfiguration)' 31 | 32 | - task: VSTest@2 33 | inputs: 34 | testAssemblyVer2: '$(Build.SourcesDirectory)/DevAudit.Tests/bin/Debug/DevAudit.Tests.dll' 35 | -------------------------------------------------------------------------------- /Renci.SshNet/Security/Cryptography/DigitalSignature.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Security.Cryptography 2 | { 3 | /// 4 | /// Base class for signature implementations 5 | /// 6 | public abstract class DigitalSignature 7 | { 8 | /// 9 | /// Verifies the signature. 10 | /// 11 | /// The input. 12 | /// The signature. 13 | /// True if signature was successfully verified; otherwise false. 14 | public abstract bool Verify(byte[] input, byte[] signature); 15 | 16 | /// 17 | /// Creates the signature. 18 | /// 19 | /// The input. 20 | /// Signed input data. 21 | public abstract byte[] Sign(byte[] input); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Transport/UnimplementedMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Messages.Transport 4 | { 5 | /// 6 | /// Represents SSH_MSG_UNIMPLEMENTED message. 7 | /// 8 | [Message("SSH_MSG_UNIMPLEMENTED", 3)] 9 | public class UnimplementedMessage : Message 10 | { 11 | /// 12 | /// Called when type specific data need to be loaded. 13 | /// 14 | protected override void LoadData() 15 | { 16 | } 17 | 18 | /// 19 | /// Called when type specific data need to be saved. 20 | /// 21 | protected override void SaveData() 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | 26 | internal override void Process(Session session) 27 | { 28 | session.OnUnimplementedReceived(this); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/AuthenticationPasswordChangeEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Common 2 | { 3 | /// 4 | /// Provides data for event. 5 | /// 6 | public class AuthenticationPasswordChangeEventArgs : AuthenticationEventArgs 7 | { 8 | /// 9 | /// Gets or sets the new password. 10 | /// 11 | /// 12 | /// The new password. 13 | /// 14 | public byte[] NewPassword { get; set; } 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// The username. 20 | public AuthenticationPasswordChangeEventArgs(string username) 21 | : base(username) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Renci.SshNet/IResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Renci.SshNet 8 | { 9 | /// 10 | /// Interface for the result of an Expect operatiob 11 | /// 12 | public interface IResult 13 | { 14 | /// 15 | /// Text matched the expected query. 16 | /// 17 | bool IsMatch { get; } 18 | /// 19 | /// Result object: can be string or a Regex.Match object etc. 20 | /// 21 | object Result { get; } 22 | /// 23 | /// The text the expected query was match against. 24 | /// 25 | string Text { get; } 26 | /// 27 | /// The number of matches found in the text. 28 | /// 29 | int? Count { get; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/SftpVersionResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Renci.SshNet.Sftp.Responses 4 | { 5 | internal class SftpVersionResponse : SftpMessage 6 | { 7 | public override SftpMessageTypes SftpMessageType 8 | { 9 | get { return SftpMessageTypes.Version; } 10 | } 11 | 12 | public uint Version { get; private set; } 13 | 14 | public IDictionary Extentions { get; private set; } 15 | 16 | protected override void LoadData() 17 | { 18 | base.LoadData(); 19 | Version = ReadUInt32(); 20 | Extentions = ReadExtensionPair(); 21 | } 22 | 23 | protected override void SaveData() 24 | { 25 | base.SaveData(); 26 | 27 | Write(Version); 28 | if (Extentions != null) 29 | Write(Extentions); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelOpen/ChannelOpenInfo.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Common; 2 | 3 | namespace Renci.SshNet.Messages.Connection 4 | { 5 | /// 6 | /// Base class for open channel messages 7 | /// 8 | public abstract class ChannelOpenInfo : SshData 9 | { 10 | /// 11 | /// Gets the type of the channel to open. 12 | /// 13 | /// 14 | /// The type of the channel to open. 15 | /// 16 | public abstract string ChannelType { get; } 17 | 18 | /// 19 | /// Called when type specific data need to be loaded. 20 | /// 21 | protected override void LoadData() 22 | { 23 | } 24 | 25 | /// 26 | /// Called when type specific data need to be saved. 27 | /// 28 | protected override void SaveData() 29 | { 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/IArtifact.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public interface IArtifact 10 | { 11 | string ArtifactId { get; } 12 | string PackageId { get; set; } 13 | string PackageName { get; set; } 14 | string PackageManager { get; set; } 15 | string PackageUrl { get; set; } 16 | string Description { get; set; } 17 | string Version { get; set; } 18 | ArtifactVersion[] Versions { get; set; } 19 | } 20 | 21 | public class ArtifactVersion 22 | { 23 | public string Version { get; set; } 24 | public DateTime PublishedDate { get; set; } 25 | public ArtifactVersion(string version, DateTime date) 26 | { 27 | this.Version = version; 28 | this.PublishedDate = date; 29 | } 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Renci.SshNet/MessageEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet 4 | { 5 | /// 6 | /// Provides data for message events. 7 | /// 8 | /// Message type 9 | public class MessageEventArgs : EventArgs 10 | { 11 | /// 12 | /// Gets the message. 13 | /// 14 | public T Message { get; private set; } 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// The message. 20 | /// is null. 21 | public MessageEventArgs(T message) 22 | { 23 | if (message == null) 24 | throw new ArgumentNullException("message"); 25 | 26 | Message = message; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelRequest/ShellRequestInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// Represents "shell" type channel request information 5 | /// 6 | internal class ShellRequestInfo : RequestInfo 7 | { 8 | /// 9 | /// Channel request name 10 | /// 11 | public const string Name = "shell"; 12 | 13 | /// 14 | /// Gets the name of the request. 15 | /// 16 | /// 17 | /// The name of the request. 18 | /// 19 | public override string RequestName 20 | { 21 | get { return Name; } 22 | } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | public ShellRequestInfo() 28 | { 29 | WantReply = true; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/DataSources/OSSIndex3/ObjectBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Runtime.Serialization; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | /** https://github.com/acarteas/FileCache */ 10 | public sealed class ObjectBinder : SerializationBinder 11 | { 12 | public override Type BindToType(string assemblyName, string typeName) 13 | { 14 | Type typeToDeserialize = null; 15 | String currentAssembly = Assembly.GetExecutingAssembly().FullName; 16 | 17 | // In this case we are always using the current assembly 18 | assemblyName = currentAssembly; 19 | 20 | // Get the type using the typeName and assemblyName 21 | typeToDeserialize = Type.GetType(String.Format("{0}, {1}", 22 | typeName, assemblyName)); 23 | 24 | return typeToDeserialize; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Expect.NET/ProcessAdapter.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace ExpectNet 3 | { 4 | class ProcessAdapter : IProcess 5 | { 6 | private System.Diagnostics.Process process; 7 | 8 | public ProcessAdapter(System.Diagnostics.Process process) 9 | { 10 | this.process = process; 11 | } 12 | 13 | public System.Diagnostics.ProcessStartInfo StartInfo 14 | { 15 | get { return process.StartInfo; } 16 | } 17 | 18 | public System.IO.StreamReader StandardOutput 19 | { 20 | get { return process.StandardOutput; } 21 | } 22 | 23 | public System.IO.StreamReader StandardError 24 | { 25 | get { return process.StandardError; } 26 | } 27 | 28 | public System.IO.StreamWriter StandardInput 29 | { 30 | get { return process.StandardInput; } 31 | } 32 | 33 | public void Start() 34 | { 35 | process.Start(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Renci.SshNet/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Runtime.CompilerServices; 4 | 5 | [assembly: AssemblyTitle("SSH.NET .NET 4.0")] 6 | [assembly: Guid("ad816c5e-6f13-4589-9f3e-59523f8b77a4")] 7 | [assembly: InternalsVisibleTo("Renci.SshNet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f9194e1eb66b7e2575aaee115ee1d27bc100920e7150e43992d6f668f9737de8b9c7ae892b62b8a36dd1d57929ff1541665d101dc476d6e02390846efae7e5186eec409710fdb596e3f83740afef0d4443055937649bc5a773175b61c57615dac0f0fd10f52b52fedf76c17474cc567b3f7a79de95dde842509fb39aaf69c6c2")] 8 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] 9 | -------------------------------------------------------------------------------- /DevAudit.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Audit/HttpException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Net.Http; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace DevAudit.AuditLibrary 10 | { 11 | public class HttpException : Exception 12 | { 13 | public string RequestParameter { get; set; } 14 | public HttpStatusCode StatusCode { get; set; } 15 | public string ReasonPhrase { get; set; } 16 | public HttpRequestMessage Request { get; set; } 17 | public HttpException(string request_parameter, HttpStatusCode status_code, string reason_phrase, HttpRequestMessage request) 18 | : base("HTTP error code was received or did not receieve expected HTTP response.") 19 | { 20 | this.RequestParameter = request_parameter; 21 | this.StatusCode = status_code; 22 | this.ReasonPhrase = reason_phrase; 23 | this.Request = request; 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelRequest/EndOfWriteRequestInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// Represents "eow@openssh.com" type channel request information 5 | /// 6 | public class EndOfWriteRequestInfo : RequestInfo 7 | { 8 | /// 9 | /// Channel request name 10 | /// 11 | public const string Name = "eow@openssh.com"; 12 | 13 | /// 14 | /// Gets the name of the request. 15 | /// 16 | /// 17 | /// The name of the request. 18 | /// 19 | public override string RequestName 20 | { 21 | get { return Name; } 22 | } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | public EndOfWriteRequestInfo() 28 | { 29 | WantReply = false; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ChannelExtendedDataEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Common 2 | { 3 | /// 4 | /// Provides data for events. 5 | /// 6 | internal class ChannelExtendedDataEventArgs : ChannelDataEventArgs 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// Channel number. 12 | /// Channel data. 13 | /// Channel data type code. 14 | public ChannelExtendedDataEventArgs(uint channelNumber, byte[] data, uint dataTypeCode) : base(channelNumber, data) 15 | { 16 | DataTypeCode = dataTypeCode; 17 | } 18 | 19 | /// 20 | /// Gets the data type code. 21 | /// 22 | public uint DataTypeCode { get; private set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelRequest/KeepAliveRequestInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// Represents "keepalive@openssh.com" type channel request information 5 | /// 6 | public class KeepAliveRequestInfo : RequestInfo 7 | { 8 | /// 9 | /// Channel request name 10 | /// 11 | public const string Name = "keepalive@openssh.com"; 12 | 13 | /// 14 | /// Gets the name of the request. 15 | /// 16 | /// 17 | /// The name of the request. 18 | /// 19 | public override string RequestName 20 | { 21 | get { return Name; } 22 | } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | public KeepAliveRequestInfo() 28 | { 29 | WantReply = false; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelEofMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// Represents SSH_MSG_CHANNEL_EOF message. 5 | /// 6 | [Message("SSH_MSG_CHANNEL_EOF", 96)] 7 | public class ChannelEofMessage : ChannelMessage 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | public ChannelEofMessage() 13 | { 14 | 15 | } 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The local channel number. 21 | public ChannelEofMessage(uint localChannelNumber) 22 | : base(localChannelNumber) 23 | { 24 | } 25 | 26 | internal override void Process(Session session) 27 | { 28 | session.OnChannelEofReceived(this); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Audit/DataSourceInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | [Serializable] 10 | public class DataSourceInfo 11 | { 12 | #region Constructors 13 | public DataSourceInfo(string name, string url, string description, string license = null, string copyright = null) 14 | { 15 | this.Name = name; 16 | this.Url = url; 17 | this.Description = description; 18 | this.License = license; 19 | this.Copyright = copyright; 20 | } 21 | 22 | public DataSourceInfo() {} 23 | #endregion 24 | 25 | #region Properties 26 | public string Name { get; set; } 27 | public string Url { get; set; } 28 | public string Description { get; set; } 29 | public string License { get; set; } 30 | public string Copyright { get; set; } 31 | #endregion 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelCloseMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// Represents SSH_MSG_CHANNEL_CLOSE message. 5 | /// 6 | [Message("SSH_MSG_CHANNEL_CLOSE", 97)] 7 | public class ChannelCloseMessage : ChannelMessage 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | public ChannelCloseMessage() 13 | { 14 | 15 | } 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The local channel number. 21 | public ChannelCloseMessage(uint localChannelNumber) 22 | : base(localChannelNumber) 23 | { 24 | } 25 | 26 | internal override void Process(Session session) 27 | { 28 | session.OnChannelCloseReceived(this); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelFailureMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// Represents SSH_MSG_CHANNEL_FAILURE message. 5 | /// 6 | [Message("SSH_MSG_CHANNEL_FAILURE", 100)] 7 | public class ChannelFailureMessage : ChannelMessage 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | public ChannelFailureMessage() 13 | { 14 | 15 | } 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The local channel number. 21 | public ChannelFailureMessage(uint localChannelNumber) 22 | : base(localChannelNumber) 23 | { 24 | } 25 | 26 | internal override void Process(Session session) 27 | { 28 | session.OnChannelFailureReceived(this); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelSuccessMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Messages.Connection 2 | { 3 | /// 4 | /// Represents SSH_MSG_CHANNEL_SUCCESS message. 5 | /// 6 | [Message("SSH_MSG_CHANNEL_SUCCESS", 99)] 7 | public class ChannelSuccessMessage : ChannelMessage 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | public ChannelSuccessMessage() 13 | { 14 | 15 | } 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The local channel number. 21 | public ChannelSuccessMessage(uint localChannelNumber) 22 | : base(localChannelNumber) 23 | { 24 | } 25 | 26 | internal override void Process(Session session) 27 | { 28 | session.OnChannelSuccessReceived(this); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/StatVfsResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Sftp.Responses 2 | { 3 | internal class StatVfsResponse : SftpExtendedReplyResponse 4 | { 5 | public SftpFileSytemInformation Information { get; private set; } 6 | 7 | public StatVfsResponse() 8 | : base(0) 9 | { 10 | } 11 | 12 | protected override void LoadData() 13 | { 14 | base.LoadData(); 15 | 16 | this.Information = new SftpFileSytemInformation(this.ReadUInt64(), this.ReadUInt64(), 17 | this.ReadUInt64(), this.ReadUInt64(), 18 | this.ReadUInt64(), this.ReadUInt64(), 19 | this.ReadUInt64(), this.ReadUInt64(), 20 | this.ReadUInt64(), this.ReadUInt64(), 21 | this.ReadUInt64()); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Reporters/Models/IQServerApplications.cs: -------------------------------------------------------------------------------- 1 | namespace DevAudit.AuditLibrary.Reporters.Models 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | using System.Globalization; 7 | using Newtonsoft.Json; 8 | using Newtonsoft.Json.Converters; 9 | 10 | public partial class IQServerApplications 11 | { 12 | [JsonProperty("applications")] 13 | public Application[] Applications { get; set; } 14 | } 15 | 16 | public partial class Application 17 | { 18 | [JsonProperty("id")] 19 | public string Id { get; set; } 20 | 21 | [JsonProperty("publicId")] 22 | public string PublicId { get; set; } 23 | 24 | [JsonProperty("name")] 25 | public string Name { get; set; } 26 | 27 | [JsonProperty("organizationId")] 28 | public string OrganizationId { get; set; } 29 | 30 | [JsonProperty("contactUserName")] 31 | public object ContactUserName { get; set; } 32 | 33 | [JsonProperty("applicationTags")] 34 | public object[] ApplicationTags { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeSha256.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Abstractions; 2 | 3 | namespace Renci.SshNet.Security 4 | { 5 | /// 6 | /// Represents "diffie-hellman-group-exchange-sha256" algorithm implementation. 7 | /// 8 | public class KeyExchangeDiffieHellmanGroupExchangeSha256 : KeyExchangeDiffieHellmanGroupExchangeShaBase 9 | { 10 | /// 11 | /// Gets algorithm name. 12 | /// 13 | public override string Name 14 | { 15 | get { return "diffie-hellman-group-exchange-sha256"; } 16 | } 17 | 18 | /// 19 | /// Hashes the specified data bytes. 20 | /// 21 | /// Data to hash. 22 | /// 23 | /// Hashed bytes 24 | /// 25 | protected override byte[] Hash(byte[] hashBytes) 26 | { 27 | using (var sha256 = CryptoAbstraction.CreateSHA256()) 28 | { 29 | return sha256.ComputeHash(hashBytes); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Renci.SshNet/CipherInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Security.Cryptography; 3 | 4 | namespace Renci.SshNet 5 | { 6 | /// 7 | /// Holds information about key size and cipher to use 8 | /// 9 | public class CipherInfo 10 | { 11 | /// 12 | /// Gets the size of the key. 13 | /// 14 | /// 15 | /// The size of the key. 16 | /// 17 | public int KeySize { get; private set; } 18 | 19 | /// 20 | /// Gets the cipher. 21 | /// 22 | public Func Cipher { get; private set; } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// Size of the key. 28 | /// The cipher. 29 | public CipherInfo(int keySize, Func cipher) 30 | { 31 | KeySize = keySize; 32 | Cipher = (key, iv) => (cipher(key.Take(KeySize / 8), iv)); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ShellDataEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Provides data for Shell DataReceived event 7 | /// 8 | public class ShellDataEventArgs : EventArgs 9 | { 10 | /// 11 | /// Gets the data. 12 | /// 13 | public byte[] Data { get; private set; } 14 | 15 | /// 16 | /// Gets the line data. 17 | /// 18 | public string Line { get; private set; } 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// The data. 24 | public ShellDataEventArgs(byte[] data) 25 | { 26 | Data = data; 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the class. 31 | /// 32 | /// The line. 33 | public ShellDataEventArgs(string line) 34 | { 35 | Line = line; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Renci.SshNet/HashInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | 4 | namespace Renci.SshNet 5 | { 6 | /// 7 | /// Holds information about key size and cipher to use 8 | /// 9 | public class HashInfo 10 | { 11 | /// 12 | /// Gets the size of the key. 13 | /// 14 | /// 15 | /// The size of the key. 16 | /// 17 | public int KeySize { get; private set; } 18 | 19 | /// 20 | /// Gets the cipher. 21 | /// 22 | public Func HashAlgorithm { get; private set; } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// Size of the key. 28 | /// The hash algorithm to use for a given key. 29 | public HashInfo(int keySize, Func hash) 30 | { 31 | KeySize = keySize; 32 | HashAlgorithm = key => (hash(key.Take(KeySize / 8))); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Renci.SshNet/Compression/ZlibOpenSsh.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Messages.Authentication; 2 | 3 | namespace Renci.SshNet.Compression 4 | { 5 | /// 6 | /// Represents "zlib@openssh.org" compression implementation 7 | /// 8 | public class ZlibOpenSsh : Compressor 9 | { 10 | /// 11 | /// Gets algorithm name. 12 | /// 13 | public override string Name 14 | { 15 | get { return "zlib@openssh.org"; } 16 | } 17 | 18 | /// 19 | /// Initializes the algorithm 20 | /// 21 | /// The session. 22 | public override void Init(Session session) 23 | { 24 | base.Init(session); 25 | 26 | session.UserAuthenticationSuccessReceived += Session_UserAuthenticationSuccessReceived; 27 | } 28 | 29 | private void Session_UserAuthenticationSuccessReceived(object sender, MessageEventArgs e) 30 | { 31 | IsActive = true; 32 | Session.UserAuthenticationSuccessReceived -= Session_UserAuthenticationSuccessReceived; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Renci.SshNet/IAuthenticationMethod.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Renci.SshNet 4 | { 5 | /// 6 | /// Base interface for authentication of a session using a given method. 7 | /// 8 | internal interface IAuthenticationMethod 9 | { 10 | /// 11 | /// Authenticates the specified session. 12 | /// 13 | /// The session to authenticate. 14 | /// 15 | /// The result of the authentication process. 16 | /// 17 | AuthenticationResult Authenticate(ISession session); 18 | 19 | /// 20 | /// Gets the list of allowed authentications. 21 | /// 22 | /// 23 | /// The list of allowed authentications. 24 | /// 25 | IList AllowedAuthentications { get; } 26 | 27 | /// 28 | /// Gets the name of the authentication method. 29 | /// 30 | /// 31 | /// The name of the authentication method. 32 | /// 33 | string Name { get; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Renci.SshNet/Abstractions/DiagnosticAbstraction.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | #if FEATURE_DIAGNOSTICS_TRACESOURCE 3 | using System.Threading; 4 | #endif // FEATURE_DIAGNOSTICS_TRACESOURCE 5 | 6 | namespace Renci.SshNet.Abstractions 7 | { 8 | internal static class DiagnosticAbstraction 9 | { 10 | #if FEATURE_DIAGNOSTICS_TRACESOURCE 11 | 12 | private static readonly SourceSwitch SourceSwitch = new SourceSwitch("SshNetSwitch"); 13 | 14 | public static bool IsEnabled(TraceEventType traceEventType) 15 | { 16 | return SourceSwitch.ShouldTrace(traceEventType); 17 | } 18 | 19 | private static readonly TraceSource Loggging = 20 | #if DEBUG 21 | new TraceSource("SshNet.Logging", SourceLevels.All); 22 | #else 23 | new TraceSource("SshNet.Logging"); 24 | #endif // DEBUG 25 | #endif // FEATURE_DIAGNOSTICS_TRACESOURCE 26 | 27 | [Conditional("DEBUG")] 28 | public static void Log(string text) 29 | { 30 | #if FEATURE_DIAGNOSTICS_TRACESOURCE 31 | Loggging.TraceEvent(TraceEventType.Verbose, Thread.CurrentThread.ManagedThreadId, text); 32 | #endif // FEATURE_DIAGNOSTICS_TRACESOURCE 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/AuthenticationBannerEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Common 2 | { 3 | /// 4 | /// Provides data for event. 5 | /// 6 | public class AuthenticationBannerEventArgs : AuthenticationEventArgs 7 | { 8 | /// 9 | /// Gets banner message. 10 | /// 11 | public string BannerMessage { get; private set; } 12 | 13 | /// 14 | /// Gets banner language. 15 | /// 16 | public string Language { get; private set; } 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// The username. 22 | /// Banner message. 23 | /// Banner language. 24 | public AuthenticationBannerEventArgs(string username, string message, string language) 25 | : base(username) 26 | { 27 | BannerMessage = message; 28 | Language = language; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.7zip/License.txt: -------------------------------------------------------------------------------- 1 | 7-Zip Extra 2 | ~~~~~~~~~~~ 3 | License for use and distribution 4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | Copyright (C) 1999-2016 Igor Pavlov. 7 | 8 | 7-Zip Extra files are under the GNU LGPL license. 9 | 10 | 11 | Notes: 12 | You can use 7-Zip Extra on any computer, including a computer in a commercial 13 | organization. You don't need to register or pay for 7-Zip. 14 | 15 | 16 | GNU LGPL information 17 | -------------------- 18 | 19 | This library is free software; you can redistribute it and/or 20 | modify it under the terms of the GNU Lesser General Public 21 | License as published by the Free Software Foundation; either 22 | version 2.1 of the License, or (at your option) any later version. 23 | 24 | This library is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | Lesser General Public License for more details. 28 | 29 | You can receive a copy of the GNU Lesser General Public License from 30 | http://www.gnu.org/ 31 | 32 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpInitRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Sftp.Requests 2 | { 3 | internal class SftpInitRequest : SftpMessage 4 | { 5 | public override SftpMessageTypes SftpMessageType 6 | { 7 | get { return SftpMessageTypes.Init; } 8 | } 9 | 10 | public uint Version { get; private set; } 11 | 12 | /// 13 | /// Gets the size of the message in bytes. 14 | /// 15 | /// 16 | /// The size of the messages in bytes. 17 | /// 18 | protected override int BufferCapacity 19 | { 20 | get 21 | { 22 | var capacity = base.BufferCapacity; 23 | capacity += 4; // Version 24 | return capacity; 25 | } 26 | } 27 | 28 | public SftpInitRequest(uint version) 29 | { 30 | Version = version; 31 | } 32 | 33 | protected override void LoadData() 34 | { 35 | base.LoadData(); 36 | Version = ReadUInt32(); 37 | } 38 | 39 | protected override void SaveData() 40 | { 41 | base.SaveData(); 42 | Write(Version); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/MessageAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Messages 4 | { 5 | 6 | /// 7 | /// Indicates that a class represents SSH message. This class cannot be inherited. 8 | /// 9 | [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 10 | public sealed class MessageAttribute : Attribute 11 | { 12 | /// 13 | /// Gets or sets message name as defined in RFC 4250. 14 | /// 15 | /// 16 | /// The name. 17 | /// 18 | public string Name { get; set; } 19 | 20 | /// 21 | /// Gets or sets message number as defined in RFC 4250. 22 | /// 23 | /// 24 | /// The number. 25 | /// 26 | public byte Number { get; set; } 27 | 28 | /// 29 | /// Initializes a new instance of the class. 30 | /// 31 | /// The name. 32 | /// The number. 33 | public MessageAttribute(string name, byte number) 34 | { 35 | Name = name; 36 | Number = number; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/ExtendedReplies/StatVfsReplyInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Sftp.Responses 2 | { 3 | internal class StatVfsReplyInfo : ExtendedReplyInfo 4 | { 5 | public SftpFileSytemInformation Information { get; private set; } 6 | 7 | protected override void LoadData() 8 | { 9 | base.LoadData(); 10 | 11 | Information = new SftpFileSytemInformation(ReadUInt64(), 12 | ReadUInt64(), 13 | ReadUInt64(), 14 | ReadUInt64(), 15 | ReadUInt64(), 16 | ReadUInt64(), 17 | ReadUInt64(), 18 | ReadUInt64(), 19 | ReadUInt64(), 20 | ReadUInt64(), 21 | ReadUInt64()); 22 | } 23 | 24 | protected override void SaveData() 25 | { 26 | throw new System.NotImplementedException(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Renci.SshNet/Common/ScpUploadEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Provides data for the Uploading event. 7 | /// 8 | public class ScpUploadEventArgs : EventArgs 9 | { 10 | /// 11 | /// Gets the uploaded filename. 12 | /// 13 | public string Filename { get; private set; } 14 | 15 | /// 16 | /// Gets the uploaded file size. 17 | /// 18 | public long Size { get; private set; } 19 | 20 | /// 21 | /// Gets number of uploaded bytes so far. 22 | /// 23 | public long Uploaded { get; private set; } 24 | 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 28 | /// The uploaded filename. 29 | /// The uploaded file size. 30 | /// The number of uploaded bytes so far. 31 | public ScpUploadEventArgs(string filename, long size, long uploaded) 32 | { 33 | Filename = filename; 34 | Size = size; 35 | Uploaded = uploaded; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Transport/ServiceAcceptMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Messages.Transport 4 | { 5 | /// 6 | /// Represents SSH_MSG_SERVICE_ACCEPT message. 7 | /// 8 | [Message("SSH_MSG_SERVICE_ACCEPT", MessageNumber)] 9 | public class ServiceAcceptMessage : Message 10 | { 11 | internal const byte MessageNumber = 6; 12 | 13 | /// 14 | /// Gets the name of the service. 15 | /// 16 | /// 17 | /// The name of the service. 18 | /// 19 | public ServiceName ServiceName { get; private set; } 20 | 21 | /// 22 | /// Called when type specific data need to be loaded. 23 | /// 24 | protected override void LoadData() 25 | { 26 | ServiceName = ReadBinary().ToServiceName(); 27 | } 28 | 29 | /// 30 | /// Called when type specific data need to be saved. 31 | /// 32 | protected override void SaveData() 33 | { 34 | throw new NotImplementedException(); 35 | } 36 | 37 | internal override void Process(Session session) 38 | { 39 | session.OnServiceAcceptReceived(this); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/SftpListDirectoryAsyncResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Renci.SshNet.Common; 4 | 5 | namespace Renci.SshNet.Sftp 6 | { 7 | /// 8 | /// Encapsulates the results of an asynchronous directory list operation. 9 | /// 10 | public class SftpListDirectoryAsyncResult : AsyncResult> 11 | { 12 | /// 13 | /// Gets the number of files read so far. 14 | /// 15 | public int FilesRead { get; private set; } 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The async callback. 21 | /// The state. 22 | public SftpListDirectoryAsyncResult(AsyncCallback asyncCallback, Object state) 23 | : base(asyncCallback, state) 24 | { 25 | 26 | } 27 | 28 | /// 29 | /// Updates asynchronous operation status information. 30 | /// 31 | /// The files read. 32 | internal void Update(int filesRead) 33 | { 34 | FilesRead = filesRead; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ScpDownloadEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Provides data for the Downloading event. 7 | /// 8 | public class ScpDownloadEventArgs : EventArgs 9 | { 10 | /// 11 | /// Gets the downloaded filename. 12 | /// 13 | public string Filename { get; private set; } 14 | 15 | /// 16 | /// Gets the downloaded file size. 17 | /// 18 | public long Size { get; private set; } 19 | 20 | /// 21 | /// Gets number of downloaded bytes so far. 22 | /// 23 | public long Downloaded { get; private set; } 24 | 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 28 | /// The downloaded filename. 29 | /// The downloaded file size. 30 | /// The number of downloaded bytes so far. 31 | public ScpDownloadEventArgs(string filename, long size, long downloaded) 32 | { 33 | Filename = filename; 34 | Size = size; 35 | Downloaded = downloaded; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/DataSources/Vulnersdotcom/Models/VulnersAuditQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.AuditLibrary 8 | { 9 | public class VulnersAuditQuery 10 | { 11 | public VulnersAuditQuery(string os, string version, string[] p) 12 | { 13 | this.os = os; 14 | switch (this.os) 15 | { 16 | 17 | case "ubuntu": 18 | this.version = version; 19 | package = p; 20 | break; 21 | case "debian": 22 | this.version = version.Split('.').First(); 23 | package = p; 24 | break; 25 | case "centos": 26 | case "oraclelinux": 27 | case "rhel": 28 | this.version = version.Split('.').First(); 29 | package = p; 30 | break; 31 | default: 32 | throw new NotSupportedException("Unknown OS: " + this.os); 33 | } 34 | 35 | } 36 | public string os { get; set; } 37 | public string[] package { get; set; } 38 | public string version { get; set; } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/SftpStatusResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Sftp.Responses 2 | { 3 | internal class SftpStatusResponse : SftpResponse 4 | { 5 | public override SftpMessageTypes SftpMessageType 6 | { 7 | get { return SftpMessageTypes.Status; } 8 | } 9 | 10 | public SftpStatusResponse(uint protocolVersion) 11 | : base(protocolVersion) 12 | { 13 | } 14 | 15 | public StatusCodes StatusCode { get; private set; } 16 | 17 | public string ErrorMessage { get; private set; } 18 | 19 | public string Language { get; private set; } 20 | 21 | protected override void LoadData() 22 | { 23 | base.LoadData(); 24 | 25 | StatusCode = (StatusCodes) ReadUInt32(); 26 | 27 | if (ProtocolVersion < 3) 28 | { 29 | return; 30 | } 31 | 32 | if (!IsEndOfData) 33 | { 34 | // the SSH File Transfer Protocol specification states that the error message is UTF-8 35 | ErrorMessage = ReadString(Utf8); 36 | 37 | // the language of the error message; RFC 1766 states that the language code may be 38 | // expressed as US-ASCII 39 | Language = ReadString(Ascii); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/SftpSynchronizeDirectoriesAsyncResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Renci.SshNet.Common; 4 | using System.IO; 5 | 6 | namespace Renci.SshNet.Sftp 7 | { 8 | /// 9 | /// Encapsulates the results of an asynchronous directory synchronization operation. 10 | /// 11 | public class SftpSynchronizeDirectoriesAsyncResult : AsyncResult> 12 | { 13 | /// 14 | /// Gets the number of files read so far. 15 | /// 16 | public int FilesRead { get; private set; } 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// The async callback. 22 | /// The state. 23 | public SftpSynchronizeDirectoriesAsyncResult(AsyncCallback asyncCallback, Object state) 24 | : base(asyncCallback, state) 25 | { 26 | } 27 | 28 | /// 29 | /// Updates asynchronous operation status information. 30 | /// 31 | /// The files read. 32 | internal void Update(int filesRead) 33 | { 34 | FilesRead = filesRead; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/ExtendedRequests/FStatVfsRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | 4 | namespace Renci.SshNet.Sftp.Requests 5 | { 6 | internal class FStatVfsRequest : SftpExtendedRequest 7 | { 8 | public byte[] Handle { get; private set; } 9 | 10 | /// 11 | /// Gets the size of the message in bytes. 12 | /// 13 | /// 14 | /// The size of the messages in bytes. 15 | /// 16 | protected override int BufferCapacity 17 | { 18 | get 19 | { 20 | var capacity = base.BufferCapacity; 21 | capacity += 4; // Handle length 22 | capacity += Handle.Length; // Handle 23 | return capacity; 24 | } 25 | } 26 | 27 | public FStatVfsRequest(uint protocolVersion, uint requestId, byte[] handle, Action extendedAction, Action statusAction) 28 | : base(protocolVersion, requestId, statusAction, "fstatvfs@openssh.com") 29 | { 30 | Handle = handle; 31 | SetAction(extendedAction); 32 | } 33 | 34 | protected override void SaveData() 35 | { 36 | base.SaveData(); 37 | WriteBinaryString(Handle); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelOpen/SessionChannelOpenInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Messages.Connection 4 | { 5 | /// 6 | /// Used to open "session" channel type 7 | /// 8 | internal class SessionChannelOpenInfo : ChannelOpenInfo 9 | { 10 | /// 11 | /// Specifies channel open type 12 | /// 13 | public const string Name = "session"; 14 | 15 | /// 16 | /// Gets the type of the channel to open. 17 | /// 18 | /// 19 | /// The type of the channel to open. 20 | /// 21 | public override string ChannelType 22 | { 23 | get { return Name; } 24 | } 25 | 26 | /// 27 | /// Initializes a new instance of the class. 28 | /// 29 | public SessionChannelOpenInfo() 30 | { 31 | } 32 | 33 | /// 34 | /// Initializes a new instance of the class from the 35 | /// specified data. 36 | /// 37 | /// is null. 38 | public SessionChannelOpenInfo(byte[] data) 39 | { 40 | Load(data); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Renci.SshNet/Security/KeyExchangeDiffieHellmanGroup1Sha1.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Common; 2 | using System.Globalization; 3 | 4 | namespace Renci.SshNet.Security 5 | { 6 | /// 7 | /// Represents "diffie-hellman-group1-sha1" algorithm implementation. 8 | /// 9 | public class KeyExchangeDiffieHellmanGroup1Sha1 : KeyExchangeDiffieHellmanGroupSha1 10 | { 11 | private const string SecondOkleyGroup = @"00FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF"; 12 | 13 | /// 14 | /// Gets algorithm name. 15 | /// 16 | public override string Name 17 | { 18 | get { return "diffie-hellman-group1-sha1"; } 19 | } 20 | 21 | /// 22 | /// Gets the group prime. 23 | /// 24 | /// 25 | /// The group prime. 26 | /// 27 | public override BigInteger GroupPrime 28 | { 29 | get 30 | { 31 | BigInteger prime; 32 | BigInteger.TryParse(SecondOkleyGroup, NumberStyles.AllowHexSpecifier, NumberFormatInfo.CurrentInfo, out prime); 33 | return prime; 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Responses/SftpNameResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text; 3 | 4 | namespace Renci.SshNet.Sftp.Responses 5 | { 6 | internal class SftpNameResponse : SftpResponse 7 | { 8 | public override SftpMessageTypes SftpMessageType 9 | { 10 | get { return SftpMessageTypes.Name; } 11 | } 12 | 13 | public uint Count { get; private set; } 14 | 15 | public Encoding Encoding { get; private set; } 16 | 17 | public KeyValuePair[] Files { get; private set; } 18 | 19 | public SftpNameResponse(uint protocolVersion, Encoding encoding) 20 | : base(protocolVersion) 21 | { 22 | Files = new KeyValuePair[0]; 23 | Encoding = encoding; 24 | } 25 | 26 | protected override void LoadData() 27 | { 28 | base.LoadData(); 29 | 30 | Count = ReadUInt32(); 31 | Files = new KeyValuePair[Count]; 32 | 33 | for (var i = 0; i < Count; i++) 34 | { 35 | var fileName = ReadString(Encoding); 36 | ReadString(Encoding); // skip longname 37 | var attributes = ReadAttributes(); 38 | Files[i] = new KeyValuePair(fileName, attributes); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Renci.SshNet/Security/HostAlgorithm.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Security 2 | { 3 | /// 4 | /// Base class for SSH host algorithms. 5 | /// 6 | public abstract class HostAlgorithm 7 | { 8 | /// 9 | /// Gets the host key name. 10 | /// 11 | public string Name { get; private set; } 12 | 13 | /// 14 | /// Gets the host key data. 15 | /// 16 | public abstract byte[] Data { get; } 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// The host key name. 22 | protected HostAlgorithm(string name) 23 | { 24 | Name = name; 25 | } 26 | 27 | /// 28 | /// Signs the specified data. 29 | /// 30 | /// The data. 31 | /// Signed data. 32 | public abstract byte[] Sign(byte[] data); 33 | 34 | /// 35 | /// Verifies the signature. 36 | /// 37 | /// The data. 38 | /// The signature. 39 | /// True is signature was successfully verifies; otherwise false. 40 | public abstract bool VerifySignature(byte[] data, byte[] signature); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/composer.json.example.3: -------------------------------------------------------------------------------- 1 | { 2 | "name": "drupal/drupal", 3 | "description": "Drupal is an open source content management platform powering millions of websites and applications.", 4 | "type": "project", 5 | "license": "GPL-2.0+", 6 | "require": { 7 | "composer/installers": "^1.0.21", 8 | "wikimedia/composer-merge-plugin": "~1.3" 9 | }, 10 | "replace": { 11 | "drupal/core": "~8.0" 12 | }, 13 | "minimum-stability": "dev", 14 | "prefer-stable": true, 15 | "config": { 16 | "preferred-install": "dist", 17 | "autoloader-suffix": "Drupal8" 18 | }, 19 | "extra": { 20 | "_readme": [ 21 | "By default Drupal loads the autoloader from ./vendor/autoload.php.", 22 | "To change the autoloader you can edit ./autoload.php." 23 | ], 24 | "merge-plugin": { 25 | "include": [ 26 | "core/composer.json" 27 | ], 28 | "recurse": false, 29 | "replace": false, 30 | "merge-extra": false 31 | } 32 | }, 33 | "autoload": { 34 | "psr-4": { 35 | "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer" 36 | } 37 | }, 38 | "scripts": { 39 | "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump", 40 | "post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess", 41 | "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup", 42 | "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Renci.SshNet/Abstractions/ThreadAbstraction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Abstractions 4 | { 5 | internal static class ThreadAbstraction 6 | { 7 | /// 8 | /// Suspends the current thread for the specified number of milliseconds. 9 | /// 10 | /// The number of milliseconds for which the thread is suspended. 11 | public static void Sleep(int millisecondsTimeout) 12 | { 13 | #if FEATURE_THREAD_SLEEP 14 | System.Threading.Thread.Sleep(millisecondsTimeout); 15 | #elif FEATURE_THREAD_TAP 16 | System.Threading.Tasks.Task.Delay(millisecondsTimeout).Wait(); 17 | #else 18 | #error Suspend of the current thread is not implemented. 19 | #endif 20 | } 21 | 22 | /// 23 | /// Executes the specified action in a separate thread. 24 | /// 25 | /// The action to execute. 26 | public static void ExecuteThread(Action action) 27 | { 28 | if (action == null) 29 | throw new ArgumentNullException("action"); 30 | 31 | #if FEATURE_THREAD_THREADPOOL 32 | System.Threading.ThreadPool.QueueUserWorkItem(o => action()); 33 | #elif FEATURE_THREAD_TAP 34 | System.Threading.Tasks.Task.Run(action); 35 | #else 36 | #error Execution of action in a separate thread is not implemented. 37 | #endif 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ChannelOpenFailedEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Common 2 | { 3 | /// 4 | /// Provides data for event. 5 | /// 6 | internal class ChannelOpenFailedEventArgs : ChannelEventArgs 7 | { 8 | /// 9 | /// Gets failure reason code. 10 | /// 11 | public uint ReasonCode { get; private set; } 12 | 13 | /// 14 | /// Gets failure description. 15 | /// 16 | public string Description { get; private set; } 17 | 18 | /// 19 | /// Gets failure language. 20 | /// 21 | public string Language { get; private set; } 22 | 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// Channel number. 27 | /// Failure reason code. 28 | /// Failure description. 29 | /// Failure language. 30 | public ChannelOpenFailedEventArgs(uint channelNumber, uint reasonCode, string description, string language) 31 | : base(channelNumber) 32 | { 33 | ReasonCode = reasonCode; 34 | Description = description; 35 | Language = language; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/PortForwardEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Provides data for event. 7 | /// 8 | public class PortForwardEventArgs : EventArgs 9 | { 10 | /// 11 | /// Gets request originator host. 12 | /// 13 | public string OriginatorHost { get; private set; } 14 | 15 | /// 16 | /// Gets request originator port. 17 | /// 18 | public uint OriginatorPort { get; private set; } 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// The host. 24 | /// The port. 25 | /// is null. 26 | /// is not within and . 27 | internal PortForwardEventArgs(string host, uint port) 28 | { 29 | if (host == null) 30 | throw new ArgumentNullException("host"); 31 | port.ValidatePort("port"); 32 | 33 | OriginatorHost = host; 34 | OriginatorPort = port; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Renci.SshNet/Abstractions/FileSystemAbstraction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace Renci.SshNet.Abstractions 6 | { 7 | internal class FileSystemAbstraction 8 | { 9 | /// 10 | /// Returns an enumerable collection of file information that matches a search pattern. 11 | /// 12 | /// 13 | /// The search string to match against the names of files. 14 | /// 15 | /// An enumerable collection of files that matches . 16 | /// 17 | /// is null. 18 | /// is null. 19 | /// The path represented by does not exist or is not valid. 20 | public static IEnumerable EnumerateFiles(DirectoryInfo directoryInfo, string searchPattern) 21 | { 22 | if (directoryInfo == null) 23 | throw new ArgumentNullException("directoryInfo"); 24 | 25 | #if FEATURE_DIRECTORYINFO_ENUMERATEFILES 26 | return directoryInfo.EnumerateFiles(searchPattern); 27 | #else 28 | return directoryInfo.GetFiles(searchPattern); 29 | #endif 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpCloseRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | 4 | namespace Renci.SshNet.Sftp.Requests 5 | { 6 | internal class SftpCloseRequest : SftpRequest 7 | { 8 | public override SftpMessageTypes SftpMessageType 9 | { 10 | get { return SftpMessageTypes.Close; } 11 | } 12 | 13 | public byte[] Handle { get; private set; } 14 | 15 | /// 16 | /// Gets the size of the message in bytes. 17 | /// 18 | /// 19 | /// The size of the messages in bytes. 20 | /// 21 | protected override int BufferCapacity 22 | { 23 | get 24 | { 25 | var capacity = base.BufferCapacity; 26 | capacity += 4; // Handle length 27 | capacity += Handle.Length; // Handle 28 | return capacity; 29 | } 30 | } 31 | 32 | public SftpCloseRequest(uint protocolVersion, uint requestId, byte[] handle, Action statusAction) 33 | : base(protocolVersion, requestId, statusAction) 34 | { 35 | Handle = handle; 36 | } 37 | 38 | protected override void LoadData() 39 | { 40 | base.LoadData(); 41 | Handle = ReadBinary(); 42 | } 43 | 44 | protected override void SaveData() 45 | { 46 | base.SaveData(); 47 | WriteBinaryString(Handle); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /DevAudit.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DevAudit.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DevAudit.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("69d9bd41-1b7c-4dc0-9b06-1ddaa8f7bba6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, OSSIndex 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of winaudit nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/ChannelOpenConfirmedEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Common 2 | { 3 | /// 4 | /// Provides data for event. 5 | /// 6 | internal class ChannelOpenConfirmedEventArgs : ChannelEventArgs 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// The remote channel number. 12 | /// The initial window size. 13 | /// The maximum packet size. 14 | public ChannelOpenConfirmedEventArgs(uint remoteChannelNumber, uint initialWindowSize, uint maximumPacketSize) 15 | : base(remoteChannelNumber) 16 | { 17 | InitialWindowSize = initialWindowSize; 18 | MaximumPacketSize = maximumPacketSize; 19 | } 20 | 21 | /// 22 | /// Gets the initial size of the window. 23 | /// 24 | /// 25 | /// The initial size of the window. 26 | /// 27 | public uint InitialWindowSize { get; private set; } 28 | 29 | /// 30 | /// Gets the maximum size of the packet. 31 | /// 32 | /// 33 | /// The maximum size of the packet. 34 | /// 35 | public uint MaximumPacketSize { get; private set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /DevAudit.CommandLine/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, OSSIndex 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of winaudit nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /DevAudit.Tests.VMRequired/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DevAudit.Tests.VMRequired")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DevAudit.Tests.VMRequired")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9136cdb4-7e20-47f2-986d-d57b9aeb70d4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/composer.json.example.1: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": ["framework", "laravel"], 5 | "license": "MIT", 6 | "type": "project", 7 | "require": { 8 | "php": ">=5.5.9", 9 | "cakephp/cakephp": "3.1.2.0", 10 | "laravel/framework": "5.2.*", 11 | "guzzlehttp/guzzle": "~6.1" 12 | }, 13 | "require-dev": { 14 | "fzaninotto/faker": "~1.4", 15 | "mockery/mockery": "0.9.*", 16 | "phpunit/phpunit": "~4.0", 17 | "symfony/css-selector": "2.8.*|3.0.*", 18 | "symfony/dom-crawler": "2.8.*|3.0.*" 19 | }, 20 | "autoload": { 21 | "classmap": [ 22 | "database" 23 | ], 24 | "psr-4": { 25 | "App\\": "app/" 26 | } 27 | }, 28 | "autoload-dev": { 29 | "classmap": [ 30 | "tests/TestCase.php" 31 | ] 32 | }, 33 | "scripts": { 34 | "post-root-package-install": [ 35 | "php -r \"copy('.env.example', '.env');\"" 36 | ], 37 | "post-create-project-cmd": [ 38 | "php artisan key:generate" 39 | ], 40 | "post-install-cmd": [ 41 | "php artisan clear-compiled", 42 | "php artisan optimize" 43 | ], 44 | "pre-update-cmd": [ 45 | "php artisan clear-compiled" 46 | ], 47 | "post-update-cmd": [ 48 | "php artisan optimize" 49 | ] 50 | }, 51 | "config": { 52 | "preferred-install": "dist" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/IVulnerability.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Newtonsoft.Json; 8 | 9 | namespace DevAudit.AuditLibrary 10 | { 11 | public enum VulnerabilityReportType 12 | { 13 | Bulletin = 0 14 | } 15 | 16 | public enum VulnerabilityReportCategory 17 | { 18 | Software = 0 19 | } 20 | 21 | [Serializable] 22 | public struct VulnerabilityCVSS 23 | { 24 | public string Score; 25 | public string Vector; 26 | } 27 | 28 | public interface IVulnerability 29 | { 30 | string Id { get; } 31 | 32 | string Title { get; } 33 | 34 | string Description { get; } 35 | 36 | string Details { get; } 37 | 38 | string[] Versions { get; } 39 | 40 | 41 | string Reporter { get; } 42 | 43 | VulnerabilityReportType ReportType { get; } 44 | 45 | VulnerabilityReportCategory ReportCategory { get; } 46 | 47 | DateTime Published { get; } 48 | 49 | DateTime Updated { get; } 50 | 51 | string [] CVE { get; } 52 | 53 | VulnerabilityCVSS CVSS { get; } 54 | 55 | string[] References { get; } 56 | 57 | [JsonIgnore] 58 | string PackageId { get; } 59 | 60 | [JsonIgnore] 61 | IPackage Package { get; set; } 62 | 63 | [JsonIgnore] 64 | bool PackageVersionIsInRange { get; set; } 65 | 66 | [JsonIgnore] 67 | DataSourceInfo DataSource { get; set; } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /DevAudit.CommandLine/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DevAudit.CommandLine")] 9 | [assembly: AssemblyDescription("DevAudit command-line interface.")] 10 | [assembly: AssemblyConfiguration("Debug")] 11 | [assembly: AssemblyCompany("Sonatype")] 12 | [assembly: AssemblyProduct("DevAudit")] 13 | [assembly: AssemblyCopyright("Copyright © 2019 2020 Sonatype")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("86ee75fc-d05d-42bc-b2c2-b80cf3734332")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.5.0")] 36 | [assembly: AssemblyFileVersion("3.5.0")] 37 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpFStatRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | 4 | namespace Renci.SshNet.Sftp.Requests 5 | { 6 | internal class SftpFStatRequest : SftpRequest 7 | { 8 | public override SftpMessageTypes SftpMessageType 9 | { 10 | get { return SftpMessageTypes.FStat; } 11 | } 12 | 13 | public byte[] Handle { get; private set; } 14 | 15 | /// 16 | /// Gets the size of the message in bytes. 17 | /// 18 | /// 19 | /// The size of the messages in bytes. 20 | /// 21 | protected override int BufferCapacity 22 | { 23 | get 24 | { 25 | var capacity = base.BufferCapacity; 26 | capacity += 4; // Handle length 27 | capacity += Handle.Length; // Handle 28 | return capacity; 29 | } 30 | } 31 | 32 | public SftpFStatRequest(uint protocolVersion, uint requestId, byte[] handle, Action attrsAction, Action statusAction) 33 | : base(protocolVersion, requestId, statusAction) 34 | { 35 | Handle = handle; 36 | SetAction(attrsAction); 37 | } 38 | 39 | protected override void LoadData() 40 | { 41 | base.LoadData(); 42 | Handle = ReadBinary(); 43 | } 44 | 45 | protected override void SaveData() 46 | { 47 | base.SaveData(); 48 | WriteBinaryString(Handle); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpReadDirRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | 4 | namespace Renci.SshNet.Sftp.Requests 5 | { 6 | internal class SftpReadDirRequest : SftpRequest 7 | { 8 | public override SftpMessageTypes SftpMessageType 9 | { 10 | get { return SftpMessageTypes.ReadDir; } 11 | } 12 | 13 | public byte[] Handle { get; private set; } 14 | 15 | /// 16 | /// Gets the size of the message in bytes. 17 | /// 18 | /// 19 | /// The size of the messages in bytes. 20 | /// 21 | protected override int BufferCapacity 22 | { 23 | get 24 | { 25 | var capacity = base.BufferCapacity; 26 | capacity += 4; // Handle length 27 | capacity += Handle.Length; // Handle 28 | return capacity; 29 | } 30 | } 31 | 32 | public SftpReadDirRequest(uint protocolVersion, uint requestId, byte[] handle, Action nameAction, Action statusAction) 33 | : base(protocolVersion, requestId, statusAction) 34 | { 35 | Handle = handle; 36 | SetAction(nameAction); 37 | } 38 | 39 | protected override void LoadData() 40 | { 41 | base.LoadData(); 42 | Handle = ReadBinary(); 43 | } 44 | 45 | protected override void SaveData() 46 | { 47 | base.SaveData(); 48 | WriteBinaryString(Handle); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/AuthenticationPromptEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Renci.SshNet.Common 4 | { 5 | /// 6 | /// Provides data for event. 7 | /// 8 | public class AuthenticationPromptEventArgs : AuthenticationEventArgs 9 | { 10 | /// 11 | /// Gets prompt language. 12 | /// 13 | public string Language { get; private set; } 14 | 15 | /// 16 | /// Gets prompt instruction. 17 | /// 18 | public string Instruction { get; private set; } 19 | 20 | /// 21 | /// Gets server information request prompts. 22 | /// 23 | public IEnumerable Prompts { get; private set; } 24 | 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 28 | /// The username. 29 | /// The instruction. 30 | /// The language. 31 | /// The information request prompts. 32 | public AuthenticationPromptEventArgs(string username, string instruction, string language, IEnumerable prompts) 33 | : base(username) 34 | { 35 | Instruction = instruction; 36 | Language = language; 37 | Prompts = prompts; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DevAudit.AuditLibrary")] 9 | [assembly: AssemblyDescription("DevAudit core audit library.")] 10 | [assembly: AssemblyConfiguration("Debug")] 11 | [assembly: AssemblyCompany("Sonatype")] 12 | [assembly: AssemblyProduct("DevAudit")] 13 | [assembly: AssemblyCopyright("Copyright © 2019 2020 Sonatype")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("36f663f6-4b5c-441f-b11a-9cc556d1c1fe")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.5.0")] 36 | [assembly: AssemblyFileVersion("3.5.0")] 37 | 38 | [assembly: InternalsVisibleTo("DevAudit.Tests")] 39 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpExtendedRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | 4 | namespace Renci.SshNet.Sftp.Requests 5 | { 6 | internal abstract class SftpExtendedRequest : SftpRequest 7 | { 8 | private byte[] _nameBytes; 9 | private string _name; 10 | 11 | public override SftpMessageTypes SftpMessageType 12 | { 13 | get { return SftpMessageTypes.Extended; } 14 | } 15 | 16 | public string Name 17 | { 18 | get { return _name; } 19 | private set 20 | { 21 | _name = value; 22 | _nameBytes = Utf8.GetBytes(value); 23 | } 24 | } 25 | 26 | /// 27 | /// Gets the size of the message in bytes. 28 | /// 29 | /// 30 | /// The size of the messages in bytes. 31 | /// 32 | protected override int BufferCapacity 33 | { 34 | get 35 | { 36 | var capacity = base.BufferCapacity; 37 | capacity += 4; // Name length 38 | capacity += _nameBytes.Length; // Name 39 | return capacity; 40 | } 41 | } 42 | 43 | protected SftpExtendedRequest(uint protocolVersion, uint requestId, Action statusAction, string name) 44 | : base(protocolVersion, requestId, statusAction) 45 | { 46 | Name = name; 47 | } 48 | 49 | protected override void SaveData() 50 | { 51 | base.SaveData(); 52 | WriteBinaryString(_nameBytes); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/ExtendedRequests/StatVfsRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | using System.Text; 4 | 5 | namespace Renci.SshNet.Sftp.Requests 6 | { 7 | internal class StatVfsRequest : SftpExtendedRequest 8 | { 9 | private byte[] _path; 10 | 11 | public string Path 12 | { 13 | get { return Encoding.GetString(_path, 0, _path.Length); } 14 | private set { _path = Encoding.GetBytes(value); } 15 | } 16 | 17 | public Encoding Encoding { get; private set; } 18 | 19 | /// 20 | /// Gets the size of the message in bytes. 21 | /// 22 | /// 23 | /// The size of the messages in bytes. 24 | /// 25 | protected override int BufferCapacity 26 | { 27 | get 28 | { 29 | var capacity = base.BufferCapacity; 30 | capacity += 4; // Path length 31 | capacity += _path.Length; // Path 32 | return capacity; 33 | } 34 | } 35 | 36 | public StatVfsRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action extendedAction, Action statusAction) 37 | : base(protocolVersion, requestId, statusAction, "statvfs@openssh.com") 38 | { 39 | Encoding = encoding; 40 | Path = path; 41 | SetAction(extendedAction); 42 | } 43 | 44 | protected override void SaveData() 45 | { 46 | base.SaveData(); 47 | WriteBinaryString(_path); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Renci.SshNet/Security/KeyExchangeDiffieHellmanGroup14Sha1.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Common; 2 | using System.Globalization; 3 | 4 | namespace Renci.SshNet.Security 5 | { 6 | /// 7 | /// Represents "diffie-hellman-group14-sha1" algorithm implementation. 8 | /// 9 | internal class KeyExchangeDiffieHellmanGroup14Sha1 : KeyExchangeDiffieHellmanGroupSha1 10 | { 11 | private const string SecondOkleyGroup = "00FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF"; 12 | 13 | /// 14 | /// Gets algorithm name. 15 | /// 16 | public override string Name 17 | { 18 | get { return "diffie-hellman-group14-sha1"; } 19 | } 20 | 21 | /// 22 | /// Gets the group prime. 23 | /// 24 | /// 25 | /// The group prime. 26 | /// 27 | public override BigInteger GroupPrime 28 | { 29 | get 30 | { 31 | BigInteger prime; 32 | BigInteger.TryParse(SecondOkleyGroup, NumberStyles.AllowHexSpecifier, NumberFormatInfo.CurrentInfo, out prime); 33 | return prime; 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Audit/AuditProfile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | using YamlDotNet.Serialization; 9 | using YamlDotNet.Serialization.NamingConventions; 10 | namespace DevAudit.AuditLibrary 11 | { 12 | public class AuditProfile 13 | { 14 | #region Constructors 15 | public AuditProfile(AuditEnvironment env, AuditFileInfo pf) 16 | { 17 | this.AuditEnvironment = env; 18 | this.ProfileFile = pf; 19 | this.AuditEnvironment.Info("Using profile file {0}.", pf.FullName); 20 | IDeserializer yaml_deserializer = new DeserializerBuilder() 21 | .WithNamingConvention(new CamelCaseNamingConvention()) 22 | .IgnoreUnmatchedProperties() 23 | .Build(); 24 | try 25 | { 26 | this.Rules = yaml_deserializer.Deserialize>(new StringReader(this.ProfileFile.ReadAsText())); 27 | AuditEnvironment.Info("Loaded {0} rule(s) from audit profile.", this.Rules.Count); 28 | } 29 | catch (Exception e) 30 | { 31 | this.AuditEnvironment.Error(e, "Error occurred reading audit profile from {0}.", this.ProfileFile.FullName); 32 | } 33 | 34 | } 35 | #endregion 36 | 37 | #region Properties 38 | public AuditEnvironment AuditEnvironment { get; protected set; } 39 | public AuditFileInfo ProfileFile { get; protected set; } 40 | public List Rules { get; protected set; } 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Expect.NET/Match.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ExpectNet.NET 8 | { 9 | public abstract class Match : IMatch 10 | { 11 | #region Public properties 12 | public bool IsMatch 13 | { 14 | get 15 | { 16 | return _IsMatch; 17 | } 18 | } 19 | 20 | public object Result 21 | { 22 | get 23 | { 24 | return this._Result; 25 | } 26 | } 27 | 28 | public string Text 29 | { 30 | get 31 | { 32 | return this._Text; 33 | } 34 | } 35 | 36 | public int? Count 37 | { 38 | get 39 | { 40 | return this._Count; 41 | } 42 | } 43 | 44 | public string Query { get; private set; } 45 | #endregion 46 | 47 | #region Constructors 48 | public Match (string query) 49 | { 50 | if (string.IsNullOrEmpty(query)) 51 | { 52 | throw new ArgumentNullException("query"); 53 | } 54 | this.Query = query; 55 | } 56 | #endregion 57 | 58 | #region Abstract methods 59 | public abstract bool Execute(string text); 60 | #endregion 61 | 62 | #region Protected and private fields 63 | protected bool _IsMatch = false; 64 | protected object _Result; 65 | protected string _Text; 66 | protected int? _Count; 67 | #endregion 68 | 69 | 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Renci.SshNet/Channels/ServerChannel.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Messages.Connection; 2 | 3 | namespace Renci.SshNet.Channels 4 | { 5 | internal abstract class ServerChannel : Channel 6 | { 7 | /// 8 | /// Initializes a new instance. 9 | /// 10 | /// The session. 11 | /// The local channel number. 12 | /// Size of the window. 13 | /// Size of the packet. 14 | /// The remote channel number. 15 | /// The window size of the remote party. 16 | /// The maximum size of a data packet that we can send to the remote party. 17 | protected ServerChannel(ISession session, uint localChannelNumber, uint localWindowSize, uint localPacketSize, uint remoteChannelNumber, uint remoteWindowSize, uint remotePacketSize) 18 | : base(session, localChannelNumber, localWindowSize, localPacketSize) 19 | { 20 | InitializeRemoteInfo(remoteChannelNumber, remoteWindowSize, remotePacketSize); 21 | } 22 | 23 | protected void SendMessage(ChannelOpenConfirmationMessage message) 24 | { 25 | // No need to check whether channel is open when trying to open a channel 26 | Session.SendMessage(message); 27 | 28 | // When we act as server, consider the channel open when we've sent the 29 | // confirmation message to the peer 30 | IsOpen = true; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Examples/bower.json.example.2: -------------------------------------------------------------------------------- 1 | { 2 | "name": "leaflet-draw", 3 | "description": "Vector drawing plugin for Leaflet", 4 | "version": "0.3.0", 5 | "main": [ 6 | "dist/leaflet.draw-src.js", 7 | "dist/leaflet.draw.css", 8 | "dist/images/spritesheet-2x.png", 9 | "dist/images/spritesheet.png", 10 | "dist/images/spritesheet.svg" 11 | ], 12 | "license": "MIT", 13 | "ignore": [ 14 | "**/.*", 15 | "src", 16 | "doc", 17 | "examples", 18 | "test", 19 | "build", 20 | "spec", 21 | "*.md", 22 | "Gruntfile.js", 23 | "Jakefile.js", 24 | "package.json", 25 | "bower.json" 26 | ], 27 | "keywords": [ 28 | "javascript", 29 | "leaflet", 30 | "maps", 31 | "client", 32 | "vector", 33 | "drawing", 34 | "draw" 35 | ], 36 | "authors": [ 37 | { 38 | "name": "Jon West", 39 | "email": "ddproxy@gmail.com" 40 | }, 41 | { 42 | "name":"Jacob Toye" 43 | } 44 | ], 45 | "homepage":"", 46 | "repository": { 47 | "type": "git", 48 | "url": "https://github.com/Leaflet/Leaflet.draw.git" 49 | }, 50 | "dependencies": { 51 | "jquery": "1.9.1 - 3", 52 | "leaflet": "^0.7.0", 53 | "angular": ">=1.2.0 <1.6.0", 54 | "moment": ">=2.0.0 <3.0.0" 55 | }, 56 | "devDependencies": { 57 | "leaflet": "~0.7.0", 58 | "jshint": "~2.3.0", 59 | "uglify-js": "~2.4.3", 60 | "jake": "~0.7.4", 61 | "mocha": "~1.14.0", 62 | "happen": "~0.1.3", 63 | "karma": "^0.12.19", 64 | "karma-mocha": "~0.1.0", 65 | "karma-coverage": "~0.1.3", 66 | "angular-mocks": "1.3.x - 1.5.x", 67 | "moment-timezone": "0.4.0" 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/SftpUploadAsyncResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Common; 3 | 4 | namespace Renci.SshNet.Sftp 5 | { 6 | /// 7 | /// Encapsulates the results of an asynchronous upload operation. 8 | /// 9 | public class SftpUploadAsyncResult : AsyncResult 10 | { 11 | /// 12 | /// Gets or sets a value indicating whether to cancel asynchronous upload operation 13 | /// 14 | /// 15 | /// true if upload operation to be canceled; otherwise, false. 16 | /// 17 | /// 18 | /// Upload operation will be canceled after finishing uploading current buffer. 19 | /// 20 | public bool IsUploadCanceled { get; set; } 21 | 22 | /// 23 | /// Gets the number of uploaded bytes. 24 | /// 25 | public ulong UploadedBytes { get; private set; } 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | /// The async callback. 31 | /// The state. 32 | public SftpUploadAsyncResult(AsyncCallback asyncCallback, Object state) 33 | : base(asyncCallback, state) 34 | { 35 | } 36 | 37 | /// 38 | /// Updates asynchronous operation status information. 39 | /// 40 | /// Number of uploaded bytes. 41 | internal void Update(ulong uploadedBytes) 42 | { 43 | UploadedBytes = uploadedBytes; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/SftpDownloadAsyncResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Common; 3 | 4 | namespace Renci.SshNet.Sftp 5 | { 6 | /// 7 | /// Encapsulates the results of an asynchronous download operation. 8 | /// 9 | public class SftpDownloadAsyncResult : AsyncResult 10 | { 11 | /// 12 | /// Gets or sets a value indicating whether to cancel asynchronous download operation. 13 | /// 14 | /// 15 | /// true if download operation to be canceled; otherwise, false. 16 | /// 17 | /// 18 | /// Download operation will be canceled after finishing uploading current buffer. 19 | /// 20 | public bool IsDownloadCanceled { get; set; } 21 | 22 | /// 23 | /// Gets the number of downloaded bytes. 24 | /// 25 | public ulong DownloadedBytes { get; private set; } 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | /// The async callback. 31 | /// The state. 32 | public SftpDownloadAsyncResult(AsyncCallback asyncCallback, object state) 33 | : base(asyncCallback, state) 34 | { 35 | } 36 | 37 | /// 38 | /// Updates asynchronous operation status information. 39 | /// 40 | /// Number of downloaded bytes. 41 | internal void Update(ulong downloadedBytes) 42 | { 43 | DownloadedBytes = downloadedBytes; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Base/AuditFileInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.CompilerServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | using Alpheus.IO; 10 | 11 | namespace DevAudit.AuditLibrary 12 | { 13 | public abstract class AuditFileInfo : AuditFileSystemInfo, IFileInfo 14 | { 15 | #region Abstract properties 16 | public abstract string DirectoryName { get; } 17 | public abstract IDirectoryInfo Directory { get; } 18 | public abstract bool IsReadOnly { get; } 19 | public abstract long Length { get; } 20 | public abstract DateTime LastWriteTimeUtc { get; } 21 | #endregion 22 | 23 | #region Abstract methods 24 | public abstract string ReadAsText(); 25 | public abstract byte[] ReadAsBinary(); 26 | public abstract bool PathExists(string file_path); 27 | public abstract LocalAuditFileInfo GetAsLocalFile(); 28 | public abstract Task GetAsLocalFileAsync(); 29 | #endregion 30 | 31 | #region Constructors 32 | public AuditFileInfo(AuditEnvironment env, string file_path) 33 | { 34 | this.AuditEnvironment = env; 35 | this.FullName = file_path; 36 | this.PathSeparator = this.AuditEnvironment.OS.Platform == PlatformID.Win32NT ? "\\" : "/"; 37 | this.Name = this.GetPathComponents().Last(); 38 | } 39 | #endregion 40 | 41 | #region Methods 42 | public IFileInfo Create(string file_path) 43 | { 44 | return this.AuditEnvironment.ConstructFile(this.CombinePaths(this.Directory.FullName, file_path)); 45 | } 46 | #endregion 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Renci.SshNet/Compression/ZlibStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Renci.SshNet.Compression 4 | { 5 | /// 6 | /// Implements Zlib compression algorithm. 7 | /// 8 | public class ZlibStream 9 | { 10 | //private readonly Ionic.Zlib.ZlibStream _baseStream; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The stream. 16 | /// The mode. 17 | public ZlibStream(Stream stream, CompressionMode mode) 18 | { 19 | //switch (mode) 20 | //{ 21 | // case CompressionMode.Compress: 22 | // this._baseStream = new Ionic.Zlib.ZlibStream(stream, Ionic.Zlib.CompressionMode.Compress, Ionic.Zlib.CompressionLevel.Default); 23 | // break; 24 | // case CompressionMode.Decompress: 25 | // this._baseStream = new Ionic.Zlib.ZlibStream(stream, Ionic.Zlib.CompressionMode.Decompress, Ionic.Zlib.CompressionLevel.Default); 26 | // break; 27 | // default: 28 | // break; 29 | //} 30 | 31 | //this._baseStream.FlushMode = Ionic.Zlib.FlushType.Partial; 32 | } 33 | 34 | /// 35 | /// Writes the specified buffer. 36 | /// 37 | /// The buffer. 38 | /// The offset. 39 | /// The count. 40 | public void Write(byte[] buffer, int offset, int count) 41 | { 42 | //this._baseStream.Write(buffer, offset, count); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Renci.SshNet/Security/CertificateHostAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Security 4 | { 5 | /// 6 | /// Implements certificate support for host algorithm. 7 | /// 8 | public class CertificateHostAlgorithm : HostAlgorithm 9 | { 10 | /// 11 | /// Gets the host key data. 12 | /// 13 | public override byte[] Data 14 | { 15 | get { throw new NotImplementedException(); } 16 | } 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// The host key name. 22 | public CertificateHostAlgorithm(string name) 23 | : base(name) 24 | { 25 | } 26 | 27 | /// 28 | /// Signs the specified data. 29 | /// 30 | /// The data. 31 | /// Signed data. 32 | /// 33 | public override byte[] Sign(byte[] data) 34 | { 35 | throw new NotImplementedException(); 36 | } 37 | 38 | /// 39 | /// Verifies the signature. 40 | /// 41 | /// The data. 42 | /// The signature. 43 | /// true if signature was successfully verified; otherwise false. 44 | /// 45 | public override bool VerifySignature(byte[] data, byte[] signature) 46 | { 47 | throw new NotImplementedException(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /DevAudit.Tests/Environments/GitHubEnvironmentTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Linq.Expressions; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | using Xunit; 10 | 11 | using DevAudit.AuditLibrary; 12 | 13 | namespace DevAudit.Tests 14 | { 15 | public class GitHub : EnvironmentTests 16 | { 17 | #region Constructor 18 | public GitHub() : base() 19 | { 20 | Sources.Add( 21 | new YarnPackageSource(new Dictionary 22 | { 23 | {"AuditEnvironment", GitHubEnv}, 24 | {"HostEnvironment", HostEnvironment}, 25 | }, EnvironmentMessageHandler)); 26 | 27 | } 28 | #endregion 29 | 30 | #region Overriden Properties 31 | protected override AuditEnvironment Env => GitHubEnv; 32 | 33 | protected override List FilesToConstruct { get; } = new List 34 | { 35 | "README.md", 36 | "LICENSE", 37 | "packages/empty.ts" 38 | }; 39 | 40 | protected override List FilesToTestExistence => FilesToConstruct; 41 | 42 | protected override Dictionary FilesToRead { get; } = new Dictionary 43 | { 44 | {"LICENSE", "Permission is hereby granted, free of charge,"} 45 | }; 46 | 47 | 48 | #endregion 49 | 50 | #region Properties 51 | protected GitHubAuditEnvironment GitHubEnv {get; } = new GitHubAuditEnvironment(EnvironmentMessageHandler, 52 | Environment.GetEnvironmentVariable("GITHUB_USER_API_TOKEN"), "angular", "angular", "master", HostEnvironment); 53 | #endregion 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Renci.SshNet/Channels/IChannelDirectTcpip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Sockets; 3 | using Renci.SshNet.Common; 4 | 5 | namespace Renci.SshNet.Channels 6 | { 7 | /// 8 | /// A "direct-tcpip" SSH channel. 9 | /// 10 | internal interface IChannelDirectTcpip : IDisposable 11 | { 12 | /// 13 | /// Occurs when an exception is thrown while processing channel messages. 14 | /// 15 | event EventHandler Exception; 16 | 17 | /// 18 | /// Gets a value indicating whether this channel is open. 19 | /// 20 | /// 21 | /// true if this channel is open; otherwise, false. 22 | /// 23 | bool IsOpen { get; } 24 | 25 | /// 26 | /// Gets the local channel number. 27 | /// 28 | /// 29 | /// The local channel number. 30 | /// 31 | uint LocalChannelNumber { get; } 32 | 33 | /// 34 | /// Opens a channel for a locally forwarded TCP/IP port. 35 | /// 36 | /// The name of the remote host to forward to. 37 | /// The port of the remote hosts to forward to. 38 | /// The forwarded port for which the channel is opened. 39 | /// The socket to receive requests from, and send responses from the remote host to. 40 | void Open(string remoteHost, uint port, IForwardedPort forwardedPort, Socket socket); 41 | 42 | /// 43 | /// Binds the channel to the remote host. 44 | /// 45 | void Bind(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/AuthenticationPrompt.cs: -------------------------------------------------------------------------------- 1 | namespace Renci.SshNet.Common 2 | { 3 | /// 4 | /// Provides prompt information when is raised 5 | /// 6 | public class AuthenticationPrompt 7 | { 8 | /// 9 | /// Gets the prompt sequence id. 10 | /// 11 | public int Id { get; private set; } 12 | 13 | /// 14 | /// Gets or sets a value indicating whether the user input should be echoed as characters are typed. 15 | /// 16 | /// 17 | /// true if the user input should be echoed as characters are typed; otherwise, false. 18 | /// 19 | public bool IsEchoed { get; private set; } 20 | 21 | /// 22 | /// Gets server information request. 23 | /// 24 | public string Request { get; private set; } 25 | 26 | /// 27 | /// Gets or sets server information response. 28 | /// 29 | /// 30 | /// The response. 31 | /// 32 | public string Response { get; set; } 33 | 34 | /// 35 | /// Initializes a new instance of the class. 36 | /// 37 | /// The sequence id. 38 | /// if set to true the user input should be echoed. 39 | /// The request. 40 | public AuthenticationPrompt(int id, bool isEchoed, string request) 41 | { 42 | Id = id; 43 | IsEchoed = isEchoed; 44 | Request = request; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/DataSources/OSSIndex3/PackageURL/MalformedPackageUrlException.cs: -------------------------------------------------------------------------------- 1 | // MIT License 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in all 11 | // copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | // SOFTWARE. 20 | 21 | using System; 22 | 23 | namespace PackageUrl 24 | { 25 | /// 26 | /// Exception class intended to be used for PackageURL parsing exceptions. 27 | /// 28 | public class MalformedPackageUrlException : Exception 29 | { 30 | /// 31 | /// Constructs a with the 32 | /// specified detail message. 33 | /// 34 | // The message that describes the error 35 | public MalformedPackageUrlException(string message) : base(message) 36 | { } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Audit/Vulnerability.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Newtonsoft.Json; 8 | 9 | namespace DevAudit.AuditLibrary 10 | { 11 | public class Vulnerability : IVulnerability 12 | { 13 | 14 | [JsonProperty("id")] 15 | public string Id { get; set; } 16 | 17 | [JsonProperty("title")] 18 | public string Title { get; set; } 19 | 20 | [JsonProperty("description")] 21 | public string Description { get; set; } 22 | 23 | [JsonProperty("details")] 24 | public string Details { get; set; } 25 | 26 | [JsonProperty("versions")] 27 | public string[] Versions { get; set; } 28 | 29 | [JsonProperty("references")] 30 | public string[] References { get; set; } 31 | 32 | [JsonIgnore] 33 | public string PackageId { get; set; } 34 | 35 | [JsonIgnore] 36 | public IPackage Package { get; set; } 37 | 38 | [JsonIgnore] 39 | public bool PackageVersionIsInRange { get; set; } 40 | 41 | [JsonIgnore] 42 | public string Reporter { get; set; } 43 | 44 | [JsonIgnore] 45 | public VulnerabilityReportType ReportType { get; set; } 46 | 47 | [JsonIgnore] 48 | public VulnerabilityReportCategory ReportCategory { get; set; } 49 | 50 | [JsonIgnore] 51 | public DateTime Published { get; set; } 52 | 53 | [JsonIgnore] 54 | public DateTime Updated { get; set; } 55 | 56 | [JsonIgnore] 57 | public string[] CVE { get; set; } 58 | 59 | [JsonIgnore] 60 | public VulnerabilityCVSS CVSS { get; set; } 61 | 62 | [JsonIgnore] 63 | public DataSourceInfo DataSource { get; set; } 64 | 65 | } 66 | 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpRmDirRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Renci.SshNet.Sftp.Responses; 4 | 5 | namespace Renci.SshNet.Sftp.Requests 6 | { 7 | internal class SftpRmDirRequest : SftpRequest 8 | { 9 | private byte[] _path; 10 | 11 | public override SftpMessageTypes SftpMessageType 12 | { 13 | get { return SftpMessageTypes.RmDir; } 14 | } 15 | 16 | public string Path 17 | { 18 | get { return Encoding.GetString(_path, 0, _path.Length); } 19 | private set { _path = Encoding.GetBytes(value); } 20 | } 21 | 22 | public Encoding Encoding { get; private set; } 23 | 24 | /// 25 | /// Gets the size of the message in bytes. 26 | /// 27 | /// 28 | /// The size of the messages in bytes. 29 | /// 30 | protected override int BufferCapacity 31 | { 32 | get 33 | { 34 | var capacity = base.BufferCapacity; 35 | capacity += 4; // Path length 36 | capacity += _path.Length; // Path 37 | return capacity; 38 | } 39 | } 40 | 41 | public SftpRmDirRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action statusAction) 42 | : base(protocolVersion, requestId, statusAction) 43 | { 44 | Encoding = encoding; 45 | Path = path; 46 | } 47 | 48 | protected override void LoadData() 49 | { 50 | base.LoadData(); 51 | _path = ReadBinary(); 52 | } 53 | 54 | protected override void SaveData() 55 | { 56 | base.SaveData(); 57 | WriteBinaryString(_path); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Connection/ChannelRequest/RequestInfo.cs: -------------------------------------------------------------------------------- 1 | using Renci.SshNet.Common; 2 | 3 | namespace Renci.SshNet.Messages.Connection 4 | { 5 | /// 6 | /// Represents type specific information for channel request. 7 | /// 8 | public abstract class RequestInfo : SshData 9 | { 10 | /// 11 | /// Gets the name of the request. 12 | /// 13 | /// 14 | /// The name of the request. 15 | /// 16 | public abstract string RequestName { get; } 17 | 18 | /// 19 | /// Gets or sets a value indicating whether reply message is needed. 20 | /// 21 | /// 22 | /// true if reply message is needed; otherwise, false. 23 | /// 24 | public bool WantReply { get; protected set; } 25 | 26 | /// 27 | /// Gets the size of the message in bytes. 28 | /// 29 | /// 30 | /// The size of the messages in bytes. 31 | /// 32 | protected override int BufferCapacity 33 | { 34 | get 35 | { 36 | var capacity = base.BufferCapacity; 37 | capacity += 1; // WantReply 38 | return capacity; 39 | } 40 | } 41 | 42 | /// 43 | /// Called when type specific data need to be loaded. 44 | /// 45 | protected override void LoadData() 46 | { 47 | WantReply = ReadBoolean(); 48 | } 49 | 50 | /// 51 | /// Called when type specific data need to be saved. 52 | /// 53 | protected override void SaveData() 54 | { 55 | Write(WantReply); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Renci.SshNet/ISubsystemSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using Renci.SshNet.Common; 4 | 5 | namespace Renci.SshNet 6 | { 7 | /// 8 | /// Base interface for SSH subsystem implementations. 9 | /// 10 | internal interface ISubsystemSession : IDisposable 11 | { 12 | /// 13 | /// Gets a value indicating whether this session is open. 14 | /// 15 | /// 16 | /// true if this session is open; otherwise, false. 17 | /// 18 | bool IsOpen { get; } 19 | 20 | /// 21 | /// Connects the subsystem using a new SSH channel session. 22 | /// 23 | /// The session is already connected. 24 | /// The method was called after the session was disposed. 25 | void Connect(); 26 | 27 | /// 28 | /// Disconnects the subsystem channel. 29 | /// 30 | void Disconnect(); 31 | 32 | /// 33 | /// Waits a specified time for a given to get signaled. 34 | /// 35 | /// The handle to wait for. 36 | /// The time to wait for to get signaled. 37 | /// The connection was closed by the server. 38 | /// The channel was closed. 39 | /// The handle did not get signaled within the specified . 40 | void WaitOnHandle(WaitHandle waitHandle, TimeSpan operationTimeout); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpRemoveRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Renci.SshNet.Sftp.Responses; 4 | 5 | namespace Renci.SshNet.Sftp.Requests 6 | { 7 | internal class SftpRemoveRequest : SftpRequest 8 | { 9 | private byte[] _fileName; 10 | 11 | public override SftpMessageTypes SftpMessageType 12 | { 13 | get { return SftpMessageTypes.Remove; } 14 | } 15 | 16 | public string Filename 17 | { 18 | get { return Encoding.GetString(_fileName, 0, _fileName.Length); } 19 | private set { _fileName = Encoding.GetBytes(value); } 20 | } 21 | 22 | public Encoding Encoding { get; private set; } 23 | 24 | /// 25 | /// Gets the size of the message in bytes. 26 | /// 27 | /// 28 | /// The size of the messages in bytes. 29 | /// 30 | protected override int BufferCapacity 31 | { 32 | get 33 | { 34 | var capacity = base.BufferCapacity; 35 | capacity += 4; // FileName length 36 | capacity += _fileName.Length; // FileName 37 | return capacity; 38 | } 39 | } 40 | 41 | public SftpRemoveRequest(uint protocolVersion, uint requestId, string filename, Encoding encoding, Action statusAction) 42 | : base(protocolVersion, requestId, statusAction) 43 | { 44 | Encoding = encoding; 45 | Filename = filename; 46 | } 47 | 48 | protected override void LoadData() 49 | { 50 | base.LoadData(); 51 | _fileName = ReadBinary(); 52 | } 53 | 54 | protected override void SaveData() 55 | { 56 | base.SaveData(); 57 | WriteBinaryString(_fileName); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/ExtendedRequests/HardLinkRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | 4 | namespace Renci.SshNet.Sftp.Requests 5 | { 6 | internal class HardLinkRequest : SftpExtendedRequest 7 | { 8 | private byte[] _oldPath; 9 | private byte[] _newPath; 10 | 11 | public string OldPath 12 | { 13 | get { return Utf8.GetString(_oldPath, 0, _oldPath.Length); } 14 | private set { _oldPath = Utf8.GetBytes(value); } 15 | } 16 | 17 | public string NewPath 18 | { 19 | get { return Utf8.GetString(_newPath, 0, _newPath.Length); } 20 | private set { _newPath = Utf8.GetBytes(value); } 21 | } 22 | 23 | /// 24 | /// Gets the size of the message in bytes. 25 | /// 26 | /// 27 | /// The size of the messages in bytes. 28 | /// 29 | protected override int BufferCapacity 30 | { 31 | get 32 | { 33 | var capacity = base.BufferCapacity; 34 | capacity += 4; // OldPath length 35 | capacity += _oldPath.Length; // OldPath 36 | capacity += 4; // NewPath length 37 | capacity += _newPath.Length; // NewPath 38 | return capacity; 39 | } 40 | } 41 | 42 | public HardLinkRequest(uint protocolVersion, uint requestId, string oldPath, string newPath, Action statusAction) 43 | : base(protocolVersion, requestId, statusAction, "hardlink@openssh.com") 44 | { 45 | OldPath = oldPath; 46 | NewPath = newPath; 47 | } 48 | 49 | protected override void SaveData() 50 | { 51 | base.SaveData(); 52 | WriteBinaryString(_oldPath); 53 | WriteBinaryString(_newPath); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpStatRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Renci.SshNet.Sftp.Responses; 4 | 5 | namespace Renci.SshNet.Sftp.Requests 6 | { 7 | internal class SftpStatRequest : SftpRequest 8 | { 9 | private byte[] _path; 10 | 11 | public override SftpMessageTypes SftpMessageType 12 | { 13 | get { return SftpMessageTypes.Stat; } 14 | } 15 | 16 | public string Path 17 | { 18 | get { return Encoding.GetString(_path, 0, _path.Length); } 19 | private set { _path = Encoding.GetBytes(value); } 20 | } 21 | 22 | public Encoding Encoding { get; private set; } 23 | 24 | /// 25 | /// Gets the size of the message in bytes. 26 | /// 27 | /// 28 | /// The size of the messages in bytes. 29 | /// 30 | protected override int BufferCapacity 31 | { 32 | get 33 | { 34 | var capacity = base.BufferCapacity; 35 | capacity += 4; // Path length 36 | capacity += _path.Length; // Path 37 | return capacity; 38 | } 39 | } 40 | 41 | public SftpStatRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action attrsAction, Action statusAction) 42 | : base(protocolVersion, requestId, statusAction) 43 | { 44 | Encoding = encoding; 45 | Path = path; 46 | SetAction(attrsAction); 47 | } 48 | 49 | protected override void LoadData() 50 | { 51 | base.LoadData(); 52 | _path = ReadBinary(); 53 | } 54 | 55 | protected override void SaveData() 56 | { 57 | base.SaveData(); 58 | WriteBinaryString(_path); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpLStatRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Renci.SshNet.Sftp.Responses; 4 | 5 | namespace Renci.SshNet.Sftp.Requests 6 | { 7 | internal class SftpLStatRequest : SftpRequest 8 | { 9 | private byte[] _path; 10 | 11 | public override SftpMessageTypes SftpMessageType 12 | { 13 | get { return SftpMessageTypes.LStat; } 14 | } 15 | 16 | public string Path 17 | { 18 | get { return Encoding.GetString(_path, 0, _path.Length); } 19 | private set { _path = Encoding.GetBytes(value); } 20 | } 21 | 22 | public Encoding Encoding { get; private set; } 23 | 24 | /// 25 | /// Gets the size of the message in bytes. 26 | /// 27 | /// 28 | /// The size of the messages in bytes. 29 | /// 30 | protected override int BufferCapacity 31 | { 32 | get 33 | { 34 | var capacity = base.BufferCapacity; 35 | capacity += 4; // Path length 36 | capacity += _path.Length; // Path 37 | return capacity; 38 | } 39 | } 40 | 41 | public SftpLStatRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action attrsAction, Action statusAction) 42 | : base(protocolVersion, requestId, statusAction) 43 | { 44 | Encoding = encoding; 45 | Path = path; 46 | SetAction(attrsAction); 47 | } 48 | 49 | protected override void LoadData() 50 | { 51 | base.LoadData(); 52 | _path = ReadBinary(); 53 | } 54 | 55 | protected override void SaveData() 56 | { 57 | base.SaveData(); 58 | WriteBinaryString(_path); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /DevAudit.AuditLibrary/Serializers/PackageSourceSerializer.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace DevAudit.AuditLibrary 9 | { 10 | public class PackageSourceSerializer : JsonConverter 11 | { 12 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 13 | { 14 | PackageSource val = (PackageSource)value; 15 | 16 | writer.WriteStartObject(); 17 | writer.WritePropertyName("Packages Audited"); 18 | serializer.Serialize(writer, val.Vulnerabilities.Values.Count()); 19 | writer.WritePropertyName("Vulnerabilities Found"); 20 | int total_vulnerabilities = val.Vulnerabilities.Sum(v => v.Value != null ? v.Value.Count(pv => pv.PackageVersionIsInRange) : 0); 21 | serializer.Serialize(writer, total_vulnerabilities); 22 | writer.WritePropertyName("Packages"); 23 | writer.WriteStartArray(); 24 | foreach (var vul in val.Vulnerabilities) 25 | { 26 | writer.WriteStartObject(); 27 | writer.WritePropertyName("Package"); 28 | serializer.Serialize(writer, vul.Key); 29 | writer.WritePropertyName("Vulnerabilities"); 30 | serializer.Serialize(writer, vul.Value); 31 | writer.WriteEndObject(); 32 | } 33 | writer.WriteEndObject(); 34 | } 35 | 36 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) 37 | { 38 | throw new NotImplementedException(); 39 | } 40 | 41 | public override bool CanConvert(Type objectType) 42 | { 43 | return typeof(PackageSource).IsAssignableFrom(objectType); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpOpenDirRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Renci.SshNet.Sftp.Responses; 4 | 5 | namespace Renci.SshNet.Sftp.Requests 6 | { 7 | internal class SftpOpenDirRequest : SftpRequest 8 | { 9 | private byte[] _path; 10 | 11 | public override SftpMessageTypes SftpMessageType 12 | { 13 | get { return SftpMessageTypes.OpenDir; } 14 | } 15 | 16 | public string Path 17 | { 18 | get { return Encoding.GetString(_path, 0, _path.Length); } 19 | private set { _path = Encoding.GetBytes(value); } 20 | } 21 | 22 | public Encoding Encoding { get; private set; } 23 | 24 | /// 25 | /// Gets the size of the message in bytes. 26 | /// 27 | /// 28 | /// The size of the messages in bytes. 29 | /// 30 | protected override int BufferCapacity 31 | { 32 | get 33 | { 34 | var capacity = base.BufferCapacity; 35 | capacity += 4; // Path length 36 | capacity += _path.Length; // Path 37 | return capacity; 38 | } 39 | } 40 | 41 | public SftpOpenDirRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action handleAction, Action statusAction) 42 | : base(protocolVersion, requestId, statusAction) 43 | { 44 | Encoding = encoding; 45 | Path = path; 46 | SetAction(handleAction); 47 | } 48 | 49 | protected override void LoadData() 50 | { 51 | base.LoadData(); 52 | 53 | _path = ReadBinary(); 54 | } 55 | 56 | protected override void SaveData() 57 | { 58 | base.SaveData(); 59 | 60 | WriteBinaryString(_path); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpReadLinkRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Renci.SshNet.Sftp.Responses; 4 | 5 | namespace Renci.SshNet.Sftp.Requests 6 | { 7 | internal class SftpReadLinkRequest : SftpRequest 8 | { 9 | private byte[] _path; 10 | 11 | public override SftpMessageTypes SftpMessageType 12 | { 13 | get { return SftpMessageTypes.ReadLink; } 14 | } 15 | 16 | public string Path 17 | { 18 | get { return Encoding.GetString(_path, 0, _path.Length); } 19 | private set { _path = Encoding.GetBytes(value); } 20 | } 21 | 22 | public Encoding Encoding { get; private set; } 23 | 24 | /// 25 | /// Gets the size of the message in bytes. 26 | /// 27 | /// 28 | /// The size of the messages in bytes. 29 | /// 30 | protected override int BufferCapacity 31 | { 32 | get 33 | { 34 | var capacity = base.BufferCapacity; 35 | capacity += 4; // Path length 36 | capacity += _path.Length; // Handle 37 | return capacity; 38 | } 39 | } 40 | 41 | public SftpReadLinkRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action nameAction, Action statusAction) 42 | : base(protocolVersion, requestId, statusAction) 43 | { 44 | Encoding = encoding; 45 | Path = path; 46 | SetAction(nameAction); 47 | } 48 | 49 | protected override void LoadData() 50 | { 51 | base.LoadData(); 52 | 53 | _path = ReadBinary(); 54 | } 55 | 56 | protected override void SaveData() 57 | { 58 | base.SaveData(); 59 | 60 | WriteBinaryString(_path); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Authentication/FailureMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Renci.SshNet.Messages.Authentication 4 | { 5 | /// 6 | /// Represents SSH_MSG_USERAUTH_FAILURE message. 7 | /// 8 | [Message("SSH_MSG_USERAUTH_FAILURE", 51)] 9 | public class FailureMessage : Message 10 | { 11 | /// 12 | /// Gets or sets the allowed authentications if available. 13 | /// 14 | /// 15 | /// The allowed authentications. 16 | /// 17 | public string[] AllowedAuthentications { get; set; } 18 | 19 | /// 20 | /// Gets failure message. 21 | /// 22 | public string Message { get; private set; } 23 | 24 | /// 25 | /// Gets a value indicating whether authentication is partially successful. 26 | /// 27 | /// 28 | /// true if partially successful; otherwise, false. 29 | /// 30 | public bool PartialSuccess { get; private set; } 31 | 32 | /// 33 | /// Called when type specific data need to be loaded. 34 | /// 35 | protected override void LoadData() 36 | { 37 | AllowedAuthentications = ReadNamesList(); 38 | PartialSuccess = ReadBoolean(); 39 | if (PartialSuccess) 40 | { 41 | Message = string.Join(",", AllowedAuthentications); 42 | } 43 | } 44 | 45 | /// 46 | /// Called when type specific data need to be saved. 47 | /// 48 | protected override void SaveData() 49 | { 50 | throw new NotImplementedException(); 51 | } 52 | 53 | internal override void Process(Session session) 54 | { 55 | session.OnUserAuthenticationFailureReceived(this); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /DevAudit.CommandLine/HtmlOutput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DevAudit.CommandLine 8 | { 9 | class HtmlOutput 10 | { 11 | StringBuilder _Html; 12 | 13 | public HtmlOutput() 14 | { 15 | _Html = new StringBuilder(); 16 | } 17 | 18 | public void AddParagraph() 19 | { 20 | _Html.AppendLine("

"); 21 | } 22 | 23 | public void EndParagraph() 24 | { 25 | _Html.AppendLine("

"); 26 | } 27 | 28 | public void AddHeadLine(string line, ConsoleColor consoleColor = ConsoleColor.Black) 29 | { 30 | string tmpHeadLine = $"

{line}

"; 31 | if (consoleColor != ConsoleColor.Black) 32 | tmpHeadLine = $"{tmpHeadLine}"; 33 | 34 | _Html.AppendLine(tmpHeadLine); 35 | } 36 | 37 | public void Add(string text, ConsoleColor consoleColor = ConsoleColor.Black,bool AddNewLine = false) 38 | { 39 | var htmlToAdd = new StringBuilder(); 40 | 41 | if (consoleColor == ConsoleColor.Black) 42 | htmlToAdd.Append(text); 43 | else 44 | htmlToAdd.Append($"{text}"); 45 | 46 | if(AddNewLine) 47 | { 48 | htmlToAdd.AppendLine("
"); 49 | } 50 | 51 | _Html.Append(htmlToAdd); 52 | } 53 | 54 | public void AddLine(string line,ConsoleColor consoleColor = ConsoleColor.Black) 55 | { 56 | Add(line, consoleColor, true); 57 | } 58 | 59 | public override string ToString() 60 | { 61 | return " " + _Html.ToString() + " "; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpUnblockRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | 4 | namespace Renci.SshNet.Sftp.Requests 5 | { 6 | internal class SftpUnblockRequest : SftpRequest 7 | { 8 | public override SftpMessageTypes SftpMessageType 9 | { 10 | get { return SftpMessageTypes.Unblock; } 11 | } 12 | 13 | public byte[] Handle { get; private set; } 14 | 15 | public ulong Offset { get; private set; } 16 | 17 | public ulong Length { get; private set; } 18 | 19 | /// 20 | /// Gets the size of the message in bytes. 21 | /// 22 | /// 23 | /// The size of the messages in bytes. 24 | /// 25 | protected override int BufferCapacity 26 | { 27 | get 28 | { 29 | var capacity = base.BufferCapacity; 30 | capacity += 4; // Handle length 31 | capacity += Handle.Length; // Handle 32 | capacity += 8; // Offset 33 | capacity += 8; // Length 34 | return capacity; 35 | } 36 | } 37 | 38 | public SftpUnblockRequest(uint protocolVersion, uint requestId, byte[] handle, UInt64 offset, UInt64 length, Action statusAction) 39 | : base(protocolVersion, requestId, statusAction) 40 | { 41 | Handle = handle; 42 | Offset = offset; 43 | Length = length; 44 | } 45 | 46 | protected override void LoadData() 47 | { 48 | base.LoadData(); 49 | Handle = ReadBinary(); 50 | Offset = ReadUInt64(); 51 | Length = ReadUInt64(); 52 | } 53 | 54 | protected override void SaveData() 55 | { 56 | base.SaveData(); 57 | WriteBinaryString(Handle); 58 | Write(Offset); 59 | Write(Length); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Renci.SshNet/Common/HostKeyEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Abstractions; 3 | using Renci.SshNet.Security; 4 | 5 | namespace Renci.SshNet.Common 6 | { 7 | /// 8 | /// Provides data for the HostKeyReceived event. 9 | /// 10 | public class HostKeyEventArgs : EventArgs 11 | { 12 | /// 13 | /// Gets or sets a value indicating whether host key can be trusted. 14 | /// 15 | /// 16 | /// true if host key can be trusted; otherwise, false. 17 | /// 18 | public bool CanTrust { get; set; } 19 | 20 | /// 21 | /// Gets the host key. 22 | /// 23 | public byte[] HostKey { get; private set; } 24 | 25 | /// 26 | /// Gets the host key name. 27 | /// 28 | public string HostKeyName{ get; private set; } 29 | 30 | /// 31 | /// Gets the finger print. 32 | /// 33 | public byte[] FingerPrint { get; private set; } 34 | 35 | /// 36 | /// Gets the length of the key in bits. 37 | /// 38 | /// 39 | /// The length of the key in bits. 40 | /// 41 | public int KeyLength { get; private set; } 42 | 43 | /// 44 | /// Initializes a new instance of the class. 45 | /// 46 | /// The host. 47 | public HostKeyEventArgs(KeyHostAlgorithm host) 48 | { 49 | CanTrust = true; // Set default value 50 | 51 | HostKey = host.Data; 52 | 53 | HostKeyName = host.Name; 54 | 55 | KeyLength = host.Key.KeyLength; 56 | 57 | using (var md5 = CryptoAbstraction.CreateMD5()) 58 | { 59 | FingerPrint = md5.ComputeHash(host.Data); 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpRealPathRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Renci.SshNet.Sftp.Responses; 4 | 5 | namespace Renci.SshNet.Sftp.Requests 6 | { 7 | internal class SftpRealPathRequest : SftpRequest 8 | { 9 | private byte[] _path; 10 | 11 | public override SftpMessageTypes SftpMessageType 12 | { 13 | get { return SftpMessageTypes.RealPath; } 14 | } 15 | 16 | public string Path 17 | { 18 | get { return Encoding.GetString(_path, 0, _path.Length); } 19 | private set { _path = Encoding.GetBytes(value); } 20 | } 21 | 22 | public Encoding Encoding { get; private set; } 23 | 24 | /// 25 | /// Gets the size of the message in bytes. 26 | /// 27 | /// 28 | /// The size of the messages in bytes. 29 | /// 30 | protected override int BufferCapacity 31 | { 32 | get 33 | { 34 | var capacity = base.BufferCapacity; 35 | capacity += 4; // Path length 36 | capacity += _path.Length; // Path 37 | return capacity; 38 | } 39 | } 40 | 41 | public SftpRealPathRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action nameAction, Action statusAction) 42 | : base(protocolVersion, requestId, statusAction) 43 | { 44 | if (nameAction == null) 45 | throw new ArgumentNullException("nameAction"); 46 | if (statusAction == null) 47 | throw new ArgumentNullException("statusAction"); 48 | 49 | Encoding = encoding; 50 | Path = path; 51 | SetAction(nameAction); 52 | 53 | } 54 | 55 | protected override void SaveData() 56 | { 57 | base.SaveData(); 58 | WriteBinaryString(_path); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /BuildCommon/Mono.Common.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CommonBuildDefineModifiedAssemblyVersion; 7 | $(CompileDependsOn); 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Renci.SshNet/Messages/Authentication/InformationResponseMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Renci.SshNet.Messages.Authentication 5 | { 6 | /// 7 | /// Represents SSH_MSG_USERAUTH_INFO_RESPONSE message. 8 | /// 9 | [Message("SSH_MSG_USERAUTH_INFO_RESPONSE", 61)] 10 | internal class InformationResponseMessage : Message 11 | { 12 | /// 13 | /// Gets authentication responses. 14 | /// 15 | public IList Responses { get; private set; } 16 | 17 | /// 18 | /// Gets the size of the message in bytes. 19 | /// 20 | /// 21 | /// -1 to indicate that the size of the message cannot be determined, 22 | /// or is too costly to calculate. 23 | /// 24 | protected override int BufferCapacity 25 | { 26 | get { return -1; } 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the class. 31 | /// 32 | public InformationResponseMessage() 33 | { 34 | Responses = new List(); 35 | } 36 | 37 | /// 38 | /// Called when type specific data need to be loaded. 39 | /// 40 | protected override void LoadData() 41 | { 42 | throw new NotImplementedException(); 43 | } 44 | 45 | /// 46 | /// Called when type specific data need to be saved. 47 | /// 48 | protected override void SaveData() 49 | { 50 | Write((uint) Responses.Count); 51 | foreach (var response in Responses) 52 | { 53 | Write(response); 54 | } 55 | } 56 | 57 | internal override void Process(Session session) 58 | { 59 | throw new NotImplementedException(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Renci.SshNet/Sftp/Requests/SftpReadRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Renci.SshNet.Sftp.Responses; 3 | 4 | namespace Renci.SshNet.Sftp.Requests 5 | { 6 | internal class SftpReadRequest : SftpRequest 7 | { 8 | public override SftpMessageTypes SftpMessageType 9 | { 10 | get { return SftpMessageTypes.Read; } 11 | } 12 | 13 | public byte[] Handle { get; private set; } 14 | 15 | public ulong Offset { get; private set; } 16 | 17 | public uint Length { get; private set; } 18 | 19 | /// 20 | /// Gets the size of the message in bytes. 21 | /// 22 | /// 23 | /// The size of the messages in bytes. 24 | /// 25 | protected override int BufferCapacity 26 | { 27 | get 28 | { 29 | var capacity = base.BufferCapacity; 30 | capacity += 4; // Handle length 31 | capacity += Handle.Length; // Handle 32 | capacity += 8; // Offset 33 | capacity += 4; // Length 34 | return capacity; 35 | } 36 | } 37 | 38 | public SftpReadRequest(uint protocolVersion, uint requestId, byte[] handle, UInt64 offset, UInt32 length, Action dataAction, Action statusAction) 39 | : base(protocolVersion, requestId, statusAction) 40 | { 41 | Handle = handle; 42 | Offset = offset; 43 | Length = length; 44 | SetAction(dataAction); 45 | } 46 | 47 | protected override void LoadData() 48 | { 49 | base.LoadData(); 50 | Handle = ReadBinary(); 51 | Offset = ReadUInt64(); 52 | Length = ReadUInt32(); 53 | } 54 | 55 | protected override void SaveData() 56 | { 57 | base.SaveData(); 58 | WriteBinaryString(Handle); 59 | Write(Offset); 60 | Write(Length); 61 | } 62 | } 63 | } 64 | --------------------------------------------------------------------------------