mirror of
https://github.com/jakobadam/RDSFactor.git
synced 2025-06-19 19:00:39 +02:00
Imported Claus Isager's CICRadarR
This commit is contained in:
commit
249ae5818b
156 changed files with 10807 additions and 0 deletions
20
CICRadarR.sln
Normal file
20
CICRadarR.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}") = "CICRadarR", "CICRadarR\CICRadarR.vbproj", "{04C6C533-9FEA-41B2-B554-A166C7C7FE32}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{04C6C533-9FEA-41B2-B554-A166C7C7FE32}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{04C6C533-9FEA-41B2-B554-A166C7C7FE32}.Debug|x86.Build.0 = Debug|x86
|
||||
{04C6C533-9FEA-41B2-B554-A166C7C7FE32}.Release|x86.ActiveCfg = Release|x86
|
||||
{04C6C533-9FEA-41B2-B554-A166C7C7FE32}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
CICRadarR.suo
Normal file
BIN
CICRadarR.suo
Normal file
Binary file not shown.
60
CICRadarR/CICRadarR.Designer.vb
generated
Normal file
60
CICRadarR/CICRadarR.Designer.vb
generated
Normal file
|
@ -0,0 +1,60 @@
|
|||
Imports System.ServiceProcess
|
||||
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class CICRadarR
|
||||
Inherits System.ServiceProcess.ServiceBase
|
||||
|
||||
'UserService overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
' The main entry point for the process
|
||||
<MTAThread()> _
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Shared Sub Main()
|
||||
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
|
||||
|
||||
' More than one NT Service may run within the same process. To add
|
||||
' another service to this process, change the following line to
|
||||
' create a second service object. For example,
|
||||
'
|
||||
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
|
||||
'
|
||||
ServicesToRun = New System.ServiceProcess.ServiceBase() {New CICRadarR}
|
||||
|
||||
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
|
||||
End Sub
|
||||
|
||||
'Required by the Component Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
' NOTE: The following procedure is required by the Component Designer
|
||||
' It can be modified using the Component Designer.
|
||||
' Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.TimerCleanUpHash = New System.Timers.Timer()
|
||||
CType(Me.TimerCleanUpHash, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
'
|
||||
'TimerCleanUpHash
|
||||
'
|
||||
Me.TimerCleanUpHash.Enabled = True
|
||||
Me.TimerCleanUpHash.Interval = 60000.0R
|
||||
'
|
||||
'CICRadarR
|
||||
'
|
||||
Me.ServiceName = "Service1"
|
||||
CType(Me.TimerCleanUpHash, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
|
||||
End Sub
|
||||
Friend WithEvents TimerCleanUpHash As System.Timers.Timer
|
||||
|
||||
End Class
|
126
CICRadarR/CICRadarR.resx
Normal file
126
CICRadarR/CICRadarR.resx
Normal file
|
@ -0,0 +1,126 @@
|
|||
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<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" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="TimerCleanUpHash.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
BIN
CICRadarR/CICRadarR.suo
Normal file
BIN
CICRadarR/CICRadarR.suo
Normal file
Binary file not shown.
1174
CICRadarR/CICRadarR.vb
Normal file
1174
CICRadarR/CICRadarR.vb
Normal file
File diff suppressed because it is too large
Load diff
162
CICRadarR/CICRadarR.vbproj
Normal file
162
CICRadarR/CICRadarR.vbproj
Normal file
|
@ -0,0 +1,162 @@
|
|||
<?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)' == '' ">x86</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>
|
||||
</SchemaVersion>
|
||||
<ProjectGuid>{04C6C533-9FEA-41B2-B554-A166C7C7FE32}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>CICRadarR.CICRadarR</StartupObject>
|
||||
<RootNamespace>CICRadarR</RootNamespace>
|
||||
<AssemblyName>CICRadarR</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Console</MyType>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>CICRadarR.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>CICRadarR.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>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Conversion.vb" />
|
||||
<Compile Include="VendorSpefic.vb" />
|
||||
<Compile Include="Crypto.vb" />
|
||||
<Compile Include="IniFileVb.vb" />
|
||||
<Compile Include="Log.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CICRadarR.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CICRadarR.Designer.vb">
|
||||
<DependentUpon>CICRadarR.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<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="NASAuthList.vb" />
|
||||
<Compile Include="ProjectInstaller.Designer.vb">
|
||||
<DependentUpon>ProjectInstaller.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProjectInstaller.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RADIUSAttributes.vb" />
|
||||
<Compile Include="RADIUSPacket.vb" />
|
||||
<Compile Include="RADIUSServer.vb" />
|
||||
<Compile Include="SmsClass.vb" />
|
||||
<Compile Include="TestService.Designer.vb">
|
||||
<DependentUpon>TestService.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TestService.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UDPServer.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="CICRadarR.resx">
|
||||
<DependentUpon>CICRadarR.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ProjectInstaller.resx">
|
||||
<DependentUpon>ProjectInstaller.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="TestService.resx">
|
||||
<DependentUpon>TestService.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\app.manifest" />
|
||||
<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
CICRadarR/CICRadarR.vbproj.user
Normal file
3
CICRadarR/CICRadarR.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>
|
56
CICRadarR/Conversion.vb
Normal file
56
CICRadarR/Conversion.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
|
344
CICRadarR/Crypto.vb
Normal file
344
CICRadarR/Crypto.vb
Normal file
|
@ -0,0 +1,344 @@
|
|||
Imports System
|
||||
Imports System.IO
|
||||
Imports System.Security.Cryptography
|
||||
|
||||
'
|
||||
' encrypt/decrypt functions
|
||||
' Parameter checks and error handling
|
||||
' are ommited for better readability
|
||||
'
|
||||
|
||||
Public Class EncDec
|
||||
' Encrypt a byte array into a byte array using a key and an IV
|
||||
Public Shared Function Encrypt(ByVal clearData As Byte(), ByVal Key As Byte(), ByVal IV As Byte()) As Byte()
|
||||
' Create a MemoryStream to accept the encrypted bytes
|
||||
Dim ms As New MemoryStream()
|
||||
|
||||
' Create a symmetric algorithm.
|
||||
' We are going to use Rijndael because it is strong and
|
||||
' available on all platforms.
|
||||
' You can use other algorithms, to do so substitute the
|
||||
' next line with something like
|
||||
' TripleDES alg = TripleDES.Create();
|
||||
Dim alg As Rijndael = Rijndael.Create()
|
||||
|
||||
' Now set the key and the IV.
|
||||
' We need the IV (Initialization Vector) because
|
||||
' the algorithm is operating in its default
|
||||
' mode called CBC (Cipher Block Chaining).
|
||||
' The IV is XORed with the first block (8 byte)
|
||||
' of the data before it is encrypted, and then each
|
||||
' encrypted block is XORed with the
|
||||
' following block of plaintext.
|
||||
' This is done to make encryption more secure.
|
||||
|
||||
' There is also a mode called ECB which does not need an IV,
|
||||
' but it is much less secure.
|
||||
alg.Key = Key
|
||||
alg.IV = IV
|
||||
|
||||
' Create a CryptoStream through which we are going to be
|
||||
' pumping our data.
|
||||
' CryptoStreamMode.Write means that we are going to be
|
||||
' writing data to the stream and the output will be written
|
||||
' in the MemoryStream we have provided.
|
||||
Dim cs As New CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write)
|
||||
|
||||
' Write the data and make it do the encryption
|
||||
cs.Write(clearData, 0, clearData.Length)
|
||||
|
||||
' Close the crypto stream (or do FlushFinalBlock).
|
||||
' This will tell it that we have done our encryption and
|
||||
' there is no more data coming in,
|
||||
' and it is now a good time to apply the padding and
|
||||
' finalize the encryption process.
|
||||
cs.Close()
|
||||
|
||||
' Now get the encrypted data from the MemoryStream.
|
||||
' Some people make a mistake of using GetBuffer() here,
|
||||
' which is not the right way.
|
||||
Dim encryptedData As Byte() = ms.ToArray()
|
||||
|
||||
Return encryptedData
|
||||
End Function
|
||||
|
||||
' Encrypt a string into a string using a password
|
||||
' Uses Encrypt(byte[], byte[], byte[])
|
||||
|
||||
Public Shared Function Encrypt(ByVal clearText As String, ByVal Password As String) As String
|
||||
' First we need to turn the input string into a byte array.
|
||||
Dim clearBytes As Byte() = System.Text.Encoding.Unicode.GetBytes(clearText)
|
||||
|
||||
' Then, we need to turn the password into Key and IV
|
||||
' We are using salt to make it harder to guess our key
|
||||
' using a dictionary attack -
|
||||
' trying to guess a password by enumerating all possible words.
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
' Now get the key/IV and do the encryption using the
|
||||
' function that accepts byte arrays.
|
||||
' Using PasswordDeriveBytes object we are first getting
|
||||
' 32 bytes for the Key
|
||||
' (the default Rijndael key length is 256bit = 32bytes)
|
||||
' and then 16 bytes for the IV.
|
||||
' IV should always be the block size, which is by default
|
||||
' 16 bytes (128 bit) for Rijndael.
|
||||
' If you are using DES/TripleDES/RC2 the block size is
|
||||
' 8 bytes and so should be the IV size.
|
||||
' You can also read KeySize/BlockSize properties off
|
||||
' the algorithm to find out the sizes.
|
||||
Dim encryptedData As Byte() = Encrypt(clearBytes, pdb.GetBytes(32), pdb.GetBytes(16))
|
||||
|
||||
' Now we need to turn the resulting byte array into a string.
|
||||
' A common mistake would be to use an Encoding class for that.
|
||||
'It does not work because not all byte values can be
|
||||
' represented by characters.
|
||||
' We are going to be using Base64 encoding that is designed
|
||||
'exactly for what we are trying to do.
|
||||
Return Convert.ToBase64String(encryptedData)
|
||||
|
||||
End Function
|
||||
|
||||
' Encrypt bytes into bytes using a password
|
||||
' Uses Encrypt(byte[], byte[], byte[])
|
||||
|
||||
Public Shared Function Encrypt(ByVal clearData As Byte(), ByVal Password As String) As Byte()
|
||||
' We need to turn the password into Key and IV.
|
||||
' We are using salt to make it harder to guess our key
|
||||
' using a dictionary attack -
|
||||
' trying to guess a password by enumerating all possible words.
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
' Now get the key/IV and do the encryption using the function
|
||||
' that accepts byte arrays.
|
||||
' Using PasswordDeriveBytes object we are first getting
|
||||
' 32 bytes for the Key
|
||||
' (the default Rijndael key length is 256bit = 32bytes)
|
||||
' and then 16 bytes for the IV.
|
||||
' IV should always be the block size, which is by default
|
||||
' 16 bytes (128 bit) for Rijndael.
|
||||
' If you are using DES/TripleDES/RC2 the block size is 8
|
||||
' bytes and so should be the IV size.
|
||||
' You can also read KeySize/BlockSize properties off the
|
||||
' algorithm to find out the sizes.
|
||||
Return Encrypt(clearData, pdb.GetBytes(32), pdb.GetBytes(16))
|
||||
|
||||
End Function
|
||||
|
||||
' Encrypt a file into another file using a password
|
||||
Public Shared Sub Encrypt(ByVal fileIn As String, ByVal fileOut As String, ByVal Password As String)
|
||||
|
||||
' First we are going to open the file streams
|
||||
Dim fsIn As New FileStream(fileIn, FileMode.Open, FileAccess.Read)
|
||||
Dim fsOut As New FileStream(fileOut, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
|
||||
' Then we are going to derive a Key and an IV from the
|
||||
' Password and create an algorithm
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
Dim alg As Rijndael = Rijndael.Create()
|
||||
alg.Key = pdb.GetBytes(32)
|
||||
alg.IV = pdb.GetBytes(16)
|
||||
|
||||
' Now create a crypto stream through which we are going
|
||||
' to be pumping data.
|
||||
' Our fileOut is going to be receiving the encrypted bytes.
|
||||
Dim cs As New CryptoStream(fsOut, alg.CreateEncryptor(), CryptoStreamMode.Write)
|
||||
|
||||
' Now will will initialize a buffer and will be processing
|
||||
' the input file in chunks.
|
||||
' This is done to avoid reading the whole file (which can
|
||||
' be huge) into memory.
|
||||
Dim bufferLen As Integer = 4096
|
||||
Dim buffer As Byte() = New Byte(bufferLen - 1) {}
|
||||
Dim bytesRead As Integer
|
||||
|
||||
Do
|
||||
' read a chunk of data from the input file
|
||||
bytesRead = fsIn.Read(buffer, 0, bufferLen)
|
||||
|
||||
' encrypt it
|
||||
cs.Write(buffer, 0, bytesRead)
|
||||
Loop While bytesRead <> 0
|
||||
|
||||
' close everything
|
||||
|
||||
' this will also close the unrelying fsOut stream
|
||||
cs.Close()
|
||||
fsIn.Close()
|
||||
End Sub
|
||||
|
||||
' Decrypt a byte array into a byte array using a key and an IV
|
||||
Public Shared Function Decrypt(ByVal cipherData As Byte(), ByVal Key As Byte(), ByVal IV As Byte()) As Byte()
|
||||
' Create a MemoryStream that is going to accept the
|
||||
' decrypted bytes
|
||||
Dim ms As New MemoryStream()
|
||||
|
||||
' Create a symmetric algorithm.
|
||||
' We are going to use Rijndael because it is strong and
|
||||
' available on all platforms.
|
||||
' You can use other algorithms, to do so substitute the next
|
||||
' line with something like
|
||||
' TripleDES alg = TripleDES.Create();
|
||||
Dim alg As Rijndael = Rijndael.Create()
|
||||
|
||||
' Now set the key and the IV.
|
||||
' We need the IV (Initialization Vector) because the algorithm
|
||||
' is operating in its default
|
||||
' mode called CBC (Cipher Block Chaining). The IV is XORed with
|
||||
' the first block (8 byte)
|
||||
' of the data after it is decrypted, and then each decrypted
|
||||
' block is XORed with the previous
|
||||
' cipher block. This is done to make encryption more secure.
|
||||
' There is also a mode called ECB which does not need an IV,
|
||||
' but it is much less secure.
|
||||
alg.Key = Key
|
||||
alg.IV = IV
|
||||
|
||||
' Create a CryptoStream through which we are going to be
|
||||
' pumping our data.
|
||||
' CryptoStreamMode.Write means that we are going to be
|
||||
' writing data to the stream
|
||||
' and the output will be written in the MemoryStream
|
||||
' we have provided.
|
||||
Dim cs As New CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write)
|
||||
|
||||
' Write the data and make it do the decryption
|
||||
cs.Write(cipherData, 0, cipherData.Length)
|
||||
|
||||
' Close the crypto stream (or do FlushFinalBlock).
|
||||
' This will tell it that we have done our decryption
|
||||
' and there is no more data coming in,
|
||||
' and it is now a good time to remove the padding
|
||||
' and finalize the decryption process.
|
||||
cs.Close()
|
||||
|
||||
' Now get the decrypted data from the MemoryStream.
|
||||
' Some people make a mistake of using GetBuffer() here,
|
||||
' which is not the right way.
|
||||
Dim decryptedData As Byte() = ms.ToArray()
|
||||
|
||||
Return decryptedData
|
||||
End Function
|
||||
|
||||
' Decrypt a string into a string using a password
|
||||
' Uses Decrypt(byte[], byte[], byte[])
|
||||
|
||||
Public Shared Function Decrypt(ByVal cipherText As String, ByVal Password As String) As String
|
||||
' First we need to turn the input string into a byte array.
|
||||
' We presume that Base64 encoding was used
|
||||
Dim cipherBytes As Byte() = Convert.FromBase64String(cipherText)
|
||||
|
||||
' Then, we need to turn the password into Key and IV
|
||||
' We are using salt to make it harder to guess our key
|
||||
' using a dictionary attack -
|
||||
' trying to guess a password by enumerating all possible words.
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
' Now get the key/IV and do the decryption using
|
||||
' the function that accepts byte arrays.
|
||||
' Using PasswordDeriveBytes object we are first
|
||||
' getting 32 bytes for the Key
|
||||
' (the default Rijndael key length is 256bit = 32bytes)
|
||||
' and then 16 bytes for the IV.
|
||||
' IV should always be the block size, which is by
|
||||
' default 16 bytes (128 bit) for Rijndael.
|
||||
' If you are using DES/TripleDES/RC2 the block size is
|
||||
' 8 bytes and so should be the IV size.
|
||||
' You can also read KeySize/BlockSize properties off
|
||||
' the algorithm to find out the sizes.
|
||||
Dim decryptedData As Byte() = Decrypt(cipherBytes, pdb.GetBytes(32), pdb.GetBytes(16))
|
||||
|
||||
' Now we need to turn the resulting byte array into a string.
|
||||
' A common mistake would be to use an Encoding class for that.
|
||||
' It does not work
|
||||
' because not all byte values can be represented by characters.
|
||||
' We are going to be using Base64 encoding that is
|
||||
' designed exactly for what we are trying to do.
|
||||
Return System.Text.Encoding.Unicode.GetString(decryptedData)
|
||||
End Function
|
||||
|
||||
' Decrypt bytes into bytes using a password
|
||||
' Uses Decrypt(byte[], byte[], byte[])
|
||||
|
||||
Public Shared Function Decrypt(ByVal cipherData As Byte(), ByVal Password As String) As Byte()
|
||||
' We need to turn the password into Key and IV.
|
||||
' We are using salt to make it harder to guess our key
|
||||
' using a dictionary attack -
|
||||
' trying to guess a password by enumerating all possible words.
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
' Now get the key/IV and do the Decryption using the
|
||||
'function that accepts byte arrays.
|
||||
' Using PasswordDeriveBytes object we are first getting
|
||||
' 32 bytes for the Key
|
||||
' (the default Rijndael key length is 256bit = 32bytes)
|
||||
' and then 16 bytes for the IV.
|
||||
' IV should always be the block size, which is by default
|
||||
' 16 bytes (128 bit) for Rijndael.
|
||||
' If you are using DES/TripleDES/RC2 the block size is
|
||||
' 8 bytes and so should be the IV size.
|
||||
|
||||
' You can also read KeySize/BlockSize properties off the
|
||||
' algorithm to find out the sizes.
|
||||
Return Decrypt(cipherData, pdb.GetBytes(32), pdb.GetBytes(16))
|
||||
End Function
|
||||
|
||||
' Decrypt a file into another file using a password
|
||||
Public Shared Sub Decrypt(ByVal fileIn As String, ByVal fileOut As String, ByVal Password As String)
|
||||
|
||||
' First we are going to open the file streams
|
||||
Dim fsIn As New FileStream(fileIn, FileMode.Open, FileAccess.Read)
|
||||
Dim fsOut As New FileStream(fileOut, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
|
||||
' Then we are going to derive a Key and an IV from
|
||||
' the Password and create an algorithm
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
Dim alg As Rijndael = Rijndael.Create()
|
||||
|
||||
alg.Key = pdb.GetBytes(32)
|
||||
alg.IV = pdb.GetBytes(16)
|
||||
|
||||
' Now create a crypto stream through which we are going
|
||||
' to be pumping data.
|
||||
' Our fileOut is going to be receiving the Decrypted bytes.
|
||||
Dim cs As New CryptoStream(fsOut, alg.CreateDecryptor(), CryptoStreamMode.Write)
|
||||
|
||||
' Now will will initialize a buffer and will be
|
||||
' processing the input file in chunks.
|
||||
' This is done to avoid reading the whole file (which can be
|
||||
' huge) into memory.
|
||||
Dim bufferLen As Integer = 4096
|
||||
Dim buffer As Byte() = New Byte(bufferLen - 1) {}
|
||||
Dim bytesRead As Integer
|
||||
|
||||
Do
|
||||
' read a chunk of data from the input file
|
||||
bytesRead = fsIn.Read(buffer, 0, bufferLen)
|
||||
|
||||
' Decrypt it
|
||||
|
||||
cs.Write(buffer, 0, bytesRead)
|
||||
Loop While bytesRead <> 0
|
||||
|
||||
' close everything
|
||||
cs.Close()
|
||||
' this will also close the unrelying fsOut stream
|
||||
fsIn.Close()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
|
376
CICRadarR/IniFileVb.vb
Normal file
376
CICRadarR/IniFileVb.vb
Normal file
|
@ -0,0 +1,376 @@
|
|||
' Programmer: Ludvik Jerabek
|
||||
' Date: 08\23\2010
|
||||
' Purpose: Allow INI manipulation in .NET
|
||||
|
||||
Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Collections
|
||||
Imports System.Diagnostics
|
||||
|
||||
' IniFile class used to read and write ini files by loading the file into memory
|
||||
Public Class IniFile
|
||||
' List of IniSection objects keeps track of all the sections in the INI file
|
||||
Private m_sections As Hashtable
|
||||
|
||||
' Public constructor
|
||||
Public Sub New()
|
||||
m_sections = New Hashtable(StringComparer.InvariantCultureIgnoreCase)
|
||||
End Sub
|
||||
|
||||
' Loads the Reads the data in the ini file into the IniFile object
|
||||
Public Sub Load(ByVal sFileName As String, Optional ByVal bMerge As Boolean = False)
|
||||
If Not bMerge Then
|
||||
RemoveAllSections()
|
||||
End If
|
||||
' Clear the object...
|
||||
Dim tempsection As IniSection = Nothing
|
||||
Dim oReader As New StreamReader(sFileName)
|
||||
Dim regexcomment As New Regex("^([\s]*#.*)", (RegexOptions.Singleline Or RegexOptions.IgnoreCase))
|
||||
' Broken but left for history
|
||||
'Dim regexsection As New Regex("\[[\s]*([^\[\s].*[^\s\]])[\s]*\]", (RegexOptions.Singleline Or RegexOptions.IgnoreCase))
|
||||
Dim regexsection As New Regex("^[\s]*\[[\s]*([^\[\s].*[^\s\]])[\s]*\][\s]*$", (RegexOptions.Singleline Or RegexOptions.IgnoreCase))
|
||||
Dim regexkey As New Regex("^\s*([^=\s]*)[^=]*=(.*)", (RegexOptions.Singleline Or RegexOptions.IgnoreCase))
|
||||
While Not oReader.EndOfStream
|
||||
Dim line As String = oReader.ReadLine()
|
||||
If line <> String.Empty Then
|
||||
Dim m As Match = Nothing
|
||||
If regexcomment.Match(line).Success Then
|
||||
m = regexcomment.Match(line)
|
||||
Trace.WriteLine(String.Format("Skipping Comment: {0}", m.Groups(0).Value))
|
||||
ElseIf regexsection.Match(line).Success Then
|
||||
m = regexsection.Match(line)
|
||||
Trace.WriteLine(String.Format("Adding section [{0}]", m.Groups(1).Value))
|
||||
tempsection = AddSection(m.Groups(1).Value)
|
||||
ElseIf regexkey.Match(line).Success AndAlso tempsection IsNot Nothing Then
|
||||
m = regexkey.Match(line)
|
||||
Trace.WriteLine(String.Format("Adding Key [{0}]=[{1}]", m.Groups(1).Value, m.Groups(2).Value))
|
||||
tempsection.AddKey(m.Groups(1).Value).Value = m.Groups(2).Value
|
||||
ElseIf tempsection IsNot Nothing Then
|
||||
' Handle Key without value
|
||||
Trace.WriteLine(String.Format("Adding Key [{0}]", line))
|
||||
tempsection.AddKey(line)
|
||||
Else
|
||||
' This should not occur unless the tempsection is not created yet...
|
||||
Trace.WriteLine(String.Format("Skipping unknown type of data: {0}", line))
|
||||
End If
|
||||
End If
|
||||
End While
|
||||
oReader.Close()
|
||||
End Sub
|
||||
|
||||
' Used to save the data back to the file or your choice
|
||||
Public Sub Save(ByVal sFileName As String)
|
||||
Dim oWriter As New StreamWriter(sFileName, False)
|
||||
For Each s As IniSection In Sections
|
||||
Trace.WriteLine(String.Format("Writing Section: [{0}]", s.Name))
|
||||
oWriter.WriteLine(String.Format("[{0}]", s.Name))
|
||||
For Each k As IniSection.IniKey In s.Keys
|
||||
If k.Value <> String.Empty Then
|
||||
Trace.WriteLine(String.Format("Writing Key: {0}={1}", k.Name, k.Value))
|
||||
oWriter.WriteLine(String.Format("{0}={1}", k.Name, k.Value))
|
||||
Else
|
||||
Trace.WriteLine(String.Format("Writing Key: {0}", k.Name))
|
||||
oWriter.WriteLine(String.Format("{0}", k.Name))
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
oWriter.Close()
|
||||
End Sub
|
||||
|
||||
' Gets all the sections
|
||||
Public ReadOnly Property Sections() As System.Collections.ICollection
|
||||
Get
|
||||
Return m_sections.Values
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Adds a section to the IniFile object, returns a IniSection object to the new or existing object
|
||||
Public Function AddSection(ByVal sSection As String) As IniSection
|
||||
Dim s As IniSection = Nothing
|
||||
sSection = sSection.Trim()
|
||||
' Trim spaces
|
||||
If m_sections.ContainsKey(sSection) Then
|
||||
s = DirectCast(m_sections(sSection), IniSection)
|
||||
Else
|
||||
s = New IniSection(Me, sSection)
|
||||
m_sections(sSection) = s
|
||||
End If
|
||||
Return s
|
||||
End Function
|
||||
|
||||
' Removes a section by its name sSection, returns trus on success
|
||||
Public Function RemoveSection(ByVal sSection As String) As Boolean
|
||||
sSection = sSection.Trim()
|
||||
Return RemoveSection(GetSection(sSection))
|
||||
End Function
|
||||
|
||||
' Removes section by object, returns trus on success
|
||||
Public Function RemoveSection(ByVal Section As IniSection) As Boolean
|
||||
If Section IsNot Nothing Then
|
||||
Try
|
||||
m_sections.Remove(Section.Name)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Trace.WriteLine(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Removes all existing sections, returns trus on success
|
||||
Public Function RemoveAllSections() As Boolean
|
||||
m_sections.Clear()
|
||||
Return (m_sections.Count = 0)
|
||||
End Function
|
||||
|
||||
' Returns an IniSection to the section by name, NULL if it was not found
|
||||
Public Function GetSection(ByVal sSection As String) As IniSection
|
||||
sSection = sSection.Trim()
|
||||
' Trim spaces
|
||||
If m_sections.ContainsKey(sSection) Then
|
||||
Return DirectCast(m_sections(sSection), IniSection)
|
||||
End If
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
' Returns a KeyValue in a certain section
|
||||
Public Function GetKeyValue(ByVal sSection As String, ByVal sKey As String) As String
|
||||
Dim s As IniSection = GetSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
Dim k As IniSection.IniKey = s.GetKey(sKey)
|
||||
If k IsNot Nothing Then
|
||||
Return k.Value
|
||||
End If
|
||||
End If
|
||||
Return String.Empty
|
||||
End Function
|
||||
|
||||
' Sets a KeyValuePair in a certain section
|
||||
Public Function SetKeyValue(ByVal sSection As String, ByVal sKey As String, ByVal sValue As String) As Boolean
|
||||
Dim s As IniSection = AddSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
Dim k As IniSection.IniKey = s.AddKey(sKey)
|
||||
If k IsNot Nothing Then
|
||||
k.Value = sValue
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Renames an existing section returns true on success, false if the section didn't exist or there was another section with the same sNewSection
|
||||
Public Function RenameSection(ByVal sSection As String, ByVal sNewSection As String) As Boolean
|
||||
' Note string trims are done in lower calls.
|
||||
Dim bRval As Boolean = False
|
||||
Dim s As IniSection = GetSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
bRval = s.SetName(sNewSection)
|
||||
End If
|
||||
Return bRval
|
||||
End Function
|
||||
|
||||
' Renames an existing key returns true on success, false if the key didn't exist or there was another section with the same sNewKey
|
||||
Public Function RenameKey(ByVal sSection As String, ByVal sKey As String, ByVal sNewKey As String) As Boolean
|
||||
' Note string trims are done in lower calls.
|
||||
Dim s As IniSection = GetSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
Dim k As IniSection.IniKey = s.GetKey(sKey)
|
||||
If k IsNot Nothing Then
|
||||
Return k.SetName(sNewKey)
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Remove a key by section name and key name
|
||||
Public Function RemoveKey(ByVal sSection As String, ByVal sKey As String) As Boolean
|
||||
Dim s As IniSection = GetSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
Return s.RemoveKey(sKey)
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' IniSection class
|
||||
Public Class IniSection
|
||||
' IniFile IniFile object instance
|
||||
Private m_pIniFile As IniFile
|
||||
' Name of the section
|
||||
Private m_sSection As String
|
||||
' List of IniKeys in the section
|
||||
Private m_keys As Hashtable
|
||||
|
||||
' Constuctor so objects are internally managed
|
||||
Protected Friend Sub New(ByVal parent As IniFile, ByVal sSection As String)
|
||||
m_pIniFile = parent
|
||||
m_sSection = sSection
|
||||
m_keys = New Hashtable(StringComparer.InvariantCultureIgnoreCase)
|
||||
End Sub
|
||||
|
||||
' Returns all the keys in a section
|
||||
Public ReadOnly Property Keys() As System.Collections.ICollection
|
||||
Get
|
||||
Return m_keys.Values
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Returns the section name
|
||||
Public ReadOnly Property Name() As String
|
||||
Get
|
||||
Return m_sSection
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Adds a key to the IniSection object, returns a IniKey object to the new or existing object
|
||||
Public Function AddKey(ByVal sKey As String) As IniKey
|
||||
sKey = sKey.Trim()
|
||||
Dim k As IniSection.IniKey = Nothing
|
||||
If sKey.Length <> 0 Then
|
||||
If m_keys.ContainsKey(sKey) Then
|
||||
k = DirectCast(m_keys(sKey), IniKey)
|
||||
Else
|
||||
k = New IniSection.IniKey(Me, sKey)
|
||||
m_keys(sKey) = k
|
||||
End If
|
||||
End If
|
||||
Return k
|
||||
End Function
|
||||
|
||||
' Removes a single key by string
|
||||
Public Function RemoveKey(ByVal sKey As String) As Boolean
|
||||
Return RemoveKey(GetKey(sKey))
|
||||
End Function
|
||||
|
||||
' Removes a single key by IniKey object
|
||||
Public Function RemoveKey(ByVal Key As IniKey) As Boolean
|
||||
If Key IsNot Nothing Then
|
||||
Try
|
||||
m_keys.Remove(Key.Name)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Trace.WriteLine(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Removes all the keys in the section
|
||||
Public Function RemoveAllKeys() As Boolean
|
||||
m_keys.Clear()
|
||||
Return (m_keys.Count = 0)
|
||||
End Function
|
||||
|
||||
' Returns a IniKey object to the key by name, NULL if it was not found
|
||||
Public Function GetKey(ByVal sKey As String) As IniKey
|
||||
sKey = sKey.Trim()
|
||||
If m_keys.ContainsKey(sKey) Then
|
||||
Return DirectCast(m_keys(sKey), IniKey)
|
||||
End If
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
' Sets the section name, returns true on success, fails if the section
|
||||
' name sSection already exists
|
||||
Public Function SetName(ByVal sSection As String) As Boolean
|
||||
sSection = sSection.Trim()
|
||||
If sSection.Length <> 0 Then
|
||||
' Get existing section if it even exists...
|
||||
Dim s As IniSection = m_pIniFile.GetSection(sSection)
|
||||
If s IsNot Me AndAlso s IsNot Nothing Then
|
||||
Return False
|
||||
End If
|
||||
Try
|
||||
' Remove the current section
|
||||
m_pIniFile.m_sections.Remove(m_sSection)
|
||||
' Set the new section name to this object
|
||||
m_pIniFile.m_sections(sSection) = Me
|
||||
' Set the new section name
|
||||
m_sSection = sSection
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Trace.WriteLine(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Returns the section name
|
||||
Public Function GetName() As String
|
||||
Return m_sSection
|
||||
End Function
|
||||
|
||||
' IniKey class
|
||||
Public Class IniKey
|
||||
' Name of the Key
|
||||
Private m_sKey As String
|
||||
' Value associated
|
||||
Private m_sValue As String
|
||||
' Pointer to the parent CIniSection
|
||||
Private m_section As IniSection
|
||||
|
||||
' Constuctor so objects are internally managed
|
||||
Protected Friend Sub New(ByVal parent As IniSection, ByVal sKey As String)
|
||||
m_section = parent
|
||||
m_sKey = sKey
|
||||
End Sub
|
||||
|
||||
' Returns the name of the Key
|
||||
Public ReadOnly Property Name() As String
|
||||
Get
|
||||
Return m_sKey
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Sets or Gets the value of the key
|
||||
Public Property Value() As String
|
||||
Get
|
||||
Return m_sValue
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
m_sValue = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Sets the value of the key
|
||||
Public Sub SetValue(ByVal sValue As String)
|
||||
m_sValue = sValue
|
||||
End Sub
|
||||
' Returns the value of the Key
|
||||
Public Function GetValue() As String
|
||||
Return m_sValue
|
||||
End Function
|
||||
|
||||
' Sets the key name
|
||||
' Returns true on success, fails if the section name sKey already exists
|
||||
Public Function SetName(ByVal sKey As String) As Boolean
|
||||
sKey = sKey.Trim()
|
||||
If sKey.Length <> 0 Then
|
||||
Dim k As IniKey = m_section.GetKey(sKey)
|
||||
If k IsNot Me AndAlso k IsNot Nothing Then
|
||||
Return False
|
||||
End If
|
||||
Try
|
||||
' Remove the current key
|
||||
m_section.m_keys.Remove(m_sKey)
|
||||
' Set the new key name to this object
|
||||
m_section.m_keys(sKey) = Me
|
||||
' Set the new key name
|
||||
m_sKey = sKey
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Trace.WriteLine(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Returns the name of the Key
|
||||
Public Function GetName() As String
|
||||
Return m_sKey
|
||||
End Function
|
||||
End Class
|
||||
' End of IniKey class
|
||||
End Class
|
||||
' End of IniSection class
|
||||
End Class
|
||||
' End of IniFile class
|
44
CICRadarR/Log.vb
Normal file
44
CICRadarR/Log.vb
Normal file
|
@ -0,0 +1,44 @@
|
|||
Imports System
|
||||
Imports System.IO
|
||||
Imports System.Data
|
||||
|
||||
Namespace LogFile
|
||||
Public Class LogWriter
|
||||
|
||||
|
||||
Public filePath As String
|
||||
Private fileStream As FileStream
|
||||
Private streamWriter As StreamWriter
|
||||
|
||||
Public Sub OpenFile()
|
||||
Try
|
||||
Dim strPath As String
|
||||
strPath = filePath
|
||||
If System.IO.File.Exists(strPath) Then
|
||||
fileStream = New FileStream(strPath, FileMode.Append, FileAccess.Write)
|
||||
Else
|
||||
fileStream = New FileStream(strPath, FileMode.Create, FileAccess.Write)
|
||||
End If
|
||||
streamWriter = New StreamWriter(fileStream)
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub WriteLog(ByVal strComments As String)
|
||||
Try
|
||||
OpenFile()
|
||||
streamWriter.WriteLine(strComments)
|
||||
CloseFile()
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub CloseFile()
|
||||
Try
|
||||
streamWriter.Close()
|
||||
fileStream.Close()
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
13
CICRadarR/My Project/Application.Designer.vb
generated
Normal file
13
CICRadarR/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.1008
|
||||
'
|
||||
' 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
CICRadarR/My Project/Application.myapp
Normal file
10
CICRadarR/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>true</MySubMain>
|
||||
<MainForm>TestService</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
35
CICRadarR/My Project/AssemblyInfo.vb
Normal file
35
CICRadarR/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("CICRadarR")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Microsoft")>
|
||||
<Assembly: AssemblyProduct("CICRadarR")>
|
||||
<Assembly: AssemblyCopyright("Copyright © Microsoft 2012")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("ce54c196-bc53-47c7-9e19-91495f15dcb6")>
|
||||
|
||||
' 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
CICRadarR/My Project/Resources.Designer.vb
generated
Normal file
63
CICRadarR/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.1008
|
||||
'
|
||||
' 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("CICRadarR.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
CICRadarR/My Project/Resources.resx
Normal file
117
CICRadarR/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
CICRadarR/My Project/Settings.Designer.vb
generated
Normal file
73
CICRadarR/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.1008
|
||||
'
|
||||
' 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.CICRadarR.My.MySettings
|
||||
Get
|
||||
Return Global.CICRadarR.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
7
CICRadarR/My Project/Settings.settings
Normal file
7
CICRadarR/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>
|
48
CICRadarR/My Project/app.manifest
Normal file
48
CICRadarR/My Project/app.manifest
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel node will disable file and registry virtualization.
|
||||
If you want to utilize File and Registry Virtualization for backward
|
||||
compatibility then delete the requestedExecutionLevel node.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
|
||||
|
||||
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!-- <dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>-->
|
||||
|
||||
</asmv1:assembly>
|
17
CICRadarR/NASAuthList.vb
Normal file
17
CICRadarR/NASAuthList.vb
Normal file
|
@ -0,0 +1,17 @@
|
|||
Public Class NASAuthList
|
||||
Inherits System.Collections.Generic.Dictionary(Of String, String)
|
||||
|
||||
Public Sub AddSharedSecret(ByVal nasIP As String, ByVal secret As String)
|
||||
If MyBase.ContainsKey(nasIP) Then
|
||||
MyBase.Item(nasIP) = secret
|
||||
Else
|
||||
MyBase.Add(nasIP, secret)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function GetSharedSecret(ByVal nasIP As String) As String
|
||||
Dim res As String = ""
|
||||
MyBase.TryGetValue(nasIP, res)
|
||||
Return res
|
||||
End Function
|
||||
End Class
|
48
CICRadarR/ProjectInstaller.Designer.vb
generated
Normal file
48
CICRadarR/ProjectInstaller.Designer.vb
generated
Normal file
|
@ -0,0 +1,48 @@
|
|||
<System.ComponentModel.RunInstaller(True)> Partial Class ProjectInstaller
|
||||
Inherits System.Configuration.Install.Installer
|
||||
|
||||
'Installer overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Required by the Component Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Component Designer
|
||||
'It can be modified using the Component Designer.
|
||||
'Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.ServiceProcessInstaller1 = New System.ServiceProcess.ServiceProcessInstaller()
|
||||
Me.ServiceInstaller1 = New System.ServiceProcess.ServiceInstaller()
|
||||
'
|
||||
'ServiceProcessInstaller1
|
||||
'
|
||||
Me.ServiceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem
|
||||
Me.ServiceProcessInstaller1.Password = Nothing
|
||||
Me.ServiceProcessInstaller1.Username = Nothing
|
||||
'
|
||||
'ServiceInstaller1
|
||||
'
|
||||
Me.ServiceInstaller1.Description = "Radius Server for SMS Token"
|
||||
Me.ServiceInstaller1.DisplayName = "CIC Radius Server"
|
||||
Me.ServiceInstaller1.ServiceName = "CICRadiusR"
|
||||
Me.ServiceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic
|
||||
'
|
||||
'ProjectInstaller
|
||||
'
|
||||
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller1, Me.ServiceInstaller1})
|
||||
|
||||
End Sub
|
||||
Friend WithEvents ServiceProcessInstaller1 As System.ServiceProcess.ServiceProcessInstaller
|
||||
Friend WithEvents ServiceInstaller1 As System.ServiceProcess.ServiceInstaller
|
||||
|
||||
End Class
|
129
CICRadarR/ProjectInstaller.resx
Normal file
129
CICRadarR/ProjectInstaller.resx
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<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" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ServiceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="ServiceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>188, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
16
CICRadarR/ProjectInstaller.vb
Normal file
16
CICRadarR/ProjectInstaller.vb
Normal file
|
@ -0,0 +1,16 @@
|
|||
Imports System.ComponentModel
|
||||
Imports System.Configuration.Install
|
||||
|
||||
Public Class ProjectInstaller
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
|
||||
'This call is required by the Component Designer.
|
||||
InitializeComponent()
|
||||
|
||||
'Add initialization code after the call to InitializeComponent
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
312
CICRadarR/RADIUSAttributes.vb
Normal file
312
CICRadarR/RADIUSAttributes.vb
Normal file
|
@ -0,0 +1,312 @@
|
|||
Imports Microsoft.VisualBasic.Conversion
|
||||
Imports CICRadarR.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
|
||||
|
||||
'Public Function GetAllVSAs() As RADIUSAttributes
|
||||
' Dim ret As New RADIUSAttributes
|
||||
' Dim atr As RADIUSAttribute
|
||||
' For Each atr In Me
|
||||
' If atr.Type = RadiusAttributeType.VendorSpecific Then ret.Add(atr)
|
||||
' Next
|
||||
' Return ret
|
||||
'End Function
|
||||
|
||||
'Public Function GetAllCiscoAVPairs() As RADIUSAttributes
|
||||
' Dim ret As New RADIUSAttributes
|
||||
' Dim atr As RADIUSAttribute
|
||||
' For Each atr In Me
|
||||
' If atr.GetCiscoAVPair IsNot Nothing Then ret.Add(atr)
|
||||
' Next
|
||||
' Return ret
|
||||
'End Function
|
||||
|
||||
'Public Function GetFirstCiscoAVPair(ByVal type As CiscoAVPairType) As CiscoAVPair
|
||||
' Dim atr As RADIUSAttribute
|
||||
' Dim avpair As CiscoAVPair
|
||||
' For Each atr In Me
|
||||
' If atr.Type = RadiusAttributeType.VendorSpecific Then
|
||||
' avpair = atr.GetCiscoAVPair
|
||||
' If avpair IsNot Nothing Then
|
||||
' If avpair.VendorType = type Then Return avpair
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
' Return Nothing
|
||||
'End Function
|
||||
|
||||
'Public Function GetFirstCiscoAVPair(ByVal name As String) As CiscoAVPair
|
||||
' Dim atr As RADIUSAttribute
|
||||
' Dim avpair As CiscoAVPair
|
||||
' For Each atr In Me
|
||||
' If atr.Type = RadiusAttributeType.VendorSpecific Then
|
||||
' avpair = atr.GetCiscoAVPair
|
||||
' If avpair IsNot Nothing Then
|
||||
' If avpair.VendorName = name Then Return avpair
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
' Return Nothing
|
||||
'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 = 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 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
|
||||
|
||||
Public Function GetVendorSpecific() As VendorSpecificAttribute
|
||||
Return New VendorSpecificAttribute(mValue)
|
||||
End Function
|
||||
|
||||
'Public Function GetCiscoAVPair() As CiscoAVPair
|
||||
' Return New CiscoAVPair(mValue)
|
||||
'End Function
|
||||
|
||||
'Public Function GetVendorSpecific() As CiscoAVPair
|
||||
' Return New CiscoAVPair(mValue)
|
||||
'End Function
|
||||
|
||||
'Public Function CiscoAVPairTypeLookahead() As CiscoAVPairType
|
||||
' If mLength < 8 Then Return CiscoAVPairType.Invalid
|
||||
' If mValue(3) <> 9 Then Return CiscoAVPairType.Invalid
|
||||
' If mValue(2) <> 0 Then Return CiscoAVPairType.Invalid
|
||||
' If mValue(1) <> 0 Then Return CiscoAVPairType.Invalid
|
||||
' If mValue(0) <> 0 Then Return CiscoAVPairType.Invalid
|
||||
' Return mValue(4)
|
||||
'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
|
249
CICRadarR/RADIUSPacket.vb
Normal file
249
CICRadarR/RADIUSPacket.vb
Normal file
|
@ -0,0 +1,249 @@
|
|||
Imports System.Net
|
||||
Imports System.Security.Cryptography
|
||||
Imports CICRadarR.Conversion
|
||||
|
||||
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
|
||||
Private mServer As RADIUSServer
|
||||
|
||||
Friend Sub New(ByRef data() As Byte, ByVal endPoint As IPEndPoint, ByRef server As RADIUSServer)
|
||||
'Check validity ...
|
||||
mIsValid = mAttributes.LoadAttributes(data)
|
||||
If mIsValid Then
|
||||
mCode = data(0)
|
||||
mIdentifier = data(1)
|
||||
Array.Copy(data, 4, mAuthenticator, 0, 16)
|
||||
mEndPoint = endPoint
|
||||
mServer = server
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub New(ByVal code As RadiusPacketCode, ByVal identifier As Byte, ByVal attributes As RADIUSAttributes, ByVal endPoint As IPEndPoint)
|
||||
mCode = code
|
||||
mIdentifier = identifier
|
||||
If attributes Is Nothing Then
|
||||
mAttributes = New RADIUSAttributes
|
||||
Else
|
||||
mAttributes = attributes
|
||||
End If
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
''' Returns the username supplied in an Access Request. Returns
|
||||
''' Nothing if a User-Name attribute is missing or the packet is not an
|
||||
''' Access Request.
|
||||
''' </summary>
|
||||
''' <value></value>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
''' Returns the password supplied in an Access Request. Returns
|
||||
''' Nothing is a User-Password attribute is missing or the packet is not
|
||||
''' an Access Request.
|
||||
''' </summary>
|
||||
''' <value></value>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public ReadOnly Property UserPassword() As String
|
||||
Get
|
||||
If mCode <> RadiusPacketCode.AccessRequest Then Return Nothing
|
||||
|
||||
If mAttributes.GetFirstAttribute(RadiusAttributeType.UserPassword) Is Nothing Then Return Nothing
|
||||
|
||||
Dim secret As String = mServer.NASList.GetSharedSecret(mEndPoint.Address.ToString)
|
||||
If secret = "" Then Return Nothing
|
||||
Dim userpass As Byte() = mAttributes.GetFirstAttribute(RadiusAttributeType.UserPassword).Value
|
||||
If userpass.Length Mod 16 > 0 Then Return Nothing
|
||||
|
||||
Dim hasher As MD5 = MD5.Create
|
||||
Dim decoded As Byte() = {}
|
||||
Array.Resize(decoded, userpass.Length)
|
||||
Dim temp As Byte() = {}
|
||||
Array.Resize(temp, secret.Length + 16)
|
||||
Dim segment As Byte() = {}
|
||||
Array.Resize(segment, 16)
|
||||
ConvertToBytes(secret).CopyTo(temp, 0)
|
||||
Dim i As Integer
|
||||
For i = 0 To userpass.Length \ 16 - 1
|
||||
If i = 0 Then
|
||||
mAuthenticator.CopyTo(temp, secret.Length)
|
||||
Else
|
||||
Array.Copy(userpass, (i - 1) * 16, temp, secret.Length, 16)
|
||||
End If
|
||||
Array.Copy(userpass, i * 16, segment, 0, 16)
|
||||
Array.Copy(XorBytes(hasher.ComputeHash(temp), segment), 0, decoded, i * 16, 16)
|
||||
Next
|
||||
hasher = Nothing
|
||||
|
||||
Return ConvertToString(decoded).Trim(Chr(0))
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
''' Deprecated. User the UserName and UserPassword properties instead.
|
||||
''' </summary>
|
||||
''' <param name="authList"></param>
|
||||
''' <param name="nasList"></param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function AuthenticateAccessRequest(ByRef authList As NASAuthList, ByRef nasList As NASAuthList) As Boolean
|
||||
If authList Is Nothing Then Return False
|
||||
If nasList Is Nothing Then Return False
|
||||
If Not mIsValid Then Return False
|
||||
If mCode <> RadiusPacketCode.AccessRequest Then Return True
|
||||
|
||||
Dim secret As String = nasList.GetSharedSecret(mEndPoint.Address.ToString)
|
||||
If secret = "" Then Return False
|
||||
Dim username As RADIUSAttribute = mAttributes.GetFirstAttribute(RadiusAttributeType.UserName)
|
||||
If username Is Nothing Then Return False
|
||||
Dim userpass As RADIUSAttribute = mAttributes.GetFirstAttribute(RadiusAttributeType.UserPassword)
|
||||
If userpass Is Nothing Then Return False
|
||||
Dim password As String = authList.GetSharedSecret(username.GetString)
|
||||
If password = "" Then Return False
|
||||
|
||||
Dim passlen As Integer = password.Length \ 16
|
||||
If password.Length Mod 16 > 0 Then
|
||||
passlen += 1
|
||||
password = password & StrDup(16 - (password.Length Mod 16), Chr(0))
|
||||
End If
|
||||
|
||||
Dim hasher As MD5 = MD5.Create
|
||||
Dim expect() As Byte = {}
|
||||
Array.Resize(expect, passlen * 16)
|
||||
Dim temp() As Byte = {}
|
||||
Array.Resize(temp, secret.Length + 16)
|
||||
ConvertToBytes(secret).CopyTo(temp, 0)
|
||||
Dim i As Integer
|
||||
For i = 0 To passlen - 1
|
||||
If i = 0 Then
|
||||
mAuthenticator.CopyTo(temp, secret.Length)
|
||||
Else
|
||||
Array.Copy(expect, (i - 1) * 16, temp, secret.Length, 16)
|
||||
End If
|
||||
Array.Copy(XorBytes(hasher.ComputeHash(temp), ConvertToBytes(password.Substring(i * 16, 16))), 0, expect, i * 16, 16)
|
||||
Next
|
||||
|
||||
hasher = Nothing
|
||||
|
||||
Return (ConvertToString(expect) = userpass.GetString)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Accept the access request.
|
||||
''' </summary>
|
||||
''' <remarks></remarks>
|
||||
Public Sub AcceptAccessRequest()
|
||||
AcceptAccessRequest(Nothing)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Accept the access request and include the specified attributes in the RADIUS response.
|
||||
''' </summary>
|
||||
''' <param name="attributes">The RADIUS attributes to include with the response.</param>
|
||||
''' <remarks></remarks>
|
||||
Public Sub AcceptAccessRequest(ByVal attributes As RADIUSAttributes)
|
||||
If mCode <> RadiusPacketCode.AccessRequest Then Exit Sub
|
||||
mServer.SendAsResponse(New RADIUSPacket(RadiusPacketCode.AccessAccept, mIdentifier, attributes, mEndPoint), mAuthenticator)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Reject the access request.
|
||||
''' </summary>
|
||||
''' <remarks></remarks>
|
||||
Public Sub RejectAccessRequest()
|
||||
If mCode <> RadiusPacketCode.AccessRequest Then Exit Sub
|
||||
mServer.SendAsResponse(New RADIUSPacket(RadiusPacketCode.AccessReject, mIdentifier, Nothing, mEndPoint), mAuthenticator)
|
||||
End Sub
|
||||
|
||||
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
|
156
CICRadarR/RADIUSServer.vb
Normal file
156
CICRadarR/RADIUSServer.vb
Normal file
|
@ -0,0 +1,156 @@
|
|||
Imports System.Net
|
||||
Imports CICRadarR.Conversion
|
||||
|
||||
Public Class RADIUSServer
|
||||
|
||||
Private mSocket As UDPServer
|
||||
Private mSecrets As NASAuthList
|
||||
Private mLastAuthenticator() As Byte = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
|
||||
Public Delegate Sub RADIUSHandler(ByVal packet As RADIUSPacket)
|
||||
|
||||
Private HandlePacket As RADIUSHandler
|
||||
|
||||
Public Sub New(ByVal portNumber As Integer, ByVal onRADIUSPacket As RADIUSHandler, ByRef secrets As NASAuthList)
|
||||
mSocket = New UDPServer(portNumber, AddressOf SocketData)
|
||||
HandlePacket = onRADIUSPacket
|
||||
mSecrets = secrets
|
||||
End Sub
|
||||
|
||||
Public Sub New(ByVal ipAddress As String, ByVal portNumber As Integer, ByVal onRADIUSPacket As RADIUSHandler, ByRef secrets As NASAuthList)
|
||||
mSocket = New UDPServer(ipAddress, portNumber, AddressOf SocketData)
|
||||
HandlePacket = onRADIUSPacket
|
||||
mSecrets = secrets
|
||||
End Sub
|
||||
|
||||
Friend ReadOnly Property NASList() As NASAuthList
|
||||
Get
|
||||
Return mSecrets
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub SendAsRequest(ByVal packet As RADIUSPacket)
|
||||
If packet Is Nothing Then Exit Sub
|
||||
If Not packet.IsValid Then Exit Sub
|
||||
Dim data() As Byte = packet.Bytes
|
||||
Dim hasher As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create
|
||||
Dim hash() As Byte = {}
|
||||
Dim secret As String = mSecrets.GetSharedSecret(packet.EndPoint.Address.ToString)
|
||||
Array.Resize(hash, data.Length + secret.Length)
|
||||
data.CopyTo(hash, 0)
|
||||
ConvertToBytes(secret).CopyTo(hash, data.Length)
|
||||
hash = hasher.ComputeHash(hash)
|
||||
hash.CopyTo(data, 4)
|
||||
hash.CopyTo(mLastAuthenticator, 0)
|
||||
mSocket.Send(data, packet.EndPoint)
|
||||
End Sub
|
||||
|
||||
Public Sub SendAsResponse(ByVal packet As RADIUSPacket, ByVal requestAuth() As Byte)
|
||||
Try
|
||||
If packet Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not packet.IsValid Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If requestAuth Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If requestAuth.Length <> 16 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim data() As Byte = packet.Bytes
|
||||
Dim hasher As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create
|
||||
Dim hash() As Byte = {}
|
||||
Dim secret As String = mSecrets.GetSharedSecret(packet.EndPoint.Address.ToString)
|
||||
Array.Resize(hash, data.Length + secret.Length)
|
||||
data.CopyTo(hash, 0)
|
||||
ConvertToBytes(secret).CopyTo(hash, data.Length)
|
||||
Array.Copy(requestAuth, 0, hash, 4, 16)
|
||||
hash = hasher.ComputeHash(hash)
|
||||
hash.CopyTo(data, 4)
|
||||
mSocket.Send(data, packet.EndPoint)
|
||||
|
||||
Catch ex As Exception
|
||||
Console.WriteLine(ex.Message)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub SocketData(ByRef data() As Byte, ByRef ep As IPEndPoint)
|
||||
'Verify validity ...
|
||||
If data.Length < 20 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim len As Integer = data(2) * 256 + data(3)
|
||||
If data.Length <> len Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim code As RadiusPacketCode = data(0)
|
||||
Dim auth As Boolean
|
||||
If code = RadiusPacketCode.AccessRequest Or code = RadiusPacketCode.AccountingRequest Then
|
||||
auth = AuthenticateRequest(data, mSecrets.GetSharedSecret(ep.Address.ToString))
|
||||
Else
|
||||
auth = AuthenticateResponse(data, mSecrets.GetSharedSecret(ep.Address.ToString))
|
||||
End If
|
||||
If Not auth Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Dim packet As New RADIUSPacket(data, ep, Me)
|
||||
HandlePacket(packet)
|
||||
End Sub
|
||||
|
||||
Private Function AuthenticateRequest(ByRef dataBytes() As Byte, ByVal secret As String) As Boolean
|
||||
If dataBytes Is Nothing Then Return False
|
||||
If dataBytes(0) = RadiusPacketCode.AccessRequest Then Return True
|
||||
If secret Is Nothing Then Return False
|
||||
Dim res As Boolean = True
|
||||
Dim i As Integer
|
||||
Dim hasher As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create
|
||||
Dim expectedHash() As Byte = {}
|
||||
|
||||
Array.Resize(Of Byte)(expectedHash, dataBytes.Length + secret.Length)
|
||||
dataBytes.CopyTo(expectedHash, 0)
|
||||
ConvertToBytes(secret).CopyTo(expectedHash, dataBytes.Length)
|
||||
|
||||
For i = 4 To 19 : expectedHash(i) = 0 : Next ' Setting authenticator to zero...
|
||||
|
||||
expectedHash = hasher.ComputeHash(expectedHash)
|
||||
|
||||
' Compare ...
|
||||
i = 4 : Do While res And i <= 19 : If dataBytes(i) <> expectedHash(i - 4) Then : res = False : End If : i += 1 : Loop
|
||||
|
||||
Return res
|
||||
End Function
|
||||
|
||||
Private Function AuthenticateResponse(ByRef dataBytes() As Byte, ByVal secret As String) As Boolean
|
||||
If secret Is Nothing Then Return False
|
||||
If secret = "" Then Return False
|
||||
Dim res As Boolean = True
|
||||
Dim i As Integer
|
||||
Dim hasher As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create
|
||||
Dim expectedHash() As Byte = {}
|
||||
|
||||
Array.Resize(Of Byte)(expectedHash, dataBytes.Length + secret.Length)
|
||||
dataBytes.CopyTo(expectedHash, 0)
|
||||
ConvertToBytes(secret).CopyTo(expectedHash, dataBytes.Length)
|
||||
|
||||
For i = 4 To 19 : expectedHash(i) = mLastAuthenticator(i - 4) : Next ' Setting authenticator to zero...
|
||||
|
||||
expectedHash = hasher.ComputeHash(expectedHash)
|
||||
|
||||
' Compare ...
|
||||
i = 4 : Do While res And i <= 19 : If dataBytes(i) <> expectedHash(i - 4) Then : res = False : End If : i += 1 : Loop
|
||||
|
||||
Return res
|
||||
End Function
|
||||
|
||||
End Class
|
66
CICRadarR/SmsClass.vb
Normal file
66
CICRadarR/SmsClass.vb
Normal file
|
@ -0,0 +1,66 @@
|
|||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Text
|
||||
Imports System.Threading
|
||||
Imports System.IO.Ports
|
||||
Imports System.Windows.Forms
|
||||
Namespace SMS
|
||||
Class SmsClass
|
||||
Private serialPort As SerialPort
|
||||
Public Sub New(ByVal comPort As String)
|
||||
Me.serialPort = New SerialPort()
|
||||
Me.serialPort.PortName = comPort
|
||||
Me.serialPort.BaudRate = 38400
|
||||
Me.serialPort.Parity = Parity.None
|
||||
Me.serialPort.DataBits = 8
|
||||
Me.serialPort.StopBits = StopBits.One
|
||||
Me.serialPort.Handshake = Handshake.RequestToSend
|
||||
Me.serialPort.DtrEnable = True
|
||||
Me.serialPort.RtsEnable = True
|
||||
Me.serialPort.NewLine = System.Environment.NewLine
|
||||
End Sub
|
||||
Public Function sendSms(ByVal cellNo As String, ByVal sms As String, ByVal SMSC As String) As Boolean
|
||||
Dim messages As String = Nothing
|
||||
messages = sms
|
||||
If Me.serialPort.IsOpen = True Then
|
||||
Try
|
||||
Me.serialPort.WriteLine("AT" + Chr(13))
|
||||
Thread.Sleep(4)
|
||||
Me.serialPort.WriteLine("AT+CSCA=""" + SMSC + """" + Chr(13))
|
||||
Thread.Sleep(30)
|
||||
Me.serialPort.WriteLine(Chr(13))
|
||||
Thread.Sleep(30)
|
||||
Me.serialPort.WriteLine("AT+CMGS=""" + cellNo + """")
|
||||
|
||||
Thread.Sleep(30)
|
||||
Me.serialPort.WriteLine(messages + Chr(26))
|
||||
Catch ex As Exception
|
||||
MessageBox.Show(ex.Source)
|
||||
End Try
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Sub Opens()
|
||||
|
||||
If Me.serialPort.IsOpen = False Then
|
||||
Try
|
||||
'bool ok =this.serialPort.IsOpen //does not work between 2 treads
|
||||
|
||||
Me.serialPort.Open()
|
||||
Catch
|
||||
Thread.Sleep(1000)
|
||||
'wait for the port to get ready if
|
||||
Opens()
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
Public Sub Closes()
|
||||
If Me.serialPort.IsOpen = True Then
|
||||
Me.serialPort.Close()
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
73
CICRadarR/TestService.Designer.vb
generated
Normal file
73
CICRadarR/TestService.Designer.vb
generated
Normal file
|
@ -0,0 +1,73 @@
|
|||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class TestService
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Required by the Windows Form Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Windows Form Designer
|
||||
'It can be modified using the Windows Form Designer.
|
||||
'Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.btnStart = New System.Windows.Forms.Button()
|
||||
Me.btnStop = New System.Windows.Forms.Button()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'btnStart
|
||||
'
|
||||
Me.btnStart.Location = New System.Drawing.Point(38, 41)
|
||||
Me.btnStart.Name = "btnStart"
|
||||
Me.btnStart.Size = New System.Drawing.Size(75, 23)
|
||||
Me.btnStart.TabIndex = 0
|
||||
Me.btnStart.Text = "Start"
|
||||
Me.btnStart.UseVisualStyleBackColor = True
|
||||
'
|
||||
'btnStop
|
||||
'
|
||||
Me.btnStop.Location = New System.Drawing.Point(38, 95)
|
||||
Me.btnStop.Name = "btnStop"
|
||||
Me.btnStop.Size = New System.Drawing.Size(75, 23)
|
||||
Me.btnStop.TabIndex = 1
|
||||
Me.btnStop.Text = "Stop"
|
||||
Me.btnStop.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Button1
|
||||
'
|
||||
Me.Button1.Location = New System.Drawing.Point(175, 40)
|
||||
Me.Button1.Name = "Button1"
|
||||
Me.Button1.Size = New System.Drawing.Size(75, 23)
|
||||
Me.Button1.TabIndex = 2
|
||||
Me.Button1.Text = "Button1"
|
||||
Me.Button1.UseVisualStyleBackColor = True
|
||||
'
|
||||
'TestService
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(292, 273)
|
||||
Me.Controls.Add(Me.Button1)
|
||||
Me.Controls.Add(Me.btnStop)
|
||||
Me.Controls.Add(Me.btnStart)
|
||||
Me.Name = "TestService"
|
||||
Me.Text = "TestService"
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
Friend WithEvents btnStart As System.Windows.Forms.Button
|
||||
Friend WithEvents btnStop As System.Windows.Forms.Button
|
||||
Friend WithEvents Button1 As System.Windows.Forms.Button
|
||||
End Class
|
120
CICRadarR/TestService.resx
Normal file
120
CICRadarR/TestService.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<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" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
44
CICRadarR/TestService.vb
Normal file
44
CICRadarR/TestService.vb
Normal file
|
@ -0,0 +1,44 @@
|
|||
Imports CICRadarR
|
||||
|
||||
Public Class TestService
|
||||
|
||||
Private Radius_Service As New CICRadarR
|
||||
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
|
||||
btnStart.Enabled = False
|
||||
Call Radius_Service.OnstartTest()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
|
||||
Call Radius_Service.OnStopTest()
|
||||
End
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
|
||||
Button1.Enabled = False
|
||||
Dim SessionTimeOut As Integer = 1
|
||||
Dim TSGWSessionIdTimeStampHash As New Hashtable
|
||||
Dim TSGWSessionIdHash As New Hashtable
|
||||
TSGWSessionIdTimeStampHash.Add("ged", Now)
|
||||
Threading.Thread.Sleep(65000)
|
||||
Dim timeValid As Long = 0
|
||||
Dim hashTime As DateTime = DirectCast(TSGWSessionIdTimeStampHash("ged"), DateTime)
|
||||
timeValid = DateDiff(DateInterval.Second, hashTime, Now)
|
||||
MsgBox(timeValid)
|
||||
|
||||
|
||||
Dim Item As DictionaryEntry
|
||||
|
||||
|
||||
For Each Item In TSGWSessionIdTimeStampHash
|
||||
Dim hTime As DateTime = DirectCast(Item.Value, DateTime)
|
||||
Dim tValid = DateDiff(DateInterval.Minute, hTime, Now)
|
||||
If tValid >= SessionTimeOut Then
|
||||
TSGWSessionIdTimeStampHash.Remove(Item.Key)
|
||||
If TSGWSessionIdHash.Contains(Item.Key) Then
|
||||
TSGWSessionIdHash.Remove(Item.Key)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
End Class
|
57
CICRadarR/UDPServer.vb
Normal file
57
CICRadarR/UDPServer.vb
Normal file
|
@ -0,0 +1,57 @@
|
|||
Imports System.Net
|
||||
Imports System.Net.Sockets
|
||||
|
||||
Friend Class UDPServer
|
||||
|
||||
Private mSocket As UdpClient
|
||||
Private mAsyncResult As IAsyncResult
|
||||
|
||||
Friend Delegate Sub UDPPacketHandler(ByRef data() As Byte, ByRef endPoint As IPEndPoint)
|
||||
|
||||
Private HandlePacket As UDPPacketHandler
|
||||
|
||||
Friend Sub New(ByVal portNumber As Integer, ByVal onDataArrived As UDPPacketHandler)
|
||||
mSocket = New UdpClient(portNumber)
|
||||
HandlePacket = onDataArrived
|
||||
commonNew()
|
||||
End Sub
|
||||
|
||||
Friend Sub New(ByVal ipAddress As String, ByVal portNumber As Integer, ByVal onDataArrived As UDPPacketHandler)
|
||||
Dim ep As New IPEndPoint(System.Net.IPAddress.Parse(ipAddress), portNumber)
|
||||
mSocket = New UdpClient(ep)
|
||||
HandlePacket = onDataArrived
|
||||
commonNew()
|
||||
End Sub
|
||||
|
||||
Private Sub commonNew()
|
||||
mAsyncResult = mSocket.BeginReceive(New AsyncCallback(AddressOf DataReceived), Nothing)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub DataReceived(ByVal ar As IAsyncResult)
|
||||
Dim ep As New IPEndPoint(0, 0)
|
||||
Dim ef As Boolean = False
|
||||
Dim data() As Byte = {}
|
||||
Try
|
||||
data = mSocket.EndReceive(mAsyncResult, ep)
|
||||
Catch ex As System.Net.Sockets.SocketException
|
||||
If ex.SocketErrorCode = 10054 Then ' Client killed connection
|
||||
ef = False
|
||||
Else
|
||||
ef = True
|
||||
End If
|
||||
|
||||
End Try
|
||||
If Not ef Then
|
||||
mAsyncResult = mSocket.BeginReceive(New AsyncCallback(AddressOf DataReceived), Nothing)
|
||||
HandlePacket(data, ep)
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub Send(ByRef data() As Byte, ByRef endPoint As IPEndPoint)
|
||||
mSocket.Send(data, data.Length, endPoint)
|
||||
End Sub
|
||||
|
||||
End Class
|
131
CICRadarR/VSA.vb
Normal file
131
CICRadarR/VSA.vb
Normal file
|
@ -0,0 +1,131 @@
|
|||
'Copyright (C) 2008-2011 Nikolay Semov
|
||||
|
||||
' This program is free software: you can redistribute it and/or modify
|
||||
' it under the terms of the GNU General Public License as published by
|
||||
' the Free Software Foundation, either version 3 of the License, or
|
||||
' (at your option) any later version.
|
||||
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
' GNU General Public License for more details.
|
||||
|
||||
' You should have received a copy of the GNU General Public License
|
||||
' along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Imports CICRadarR.Conversion
|
||||
|
||||
Public Class CiscoAVPair
|
||||
|
||||
Private mVendorType As CiscoAVPairType
|
||||
Private mVendorName As String
|
||||
Private mVendorValue As String
|
||||
|
||||
Public ReadOnly Property VendorType() As CiscoAVPairType
|
||||
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 = CiscoAVPairType.Invalid
|
||||
mVendorName = ""
|
||||
mVendorValue = ""
|
||||
If value.Length < 6 Then Exit Sub
|
||||
If Not (value(0) = 0 And value(1) = 0 And value(2) = 0 And value(3) = 9) 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)
|
||||
If VendorValue.Contains("=") Then
|
||||
mVendorName = Left(VendorValue, InStr(VendorValue, "=") - 1)
|
||||
mVendorValue = Right(VendorValue, VendorValue.Length - VendorName.Length - 1)
|
||||
End If
|
||||
If VendorName = "h323-ivr-in" Then mVendorType = CiscoAVPairType.IVR_In
|
||||
If VendorName = "h323-ivr-out" Then mVendorType = CiscoAVPairType.IVR_Out
|
||||
End Sub
|
||||
|
||||
Public Sub New(ByVal type As CiscoAVPairType, ByVal value As String)
|
||||
mVendorType = type
|
||||
If type = CiscoAVPairType.Invalid Then
|
||||
mVendorName = ""
|
||||
mVendorValue = ""
|
||||
ElseIf type = CiscoAVPairType.Generic Then
|
||||
mVendorName = "generic"
|
||||
mVendorValue = value
|
||||
Else
|
||||
mVendorName = "h323-" & Replace(LCase(type.ToString), "_", "-")
|
||||
mVendorValue = value
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub New(ByVal name As String, ByVal value As String)
|
||||
mVendorType = CiscoAVPairType.Generic
|
||||
mVendorName = name
|
||||
mVendorValue = value
|
||||
End Sub
|
||||
|
||||
Public Sub GetRADIUSAttribute(ByRef attributes As RADIUSAttributes)
|
||||
If attributes Is Nothing Then Exit Sub
|
||||
If mVendorType = CiscoAVPairType.Invalid Then Exit Sub
|
||||
Dim data() As Byte = {}
|
||||
Dim len As Byte = 6
|
||||
Dim lvt As Byte = mVendorType
|
||||
If lvt = CiscoAVPairType.IVR_In Or lvt = CiscoAVPairType.IVR_Out Then lvt = 1
|
||||
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
|
||||
|
||||
End Class
|
||||
|
||||
Public Enum CiscoAVPairType As Byte
|
||||
Invalid = 0
|
||||
Generic = 1
|
||||
Remote_Address = 23
|
||||
Conf_Id = 24
|
||||
Setup_Time = 25
|
||||
Call_Origin = 26
|
||||
Call_Type = 27
|
||||
Connect_Time = 28
|
||||
Disconnect_Time = 29
|
||||
Disconnect_Cause = 30
|
||||
Voice_Quality = 31
|
||||
GW_Id = 33
|
||||
IVR_In = 201
|
||||
IVR_Out = 202
|
||||
End Enum
|
142
CICRadarR/VendorSpefic.vb
Normal file
142
CICRadarR/VendorSpefic.vb
Normal file
|
@ -0,0 +1,142 @@
|
|||
|
||||
|
||||
Imports CICRadarR.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
|
||||
End If
|
||||
|
||||
If value.Length <> value(5) + 4 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
mVendorType = value(4)
|
||||
If mVendorType = 47 Then
|
||||
mVendorName = "generic"
|
||||
mVendorValue = "TSGateway"
|
||||
Else
|
||||
|
||||
mVendorName = "generic"
|
||||
Dim v() As Byte = {}
|
||||
Array.Resize(v, value.Length - 6)
|
||||
Array.Copy(value, 6, v, 0, v.Length)
|
||||
mVendorValue = ConvertToString(v)
|
||||
End If
|
||||
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 Function ToBytes(data As String) As Byte()
|
||||
Dim newdata() As Byte = ConvertToBytes(data)
|
||||
Return newdata
|
||||
End Function
|
||||
|
||||
Public Sub GetRADIUSAttribute(ByRef attributes As RADIUSAttributes)
|
||||
If attributes Is Nothing Then Exit Sub
|
||||
If mVendorType = VendorSpecificType.Invalid Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim data() As Byte = {}
|
||||
Dim len As Byte = 6
|
||||
Dim lvt As Byte = mVendorType
|
||||
' If lvt = CiscoAVPairType.IVR_In Or lvt = CiscoAVPairType.IVR_Out Then lvt = 1
|
||||
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) = 2 ' Generic value 666. Not sure if this confilct with other vendor, but RFC does not list existing vendor id's
|
||||
data(3) = 154
|
||||
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
|
97
CICRadarR/bin/Debug/CICRadarR.InstallLog
Normal file
97
CICRadarR/bin/Debug/CICRadarR.InstallLog
Normal file
|
@ -0,0 +1,97 @@
|
|||
Installing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly.
|
||||
Committing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly.
|
||||
Remove InstallState file because there are no installers.
|
||||
Installing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly.
|
||||
Committing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly.
|
||||
Remove InstallState file because there are no installers.
|
||||
Installing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
Installing service CICRadiusR...
|
||||
Creating EventLog source CICRadiusR in log Application...
|
||||
Rolling back assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
Restoring event log to previous state for source CICRadiusR.
|
||||
Installing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly.
|
||||
Committing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly.
|
||||
Remove InstallState file because there are no installers.
|
||||
Installing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly.
|
||||
Committing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly.
|
||||
Remove InstallState file because there are no installers.
|
||||
Installing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
Rolling back assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
Installing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
Installing service CICRadiusR...
|
||||
Service CICRadiusR has been successfully installed.
|
||||
Creating EventLog source CICRadiusR in log Application...
|
||||
Committing assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
Uninstalling assembly 'C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe'.
|
||||
Affected parameters are:
|
||||
logtoconsole =
|
||||
logfile = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog
|
||||
assemblypath = C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
Removing EventLog source CICRadiusR.
|
||||
Service CICRadiusR is being removed from the system...
|
||||
Service CICRadiusR was successfully removed from the system.
|
||||
Attempt to stop service CICRadiusR.
|
BIN
CICRadarR/bin/Debug/CICRadarR.exe
Normal file
BIN
CICRadarR/bin/Debug/CICRadarR.exe
Normal file
Binary file not shown.
23
CICRadarR/bin/Debug/CICRadarR.ini
Normal file
23
CICRadarR/bin/Debug/CICRadarR.ini
Normal file
|
@ -0,0 +1,23 @@
|
|||
[CICRadarR]
|
||||
USELOCALMODEM=0
|
||||
SMSC=+4540390999
|
||||
Debug=1
|
||||
ADField=telephoneNumber
|
||||
COMPORT=com1
|
||||
NetBiosDomain=isager
|
||||
ClientList=10.10.10.47,192.168.1.139,192.168.1.101,192.168.1.61,192.168.1.44
|
||||
LDAPDomain=isager.lan
|
||||
Provider=https://www.cpsms.dk/sms/?username=myuser&password=mypassword&recipient=***NUMBER***&message=***TEXTMESSAGE***&from=CPSMS
|
||||
EnableOTP=1
|
||||
TSGW=1
|
||||
EnableSMS=1
|
||||
EnableEmail=1
|
||||
MailServer=192.168.1.25
|
||||
SenderEmail=noreply@isager.dk
|
||||
ADMailfield=mail
|
||||
[Clients]
|
||||
10.10.10.47=iirseiKUQCWnjfg1ZLhF+w==
|
||||
192.168.1.101=eXA0YJxFrgfaDtOFApCifbPtJYrEL0RjpDzymPKlw6c=
|
||||
192.168.1.61=p2fyLMddDfH8aLYwMyDbhQ1l3MY9hAJxx6DyiUOhjXw=
|
||||
192.168.1.139=eXA0YJxFrgfaDtOFApCifbPtJYrEL0RjpDzymPKlw6c=
|
||||
192.168.1.44=eXA0YJxFrgfaDtOFApCifbPtJYrEL0RjpDzymPKlw6c=
|
BIN
CICRadarR/bin/Debug/CICRadarR.pdb
Normal file
BIN
CICRadarR/bin/Debug/CICRadarR.pdb
Normal file
Binary file not shown.
BIN
CICRadarR/bin/Debug/CICRadarR.vshost.exe
Normal file
BIN
CICRadarR/bin/Debug/CICRadarR.vshost.exe
Normal file
Binary file not shown.
48
CICRadarR/bin/Debug/CICRadarR.vshost.exe.manifest
Normal file
48
CICRadarR/bin/Debug/CICRadarR.vshost.exe.manifest
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel node will disable file and registry virtualization.
|
||||
If you want to utilize File and Registry Virtualization for backward
|
||||
compatibility then delete the requestedExecutionLevel node.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
|
||||
|
||||
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!-- <dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>-->
|
||||
|
||||
</asmv1:assembly>
|
66
CICRadarR/bin/Debug/CICRadarR.xml
Normal file
66
CICRadarR/bin/Debug/CICRadarR.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
CICRadarR
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:CICRadarR.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarR.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:CICRadarR.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarR.RADIUSPacket.UserName">
|
||||
<summary>
|
||||
Returns the username supplied in an Access Request. Returns
|
||||
Nothing if a User-Name attribute is missing or the packet is not an
|
||||
Access Request.
|
||||
</summary>
|
||||
<value></value>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="P:CICRadarR.RADIUSPacket.UserPassword">
|
||||
<summary>
|
||||
Returns the password supplied in an Access Request. Returns
|
||||
Nothing is a User-Password attribute is missing or the packet is not
|
||||
an Access Request.
|
||||
</summary>
|
||||
<value></value>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AuthenticateAccessRequest(CICRadarR.NASAuthList@,CICRadarR.NASAuthList@)">
|
||||
<summary>
|
||||
Deprecated. User the UserName and UserPassword properties instead.
|
||||
</summary>
|
||||
<param name="authList"></param>
|
||||
<param name="nasList"></param>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AcceptAccessRequest">
|
||||
<summary>
|
||||
Accept the access request.
|
||||
</summary>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AcceptAccessRequest(CICRadarR.RADIUSAttributes)">
|
||||
<summary>
|
||||
Accept the access request and include the specified attributes in the RADIUS response.
|
||||
</summary>
|
||||
<param name="attributes">The RADIUS attributes to include with the response.</param>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.RejectAccessRequest">
|
||||
<summary>
|
||||
Reject the access request.
|
||||
</summary>
|
||||
<remarks></remarks>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
111
CICRadarR/bin/Debug/InstallUtil.InstallLog
Normal file
111
CICRadarR/bin/Debug/InstallUtil.InstallLog
Normal file
|
@ -0,0 +1,111 @@
|
|||
|
||||
Running a transacted installation.
|
||||
|
||||
Beginning the Install phase of the installation.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Install phase completed successfully, and the Commit phase is beginning.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Commit phase completed successfully.
|
||||
|
||||
The transacted install has completed.
|
||||
|
||||
Running a transacted installation.
|
||||
|
||||
Beginning the Install phase of the installation.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Install phase completed successfully, and the Commit phase is beginning.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Commit phase completed successfully.
|
||||
|
||||
The transacted install has completed.
|
||||
|
||||
Running a transacted installation.
|
||||
|
||||
Beginning the Install phase of the installation.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
An exception occurred during the Install phase.
|
||||
System.InvalidOperationException: Installation failed due to the absence of a ServiceProcessInstaller. The ServiceProcessInstaller must either be the containing installer, or it must be present in the Installers collection on the same installer as the ServiceInstaller.
|
||||
|
||||
The Rollback phase of the installation is beginning.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Rollback phase completed successfully.
|
||||
|
||||
The transacted install has completed.
|
||||
|
||||
Running a transacted installation.
|
||||
|
||||
Beginning the Install phase of the installation.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Install phase completed successfully, and the Commit phase is beginning.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Commit phase completed successfully.
|
||||
|
||||
The transacted install has completed.
|
||||
|
||||
Running a transacted installation.
|
||||
|
||||
Beginning the Install phase of the installation.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Install phase completed successfully, and the Commit phase is beginning.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Commit phase completed successfully.
|
||||
|
||||
The transacted install has completed.
|
||||
|
||||
Running a transacted installation.
|
||||
|
||||
Beginning the Install phase of the installation.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
An exception occurred during the Install phase.
|
||||
System.InvalidOperationException: User has canceled installation of services in executable C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe.
|
||||
|
||||
The Rollback phase of the installation is beginning.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Rollback phase completed successfully.
|
||||
|
||||
The transacted install has completed.
|
||||
|
||||
Running a transacted installation.
|
||||
|
||||
Beginning the Install phase of the installation.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Install phase completed successfully, and the Commit phase is beginning.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The Commit phase completed successfully.
|
||||
|
||||
The transacted install has completed.
|
||||
|
||||
|
||||
The uninstall is beginning.
|
||||
See the contents of the log file for the C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe assembly's progress.
|
||||
The file is located at C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.InstallLog.
|
||||
|
||||
The uninstall has completed.
|
BIN
CICRadarR/bin/Release/CICRadarR.exe
Normal file
BIN
CICRadarR/bin/Release/CICRadarR.exe
Normal file
Binary file not shown.
BIN
CICRadarR/bin/Release/CICRadarR.pdb
Normal file
BIN
CICRadarR/bin/Release/CICRadarR.pdb
Normal file
Binary file not shown.
BIN
CICRadarR/bin/Release/CICRadarR.vshost.exe
Normal file
BIN
CICRadarR/bin/Release/CICRadarR.vshost.exe
Normal file
Binary file not shown.
48
CICRadarR/bin/Release/CICRadarR.vshost.exe.manifest
Normal file
48
CICRadarR/bin/Release/CICRadarR.vshost.exe.manifest
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel node will disable file and registry virtualization.
|
||||
If you want to utilize File and Registry Virtualization for backward
|
||||
compatibility then delete the requestedExecutionLevel node.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
|
||||
|
||||
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!-- <dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>-->
|
||||
|
||||
</asmv1:assembly>
|
66
CICRadarR/bin/Release/CICRadarR.xml
Normal file
66
CICRadarR/bin/Release/CICRadarR.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
CICRadarR
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:CICRadarR.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarR.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:CICRadarR.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarR.RADIUSPacket.UserName">
|
||||
<summary>
|
||||
Returns the username supplied in an Access Request. Returns
|
||||
Nothing if a User-Name attribute is missing or the packet is not an
|
||||
Access Request.
|
||||
</summary>
|
||||
<value></value>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="P:CICRadarR.RADIUSPacket.UserPassword">
|
||||
<summary>
|
||||
Returns the password supplied in an Access Request. Returns
|
||||
Nothing is a User-Password attribute is missing or the packet is not
|
||||
an Access Request.
|
||||
</summary>
|
||||
<value></value>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AuthenticateAccessRequest(CICRadarR.NASAuthList@,CICRadarR.NASAuthList@)">
|
||||
<summary>
|
||||
Deprecated. User the UserName and UserPassword properties instead.
|
||||
</summary>
|
||||
<param name="authList"></param>
|
||||
<param name="nasList"></param>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AcceptAccessRequest">
|
||||
<summary>
|
||||
Accept the access request.
|
||||
</summary>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AcceptAccessRequest(CICRadarR.RADIUSAttributes)">
|
||||
<summary>
|
||||
Accept the access request and include the specified attributes in the RADIUS response.
|
||||
</summary>
|
||||
<param name="attributes">The RADIUS attributes to include with the response.</param>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.RejectAccessRequest">
|
||||
<summary>
|
||||
Reject the access request.
|
||||
</summary>
|
||||
<remarks></remarks>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
BIN
CICRadarR/obj/x86/Debug/CICRadarR.CICRadarR.resources
Normal file
BIN
CICRadarR/obj/x86/Debug/CICRadarR.CICRadarR.resources
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Debug/CICRadarR.ProjectInstaller.resources
Normal file
BIN
CICRadarR/obj/x86/Debug/CICRadarR.ProjectInstaller.resources
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Debug/CICRadarR.Resources.resources
Normal file
BIN
CICRadarR/obj/x86/Debug/CICRadarR.Resources.resources
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Debug/CICRadarR.TestService.resources
Normal file
BIN
CICRadarR/obj/x86/Debug/CICRadarR.TestService.resources
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Debug/CICRadarR.exe
Normal file
BIN
CICRadarR/obj/x86/Debug/CICRadarR.exe
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Debug/CICRadarR.pdb
Normal file
BIN
CICRadarR/obj/x86/Debug/CICRadarR.pdb
Normal file
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
C:\CICRadarR\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\bin\Debug\CICRadarR.pdb
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\bin\Debug\CICRadarR.xml
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\obj\x86\Debug\ResolveAssemblyReference.cache
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.Resources.resources
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\obj\x86\Debug\GenerateResource.read.1.tlog
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\obj\x86\Debug\GenerateResource.write.1.tlog
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.exe
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.xml
|
||||
C:\CICRadarR\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.pdb
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.exe
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.xml
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.pdb
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.Resources.resources
|
||||
C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.exe
|
||||
C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.pdb
|
||||
C:\CICRadarR\CICRadarR\bin\Debug\CICRadarR.xml
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.TestService.resources
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.CICRadarR.resources
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.ProjectInstaller.resources
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Debug\CICRadarR.vbproj.GenerateResource.Cache
|
BIN
CICRadarR/obj/x86/Debug/CICRadarR.vbproj.GenerateResource.Cache
Normal file
BIN
CICRadarR/obj/x86/Debug/CICRadarR.vbproj.GenerateResource.Cache
Normal file
Binary file not shown.
66
CICRadarR/obj/x86/Debug/CICRadarR.xml
Normal file
66
CICRadarR/obj/x86/Debug/CICRadarR.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
CICRadarR
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:CICRadarR.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarR.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:CICRadarR.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarR.RADIUSPacket.UserName">
|
||||
<summary>
|
||||
Returns the username supplied in an Access Request. Returns
|
||||
Nothing if a User-Name attribute is missing or the packet is not an
|
||||
Access Request.
|
||||
</summary>
|
||||
<value></value>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="P:CICRadarR.RADIUSPacket.UserPassword">
|
||||
<summary>
|
||||
Returns the password supplied in an Access Request. Returns
|
||||
Nothing is a User-Password attribute is missing or the packet is not
|
||||
an Access Request.
|
||||
</summary>
|
||||
<value></value>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AuthenticateAccessRequest(CICRadarR.NASAuthList@,CICRadarR.NASAuthList@)">
|
||||
<summary>
|
||||
Deprecated. User the UserName and UserPassword properties instead.
|
||||
</summary>
|
||||
<param name="authList"></param>
|
||||
<param name="nasList"></param>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AcceptAccessRequest">
|
||||
<summary>
|
||||
Accept the access request.
|
||||
</summary>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AcceptAccessRequest(CICRadarR.RADIUSAttributes)">
|
||||
<summary>
|
||||
Accept the access request and include the specified attributes in the RADIUS response.
|
||||
</summary>
|
||||
<param name="attributes">The RADIUS attributes to include with the response.</param>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.RejectAccessRequest">
|
||||
<summary>
|
||||
Reject the access request.
|
||||
</summary>
|
||||
<remarks></remarks>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
CICRadarR/obj/x86/Release/CICRadarR.CICRadarR.resources
Normal file
BIN
CICRadarR/obj/x86/Release/CICRadarR.CICRadarR.resources
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Release/CICRadarR.ProjectInstaller.resources
Normal file
BIN
CICRadarR/obj/x86/Release/CICRadarR.ProjectInstaller.resources
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Release/CICRadarR.Resources.resources
Normal file
BIN
CICRadarR/obj/x86/Release/CICRadarR.Resources.resources
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Release/CICRadarR.TestService.resources
Normal file
BIN
CICRadarR/obj/x86/Release/CICRadarR.TestService.resources
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Release/CICRadarR.exe
Normal file
BIN
CICRadarR/obj/x86/Release/CICRadarR.exe
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Release/CICRadarR.pdb
Normal file
BIN
CICRadarR/obj/x86/Release/CICRadarR.pdb
Normal file
Binary file not shown.
|
@ -0,0 +1,13 @@
|
|||
C:\CICRadarR\CICRadarR\bin\Release\CICRadarR.exe
|
||||
C:\CICRadarR\CICRadarR\bin\Release\CICRadarR.pdb
|
||||
C:\CICRadarR\CICRadarR\bin\Release\CICRadarR.xml
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\ResolveAssemblyReference.cache
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\CICRadarR.CICRadarR.resources
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\CICRadarR.Resources.resources
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\CICRadarR.ProjectInstaller.resources
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\CICRadarR.TestService.resources
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\GenerateResource.read.1.tlog
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\GenerateResource.write.1.tlog
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\CICRadarR.exe
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\CICRadarR.xml
|
||||
C:\CICRadarR\CICRadarR\obj\x86\Release\CICRadarR.pdb
|
66
CICRadarR/obj/x86/Release/CICRadarR.xml
Normal file
66
CICRadarR/obj/x86/Release/CICRadarR.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
CICRadarR
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:CICRadarR.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarR.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:CICRadarR.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarR.RADIUSPacket.UserName">
|
||||
<summary>
|
||||
Returns the username supplied in an Access Request. Returns
|
||||
Nothing if a User-Name attribute is missing or the packet is not an
|
||||
Access Request.
|
||||
</summary>
|
||||
<value></value>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="P:CICRadarR.RADIUSPacket.UserPassword">
|
||||
<summary>
|
||||
Returns the password supplied in an Access Request. Returns
|
||||
Nothing is a User-Password attribute is missing or the packet is not
|
||||
an Access Request.
|
||||
</summary>
|
||||
<value></value>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AuthenticateAccessRequest(CICRadarR.NASAuthList@,CICRadarR.NASAuthList@)">
|
||||
<summary>
|
||||
Deprecated. User the UserName and UserPassword properties instead.
|
||||
</summary>
|
||||
<param name="authList"></param>
|
||||
<param name="nasList"></param>
|
||||
<returns></returns>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AcceptAccessRequest">
|
||||
<summary>
|
||||
Accept the access request.
|
||||
</summary>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.AcceptAccessRequest(CICRadarR.RADIUSAttributes)">
|
||||
<summary>
|
||||
Accept the access request and include the specified attributes in the RADIUS response.
|
||||
</summary>
|
||||
<param name="attributes">The RADIUS attributes to include with the response.</param>
|
||||
<remarks></remarks>
|
||||
</member><member name="M:CICRadarR.RADIUSPacket.RejectAccessRequest">
|
||||
<summary>
|
||||
Reject the access request.
|
||||
</summary>
|
||||
<remarks></remarks>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
Binary file not shown.
BIN
CICRadarR/obj/x86/Release/GenerateResource.read.1.tlog
Normal file
BIN
CICRadarR/obj/x86/Release/GenerateResource.read.1.tlog
Normal file
Binary file not shown.
BIN
CICRadarR/obj/x86/Release/GenerateResource.write.1.tlog
Normal file
BIN
CICRadarR/obj/x86/Release/GenerateResource.write.1.tlog
Normal file
Binary file not shown.
Binary file not shown.
135
CICRadarR/random.vb
Normal file
135
CICRadarR/random.vb
Normal file
|
@ -0,0 +1,135 @@
|
|||
|
||||
Imports System
|
||||
Imports System.Security.Cryptography
|
||||
|
||||
|
||||
Namespace Security
|
||||
Public Enum RandomPasswordOptions
|
||||
Alpha = 1
|
||||
Numeric = 2
|
||||
AlphaNumeric = Alpha + Numeric
|
||||
AlphaNumericSpecial = 4
|
||||
End Enum
|
||||
|
||||
Public Class RandomPasswordGenerator
|
||||
' Define default password length.
|
||||
Private Shared DEFAULT_PASSWORD_LENGTH As Integer = 2
|
||||
|
||||
'No characters that are confusing: i, I, l, L, o, O, 0, 1, u, v
|
||||
|
||||
Private Shared PASSWORD_CHARS_Alpha As String = "abcdefghjkmnpqrstwxyzABCDEFGHJKMNPQRSTWXYZ"
|
||||
Private Shared PASSWORD_CHARS_NUMERIC As String = "23456789"
|
||||
Private Shared PASSWORD_CHARS_SPECIAL As String = ""
|
||||
|
||||
#Region "Overloads"
|
||||
|
||||
''' <summary>
|
||||
''' Generates a random password with the default length.
|
||||
''' </summary>
|
||||
''' <returns>Randomly generated password.</returns>
|
||||
Public Shared Function Generate() As String
|
||||
Return Generate(DEFAULT_PASSWORD_LENGTH, RandomPasswordOptions.AlphaNumericSpecial)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Generates a random password with the default length.
|
||||
''' </summary>
|
||||
''' <returns>Randomly generated password.</returns>
|
||||
Public Shared Function Generate(ByVal [option] As RandomPasswordOptions) As String
|
||||
Return Generate(DEFAULT_PASSWORD_LENGTH, [option])
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Generates a random password with the default length.
|
||||
''' </summary>
|
||||
''' <returns>Randomly generated password.</returns>
|
||||
Public Shared Function Generate(ByVal passwordLength As Integer) As String
|
||||
Return Generate(DEFAULT_PASSWORD_LENGTH, RandomPasswordOptions.AlphaNumericSpecial)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Generates a random password.
|
||||
''' </summary>
|
||||
''' <returns>Randomly generated password.</returns>
|
||||
Public Shared Function Generate(ByVal passwordLength As Integer, ByVal [option] As RandomPasswordOptions) As String
|
||||
Return GeneratePassword(passwordLength, [option])
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Generates the password.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Private Shared Function GeneratePassword(ByVal passwordLength As Integer, ByVal [option] As RandomPasswordOptions) As String
|
||||
If passwordLength < 0 Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Dim passwordChars = GetCharacters([option])
|
||||
|
||||
If String.IsNullOrEmpty(passwordChars) Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Dim password = New Char(passwordLength - 1) {}
|
||||
|
||||
Dim random = GetRandom()
|
||||
|
||||
For i As Integer = 0 To passwordLength - 1
|
||||
Dim index = random.[Next](passwordChars.Length)
|
||||
Dim passwordChar = passwordChars(index)
|
||||
|
||||
password(i) = passwordChar
|
||||
Next
|
||||
|
||||
Return New String(password)
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Gets the characters selected by the option
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Private Shared Function GetCharacters(ByVal [option] As RandomPasswordOptions) As String
|
||||
Select Case [option]
|
||||
Case RandomPasswordOptions.Alpha
|
||||
Return PASSWORD_CHARS_Alpha
|
||||
Case RandomPasswordOptions.Numeric
|
||||
Return PASSWORD_CHARS_NUMERIC
|
||||
Case RandomPasswordOptions.AlphaNumeric
|
||||
Return PASSWORD_CHARS_Alpha + PASSWORD_CHARS_NUMERIC
|
||||
Case RandomPasswordOptions.AlphaNumericSpecial
|
||||
Return PASSWORD_CHARS_Alpha + PASSWORD_CHARS_NUMERIC + PASSWORD_CHARS_SPECIAL
|
||||
Case Else
|
||||
Exit Select
|
||||
End Select
|
||||
Return String.Empty
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Gets a random object with a real random seed
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Private Shared Function GetRandom() As Random
|
||||
' Use a 4-byte array to fill it with random bytes and convert it then
|
||||
' to an integer value.
|
||||
Dim randomBytes As Byte() = New Byte(3) {}
|
||||
|
||||
' Generate 4 random bytes.
|
||||
Dim rng As New RNGCryptoServiceProvider()
|
||||
rng.GetBytes(randomBytes)
|
||||
|
||||
' Convert 4 bytes into a 32-bit integer value.
|
||||
Dim seed As Integer = (randomBytes(0) And &H7F) << 24 Or randomBytes(1) << 16 Or randomBytes(2) << 8 Or randomBytes(3)
|
||||
|
||||
' Now, this is real randomization.
|
||||
Return New Random(seed)
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
|
20
Console/CICRadarRConfig/CICRadarRConfig.sln
Normal file
20
Console/CICRadarRConfig/CICRadarRConfig.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}") = "CICRadarRConfig", "CICRadarRConfig\CICRadarRConfig.vbproj", "{698299A4-5778-4EE0-9C46-445A9B66F645}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{698299A4-5778-4EE0-9C46-445A9B66F645}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{698299A4-5778-4EE0-9C46-445A9B66F645}.Debug|x86.Build.0 = Debug|x86
|
||||
{698299A4-5778-4EE0-9C46-445A9B66F645}.Release|x86.ActiveCfg = Release|x86
|
||||
{698299A4-5778-4EE0-9C46-445A9B66F645}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
Console/CICRadarRConfig/CICRadarRConfig.suo
Normal file
BIN
Console/CICRadarRConfig/CICRadarRConfig.suo
Normal file
Binary file not shown.
177
Console/CICRadarRConfig/CICRadarRConfig/CICRadarRConfig.vbproj
Normal file
177
Console/CICRadarRConfig/CICRadarRConfig/CICRadarRConfig.vbproj
Normal file
|
@ -0,0 +1,177 @@
|
|||
<?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)' == '' ">x86</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{698299A4-5778-4EE0-9C46-445A9B66F645}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>CICRadarRConfig.My.MyApplication</StartupObject>
|
||||
<RootNamespace>CICRadarRConfig</RootNamespace>
|
||||
<AssemblyName>CICRadarRConfig</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>CICRadarRConfig.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>CICRadarRConfig.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>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>lock.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Crypto.vb" />
|
||||
<Compile Include="IniFileVb.vb" />
|
||||
<Compile Include="Main.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Main.Designer.vb">
|
||||
<DependentUpon>Main.vb</DependentUpon>
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<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="SmsClass.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Main.resx">
|
||||
<DependentUpon>Main.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<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="app.config" />
|
||||
<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>
|
||||
<ItemGroup>
|
||||
<Content Include="lock.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</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>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory>publish\</PublishUrlHistory>
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
344
Console/CICRadarRConfig/CICRadarRConfig/Crypto.vb
Normal file
344
Console/CICRadarRConfig/CICRadarRConfig/Crypto.vb
Normal file
|
@ -0,0 +1,344 @@
|
|||
Imports System
|
||||
Imports System.IO
|
||||
Imports System.Security.Cryptography
|
||||
|
||||
'
|
||||
' encrypt/decrypt functions
|
||||
' Parameter checks and error handling
|
||||
' are ommited for better readability
|
||||
'
|
||||
|
||||
Public Class EncDec
|
||||
' Encrypt a byte array into a byte array using a key and an IV
|
||||
Public Shared Function Encrypt(ByVal clearData As Byte(), ByVal Key As Byte(), ByVal IV As Byte()) As Byte()
|
||||
' Create a MemoryStream to accept the encrypted bytes
|
||||
Dim ms As New MemoryStream()
|
||||
|
||||
' Create a symmetric algorithm.
|
||||
' We are going to use Rijndael because it is strong and
|
||||
' available on all platforms.
|
||||
' You can use other algorithms, to do so substitute the
|
||||
' next line with something like
|
||||
' TripleDES alg = TripleDES.Create();
|
||||
Dim alg As Rijndael = Rijndael.Create()
|
||||
|
||||
' Now set the key and the IV.
|
||||
' We need the IV (Initialization Vector) because
|
||||
' the algorithm is operating in its default
|
||||
' mode called CBC (Cipher Block Chaining).
|
||||
' The IV is XORed with the first block (8 byte)
|
||||
' of the data before it is encrypted, and then each
|
||||
' encrypted block is XORed with the
|
||||
' following block of plaintext.
|
||||
' This is done to make encryption more secure.
|
||||
|
||||
' There is also a mode called ECB which does not need an IV,
|
||||
' but it is much less secure.
|
||||
alg.Key = Key
|
||||
alg.IV = IV
|
||||
|
||||
' Create a CryptoStream through which we are going to be
|
||||
' pumping our data.
|
||||
' CryptoStreamMode.Write means that we are going to be
|
||||
' writing data to the stream and the output will be written
|
||||
' in the MemoryStream we have provided.
|
||||
Dim cs As New CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write)
|
||||
|
||||
' Write the data and make it do the encryption
|
||||
cs.Write(clearData, 0, clearData.Length)
|
||||
|
||||
' Close the crypto stream (or do FlushFinalBlock).
|
||||
' This will tell it that we have done our encryption and
|
||||
' there is no more data coming in,
|
||||
' and it is now a good time to apply the padding and
|
||||
' finalize the encryption process.
|
||||
cs.Close()
|
||||
|
||||
' Now get the encrypted data from the MemoryStream.
|
||||
' Some people make a mistake of using GetBuffer() here,
|
||||
' which is not the right way.
|
||||
Dim encryptedData As Byte() = ms.ToArray()
|
||||
|
||||
Return encryptedData
|
||||
End Function
|
||||
|
||||
' Encrypt a string into a string using a password
|
||||
' Uses Encrypt(byte[], byte[], byte[])
|
||||
|
||||
Public Shared Function Encrypt(ByVal clearText As String, ByVal Password As String) As String
|
||||
' First we need to turn the input string into a byte array.
|
||||
Dim clearBytes As Byte() = System.Text.Encoding.Unicode.GetBytes(clearText)
|
||||
|
||||
' Then, we need to turn the password into Key and IV
|
||||
' We are using salt to make it harder to guess our key
|
||||
' using a dictionary attack -
|
||||
' trying to guess a password by enumerating all possible words.
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
' Now get the key/IV and do the encryption using the
|
||||
' function that accepts byte arrays.
|
||||
' Using PasswordDeriveBytes object we are first getting
|
||||
' 32 bytes for the Key
|
||||
' (the default Rijndael key length is 256bit = 32bytes)
|
||||
' and then 16 bytes for the IV.
|
||||
' IV should always be the block size, which is by default
|
||||
' 16 bytes (128 bit) for Rijndael.
|
||||
' If you are using DES/TripleDES/RC2 the block size is
|
||||
' 8 bytes and so should be the IV size.
|
||||
' You can also read KeySize/BlockSize properties off
|
||||
' the algorithm to find out the sizes.
|
||||
Dim encryptedData As Byte() = Encrypt(clearBytes, pdb.GetBytes(32), pdb.GetBytes(16))
|
||||
|
||||
' Now we need to turn the resulting byte array into a string.
|
||||
' A common mistake would be to use an Encoding class for that.
|
||||
'It does not work because not all byte values can be
|
||||
' represented by characters.
|
||||
' We are going to be using Base64 encoding that is designed
|
||||
'exactly for what we are trying to do.
|
||||
Return Convert.ToBase64String(encryptedData)
|
||||
|
||||
End Function
|
||||
|
||||
' Encrypt bytes into bytes using a password
|
||||
' Uses Encrypt(byte[], byte[], byte[])
|
||||
|
||||
Public Shared Function Encrypt(ByVal clearData As Byte(), ByVal Password As String) As Byte()
|
||||
' We need to turn the password into Key and IV.
|
||||
' We are using salt to make it harder to guess our key
|
||||
' using a dictionary attack -
|
||||
' trying to guess a password by enumerating all possible words.
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
' Now get the key/IV and do the encryption using the function
|
||||
' that accepts byte arrays.
|
||||
' Using PasswordDeriveBytes object we are first getting
|
||||
' 32 bytes for the Key
|
||||
' (the default Rijndael key length is 256bit = 32bytes)
|
||||
' and then 16 bytes for the IV.
|
||||
' IV should always be the block size, which is by default
|
||||
' 16 bytes (128 bit) for Rijndael.
|
||||
' If you are using DES/TripleDES/RC2 the block size is 8
|
||||
' bytes and so should be the IV size.
|
||||
' You can also read KeySize/BlockSize properties off the
|
||||
' algorithm to find out the sizes.
|
||||
Return Encrypt(clearData, pdb.GetBytes(32), pdb.GetBytes(16))
|
||||
|
||||
End Function
|
||||
|
||||
' Encrypt a file into another file using a password
|
||||
Public Shared Sub Encrypt(ByVal fileIn As String, ByVal fileOut As String, ByVal Password As String)
|
||||
|
||||
' First we are going to open the file streams
|
||||
Dim fsIn As New FileStream(fileIn, FileMode.Open, FileAccess.Read)
|
||||
Dim fsOut As New FileStream(fileOut, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
|
||||
' Then we are going to derive a Key and an IV from the
|
||||
' Password and create an algorithm
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
Dim alg As Rijndael = Rijndael.Create()
|
||||
alg.Key = pdb.GetBytes(32)
|
||||
alg.IV = pdb.GetBytes(16)
|
||||
|
||||
' Now create a crypto stream through which we are going
|
||||
' to be pumping data.
|
||||
' Our fileOut is going to be receiving the encrypted bytes.
|
||||
Dim cs As New CryptoStream(fsOut, alg.CreateEncryptor(), CryptoStreamMode.Write)
|
||||
|
||||
' Now will will initialize a buffer and will be processing
|
||||
' the input file in chunks.
|
||||
' This is done to avoid reading the whole file (which can
|
||||
' be huge) into memory.
|
||||
Dim bufferLen As Integer = 4096
|
||||
Dim buffer As Byte() = New Byte(bufferLen - 1) {}
|
||||
Dim bytesRead As Integer
|
||||
|
||||
Do
|
||||
' read a chunk of data from the input file
|
||||
bytesRead = fsIn.Read(buffer, 0, bufferLen)
|
||||
|
||||
' encrypt it
|
||||
cs.Write(buffer, 0, bytesRead)
|
||||
Loop While bytesRead <> 0
|
||||
|
||||
' close everything
|
||||
|
||||
' this will also close the unrelying fsOut stream
|
||||
cs.Close()
|
||||
fsIn.Close()
|
||||
End Sub
|
||||
|
||||
' Decrypt a byte array into a byte array using a key and an IV
|
||||
Public Shared Function Decrypt(ByVal cipherData As Byte(), ByVal Key As Byte(), ByVal IV As Byte()) As Byte()
|
||||
' Create a MemoryStream that is going to accept the
|
||||
' decrypted bytes
|
||||
Dim ms As New MemoryStream()
|
||||
|
||||
' Create a symmetric algorithm.
|
||||
' We are going to use Rijndael because it is strong and
|
||||
' available on all platforms.
|
||||
' You can use other algorithms, to do so substitute the next
|
||||
' line with something like
|
||||
' TripleDES alg = TripleDES.Create();
|
||||
Dim alg As Rijndael = Rijndael.Create()
|
||||
|
||||
' Now set the key and the IV.
|
||||
' We need the IV (Initialization Vector) because the algorithm
|
||||
' is operating in its default
|
||||
' mode called CBC (Cipher Block Chaining). The IV is XORed with
|
||||
' the first block (8 byte)
|
||||
' of the data after it is decrypted, and then each decrypted
|
||||
' block is XORed with the previous
|
||||
' cipher block. This is done to make encryption more secure.
|
||||
' There is also a mode called ECB which does not need an IV,
|
||||
' but it is much less secure.
|
||||
alg.Key = Key
|
||||
alg.IV = IV
|
||||
|
||||
' Create a CryptoStream through which we are going to be
|
||||
' pumping our data.
|
||||
' CryptoStreamMode.Write means that we are going to be
|
||||
' writing data to the stream
|
||||
' and the output will be written in the MemoryStream
|
||||
' we have provided.
|
||||
Dim cs As New CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write)
|
||||
|
||||
' Write the data and make it do the decryption
|
||||
cs.Write(cipherData, 0, cipherData.Length)
|
||||
|
||||
' Close the crypto stream (or do FlushFinalBlock).
|
||||
' This will tell it that we have done our decryption
|
||||
' and there is no more data coming in,
|
||||
' and it is now a good time to remove the padding
|
||||
' and finalize the decryption process.
|
||||
cs.Close()
|
||||
|
||||
' Now get the decrypted data from the MemoryStream.
|
||||
' Some people make a mistake of using GetBuffer() here,
|
||||
' which is not the right way.
|
||||
Dim decryptedData As Byte() = ms.ToArray()
|
||||
|
||||
Return decryptedData
|
||||
End Function
|
||||
|
||||
' Decrypt a string into a string using a password
|
||||
' Uses Decrypt(byte[], byte[], byte[])
|
||||
|
||||
Public Shared Function Decrypt(ByVal cipherText As String, ByVal Password As String) As String
|
||||
' First we need to turn the input string into a byte array.
|
||||
' We presume that Base64 encoding was used
|
||||
Dim cipherBytes As Byte() = Convert.FromBase64String(cipherText)
|
||||
|
||||
' Then, we need to turn the password into Key and IV
|
||||
' We are using salt to make it harder to guess our key
|
||||
' using a dictionary attack -
|
||||
' trying to guess a password by enumerating all possible words.
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
' Now get the key/IV and do the decryption using
|
||||
' the function that accepts byte arrays.
|
||||
' Using PasswordDeriveBytes object we are first
|
||||
' getting 32 bytes for the Key
|
||||
' (the default Rijndael key length is 256bit = 32bytes)
|
||||
' and then 16 bytes for the IV.
|
||||
' IV should always be the block size, which is by
|
||||
' default 16 bytes (128 bit) for Rijndael.
|
||||
' If you are using DES/TripleDES/RC2 the block size is
|
||||
' 8 bytes and so should be the IV size.
|
||||
' You can also read KeySize/BlockSize properties off
|
||||
' the algorithm to find out the sizes.
|
||||
Dim decryptedData As Byte() = Decrypt(cipherBytes, pdb.GetBytes(32), pdb.GetBytes(16))
|
||||
|
||||
' Now we need to turn the resulting byte array into a string.
|
||||
' A common mistake would be to use an Encoding class for that.
|
||||
' It does not work
|
||||
' because not all byte values can be represented by characters.
|
||||
' We are going to be using Base64 encoding that is
|
||||
' designed exactly for what we are trying to do.
|
||||
Return System.Text.Encoding.Unicode.GetString(decryptedData)
|
||||
End Function
|
||||
|
||||
' Decrypt bytes into bytes using a password
|
||||
' Uses Decrypt(byte[], byte[], byte[])
|
||||
|
||||
Public Shared Function Decrypt(ByVal cipherData As Byte(), ByVal Password As String) As Byte()
|
||||
' We need to turn the password into Key and IV.
|
||||
' We are using salt to make it harder to guess our key
|
||||
' using a dictionary attack -
|
||||
' trying to guess a password by enumerating all possible words.
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
|
||||
' Now get the key/IV and do the Decryption using the
|
||||
'function that accepts byte arrays.
|
||||
' Using PasswordDeriveBytes object we are first getting
|
||||
' 32 bytes for the Key
|
||||
' (the default Rijndael key length is 256bit = 32bytes)
|
||||
' and then 16 bytes for the IV.
|
||||
' IV should always be the block size, which is by default
|
||||
' 16 bytes (128 bit) for Rijndael.
|
||||
' If you are using DES/TripleDES/RC2 the block size is
|
||||
' 8 bytes and so should be the IV size.
|
||||
|
||||
' You can also read KeySize/BlockSize properties off the
|
||||
' algorithm to find out the sizes.
|
||||
Return Decrypt(cipherData, pdb.GetBytes(32), pdb.GetBytes(16))
|
||||
End Function
|
||||
|
||||
' Decrypt a file into another file using a password
|
||||
Public Shared Sub Decrypt(ByVal fileIn As String, ByVal fileOut As String, ByVal Password As String)
|
||||
|
||||
' First we are going to open the file streams
|
||||
Dim fsIn As New FileStream(fileIn, FileMode.Open, FileAccess.Read)
|
||||
Dim fsOut As New FileStream(fileOut, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
|
||||
' Then we are going to derive a Key and an IV from
|
||||
' the Password and create an algorithm
|
||||
Dim pdb As New PasswordDeriveBytes(Password, New Byte() {&H49, &H76, &H61, &H6E, &H20, &H4D, _
|
||||
&H65, &H64, &H76, &H65, &H64, &H65, _
|
||||
&H76})
|
||||
Dim alg As Rijndael = Rijndael.Create()
|
||||
|
||||
alg.Key = pdb.GetBytes(32)
|
||||
alg.IV = pdb.GetBytes(16)
|
||||
|
||||
' Now create a crypto stream through which we are going
|
||||
' to be pumping data.
|
||||
' Our fileOut is going to be receiving the Decrypted bytes.
|
||||
Dim cs As New CryptoStream(fsOut, alg.CreateDecryptor(), CryptoStreamMode.Write)
|
||||
|
||||
' Now will will initialize a buffer and will be
|
||||
' processing the input file in chunks.
|
||||
' This is done to avoid reading the whole file (which can be
|
||||
' huge) into memory.
|
||||
Dim bufferLen As Integer = 4096
|
||||
Dim buffer As Byte() = New Byte(bufferLen - 1) {}
|
||||
Dim bytesRead As Integer
|
||||
|
||||
Do
|
||||
' read a chunk of data from the input file
|
||||
bytesRead = fsIn.Read(buffer, 0, bufferLen)
|
||||
|
||||
' Decrypt it
|
||||
|
||||
cs.Write(buffer, 0, bytesRead)
|
||||
Loop While bytesRead <> 0
|
||||
|
||||
' close everything
|
||||
cs.Close()
|
||||
' this will also close the unrelying fsOut stream
|
||||
fsIn.Close()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
|
376
Console/CICRadarRConfig/CICRadarRConfig/IniFileVb.vb
Normal file
376
Console/CICRadarRConfig/CICRadarRConfig/IniFileVb.vb
Normal file
|
@ -0,0 +1,376 @@
|
|||
' Programmer: Ludvik Jerabek
|
||||
' Date: 08\23\2010
|
||||
' Purpose: Allow INI manipulation in .NET
|
||||
|
||||
Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Collections
|
||||
Imports System.Diagnostics
|
||||
|
||||
' IniFile class used to read and write ini files by loading the file into memory
|
||||
Public Class IniFile
|
||||
' List of IniSection objects keeps track of all the sections in the INI file
|
||||
Private m_sections As Hashtable
|
||||
|
||||
' Public constructor
|
||||
Public Sub New()
|
||||
m_sections = New Hashtable(StringComparer.InvariantCultureIgnoreCase)
|
||||
End Sub
|
||||
|
||||
' Loads the Reads the data in the ini file into the IniFile object
|
||||
Public Sub Load(ByVal sFileName As String, Optional ByVal bMerge As Boolean = False)
|
||||
If Not bMerge Then
|
||||
RemoveAllSections()
|
||||
End If
|
||||
' Clear the object...
|
||||
Dim tempsection As IniSection = Nothing
|
||||
Dim oReader As New StreamReader(sFileName)
|
||||
Dim regexcomment As New Regex("^([\s]*#.*)", (RegexOptions.Singleline Or RegexOptions.IgnoreCase))
|
||||
' Broken but left for history
|
||||
'Dim regexsection As New Regex("\[[\s]*([^\[\s].*[^\s\]])[\s]*\]", (RegexOptions.Singleline Or RegexOptions.IgnoreCase))
|
||||
Dim regexsection As New Regex("^[\s]*\[[\s]*([^\[\s].*[^\s\]])[\s]*\][\s]*$", (RegexOptions.Singleline Or RegexOptions.IgnoreCase))
|
||||
Dim regexkey As New Regex("^\s*([^=\s]*)[^=]*=(.*)", (RegexOptions.Singleline Or RegexOptions.IgnoreCase))
|
||||
While Not oReader.EndOfStream
|
||||
Dim line As String = oReader.ReadLine()
|
||||
If line <> String.Empty Then
|
||||
Dim m As Match = Nothing
|
||||
If regexcomment.Match(line).Success Then
|
||||
m = regexcomment.Match(line)
|
||||
Trace.WriteLine(String.Format("Skipping Comment: {0}", m.Groups(0).Value))
|
||||
ElseIf regexsection.Match(line).Success Then
|
||||
m = regexsection.Match(line)
|
||||
Trace.WriteLine(String.Format("Adding section [{0}]", m.Groups(1).Value))
|
||||
tempsection = AddSection(m.Groups(1).Value)
|
||||
ElseIf regexkey.Match(line).Success AndAlso tempsection IsNot Nothing Then
|
||||
m = regexkey.Match(line)
|
||||
Trace.WriteLine(String.Format("Adding Key [{0}]=[{1}]", m.Groups(1).Value, m.Groups(2).Value))
|
||||
tempsection.AddKey(m.Groups(1).Value).Value = m.Groups(2).Value
|
||||
ElseIf tempsection IsNot Nothing Then
|
||||
' Handle Key without value
|
||||
Trace.WriteLine(String.Format("Adding Key [{0}]", line))
|
||||
tempsection.AddKey(line)
|
||||
Else
|
||||
' This should not occur unless the tempsection is not created yet...
|
||||
Trace.WriteLine(String.Format("Skipping unknown type of data: {0}", line))
|
||||
End If
|
||||
End If
|
||||
End While
|
||||
oReader.Close()
|
||||
End Sub
|
||||
|
||||
' Used to save the data back to the file or your choice
|
||||
Public Sub Save(ByVal sFileName As String)
|
||||
Dim oWriter As New StreamWriter(sFileName, False)
|
||||
For Each s As IniSection In Sections
|
||||
Trace.WriteLine(String.Format("Writing Section: [{0}]", s.Name))
|
||||
oWriter.WriteLine(String.Format("[{0}]", s.Name))
|
||||
For Each k As IniSection.IniKey In s.Keys
|
||||
If k.Value <> String.Empty Then
|
||||
Trace.WriteLine(String.Format("Writing Key: {0}={1}", k.Name, k.Value))
|
||||
oWriter.WriteLine(String.Format("{0}={1}", k.Name, k.Value))
|
||||
Else
|
||||
Trace.WriteLine(String.Format("Writing Key: {0}", k.Name))
|
||||
oWriter.WriteLine(String.Format("{0}", k.Name))
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
oWriter.Close()
|
||||
End Sub
|
||||
|
||||
' Gets all the sections
|
||||
Public ReadOnly Property Sections() As System.Collections.ICollection
|
||||
Get
|
||||
Return m_sections.Values
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Adds a section to the IniFile object, returns a IniSection object to the new or existing object
|
||||
Public Function AddSection(ByVal sSection As String) As IniSection
|
||||
Dim s As IniSection = Nothing
|
||||
sSection = sSection.Trim()
|
||||
' Trim spaces
|
||||
If m_sections.ContainsKey(sSection) Then
|
||||
s = DirectCast(m_sections(sSection), IniSection)
|
||||
Else
|
||||
s = New IniSection(Me, sSection)
|
||||
m_sections(sSection) = s
|
||||
End If
|
||||
Return s
|
||||
End Function
|
||||
|
||||
' Removes a section by its name sSection, returns trus on success
|
||||
Public Function RemoveSection(ByVal sSection As String) As Boolean
|
||||
sSection = sSection.Trim()
|
||||
Return RemoveSection(GetSection(sSection))
|
||||
End Function
|
||||
|
||||
' Removes section by object, returns trus on success
|
||||
Public Function RemoveSection(ByVal Section As IniSection) As Boolean
|
||||
If Section IsNot Nothing Then
|
||||
Try
|
||||
m_sections.Remove(Section.Name)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Trace.WriteLine(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Removes all existing sections, returns trus on success
|
||||
Public Function RemoveAllSections() As Boolean
|
||||
m_sections.Clear()
|
||||
Return (m_sections.Count = 0)
|
||||
End Function
|
||||
|
||||
' Returns an IniSection to the section by name, NULL if it was not found
|
||||
Public Function GetSection(ByVal sSection As String) As IniSection
|
||||
sSection = sSection.Trim()
|
||||
' Trim spaces
|
||||
If m_sections.ContainsKey(sSection) Then
|
||||
Return DirectCast(m_sections(sSection), IniSection)
|
||||
End If
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
' Returns a KeyValue in a certain section
|
||||
Public Function GetKeyValue(ByVal sSection As String, ByVal sKey As String) As String
|
||||
Dim s As IniSection = GetSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
Dim k As IniSection.IniKey = s.GetKey(sKey)
|
||||
If k IsNot Nothing Then
|
||||
Return k.Value
|
||||
End If
|
||||
End If
|
||||
Return String.Empty
|
||||
End Function
|
||||
|
||||
' Sets a KeyValuePair in a certain section
|
||||
Public Function SetKeyValue(ByVal sSection As String, ByVal sKey As String, ByVal sValue As String) As Boolean
|
||||
Dim s As IniSection = AddSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
Dim k As IniSection.IniKey = s.AddKey(sKey)
|
||||
If k IsNot Nothing Then
|
||||
k.Value = sValue
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Renames an existing section returns true on success, false if the section didn't exist or there was another section with the same sNewSection
|
||||
Public Function RenameSection(ByVal sSection As String, ByVal sNewSection As String) As Boolean
|
||||
' Note string trims are done in lower calls.
|
||||
Dim bRval As Boolean = False
|
||||
Dim s As IniSection = GetSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
bRval = s.SetName(sNewSection)
|
||||
End If
|
||||
Return bRval
|
||||
End Function
|
||||
|
||||
' Renames an existing key returns true on success, false if the key didn't exist or there was another section with the same sNewKey
|
||||
Public Function RenameKey(ByVal sSection As String, ByVal sKey As String, ByVal sNewKey As String) As Boolean
|
||||
' Note string trims are done in lower calls.
|
||||
Dim s As IniSection = GetSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
Dim k As IniSection.IniKey = s.GetKey(sKey)
|
||||
If k IsNot Nothing Then
|
||||
Return k.SetName(sNewKey)
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Remove a key by section name and key name
|
||||
Public Function RemoveKey(ByVal sSection As String, ByVal sKey As String) As Boolean
|
||||
Dim s As IniSection = GetSection(sSection)
|
||||
If s IsNot Nothing Then
|
||||
Return s.RemoveKey(sKey)
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' IniSection class
|
||||
Public Class IniSection
|
||||
' IniFile IniFile object instance
|
||||
Private m_pIniFile As IniFile
|
||||
' Name of the section
|
||||
Private m_sSection As String
|
||||
' List of IniKeys in the section
|
||||
Private m_keys As Hashtable
|
||||
|
||||
' Constuctor so objects are internally managed
|
||||
Protected Friend Sub New(ByVal parent As IniFile, ByVal sSection As String)
|
||||
m_pIniFile = parent
|
||||
m_sSection = sSection
|
||||
m_keys = New Hashtable(StringComparer.InvariantCultureIgnoreCase)
|
||||
End Sub
|
||||
|
||||
' Returns all the keys in a section
|
||||
Public ReadOnly Property Keys() As System.Collections.ICollection
|
||||
Get
|
||||
Return m_keys.Values
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Returns the section name
|
||||
Public ReadOnly Property Name() As String
|
||||
Get
|
||||
Return m_sSection
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Adds a key to the IniSection object, returns a IniKey object to the new or existing object
|
||||
Public Function AddKey(ByVal sKey As String) As IniKey
|
||||
sKey = sKey.Trim()
|
||||
Dim k As IniSection.IniKey = Nothing
|
||||
If sKey.Length <> 0 Then
|
||||
If m_keys.ContainsKey(sKey) Then
|
||||
k = DirectCast(m_keys(sKey), IniKey)
|
||||
Else
|
||||
k = New IniSection.IniKey(Me, sKey)
|
||||
m_keys(sKey) = k
|
||||
End If
|
||||
End If
|
||||
Return k
|
||||
End Function
|
||||
|
||||
' Removes a single key by string
|
||||
Public Function RemoveKey(ByVal sKey As String) As Boolean
|
||||
Return RemoveKey(GetKey(sKey))
|
||||
End Function
|
||||
|
||||
' Removes a single key by IniKey object
|
||||
Public Function RemoveKey(ByVal Key As IniKey) As Boolean
|
||||
If Key IsNot Nothing Then
|
||||
Try
|
||||
m_keys.Remove(Key.Name)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Trace.WriteLine(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Removes all the keys in the section
|
||||
Public Function RemoveAllKeys() As Boolean
|
||||
m_keys.Clear()
|
||||
Return (m_keys.Count = 0)
|
||||
End Function
|
||||
|
||||
' Returns a IniKey object to the key by name, NULL if it was not found
|
||||
Public Function GetKey(ByVal sKey As String) As IniKey
|
||||
sKey = sKey.Trim()
|
||||
If m_keys.ContainsKey(sKey) Then
|
||||
Return DirectCast(m_keys(sKey), IniKey)
|
||||
End If
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
' Sets the section name, returns true on success, fails if the section
|
||||
' name sSection already exists
|
||||
Public Function SetName(ByVal sSection As String) As Boolean
|
||||
sSection = sSection.Trim()
|
||||
If sSection.Length <> 0 Then
|
||||
' Get existing section if it even exists...
|
||||
Dim s As IniSection = m_pIniFile.GetSection(sSection)
|
||||
If s IsNot Me AndAlso s IsNot Nothing Then
|
||||
Return False
|
||||
End If
|
||||
Try
|
||||
' Remove the current section
|
||||
m_pIniFile.m_sections.Remove(m_sSection)
|
||||
' Set the new section name to this object
|
||||
m_pIniFile.m_sections(sSection) = Me
|
||||
' Set the new section name
|
||||
m_sSection = sSection
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Trace.WriteLine(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Returns the section name
|
||||
Public Function GetName() As String
|
||||
Return m_sSection
|
||||
End Function
|
||||
|
||||
' IniKey class
|
||||
Public Class IniKey
|
||||
' Name of the Key
|
||||
Private m_sKey As String
|
||||
' Value associated
|
||||
Private m_sValue As String
|
||||
' Pointer to the parent CIniSection
|
||||
Private m_section As IniSection
|
||||
|
||||
' Constuctor so objects are internally managed
|
||||
Protected Friend Sub New(ByVal parent As IniSection, ByVal sKey As String)
|
||||
m_section = parent
|
||||
m_sKey = sKey
|
||||
End Sub
|
||||
|
||||
' Returns the name of the Key
|
||||
Public ReadOnly Property Name() As String
|
||||
Get
|
||||
Return m_sKey
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Sets or Gets the value of the key
|
||||
Public Property Value() As String
|
||||
Get
|
||||
Return m_sValue
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
m_sValue = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Sets the value of the key
|
||||
Public Sub SetValue(ByVal sValue As String)
|
||||
m_sValue = sValue
|
||||
End Sub
|
||||
' Returns the value of the Key
|
||||
Public Function GetValue() As String
|
||||
Return m_sValue
|
||||
End Function
|
||||
|
||||
' Sets the key name
|
||||
' Returns true on success, fails if the section name sKey already exists
|
||||
Public Function SetName(ByVal sKey As String) As Boolean
|
||||
sKey = sKey.Trim()
|
||||
If sKey.Length <> 0 Then
|
||||
Dim k As IniKey = m_section.GetKey(sKey)
|
||||
If k IsNot Me AndAlso k IsNot Nothing Then
|
||||
Return False
|
||||
End If
|
||||
Try
|
||||
' Remove the current key
|
||||
m_section.m_keys.Remove(m_sKey)
|
||||
' Set the new key name to this object
|
||||
m_section.m_keys(sKey) = Me
|
||||
' Set the new key name
|
||||
m_sKey = sKey
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Trace.WriteLine(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' Returns the name of the Key
|
||||
Public Function GetName() As String
|
||||
Return m_sKey
|
||||
End Function
|
||||
End Class
|
||||
' End of IniKey class
|
||||
End Class
|
||||
' End of IniSection class
|
||||
End Class
|
||||
' End of IniFile class
|
1048
Console/CICRadarRConfig/CICRadarRConfig/Main.Designer.vb
generated
Normal file
1048
Console/CICRadarRConfig/CICRadarRConfig/Main.Designer.vb
generated
Normal file
File diff suppressed because it is too large
Load diff
1254
Console/CICRadarRConfig/CICRadarRConfig/Main.resx
Normal file
1254
Console/CICRadarRConfig/CICRadarRConfig/Main.resx
Normal file
File diff suppressed because it is too large
Load diff
529
Console/CICRadarRConfig/CICRadarRConfig/Main.vb
Normal file
529
Console/CICRadarRConfig/CICRadarRConfig/Main.vb
Normal file
|
@ -0,0 +1,529 @@
|
|||
Imports CICRadarRConfig.SMS
|
||||
Imports System.ServiceProcess
|
||||
Imports System.IO
|
||||
Imports System.Net.Mail
|
||||
Public Class CICRadiusRConfig
|
||||
Private ConfigFile As New IniFile
|
||||
Private encCode As String = "gewsyy#sjs2!"
|
||||
Private Sub CICRadiusRConfig_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||||
Me.Height = 440
|
||||
Me.Width = 620
|
||||
|
||||
|
||||
PanelSetup.Location = New Point(136, 27)
|
||||
PanelSetup.Height = 357
|
||||
PanelSetup.Width = 470
|
||||
|
||||
PanelActiveDirectory.Location = New Point(136, 27)
|
||||
PanelActiveDirectory.Height = 357
|
||||
PanelActiveDirectory.Width = 470
|
||||
|
||||
PanelRadiusClients.Location = New Point(136, 27)
|
||||
PanelRadiusClients.Height = 357
|
||||
PanelRadiusClients.Width = 470
|
||||
|
||||
PanelSMSSetup.Location = New Point(136, 27)
|
||||
PanelSMSSetup.Height = 357
|
||||
PanelSMSSetup.Width = 470
|
||||
|
||||
PanelMailSetup.Location = New Point(136, 27)
|
||||
PanelMailSetup.Height = 357
|
||||
PanelMailSetup.Width = 470
|
||||
Try
|
||||
ConfigFile.Load(Application.StartupPath & "\CICRadarR.ini")
|
||||
txtNetBios.Text = ConfigFile.GetKeyValue("CICRadarR", "NetBiosDomain")
|
||||
txtLdapDomain.Text = ConfigFile.GetKeyValue("CICRadarR", "LDAPDomain")
|
||||
txtProvider.Text = ConfigFile.GetKeyValue("CICRadarR", "Provider")
|
||||
txtADField.Text = ConfigFile.GetKeyValue("CICRadarR", "ADField")
|
||||
txtADMailField.Text = ConfigFile.GetKeyValue("CICRadarR", "ADMailField")
|
||||
Dim ModemType As String
|
||||
ModemType = ConfigFile.GetKeyValue("CICRadarR", "USELOCALMODEM")
|
||||
If ModemType = "1" Then
|
||||
rbLocalSMS.Checked = True
|
||||
Else
|
||||
rbLocalSMS.Checked = False
|
||||
End If
|
||||
|
||||
Dim EnableOTP As String
|
||||
EnableOTP = ConfigFile.GetKeyValue("CICRadarR", "EnableOTP")
|
||||
If EnableOTP = "1" Then
|
||||
ckEnableOTP.Checked = True
|
||||
Dim EnableSMS As String
|
||||
Dim EnableEmail As String
|
||||
EnableSMS = ConfigFile.GetKeyValue("CICRadarR", "EnableSMS")
|
||||
EnableEmail = ConfigFile.GetKeyValue("CICRadarR", "EnableEmail")
|
||||
If EnableEmail = "1" Then
|
||||
ckEnableMail.Checked = True
|
||||
Else
|
||||
TestMailConfigurationToolStripMenuItem.Enabled = False
|
||||
lvConfig.Items.Item(3).ImageIndex = 6
|
||||
ckEnableMail.Checked = False
|
||||
|
||||
End If
|
||||
|
||||
If EnableSMS = "1" Then
|
||||
ckEnableSMS.Checked = True
|
||||
Else
|
||||
lvConfig.Items.Item(2).ImageIndex = 5
|
||||
ckEnableSMS.Checked = False
|
||||
TestModemConfigurationToolStripMenuItem.Enabled = False
|
||||
End If
|
||||
Else
|
||||
lvConfig.Items.Item(2).ImageIndex = 5
|
||||
lvConfig.Items.Item(3).ImageIndex = 6
|
||||
TestMailConfigurationToolStripMenuItem.Enabled = False
|
||||
TestModemConfigurationToolStripMenuItem.Enabled = False
|
||||
ckEnableSMS.Checked = False
|
||||
ckEnableMail.Checked = False
|
||||
ckEnableOTP.Checked = False
|
||||
End If
|
||||
|
||||
txtMailServer.Text = ConfigFile.GetKeyValue("CICRadarR", "MailServer")
|
||||
txtSenderEmail.Text = ConfigFile.GetKeyValue("CICRadarR", "SenderEmail")
|
||||
|
||||
txtComPort.Text = ConfigFile.GetKeyValue("CICRadarR", "COMPORT")
|
||||
txtSMSC.Text = ConfigFile.GetKeyValue("CICRadarR", "SMSC")
|
||||
Dim Debug As String
|
||||
Debug = ConfigFile.GetKeyValue("CICRadarR", "Debug")
|
||||
If Debug = "1" Then
|
||||
ckDebug.Checked = True
|
||||
Else
|
||||
ckDebug.Checked = False
|
||||
End If
|
||||
|
||||
Dim RDGateway As String
|
||||
RDGateway = ConfigFile.GetKeyValue("CICRadarR", "TSGW")
|
||||
If RDGateway = "1" Then
|
||||
rbRDGateway.Checked = True
|
||||
rbCitrixNetscaler.Checked = False
|
||||
Else
|
||||
rbRDGateway.Checked = False
|
||||
rbCitrixNetscaler.Checked = True
|
||||
End If
|
||||
|
||||
Dim ClientList() As String
|
||||
ClientList = Split(ConfigFile.GetKeyValue("CICRadarR", "ClientList"), ",")
|
||||
|
||||
For i As Integer = 0 To ClientList.Length - 1
|
||||
ListClients.Items.Add(ClientList(i) & " ( " & ConfigFile.GetKeyValue("Clients", ClientList(i)) & " )")
|
||||
Next
|
||||
|
||||
|
||||
|
||||
|
||||
Catch
|
||||
End Try
|
||||
|
||||
Dim tt As New ToolTip()
|
||||
|
||||
tt.ShowAlways = True
|
||||
|
||||
tt.SetToolTip(txtADField, "Type the Active Directory field where phonenumbers are stored." & vbCrLf & "Ex: mobile or telephoneNumber" & vbCrLf & "Use Adsiedit.msc to find the correct field.")
|
||||
tt.SetToolTip(txtSMSC, "See http://smsclist.com/downloads/default.txt for your provider" & vbCrLf & "Ex: +4540390999")
|
||||
tt.SetToolTip(txtComPort, "Ex: com1")
|
||||
tt.SetToolTip(txtProvider, "Type the https address of your SMS provider." & vbCrLf & "Replace the message field of the url with ***TEXTMESSAGE***" & vbCrLf & "Replace the recipient field of the url with ***NUMBER***" & vbCrLf & "Ex: https://www.cpsms.dk/sms/?username=myuser&password=mypassword&recipient=***NUMBER***&message=&from=CPSMS")
|
||||
tt.SetToolTip(txtNetBios, "Set NetBios Domain name" & vbCrLf & "Ex: MYDOMAIN")
|
||||
tt.SetToolTip(txtLdapDomain, "Set LDAP Domain" & vbCrLf & "Ex: test.lan")
|
||||
tt.SetToolTip(ckEnableOTP, "Enable SMS Magic.")
|
||||
|
||||
ToolStripStatusLabel1.Text = "Status: " & "Configuration loaded"
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub btnRemoveClient_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
||||
If ListClients.SelectedIndex > -1 Then
|
||||
|
||||
ListClients.Items.RemoveAt(ListClients.SelectedIndex)
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btnAddClient_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
||||
If Not ListClients.Items.Contains(txtClient.Text & " ( " & EncDec.Encrypt(txtSecret.Text, encCode) & " )") Then
|
||||
ListClients.Items.Add(txtClient.Text & " ( " & EncDec.Encrypt(txtSecret.Text, encCode) & " )")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub btnRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestart.Click
|
||||
Dim ok As MsgBoxResult
|
||||
btnRestart.Enabled = False
|
||||
ok = MsgBox("Restart CICRadiusR Service?", MsgBoxStyle.YesNo, "Restart Service")
|
||||
If ok = vbYes Then
|
||||
ToolStripStatusLabel1.Text = "Status: " & "Radius server restarting..."
|
||||
Dim controller As New ServiceController("CICRadiusR")
|
||||
controller.Stop()
|
||||
controller.WaitForStatus(ServiceControllerStatus.Stopped)
|
||||
ToolStripStatusLabel1.Text = "Status: " & "Radius server stopped"
|
||||
controller.Start()
|
||||
controller.WaitForStatus(ServiceControllerStatus.Running)
|
||||
ToolStripStatusLabel1.Text = "Status: " & "Radius server started"
|
||||
MsgBox("CICRadiusR Service restarted", MsgBoxStyle.Information, "Information")
|
||||
End If
|
||||
btnRestart.Enabled = True
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub lvConfig_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lvConfig.SelectedIndexChanged
|
||||
Dim ele As ListViewItem
|
||||
If lvConfig.SelectedIndices.Count > 0 Then
|
||||
Select lvConfig.SelectedItems(0).Text.ToUpper
|
||||
|
||||
Case "SETUP"
|
||||
PanelSetup.Visible = True
|
||||
PanelActiveDirectory.Visible = False
|
||||
PanelSMSSetup.Visible = False
|
||||
PanelMailSetup.Visible = False
|
||||
PanelRadiusClients.Visible = False
|
||||
Case "ACTIVE DIRECTORY"
|
||||
PanelSetup.Visible = False
|
||||
PanelActiveDirectory.Visible = True
|
||||
PanelSMSSetup.Visible = False
|
||||
PanelMailSetup.Visible = False
|
||||
PanelRadiusClients.Visible = False
|
||||
Case "SMS SETUP"
|
||||
If ckEnableSMS.Checked = True Then
|
||||
PanelSetup.Visible = False
|
||||
PanelActiveDirectory.Visible = False
|
||||
PanelSMSSetup.Visible = True
|
||||
PanelMailSetup.Visible = False
|
||||
PanelRadiusClients.Visible = False
|
||||
End If
|
||||
Case "MAIL SETUP"
|
||||
If ckEnableMail.Checked = True Then
|
||||
PanelSetup.Visible = False
|
||||
PanelActiveDirectory.Visible = False
|
||||
PanelSMSSetup.Visible = False
|
||||
PanelMailSetup.Visible = True
|
||||
PanelRadiusClients.Visible = False
|
||||
End If
|
||||
Case "RADIUS CLIENTS"
|
||||
PanelSetup.Visible = False
|
||||
PanelActiveDirectory.Visible = False
|
||||
PanelSMSSetup.Visible = False
|
||||
PanelMailSetup.Visible = False
|
||||
PanelRadiusClients.Visible = True
|
||||
Panel1.AutoScrollPosition = New Point(0, 130)
|
||||
End Select
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub rbRDGateway_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbRDGateway.CheckedChanged
|
||||
If rbRDGateway.Checked = True Then
|
||||
rbCitrixNetscaler.Checked = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub rbCitrixNetscaler_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbCitrixNetscaler.CheckedChanged
|
||||
If rbCitrixNetscaler.Checked = True Then
|
||||
rbRDGateway.Checked = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub rbOnlineSMS_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbOnlineSMS.CheckedChanged
|
||||
If rbOnlineSMS.Checked = True Then
|
||||
rbLocalSMS.Checked = False
|
||||
txtComPort.Enabled = False
|
||||
txtSMSC.Enabled = False
|
||||
txtProvider.Enabled = True
|
||||
txtSMSC.BackColor = Color.White
|
||||
txtComPort.BackColor = Color.White
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub rbLocalSMS_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbLocalSMS.CheckedChanged
|
||||
If rbLocalSMS.Checked = True Then
|
||||
rbOnlineSMS.Checked = False
|
||||
txtComPort.Enabled = True
|
||||
txtSMSC.Enabled = True
|
||||
txtProvider.Enabled = False
|
||||
txtProvider.BackColor = Color.White
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub btnTestModem_Click(sender As System.Object, e As System.EventArgs) Handles btnTestModem.Click
|
||||
Call TestModem()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub ckEnableOTP_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles ckEnableOTP.CheckedChanged
|
||||
If ckEnableOTP.Checked = True Then
|
||||
ckEnableMail.Enabled = True
|
||||
ckEnableSMS.Enabled = True
|
||||
'If ckEnableSMS.Checked = True Then
|
||||
' lvConfig.Items.Item(2).ImageIndex = 2
|
||||
'Else
|
||||
' lvConfig.Items.Item(2).ImageIndex = 5
|
||||
'End If
|
||||
'If ckEnableMail.Checked = True Then
|
||||
' lvConfig.Items.Item(3).ImageIndex = 3
|
||||
'Else
|
||||
' lvConfig.Items.Item(3).ImageIndex = 6
|
||||
'End If
|
||||
|
||||
'txtADField.Enabled = True
|
||||
'txtComPort.Enabled = True
|
||||
'txtSMSC.Enabled = True
|
||||
'If rbLocalSMS.Checked = True Then
|
||||
' txtComPort.Enabled = True
|
||||
' txtSMSC.Enabled = True
|
||||
' txtProvider.Enabled = False
|
||||
|
||||
'Else
|
||||
' txtComPort.Enabled = False
|
||||
' txtSMSC.Enabled = False
|
||||
' txtProvider.Enabled = True
|
||||
|
||||
'End If
|
||||
'btnTestModem.Enabled = True
|
||||
Else
|
||||
ckEnableMail.Enabled = False
|
||||
ckEnableSMS.Enabled = False
|
||||
lvConfig.Items.Item(2).ImageIndex = 5
|
||||
lvConfig.Items.Item(3).ImageIndex = 6
|
||||
'txtADField.Enabled = False
|
||||
'txtComPort.Enabled = False
|
||||
'txtSMSC.Enabled = False
|
||||
'txtProvider.Enabled = False
|
||||
'btnTestModem.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ckEnableSMS_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles ckEnableSMS.CheckedChanged
|
||||
If ckEnableSMS.Checked = True Then
|
||||
lvConfig.Items.Item(2).ImageIndex = 2
|
||||
TestModemConfigurationToolStripMenuItem.Enabled = True
|
||||
Else
|
||||
TestModemConfigurationToolStripMenuItem.Enabled = False
|
||||
lvConfig.Items.Item(2).ImageIndex = 5
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ckEnableMail_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles ckEnableMail.CheckedChanged
|
||||
If ckEnableMail.Checked = True Then
|
||||
lvConfig.Items.Item(3).ImageIndex = 3
|
||||
TestMailConfigurationToolStripMenuItem.Enabled = True
|
||||
Else
|
||||
lvConfig.Items.Item(3).ImageIndex = 6
|
||||
TestMailConfigurationToolStripMenuItem.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SaveConfigurationToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SaveConfigurationToolStripMenuItem.Click
|
||||
Call save()
|
||||
End Sub
|
||||
|
||||
Private Sub RestartRadiusServerToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles RestartRadiusServerToolStripMenuItem.Click
|
||||
Dim ok As MsgBoxResult
|
||||
RestartRadiusServerToolStripMenuItem.Enabled = False
|
||||
ok = MsgBox("Restart CICRadiusR Service?", MsgBoxStyle.YesNo + MsgBoxStyle.Information, "Restart Service")
|
||||
If ok = vbYes Then
|
||||
|
||||
Dim controller As New ServiceController("CICRadiusR")
|
||||
controller.Stop()
|
||||
controller.WaitForStatus(ServiceControllerStatus.Stopped)
|
||||
controller.Start()
|
||||
controller.WaitForStatus(ServiceControllerStatus.Running)
|
||||
MsgBox("CICRadiusR Service restarted", MsgBoxStyle.Information, "Information")
|
||||
End If
|
||||
RestartRadiusServerToolStripMenuItem.Enabled = True
|
||||
End Sub
|
||||
|
||||
Sub Save()
|
||||
ConfigFile.SetKeyValue("CICRadarR", "NetBiosDomain", txtNetBios.Text)
|
||||
ConfigFile.SetKeyValue("CICRadarR", "LDAPDomain", txtLdapDomain.Text)
|
||||
ConfigFile.SetKeyValue("CICRadarR", "Provider", txtProvider.Text)
|
||||
ConfigFile.SetKeyValue("CICRadarR", "ADField", txtADField.Text)
|
||||
ConfigFile.SetKeyValue("CICRadarR", "ADMailField", txtADMailField.Text)
|
||||
|
||||
ConfigFile.SetKeyValue("CICRadarR", "SenderEmail", txtSenderEmail.Text)
|
||||
ConfigFile.SetKeyValue("CICRadarR", "MailServer", txtMailServer.Text)
|
||||
|
||||
If rbLocalSMS.Checked = True Then
|
||||
ConfigFile.SetKeyValue("CICRadarR", "USELOCALMODEM", "1")
|
||||
Else
|
||||
ConfigFile.SetKeyValue("CICRadarR", "USELOCALMODEM", "0")
|
||||
End If
|
||||
|
||||
ConfigFile.SetKeyValue("CICRadarR", "COMPORT", txtComPort.Text)
|
||||
ConfigFile.SetKeyValue("CICRadarR", "SMSC", txtSMSC.Text)
|
||||
|
||||
If ckDebug.Checked = True Then
|
||||
ConfigFile.SetKeyValue("CICRadarR", "Debug", "1")
|
||||
Else
|
||||
ConfigFile.SetKeyValue("CICRadarR", "Debug", "0")
|
||||
End If
|
||||
|
||||
If ckEnableOTP.Checked = True Then
|
||||
ConfigFile.SetKeyValue("CICRadarR", "EnableOTP", "1")
|
||||
Else
|
||||
ConfigFile.SetKeyValue("CICRadarR", "EnableOTP", "0")
|
||||
End If
|
||||
|
||||
If rbRDGateway.Checked = True Then
|
||||
ConfigFile.SetKeyValue("CICRadarR", "TSGW", "1")
|
||||
Else
|
||||
ConfigFile.SetKeyValue("CICRadarR", "TSGW", "0")
|
||||
End If
|
||||
|
||||
If ckEnableMail.Checked = True Then
|
||||
ConfigFile.SetKeyValue("CICRadarR", "EnableEmail", "1")
|
||||
Else
|
||||
ConfigFile.SetKeyValue("CICRadarR", "EnableEmail", "0")
|
||||
End If
|
||||
|
||||
If ckEnableSMS.Checked = True Then
|
||||
ConfigFile.SetKeyValue("CICRadarR", "EnableSMS", "1")
|
||||
Else
|
||||
ConfigFile.SetKeyValue("CICRadarR", "EnableSMS", "0")
|
||||
End If
|
||||
ConfigFile.RemoveSection("Clients")
|
||||
Dim ClientList As String = ""
|
||||
For i As Integer = 0 To ListClients.Items.Count - 1
|
||||
Dim Client As String
|
||||
Dim Secret As String
|
||||
Client = Split(ListClients.Items(i), " ( ")(0)
|
||||
Secret = Replace(Split(ListClients.Items(i), " ( ")(1), " )", "")
|
||||
ConfigFile.SetKeyValue("Clients", Client, Secret)
|
||||
|
||||
If i = ListClients.Items.Count - 1 Then
|
||||
ClientList = ClientList & Client
|
||||
Else
|
||||
ClientList = ClientList & Client & ","
|
||||
End If
|
||||
|
||||
Next
|
||||
ConfigFile.SetKeyValue("CICRadarR", "ClientList", ClientList)
|
||||
|
||||
|
||||
ConfigFile.Save(Application.StartupPath & "\CICRadarR.ini")
|
||||
End Sub
|
||||
|
||||
Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click
|
||||
|
||||
Select Case MsgBox("Save configuration before exit?", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Information, "Configuration")
|
||||
Case vbYes
|
||||
Call Save()
|
||||
ToolStripStatusLabel1.Text = "Status: " & "Configuration saved"
|
||||
MsgBox("Configuration saved", vbOKOnly + MsgBoxStyle.Information, "Configuration")
|
||||
End
|
||||
Case vbNo
|
||||
End
|
||||
Case vbCancel
|
||||
End Select
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub AboutToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AboutToolStripMenuItem.Click
|
||||
MsgBox("Configuration tool for CICRadar." & vbCrLf & vbCrLf & "Version 1.1", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "About")
|
||||
End Sub
|
||||
|
||||
Sub TestModem()
|
||||
Dim number As String
|
||||
number = InputBox("Type the phone number to send the test sms to" & vbCrLf & vbCrLf & "Ex: +4512345678", "Phone Number", "", Me.Left + 150, Me.Top + 100)
|
||||
If rbLocalSMS.Checked = True Then
|
||||
Dim testsms As New SmsClass(txtComPort.Text)
|
||||
testsms.Opens()
|
||||
testsms.sendSms(number, "Test SMS Service", txtSMSC.Text)
|
||||
testsms.Closes()
|
||||
Else
|
||||
Dim baseurl As String = txtProvider.Text.Split("?")(0)
|
||||
Dim client As New System.Net.WebClient()
|
||||
' Add a user agent header in case the requested URI contains a query.
|
||||
|
||||
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)")
|
||||
|
||||
Dim parameters As String = txtProvider.Text.Split("?")(1)
|
||||
Dim pary As String() = parameters.Split("&")
|
||||
|
||||
For i As Integer = 0 To pary.Length - 1
|
||||
If pary(i).IndexOf("***TEXTMESSAGE***") > 0 Then
|
||||
Dim qpar As String() = pary(i).Split("=")
|
||||
client.QueryString.Add(qpar(0), "Test SMS Service")
|
||||
ElseIf pary(i).IndexOf("***NUMBER***") > 0 Then
|
||||
Dim qpar As String() = pary(i).Split("=")
|
||||
client.QueryString.Add(qpar(0), number)
|
||||
Else
|
||||
|
||||
Dim qpar As String() = pary(i).Split("=")
|
||||
client.QueryString.Add(qpar(0), qpar(1))
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Dim data As Stream = client.OpenRead(baseurl)
|
||||
Dim reader As New StreamReader(data)
|
||||
Dim s As String = reader.ReadToEnd()
|
||||
data.Close()
|
||||
reader.Close()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub TestEmail()
|
||||
Dim email As String
|
||||
email = InputBox("Type the email address to send the test email to" & vbCrLf & vbCrLf & "Ex: test@my.mail.com", "Email", "", Me.Left + 150, Me.Top + 100)
|
||||
Dim mail As New MailMessage()
|
||||
mail.To.Add(email)
|
||||
mail.From = New MailAddress(txtSenderEmail.Text)
|
||||
mail.Subject = "Test mail from CICRadar"
|
||||
mail.Body = "Just a test."
|
||||
mail.IsBodyHtml = False
|
||||
Dim smtp As New SmtpClient(txtMailServer.Text)
|
||||
|
||||
|
||||
Try
|
||||
smtp.Send(mail)
|
||||
|
||||
ToolStripStatusLabel1.Text = "Status: Mail send"
|
||||
Catch e As InvalidCastException
|
||||
|
||||
ToolStripStatusLabel1.Text = "Status: Failed to send mail"
|
||||
End Try
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub TestModemConfigurationToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles TestModemConfigurationToolStripMenuItem.Click
|
||||
Call TestModem()
|
||||
End Sub
|
||||
|
||||
Private Sub TestMailConfigurationToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles TestMailConfigurationToolStripMenuItem.Click
|
||||
Call TestEmail()
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
|
||||
Call TestEmail()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub btnRemoveClient_Click(sender As System.Object, e As System.EventArgs) Handles btnRemoveClient.Click
|
||||
If ListClients.SelectedIndex > -1 Then
|
||||
|
||||
ListClients.Items.RemoveAt(ListClients.SelectedIndex)
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btnAddClient_Click(sender As System.Object, e As System.EventArgs) Handles btnAddClient.Click
|
||||
If Not ListClients.Items.Contains(txtClient.Text & " ( " & EncDec.Encrypt(txtSecret.Text, encCode) & " )") Then
|
||||
ListClients.Items.Add(txtClient.Text & " ( " & EncDec.Encrypt(txtSecret.Text, encCode) & " )")
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
38
Console/CICRadarRConfig/CICRadarRConfig/My Project/Application.Designer.vb
generated
Normal file
38
Console/CICRadarRConfig/CICRadarRConfig/My Project/Application.Designer.vb
generated
Normal file
|
@ -0,0 +1,38 @@
|
|||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.1008
|
||||
'
|
||||
' 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
|
||||
|
||||
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
|
||||
' or if you encounter build errors in this file, go to the Project Designer
|
||||
' (go to Project Properties or double-click the My Project node in
|
||||
' Solution Explorer), and make changes on the Application tab.
|
||||
'
|
||||
Partial Friend Class MyApplication
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Public Sub New()
|
||||
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
||||
Me.IsSingleInstance = false
|
||||
Me.EnableVisualStyles = true
|
||||
Me.SaveMySettingsOnExit = true
|
||||
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
|
||||
End Sub
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.CICRadarRConfig.CICRadiusRConfig
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-16"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>true</MySubMain>
|
||||
<MainForm>CICRadiusRConfig</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
|
@ -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("CICRadarRConfig")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Microsoft")>
|
||||
<Assembly: AssemblyProduct("CICRadarRConfig")>
|
||||
<Assembly: AssemblyCopyright("Copyright © Microsoft 2012")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("f0feb00f-1171-4cdf-b5d1-30cc01b75624")>
|
||||
|
||||
' 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
Console/CICRadarRConfig/CICRadarRConfig/My Project/Resources.Designer.vb
generated
Normal file
63
Console/CICRadarRConfig/CICRadarRConfig/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.1008
|
||||
'
|
||||
' 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("CICRadarRConfig.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
|
|
@ -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
Console/CICRadarRConfig/CICRadarRConfig/My Project/Settings.Designer.vb
generated
Normal file
73
Console/CICRadarRConfig/CICRadarRConfig/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.1008
|
||||
'
|
||||
' 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.CICRadarRConfig.My.MySettings
|
||||
Get
|
||||
Return Global.CICRadarRConfig.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
|
@ -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>
|
66
Console/CICRadarRConfig/CICRadarRConfig/SmsClass.vb
Normal file
66
Console/CICRadarRConfig/CICRadarRConfig/SmsClass.vb
Normal file
|
@ -0,0 +1,66 @@
|
|||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Text
|
||||
Imports System.Threading
|
||||
Imports System.IO.Ports
|
||||
Imports System.Windows.Forms
|
||||
Namespace SMS
|
||||
Class SmsClass
|
||||
Private serialPort As SerialPort
|
||||
Public Sub New(ByVal comPort As String)
|
||||
Me.serialPort = New SerialPort()
|
||||
Me.serialPort.PortName = comPort
|
||||
Me.serialPort.BaudRate = 38400
|
||||
Me.serialPort.Parity = Parity.None
|
||||
Me.serialPort.DataBits = 8
|
||||
Me.serialPort.StopBits = StopBits.One
|
||||
Me.serialPort.Handshake = Handshake.RequestToSend
|
||||
Me.serialPort.DtrEnable = True
|
||||
Me.serialPort.RtsEnable = True
|
||||
Me.serialPort.NewLine = System.Environment.NewLine
|
||||
End Sub
|
||||
Public Function sendSms(ByVal cellNo As String, ByVal sms As String, ByVal SMSC As String) As Boolean
|
||||
Dim messages As String = Nothing
|
||||
messages = sms
|
||||
If Me.serialPort.IsOpen = True Then
|
||||
Try
|
||||
Me.serialPort.WriteLine("AT" + Chr(13))
|
||||
Thread.Sleep(4)
|
||||
Me.serialPort.WriteLine("AT+CSCA=""" + SMSC + """" + Chr(13))
|
||||
Thread.Sleep(30)
|
||||
Me.serialPort.WriteLine(Chr(13))
|
||||
Thread.Sleep(30)
|
||||
Me.serialPort.WriteLine("AT+CMGS=""" + cellNo + """")
|
||||
|
||||
Thread.Sleep(30)
|
||||
Me.serialPort.WriteLine(messages + Chr(26))
|
||||
Catch ex As Exception
|
||||
MessageBox.Show(ex.Source)
|
||||
End Try
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Sub Opens()
|
||||
|
||||
If Me.serialPort.IsOpen = False Then
|
||||
Try
|
||||
'bool ok =this.serialPort.IsOpen //does not work between 2 treads
|
||||
|
||||
Me.serialPort.Open()
|
||||
Catch
|
||||
Thread.Sleep(1000)
|
||||
'wait for the port to get ready if
|
||||
Opens()
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
Public Sub Closes()
|
||||
If Me.serialPort.IsOpen = True Then
|
||||
Me.serialPort.Close()
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
23
Console/CICRadarRConfig/CICRadarRConfig/app.config
Normal file
23
Console/CICRadarRConfig/CICRadarRConfig/app.config
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<!-- This section defines the logging configuration for My.Application.Log -->
|
||||
<source name="DefaultSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog"/>
|
||||
<!-- Uncomment the below section to write to the Application Event Log -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information"/>
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
|
||||
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
</system.diagnostics>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
|
@ -0,0 +1,24 @@
|
|||
[CICRadarR]
|
||||
ClientList=10.10.10.47,192.168.1.139,192.168.1.101,192.168.1.61,192.168.1.44,188.244.24.22
|
||||
SenderEmail=noreply2@isager.dk
|
||||
EnableOTP=1
|
||||
Provider=https://www.cpsms.dk/sms/?username=myuser&password=mypassword&recipient=***NUMBER***&message=***TEXTMESSAGE***&from=CPSMS
|
||||
Debug=0
|
||||
EnableSMS=1
|
||||
ADField=telephoneNumber
|
||||
NetBiosDomain=isager
|
||||
TSGW=1
|
||||
LDAPDomain=isager.lan
|
||||
EnableEmail=1
|
||||
USELOCALMODEM=0
|
||||
SMSC=+4540390999
|
||||
COMPORT=com1
|
||||
MailServer=192.168.1.25
|
||||
ADMailfield=mail
|
||||
[Clients]
|
||||
188.244.24.22=/pkahxdoI69d+omeup3YZA==
|
||||
192.168.1.139=eXA0YJxFrgfaDtOFApCifbPtJYrEL0RjpDzymPKlw6c=
|
||||
10.10.10.47=iirseiKUQCWnjfg1ZLhF+w==
|
||||
192.168.1.101=eXA0YJxFrgfaDtOFApCifbPtJYrEL0RjpDzymPKlw6c=
|
||||
192.168.1.61=p2fyLMddDfH8aLYwMyDbhQ1l3MY9hAJxx6DyiUOhjXw=
|
||||
192.168.1.44=eXA0YJxFrgfaDtOFApCifbPtJYrEL0RjpDzymPKlw6c=
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<!-- This section defines the logging configuration for My.Application.Log -->
|
||||
<source name="DefaultSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog"/>
|
||||
<!-- Uncomment the below section to write to the Application Event Log -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information"/>
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
|
||||
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
</system.diagnostics>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<!-- This section defines the logging configuration for My.Application.Log -->
|
||||
<source name="DefaultSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog"/>
|
||||
<!-- Uncomment the below section to write to the Application Event Log -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information"/>
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
|
||||
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
</system.diagnostics>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
CICRadarRConfig
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:CICRadarRConfig.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member><member name="P:CICRadarRConfig.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:CICRadarRConfig.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.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue