Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Products
/
VSTT-Plugins
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
2
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
c2cc16a9
...
c2cc16a93a58fa43a17ae5e3ce1118fc89c05d93
authored
2018-04-20 20:48:27 +0200
by
Christian Gerdes
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
SSL Session Cache Disabled plugin
First tested and fully working version.
1 parent
1eac38b7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
16 deletions
LIL_VSTT_Plugins/LoadTestPlugins.cs
LIL_VSTT_Plugins/LoadTestPlugins.cs
View file @
c2cc16a
...
...
@@ -24,38 +24,54 @@ namespace LIL_VSTT_Plugins
/// <summary>
/// LoadTest Context Copy
/// </summary>
[
DisplayName
(
"
Clear SSL Sessions
"
)]
[
Description
(
"(C) Copyright 2018 LIGHTS IN LINE AB\r\n
Clears all SSL Sessions after each test from the SSLClients
. Beta."
)]
[
DisplayName
(
"
SSL Session Cache Disabled
"
)]
[
Description
(
"(C) Copyright 2018 LIGHTS IN LINE AB\r\n
Disables SSL Session Cache and Reuse of handshakes during this loadtest
. Beta."
)]
public
class
ClearSSLSessions
:
ILoadTestPlugin
{
LoadTest
mLoadTest
;
public
void
Initialize
(
LoadTest
loadTest
)
{
mLoadTest
=
loadTest
;
mLoadTest
.
TestStarting
+=
new
EventHandler
<
TestStartingEventArgs
>(
mLoadTest_TestStarting
);
mLoadTest
.
TestFinished
+=
new
EventHandler
<
TestFinishedEventArgs
>(
mLoadTest_TestFinished
);
mLoadTest
.
TestSelected
+=
new
EventHandler
<
TestSelectedEventArgs
>(
mLoadTest_TestSelected
);
loadTest
.
LoadTestStarting
+=
new
EventHandler
(
mLoadTest_Starting
);
loadTest
.
LoadTestFinished
+=
new
EventHandler
(
mLoadTest_Finished
);
loadTest
.
LoadTestAborted
+=
new
EventHandler
<
LoadTestAbortedEventArgs
>(
mLoadTest_Aborted
);
}
void
mLoadTest_TestStarting
(
object
sender
,
TestStartingEventArgs
e
)
void
mLoadTest_Starting
(
object
sender
,
EventArgs
e
)
{
clear
It
();
zero
It
();
}
void
mLoadTest_TestFinished
(
object
sender
,
TestFinishedEventArgs
e
)
void
mLoadTest_Finished
(
object
sender
,
EventArgs
e
)
{
undoIt
();
}
void
mLoadTest_Aborted
(
object
sender
,
LoadTestAbortedEventArgs
e
)
{
clear
It
();
undo
It
();
}
void
mLoadTest_TestSelected
(
object
sender
,
TestSelectedEventArgs
e
)
void
zeroIt
()
{
clearIt
();
System
.
Reflection
.
Assembly
asm
=
System
.
Reflection
.
Assembly
.
GetAssembly
(
typeof
(
System
.
Net
.
Security
.
SslStream
));
Type
t
=
asm
.
GetType
(
"System.Net.Security.SslSessionsCache"
);
System
.
Reflection
.
FieldInfo
f
=
t
.
GetField
(
"s_CachedCreds"
,
System
.
Reflection
.
BindingFlags
.
NonPublic
|
System
.
Reflection
.
BindingFlags
.
Static
);
f
.
SetValue
(
null
,
new
ZeroHashtable
());
}
void
clear
It
()
void
undo
It
()
{
System
.
Reflection
.
Assembly
asm
=
System
.
Reflection
.
Assembly
.
GetAssembly
(
typeof
(
System
.
Net
.
Security
.
SslStream
));
Type
t
=
asm
.
GetType
(
"System.Net.Security.SslSessionsCache"
);
System
.
Reflection
.
FieldInfo
f
=
t
.
GetField
(
"s_CachedCreds"
,
System
.
Reflection
.
BindingFlags
.
NonPublic
|
System
.
Reflection
.
BindingFlags
.
Static
);
System
.
Collections
.
Hashtable
h
=
(
System
.
Collections
.
Hashtable
)
f
.
GetValue
(
null
);
h
.
Clear
();
f
.
SetValue
(
null
,
new
System
.
Collections
.
Hashtable
(
32
));
}
}
public
class
ZeroHashtable
:
System
.
Collections
.
Hashtable
{
public
override
int
Count
{
get
{
if
(
base
.
Count
%
32
==
0
)
this
.
Clear
();
return
0
;
}
}
}
...
...
Please
register
or
sign in
to post a comment