@@ -11,7 +11,7 @@ import Auburn
1111
1212class ConnectionInspector
1313{
14- func analyzeConnections( enableSequenceAnalysis: Bool )
14+ func analyzeConnections( enableSequenceAnalysis: Bool , enableTLSAnalysis : Bool )
1515 {
1616 analysisQueue. async
1717 {
@@ -36,7 +36,7 @@ class ConnectionInspector
3636
3737 let allowedConnection = ObservedConnection ( connectionType: . allowed, connectionID: allowedConnectionID)
3838
39- self . analyze ( connection: allowedConnection, enableSequenceAnalysis: enableSequenceAnalysis)
39+ self . analyze ( connection: allowedConnection, enableSequenceAnalysis: enableSequenceAnalysis, enableTLSAnalysis : enableTLSAnalysis )
4040 }
4141
4242 // Blocked Connections
@@ -59,32 +59,35 @@ class ConnectionInspector
5959
6060 let blockedConnection = ObservedConnection ( connectionType: . blocked, connectionID: blockedConnectionID)
6161
62- self . analyze ( connection: blockedConnection, enableSequenceAnalysis: enableSequenceAnalysis)
62+ self . analyze ( connection: blockedConnection, enableSequenceAnalysis: enableSequenceAnalysis, enableTLSAnalysis : enableTLSAnalysis )
6363 }
6464
65- self . scoreConnections ( )
65+ self . scoreConnections ( enableSequenceAnalysis : enableSequenceAnalysis , enableTLSAnalysis : enableTLSAnalysis )
6666 }
6767
6868 // New Data Available for UI
6969 print ( " Analysis loop complete: SENDING UI UPDATE NOTIFICATION " )
7070 NotificationCenter . default. post ( name: . updateStats, object: nil )
7171 }
7272
73- func scoreConnections( )
73+ func scoreConnections( enableSequenceAnalysis : Bool , enableTLSAnalysis : Bool )
7474 {
7575 sleep ( 1 )
7676 scoreAllPacketLengths ( )
7777 sleep ( 1 )
78- scoreAllFloatSequences ( )
79- sleep ( 1 )
78+ if enableSequenceAnalysis
79+ {
80+ scoreAllFloatSequences ( )
81+ sleep ( 1 )
82+ }
8083 scoreAllEntropy ( )
8184 sleep ( 1 )
8285 scoreAllTiming ( )
8386 sleep ( 1 )
8487 NotificationCenter . default. post ( name: . updateStats, object: nil )
8588 }
8689
87- func analyze( connection: ObservedConnection , enableSequenceAnalysis: Bool )
90+ func analyze( connection: ObservedConnection , enableSequenceAnalysis: Bool , enableTLSAnalysis : Bool )
8891 {
8992 print ( " Analyzing a new connection: \( connection. connectionID) " )
9093 // Process Packet Lengths
@@ -130,11 +133,13 @@ class ConnectionInspector
130133 }
131134 }
132135
133- if let knownProtocol = detectKnownProtocol ( connection: connection) {
134- NSLog ( " It's TLS! " )
135- processKnownProtocol ( knownProtocol, connection)
136- } else {
137- NSLog ( " Not TLS. " )
136+ if enableTLSAnalysis {
137+ if let knownProtocol = detectKnownProtocol ( connection: connection) {
138+ NSLog ( " It's TLS! " )
139+ processKnownProtocol ( knownProtocol, connection)
140+ } else {
141+ NSLog ( " Not TLS. " )
142+ }
138143 }
139144 }
140145}
0 commit comments