├── .gitattributes ├── .gitignore ├── Image ├── image-20240731134334232.png ├── image-20240731134357549.png ├── image-20240731134433626.png ├── image-20240731144400465.png ├── image-20240731151455139.png ├── image-20240731162159957.png ├── image-20240801112506349.png ├── image-20240801125524783.png ├── image-20240801125922524.png ├── image-20240801131225528.png ├── image-20240801131239111.png ├── image-20240801131945885.png ├── image-20240801134555502.png ├── image-20240801170821991.png └── image-20240804172810364.png ├── Powershell ├── Invoke-SharpScan.ps1 ├── Patch.ps1 ├── README.md └── stub.ps1 ├── README.md ├── SharpScan.Core ├── Common │ ├── CheckIP.cs │ ├── Config.cs │ └── GetOSInfo.cs ├── Handle │ └── HandlePOC.cs ├── Mono.Options │ └── Options.cs ├── Pkg │ ├── EDRCheck.cs │ ├── Helper.cs │ ├── HookConhost.cs │ ├── Lib │ │ ├── NBNSResolver.cs │ │ ├── NTLMSSPBuffer.cs │ │ ├── NTLMSSPExtract.cs │ │ ├── SSPKey.cs │ │ ├── SSPKeyOutput.cs │ │ ├── TargetParser.cs │ │ ├── TimeoutSocket.cs │ │ └── Writer.cs │ ├── RdpFull │ │ ├── Cryptography │ │ │ ├── ABCDStruct.cs │ │ │ ├── HMACT64.cs │ │ │ ├── MD4.cs │ │ │ ├── MD4Managed.cs │ │ │ ├── MD5.cs │ │ │ └── RC4.cs │ │ ├── Encoding │ │ │ └── ASCIIEncoding.cs │ │ ├── Exceptions │ │ │ └── RDFatalException.cs │ │ ├── Protocol │ │ │ ├── Negotiation │ │ │ │ ├── ASN1.cs │ │ │ │ ├── CredSSP.cs │ │ │ │ ├── MCS.cs │ │ │ │ ├── NTLM.cs │ │ │ │ └── RdpPacket.cs │ │ │ ├── Network │ │ │ │ ├── Network.cs │ │ │ │ ├── NetworkSocket.cs │ │ │ │ └── PacketLogger.cs │ │ │ └── Processing │ │ │ │ ├── ISO.cs │ │ │ │ └── IsoLayer.cs │ │ └── Settings │ │ │ └── Options.cs │ ├── SSH │ │ ├── Cipher │ │ │ ├── AES │ │ │ │ ├── AES128CBC.cs │ │ │ │ ├── BlowfishCBC.cs │ │ │ │ ├── DH.cs │ │ │ │ ├── HMACMD5.cs │ │ │ │ ├── HMACMD596.cs │ │ │ │ ├── HMACSHA1.cs │ │ │ │ ├── HMACSHA196.cs │ │ │ │ ├── KeyPairGenDSA.cs │ │ │ │ ├── KeyPairGenRSA.cs │ │ │ │ ├── MD5.cs │ │ │ │ ├── Random.cs │ │ │ │ ├── SHA1.cs │ │ │ │ ├── SignatureDSA.cs │ │ │ │ ├── SignatureRSA.cs │ │ │ │ └── TripleDESCBC.cs │ │ │ ├── Buffer.cs │ │ │ ├── Channel.cs │ │ │ ├── Channel.old.cs │ │ │ ├── ChannelDirectTCPIP.cs │ │ │ ├── ChannelExec.cs │ │ │ ├── ChannelForwardedTCPIP.cs │ │ │ ├── ChannelSession.cs │ │ │ ├── ChannelSftp.cs │ │ │ ├── ChannelSftpStreamGet.cs │ │ │ ├── ChannelSftpStreamPut.cs │ │ │ ├── ChannelShell.cs │ │ │ ├── ChannelSubsystem.cs │ │ │ ├── ChannelX11.cs │ │ │ ├── Cipher.cs │ │ │ ├── Compression.cs │ │ │ ├── DH.cs │ │ │ ├── DHG1.cs │ │ │ ├── DHGEX.cs │ │ │ ├── ForwardedTCPIPDaemon.cs │ │ │ ├── HASH.cs │ │ │ ├── HostKey.cs │ │ │ ├── HostKeyRepository.cs │ │ │ ├── IO.cs │ │ │ ├── Identity.cs │ │ │ ├── IdentityFile.cs │ │ │ ├── JSch.cs │ │ │ ├── JSchAuthCancelException.cs │ │ │ ├── JSchException.cs │ │ │ ├── JSchPartialAuthException.cs │ │ │ ├── KeyExchange.cs │ │ │ ├── KeyPair.cs │ │ │ ├── KeyPairDSA.cs │ │ │ ├── KeyPairGenDSA.cs │ │ │ ├── KeyPairGenRSA.cs │ │ │ ├── KeyPairRSA.cs │ │ │ ├── KnownHosts.cs │ │ │ ├── MAC.cs │ │ │ ├── Packet.cs │ │ │ ├── PortWatcher.cs │ │ │ ├── Proxy.cs │ │ │ ├── Random.cs │ │ │ ├── Request.cs │ │ │ ├── RequestExec.cs │ │ │ ├── RequestPtyReq.cs │ │ │ ├── RequestSftp.cs │ │ │ ├── RequestShell.cs │ │ │ ├── RequestSignal.cs │ │ │ ├── RequestSubsystem.cs │ │ │ ├── RequestWindowChange.cs │ │ │ ├── RequestX11.cs │ │ │ ├── ServerSocketFactory.cs │ │ │ ├── Session.cs │ │ │ ├── SftpATTRS.cs │ │ │ ├── SftpException.cs │ │ │ ├── SftpProgressMonitor.cs │ │ │ ├── SignatureDSA.cs │ │ │ ├── SignatureRSA.cs │ │ │ ├── SocketFactory.cs │ │ │ ├── UIKeyboardInteractive.cs │ │ │ ├── UserAuth.cs │ │ │ ├── UserAuthKeyboardInteractive.cs │ │ │ ├── UserAuthNone.cs │ │ │ ├── UserAuthPassword.cs │ │ │ ├── UserAuthPublicKey.cs │ │ │ ├── UserInfo.cs │ │ │ └── Util.cs │ │ ├── DHKeyGeneration.cs │ │ ├── DHParameters.cs │ │ ├── DiffieHellman.cs │ │ ├── DiffieHellmanManaged.cs │ │ ├── ITransferProtocol.cs │ │ ├── Org.Mentalis.Security.Cryptography │ │ │ └── HMAC.cs │ │ ├── Scp.cs │ │ ├── Sftp.cs │ │ ├── SshBase.cs │ │ ├── SshExe.cs │ │ ├── SshShell.cs │ │ ├── SshStream.cs │ │ ├── SshTransferException.cs │ │ ├── SshTransferProtocolBase.cs │ │ ├── Streams │ │ │ ├── CombinedStream.cs │ │ │ ├── InputStream.cs │ │ │ ├── OutputStream.cs │ │ │ ├── PipedInputStream.cs │ │ │ ├── PipedOutputStream.cs │ │ │ └── ProtectedConsoleStream.cs │ │ ├── System │ │ │ ├── Exception.cs │ │ │ ├── Platform.cs │ │ │ ├── RuntimeException.cs │ │ │ ├── String.cs │ │ │ ├── System.cs │ │ │ ├── io │ │ │ │ ├── File.cs │ │ │ │ ├── FileInputStream.cs │ │ │ │ ├── FileOutputStream.cs │ │ │ │ ├── InputStream.cs │ │ │ │ ├── InputStreamWrapper.cs │ │ │ │ ├── JStream.cs │ │ │ │ └── OutputStream.cs │ │ │ ├── lang │ │ │ │ ├── Class.cs │ │ │ │ ├── Integer.cs │ │ │ │ ├── Runnable.cs │ │ │ │ ├── StringBuffer.cs │ │ │ │ └── Thread.cs │ │ │ ├── net │ │ │ │ ├── InetAddress.cs │ │ │ │ ├── ServerSocket.cs │ │ │ │ └── Socket.cs │ │ │ └── util │ │ │ │ ├── Arrays.cs │ │ │ │ ├── Enumeration.cs │ │ │ │ ├── Hashtable.cs │ │ │ │ ├── JavaString.cs │ │ │ │ └── Vector.cs │ │ └── mono │ │ │ ├── BigInteger.cs │ │ │ ├── ConfidenceFactor.cs │ │ │ ├── MiniParser.cs │ │ │ ├── NextPrimeFinder.cs │ │ │ ├── PrimalityTests.cs │ │ │ ├── PrimeGeneratorBase.cs │ │ │ ├── SecurityParser.cs │ │ │ └── SequentialSearchPrimeGeneratorBase.cs │ ├── Services │ │ ├── NBNS.cs │ │ ├── SMB.cs │ │ └── WMI.cs │ └── Socks5 │ │ ├── Chunked.cs │ │ ├── Encryption │ │ ├── DarthEncrypt.cs │ │ └── SocksEncryption.cs │ │ ├── ExamplePlugins │ │ ├── ClientConnectHandlerExample.cs │ │ ├── ConnectHandlerExample.cs │ │ ├── DataHandlerExample.cs │ │ └── LoginHandlerExample.cs │ │ ├── ExtensionAttribute.cs │ │ ├── Extensions.cs │ │ ├── Plugin │ │ ├── ClientConnectedHandler.cs │ │ ├── ClientDisconnectedHandler.cs │ │ ├── ConnectHandler.cs │ │ ├── ConnectSocketOverrideHandler.cs │ │ ├── DataHandler.cs │ │ ├── GenericPlugin.cs │ │ ├── LoginHandler.cs │ │ ├── LoginStatus.cs │ │ └── PluginLoader.cs │ │ ├── Socks │ │ ├── AddressType.cs │ │ ├── AuthTypes.cs │ │ ├── HeaderTypes.cs │ │ ├── Socks5.cs │ │ ├── SocksClient.cs │ │ ├── SocksError.cs │ │ ├── SocksRequest.cs │ │ ├── SocksSpecialTunnel.cs │ │ ├── SocksTunnel.cs │ │ ├── StreamTypes.cs │ │ └── User.cs │ │ ├── Socks5Client │ │ ├── Events │ │ │ ├── Socks5ClientArgs.cs │ │ │ └── Socks5ClientDataArgs.cs │ │ ├── Socks.cs │ │ └── Socks5Client.cs │ │ ├── SocksServer │ │ └── Socks5Server.cs │ │ ├── TCP │ │ ├── ByteType.cs │ │ ├── Client.cs │ │ ├── ClientEventArgs.cs │ │ ├── DataEventArgs.cs │ │ ├── PacketType.cs │ │ ├── SocksClientEventArgs.cs │ │ ├── Stats.cs │ │ └── TcpServer.cs │ │ └── Utils.cs ├── Plugins │ ├── FileSearch.cs │ ├── Ftp.cs │ ├── MS17-010.cs │ ├── Rdp.cs │ ├── SMBEnum.cs │ ├── SMBGhost.cs │ ├── SSH.cs │ ├── Socks5.cs │ ├── WebTitle.cs │ └── ZeroLogon.cs ├── Program.cs ├── Properties │ └── PublishProfiles │ │ ├── FolderProfile.pubxml │ │ └── FolderProfile.pubxml.user ├── Scan │ ├── ArpScan.cs │ ├── ICMPScan.cs │ ├── TcpPortScan.cs │ └── UdpPortScan.cs ├── SharpScan.Core.csproj └── SharpScan.Core.csproj.user ├── SharpScan ├── Common │ ├── CheckIP.cs │ ├── Config.cs │ └── GetOSInfo.cs ├── FodyWeavers.xml ├── Handle │ └── HandlePOC.cs ├── Mono.Options │ └── Options.cs ├── Pkg │ ├── Helper.cs │ ├── HookConhost.cs │ ├── RdpFull │ │ ├── Cryptography │ │ │ ├── ABCDStruct.cs │ │ │ ├── HMACT64.cs │ │ │ ├── MD4.cs │ │ │ ├── MD4Managed.cs │ │ │ ├── MD5.cs │ │ │ └── RC4.cs │ │ ├── Encoding │ │ │ └── ASCIIEncoding.cs │ │ ├── Exceptions │ │ │ └── RDFatalException.cs │ │ ├── Protocol │ │ │ ├── Negotiation │ │ │ │ ├── ASN1.cs │ │ │ │ ├── CredSSP.cs │ │ │ │ ├── MCS.cs │ │ │ │ ├── NTLM.cs │ │ │ │ └── RdpPacket.cs │ │ │ ├── Network │ │ │ │ ├── Network.cs │ │ │ │ ├── NetworkSocket.cs │ │ │ │ └── PacketLogger.cs │ │ │ └── Processing │ │ │ │ ├── ISO.cs │ │ │ │ └── IsoLayer.cs │ │ └── Settings │ │ │ └── Options.cs │ ├── SSH │ │ ├── Cipher │ │ │ ├── AES │ │ │ │ ├── AES128CBC.cs │ │ │ │ ├── BlowfishCBC.cs │ │ │ │ ├── DH.cs │ │ │ │ ├── HMACMD5.cs │ │ │ │ ├── HMACMD596.cs │ │ │ │ ├── HMACSHA1.cs │ │ │ │ ├── HMACSHA196.cs │ │ │ │ ├── KeyPairGenDSA.cs │ │ │ │ ├── KeyPairGenRSA.cs │ │ │ │ ├── MD5.cs │ │ │ │ ├── Random.cs │ │ │ │ ├── SHA1.cs │ │ │ │ ├── SignatureDSA.cs │ │ │ │ ├── SignatureRSA.cs │ │ │ │ └── TripleDESCBC.cs │ │ │ ├── Buffer.cs │ │ │ ├── Channel.cs │ │ │ ├── Channel.old.cs │ │ │ ├── ChannelDirectTCPIP.cs │ │ │ ├── ChannelExec.cs │ │ │ ├── ChannelForwardedTCPIP.cs │ │ │ ├── ChannelSession.cs │ │ │ ├── ChannelSftp.cs │ │ │ ├── ChannelSftpStreamGet.cs │ │ │ ├── ChannelSftpStreamPut.cs │ │ │ ├── ChannelShell.cs │ │ │ ├── ChannelSubsystem.cs │ │ │ ├── ChannelX11.cs │ │ │ ├── Cipher.cs │ │ │ ├── Compression.cs │ │ │ ├── DH.cs │ │ │ ├── DHG1.cs │ │ │ ├── DHGEX.cs │ │ │ ├── ForwardedTCPIPDaemon.cs │ │ │ ├── HASH.cs │ │ │ ├── HostKey.cs │ │ │ ├── HostKeyRepository.cs │ │ │ ├── IO.cs │ │ │ ├── Identity.cs │ │ │ ├── IdentityFile.cs │ │ │ ├── JSch.cs │ │ │ ├── JSchAuthCancelException.cs │ │ │ ├── JSchException.cs │ │ │ ├── JSchPartialAuthException.cs │ │ │ ├── KeyExchange.cs │ │ │ ├── KeyPair.cs │ │ │ ├── KeyPairDSA.cs │ │ │ ├── KeyPairGenDSA.cs │ │ │ ├── KeyPairGenRSA.cs │ │ │ ├── KeyPairRSA.cs │ │ │ ├── KnownHosts.cs │ │ │ ├── MAC.cs │ │ │ ├── Packet.cs │ │ │ ├── PortWatcher.cs │ │ │ ├── Proxy.cs │ │ │ ├── Random.cs │ │ │ ├── Request.cs │ │ │ ├── RequestExec.cs │ │ │ ├── RequestPtyReq.cs │ │ │ ├── RequestSftp.cs │ │ │ ├── RequestShell.cs │ │ │ ├── RequestSignal.cs │ │ │ ├── RequestSubsystem.cs │ │ │ ├── RequestWindowChange.cs │ │ │ ├── RequestX11.cs │ │ │ ├── ServerSocketFactory.cs │ │ │ ├── Session.cs │ │ │ ├── SftpATTRS.cs │ │ │ ├── SftpException.cs │ │ │ ├── SftpProgressMonitor.cs │ │ │ ├── SignatureDSA.cs │ │ │ ├── SignatureRSA.cs │ │ │ ├── SocketFactory.cs │ │ │ ├── UIKeyboardInteractive.cs │ │ │ ├── UserAuth.cs │ │ │ ├── UserAuthKeyboardInteractive.cs │ │ │ ├── UserAuthNone.cs │ │ │ ├── UserAuthPassword.cs │ │ │ ├── UserAuthPublicKey.cs │ │ │ ├── UserInfo.cs │ │ │ └── Util.cs │ │ ├── DHKeyGeneration.cs │ │ ├── DHParameters.cs │ │ ├── DiffieHellman.cs │ │ ├── DiffieHellmanManaged.cs │ │ ├── ITransferProtocol.cs │ │ ├── Org.Mentalis.Security.Cryptography │ │ │ └── HMAC.cs │ │ ├── Scp.cs │ │ ├── Sftp.cs │ │ ├── SshBase.cs │ │ ├── SshExe.cs │ │ ├── SshShell.cs │ │ ├── SshStream.cs │ │ ├── SshTransferException.cs │ │ ├── SshTransferProtocolBase.cs │ │ ├── Streams │ │ │ ├── CombinedStream.cs │ │ │ ├── InputStream.cs │ │ │ ├── OutputStream.cs │ │ │ ├── PipedInputStream.cs │ │ │ ├── PipedOutputStream.cs │ │ │ └── ProtectedConsoleStream.cs │ │ ├── System │ │ │ ├── Exception.cs │ │ │ ├── Platform.cs │ │ │ ├── RuntimeException.cs │ │ │ ├── String.cs │ │ │ ├── System.cs │ │ │ ├── io │ │ │ │ ├── File.cs │ │ │ │ ├── FileInputStream.cs │ │ │ │ ├── FileOutputStream.cs │ │ │ │ ├── InputStream.cs │ │ │ │ ├── InputStreamWrapper.cs │ │ │ │ ├── JStream.cs │ │ │ │ └── OutputStream.cs │ │ │ ├── lang │ │ │ │ ├── Class.cs │ │ │ │ ├── Integer.cs │ │ │ │ ├── Runnable.cs │ │ │ │ ├── StringBuffer.cs │ │ │ │ └── Thread.cs │ │ │ ├── net │ │ │ │ ├── InetAddress.cs │ │ │ │ ├── ServerSocket.cs │ │ │ │ └── Socket.cs │ │ │ └── util │ │ │ │ ├── Arrays.cs │ │ │ │ ├── Enumeration.cs │ │ │ │ ├── Hashtable.cs │ │ │ │ ├── JavaString.cs │ │ │ │ └── Vector.cs │ │ └── mono │ │ │ ├── BigInteger.cs │ │ │ ├── ConfidenceFactor.cs │ │ │ ├── MiniParser.cs │ │ │ ├── NextPrimeFinder.cs │ │ │ ├── PrimalityTests.cs │ │ │ ├── PrimeGeneratorBase.cs │ │ │ ├── SecurityParser.cs │ │ │ └── SequentialSearchPrimeGeneratorBase.cs │ ├── Services │ │ ├── Lib │ │ │ ├── NBNSResolver.cs │ │ │ ├── NTLMSSPBuffer.cs │ │ │ ├── NTLMSSPExtract.cs │ │ │ ├── SSPKey.cs │ │ │ ├── SSPKeyOutput.cs │ │ │ ├── TargetParser.cs │ │ │ ├── TimeoutSocket.cs │ │ │ └── Writer.cs │ │ ├── NBNS.cs │ │ ├── SMB.cs │ │ └── WMI.cs │ ├── SetTls12UserRegistryKeys.cs │ ├── Socks5 │ │ ├── Chunked.cs │ │ ├── Encryption │ │ │ ├── DarthEncrypt.cs │ │ │ └── SocksEncryption.cs │ │ ├── ExamplePlugins │ │ │ ├── ClientConnectHandlerExample.cs │ │ │ ├── ConnectHandlerExample.cs │ │ │ ├── DataHandlerExample.cs │ │ │ └── LoginHandlerExample.cs │ │ ├── ExtensionAttribute.cs │ │ ├── Extensions.cs │ │ ├── Plugin │ │ │ ├── ClientConnectedHandler.cs │ │ │ ├── ClientDisconnectedHandler.cs │ │ │ ├── ConnectHandler.cs │ │ │ ├── ConnectSocketOverrideHandler.cs │ │ │ ├── DataHandler.cs │ │ │ ├── GenericPlugin.cs │ │ │ ├── LoginHandler.cs │ │ │ ├── LoginStatus.cs │ │ │ └── PluginLoader.cs │ │ ├── Socks │ │ │ ├── AddressType.cs │ │ │ ├── AuthTypes.cs │ │ │ ├── HeaderTypes.cs │ │ │ ├── Socks5.cs │ │ │ ├── SocksClient.cs │ │ │ ├── SocksError.cs │ │ │ ├── SocksRequest.cs │ │ │ ├── SocksSpecialTunnel.cs │ │ │ ├── SocksTunnel.cs │ │ │ ├── StreamTypes.cs │ │ │ └── User.cs │ │ ├── Socks5Client │ │ │ ├── Events │ │ │ │ ├── Socks5ClientArgs.cs │ │ │ │ └── Socks5ClientDataArgs.cs │ │ │ ├── Socks.cs │ │ │ └── Socks5Client.cs │ │ ├── SocksServer │ │ │ └── Socks5Server.cs │ │ ├── TCP │ │ │ ├── ByteType.cs │ │ │ ├── Client.cs │ │ │ ├── ClientEventArgs.cs │ │ │ ├── DataEventArgs.cs │ │ │ ├── PacketType.cs │ │ │ ├── SocksClientEventArgs.cs │ │ │ ├── Stats.cs │ │ │ └── TcpServer.cs │ │ └── Utils.cs │ ├── System.Threading.Tasks35 │ │ ├── StreamExtensions.cs │ │ ├── System.Collections.Concurrent.Partitioners │ │ │ ├── EnumerablePartitioner.cs │ │ │ ├── ListPartitioner.cs │ │ │ └── UserRangePartitioner.cs │ │ ├── System.Collections.Concurrent │ │ │ ├── BlockingCollection.cs │ │ │ ├── ConcurrentBag.cs │ │ │ ├── ConcurrentDictionary.cs │ │ │ ├── ConcurrentOrderedList.cs │ │ │ ├── ConcurrentQueue.cs │ │ │ ├── ConcurrentStack.cs │ │ │ ├── IProducerConsumerCollection.cs │ │ │ ├── OrderablePartitioner.cs │ │ │ ├── Partitioner.cs │ │ │ └── SplitOrderedList.cs │ │ ├── System.Collections.Generic │ │ │ ├── CollectionDebuggerView.cs │ │ │ ├── DefaultEqualityComparer.cs │ │ │ └── GenericEqualityComparer.cs │ │ ├── System.Collections │ │ │ ├── IStructuralComparable.cs │ │ │ └── IStructuralEquatable.cs │ │ ├── System.Diagnostics │ │ │ └── CodeAnalysis.cs │ │ ├── System.Runtime.CompilerServices │ │ │ ├── AsyncStateMachineAttribute.cs │ │ │ ├── AsyncTaskMethodBuilder.cs │ │ │ ├── AsyncTaskMethodBuilder_T.cs │ │ │ ├── AsyncVoidMethodBuilder.cs │ │ │ ├── ConfiguredTaskAwaitable.cs │ │ │ ├── ConfiguredTaskAwaitable_T.cs │ │ │ ├── IAsyncStateMachine.cs │ │ │ ├── ICriticalNotifyCompletion.cs │ │ │ ├── INotifyCompletion.cs │ │ │ ├── StateMachineAttribute.cs │ │ │ ├── TaskAwaiter.cs │ │ │ ├── TaskAwaiter_T.cs │ │ │ └── YieldAwaitable.cs │ │ ├── System.Runtime.ExceptionServices │ │ │ └── ExceptionDispatchInfo.cs │ │ ├── System.Runtime.Remoting.Messaging │ │ │ └── AsyncResult.cs │ │ ├── System.Threading.Tasks │ │ │ ├── CyclicDeque.cs │ │ │ ├── IConcurrentDeque.cs │ │ │ ├── PopResult.cs │ │ │ ├── SynchronizationContextScheduler.cs │ │ │ ├── Task.cs │ │ │ ├── TaskActionInvoker.cs │ │ │ ├── TaskCanceledException.cs │ │ │ ├── TaskCompletionQueue.cs │ │ │ ├── TaskCompletionSource.cs │ │ │ ├── TaskConstants.cs │ │ │ ├── TaskConstants_T.cs │ │ │ ├── TaskContinuation.cs │ │ │ ├── TaskContinuationOptions.cs │ │ │ ├── TaskCreationOptions.cs │ │ │ ├── TaskDebuggerView.cs │ │ │ ├── TaskExceptionSlot.cs │ │ │ ├── TaskExtensions.cs │ │ │ ├── TaskExtensionsImpl.cs │ │ │ ├── TaskFactory.cs │ │ │ ├── TaskFactory_T.cs │ │ │ ├── TaskScheduler.cs │ │ │ ├── TaskSchedulerException.cs │ │ │ ├── TaskStatus.cs │ │ │ ├── Task_T.cs │ │ │ ├── TpScheduler.cs │ │ │ └── UnobservedTaskExceptionEventArgs.cs │ │ ├── System.Threading │ │ │ ├── AtomicBoolean.cs │ │ │ ├── CancellationToken.cs │ │ │ ├── CancellationTokenRegistration.cs │ │ │ ├── CancellationTokenSource.cs │ │ │ ├── CountdownEvent.cs │ │ │ ├── ManualResetEventSlim.cs │ │ │ ├── SemaphoreSlim.cs │ │ │ ├── SpinLock.cs │ │ │ ├── SpinWait.cs │ │ │ ├── ThreadingHelper.SpinWait.cs │ │ │ ├── ThreadingHelper.cs │ │ │ ├── Volatile.cs │ │ │ └── Watch.cs │ │ └── System │ │ │ ├── AggregateException.cs │ │ │ ├── Funcs.cs │ │ │ ├── Lazy.cs │ │ │ ├── LazyThreadSafetyMode.cs │ │ │ ├── LocalDataStoreSlot.cs │ │ │ ├── OperationCanceledException.cs │ │ │ ├── Tuple.cs │ │ │ └── Tuples.cs │ └── Windows │ │ ├── Domain.cs │ │ ├── EDRCheck.cs │ │ ├── Netapi32.cs │ │ ├── RdpLogs.cs │ │ └── SearchFile.cs ├── Plugins │ ├── Domain.cs │ ├── FileSearch.cs │ ├── Ftp.cs │ ├── HttpServer.cs │ ├── KerberEnum.cs │ ├── MS17-010.cs │ ├── MsSql.cs │ ├── Mysql.cs │ ├── Rdp.cs │ ├── SMBEnum.cs │ ├── SMBGhost.cs │ ├── SSH.cs │ ├── Socks5.cs │ ├── WebTitle.cs │ ├── WmiExec.cs │ └── ZeroLogon.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── README.md ├── Scan │ ├── ArpScan.cs │ ├── ICMPScan.cs │ ├── TcpPortScan.cs │ └── UdpPortScan.cs ├── SharpScan.csproj ├── SharpScan.csproj.user ├── SharpScan.sln ├── app.config ├── packages.config └── workload-install.ps1 ├── Test ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── Test.csproj ├── app.config └── packages.config ├── build.bat └── github.bat /.gitattributes: -------------------------------------------------------------------------------- 1 | *.mmdb filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | bin/ 3 | ClientsFolder/ 4 | Binaries/ 5 | packages/* 6 | obj/ 7 | *.exe 8 | *.pdb 9 | *.obj 10 | x64/* 11 | .git/ 12 | -------------------------------------------------------------------------------- /Image/image-20240731134334232.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240731134334232.png -------------------------------------------------------------------------------- /Image/image-20240731134357549.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240731134357549.png -------------------------------------------------------------------------------- /Image/image-20240731134433626.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240731134433626.png -------------------------------------------------------------------------------- /Image/image-20240731144400465.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240731144400465.png -------------------------------------------------------------------------------- /Image/image-20240731151455139.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240731151455139.png -------------------------------------------------------------------------------- /Image/image-20240731162159957.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240731162159957.png -------------------------------------------------------------------------------- /Image/image-20240801112506349.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240801112506349.png -------------------------------------------------------------------------------- /Image/image-20240801125524783.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240801125524783.png -------------------------------------------------------------------------------- /Image/image-20240801125922524.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240801125922524.png -------------------------------------------------------------------------------- /Image/image-20240801131225528.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240801131225528.png -------------------------------------------------------------------------------- /Image/image-20240801131239111.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240801131239111.png -------------------------------------------------------------------------------- /Image/image-20240801131945885.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240801131945885.png -------------------------------------------------------------------------------- /Image/image-20240801134555502.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240801134555502.png -------------------------------------------------------------------------------- /Image/image-20240801170821991.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240801170821991.png -------------------------------------------------------------------------------- /Image/image-20240804172810364.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Image/image-20240804172810364.png -------------------------------------------------------------------------------- /Powershell/Invoke-SharpScan.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/Powershell/Invoke-SharpScan.ps1 -------------------------------------------------------------------------------- /Powershell/Patch.ps1: -------------------------------------------------------------------------------- 1 | 2 | $filePath = "SharpScan.exe" 3 | $outputFilePath = "SharpScan_Patched.exe" 4 | $findBytes = [System.Text.Encoding]::ASCII.GetBytes("v2.0.50727") 5 | $replaceBytes = [System.Text.Encoding]::ASCII.GetBytes("v4.0.30319") 6 | $content = [System.IO.File]::ReadAllBytes($filePath) 7 | for ($i = 0; $i -le $content.Length - $findBytes.Length; $i++) { 8 | $match = $true 9 | for ($j = 0; $j -lt $findBytes.Length; $j++) { 10 | if ($content[$i + $j] -ne $findBytes[$j]) { 11 | $match = $false 12 | break 13 | } 14 | } 15 | if ($match) { 16 | [Array]::Copy($replaceBytes, 0, $content, $i, $replaceBytes.Length) 17 | } 18 | } 19 | 20 | [System.IO.File]::WriteAllBytes($outputFilePath, $content) 21 | 22 | Write-Host "new exe:$outputFilePath" 23 | -------------------------------------------------------------------------------- /SharpScan.Core/Common/Config.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/SharpScan.Core/Common/Config.cs -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/EDRCheck.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace SharpScan 8 | { 9 | internal class EDRCheck 10 | { 11 | protected static string Format(string args_1, string args_2) => String.Format(" [>] {0,-28}: {1}\r", args_1, args_2); 12 | public EDRCheck() 13 | { 14 | // 获取当前系统的进程列表 15 | List currentProcesses = Process.GetProcesses() 16 | .Select(p => p.ProcessName.ToLower() + ".exe") 17 | .Distinct() 18 | .ToList(); 19 | 20 | // 查找匹配的杀毒软件 21 | var matchedProcesses = new Dictionary(); 22 | 23 | foreach (var process in currentProcesses) 24 | { 25 | if (Configuration.EDRQueryDictionary.ContainsKey(process)) 26 | { 27 | matchedProcesses[process] = Configuration.EDRQueryDictionary[process]; 28 | } 29 | } 30 | 31 | // 打印已安装的杀毒软件及对应的进程 32 | if (matchedProcesses.Any()) 33 | { 34 | Console.WriteLine("[+] Installed AV, EDR and corresponding processes:\n"); 35 | foreach (var kvp in matchedProcesses) 36 | { 37 | Console.WriteLine(Format(kvp.Key, kvp.Value)); 38 | } 39 | } 40 | else 41 | { 42 | Console.WriteLine("No installed anti-virus software was detected."); 43 | } 44 | Console.WriteLine("\n"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Helper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Sockets; 5 | using System.Text; 6 | 7 | namespace SharpScan 8 | { 9 | public class Helper 10 | { 11 | public static string GetServiceByPort(int port) 12 | { 13 | var service = Configuration.PortList.FirstOrDefault(p => p.Value == port).Key; 14 | if (service != null) 15 | { 16 | return $" ({service})"; 17 | } 18 | return ""; 19 | 20 | 21 | } 22 | 23 | public static bool TestPort(string remoteHost, int remotePort) 24 | { 25 | int timeout = 3000; // 3 seconds 26 | try 27 | { 28 | using (TcpClient client = new TcpClient()) 29 | { 30 | IAsyncResult result = client.BeginConnect(remoteHost, remotePort, null, null); 31 | bool success = result.AsyncWaitHandle.WaitOne(timeout, false); 32 | if (!success) 33 | { 34 | client.Close(); 35 | return false; 36 | } 37 | client.EndConnect(result); 38 | } 39 | return true; 40 | } 41 | catch 42 | { 43 | return false; 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/HookConhost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | 5 | public class MultiTextWriter : TextWriter 6 | { 7 | private readonly TextWriter consoleWriter; 8 | private readonly TextWriter fileWriter; 9 | 10 | public MultiTextWriter(TextWriter consoleWriter, TextWriter fileWriter) 11 | { 12 | this.consoleWriter = consoleWriter; 13 | this.fileWriter = fileWriter; 14 | } 15 | 16 | public override Encoding Encoding => consoleWriter.Encoding; 17 | 18 | public override void Write(char value) 19 | { 20 | consoleWriter.Write(value); 21 | fileWriter.Write(value); 22 | } 23 | 24 | public override void Write(string value) 25 | { 26 | consoleWriter.Write(value); 27 | fileWriter.Write(value); 28 | } 29 | 30 | public override void WriteLine(string value) 31 | { 32 | consoleWriter.WriteLine(value); 33 | fileWriter.WriteLine(value); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Lib/SSPKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpScan 4 | { 5 | public class SSPKey 6 | { 7 | public string Target { get; set; } 8 | public int Port { get; set; } 9 | public string Type { get; set; } 10 | public int NDR64Syntax { get; set; } 11 | public int OsBuildNumber { get; set; } 12 | public byte OsMajor { get; set; } 13 | public byte OsMinor { get; set; } 14 | public string NbtComputerName { get; set; } 15 | public string NbtDomainName { get; set; } 16 | public string DnsComputerName { get; set; } 17 | public string DnsDomainName { get; set; } 18 | public DateTime TimeStamp { get; set; } 19 | public string NativeOs { get; set; } 20 | public string NativeLanManager { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Lib/TargetParser.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Text.RegularExpressions; 9 | 10 | namespace SharpScan 11 | { 12 | public class TargetParser 13 | { 14 | 15 | 16 | public static void ReadFileToList(String path, ref HashSet ips) 17 | { 18 | ips.Clear(); 19 | FileStream fs_dir = null; 20 | StreamReader reader = null; 21 | try 22 | { 23 | fs_dir = new FileStream(path, FileMode.Open, FileAccess.Read); 24 | 25 | reader = new StreamReader(fs_dir); 26 | 27 | String lineStr; 28 | 29 | while ((lineStr = reader.ReadLine()) != null) 30 | { 31 | if (!lineStr.Equals("")) 32 | { 33 | ips.Add(lineStr); 34 | } 35 | } 36 | } 37 | catch (Exception e) 38 | { 39 | Writer.Failed("An exception occurred while reading the file list!" + e.Message); 40 | } 41 | finally 42 | { 43 | if (reader != null) 44 | { 45 | reader.Close(); 46 | } 47 | if (fs_dir != null) 48 | { 49 | fs_dir.Close(); 50 | } 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Lib/Writer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpScan 4 | { 5 | public class Writer 6 | { 7 | public static void Info(string info) 8 | { 9 | Console.WriteLine($"[*] {info}"); 10 | } 11 | 12 | public static void Line(string info) 13 | { 14 | Console.WriteLine($"{info}"); 15 | } 16 | 17 | public static void Failed(string log) 18 | { 19 | Console.WriteLine($"[!] Failed: {log}"); 20 | } 21 | 22 | public static void Error(string error) 23 | { 24 | Console.WriteLine($"\r\n[!] Error: {error}"); 25 | Environment.Exit(0); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/RdpFull/Cryptography/ABCDStruct.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SharpRDPCheck 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | internal struct ABCDStruct 7 | { 8 | public uint A; 9 | public uint B; 10 | public uint C; 11 | public uint D; 12 | } 13 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/RdpFull/Cryptography/MD4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | 5 | namespace SharpRDPCheck 6 | { 7 | internal sealed class MD4 8 | { 9 | 10 | public static byte[] ComputeHash(byte[] input) 11 | { 12 | MD4Managed managed = new MD4Managed(); 13 | managed.Initialize(); 14 | return managed.ComputeHash(input); 15 | } 16 | 17 | public static byte[] ComputeHash(string input, Encoding encoding) 18 | { 19 | if (input == null) 20 | { 21 | throw new ArgumentNullException("input", "Unable to calculate hash over null input data"); 22 | } 23 | if (encoding == null) 24 | { 25 | throw new ArgumentNullException("encoding", "Unable to calculate hash over a string without a default encoding. Consider using the GetHash(string) overload to use UTF8 Encoding"); 26 | } 27 | return ComputeHash(encoding.GetBytes(input)); 28 | } 29 | 30 | public static string ComputeHashString(byte[] input) 31 | { 32 | if (input == null) 33 | { 34 | throw new ArgumentNullException("input", "Unable to calculate hash over null input data"); 35 | } 36 | return BitConverter.ToString(ComputeHash(input)).Replace("-", ""); 37 | } 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/RdpFull/Exceptions/RDFatalException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpRDPCheck 4 | { 5 | internal class RDFatalException : Exception 6 | { 7 | public RDFatalException(string message) : base(message) 8 | { 9 | 10 | 11 | } 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/RdpFull/Protocol/Processing/ISO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Diagnostics; 4 | 5 | namespace SharpRDPCheck 6 | { 7 | internal class ISO 8 | { 9 | internal static RdpPacket Receive() 10 | { 11 | byte[] buffer = new byte[0x3000]; 12 | int count = Network.Receive(buffer); 13 | RdpPacket packet = new RdpPacket(); 14 | packet.Write(buffer, 0, count); 15 | packet.Position = 0L; 16 | int num2 = 0; 17 | 18 | if (packet.ReadByte() == 3) 19 | { 20 | packet.ReadByte(); 21 | num2 = packet.ReadBigEndian16(); 22 | long position = packet.Position; 23 | 24 | while (num2 > count) 25 | { 26 | int num4 = Network.Receive(buffer); 27 | packet.Position = count; 28 | packet.Write(buffer, 0, num4); 29 | count += num4; 30 | } 31 | 32 | packet.Position = position; 33 | 34 | return packet; 35 | } 36 | num2 = packet.ReadByte(); 37 | 38 | if ((num2 & 0x80) != 0) 39 | { 40 | num2 &= -129; 41 | num2 = num2 << (8 + packet.ReadByte()); 42 | } 43 | 44 | return packet; 45 | } 46 | 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/RdpFull/Protocol/Processing/IsoLayer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | 5 | namespace SharpRDPCheck 6 | { 7 | internal class IsoLayer 8 | { 9 | internal static void Write(RdpPacket data) 10 | { 11 | data.Position = 0L; 12 | byte[] buffer = new byte[data.Length]; 13 | data.Read(buffer, 0, (int)data.Length); 14 | 15 | Network.Send(buffer); 16 | } 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/RdpFull/Settings/Options.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Security.Cryptography.X509Certificates; 6 | using System.Diagnostics; 7 | 8 | namespace SharpRDPCheck 9 | { 10 | internal class Options 11 | { 12 | internal static int SocketTimeout = 3000; 13 | internal static string ClientName = "Windows7"; // Client Name 14 | internal static string Domain = ""; // Domain 15 | internal static string DomainAndUsername = ""; // Domain and Username 16 | internal static string Host = ""; // Host 17 | internal static string hostname = ""; 18 | internal static string Username = ""; // Username 19 | internal static string Password = ""; // Password 20 | internal static string hash = ""; // NTLM hash 21 | internal static int Port = 3389; // Port 22 | internal static bool enableNLA = true; // Enable NLA 23 | internal static MCS.NegotiationFlags serverNegotiateFlags; 24 | } 25 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/AES/BlowfishCBC.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch.jce 2 | { 3 | /// 4 | /// Summary description for BlowfishCBC. 5 | /// 6 | public class BlowfishCBC 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/DH.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | public interface DH 33 | { 34 | void init(); 35 | void setP(byte[] p); 36 | void setG(byte[] g); 37 | byte[] getE(); 38 | void setF(byte[] f); 39 | byte[] getK(); 40 | } 41 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/ForwardedTCPIPDaemon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Tamir.SharpSsh.Sharp.lang; 3 | 4 | namespace Tamir.SharpSsh.jsch 5 | { 6 | public interface ForwardedTCPIPDaemon : Runnable 7 | { 8 | void setChannel(ChannelForwardedTCPIP channel); 9 | void setArg(Object[] arg); 10 | } 11 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/HASH.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | public abstract class HASH 33 | { 34 | public abstract void init(); 35 | public abstract int getBlockSize(); 36 | public abstract void update(byte[] foo, int start, int len); 37 | public abstract byte[] digest(); 38 | } 39 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/JSchAuthCancelException.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /// 4 | /// Summary description for JSchException. 5 | /// 6 | public class JSchAuthCancelException : JSchException 7 | { 8 | public JSchAuthCancelException() 9 | { 10 | } 11 | 12 | public JSchAuthCancelException(string msg) : base(msg) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/JSchException.cs: -------------------------------------------------------------------------------- 1 | using Tamir.SharpSsh.Sharp; 2 | using Exception = System.Exception; 3 | 4 | namespace Tamir.SharpSsh.jsch 5 | { 6 | /// 7 | /// Summary description for JSchException. 8 | /// 9 | public class JSchException : Exception 10 | { 11 | public JSchException() 12 | { 13 | } 14 | 15 | public JSchException(string msg) : base(msg) 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/JSchPartialAuthException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Tamir.SharpSsh.jsch 4 | { 5 | /// 6 | /// Summary description for JSchException. 7 | /// 8 | public class JSchPartialAuthException : JSchException 9 | { 10 | private readonly string methods; 11 | 12 | public JSchPartialAuthException() 13 | { 14 | methods = null; 15 | } 16 | 17 | public JSchPartialAuthException(string msg) : base(msg) 18 | { 19 | methods = msg; 20 | } 21 | 22 | public String getMethods() 23 | { 24 | return methods; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/KeyPairGenDSA.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | public interface KeyPairGenDSA 33 | { 34 | void init(int key_size); 35 | byte[] getX(); 36 | byte[] getY(); 37 | byte[] getP(); 38 | byte[] getQ(); 39 | byte[] getG(); 40 | } 41 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/Random.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | public interface Random 33 | { 34 | void fill(byte[] foo, int start, int len); 35 | } 36 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/Request.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | internal interface Request 33 | { 34 | bool waitForReply(); 35 | void request(Session session, Channel channel); 36 | } 37 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/ServerSocketFactory.cs: -------------------------------------------------------------------------------- 1 | using Tamir.SharpSsh.Sharp.net; 2 | 3 | namespace Tamir.SharpSsh.jsch 4 | { 5 | /// 6 | /// Summary description for ServerSocketFactory. 7 | /// 8 | public interface ServerSocketFactory 9 | { 10 | ServerSocket createServerSocket(int port, int backlog, InetAddress bindAddr); 11 | } 12 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Cipher/SftpException.cs: -------------------------------------------------------------------------------- 1 | using Tamir.SharpSsh.Sharp; 2 | using Exception = Tamir.SharpSsh.Sharp.Exception; 3 | using String = System.String; 4 | 5 | namespace Tamir.SharpSsh.jsch 6 | { 7 | public class SftpException : Exception 8 | { 9 | public int id; 10 | public String message; 11 | 12 | public SftpException(int id, String message) 13 | { 14 | this.id = id; 15 | this.message = message; 16 | } 17 | 18 | public override String toString() 19 | { 20 | return message; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/DHParameters.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DHParameters.cs: Defines a structure that holds the parameters of the Diffie-Hellman algorithm 3 | // 4 | // Author: 5 | // Pieter Philippaerts (Pieter@mentalis.org) 6 | // 7 | // (C) 2003 The Mentalis.org Team (http://www.mentalis.org/) 8 | // 9 | 10 | namespace Org.Mentalis.Security.Cryptography 11 | { 12 | /// 13 | /// Represents the parameters of the Diffie-Hellman algorithm. 14 | /// 15 | public struct DHParameters 16 | { 17 | /// 18 | /// Represents the public G parameter of the Diffie-Hellman algorithm. 19 | /// 20 | public byte[] G; 21 | 22 | /// 23 | /// Represents the public P parameter of the Diffie-Hellman algorithm. 24 | /// 25 | public byte[] P; 26 | 27 | /// 28 | /// Represents the private X parameter of the Diffie-Hellman algorithm. 29 | /// 30 | public byte[] X; 31 | } 32 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Streams/InputStream.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.IO; 3 | // 4 | //namespace Tamir.Streams 5 | //{ 6 | // /// 7 | // /// Summary description for InputStream. 8 | // /// 9 | // public abstract class InputStream : Stream 10 | // { 11 | // public override void WriteByte(byte value) 12 | // { 13 | // } 14 | // 15 | // public override void Write(byte[] buffer, int offset, int count) 16 | // { 17 | // } 18 | // 19 | // public override bool CanRead 20 | // { 21 | // get 22 | // { 23 | // return true; 24 | // } 25 | // } 26 | // public override bool CanWrite 27 | // { 28 | // get 29 | // { 30 | // return false; 31 | // } 32 | // } 33 | // public override bool CanSeek 34 | // { 35 | // get 36 | // { 37 | // return false; 38 | // } 39 | // } 40 | // public override void Flush() 41 | // { 42 | // 43 | // } 44 | // public override long Length 45 | // { 46 | // get 47 | // { 48 | // return 0; 49 | // } 50 | // } 51 | // public override long Position 52 | // { 53 | // get 54 | // { 55 | // return 0; 56 | // } 57 | // set 58 | // { 59 | // } 60 | // } 61 | // public override void SetLength(long value) 62 | // { 63 | // } 64 | // public override long Seek(long offset, SeekOrigin origin) 65 | // { 66 | // return 0; 67 | // } 68 | // } 69 | //} 70 | 71 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/Streams/OutputStream.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.IO; 3 | // 4 | //namespace Tamir.Streams 5 | //{ 6 | // /// 7 | // /// Summary description for OutputStream. 8 | // /// 9 | // public abstract class OutputStream : Stream 10 | // { 11 | // public override int Read(byte[] buffer, int offset, int count) 12 | // { 13 | // return 0; 14 | // } 15 | // 16 | // public override int ReadByte() 17 | // { 18 | // return 0; 19 | // } 20 | // 21 | // public override bool CanRead 22 | // { 23 | // get 24 | // { 25 | // return false; 26 | // } 27 | // } 28 | // public override bool CanWrite 29 | // { 30 | // get 31 | // { 32 | // return true; 33 | // } 34 | // } 35 | // public override bool CanSeek 36 | // { 37 | // get 38 | // { 39 | // return false; 40 | // } 41 | // } 42 | // public override void Flush() 43 | // { 44 | // } 45 | // public override long Length 46 | // { 47 | // get 48 | // { 49 | // return 0; 50 | // } 51 | // } 52 | // public override long Position 53 | // { 54 | // get 55 | // { 56 | // return 0; 57 | // } 58 | // set 59 | // { 60 | // } 61 | // } 62 | // public override void SetLength(long value) 63 | // { 64 | // } 65 | // public override long Seek(long offset, SeekOrigin origin) 66 | // { 67 | // return 0; 68 | // } 69 | // } 70 | //} 71 | 72 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/Exception.cs: -------------------------------------------------------------------------------- 1 | using Ex = System.Exception; 2 | 3 | namespace Tamir.SharpSsh.Sharp 4 | { 5 | /// 6 | /// Summary description for Exception. 7 | /// 8 | public class Exception : Ex 9 | { 10 | public Exception() 11 | { 12 | } 13 | 14 | public Exception(string msg) : base(msg) 15 | { 16 | } 17 | 18 | public virtual string toString() 19 | { 20 | return ToString(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/Platform.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Tamir.SharpSsh.Sharp 4 | { 5 | /// 6 | /// Summary description for Platform. 7 | /// 8 | public class Platform 9 | { 10 | public static bool Windows 11 | { 12 | get { return Environment.OSVersion.Platform.ToString().StartsWith("Win"); } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/RuntimeException.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp 2 | { 3 | /// 4 | /// Summary description for RuntimeException. 5 | /// 6 | public class RuntimeException : Exception 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/System.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Tamir.SharpSsh.Sharp 4 | { 5 | /// 6 | /// Summary description for System. 7 | /// 8 | public class System 9 | { 10 | public static Out Out = new Out(); 11 | public static Err err = new Err(); 12 | 13 | public static void arraycopy(Array a1, long sourceIndex, Array a2, long destIndex, long len) 14 | { 15 | Array.Copy(a1, sourceIndex, a2, destIndex, len); 16 | } 17 | } 18 | 19 | public class Out 20 | { 21 | public void print(string v) 22 | { 23 | Console.Write(v); 24 | } 25 | 26 | public void println(string v) 27 | { 28 | Console.WriteLine(v); 29 | } 30 | } 31 | 32 | public class Err 33 | { 34 | public void print(string v) 35 | { 36 | Console.Error.Write(v); 37 | } 38 | 39 | public void println(string v) 40 | { 41 | Console.Error.WriteLine(v); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/io/File.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Tamir.SharpSsh.Sharp.io 4 | { 5 | /// 6 | /// Summary description for File. 7 | /// 8 | public class File 9 | { 10 | private readonly string file; 11 | internal FileInfo info; 12 | 13 | public File(string file) 14 | { 15 | this.file = file; 16 | info = new FileInfo(file); 17 | } 18 | 19 | public static string separator 20 | { 21 | get { return Path.DirectorySeparatorChar.ToString(); } 22 | } 23 | 24 | public static char separatorChar 25 | { 26 | get { return Path.DirectorySeparatorChar; } 27 | } 28 | 29 | public string getCanonicalPath() 30 | { 31 | return Path.GetFullPath(file); 32 | } 33 | 34 | public bool isDirectory() 35 | { 36 | return Directory.Exists(file); 37 | } 38 | 39 | public long Length() 40 | { 41 | return info.Length; 42 | } 43 | 44 | public long length() 45 | { 46 | return Length(); 47 | } 48 | 49 | public bool isAbsolute() 50 | { 51 | return Path.IsPathRooted(file); 52 | } 53 | 54 | public String[] list() 55 | { 56 | string[] dirs = Directory.GetDirectories(file); 57 | string[] files = Directory.GetFiles(file); 58 | var _list = new String[dirs.Length + files.Length]; 59 | System.arraycopy(dirs, 0, _list, 0, dirs.Length); 60 | System.arraycopy(files, 0, _list, dirs.Length, files.Length); 61 | return _list; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/io/FileInputStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Tamir.SharpSsh.Sharp.io 4 | { 5 | /// 6 | /// Summary description for FileInputStream. 7 | /// 8 | public class FileInputStream : InputStream 9 | { 10 | private readonly FileStream fs; 11 | 12 | public FileInputStream(string file) 13 | { 14 | fs = global::System.IO.File.OpenRead(file); 15 | } 16 | 17 | public FileInputStream(File file) : this(file.info.Name) 18 | { 19 | } 20 | 21 | public override bool CanSeek 22 | { 23 | get { return fs.CanSeek; } 24 | } 25 | 26 | public override void Close() 27 | { 28 | fs.Close(); 29 | } 30 | 31 | 32 | public override int Read(byte[] buffer, int offset, int count) 33 | { 34 | return fs.Read(buffer, offset, count); 35 | } 36 | 37 | public override long Seek(long offset, SeekOrigin origin) 38 | { 39 | return fs.Seek(offset, origin); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/io/FileOutputStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Tamir.SharpSsh.Sharp.io 4 | { 5 | /// 6 | /// Summary description for FileInputStream. 7 | /// 8 | public class FileOutputStream : OutputStream 9 | { 10 | private readonly FileStream fs; 11 | 12 | public FileOutputStream(string file) : this(file, false) 13 | { 14 | } 15 | 16 | public FileOutputStream(File file) : this(file.info.Name, false) 17 | { 18 | } 19 | 20 | public FileOutputStream(string file, bool append) 21 | { 22 | if (append) 23 | fs = new FileStream(file, FileMode.Append); // append 24 | else 25 | fs = new FileStream(file, FileMode.Create); 26 | } 27 | 28 | public FileOutputStream(File file, bool append) : this(file.info.Name) 29 | { 30 | } 31 | 32 | public override bool CanSeek 33 | { 34 | get { return fs.CanSeek; } 35 | } 36 | 37 | public override void Write(byte[] buffer, int offset, int count) 38 | { 39 | fs.Write(buffer, offset, count); 40 | } 41 | 42 | public override void Flush() 43 | { 44 | fs.Flush(); 45 | } 46 | 47 | public override void Close() 48 | { 49 | fs.Close(); 50 | } 51 | 52 | public override long Seek(long offset, SeekOrigin origin) 53 | { 54 | return fs.Seek(offset, origin); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/io/InputStreamWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Tamir.SharpSsh.Sharp.io; 3 | 4 | namespace Tamir.Streams 5 | { 6 | /// 7 | /// Summary description for InputStreamWrapper. 8 | /// 9 | public class InputStreamWrapper : InputStream 10 | { 11 | private readonly Stream s; 12 | 13 | public InputStreamWrapper(Stream s) 14 | { 15 | this.s = s; 16 | } 17 | 18 | public override int Read(byte[] buffer, int offset, int count) 19 | { 20 | return s.Read(buffer, offset, count); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/io/OutputStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Tamir.SharpSsh.Sharp.io 4 | { 5 | /// 6 | /// Summary description for InputStream. 7 | /// 8 | public abstract class OutputStream : Stream 9 | { 10 | public override bool CanRead 11 | { 12 | get { return false; } 13 | } 14 | 15 | public override bool CanWrite 16 | { 17 | get { return true; } 18 | } 19 | 20 | public override bool CanSeek 21 | { 22 | get { return false; } 23 | } 24 | 25 | public override long Length 26 | { 27 | get { return 0; } 28 | } 29 | 30 | public override long Position 31 | { 32 | get { return 0; } 33 | set { } 34 | } 35 | 36 | public override int Read(byte[] buffer, int offset, int count) 37 | { 38 | return 0; 39 | } 40 | 41 | public override int ReadByte() 42 | { 43 | return 0; 44 | } 45 | 46 | public virtual void write(byte[] buffer, int offset, int count) 47 | { 48 | Write(buffer, offset, count); 49 | } 50 | 51 | public virtual void close() 52 | { 53 | Close(); 54 | } 55 | 56 | public virtual void flush() 57 | { 58 | Flush(); 59 | } 60 | 61 | public override void Flush() 62 | { 63 | } 64 | 65 | public override void SetLength(long value) 66 | { 67 | } 68 | 69 | public override long Seek(long offset, SeekOrigin origin) 70 | { 71 | return 0; 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/lang/Class.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Tamir.SharpSsh.Sharp.lang 4 | { 5 | /// 6 | /// Summary description for Class. 7 | /// 8 | public class Class 9 | { 10 | private readonly Type t; 11 | 12 | private Class(Type t) 13 | { 14 | this.t = t; 15 | } 16 | 17 | private Class(string typeName) : this(Type.GetType(typeName)) 18 | { 19 | } 20 | 21 | public static Class forName(string name) 22 | { 23 | return new Class(name); 24 | } 25 | 26 | public object newInstance() 27 | { 28 | return Activator.CreateInstance(t); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/lang/Integer.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.lang 2 | { 3 | /// 4 | /// Summary description for Integer. 5 | /// 6 | public class Integer 7 | { 8 | private readonly int i; 9 | 10 | public Integer(int i) 11 | { 12 | this.i = i; 13 | } 14 | 15 | public int intValue() 16 | { 17 | return i; 18 | } 19 | 20 | public static int parseInt(string s) 21 | { 22 | return int.Parse(s); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/lang/Runnable.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.lang 2 | { 3 | /// 4 | /// Summary description for Runnable. 5 | /// 6 | public interface Runnable 7 | { 8 | void run(); 9 | } 10 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/lang/StringBuffer.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace Tamir.SharpSsh.Sharp.lang 4 | { 5 | /// 6 | /// Summary description for StringBuffer. 7 | /// 8 | public class StringBuffer 9 | { 10 | private readonly StringBuilder sb; 11 | 12 | public StringBuffer() 13 | { 14 | sb = new StringBuilder(); 15 | } 16 | 17 | public StringBuffer(string s) 18 | { 19 | sb = new StringBuilder(s); 20 | } 21 | 22 | public StringBuffer(StringBuilder sb) : this(sb.ToString()) 23 | { 24 | } 25 | 26 | public StringBuffer(String s) : this(s.ToString()) 27 | { 28 | } 29 | 30 | public StringBuffer append(string s) 31 | { 32 | sb.Append(s); 33 | return this; 34 | } 35 | 36 | public StringBuffer append(char s) 37 | { 38 | sb.Append(s); 39 | return this; 40 | } 41 | 42 | public StringBuffer append(String s) 43 | { 44 | return append(s.ToString()); 45 | } 46 | 47 | public StringBuffer delete(int start, int end) 48 | { 49 | sb.Remove(start, end - start); 50 | return this; 51 | } 52 | 53 | public override string ToString() 54 | { 55 | return sb.ToString(); 56 | } 57 | 58 | public string toString() 59 | { 60 | return ToString(); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/lang/Thread.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | 3 | namespace Tamir.SharpSsh.Sharp.lang 4 | { 5 | /// 6 | /// Summary description for Thread. 7 | /// 8 | public class Thread 9 | { 10 | private readonly global::System.Threading.Thread t; 11 | 12 | public Thread(global::System.Threading.Thread t) 13 | { 14 | this.t = t; 15 | } 16 | 17 | public Thread(ThreadStart ts) : this(new global::System.Threading.Thread(ts)) 18 | { 19 | } 20 | 21 | public Thread(Runnable r) : this(r.run) 22 | { 23 | } 24 | 25 | public void setName(string name) 26 | { 27 | t.Name = name; 28 | } 29 | 30 | public void start() 31 | { 32 | t.Start(); 33 | } 34 | 35 | public bool isAlive() 36 | { 37 | return t.IsAlive; 38 | } 39 | 40 | public void yield() 41 | { 42 | } 43 | 44 | public void interrupt() 45 | { 46 | try 47 | { 48 | t.Interrupt(); 49 | } 50 | catch 51 | { 52 | } 53 | } 54 | 55 | public void notifyAll() 56 | { 57 | Monitor.PulseAll(this); 58 | } 59 | 60 | public static void Sleep(int t) 61 | { 62 | global::System.Threading.Thread.Sleep(t); 63 | } 64 | 65 | public static void sleep(int t) 66 | { 67 | Sleep(t); 68 | } 69 | 70 | public static Thread currentThread() 71 | { 72 | return new Thread(global::System.Threading.Thread.CurrentThread); 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/net/InetAddress.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace Tamir.SharpSsh.Sharp.net 4 | { 5 | /// 6 | /// Summary description for InetAddress. 7 | /// 8 | public class InetAddress 9 | { 10 | internal IPAddress addr; 11 | 12 | public InetAddress(string addr) 13 | { 14 | this.addr = IPAddress.Parse(addr); 15 | } 16 | 17 | public InetAddress(IPAddress addr) 18 | { 19 | this.addr = addr; 20 | } 21 | 22 | public bool isAnyLocalAddress() 23 | { 24 | return IPAddress.IsLoopback(addr); 25 | } 26 | 27 | public bool equals(InetAddress addr) 28 | { 29 | return addr.ToString().Equals(addr.ToString()); 30 | } 31 | 32 | public bool equals(string addr) 33 | { 34 | return addr.Equals(addr); 35 | } 36 | 37 | public override string ToString() 38 | { 39 | return addr.ToString(); 40 | } 41 | 42 | public override bool Equals(object obj) 43 | { 44 | return equals(obj.ToString()); 45 | } 46 | 47 | public string getHostAddress() 48 | { 49 | return ToString(); 50 | } 51 | 52 | public override int GetHashCode() 53 | { 54 | return base.GetHashCode(); 55 | } 56 | 57 | public static InetAddress getByName(string name) 58 | { 59 | #if NET_1_1 60 | return new InetAddress( Dns.GetHostByName(name).AddressList[0] ); 61 | #else 62 | return new InetAddress(Dns.GetHostEntry(name).AddressList[0]); 63 | #endif 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/net/ServerSocket.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Sockets; 2 | 3 | namespace Tamir.SharpSsh.Sharp.net 4 | { 5 | /// 6 | /// Summary description for ServerSocket. 7 | /// 8 | public class ServerSocket : TcpListener 9 | { 10 | public ServerSocket(int port, int arg, InetAddress addr) : base(addr.addr, port) 11 | { 12 | Start(); 13 | } 14 | 15 | public Socket accept() 16 | { 17 | return new Socket(AcceptSocket()); 18 | } 19 | 20 | public void close() 21 | { 22 | Stop(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/util/Arrays.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.util 2 | { 3 | /// 4 | /// Summary description for Arrays. 5 | /// 6 | public class Arrays 7 | { 8 | internal static bool equals(byte[] foo, byte[] bar) 9 | { 10 | int i = foo.Length; 11 | if (i != bar.Length) return false; 12 | for (int j = 0; j < i; j++) 13 | { 14 | if (foo[j] != bar[j]) return false; 15 | } 16 | //try{while(true){i--; if(foo[i]!=bar[i])return false;}}catch(Exception e){} 17 | return true; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/util/Enumeration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace Tamir.SharpSsh.Sharp.util 4 | { 5 | /// 6 | /// Summary description for Enumeration. 7 | /// 8 | public class Enumeration 9 | { 10 | private readonly IEnumerator e; 11 | private bool hasMore; 12 | 13 | public Enumeration(IEnumerator e) 14 | { 15 | this.e = e; 16 | hasMore = e.MoveNext(); 17 | } 18 | 19 | public bool hasMoreElements() 20 | { 21 | return hasMore; 22 | } 23 | 24 | public object nextElement() 25 | { 26 | object o = e.Current; 27 | hasMore = e.MoveNext(); 28 | return o; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/util/Hashtable.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.util 2 | { 3 | /// 4 | /// Summary description for Hashtable. 5 | /// 6 | public class Hashtable 7 | { 8 | internal global::System.Collections.Hashtable h; 9 | 10 | public Hashtable() 11 | { 12 | h = new global::System.Collections.Hashtable(); 13 | } 14 | 15 | public Hashtable(global::System.Collections.Hashtable h) 16 | { 17 | this.h = h; 18 | } 19 | 20 | public object this[object key] 21 | { 22 | get { return get(key); } 23 | set { h[key] = value; } 24 | } 25 | 26 | public void put(object key, object item) 27 | { 28 | h.Add(key, item); 29 | } 30 | 31 | public object get(object key) 32 | { 33 | return h[key]; 34 | } 35 | 36 | public Enumeration keys() 37 | { 38 | return new Enumeration(h.Keys.GetEnumerator()); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/util/JavaString.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.util 2 | { 3 | /// 4 | /// Summary description for SharpString. 5 | /// 6 | public class SharpString : String 7 | { 8 | public SharpString(string s) : base(s) 9 | { 10 | } 11 | 12 | public SharpString(object o) : base(o) 13 | { 14 | } 15 | 16 | public SharpString(byte[] arr) : base(arr) 17 | { 18 | } 19 | 20 | public SharpString(byte[] arr, int offset, int len) : base(arr, offset, len) 21 | { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/System/util/Vector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace Tamir.SharpSsh.Sharp.util 4 | { 5 | /// 6 | /// Summary description for Vector. 7 | /// 8 | public class Vector : ArrayList 9 | { 10 | public int size() 11 | { 12 | return Count; 13 | } 14 | 15 | public void addElement(object o) 16 | { 17 | Add(o); 18 | } 19 | 20 | public void add(object o) 21 | { 22 | addElement(o); 23 | } 24 | 25 | public void removeElement(object o) 26 | { 27 | Remove(o); 28 | } 29 | 30 | public bool remove(object o) 31 | { 32 | Remove(o); 33 | return true; 34 | } 35 | 36 | public object elementAt(int i) 37 | { 38 | return this[i]; 39 | } 40 | 41 | public object get(int i) 42 | { 43 | return elementAt(i); 44 | ; 45 | } 46 | 47 | public void clear() 48 | { 49 | Clear(); 50 | } 51 | 52 | public string toString() 53 | { 54 | return ToString(); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/mono/ConfidenceFactor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Mono.Math.Prime.ConfidenceFactor.cs - Confidence factor for prime generation 3 | // 4 | // Authors: 5 | // Ben Maurer 6 | // 7 | // Copyright (c) 2003 Ben Maurer. All rights reserved 8 | // 9 | 10 | namespace Mono.Math.Prime 11 | { 12 | /// 13 | /// A factor of confidence. 14 | /// 15 | internal enum ConfidenceFactor 16 | { 17 | /// 18 | /// Only suitable for development use, probability of failure may be greater than 1/2^20. 19 | /// 20 | ExtraLow, 21 | 22 | /// 23 | /// Suitable only for transactions which do not require forward secrecy. Probability of failure about 1/2^40 24 | /// 25 | Low, 26 | 27 | /// 28 | /// Designed for production use. Probability of failure about 1/2^80. 29 | /// 30 | Medium, 31 | 32 | /// 33 | /// Suitable for sensitive data. Probability of failure about 1/2^160. 34 | /// 35 | High, 36 | 37 | /// 38 | /// Use only if you have lots of time! Probability of failure about 1/2^320. 39 | /// 40 | ExtraHigh, 41 | 42 | /// 43 | /// Only use methods which generate provable primes. Not yet implemented. 44 | /// 45 | Provable 46 | } 47 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/mono/NextPrimeFinder.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Mono.Math.Prime.Generator.NextPrimeFinder.cs - Prime Generator 3 | // 4 | // Authors: 5 | // Ben Maurer 6 | // 7 | // Copyright (c) 2003 Ben Maurer. All rights reserved 8 | // 9 | 10 | using System; 11 | 12 | namespace Mono.Math.Prime.Generator 13 | { 14 | /// 15 | /// Finds the next prime after a given number. 16 | /// 17 | internal class NextPrimeFinder : SequentialSearchPrimeGeneratorBase 18 | { 19 | protected override BigInteger GenerateSearchBase(int bits, object Context) 20 | { 21 | if (Context == null) throw new ArgumentNullException("Context"); 22 | var ret = new BigInteger((BigInteger) Context); 23 | ret.setBit(0); 24 | return ret; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/SSH/mono/PrimeGeneratorBase.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Mono.Math.Prime.Generator.PrimeGeneratorBase.cs - Abstract Prime Generator 3 | // 4 | // Authors: 5 | // Ben Maurer 6 | // 7 | // Copyright (c) 2003 Ben Maurer. All rights reserved 8 | // 9 | 10 | using System; 11 | 12 | namespace Mono.Math.Prime.Generator 13 | { 14 | internal abstract class PrimeGeneratorBase 15 | { 16 | public virtual ConfidenceFactor Confidence 17 | { 18 | get { return ConfidenceFactor.Medium; } 19 | } 20 | 21 | public virtual PrimalityTest PrimalityTest 22 | { 23 | get { return PrimalityTests.SmallPrimeSppTest; } 24 | } 25 | 26 | public virtual int TrialDivisionBounds 27 | { 28 | get { return 4000; } 29 | } 30 | 31 | /// 32 | /// Performs primality tests on bi, assumes trial division has been done. 33 | /// 34 | /// A BigInteger that has been subjected to and passed trial division 35 | /// False if bi is composite, true if it may be prime. 36 | /// The speed of this method is dependent on Confidence 37 | protected bool PostTrialDivisionTests(BigInteger bi) 38 | { 39 | return PrimalityTest(bi, Confidence); 40 | } 41 | 42 | public abstract BigInteger GenerateNewPrime(int bits); 43 | } 44 | } -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Services/SMB.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Text; 4 | 5 | namespace SharpScan 6 | { 7 | public class SMB 8 | { 9 | internal bool Execute(string ip, int port, int mtime) 10 | { 11 | var _SSPKey = new SSPKey(); 12 | _SSPKey.Target = ip; 13 | _SSPKey.Port = port; 14 | _SSPKey.Type = "smb"; 15 | string flag = "smb1"; 16 | var response = TimeoutSocket.Send(ip, port, mtime, "smb1"); 17 | if (response.Length == 0) 18 | { 19 | flag = "smb2"; 20 | response = TimeoutSocket.Send(ip, port, mtime, "smb2"); 21 | } 22 | if (response.Length == 0) return false; 23 | 24 | NTLMSSPExtract.ParsingSocketStremResponse(ref response, ref _SSPKey); 25 | 26 | if (flag.Equals("smb1")) 27 | { 28 | var veraw = Encoding.Default.GetString(response).Split(new String[] { "\0\0\0" }, StringSplitOptions.RemoveEmptyEntries); 29 | if (veraw.Length == 2) 30 | { 31 | _SSPKey.NativeOs = veraw[0].Replace("\0", ""); 32 | _SSPKey.NativeLanManager = veraw[1].Replace("\0", ""); 33 | } 34 | } 35 | 36 | SSPKeyOutput.Print(ip, _SSPKey); 37 | return true; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Services/WMI.cs: -------------------------------------------------------------------------------- 1 | using SharpScan; 2 | using System; 3 | using System.Threading; 4 | 5 | namespace SharpScan 6 | { 7 | public class WMI 8 | { 9 | public static string CommandName => "wmi"; 10 | 11 | 12 | 13 | 14 | 15 | private static int ParsingNDR64Syntax(byte[] responseBuffer) 16 | { 17 | if (responseBuffer.Length == 0) return 0; 18 | var NDR64SyntaxStr = BitConverter.ToString(responseBuffer).Replace("-", ""); 19 | return NDR64SyntaxStr.Contains("33057171BABE37498319B5DBEF9CCC36") ? 64 : 86; 20 | } 21 | 22 | internal bool Execute(string host, int port, int mtime) 23 | { 24 | var _SSPKey = new SSPKey(); 25 | _SSPKey.Target = host; 26 | _SSPKey.Port = port; 27 | _SSPKey.Type = "wmi"; 28 | 29 | var response = TimeoutSocket.Send(host, port, mtime, "wmi0"); 30 | _SSPKey.NDR64Syntax = ParsingNDR64Syntax(response); 31 | 32 | response = TimeoutSocket.Send(host, port, mtime, "wmi1"); 33 | if (response.Length == 0) return false; 34 | 35 | NTLMSSPExtract.ParsingSocketStremResponse(ref response, ref _SSPKey); 36 | SSPKeyOutput.Print(host, _SSPKey); 37 | return true; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/ExamplePlugins/ClientConnectHandlerExample.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System.Net; 20 | using Socks5.Core.Plugin; 21 | using Socks5.Core.TCP; 22 | 23 | namespace Socks5.Core.ExamplePlugins 24 | { 25 | internal class ClientConnectHandlerExample : ClientConnectedHandler 26 | { 27 | public override bool Enabled { get; set; } = false; 28 | 29 | public override bool OnStart() 30 | { 31 | return true; 32 | } 33 | 34 | public override bool OnConnect(Client client, IPEndPoint ip) 35 | { 36 | if (ip.Address.ToString() != "127.0.0.1") 37 | //deny the connection. 38 | return false; 39 | return true; 40 | //With this function you can also Modify the Socket, as it's stored in e.Client.Sock. 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/ExamplePlugins/ConnectHandlerExample.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Plugin; 20 | using Socks5.Core.Socks; 21 | using System; 22 | 23 | namespace Socks5.Core.ExamplePlugins 24 | { 25 | public class ConnectHandlerExample : ConnectHandler 26 | { 27 | public override bool Enabled { get; set; } = false; 28 | 29 | public override bool OnStart() 30 | { 31 | return true; 32 | } 33 | 34 | public override bool OnConnect(SocksRequest request) 35 | { 36 | //Compare data. 37 | if (request.Address.Contains("74.125.224")) //Google.com IP 38 | { 39 | Console.WriteLine("Redirecting traffic from {0} to yahoo.com.", request.Address); 40 | request.Address = "www.yahoo.com"; 41 | request.Type = AddressType.Domain; 42 | } 43 | 44 | //Allow the connection. 45 | return true; 46 | } 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/ExamplePlugins/LoginHandlerExample.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Plugin; 20 | using Socks5.Core.Socks; 21 | 22 | namespace Socks5.Core.ExamplePlugins 23 | { 24 | 25 | public class LoginHandlerExample : LoginHandler 26 | { 27 | //Username/Password Table? Endless possiblities for the login system. 28 | 29 | public override bool Enabled { get; set; } = false; 30 | 31 | public override bool OnStart() 32 | { 33 | return true; 34 | } 35 | 36 | public override LoginStatus HandleLogin(User user) 37 | { 38 | return user.Username == "thrdev" && user.Password == "testing1234" ? LoginStatus.Correct : LoginStatus.Denied; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/ExtensionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Socks5.Core 4 | { 5 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class 6 | | AttributeTargets.Method)] 7 | public sealed class ExtensionAttribute : Attribute 8 | { 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Plugin/ClientConnectedHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System.Net; 20 | using Socks5.Core.TCP; 21 | 22 | namespace Socks5.Core.Plugin 23 | { 24 | public abstract class ClientConnectedHandler : IGenericPlugin 25 | { 26 | public abstract bool OnStart(); 27 | public abstract bool Enabled { get; set; } 28 | 29 | /// 30 | /// Handle client connected callback. Useful for IPblocking. 31 | /// 32 | /// 33 | /// Return true to allow the connection, return false to deny it. 34 | public abstract bool OnConnect(Client client, IPEndPoint ip); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Plugin/ClientDisconnectedHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.TCP; 20 | 21 | namespace Socks5.Core.Plugin 22 | { 23 | public abstract class ClientDisconnectedHandler : IGenericPlugin 24 | { 25 | public abstract bool OnStart(); 26 | public abstract bool Enabled { get; set; } 27 | 28 | /// 29 | /// Handle client disconnected callback. Useful for keeping track of connected clients. 30 | /// 31 | public abstract bool OnDisconnected(object sender, SocksClientEventArgs e); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Plugin/ConnectHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | 21 | namespace Socks5.Core.Plugin 22 | { 23 | public abstract class ConnectHandler : IGenericPlugin 24 | { 25 | public abstract bool OnStart(); 26 | public abstract bool Enabled { get; set; } 27 | 28 | /// 29 | /// Handle request callback. 30 | /// 31 | /// 32 | /// Return true to allow the connection, return false to deny it. 33 | public abstract bool OnConnect(SocksRequest request); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Plugin/ConnectSocketOverrideHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | using Socks5.Core.TCP; 21 | 22 | namespace Socks5.Core.Plugin 23 | { 24 | public abstract class ConnectSocketOverrideHandler : IGenericPlugin 25 | { 26 | public abstract bool OnStart(); 27 | public abstract bool Enabled { get; set; } 28 | 29 | /// 30 | /// Override the connection, to do whatever you want with it. Client is a wrapper around a socket. 31 | /// 32 | /// The original request params. 33 | /// 34 | public abstract Client OnConnectOverride(SocksRequest sr); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Plugin/DataHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.TCP; 20 | 21 | namespace Socks5.Core.Plugin 22 | { 23 | public abstract class DataHandler : IGenericPlugin 24 | { 25 | public abstract bool OnStart(); 26 | 27 | public abstract bool Enabled { get; set; } 28 | 29 | /// 30 | /// Allows you to grab/modify data before it's sent to the end user. 31 | /// 32 | /// 33 | /// 34 | public abstract void OnServerDataReceived(object sender, DataEventArgs e); 35 | 36 | /// 37 | /// Allows you to grab/modify data before it's sent to the client. 38 | /// 39 | /// 40 | /// 41 | public abstract void OnClientDataReceived(object sender, DataEventArgs e); 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Plugin/GenericPlugin.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | namespace Socks5.Core.Plugin 20 | { 21 | public interface IGenericPlugin 22 | { 23 | bool Enabled { get; set; } 24 | bool OnStart(); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Plugin/LoginHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | 21 | namespace Socks5.Core.Plugin 22 | { 23 | 24 | public abstract class LoginHandler : IGenericPlugin 25 | { 26 | public abstract bool OnStart(); 27 | public abstract bool Enabled { get; set; } 28 | 29 | public abstract LoginStatus HandleLogin(User user); 30 | // 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Plugin/LoginStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Plugin 2 | { 3 | public enum LoginStatus 4 | { 5 | Denied = 0xFF, 6 | Correct = 0x00 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Socks/AddressType.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum AddressType 4 | { 5 | Ip = 0x01, 6 | Domain = 0x03, 7 | Pv6 = 0x04 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Socks/AuthTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum AuthTypes 4 | { 5 | Login = 0x02, 6 | SocksCompress = 0x88, 7 | SocksEncrypt = 0x90, 8 | SocksBoth = 0xFE, 9 | Unsupported = 0xFF, 10 | None = 0x00 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Socks/HeaderTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum HeaderTypes 4 | { 5 | Socks5 = 0x05, 6 | Zero = 0x00 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Socks/SocksError.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum SocksError 4 | { 5 | Granted = 0x00, 6 | Failure = 0x01, 7 | NotAllowed = 0x02, 8 | Unreachable = 0x03, 9 | HostUnreachable = 0x04, 10 | Refused = 0x05, 11 | Expired = 0x06, 12 | NotSupported = 0x07, 13 | AddressNotSupported = 0x08, 14 | LoginRequired = 0x90 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Socks/StreamTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum StreamTypes 4 | { 5 | Stream = 0x01, 6 | Bind = 0x02, 7 | Udp = 0x03 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Socks/User.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace Socks5.Core.Socks 4 | { 5 | public class User 6 | { 7 | public User(byte authTypeVersion, string un, string pw, IPEndPoint ip) 8 | { 9 | AuthTypeVersion = authTypeVersion; 10 | Username = un; 11 | Password = pw; 12 | Ip = ip; 13 | } 14 | 15 | public byte AuthTypeVersion { get; } 16 | public string Username { get; private set; } 17 | public string Password { get; private set; } 18 | public IPEndPoint Ip { get; private set; } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Socks5Client/Events/Socks5ClientArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | using System; 21 | 22 | namespace Socks5.Core.Socks5Client.Events 23 | { 24 | public class Socks5ClientArgs : EventArgs 25 | { 26 | public Socks5ClientArgs(Socks5Client p, SocksError? x) 27 | { 28 | Client = p; 29 | Status = x ?? SocksError.Failure; 30 | } 31 | 32 | public SocksError Status { get; } 33 | 34 | public Socks5Client Client { get; } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/Socks5Client/Events/Socks5ClientDataArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System; 20 | 21 | namespace Socks5.Core.Socks5Client.Events 22 | { 23 | public class Socks5ClientDataArgs : EventArgs 24 | { 25 | //Data Buffer 26 | //Socks Client 27 | 28 | public Socks5ClientDataArgs(Socks5Client client, byte[] buff, int count, int offset) 29 | { 30 | Client = client; 31 | Buffer = buff; 32 | Count = count; 33 | Offset = offset; 34 | } 35 | 36 | public Socks5Client Client { get; } 37 | 38 | public byte[] Buffer { get; set; } 39 | public int Count { get; set; } 40 | public int Offset { get; set; } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/TCP/ByteType.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.TCP 2 | { 3 | public enum ByteType 4 | { 5 | Sent, 6 | Received 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/TCP/ClientEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System; 20 | 21 | namespace Socks5.Core.TCP 22 | { 23 | public class ClientEventArgs : EventArgs 24 | { 25 | public ClientEventArgs(Client client) 26 | { 27 | Client = client; 28 | } 29 | 30 | public Client Client { get; private set; } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/TCP/DataEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | using System; 21 | 22 | namespace Socks5.Core.TCP 23 | { 24 | public class DataEventArgs : EventArgs 25 | { 26 | public DataEventArgs(Client client, byte[] buffer, int count, SocksRequest req = null) 27 | { 28 | Client = client; 29 | Buffer = buffer; 30 | Count = count; 31 | Offset = 0; 32 | Request = req; 33 | } 34 | 35 | public Client Client { get; set; } 36 | public byte[] Buffer { get; set; } 37 | public int Count { get; set; } 38 | public int Offset { get; set; } 39 | public SocksRequest Request { get; set; } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/TCP/PacketType.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.TCP 2 | { 3 | public enum PacketType 4 | { 5 | Sent, 6 | Received 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SharpScan.Core/Pkg/Socks5/TCP/SocksClientEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Socks5.Core.Socks; 2 | using System; 3 | 4 | namespace Socks5.Core.TCP 5 | { 6 | public class SocksClientEventArgs : EventArgs 7 | { 8 | public SocksClientEventArgs(SocksClient client) 9 | { 10 | Client = client; 11 | } 12 | 13 | public SocksClient Client { get; private set; } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /SharpScan.Core/Properties/PublishProfiles/FolderProfile.pubxml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | Release 8 | Any CPU 9 | C:\Users\Lenovo\Desktop\SharpScan\Bin 10 | FileSystem 11 | <_TargetId>Folder 12 | net6.0 13 | linux-x64 14 | true 15 | true 16 | 17 | -------------------------------------------------------------------------------- /SharpScan.Core/SharpScan.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | net6.0 5 | true 6 | true 7 | true 8 | Enabled 9 | True 10 | 11 | 12 | 13 | 0 14 | 15 | 16 | 17 | 0 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SharpScan.Core/SharpScan.Core.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_LastSelectedProfileId>C:\Users\Lenovo\Desktop\SharpScan\SharpScan.Core\Properties\PublishProfiles\FolderProfile.pubxml 5 | 6 | -------------------------------------------------------------------------------- /SharpScan/Common/Config.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/SharpScan/Common/Config.cs -------------------------------------------------------------------------------- /SharpScan/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Helper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Sockets; 5 | using System.Text; 6 | 7 | namespace SharpScan 8 | { 9 | public class Helper 10 | { 11 | public static string GetServiceByPort(int port) 12 | { 13 | var service = Configuration.PortList.FirstOrDefault(p => p.Value == port).Key; 14 | if (service != null) 15 | { 16 | return $" ({service})"; 17 | } 18 | return ""; 19 | 20 | 21 | } 22 | 23 | public static bool TestPort(string remoteHost, int remotePort) 24 | { 25 | int timeout = 3000; // 3 seconds 26 | try 27 | { 28 | using (TcpClient client = new TcpClient()) 29 | { 30 | IAsyncResult result = client.BeginConnect(remoteHost, remotePort, null, null); 31 | bool success = result.AsyncWaitHandle.WaitOne(timeout, false); 32 | if (!success) 33 | { 34 | //client.Close(); 35 | return false; 36 | } 37 | client.EndConnect(result); 38 | } 39 | return true; 40 | } 41 | catch 42 | { 43 | return false; 44 | } 45 | } 46 | 47 | public static void ColorfulConsole(string Mes, ConsoleColor color) 48 | { 49 | Console.ForegroundColor = ConsoleColor.DarkGreen; 50 | Console.Write($"[+] "); // use Write instead of WriteLine 51 | Console.ForegroundColor = color; 52 | Console.WriteLine($" {Mes}"); // use WriteLine here to add a newline after the message 53 | Console.ResetColor(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SharpScan/Pkg/HookConhost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | 5 | public class MultiTextWriter : TextWriter 6 | { 7 | private readonly TextWriter consoleWriter; 8 | private readonly TextWriter fileWriter; 9 | 10 | public MultiTextWriter(TextWriter consoleWriter, TextWriter fileWriter) 11 | { 12 | this.consoleWriter = consoleWriter; 13 | this.fileWriter = fileWriter; 14 | } 15 | 16 | public override Encoding Encoding => consoleWriter.Encoding; 17 | 18 | public override void Write(char value) 19 | { 20 | consoleWriter.Write(value); 21 | fileWriter.Write(value); 22 | } 23 | 24 | public override void Write(string value) 25 | { 26 | consoleWriter.Write(value); 27 | fileWriter.Write(value); 28 | } 29 | 30 | public override void WriteLine(string value) 31 | { 32 | consoleWriter.WriteLine(value); 33 | fileWriter.WriteLine(value); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SharpScan/Pkg/RdpFull/Cryptography/ABCDStruct.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SharpRDPCheck 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | internal struct ABCDStruct 7 | { 8 | public uint A; 9 | public uint B; 10 | public uint C; 11 | public uint D; 12 | } 13 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/RdpFull/Cryptography/MD4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | 5 | namespace SharpRDPCheck 6 | { 7 | internal sealed class MD4 8 | { 9 | 10 | public static byte[] ComputeHash(byte[] input) 11 | { 12 | MD4Managed managed = new MD4Managed(); 13 | managed.Initialize(); 14 | return managed.ComputeHash(input); 15 | } 16 | 17 | public static byte[] ComputeHash(string input, Encoding encoding) 18 | { 19 | if (input == null) 20 | { 21 | throw new ArgumentNullException("input", "Unable to calculate hash over null input data"); 22 | } 23 | if (encoding == null) 24 | { 25 | throw new ArgumentNullException("encoding", "Unable to calculate hash over a string without a default encoding. Consider using the GetHash(string) overload to use UTF8 Encoding"); 26 | } 27 | return ComputeHash(encoding.GetBytes(input)); 28 | } 29 | 30 | public static string ComputeHashString(byte[] input) 31 | { 32 | if (input == null) 33 | { 34 | throw new ArgumentNullException("input", "Unable to calculate hash over null input data"); 35 | } 36 | return BitConverter.ToString(ComputeHash(input)).Replace("-", ""); 37 | } 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/RdpFull/Exceptions/RDFatalException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpRDPCheck 4 | { 5 | internal class RDFatalException : Exception 6 | { 7 | public RDFatalException(string message) : base(message) 8 | { 9 | 10 | 11 | } 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/RdpFull/Protocol/Processing/ISO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Diagnostics; 4 | 5 | namespace SharpRDPCheck 6 | { 7 | internal class ISO 8 | { 9 | internal static RdpPacket Receive() 10 | { 11 | byte[] buffer = new byte[0x3000]; 12 | int count = Network.Receive(buffer); 13 | RdpPacket packet = new RdpPacket(); 14 | packet.Write(buffer, 0, count); 15 | packet.Position = 0L; 16 | int num2 = 0; 17 | 18 | if (packet.ReadByte() == 3) 19 | { 20 | packet.ReadByte(); 21 | num2 = packet.ReadBigEndian16(); 22 | long position = packet.Position; 23 | 24 | while (num2 > count) 25 | { 26 | int num4 = Network.Receive(buffer); 27 | packet.Position = count; 28 | packet.Write(buffer, 0, num4); 29 | count += num4; 30 | } 31 | 32 | packet.Position = position; 33 | 34 | return packet; 35 | } 36 | num2 = packet.ReadByte(); 37 | 38 | if ((num2 & 0x80) != 0) 39 | { 40 | num2 &= -129; 41 | num2 = num2 << (8 + packet.ReadByte()); 42 | } 43 | 44 | return packet; 45 | } 46 | 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/RdpFull/Protocol/Processing/IsoLayer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | 5 | namespace SharpRDPCheck 6 | { 7 | internal class IsoLayer 8 | { 9 | internal static void Write(RdpPacket data) 10 | { 11 | data.Position = 0L; 12 | byte[] buffer = new byte[data.Length]; 13 | data.Read(buffer, 0, (int)data.Length); 14 | 15 | Network.Send(buffer); 16 | } 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/RdpFull/Settings/Options.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Security.Cryptography.X509Certificates; 6 | using System.Diagnostics; 7 | 8 | namespace SharpRDPCheck 9 | { 10 | internal class Options 11 | { 12 | internal static int SocketTimeout = 3000; 13 | internal static string ClientName = "Windows7"; // Client Name 14 | internal static string Domain = ""; // Domain 15 | internal static string DomainAndUsername = ""; // Domain and Username 16 | internal static string Host = ""; // Host 17 | internal static string hostname = ""; 18 | internal static string Username = ""; // Username 19 | internal static string Password = ""; // Password 20 | internal static string hash = ""; // NTLM hash 21 | internal static int Port = 3389; // Port 22 | internal static bool enableNLA = true; // Enable NLA 23 | internal static MCS.NegotiationFlags serverNegotiateFlags; 24 | } 25 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/AES/BlowfishCBC.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch.jce 2 | { 3 | /// 4 | /// Summary description for BlowfishCBC. 5 | /// 6 | public class BlowfishCBC 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/DH.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | public interface DH 33 | { 34 | void init(); 35 | void setP(byte[] p); 36 | void setG(byte[] g); 37 | byte[] getE(); 38 | void setF(byte[] f); 39 | byte[] getK(); 40 | } 41 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/ForwardedTCPIPDaemon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Tamir.SharpSsh.Sharp.lang; 3 | 4 | namespace Tamir.SharpSsh.jsch 5 | { 6 | public interface ForwardedTCPIPDaemon : Runnable 7 | { 8 | void setChannel(ChannelForwardedTCPIP channel); 9 | void setArg(Object[] arg); 10 | } 11 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/HASH.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | public abstract class HASH 33 | { 34 | public abstract void init(); 35 | public abstract int getBlockSize(); 36 | public abstract void update(byte[] foo, int start, int len); 37 | public abstract byte[] digest(); 38 | } 39 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/JSchAuthCancelException.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /// 4 | /// Summary description for JSchException. 5 | /// 6 | public class JSchAuthCancelException : JSchException 7 | { 8 | public JSchAuthCancelException() 9 | { 10 | } 11 | 12 | public JSchAuthCancelException(string msg) : base(msg) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/JSchException.cs: -------------------------------------------------------------------------------- 1 | using Tamir.SharpSsh.Sharp; 2 | using Exception = System.Exception; 3 | 4 | namespace Tamir.SharpSsh.jsch 5 | { 6 | /// 7 | /// Summary description for JSchException. 8 | /// 9 | public class JSchException : Exception 10 | { 11 | public JSchException() 12 | { 13 | } 14 | 15 | public JSchException(string msg) : base(msg) 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/JSchPartialAuthException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Tamir.SharpSsh.jsch 4 | { 5 | /// 6 | /// Summary description for JSchException. 7 | /// 8 | public class JSchPartialAuthException : JSchException 9 | { 10 | private readonly string methods; 11 | 12 | public JSchPartialAuthException() 13 | { 14 | methods = null; 15 | } 16 | 17 | public JSchPartialAuthException(string msg) : base(msg) 18 | { 19 | methods = msg; 20 | } 21 | 22 | public String getMethods() 23 | { 24 | return methods; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/KeyPairGenDSA.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | public interface KeyPairGenDSA 33 | { 34 | void init(int key_size); 35 | byte[] getX(); 36 | byte[] getY(); 37 | byte[] getP(); 38 | byte[] getQ(); 39 | byte[] getG(); 40 | } 41 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/Random.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | public interface Random 33 | { 34 | void fill(byte[] foo, int start, int len); 35 | } 36 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/Request.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.jsch 2 | { 3 | /* -*-mode:Sharp; c-basic-offset:2; -*- */ 4 | /* 5 | Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | internal interface Request 33 | { 34 | bool waitForReply(); 35 | void request(Session session, Channel channel); 36 | } 37 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/ServerSocketFactory.cs: -------------------------------------------------------------------------------- 1 | using Tamir.SharpSsh.Sharp.net; 2 | 3 | namespace Tamir.SharpSsh.jsch 4 | { 5 | /// 6 | /// Summary description for ServerSocketFactory. 7 | /// 8 | public interface ServerSocketFactory 9 | { 10 | ServerSocket createServerSocket(int port, int backlog, InetAddress bindAddr); 11 | } 12 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Cipher/SftpException.cs: -------------------------------------------------------------------------------- 1 | using Tamir.SharpSsh.Sharp; 2 | using Exception = Tamir.SharpSsh.Sharp.Exception; 3 | using String = System.String; 4 | 5 | namespace Tamir.SharpSsh.jsch 6 | { 7 | public class SftpException : Exception 8 | { 9 | public int id; 10 | public String message; 11 | 12 | public SftpException(int id, String message) 13 | { 14 | this.id = id; 15 | this.message = message; 16 | } 17 | 18 | public override String toString() 19 | { 20 | return message; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/DHParameters.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DHParameters.cs: Defines a structure that holds the parameters of the Diffie-Hellman algorithm 3 | // 4 | // Author: 5 | // Pieter Philippaerts (Pieter@mentalis.org) 6 | // 7 | // (C) 2003 The Mentalis.org Team (http://www.mentalis.org/) 8 | // 9 | 10 | namespace Org.Mentalis.Security.Cryptography 11 | { 12 | /// 13 | /// Represents the parameters of the Diffie-Hellman algorithm. 14 | /// 15 | public struct DHParameters 16 | { 17 | /// 18 | /// Represents the public G parameter of the Diffie-Hellman algorithm. 19 | /// 20 | public byte[] G; 21 | 22 | /// 23 | /// Represents the public P parameter of the Diffie-Hellman algorithm. 24 | /// 25 | public byte[] P; 26 | 27 | /// 28 | /// Represents the private X parameter of the Diffie-Hellman algorithm. 29 | /// 30 | public byte[] X; 31 | } 32 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Streams/InputStream.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.IO; 3 | // 4 | //namespace Tamir.Streams 5 | //{ 6 | // /// 7 | // /// Summary description for InputStream. 8 | // /// 9 | // public abstract class InputStream : Stream 10 | // { 11 | // public override void WriteByte(byte value) 12 | // { 13 | // } 14 | // 15 | // public override void Write(byte[] buffer, int offset, int count) 16 | // { 17 | // } 18 | // 19 | // public override bool CanRead 20 | // { 21 | // get 22 | // { 23 | // return true; 24 | // } 25 | // } 26 | // public override bool CanWrite 27 | // { 28 | // get 29 | // { 30 | // return false; 31 | // } 32 | // } 33 | // public override bool CanSeek 34 | // { 35 | // get 36 | // { 37 | // return false; 38 | // } 39 | // } 40 | // public override void Flush() 41 | // { 42 | // 43 | // } 44 | // public override long Length 45 | // { 46 | // get 47 | // { 48 | // return 0; 49 | // } 50 | // } 51 | // public override long Position 52 | // { 53 | // get 54 | // { 55 | // return 0; 56 | // } 57 | // set 58 | // { 59 | // } 60 | // } 61 | // public override void SetLength(long value) 62 | // { 63 | // } 64 | // public override long Seek(long offset, SeekOrigin origin) 65 | // { 66 | // return 0; 67 | // } 68 | // } 69 | //} 70 | 71 | -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/Streams/OutputStream.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.IO; 3 | // 4 | //namespace Tamir.Streams 5 | //{ 6 | // /// 7 | // /// Summary description for OutputStream. 8 | // /// 9 | // public abstract class OutputStream : Stream 10 | // { 11 | // public override int Read(byte[] buffer, int offset, int count) 12 | // { 13 | // return 0; 14 | // } 15 | // 16 | // public override int ReadByte() 17 | // { 18 | // return 0; 19 | // } 20 | // 21 | // public override bool CanRead 22 | // { 23 | // get 24 | // { 25 | // return false; 26 | // } 27 | // } 28 | // public override bool CanWrite 29 | // { 30 | // get 31 | // { 32 | // return true; 33 | // } 34 | // } 35 | // public override bool CanSeek 36 | // { 37 | // get 38 | // { 39 | // return false; 40 | // } 41 | // } 42 | // public override void Flush() 43 | // { 44 | // } 45 | // public override long Length 46 | // { 47 | // get 48 | // { 49 | // return 0; 50 | // } 51 | // } 52 | // public override long Position 53 | // { 54 | // get 55 | // { 56 | // return 0; 57 | // } 58 | // set 59 | // { 60 | // } 61 | // } 62 | // public override void SetLength(long value) 63 | // { 64 | // } 65 | // public override long Seek(long offset, SeekOrigin origin) 66 | // { 67 | // return 0; 68 | // } 69 | // } 70 | //} 71 | 72 | -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/Exception.cs: -------------------------------------------------------------------------------- 1 | using Ex = System.Exception; 2 | 3 | namespace Tamir.SharpSsh.Sharp 4 | { 5 | /// 6 | /// Summary description for Exception. 7 | /// 8 | public class Exception : Ex 9 | { 10 | public Exception() 11 | { 12 | } 13 | 14 | public Exception(string msg) : base(msg) 15 | { 16 | } 17 | 18 | public virtual string toString() 19 | { 20 | return ToString(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/Platform.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Tamir.SharpSsh.Sharp 4 | { 5 | /// 6 | /// Summary description for Platform. 7 | /// 8 | public class Platform 9 | { 10 | public static bool Windows 11 | { 12 | get { return Environment.OSVersion.Platform.ToString().StartsWith("Win"); } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/RuntimeException.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp 2 | { 3 | /// 4 | /// Summary description for RuntimeException. 5 | /// 6 | public class RuntimeException : Exception 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/System.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Tamir.SharpSsh.Sharp 4 | { 5 | /// 6 | /// Summary description for System. 7 | /// 8 | public class System 9 | { 10 | public static Out Out = new Out(); 11 | public static Err err = new Err(); 12 | 13 | public static void arraycopy(Array a1, long sourceIndex, Array a2, long destIndex, long len) 14 | { 15 | Array.Copy(a1, sourceIndex, a2, destIndex, len); 16 | } 17 | } 18 | 19 | public class Out 20 | { 21 | public void print(string v) 22 | { 23 | Console.Write(v); 24 | } 25 | 26 | public void println(string v) 27 | { 28 | Console.WriteLine(v); 29 | } 30 | } 31 | 32 | public class Err 33 | { 34 | public void print(string v) 35 | { 36 | Console.Error.Write(v); 37 | } 38 | 39 | public void println(string v) 40 | { 41 | Console.Error.WriteLine(v); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/io/File.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Tamir.SharpSsh.Sharp.io 4 | { 5 | /// 6 | /// Summary description for File. 7 | /// 8 | public class File 9 | { 10 | private readonly string file; 11 | internal FileInfo info; 12 | 13 | public File(string file) 14 | { 15 | this.file = file; 16 | info = new FileInfo(file); 17 | } 18 | 19 | public static string separator 20 | { 21 | get { return Path.DirectorySeparatorChar.ToString(); } 22 | } 23 | 24 | public static char separatorChar 25 | { 26 | get { return Path.DirectorySeparatorChar; } 27 | } 28 | 29 | public string getCanonicalPath() 30 | { 31 | return Path.GetFullPath(file); 32 | } 33 | 34 | public bool isDirectory() 35 | { 36 | return Directory.Exists(file); 37 | } 38 | 39 | public long Length() 40 | { 41 | return info.Length; 42 | } 43 | 44 | public long length() 45 | { 46 | return Length(); 47 | } 48 | 49 | public bool isAbsolute() 50 | { 51 | return Path.IsPathRooted(file); 52 | } 53 | 54 | public String[] list() 55 | { 56 | string[] dirs = Directory.GetDirectories(file); 57 | string[] files = Directory.GetFiles(file); 58 | var _list = new String[dirs.Length + files.Length]; 59 | System.arraycopy(dirs, 0, _list, 0, dirs.Length); 60 | System.arraycopy(files, 0, _list, dirs.Length, files.Length); 61 | return _list; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/io/FileInputStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Tamir.SharpSsh.Sharp.io 4 | { 5 | /// 6 | /// Summary description for FileInputStream. 7 | /// 8 | public class FileInputStream : InputStream 9 | { 10 | private readonly FileStream fs; 11 | 12 | public FileInputStream(string file) 13 | { 14 | fs = global::System.IO.File.OpenRead(file); 15 | } 16 | 17 | public FileInputStream(File file) : this(file.info.Name) 18 | { 19 | } 20 | 21 | public override bool CanSeek 22 | { 23 | get { return fs.CanSeek; } 24 | } 25 | 26 | public override void Close() 27 | { 28 | fs.Close(); 29 | } 30 | 31 | 32 | public override int Read(byte[] buffer, int offset, int count) 33 | { 34 | return fs.Read(buffer, offset, count); 35 | } 36 | 37 | public override long Seek(long offset, SeekOrigin origin) 38 | { 39 | return fs.Seek(offset, origin); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/io/FileOutputStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Tamir.SharpSsh.Sharp.io 4 | { 5 | /// 6 | /// Summary description for FileInputStream. 7 | /// 8 | public class FileOutputStream : OutputStream 9 | { 10 | private readonly FileStream fs; 11 | 12 | public FileOutputStream(string file) : this(file, false) 13 | { 14 | } 15 | 16 | public FileOutputStream(File file) : this(file.info.Name, false) 17 | { 18 | } 19 | 20 | public FileOutputStream(string file, bool append) 21 | { 22 | if (append) 23 | fs = new FileStream(file, FileMode.Append); // append 24 | else 25 | fs = new FileStream(file, FileMode.Create); 26 | } 27 | 28 | public FileOutputStream(File file, bool append) : this(file.info.Name) 29 | { 30 | } 31 | 32 | public override bool CanSeek 33 | { 34 | get { return fs.CanSeek; } 35 | } 36 | 37 | public override void Write(byte[] buffer, int offset, int count) 38 | { 39 | fs.Write(buffer, offset, count); 40 | } 41 | 42 | public override void Flush() 43 | { 44 | fs.Flush(); 45 | } 46 | 47 | public override void Close() 48 | { 49 | fs.Close(); 50 | } 51 | 52 | public override long Seek(long offset, SeekOrigin origin) 53 | { 54 | return fs.Seek(offset, origin); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/io/InputStreamWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Tamir.SharpSsh.Sharp.io; 3 | 4 | namespace Tamir.Streams 5 | { 6 | /// 7 | /// Summary description for InputStreamWrapper. 8 | /// 9 | public class InputStreamWrapper : InputStream 10 | { 11 | private readonly Stream s; 12 | 13 | public InputStreamWrapper(Stream s) 14 | { 15 | this.s = s; 16 | } 17 | 18 | public override int Read(byte[] buffer, int offset, int count) 19 | { 20 | return s.Read(buffer, offset, count); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/io/OutputStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Tamir.SharpSsh.Sharp.io 4 | { 5 | /// 6 | /// Summary description for InputStream. 7 | /// 8 | public abstract class OutputStream : Stream 9 | { 10 | public override bool CanRead 11 | { 12 | get { return false; } 13 | } 14 | 15 | public override bool CanWrite 16 | { 17 | get { return true; } 18 | } 19 | 20 | public override bool CanSeek 21 | { 22 | get { return false; } 23 | } 24 | 25 | public override long Length 26 | { 27 | get { return 0; } 28 | } 29 | 30 | public override long Position 31 | { 32 | get { return 0; } 33 | set { } 34 | } 35 | 36 | public override int Read(byte[] buffer, int offset, int count) 37 | { 38 | return 0; 39 | } 40 | 41 | public override int ReadByte() 42 | { 43 | return 0; 44 | } 45 | 46 | public virtual void write(byte[] buffer, int offset, int count) 47 | { 48 | Write(buffer, offset, count); 49 | } 50 | 51 | public virtual void close() 52 | { 53 | Close(); 54 | } 55 | 56 | public virtual void flush() 57 | { 58 | Flush(); 59 | } 60 | 61 | public override void Flush() 62 | { 63 | } 64 | 65 | public override void SetLength(long value) 66 | { 67 | } 68 | 69 | public override long Seek(long offset, SeekOrigin origin) 70 | { 71 | return 0; 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/lang/Class.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Tamir.SharpSsh.Sharp.lang 4 | { 5 | /// 6 | /// Summary description for Class. 7 | /// 8 | public class Class 9 | { 10 | private readonly Type t; 11 | 12 | private Class(Type t) 13 | { 14 | this.t = t; 15 | } 16 | 17 | private Class(string typeName) : this(Type.GetType(typeName)) 18 | { 19 | } 20 | 21 | public static Class forName(string name) 22 | { 23 | return new Class(name); 24 | } 25 | 26 | public object newInstance() 27 | { 28 | return Activator.CreateInstance(t); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/lang/Integer.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.lang 2 | { 3 | /// 4 | /// Summary description for Integer. 5 | /// 6 | public class Integer 7 | { 8 | private readonly int i; 9 | 10 | public Integer(int i) 11 | { 12 | this.i = i; 13 | } 14 | 15 | public int intValue() 16 | { 17 | return i; 18 | } 19 | 20 | public static int parseInt(string s) 21 | { 22 | return int.Parse(s); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/lang/Runnable.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.lang 2 | { 3 | /// 4 | /// Summary description for Runnable. 5 | /// 6 | public interface Runnable 7 | { 8 | void run(); 9 | } 10 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/lang/StringBuffer.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace Tamir.SharpSsh.Sharp.lang 4 | { 5 | /// 6 | /// Summary description for StringBuffer. 7 | /// 8 | public class StringBuffer 9 | { 10 | private readonly StringBuilder sb; 11 | 12 | public StringBuffer() 13 | { 14 | sb = new StringBuilder(); 15 | } 16 | 17 | public StringBuffer(string s) 18 | { 19 | sb = new StringBuilder(s); 20 | } 21 | 22 | public StringBuffer(StringBuilder sb) : this(sb.ToString()) 23 | { 24 | } 25 | 26 | public StringBuffer(String s) : this(s.ToString()) 27 | { 28 | } 29 | 30 | public StringBuffer append(string s) 31 | { 32 | sb.Append(s); 33 | return this; 34 | } 35 | 36 | public StringBuffer append(char s) 37 | { 38 | sb.Append(s); 39 | return this; 40 | } 41 | 42 | public StringBuffer append(String s) 43 | { 44 | return append(s.ToString()); 45 | } 46 | 47 | public StringBuffer delete(int start, int end) 48 | { 49 | sb.Remove(start, end - start); 50 | return this; 51 | } 52 | 53 | public override string ToString() 54 | { 55 | return sb.ToString(); 56 | } 57 | 58 | public string toString() 59 | { 60 | return ToString(); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/lang/Thread.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | 3 | namespace Tamir.SharpSsh.Sharp.lang 4 | { 5 | /// 6 | /// Summary description for Thread. 7 | /// 8 | public class Thread 9 | { 10 | private readonly global::System.Threading.Thread t; 11 | 12 | public Thread(global::System.Threading.Thread t) 13 | { 14 | this.t = t; 15 | } 16 | 17 | public Thread(ThreadStart ts) : this(new global::System.Threading.Thread(ts)) 18 | { 19 | } 20 | 21 | public Thread(Runnable r) : this(r.run) 22 | { 23 | } 24 | 25 | public void setName(string name) 26 | { 27 | t.Name = name; 28 | } 29 | 30 | public void start() 31 | { 32 | t.Start(); 33 | } 34 | 35 | public bool isAlive() 36 | { 37 | return t.IsAlive; 38 | } 39 | 40 | public void yield() 41 | { 42 | } 43 | 44 | public void interrupt() 45 | { 46 | try 47 | { 48 | t.Interrupt(); 49 | } 50 | catch 51 | { 52 | } 53 | } 54 | 55 | public void notifyAll() 56 | { 57 | Monitor.PulseAll(this); 58 | } 59 | 60 | public static void Sleep(int t) 61 | { 62 | global::System.Threading.Thread.Sleep(t); 63 | } 64 | 65 | public static void sleep(int t) 66 | { 67 | Sleep(t); 68 | } 69 | 70 | public static Thread currentThread() 71 | { 72 | return new Thread(global::System.Threading.Thread.CurrentThread); 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/net/InetAddress.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace Tamir.SharpSsh.Sharp.net 4 | { 5 | /// 6 | /// Summary description for InetAddress. 7 | /// 8 | public class InetAddress 9 | { 10 | internal IPAddress addr; 11 | 12 | public InetAddress(string addr) 13 | { 14 | this.addr = IPAddress.Parse(addr); 15 | } 16 | 17 | public InetAddress(IPAddress addr) 18 | { 19 | this.addr = addr; 20 | } 21 | 22 | public bool isAnyLocalAddress() 23 | { 24 | return IPAddress.IsLoopback(addr); 25 | } 26 | 27 | public bool equals(InetAddress addr) 28 | { 29 | return addr.ToString().Equals(addr.ToString()); 30 | } 31 | 32 | public bool equals(string addr) 33 | { 34 | return addr.Equals(addr); 35 | } 36 | 37 | public override string ToString() 38 | { 39 | return addr.ToString(); 40 | } 41 | 42 | public override bool Equals(object obj) 43 | { 44 | return equals(obj.ToString()); 45 | } 46 | 47 | public string getHostAddress() 48 | { 49 | return ToString(); 50 | } 51 | 52 | public override int GetHashCode() 53 | { 54 | return base.GetHashCode(); 55 | } 56 | 57 | public static InetAddress getByName(string name) 58 | { 59 | #if NET_1_1 60 | return new InetAddress( Dns.GetHostByName(name).AddressList[0] ); 61 | #else 62 | return new InetAddress(Dns.GetHostEntry(name).AddressList[0]); 63 | #endif 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/net/ServerSocket.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Sockets; 2 | 3 | namespace Tamir.SharpSsh.Sharp.net 4 | { 5 | /// 6 | /// Summary description for ServerSocket. 7 | /// 8 | public class ServerSocket : TcpListener 9 | { 10 | public ServerSocket(int port, int arg, InetAddress addr) : base(addr.addr, port) 11 | { 12 | Start(); 13 | } 14 | 15 | public Socket accept() 16 | { 17 | return new Socket(AcceptSocket()); 18 | } 19 | 20 | public void close() 21 | { 22 | Stop(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/util/Arrays.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.util 2 | { 3 | /// 4 | /// Summary description for Arrays. 5 | /// 6 | public class Arrays 7 | { 8 | internal static bool equals(byte[] foo, byte[] bar) 9 | { 10 | int i = foo.Length; 11 | if (i != bar.Length) return false; 12 | for (int j = 0; j < i; j++) 13 | { 14 | if (foo[j] != bar[j]) return false; 15 | } 16 | //try{while(true){i--; if(foo[i]!=bar[i])return false;}}catch(Exception e){} 17 | return true; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/util/Enumeration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace Tamir.SharpSsh.Sharp.util 4 | { 5 | /// 6 | /// Summary description for Enumeration. 7 | /// 8 | public class Enumeration 9 | { 10 | private readonly IEnumerator e; 11 | private bool hasMore; 12 | 13 | public Enumeration(IEnumerator e) 14 | { 15 | this.e = e; 16 | hasMore = e.MoveNext(); 17 | } 18 | 19 | public bool hasMoreElements() 20 | { 21 | return hasMore; 22 | } 23 | 24 | public object nextElement() 25 | { 26 | object o = e.Current; 27 | hasMore = e.MoveNext(); 28 | return o; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/util/Hashtable.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.util 2 | { 3 | /// 4 | /// Summary description for Hashtable. 5 | /// 6 | public class Hashtable 7 | { 8 | internal global::System.Collections.Hashtable h; 9 | 10 | public Hashtable() 11 | { 12 | h = new global::System.Collections.Hashtable(); 13 | } 14 | 15 | public Hashtable(global::System.Collections.Hashtable h) 16 | { 17 | this.h = h; 18 | } 19 | 20 | public object this[object key] 21 | { 22 | get { return get(key); } 23 | set { h[key] = value; } 24 | } 25 | 26 | public void put(object key, object item) 27 | { 28 | h.Add(key, item); 29 | } 30 | 31 | public object get(object key) 32 | { 33 | return h[key]; 34 | } 35 | 36 | public Enumeration keys() 37 | { 38 | return new Enumeration(h.Keys.GetEnumerator()); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/util/JavaString.cs: -------------------------------------------------------------------------------- 1 | namespace Tamir.SharpSsh.Sharp.util 2 | { 3 | /// 4 | /// Summary description for SharpString. 5 | /// 6 | public class SharpString : String 7 | { 8 | public SharpString(string s) : base(s) 9 | { 10 | } 11 | 12 | public SharpString(object o) : base(o) 13 | { 14 | } 15 | 16 | public SharpString(byte[] arr) : base(arr) 17 | { 18 | } 19 | 20 | public SharpString(byte[] arr, int offset, int len) : base(arr, offset, len) 21 | { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/System/util/Vector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace Tamir.SharpSsh.Sharp.util 4 | { 5 | /// 6 | /// Summary description for Vector. 7 | /// 8 | public class Vector : ArrayList 9 | { 10 | public int size() 11 | { 12 | return Count; 13 | } 14 | 15 | public void addElement(object o) 16 | { 17 | Add(o); 18 | } 19 | 20 | public void add(object o) 21 | { 22 | addElement(o); 23 | } 24 | 25 | public void removeElement(object o) 26 | { 27 | Remove(o); 28 | } 29 | 30 | public bool remove(object o) 31 | { 32 | Remove(o); 33 | return true; 34 | } 35 | 36 | public object elementAt(int i) 37 | { 38 | return this[i]; 39 | } 40 | 41 | public object get(int i) 42 | { 43 | return elementAt(i); 44 | ; 45 | } 46 | 47 | public void clear() 48 | { 49 | Clear(); 50 | } 51 | 52 | public string toString() 53 | { 54 | return ToString(); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/mono/ConfidenceFactor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Mono.Math.Prime.ConfidenceFactor.cs - Confidence factor for prime generation 3 | // 4 | // Authors: 5 | // Ben Maurer 6 | // 7 | // Copyright (c) 2003 Ben Maurer. All rights reserved 8 | // 9 | 10 | namespace Mono.Math.Prime 11 | { 12 | /// 13 | /// A factor of confidence. 14 | /// 15 | internal enum ConfidenceFactor 16 | { 17 | /// 18 | /// Only suitable for development use, probability of failure may be greater than 1/2^20. 19 | /// 20 | ExtraLow, 21 | 22 | /// 23 | /// Suitable only for transactions which do not require forward secrecy. Probability of failure about 1/2^40 24 | /// 25 | Low, 26 | 27 | /// 28 | /// Designed for production use. Probability of failure about 1/2^80. 29 | /// 30 | Medium, 31 | 32 | /// 33 | /// Suitable for sensitive data. Probability of failure about 1/2^160. 34 | /// 35 | High, 36 | 37 | /// 38 | /// Use only if you have lots of time! Probability of failure about 1/2^320. 39 | /// 40 | ExtraHigh, 41 | 42 | /// 43 | /// Only use methods which generate provable primes. Not yet implemented. 44 | /// 45 | Provable 46 | } 47 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/mono/NextPrimeFinder.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Mono.Math.Prime.Generator.NextPrimeFinder.cs - Prime Generator 3 | // 4 | // Authors: 5 | // Ben Maurer 6 | // 7 | // Copyright (c) 2003 Ben Maurer. All rights reserved 8 | // 9 | 10 | using System; 11 | 12 | namespace Mono.Math.Prime.Generator 13 | { 14 | /// 15 | /// Finds the next prime after a given number. 16 | /// 17 | internal class NextPrimeFinder : SequentialSearchPrimeGeneratorBase 18 | { 19 | protected override BigInteger GenerateSearchBase(int bits, object Context) 20 | { 21 | if (Context == null) throw new ArgumentNullException("Context"); 22 | var ret = new BigInteger((BigInteger) Context); 23 | ret.setBit(0); 24 | return ret; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/SSH/mono/PrimeGeneratorBase.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Mono.Math.Prime.Generator.PrimeGeneratorBase.cs - Abstract Prime Generator 3 | // 4 | // Authors: 5 | // Ben Maurer 6 | // 7 | // Copyright (c) 2003 Ben Maurer. All rights reserved 8 | // 9 | 10 | using System; 11 | 12 | namespace Mono.Math.Prime.Generator 13 | { 14 | internal abstract class PrimeGeneratorBase 15 | { 16 | public virtual ConfidenceFactor Confidence 17 | { 18 | get { return ConfidenceFactor.Medium; } 19 | } 20 | 21 | public virtual PrimalityTest PrimalityTest 22 | { 23 | get { return PrimalityTests.SmallPrimeSppTest; } 24 | } 25 | 26 | public virtual int TrialDivisionBounds 27 | { 28 | get { return 4000; } 29 | } 30 | 31 | /// 32 | /// Performs primality tests on bi, assumes trial division has been done. 33 | /// 34 | /// A BigInteger that has been subjected to and passed trial division 35 | /// False if bi is composite, true if it may be prime. 36 | /// The speed of this method is dependent on Confidence 37 | protected bool PostTrialDivisionTests(BigInteger bi) 38 | { 39 | return PrimalityTest(bi, Confidence); 40 | } 41 | 42 | public abstract BigInteger GenerateNewPrime(int bits); 43 | } 44 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/Services/Lib/SSPKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpScan 4 | { 5 | public class SSPKey 6 | { 7 | public string Target { get; set; } 8 | public int Port { get; set; } 9 | public string Type { get; set; } 10 | public int NDR64Syntax { get; set; } 11 | public int OsBuildNumber { get; set; } 12 | public byte OsMajor { get; set; } 13 | public byte OsMinor { get; set; } 14 | public string NbtComputerName { get; set; } 15 | public string NbtDomainName { get; set; } 16 | public string DnsComputerName { get; set; } 17 | public string DnsDomainName { get; set; } 18 | public DateTime TimeStamp { get; set; } 19 | public string NativeOs { get; set; } 20 | public string NativeLanManager { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Services/Lib/TargetParser.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Text.RegularExpressions; 9 | 10 | namespace SharpScan 11 | { 12 | public class TargetParser 13 | { 14 | 15 | 16 | public static void ReadFileToList(String path, ref HashSet ips) 17 | { 18 | ips.Clear(); 19 | FileStream fs_dir = null; 20 | StreamReader reader = null; 21 | try 22 | { 23 | fs_dir = new FileStream(path, FileMode.Open, FileAccess.Read); 24 | 25 | reader = new StreamReader(fs_dir); 26 | 27 | String lineStr; 28 | 29 | while ((lineStr = reader.ReadLine()) != null) 30 | { 31 | if (!lineStr.Equals("")) 32 | { 33 | ips.Add(lineStr); 34 | } 35 | } 36 | } 37 | catch (Exception e) 38 | { 39 | Writer.Failed("An exception occurred while reading the file list!" + e.Message); 40 | } 41 | finally 42 | { 43 | if (reader != null) 44 | { 45 | reader.Close(); 46 | } 47 | if (fs_dir != null) 48 | { 49 | fs_dir.Close(); 50 | } 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Services/Lib/Writer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpScan 4 | { 5 | public class Writer 6 | { 7 | public static void Info(string info) 8 | { 9 | Console.WriteLine($"[*] {info}"); 10 | } 11 | 12 | public static void Line(string info) 13 | { 14 | Console.WriteLine($"{info}"); 15 | } 16 | 17 | public static void Failed(string log) 18 | { 19 | Console.WriteLine($"[!] Failed: {log}"); 20 | } 21 | 22 | public static void Error(string error) 23 | { 24 | Console.WriteLine($"\r\n[!] Error: {error}"); 25 | Environment.Exit(0); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Services/SMB.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Text; 4 | 5 | namespace SharpScan 6 | { 7 | public class SMB 8 | { 9 | internal bool Execute(string ip, int port, int mtime) 10 | { 11 | var _SSPKey = new SSPKey(); 12 | _SSPKey.Target = ip; 13 | _SSPKey.Port = port; 14 | _SSPKey.Type = "smb"; 15 | string flag = "smb1"; 16 | var response = TimeoutSocket.Send(ip, port, mtime, "smb1"); 17 | if (response.Length == 0) 18 | { 19 | flag = "smb2"; 20 | response = TimeoutSocket.Send(ip, port, mtime, "smb2"); 21 | } 22 | if (response.Length == 0) return false; 23 | 24 | NTLMSSPExtract.ParsingSocketStremResponse(ref response, ref _SSPKey); 25 | 26 | if (flag.Equals("smb1")) 27 | { 28 | var veraw = Encoding.Default.GetString(response).Split(new String[] { "\0\0\0" }, StringSplitOptions.RemoveEmptyEntries); 29 | if (veraw.Length == 2) 30 | { 31 | _SSPKey.NativeOs = veraw[0].Replace("\0", ""); 32 | _SSPKey.NativeLanManager = veraw[1].Replace("\0", ""); 33 | } 34 | } 35 | 36 | SSPKeyOutput.Print(ip, _SSPKey); 37 | return true; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Services/WMI.cs: -------------------------------------------------------------------------------- 1 | using SharpScan; 2 | using System; 3 | using System.Threading; 4 | 5 | namespace SharpScan 6 | { 7 | public class WMI 8 | { 9 | public static string CommandName => "wmi"; 10 | 11 | 12 | 13 | 14 | 15 | private static int ParsingNDR64Syntax(byte[] responseBuffer) 16 | { 17 | if (responseBuffer.Length == 0) return 0; 18 | var NDR64SyntaxStr = BitConverter.ToString(responseBuffer).Replace("-", ""); 19 | return NDR64SyntaxStr.Contains("33057171BABE37498319B5DBEF9CCC36") ? 64 : 86; 20 | } 21 | 22 | internal bool Execute(string host, int port, int mtime) 23 | { 24 | var _SSPKey = new SSPKey(); 25 | _SSPKey.Target = host; 26 | _SSPKey.Port = port; 27 | _SSPKey.Type = "wmi"; 28 | 29 | var response = TimeoutSocket.Send(host, port, mtime, "wmi0"); 30 | _SSPKey.NDR64Syntax = ParsingNDR64Syntax(response); 31 | 32 | response = TimeoutSocket.Send(host, port, mtime, "wmi1"); 33 | if (response.Length == 0) return false; 34 | 35 | NTLMSSPExtract.ParsingSocketStremResponse(ref response, ref _SSPKey); 36 | SSPKeyOutput.Print(host, _SSPKey); 37 | return true; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/ExamplePlugins/ClientConnectHandlerExample.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System.Net; 20 | using Socks5.Core.Plugin; 21 | using Socks5.Core.TCP; 22 | 23 | namespace Socks5.Core.ExamplePlugins 24 | { 25 | internal class ClientConnectHandlerExample : ClientConnectedHandler 26 | { 27 | public override bool Enabled { get; set; } = false; 28 | 29 | public override bool OnStart() 30 | { 31 | return true; 32 | } 33 | 34 | public override bool OnConnect(Client client, IPEndPoint ip) 35 | { 36 | if (ip.Address.ToString() != "127.0.0.1") 37 | //deny the connection. 38 | return false; 39 | return true; 40 | //With this function you can also Modify the Socket, as it's stored in e.Client.Sock. 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/ExamplePlugins/ConnectHandlerExample.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Plugin; 20 | using Socks5.Core.Socks; 21 | using System; 22 | 23 | namespace Socks5.Core.ExamplePlugins 24 | { 25 | public class ConnectHandlerExample : ConnectHandler 26 | { 27 | public override bool Enabled { get; set; } = false; 28 | 29 | public override bool OnStart() 30 | { 31 | return true; 32 | } 33 | 34 | public override bool OnConnect(SocksRequest request) 35 | { 36 | //Compare data. 37 | if (request.Address.Contains("74.125.224")) //Google.com IP 38 | { 39 | Console.WriteLine("Redirecting traffic from {0} to yahoo.com.", request.Address); 40 | request.Address = "www.yahoo.com"; 41 | request.Type = AddressType.Domain; 42 | } 43 | 44 | //Allow the connection. 45 | return true; 46 | } 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/ExamplePlugins/LoginHandlerExample.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Plugin; 20 | using Socks5.Core.Socks; 21 | 22 | namespace Socks5.Core.ExamplePlugins 23 | { 24 | 25 | public class LoginHandlerExample : LoginHandler 26 | { 27 | //Username/Password Table? Endless possiblities for the login system. 28 | 29 | public override bool Enabled { get; set; } = false; 30 | 31 | public override bool OnStart() 32 | { 33 | return true; 34 | } 35 | 36 | public override LoginStatus HandleLogin(User user) 37 | { 38 | return user.Username == "thrdev" && user.Password == "testing1234" ? LoginStatus.Correct : LoginStatus.Denied; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/ExtensionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Socks5.Core 4 | { 5 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class 6 | | AttributeTargets.Method)] 7 | public sealed class ExtensionAttribute : Attribute 8 | { 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Plugin/ClientConnectedHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System.Net; 20 | using Socks5.Core.TCP; 21 | 22 | namespace Socks5.Core.Plugin 23 | { 24 | public abstract class ClientConnectedHandler : IGenericPlugin 25 | { 26 | public abstract bool OnStart(); 27 | public abstract bool Enabled { get; set; } 28 | 29 | /// 30 | /// Handle client connected callback. Useful for IPblocking. 31 | /// 32 | /// 33 | /// Return true to allow the connection, return false to deny it. 34 | public abstract bool OnConnect(Client client, IPEndPoint ip); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Plugin/ClientDisconnectedHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.TCP; 20 | 21 | namespace Socks5.Core.Plugin 22 | { 23 | public abstract class ClientDisconnectedHandler : IGenericPlugin 24 | { 25 | public abstract bool OnStart(); 26 | public abstract bool Enabled { get; set; } 27 | 28 | /// 29 | /// Handle client disconnected callback. Useful for keeping track of connected clients. 30 | /// 31 | public abstract bool OnDisconnected(object sender, SocksClientEventArgs e); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Plugin/ConnectHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | 21 | namespace Socks5.Core.Plugin 22 | { 23 | public abstract class ConnectHandler : IGenericPlugin 24 | { 25 | public abstract bool OnStart(); 26 | public abstract bool Enabled { get; set; } 27 | 28 | /// 29 | /// Handle request callback. 30 | /// 31 | /// 32 | /// Return true to allow the connection, return false to deny it. 33 | public abstract bool OnConnect(SocksRequest request); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Plugin/ConnectSocketOverrideHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | using Socks5.Core.TCP; 21 | 22 | namespace Socks5.Core.Plugin 23 | { 24 | public abstract class ConnectSocketOverrideHandler : IGenericPlugin 25 | { 26 | public abstract bool OnStart(); 27 | public abstract bool Enabled { get; set; } 28 | 29 | /// 30 | /// Override the connection, to do whatever you want with it. Client is a wrapper around a socket. 31 | /// 32 | /// The original request params. 33 | /// 34 | public abstract Client OnConnectOverride(SocksRequest sr); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Plugin/DataHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.TCP; 20 | 21 | namespace Socks5.Core.Plugin 22 | { 23 | public abstract class DataHandler : IGenericPlugin 24 | { 25 | public abstract bool OnStart(); 26 | 27 | public abstract bool Enabled { get; set; } 28 | 29 | /// 30 | /// Allows you to grab/modify data before it's sent to the end user. 31 | /// 32 | /// 33 | /// 34 | public abstract void OnServerDataReceived(object sender, DataEventArgs e); 35 | 36 | /// 37 | /// Allows you to grab/modify data before it's sent to the client. 38 | /// 39 | /// 40 | /// 41 | public abstract void OnClientDataReceived(object sender, DataEventArgs e); 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Plugin/GenericPlugin.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | namespace Socks5.Core.Plugin 20 | { 21 | public interface IGenericPlugin 22 | { 23 | bool Enabled { get; set; } 24 | bool OnStart(); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Plugin/LoginHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | 21 | namespace Socks5.Core.Plugin 22 | { 23 | 24 | public abstract class LoginHandler : IGenericPlugin 25 | { 26 | public abstract bool OnStart(); 27 | public abstract bool Enabled { get; set; } 28 | 29 | public abstract LoginStatus HandleLogin(User user); 30 | // 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Plugin/LoginStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Plugin 2 | { 3 | public enum LoginStatus 4 | { 5 | Denied = 0xFF, 6 | Correct = 0x00 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Socks/AddressType.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum AddressType 4 | { 5 | Ip = 0x01, 6 | Domain = 0x03, 7 | Pv6 = 0x04 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Socks/AuthTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum AuthTypes 4 | { 5 | Login = 0x02, 6 | SocksCompress = 0x88, 7 | SocksEncrypt = 0x90, 8 | SocksBoth = 0xFE, 9 | Unsupported = 0xFF, 10 | None = 0x00 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Socks/HeaderTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum HeaderTypes 4 | { 5 | Socks5 = 0x05, 6 | Zero = 0x00 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Socks/SocksError.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum SocksError 4 | { 5 | Granted = 0x00, 6 | Failure = 0x01, 7 | NotAllowed = 0x02, 8 | Unreachable = 0x03, 9 | HostUnreachable = 0x04, 10 | Refused = 0x05, 11 | Expired = 0x06, 12 | NotSupported = 0x07, 13 | AddressNotSupported = 0x08, 14 | LoginRequired = 0x90 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Socks/StreamTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.Socks 2 | { 3 | public enum StreamTypes 4 | { 5 | Stream = 0x01, 6 | Bind = 0x02, 7 | Udp = 0x03 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Socks/User.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace Socks5.Core.Socks 4 | { 5 | public class User 6 | { 7 | public User(byte authTypeVersion, string un, string pw, IPEndPoint ip) 8 | { 9 | AuthTypeVersion = authTypeVersion; 10 | Username = un; 11 | Password = pw; 12 | Ip = ip; 13 | } 14 | 15 | public byte AuthTypeVersion { get; } 16 | public string Username { get; private set; } 17 | public string Password { get; private set; } 18 | public IPEndPoint Ip { get; private set; } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Socks5Client/Events/Socks5ClientArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | using System; 21 | 22 | namespace Socks5.Core.Socks5Client.Events 23 | { 24 | public class Socks5ClientArgs : EventArgs 25 | { 26 | public Socks5ClientArgs(Socks5Client p, SocksError? x) 27 | { 28 | Client = p; 29 | Status = x ?? SocksError.Failure; 30 | } 31 | 32 | public SocksError Status { get; } 33 | 34 | public Socks5Client Client { get; } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/Socks5Client/Events/Socks5ClientDataArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System; 20 | 21 | namespace Socks5.Core.Socks5Client.Events 22 | { 23 | public class Socks5ClientDataArgs : EventArgs 24 | { 25 | //Data Buffer 26 | //Socks Client 27 | 28 | public Socks5ClientDataArgs(Socks5Client client, byte[] buff, int count, int offset) 29 | { 30 | Client = client; 31 | Buffer = buff; 32 | Count = count; 33 | Offset = offset; 34 | } 35 | 36 | public Socks5Client Client { get; } 37 | 38 | public byte[] Buffer { get; set; } 39 | public int Count { get; set; } 40 | public int Offset { get; set; } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/TCP/ByteType.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.TCP 2 | { 3 | public enum ByteType 4 | { 5 | Sent, 6 | Received 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/TCP/ClientEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System; 20 | 21 | namespace Socks5.Core.TCP 22 | { 23 | public class ClientEventArgs : EventArgs 24 | { 25 | public ClientEventArgs(Client client) 26 | { 27 | Client = client; 28 | } 29 | 30 | public Client Client { get; private set; } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/TCP/DataEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Socks5 - A full-fledged high-performance socks5 proxy server written in C#. Plugin support included. 3 | Copyright (C) 2016 ThrDev 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using Socks5.Core.Socks; 20 | using System; 21 | 22 | namespace Socks5.Core.TCP 23 | { 24 | public class DataEventArgs : EventArgs 25 | { 26 | public DataEventArgs(Client client, byte[] buffer, int count, SocksRequest req = null) 27 | { 28 | Client = client; 29 | Buffer = buffer; 30 | Count = count; 31 | Offset = 0; 32 | Request = req; 33 | } 34 | 35 | public Client Client { get; set; } 36 | public byte[] Buffer { get; set; } 37 | public int Count { get; set; } 38 | public int Offset { get; set; } 39 | public SocksRequest Request { get; set; } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/TCP/PacketType.cs: -------------------------------------------------------------------------------- 1 | namespace Socks5.Core.TCP 2 | { 3 | public enum PacketType 4 | { 5 | Sent, 6 | Received 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Socks5/TCP/SocksClientEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Socks5.Core.Socks; 2 | using System; 3 | 4 | namespace Socks5.Core.TCP 5 | { 6 | public class SocksClientEventArgs : EventArgs 7 | { 8 | public SocksClientEventArgs(SocksClient client) 9 | { 10 | Client = client; 11 | } 12 | 13 | public SocksClient Client { get; private set; } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Collections.Concurrent/IProducerConsumerCollection.cs: -------------------------------------------------------------------------------- 1 | // IConcurrentCollection.cs 2 | // 3 | // Copyright (c) 2008 Jérémie "Garuma" Laval 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | // 23 | // 24 | 25 | using System.Collections; 26 | using System.Collections.Generic; 27 | 28 | namespace System.Collections.Concurrent 29 | { 30 | public interface IProducerConsumerCollection : IEnumerable, ICollection, IEnumerable 31 | { 32 | bool TryAdd (T item); 33 | bool TryTake (out T item); 34 | T[] ToArray (); 35 | void CopyTo (T[] array, int index); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Collections/IStructuralComparable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IStructuralComparable.cs 3 | // 4 | // Authors: 5 | // Zoltan Varga (vargaz@gmail.com) 6 | // 7 | // Copyright (C) 2009 Novell 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace System.Collections 30 | { 31 | public interface IStructuralComparable { 32 | int CompareTo (object other, IComparer comparer); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Collections/IStructuralEquatable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IStructuralEquatable.cs 3 | // 4 | // Authors: 5 | // Zoltan Varga (vargaz@gmail.com) 6 | // 7 | // Copyright (C) 2009 Novell 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | namespace System.Collections 30 | { 31 | public interface IStructuralEquatable { 32 | bool Equals (object other, IEqualityComparer comparer); 33 | 34 | int GetHashCode (IEqualityComparer comparer); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Runtime.CompilerServices/AsyncStateMachineAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AsyncStateMachineAttribute.cs 3 | // 4 | // Authors: 5 | // Marek Safar 6 | // 7 | // Copyright (C) 2012 Xamarin, Inc (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if NET_4_5 30 | 31 | namespace System.Runtime.CompilerServices 32 | { 33 | [AttributeUsage (AttributeTargets.Method, Inherited = false)] 34 | [Serializable] 35 | public sealed class AsyncStateMachineAttribute : StateMachineAttribute 36 | { 37 | public AsyncStateMachineAttribute (Type stateMachineType) 38 | : base (stateMachineType) 39 | { 40 | } 41 | } 42 | } 43 | 44 | #endif -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Runtime.CompilerServices/IAsyncStateMachine.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IAsyncStateMachine.cs 3 | // 4 | // Authors: 5 | // Marek Safar 6 | // 7 | // Copyright (C) 2012 Xamarin, Inc (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if NET_4_5 30 | 31 | namespace System.Runtime.CompilerServices 32 | { 33 | public interface IAsyncStateMachine 34 | { 35 | void MoveNext (); 36 | void SetStateMachine (IAsyncStateMachine stateMachine); 37 | } 38 | } 39 | 40 | #endif -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Runtime.CompilerServices/ICriticalNotifyCompletion.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ICriticalNotifyCompletion.cs 3 | // 4 | // Authors: 5 | // Marek Safar 6 | // 7 | // Copyright (C) 2012 Xamarin, Inc (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if NET_4_5 30 | 31 | namespace System.Runtime.CompilerServices 32 | { 33 | public interface ICriticalNotifyCompletion : INotifyCompletion 34 | { 35 | void UnsafeOnCompleted (Action continuation); 36 | } 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Runtime.CompilerServices/INotifyCompletion.cs: -------------------------------------------------------------------------------- 1 | // 2 | // INotifyCompletion.cs 3 | // 4 | // Authors: 5 | // Marek Safar 6 | // 7 | // Copyright (C) 2012 Xamarin, Inc (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if NET_4_5 30 | 31 | namespace System.Runtime.CompilerServices 32 | { 33 | public interface INotifyCompletion 34 | { 35 | void OnCompleted (Action continuation); 36 | } 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Runtime.CompilerServices/StateMachineAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // StateMachineAttribute.cs 3 | // 4 | // Authors: 5 | // Marek Safar 6 | // 7 | // Copyright (C) 2012 Xamarin, Inc (http://www.xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | #if NET_4_5 30 | 31 | namespace System.Runtime.CompilerServices 32 | { 33 | [AttributeUsage (AttributeTargets.Method, Inherited = false)] 34 | [Serializable] 35 | public class StateMachineAttribute : Attribute 36 | { 37 | public StateMachineAttribute (Type stateMachineType) 38 | { 39 | StateMachineType = stateMachineType; 40 | } 41 | 42 | public Type StateMachineType { get; private set; } 43 | } 44 | } 45 | 46 | #endif -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading.Tasks/IConcurrentDeque.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IConcurrentDeque.cs 3 | // 4 | // Author: 5 | // Jérémie "Garuma" Laval 6 | // 7 | // Copyright (c) 2011 Jérémie "Garuma" Laval 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System.Collections.Generic; 28 | 29 | namespace System.Threading.Tasks 30 | { 31 | interface IConcurrentDeque 32 | { 33 | void PushBottom (T obj); 34 | PopResult PopBottom (out T obj); 35 | PopResult PopTop (out T obj); 36 | IEnumerable GetEnumerable (); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading.Tasks/PopResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PopResult.cs 3 | // 4 | // Author: 5 | // Jérémie "Garuma" Laval 6 | // 7 | // Copyright (c) 2011 Jérémie "Garuma" Laval 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace System.Threading.Tasks 28 | { 29 | enum PopResult { 30 | Succeed, 31 | Empty, 32 | Abort 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading.Tasks/TaskConstants.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TaskConstants.cs 3 | // 4 | // Authors: 5 | // Jérémie Laval 6 | // 7 | // Copyright 2011 Xamarin Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | // 28 | 29 | namespace System.Threading.Tasks 30 | { 31 | static class TaskConstants 32 | { 33 | public static readonly Task Finished; 34 | public static readonly Task Canceled; 35 | 36 | static TaskConstants () 37 | { 38 | var tcs = new TaskCompletionSource (); 39 | tcs.SetResult (null); 40 | Finished = tcs.Task; 41 | 42 | tcs = new TaskCompletionSource (); 43 | tcs.SetCanceled (); 44 | Canceled = tcs.Task; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading.Tasks/TaskConstants_T.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TaskConstants_T.cs 3 | // 4 | // Authors: 5 | // Jérémie Laval 6 | // 7 | // Copyright 2011 Xamarin Inc. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | // 28 | 29 | #if NET_4_5 30 | 31 | namespace System.Threading.Tasks 32 | { 33 | internal class TaskConstants 34 | { 35 | internal static readonly Task Canceled; 36 | 37 | static TaskConstants () 38 | { 39 | var tcs = new TaskCompletionSource (); 40 | tcs.SetCanceled (); 41 | Canceled = tcs.Task; 42 | } 43 | } 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading.Tasks/TaskCreationOptions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TaskCreationOptions.cs 3 | // 4 | // Authors: 5 | // Marek Safar (marek.safar@gmail.com) 6 | // 7 | // Copyright (c) 2008 Jérémie "Garuma" Laval 8 | // Copyright 2011 Xamarin Inc. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to deal 12 | // in the Software without restriction, including without limitation the rights 13 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | // THE SOFTWARE. 27 | // 28 | // 29 | 30 | namespace System.Threading.Tasks 31 | { 32 | [FlagsAttribute, SerializableAttribute] 33 | public enum TaskCreationOptions 34 | { 35 | None = 0x0, 36 | PreferFairness = 0x1, 37 | LongRunning = 0x2, 38 | AttachedToParent = 0x4, 39 | #if NET_4_5 40 | DenyChildAttach = 0x8, 41 | HideScheduler = 0x10 42 | #endif 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading.Tasks/TaskStatus.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TaskStatus.cs 3 | // 4 | // Author: 5 | // Jérémie "Garuma" Laval 6 | // 7 | // Copyright (c) 2009 Jérémie "Garuma" Laval 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace System.Threading.Tasks 28 | { 29 | public enum TaskStatus 30 | { 31 | Created, 32 | WaitingForActivation, 33 | WaitingToRun, 34 | Running, 35 | WaitingForChildrenToComplete, 36 | RanToCompletion, 37 | Canceled, 38 | Faulted 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading/ThreadingHelper.cs: -------------------------------------------------------------------------------- 1 | // Needed for NET40 2 | 3 | using System; 4 | using System.Threading; 5 | 6 | namespace System.Threading 7 | { 8 | [System.Diagnostics.DebuggerNonUserCode] 9 | public static partial class ThreadingHelper 10 | { 11 | internal const int INT_SleepCountHint = 10; 12 | private const int INT_MaxTime = 200; 13 | static readonly bool isSingleCpu = (Environment.ProcessorCount == 1); 14 | 15 | 16 | public static T VolatileRead(ref T address) 17 | where T : class 18 | { 19 | T copy = address; 20 | Thread.MemoryBarrier(); 21 | return copy; 22 | } 23 | 24 | public static void VolatileWrite(ref T address, T value) 25 | where T : class 26 | { 27 | GC.KeepAlive(address); 28 | Thread.MemoryBarrier(); 29 | address = value; 30 | } 31 | 32 | internal static long Milliseconds(long ticks) 33 | { 34 | return ticks / TimeSpan.TicksPerMillisecond; 35 | } 36 | 37 | internal static void SpinOnce(ref int count) 38 | { 39 | count++; 40 | if (isSingleCpu || count % INT_SleepCountHint == 0) 41 | { 42 | Thread.Sleep(0); 43 | } 44 | else 45 | { 46 | Thread.SpinWait(Math.Min(count, INT_MaxTime) << 1); 47 | } 48 | } 49 | 50 | internal static long TicksNow() 51 | { 52 | return DateTime.Now.Ticks; 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading/Volatile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace System.Threading 5 | { 6 | public static class Volatile 7 | { 8 | public static int Read(ref int location) 9 | { 10 | return Thread.VolatileRead(ref location); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System.Threading/Watch.cs: -------------------------------------------------------------------------------- 1 | // Task.cs 2 | // 3 | // Copyright (c) 2008 Jérémie "Garuma" Laval 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | // 23 | // 24 | 25 | using System; 26 | 27 | namespace System.Threading 28 | { 29 | internal struct Watch 30 | { 31 | long startTicks; 32 | 33 | public static Watch StartNew () 34 | { 35 | Watch watch = new Watch (); 36 | watch.Start (); 37 | return watch; 38 | } 39 | 40 | public void Start () 41 | { 42 | startTicks = TicksNow (); 43 | } 44 | 45 | public void Stop () 46 | { 47 | 48 | } 49 | 50 | public long ElapsedMilliseconds { 51 | get { 52 | return (TicksNow () - startTicks) / TimeSpan.TicksPerMillisecond; 53 | } 54 | } 55 | 56 | static long TicksNow () 57 | { 58 | return DateTime.Now.Ticks; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System/Funcs.cs: -------------------------------------------------------------------------------- 1 | // 2 | // System.Func.cs 3 | // 4 | // Authors: 5 | // Alejandro Serrano "Serras" (trupill@yahoo.es) 6 | // Marek Safar (marek.safar@gmail.com) 7 | // 8 | 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR TArg PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // 27 | 28 | namespace System { 29 | 30 | public delegate TResult Func (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); 31 | public delegate TResult Func (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); 32 | public delegate TResult Func (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); 33 | public delegate TResult Func (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /SharpScan/Pkg/System.Threading.Tasks35/System/LazyThreadSafetyMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Lazy.cs 3 | // 4 | // Authors: 5 | // Rodrigo Kumpera (kumpera@gmail.com) 6 | // 7 | // Copyright (C) 2010 Novell 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace System.Threading 32 | { 33 | public enum LazyThreadSafetyMode 34 | { 35 | None, 36 | PublicationOnly, 37 | ExecutionAndPublication 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SharpScan/Pkg/Windows/EDRCheck.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace SharpScan 8 | { 9 | internal class EDRCheck 10 | { 11 | protected static string Format(string args_1, string args_2) => String.Format(" [>] {0,-28}: {1}", args_1, args_2); 12 | public EDRCheck() 13 | { 14 | 15 | List currentProcesses = Process.GetProcesses() 16 | .Select(p => p.ProcessName.ToLower() + ".exe") 17 | .Distinct() 18 | .ToList(); 19 | 20 | 21 | Dictionary matchedProcesses = new Dictionary(); 22 | 23 | foreach (string process in currentProcesses) 24 | { 25 | if (Configuration.EDRQueryDictionary.ContainsKey(process)) 26 | { 27 | matchedProcesses[process] = Configuration.EDRQueryDictionary[process]; 28 | } 29 | } 30 | 31 | 32 | if (matchedProcesses.Any()) 33 | { 34 | Console.WriteLine("[+] Installed AV, EDR and corresponding processes:\n"); 35 | foreach (KeyValuePair kvp in matchedProcesses) 36 | { 37 | Console.WriteLine(Format(kvp.Key, kvp.Value)); 38 | } 39 | } 40 | else 41 | { 42 | Console.WriteLine("No installed anti-virus software was detected."); 43 | } 44 | Console.WriteLine("\n"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SharpScan/Plugins/Socks5.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Threading; 4 | using Socks5.Core.Plugin; 5 | using Socks5.Core.Socks; 6 | using Socks5.Core.SocksServer; 7 | namespace SharpScan 8 | { 9 | public class Socks5 10 | { 11 | public static void Run(int Port,string userName,string passWord) 12 | { 13 | if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(passWord)) 14 | { 15 | var socks5Server = new Socks5Server(IPAddress.Parse("0.0.0.0"), Port); 16 | socks5Server.Start(); 17 | PluginLoader.ChangePluginStatus(true, typeof(Auth)); 18 | Console.WriteLine($"[+] Start socks5 port:{Port} , User:{Program.userName} Password:{Program.passWord}"); 19 | while (true) { } 20 | } 21 | else 22 | { 23 | Console.WriteLine("[!] Please enter your: Account or password"); 24 | } 25 | 26 | } 27 | } 28 | 29 | class Auth : LoginHandler 30 | { 31 | public override bool OnStart() => true; 32 | 33 | private bool _enabled = false; 34 | public override bool Enabled 35 | { 36 | get { return _enabled; } 37 | set { _enabled = value; } 38 | } 39 | 40 | public override LoginStatus HandleLogin(User user) 41 | { 42 | if (user != null && user.Username == Program.userName && user.Password == Program.passWord) 43 | { 44 | return LoginStatus.Correct; 45 | } 46 | else 47 | { 48 | return LoginStatus.Denied; 49 | } 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /SharpScan/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("SharpScan")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SharpScan")] 13 | [assembly: AssemblyCopyright("Copyright © 2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("ca26e548-bed0-4564-99a8-460aae0c9a90")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SharpScan/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INotGreen/SharpScan/6dea5d87dfa009a082a93463c4fbbd1384d60729/SharpScan/README.md -------------------------------------------------------------------------------- /SharpScan/SharpScan.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | zh-CN 11 | false 12 | 13 | -------------------------------------------------------------------------------- /SharpScan/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SharpScan/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Test")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Test")] 13 | [assembly: AssemblyCopyright("Copyright © 2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("e6ef8e13-301b-4877-92bd-83ffbc7cd1d2")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Test/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM 设置项目目录 3 | SET PROJECT_DIR=SharpScan.Core 4 | 5 | REM 进入项目目录 6 | cd %PROJECT_DIR% 7 | 8 | REM 恢复项目依赖 9 | dotnet restore 10 | 11 | REM 发布项目,生成适用于 Linux 的单文件可执行文件 12 | dotnet publish -c Release -r linux-x64 --self-contained /p:PublishSingleFile=true /p:EnableCompressionInSingleFile=true /p:SingleFileCompression=Enabled 13 | 14 | REM 发布后的文件路径 15 | SET PUBLISH_DIR=%PROJECT_DIR%\..\Bin 16 | REM 提示发布完成 17 | echo 发布完成!文件位于 %PUBLISH_DIR% 18 | pause 19 | -------------------------------------------------------------------------------- /github.bat: -------------------------------------------------------------------------------- 1 | set https_proxy=http://127.0.0.1:9999 2 | git init 3 | git add . 4 | git commit -m "makeG" 5 | git push -f --------------------------------------------------------------------------------