mirror of
https://github.com/jakobadam/RDSFactor.git
synced 2025-08-04 07:11:50 +02:00
Imported Claus Isager's CICRadarR
This commit is contained in:
commit
249ae5818b
156 changed files with 10807 additions and 0 deletions
20
RadiusClient/RadiusClient.sln
Normal file
20
RadiusClient/RadiusClient.sln
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
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
|
BIN
RadiusClient/RadiusClient.suo
Normal file
BIN
RadiusClient/RadiusClient.suo
Normal file
Binary file not shown.
13
RadiusClient/RadiusClient/My Project/Application.Designer.vb
generated
Normal file
13
RadiusClient/RadiusClient/My Project/Application.Designer.vb
generated
Normal file
|
@ -0,0 +1,13 @@
|
|||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' 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.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
10
RadiusClient/RadiusClient/My Project/Application.myapp
Normal file
10
RadiusClient/RadiusClient/My Project/Application.myapp
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>false</MySubMain>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>1</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
35
RadiusClient/RadiusClient/My Project/AssemblyInfo.vb
Normal file
35
RadiusClient/RadiusClient/My Project/AssemblyInfo.vb
Normal file
|
@ -0,0 +1,35 @@
|
|||
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
|
||||
|
||||
<Assembly: AssemblyTitle("RadiusClient")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("RadiusClient")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2013")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("a19ab4a4-0fb9-4a32-b8ff-6aa5a6580552")>
|
||||
|
||||
' 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:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
63
RadiusClient/RadiusClient/My Project/Resources.Designer.vb
generated
Normal file
63
RadiusClient/RadiusClient/My Project/Resources.Designer.vb
generated
Normal file
|
@ -0,0 +1,63 @@
|
|||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' 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.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
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.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
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
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
117
RadiusClient/RadiusClient/My Project/Resources.resx
Normal file
117
RadiusClient/RadiusClient/My Project/Resources.resx
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
73
RadiusClient/RadiusClient/My Project/Settings.Designer.vb
generated
Normal file
73
RadiusClient/RadiusClient/My Project/Settings.Designer.vb
generated
Normal file
|
@ -0,0 +1,73 @@
|
|||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' 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.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
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
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
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
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.RadiusClient.My.MySettings
|
||||
Get
|
||||
Return Global.RadiusClient.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
7
RadiusClient/RadiusClient/My Project/Settings.settings
Normal file
7
RadiusClient/RadiusClient/My Project/Settings.settings
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
111
RadiusClient/RadiusClient/RadiusClient.vbproj
Normal file
111
RadiusClient/RadiusClient/RadiusClient.vbproj
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>
|
||||
</SchemaVersion>
|
||||
<ProjectGuid>{46907543-4F8C-4757-8C85-0B2EAD7EFF29}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>RadiusClient</RootNamespace>
|
||||
<AssemblyName>RadiusClient</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>RadiusClient.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>RadiusClient.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Radius_Attributes.vb" />
|
||||
<Compile Include="Radius_Client.vb" />
|
||||
<Compile Include="Radius_ClientCrypto.vb" />
|
||||
<Compile Include="Radius_ClientUtils.vb" />
|
||||
<Compile Include="Radius_Conversions.vb" />
|
||||
<Compile Include="Radius_Packet.vb" />
|
||||
<Compile Include="Radius_VendorSpefic.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
3
RadiusClient/RadiusClient/RadiusClient.vbproj.user
Normal file
3
RadiusClient/RadiusClient/RadiusClient.vbproj.user
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
256
RadiusClient/RadiusClient/Radius_Attributes.vb
Normal file
256
RadiusClient/RadiusClient/Radius_Attributes.vb
Normal file
|
@ -0,0 +1,256 @@
|
|||
|
||||
|
||||
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
|
126
RadiusClient/RadiusClient/Radius_Client.vb
Normal file
126
RadiusClient/RadiusClient/Radius_Client.vb
Normal file
|
@ -0,0 +1,126 @@
|
|||
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
|
||||
|
||||
|
||||
|
77
RadiusClient/RadiusClient/Radius_ClientCrypto.vb
Normal file
77
RadiusClient/RadiusClient/Radius_ClientCrypto.vb
Normal file
|
@ -0,0 +1,77 @@
|
|||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
49
RadiusClient/RadiusClient/Radius_ClientUtils.vb
Normal file
49
RadiusClient/RadiusClient/Radius_ClientUtils.vb
Normal file
|
@ -0,0 +1,49 @@
|
|||
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
|
||||
|
||||
|
||||
|
||||
|
56
RadiusClient/RadiusClient/Radius_Conversions.vb
Normal file
56
RadiusClient/RadiusClient/Radius_Conversions.vb
Normal file
|
@ -0,0 +1,56 @@
|
|||
|
||||
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
|
||||
|
134
RadiusClient/RadiusClient/Radius_Packet.vb
Normal file
134
RadiusClient/RadiusClient/Radius_Packet.vb
Normal file
|
@ -0,0 +1,134 @@
|
|||
|
||||
|
||||
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
|
120
RadiusClient/RadiusClient/Radius_VendorSpefic.vb
Normal file
120
RadiusClient/RadiusClient/Radius_VendorSpefic.vb
Normal file
|
@ -0,0 +1,120 @@
|
|||
|
||||
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
|
BIN
RadiusClient/RadiusClient/bin/Debug/RadiusClient.dll
Normal file
BIN
RadiusClient/RadiusClient/bin/Debug/RadiusClient.dll
Normal file
Binary file not shown.
BIN
RadiusClient/RadiusClient/bin/Debug/RadiusClient.pdb
Normal file
BIN
RadiusClient/RadiusClient/bin/Debug/RadiusClient.pdb
Normal file
Binary file not shown.
24
RadiusClient/RadiusClient/bin/Debug/RadiusClient.xml
Normal file
24
RadiusClient/RadiusClient/bin/Debug/RadiusClient.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
RadiusClient
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:RadiusClient.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member><member name="P:RadiusClient.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member><member name="T:RadiusClient.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
24
RadiusClient/RadiusClient/bin/Debug/vsF77B.tmp
Normal file
24
RadiusClient/RadiusClient/bin/Debug/vsF77B.tmp
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
RadiusClient
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:RadiusClient.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member><member name="P:RadiusClient.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member><member name="T:RadiusClient.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Binary file not shown.
Binary file not shown.
BIN
RadiusClient/RadiusClient/obj/Debug/RadiusClient.dll
Normal file
BIN
RadiusClient/RadiusClient/obj/Debug/RadiusClient.dll
Normal file
Binary file not shown.
BIN
RadiusClient/RadiusClient/obj/Debug/RadiusClient.pdb
Normal file
BIN
RadiusClient/RadiusClient/obj/Debug/RadiusClient.pdb
Normal file
Binary file not shown.
|
@ -0,0 +1,10 @@
|
|||
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
|
24
RadiusClient/RadiusClient/obj/Debug/RadiusClient.xml
Normal file
24
RadiusClient/RadiusClient/obj/Debug/RadiusClient.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
RadiusClient
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:RadiusClient.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member><member name="P:RadiusClient.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member><member name="T:RadiusClient.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
BIN
RadiusClient/RadiusClient/obj/Debug/ResGen.read.1.tlog
Normal file
BIN
RadiusClient/RadiusClient/obj/Debug/ResGen.read.1.tlog
Normal file
Binary file not shown.
BIN
RadiusClient/RadiusClient/obj/Debug/ResGen.write.1.tlog
Normal file
BIN
RadiusClient/RadiusClient/obj/Debug/ResGen.write.1.tlog
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue