diff --git a/RadiusClient/RadiusClient.sln b/RadiusClient/RadiusClient.sln deleted file mode 100644 index e095a2f..0000000 --- a/RadiusClient/RadiusClient.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "RadiusClient", "RadiusClient\RadiusClient.vbproj", "{46907543-4F8C-4757-8C85-0B2EAD7EFF29}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {46907543-4F8C-4757-8C85-0B2EAD7EFF29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {46907543-4F8C-4757-8C85-0B2EAD7EFF29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {46907543-4F8C-4757-8C85-0B2EAD7EFF29}.Release|Any CPU.ActiveCfg = Release|Any CPU - {46907543-4F8C-4757-8C85-0B2EAD7EFF29}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/RadiusClient/RadiusClient.suo b/RadiusClient/RadiusClient.suo deleted file mode 100644 index df53063..0000000 Binary files a/RadiusClient/RadiusClient.suo and /dev/null differ diff --git a/RadiusClient/RadiusClient/My Project/Application.Designer.vb b/RadiusClient/RadiusClient/My Project/Application.Designer.vb deleted file mode 100644 index 2d2f4a0..0000000 --- a/RadiusClient/RadiusClient/My Project/Application.Designer.vb +++ /dev/null @@ -1,13 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.296 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - diff --git a/RadiusClient/RadiusClient/My Project/Application.myapp b/RadiusClient/RadiusClient/My Project/Application.myapp deleted file mode 100644 index 0167050..0000000 --- a/RadiusClient/RadiusClient/My Project/Application.myapp +++ /dev/null @@ -1,10 +0,0 @@ - - - false - false - 0 - true - 0 - 1 - true - diff --git a/RadiusClient/RadiusClient/My Project/AssemblyInfo.vb b/RadiusClient/RadiusClient/My Project/AssemblyInfo.vb deleted file mode 100644 index 8f82d76..0000000 --- a/RadiusClient/RadiusClient/My Project/AssemblyInfo.vb +++ /dev/null @@ -1,35 +0,0 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' General Information about an assembly is controlled through the following -' set of attributes. Change these attribute values to modify the information -' associated with an assembly. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - diff --git a/RadiusClient/RadiusClient/My Project/Resources.Designer.vb b/RadiusClient/RadiusClient/My Project/Resources.Designer.vb deleted file mode 100644 index 1fcdf75..0000000 --- a/RadiusClient/RadiusClient/My Project/Resources.Designer.vb +++ /dev/null @@ -1,63 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.296 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("RadiusClient.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - End Module -End Namespace diff --git a/RadiusClient/RadiusClient/My Project/Resources.resx b/RadiusClient/RadiusClient/My Project/Resources.resx deleted file mode 100644 index ffecec8..0000000 --- a/RadiusClient/RadiusClient/My Project/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/RadiusClient/RadiusClient/My Project/Settings.Designer.vb b/RadiusClient/RadiusClient/My Project/Settings.Designer.vb deleted file mode 100644 index ed67945..0000000 --- a/RadiusClient/RadiusClient/My Project/Settings.Designer.vb +++ /dev/null @@ -1,73 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.296 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.RadiusClient.My.MySettings - Get - Return Global.RadiusClient.My.MySettings.Default - End Get - End Property - End Module -End Namespace diff --git a/RadiusClient/RadiusClient/My Project/Settings.settings b/RadiusClient/RadiusClient/My Project/Settings.settings deleted file mode 100644 index 377f56d..0000000 --- a/RadiusClient/RadiusClient/My Project/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/RadiusClient/RadiusClient/RadiusClient.vbproj b/RadiusClient/RadiusClient/RadiusClient.vbproj deleted file mode 100644 index cf7715b..0000000 --- a/RadiusClient/RadiusClient/RadiusClient.vbproj +++ /dev/null @@ -1,111 +0,0 @@ - - - - Debug - AnyCPU - - - - - {46907543-4F8C-4757-8C85-0B2EAD7EFF29} - Library - RadiusClient - RadiusClient - 512 - Windows - v2.0 - - - - true - full - true - true - bin\Debug\ - RadiusClient.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - pdbonly - false - true - true - bin\Release\ - RadiusClient.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - On - - - Binary - - - Off - - - On - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - - - - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - \ No newline at end of file diff --git a/RadiusClient/RadiusClient/RadiusClient.vbproj.user b/RadiusClient/RadiusClient/RadiusClient.vbproj.user deleted file mode 100644 index 695b5c7..0000000 --- a/RadiusClient/RadiusClient/RadiusClient.vbproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/RadiusClient/RadiusClient/Radius_Attributes.vb b/RadiusClient/RadiusClient/Radius_Attributes.vb deleted file mode 100644 index d21157a..0000000 --- a/RadiusClient/RadiusClient/Radius_Attributes.vb +++ /dev/null @@ -1,256 +0,0 @@ - - -Imports Microsoft.VisualBasic.Conversion - - -Public Class RADIUSAttributes - Inherits List(Of RADIUSAttribute) - - Friend Function LoadAttributes(ByRef data() As Byte) As Boolean - Dim offset As Integer = 20 - Dim attr As RADIUSAttribute - Dim result As Boolean = True - - Do While offset < data.Length And result - If offset + 1 > data.Length Then result = False - If result Then - If data(offset + 1) < 3 Then result = False - End If - If result Then - If offset + data(offset + 1) > data.Length Then result = False - End If - If result Then - attr = New RADIUSAttribute(data, offset) - Me.Add(attr) - offset += data(offset + 1) - End If - Loop - - Return result - End Function - - Public ReadOnly Property Length() As Integer - Get - Dim result As Integer = 0 - For Each attr In Me - result += attr.Length - Next - Return result - End Get - End Property - - Friend ReadOnly Property Bytes() As Byte() - Get - Dim result() As Byte = {} - Dim offset As Integer = 0 - Array.Resize(result, Me.Length) - For Each attr In Me - Array.Copy(attr.Bytes, 0, result, offset, attr.Length) - offset += attr.Length - Next - Return result - End Get - End Property - - ' fixed function so it return correct value (CI) - Public Function AttributeExists(ByVal type As RadiusAttributeType) As Boolean - Dim attr As RADIUSAttribute - Dim result As Boolean = False - For Each attr In Me - result = (attr.Type = type) - - If result = True Then - Return True - End If - Next - Return False - End Function - - Public Function GetFirstAttribute(ByVal type As RadiusAttributeType) As RADIUSAttribute - Dim atr As RADIUSAttribute - For Each atr In Me - If atr.Type = type Then Return atr - Next - Return Nothing - End Function - - Public Function GetAllAttributes(ByVal type As RadiusAttributeType) As RADIUSAttributes - Dim ret As New RADIUSAttributes - Dim atr As RADIUSAttribute - For Each atr In Me - If atr.Type = type Then ret.Add(atr) - Next - Return ret - End Function - - - - - - - -End Class - -Public Class RADIUSAttribute - Private mType As Byte - Private mLength As Byte - Private mValue() As Byte = {0} - - Friend Sub New(ByRef data() As Byte, ByVal offset As Integer) - mLength = data(offset + 1) - Array.Resize(mValue, mLength - 2) - Array.Copy(data, offset + 2, mValue, 0, mLength - 2) - mType = data(offset) - End Sub - - Public Sub New(ByVal type As RadiusAttributeType, ByVal data() As Byte) - CommonNew(type, data) - End Sub - - Public Sub New(ByVal type As RadiusAttributeType, ByVal data As String) - Dim newdata() As Byte = Conversion.ConvertToBytes(data) - CommonNew(type, newdata) - End Sub - - Public Sub New(ByVal type As RadiusAttributeType, ByVal data As Long) - Dim newdata() As Byte = {data \ 16777216, _ - (data Mod 16777216) \ 65536, _ - (data Mod 65536) \ 256, _ - (data Mod 256)} - CommonNew(type, newdata) - End Sub - - Private Sub CommonNew(ByVal type As Byte, ByRef data() As Byte) - If data.Length > 253 Then - mType = 0 - mLength = 3 - Else - mType = type - Array.Resize(mValue, data.Length) - Array.Copy(data, 0, mValue, 0, data.Length) - mLength = mValue.Length + 2 - End If - End Sub - - Public ReadOnly Property Length() As Byte - Get - Return mLength - End Get - End Property - - Public ReadOnly Property Type() As RadiusAttributeType - Get - Return mType - End Get - End Property - - Friend ReadOnly Property Bytes() As Byte() - Get - Dim result() As Byte = {} - Array.Resize(result, mLength) - Array.Copy(mValue, 0, result, 2, mLength - 2) - result(0) = mType - result(1) = mLength - Return result - End Get - End Property - - Public ReadOnly Property Value() As Byte() - Get - Return mValue - End Get - End Property - - Public Function GetString() As String - Return Conversion.ConvertToString(mValue) - End Function - - Public Function GetLong() As Long - If mLength <> 6 Then Return 0 - Return mValue(0) * 16777216 + _ - mValue(1) * 65536 + _ - mValue(2) * 256 + _ - mValue(3) - End Function - - Public Function GetIPAddress() As String - If mLength <> 6 Then Return "0.0.0.0" - Return mValue(0) & "." & mValue(1) & "." & mValue(2) & "." & mValue(3) - End Function - - Public Function GetHex() As String - Dim i As Integer - Dim result As String = "" - Dim k As String - For i = 0 To mLength - 3 - k = Hex(mValue(i)) - If k.Length = 1 Then k = "0" & k - result = result & k & " " - Next - Return result - End Function - - Public Function GetTrimHex() As String - Return Replace(GetHex, " ", "") - End Function - - -End Class - -Public Enum RadiusAttributeType As Byte - Invalid = 0 - UserName = 1 - UserPassword = 2 - CHAPPassword = 3 - NASIPAddress = 4 - NASPort = 5 - ServiceType = 6 - FramedProtocol = 7 - FramedIPAddress = 8 - FramedIPNetmask = 9 - FramedRouting = 10 - FilterId = 11 - FramedMTU = 12 - FramedCompression = 13 - LoginIPHost = 14 - LoginService = 15 - LoginTCPPort = 16 - ReplyMessage = 18 - CallbackNumber = 19 - CallbackId = 20 - FramedRoute = 22 - FramedIPXNetwork = 23 - State = 24 - [Class] = 25 - VendorSpecific = 26 - SessionTimeout = 27 - IdleTimeout = 28 - TerminationAction = 29 - CalledStationId = 30 - CallingStationId = 31 - NASIdentifier = 32 - ProxyState = 33 - LoginLATService = 34 - LoginLATNode = 35 - LoginLATGroup = 36 - FramedAppleTalkLink = 37 - FramedAppleTalkNetwork = 38 - FramedAppleTalkZone = 39 - AcctStatusType = 40 - AcctDelayTime = 41 - AcctInputOctets = 42 - AcctOutputOctets = 43 - AcctSessionId = 44 - AcctAuthentic = 45 - AcctSessionTime = 46 - AcctInputPackets = 47 - AcctOutputPackets = 48 - AcctTerminateCause = 49 - AcctMultiSessionId = 50 - AcctLinkCount = 51 - CHAPChallenge = 60 - NASPortType = 61 - PortLimit = 62 - LoginLATPort = 63 - MessageAuthenticator = 80 -End Enum diff --git a/RadiusClient/RadiusClient/Radius_Client.vb b/RadiusClient/RadiusClient/Radius_Client.vb deleted file mode 100644 index 4e4b037..0000000 --- a/RadiusClient/RadiusClient/Radius_Client.vb +++ /dev/null @@ -1,126 +0,0 @@ -Imports System -Imports System.Text -Imports System.Security.Cryptography -Imports System.Collections -Imports System.IO -Imports System.Net -Imports System.Reflection - - - -Public Class Radius_Client - Private Const UDP_TTL As Integer = 10 - Private pSSecret As String = Nothing - Private pUsername As String = Nothing - Private pPassword As String = Nothing - Private pServer As String = Nothing - Private pRadiusPort As Integer = 1812 - Private pUDPTimeout As Integer = 5000 - Private pDebug As Boolean = False - Private pRA As Byte() = New Byte(15) {} - Private pClientIdentifier As Integer - - - Public Sub New(server As String, port As Integer) - pServer = Server - pRadiusPort = Port - End Sub - - Public Property UDPTimeout() As Integer - Get - Return pUDPTimeout - End Get - Set(value As Integer) - pUDPTimeout = value - End Set - End Property - - Public Property Debug() As Boolean - Get - Return pDebug - End Get - Set(value As Boolean) - pDebug = value - End Set - End Property - - Public Function Authenticate(SharedSecret As String, Username As String, Password As String, pAttributes As RADIUSAttributes) As RADIUSPacket - - Dim pRandonNumber As New Random() - - Dim pCode As Byte = RadiusPacketCode.AccessRequest - GenerateRA() - Dim pIdentifier As Byte = Convert.ToByte(pRandonNumber.[Next](0, 32000) Mod 256) - - Dim pUserAttribute As New RADIUSAttribute(RadiusAttributeType.UserName, Username) - Dim pPassAttribute As New RADIUSAttribute(RadiusAttributeType.UserPassword, Crypto.GeneratePAP_PW(Password, SharedSecret, pRA)) - - pAttributes.Add(pUserAttribute) - pAttributes.Add(pPassAttribute) - - Dim rp As RADIUSPacket = New RADIUSPacket(pCode, pIdentifier, pAttributes, pRA) - - For i As Integer = 0 To 10 - Try - Dim myRadiusClient As New Sockets.UdpClient() - myRadiusClient.Client.SendTimeout = pUDPTimeout - myRadiusClient.Client.ReceiveTimeout = pUDPTimeout - - myRadiusClient.Ttl = UDP_TTL - myRadiusClient.Connect(pServer, pRadiusPort) - Threading.Thread.Sleep(200) - DebugOutput("Sending data to radius server" & Encoding.Default.GetString(rp.Bytes)) - myRadiusClient.Send(rp.Bytes, rp.Bytes.Length) - Threading.Thread.Sleep(200) - Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0) - - Dim receiveBytes As [Byte]() = myRadiusClient.Receive(RemoteIpEndPoint) - DebugOutput("Receive data to radius server" & Encoding.Default.GetString(receiveBytes)) - myRadiusClient.Close() - - - rp = New RADIUSPacket(receiveBytes) - Exit For - Catch e As Exception - DebugOutput("Exception Error: " + e.ToString()) - If i = 5 Then - Return Nothing - End If - End Try - Next - Return rp - End Function - - Private Sub GenerateRA() - Dim pRandonNumber As New Random() - For i As Integer = 0 To 14 - pRA(i) = Convert.ToByte(1 + pRandonNumber.[Next]() Mod 255) - pRandonNumber.[Next]() - Next - - End Sub - - - Private Sub DebugOutput(Output As String) - If pDebug Then - - Dim path As String = (New System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath - - path = Replace(Replace(path.ToLower, "/bin/radiusclient.dll", "/log/"), "/", "\") - ' Console.WriteLine("[DEBUG] " + Output) - Dim myDebugWriter As New StreamWriter(path & "Radius_Debug.txt", True) - - myDebugWriter.WriteLine(Now.ToString & ": " & "[DEBUG] " + Output) - - myDebugWriter.Close() - End If - - End Sub - - - - -End Class - - - diff --git a/RadiusClient/RadiusClient/Radius_ClientCrypto.vb b/RadiusClient/RadiusClient/Radius_ClientCrypto.vb deleted file mode 100644 index 3dcea7a..0000000 --- a/RadiusClient/RadiusClient/Radius_ClientCrypto.vb +++ /dev/null @@ -1,77 +0,0 @@ -Imports System -Imports System.Collections.Generic -Imports System.Text -Imports System.Security.Cryptography - - -Partial Friend NotInheritable Class Crypto - Private Sub New() - End Sub - Public Shared Function GeneratePAP_PW(ClearTextPW As String, SharedSecret As String, RequestAuthenticator As Byte()) As Byte() - - Dim pKeyRA As String = SharedSecret & Encoding.[Default].GetString(RequestAuthenticator) - Dim md5 As MD5 = New MD5CryptoServiceProvider() - Dim pMD5Sum As Byte() = md5.ComputeHash(System.Text.Encoding.[Default].GetBytes(pKeyRA)) - Dim pMD5String As String = Utils.ToHexString(pMD5Sum) - - ' Determine how many rounds are needed for authentication - Dim pCrounds As Integer = ClearTextPW.Length \ 16 - If ClearTextPW.Length Mod 16 <> 0 Then - pCrounds += 1 - End If - - - Dim Result As Byte() = New Byte(pCrounds * 16 - 1) {} - For j As Integer = 0 To pCrounds - 1 - Dim pm As Integer - Dim pp As Integer - - 'Split the password in 16byte - Dim pRoundPW As String = "" - If ClearTextPW.Length < (j + 1) * 16 Then - pRoundPW = ClearTextPW.Substring(j * 16, ClearTextPW.Length - j * 16) - Else - pRoundPW = ClearTextPW.Substring(j * 16, 16) - End If - - For i As Integer = 0 To 15 - If 2 * i > pMD5String.Length Then - pm = 0 - Else - pm = System.Convert.ToInt32(pMD5String.Substring(2 * i, 2), 16) - End If - If i >= pRoundPW.Length Then - pp = 0 - Else - pp = AscW(pRoundPW(i)) - End If - Dim pc As Integer = pm Xor pp - Result((j * 16) + i) = CByte(pc) - Next - - - 'Determine the next MD5 Sum MD5(S + cn-1) - Dim pCN1 As Byte() = New Byte(15) {} - Array.Copy(Result, j * 16, pCN1, 0, 16) - Dim pKeyCN1 As String = SharedSecret & Encoding.[Default].GetString(pCN1) - md5 = New MD5CryptoServiceProvider() - pMD5Sum = md5.ComputeHash(System.Text.Encoding.[Default].GetBytes(pKeyCN1)) - pMD5String = Utils.ToHexString(pMD5Sum) - Next - - Return Result - End Function - - Public Shared Function CalcResponseAuth(ReceivedBytes As Byte()) As Byte() - Dim temp As Byte() = New Byte(2) {} - - Return temp - End Function - - -End Class - - - - - diff --git a/RadiusClient/RadiusClient/Radius_ClientUtils.vb b/RadiusClient/RadiusClient/Radius_ClientUtils.vb deleted file mode 100644 index bd288e2..0000000 --- a/RadiusClient/RadiusClient/Radius_ClientUtils.vb +++ /dev/null @@ -1,49 +0,0 @@ -Imports System.Net -Imports System.Net.Dns - -Partial Friend NotInheritable Class Utils - Private Sub New() - End Sub - Public Shared Function GetCurrentIP() As IPAddress - - Dim IPBytes As Byte() = New Byte(3) {} - Dim HostName As String = Dns.GetHostEntry("127.0.0.1").HostName - Dim local As IPHostEntry = Dns.GetHostEntry(HostName) - - If local.AddressList.Length > 0 Then - IPBytes = local.AddressList(0).GetAddressBytes() - Else - IPBytes = IPAddress.Loopback.GetAddressBytes() - End If - - Dim returnIP As New IPAddress(IPBytes) - Return returnIP - End Function - - Public Shared Function ToHexString(bytes As Byte()) As String - - Dim hexDigits As Char() = {"0"c, "1"c, "2"c, "3"c, "4"c, "5"c, _ - "6"c, "7"c, "8"c, "9"c, "A"c, "B"c, _ - "C"c, "D"c, "E"c, "F"c} - - - Dim chars As Char() = New Char(bytes.Length * 2 - 1) {} - For i As Integer = 0 To bytes.Length - 1 - Dim b As Integer = bytes(i) - chars(i * 2) = hexDigits(b >> 4) - chars(i * 2 + 1) = hexDigits(b And &HF) - Next - Return New String(chars) - End Function - - Public Shared Function intToByteArray(value As Integer) As Byte() - Dim littleendian As Byte() = BitConverter.GetBytes(CShort(value)) - Return New Byte() {littleendian(1), littleendian(0)} - End Function - - -End Class - - - - diff --git a/RadiusClient/RadiusClient/Radius_Conversions.vb b/RadiusClient/RadiusClient/Radius_Conversions.vb deleted file mode 100644 index e591209..0000000 --- a/RadiusClient/RadiusClient/Radius_Conversions.vb +++ /dev/null @@ -1,56 +0,0 @@ - -Friend Class Conversion - Friend Shared Function ConvertToString(ByRef bytes() As Byte) As String - Dim k As New System.Text.StringBuilder - Dim i As Integer - For i = 0 To bytes.Length - 1 : k.Append(Chr(bytes(i))) : Next - Return k.ToString - End Function - - Friend Shared Function ConvertToBytes(ByVal str As String) As Byte() - Dim res() As Byte = {} - Array.Resize(Of Byte)(res, str.Length) - Dim i As Integer - For i = 0 To res.Length - 1 - res(i) = Convert.ToByte(str.Chars(i)) - Next - Return res - End Function - - Friend Shared Function ConvertToDateTime(ByVal value As String) As DateTime - Dim ret As DateTime - value = LCase(value) - Try - value = Replace(value, "utc", "") - value = Replace(value, "mon", "") - value = Replace(value, "tue", "") - value = Replace(value, "wed", "") - value = Replace(value, "thu", "") - value = Replace(value, "fri", "") - value = Replace(value, "sat", "") - value = Replace(value, "sun", "") - value = Replace(value, "jan", "1/") - value = Replace(value, "feb", "2/") - value = Replace(value, "mar", "3/") - value = Replace(value, "apr", "4/") - value = Replace(value, "may", "5/") - value = Replace(value, "jun", "6/") - value = Replace(value, "jul", "7/") - value = Replace(value, "aug", "8/") - value = Replace(value, "sep", "9/") - value = Replace(value, "oct", "10/") - value = Replace(value, "nov", "11/") - value = Replace(value, "dec", "12/") - Do While InStr(value, " ") <> 0 - value = Replace(value, " ", " ") - Loop - value = Replace(value, "/ ", "/") - - ret = Convert.ToDateTime(value) - Catch ex As Exception - ret = Nothing - End Try - Return ret - End Function -End Class - diff --git a/RadiusClient/RadiusClient/Radius_Packet.vb b/RadiusClient/RadiusClient/Radius_Packet.vb deleted file mode 100644 index 748ff6c..0000000 --- a/RadiusClient/RadiusClient/Radius_Packet.vb +++ /dev/null @@ -1,134 +0,0 @@ - - -Imports System.Net -Imports System.Security.Cryptography - - -Public Class RADIUSPacket - Private mCode As RadiusPacketCode - Private mIdentifier As Byte - Private mAuthenticator() As Byte = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - Private mAttributes As New RADIUSAttributes - Private mEndPoint As IPEndPoint - Private mIsValid As Boolean - - - Friend Sub New(ByRef data() As Byte) - 'Check validity ... - mIsValid = mAttributes.LoadAttributes(data) - If mIsValid Then - mCode = data(0) - mIdentifier = data(1) - Array.Copy(data, 4, mAuthenticator, 0, 16) - ' mEndPoint = endPoint - - End If - End Sub - - Public Sub New(ByVal code As RadiusPacketCode, ByVal identifier As Byte, ByVal attributes As RADIUSAttributes, authenticator As Byte()) - mCode = code - mIdentifier = identifier - If attributes Is Nothing Then - mAttributes = New RADIUSAttributes - Else - mAttributes = attributes - End If - - mAuthenticator = authenticator - 'If endPoint Is Nothing Then - ' mIsValid = False - 'Else - ' mEndPoint = endPoint - ' mIsValid = True - 'End If - End Sub - - Public ReadOnly Property IsValid() As Boolean - Get - Return mIsValid - End Get - End Property - - Public ReadOnly Property Code() As RadiusPacketCode - Get - Return mCode - End Get - - - - End Property - - Public ReadOnly Property Identifier() As Byte - Get - Return mIdentifier - End Get - End Property - - Public ReadOnly Property Attributes() As RADIUSAttributes - Get - Return mAttributes - End Get - End Property - - Public ReadOnly Property Authenticator() As Byte() - Get - Return mAuthenticator - End Get - End Property - - Public ReadOnly Property EndPoint() As IPEndPoint - Get - Return mEndPoint - End Get - End Property - - Public ReadOnly Property UserName() As String - Get - If mCode <> RadiusPacketCode.AccessRequest Then Return Nothing - If mAttributes.GetFirstAttribute(RadiusAttributeType.UserName) Is Nothing Then Return Nothing - Return mAttributes.GetFirstAttribute(RadiusAttributeType.UserName).GetString - End Get - End Property - - - - Friend Function Bytes() As Byte() - Dim mLength = 20 + mAttributes.Length - Dim result() As Byte = {} - Array.Resize(result, mLength) - result(0) = mCode - result(1) = mIdentifier - result(2) = mLength \ 256 - result(3) = mLength Mod 256 - mAuthenticator.CopyTo(result, 4) - If mLength > 20 Then mAttributes.Bytes.CopyTo(result, 20) - Return result - End Function - - - - - Private Function XorBytes(ByVal oper1() As Byte, ByVal oper2() As Byte) As Byte() - Dim res() As Byte = {} - If oper1.Length <> oper2.Length Then Return res - Dim i As Integer - Array.Resize(res, oper1.Length) - For i = 0 To oper1.Length - 1 - res(i) = oper1(i) Xor oper2(i) - Next - Return res - End Function - -End Class - -Public Enum RadiusPacketCode As Byte - AccessRequest = 1 - AccessAccept = 2 - AccessReject = 3 - AccountingRequest = 4 - AccountingResponse = 5 - AccessChallenge = 11 - StatusServer = 12 - StatusClient = 13 - Reserved = 255 -End Enum diff --git a/RadiusClient/RadiusClient/Radius_VendorSpefic.vb b/RadiusClient/RadiusClient/Radius_VendorSpefic.vb deleted file mode 100644 index c450b9e..0000000 --- a/RadiusClient/RadiusClient/Radius_VendorSpefic.vb +++ /dev/null @@ -1,120 +0,0 @@ - -Imports RadiusClient.Conversion - -Public Class VendorSpecificAttribute - - Private mVendorType As VendorSpecificType - Private mVendorName As String - Private mVendorValue As String - - Public ReadOnly Property VendorType() As VendorSpecificType - Get - Return mVendorType - End Get - End Property - - Public ReadOnly Property VendorName() As String - Get - Return mVendorName - End Get - End Property - - Public ReadOnly Property VendorValue() As String - Get - Return mVendorValue - End Get - End Property - - Public Function GetTimeStamp() As DateTime - Return ConvertToDateTime(mVendorValue) - End Function - - Friend Sub New(ByRef value() As Byte) - mVendorType = VendorSpecificType.Invalid - mVendorName = "" - mVendorValue = "" - If value.Length < 6 Then Exit Sub - If value.Length <> value(5) + 4 Then Exit Sub - mVendorType = value(4) - mVendorName = "generic" - Dim v() As Byte = {} - Array.Resize(v, value.Length - 6) - Array.Copy(value, 6, v, 0, v.Length) - mVendorValue = ConvertToString(v) - - End Sub - - Public Sub New(ByVal type As VendorSpecificType, ByVal value As String) - mVendorType = type - If type = VendorSpecificType.Invalid Then - mVendorName = "" - mVendorValue = "" - ElseIf type = VendorSpecificType.Generic Then - mVendorName = "generic" - mVendorValue = value - - End If - End Sub - - Public Sub New(ByVal name As String, ByVal value As String) - mVendorType = VendorSpecificType.Generic - mVendorName = name - mVendorValue = value - End Sub - - Public Sub GetRADIUSAttribute(ByRef attributes As RADIUSAttributes) - If attributes Is Nothing Then Exit Sub - If mVendorType = VendorSpecificType.Invalid Then Exit Sub - Dim data() As Byte = {} - Dim len As Byte = 6 - Dim lvt As Byte = mVendorType - - If VendorName = "generic" Then - len += VendorValue.Length - Array.Resize(data, len) - ConvertToBytes(VendorValue).CopyTo(data, 6) - Else - len += VendorName.Length + 1 + VendorValue.Length - Array.Resize(data, len) - ConvertToBytes(VendorName & "=" & VendorValue).CopyTo(data, 6) - End If - - data(4) = lvt - data(5) = len - 4 - data(0) = 0 - data(1) = 0 - data(2) = 0 - data(3) = 9 - Dim attr As New RADIUSAttribute(RadiusAttributeType.VendorSpecific, data) - attributes.Add(attr) - End Sub - - Public Sub SetRADIUSAttribute(ByRef attributes As RADIUSAttributes) - - If mVendorType = VendorSpecificType.Invalid Then Exit Sub - Dim data() As Byte = {} - Dim len As Byte = 6 - Dim lvt As Byte = mVendorType - - - len += VendorValue.Length - Array.Resize(data, len) - ConvertToBytes(VendorValue).CopyTo(data, 6) - - data(4) = lvt - data(5) = len - 4 - data(0) = 0 - data(1) = 0 - data(2) = 0 ' Generic value 666. Not sure if this confilct with other vendor, but RFC does not list existing vendor id's - data(3) = 9 - Dim attr As New RADIUSAttribute(RadiusAttributeType.VendorSpecific, data) - attributes.Add(attr) - End Sub - -End Class - -Public Enum VendorSpecificType As Byte - Invalid = 0 - Generic = 1 - -End Enum \ No newline at end of file diff --git a/RadiusClient/RadiusClient/bin/Debug/RadiusClient.dll b/RadiusClient/RadiusClient/bin/Debug/RadiusClient.dll deleted file mode 100644 index 3d761d6..0000000 Binary files a/RadiusClient/RadiusClient/bin/Debug/RadiusClient.dll and /dev/null differ diff --git a/RadiusClient/RadiusClient/bin/Debug/RadiusClient.pdb b/RadiusClient/RadiusClient/bin/Debug/RadiusClient.pdb deleted file mode 100644 index bc6aa1b..0000000 Binary files a/RadiusClient/RadiusClient/bin/Debug/RadiusClient.pdb and /dev/null differ diff --git a/RadiusClient/RadiusClient/bin/Debug/RadiusClient.xml b/RadiusClient/RadiusClient/bin/Debug/RadiusClient.xml deleted file mode 100644 index beb73de..0000000 --- a/RadiusClient/RadiusClient/bin/Debug/RadiusClient.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - -RadiusClient - - - - - - Returns the cached ResourceManager instance used by this class. - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - \ No newline at end of file diff --git a/RadiusClient/RadiusClient/bin/Debug/vsF77B.tmp b/RadiusClient/RadiusClient/bin/Debug/vsF77B.tmp deleted file mode 100644 index beb73de..0000000 --- a/RadiusClient/RadiusClient/bin/Debug/vsF77B.tmp +++ /dev/null @@ -1,24 +0,0 @@ - - - - -RadiusClient - - - - - - Returns the cached ResourceManager instance used by this class. - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - \ No newline at end of file diff --git a/RadiusClient/RadiusClient/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/RadiusClient/RadiusClient/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache deleted file mode 100644 index f8f8b1d..0000000 Binary files a/RadiusClient/RadiusClient/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ diff --git a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.Resources.resources b/RadiusClient/RadiusClient/obj/Debug/RadiusClient.Resources.resources deleted file mode 100644 index 06c24d0..0000000 Binary files a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.Resources.resources and /dev/null differ diff --git a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.dll b/RadiusClient/RadiusClient/obj/Debug/RadiusClient.dll deleted file mode 100644 index 3d761d6..0000000 Binary files a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.dll and /dev/null differ diff --git a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.pdb b/RadiusClient/RadiusClient/obj/Debug/RadiusClient.pdb deleted file mode 100644 index bc6aa1b..0000000 Binary files a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.pdb and /dev/null differ diff --git a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.vbproj.FileListAbsolute.txt b/RadiusClient/RadiusClient/obj/Debug/RadiusClient.vbproj.FileListAbsolute.txt deleted file mode 100644 index 04af567..0000000 --- a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.vbproj.FileListAbsolute.txt +++ /dev/null @@ -1,10 +0,0 @@ -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\bin\Debug\RadiusClient.dll -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\bin\Debug\RadiusClient.pdb -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\bin\Debug\RadiusClient.xml -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\obj\Debug\ResolveAssemblyReference.cache -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\obj\Debug\RadiusClient.Resources.resources -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\obj\Debug\RadiusClient.dll -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\obj\Debug\RadiusClient.xml -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\obj\Debug\RadiusClient.pdb -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\obj\Debug\ResGen.read.1.tlog -C:\Users\Administrator\documents\visual studio 2010\Projects\RadiusClient\RadiusClient\obj\Debug\ResGen.write.1.tlog diff --git a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.xml b/RadiusClient/RadiusClient/obj/Debug/RadiusClient.xml deleted file mode 100644 index beb73de..0000000 --- a/RadiusClient/RadiusClient/obj/Debug/RadiusClient.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - -RadiusClient - - - - - - Returns the cached ResourceManager instance used by this class. - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - \ No newline at end of file diff --git a/RadiusClient/RadiusClient/obj/Debug/ResGen.read.1.tlog b/RadiusClient/RadiusClient/obj/Debug/ResGen.read.1.tlog deleted file mode 100644 index e4aaa87..0000000 Binary files a/RadiusClient/RadiusClient/obj/Debug/ResGen.read.1.tlog and /dev/null differ diff --git a/RadiusClient/RadiusClient/obj/Debug/ResGen.write.1.tlog b/RadiusClient/RadiusClient/obj/Debug/ResGen.write.1.tlog deleted file mode 100644 index dcb497c..0000000 Binary files a/RadiusClient/RadiusClient/obj/Debug/ResGen.write.1.tlog and /dev/null differ diff --git a/RadiusClient/RadiusClient/obj/Debug/TempPE/My Project.Resources.Designer.vb.dll b/RadiusClient/RadiusClient/obj/Debug/TempPE/My Project.Resources.Designer.vb.dll deleted file mode 100644 index 42e4133..0000000 Binary files a/RadiusClient/RadiusClient/obj/Debug/TempPE/My Project.Resources.Designer.vb.dll and /dev/null differ