@@ -137,7 +137,6 @@ private static int RunGuiCommand(GuiCommandOptions opts)
137
137
#else
138
138
Logger . Setup ( opts . Debug , opts . Verbose , opts . Quiet ) ;
139
139
#endif
140
- AsaTelemetry . Setup ( ) ;
141
140
142
141
var server = WebHost . CreateDefaultBuilder ( Array . Empty < string > ( ) )
143
142
. UseStartup < Startup > ( )
@@ -166,7 +165,6 @@ private static void SleepAndOpenBrowser(int sleep)
166
165
[ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Globalization" , "CA1305:Specify IFormatProvider" , Justification = "<Pending>" ) ]
167
166
private static int RunConfigCommand ( ConfigCommandOptions opts )
168
167
{
169
- AsaTelemetry . Setup ( ) ;
170
168
171
169
if ( opts . ResetDatabase )
172
170
{
@@ -176,8 +174,6 @@ private static int RunConfigCommand(ConfigCommandOptions opts)
176
174
}
177
175
else
178
176
{
179
- CheckFirstRun ( ) ;
180
-
181
177
SetupDatabase ( opts ) ;
182
178
183
179
if ( opts . ListRuns )
@@ -242,9 +238,6 @@ private static int RunConfigCommand(ConfigCommandOptions opts)
242
238
}
243
239
}
244
240
245
- AsaTelemetry . SetEnabled ( opts . TelemetryOptOut ) ;
246
- Log . Information ( Strings . Get ( "TelemetryOptOut" ) , opts . TelemetryOptOut ? "Opted out" : "Opted in" ) ;
247
-
248
241
if ( opts . DeleteRunId != null )
249
242
{
250
243
DatabaseManager . DeleteRun ( opts . DeleteRunId ) ;
@@ -271,9 +264,6 @@ private static int RunExportCollectCommand(ExportCollectCommandOptions opts)
271
264
return 0 ;
272
265
}
273
266
274
- CheckFirstRun ( ) ;
275
- AsaTelemetry . Setup ( ) ;
276
-
277
267
if ( opts . ExportSingleRun )
278
268
{
279
269
if ( opts . SecondRunId is null )
@@ -312,11 +302,6 @@ private static int RunExportCollectCommand(ExportCollectCommandOptions opts)
312
302
313
303
Log . Information ( Strings . Get ( "Comparing" ) , opts . FirstRunId , opts . SecondRunId ) ;
314
304
315
- Dictionary < string , string > StartEvent = new Dictionary < string , string > ( ) ;
316
- StartEvent . Add ( "OutputPathSet" , ( opts . OutputPath != null ) . ToString ( CultureInfo . InvariantCulture ) ) ;
317
-
318
- AsaTelemetry . TrackEvent ( "{0} Export Compare" , StartEvent ) ;
319
-
320
305
CompareCommandOptions options = new CompareCommandOptions ( opts . FirstRunId , opts . SecondRunId )
321
306
{
322
307
DatabaseFilename = opts . DatabaseFilename ,
@@ -458,17 +443,6 @@ public static void WriteScanJson(int ResultType, string BaseId, string CompareId
458
443
459
444
}
460
445
461
- private static void CheckFirstRun ( )
462
- {
463
- if ( DatabaseManager . FirstRun )
464
- {
465
- string exeStr = $ "config --telemetry-opt-out";
466
- Log . Information ( Strings . Get ( "ApplicationHasTelemetry" ) ) ;
467
- Log . Information ( Strings . Get ( "ApplicationHasTelemetry2" ) , "https://github.com/Microsoft/AttackSurfaceAnalyzer/blob/master/PRIVACY.md" ) ;
468
- Log . Information ( Strings . Get ( "ApplicationHasTelemetry3" ) , exeStr ) ;
469
- }
470
- }
471
-
472
446
private static int RunExportMonitorCommand ( ExportMonitorCommandOptions opts )
473
447
{
474
448
#if DEBUG
@@ -483,9 +457,6 @@ private static int RunExportMonitorCommand(ExportMonitorCommandOptions opts)
483
457
return 0 ;
484
458
}
485
459
486
- CheckFirstRun ( ) ;
487
- AsaTelemetry . Setup ( ) ;
488
-
489
460
if ( opts . RunId is null )
490
461
{
491
462
List < string > runIds = DatabaseManager . GetLatestRunIds ( 1 , RUN_TYPE . MONITOR ) ;
@@ -503,11 +474,6 @@ private static int RunExportMonitorCommand(ExportMonitorCommandOptions opts)
503
474
504
475
Log . Information ( "{0} {1}" , Strings . Get ( "Exporting" ) , opts . RunId ) ;
505
476
506
- Dictionary < string , string > StartEvent = new Dictionary < string , string > ( ) ;
507
- StartEvent . Add ( "OutputPathSet" , ( opts . OutputPath != null ) . ToString ( CultureInfo . InvariantCulture ) ) ;
508
-
509
- AsaTelemetry . TrackEvent ( "Begin Export Monitor" , StartEvent ) ;
510
-
511
477
WriteMonitorJson ( opts . RunId , ( int ) RESULT_TYPE . FILE , opts . OutputPath ?? "monitor.json" ) ;
512
478
513
479
return 0 ;
@@ -548,15 +514,6 @@ private static int RunMonitorCommand(MonitorCommandOptions opts)
548
514
#endif
549
515
AdminOrQuit ( ) ;
550
516
551
- AsaTelemetry . Setup ( ) ;
552
-
553
- Dictionary < string , string > StartEvent = new Dictionary < string , string > ( ) ;
554
- StartEvent . Add ( "Files" , opts . EnableFileSystemMonitor . ToString ( CultureInfo . InvariantCulture ) ) ;
555
- StartEvent . Add ( "Admin" , AsaHelpers . IsAdmin ( ) . ToString ( CultureInfo . InvariantCulture ) ) ;
556
- AsaTelemetry . TrackEvent ( "Begin monitoring" , StartEvent ) ;
557
-
558
- CheckFirstRun ( ) ;
559
-
560
517
if ( opts . RunId is string )
561
518
{
562
519
opts . RunId = opts . RunId . Trim ( ) ;
@@ -793,7 +750,6 @@ public static List<BaseCompare> GetComparators()
793
750
}
794
751
795
752
DatabaseManager . Commit ( ) ;
796
- AsaTelemetry . TrackEvent ( "End Command" , EndEvent ) ;
797
753
return c . Results ;
798
754
}
799
755
@@ -862,7 +818,6 @@ public static void AdminOrQuit()
862
818
}
863
819
}
864
820
865
- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Design" , "CA1031:Do not catch general exception types" , Justification = "Acceptable tradeoff with telemetry (to identify issues) to lessen severity of individual collector crashes." ) ]
866
821
public static int RunCollectCommand ( CollectCommandOptions opts )
867
822
{
868
823
if ( opts == null ) { return - 1 ; }
@@ -874,25 +829,8 @@ public static int RunCollectCommand(CollectCommandOptions opts)
874
829
875
830
collectors . Clear ( ) ;
876
831
877
- AsaTelemetry . Setup ( ) ;
878
-
879
- Dictionary < string , string > StartEvent = new Dictionary < string , string > ( ) ;
880
- StartEvent . Add ( "Files" , opts . EnableAllCollectors ? "True" : opts . EnableFileSystemCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
881
- StartEvent . Add ( "Ports" , opts . EnableNetworkPortCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
882
- StartEvent . Add ( "Users" , opts . EnableUserCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
883
- StartEvent . Add ( "Certificates" , opts . EnableCertificateCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
884
- StartEvent . Add ( "Registry" , opts . EnableRegistryCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
885
- StartEvent . Add ( "Service" , opts . EnableServiceCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
886
- StartEvent . Add ( "Firewall" , opts . EnableFirewallCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
887
- StartEvent . Add ( "ComObject" , opts . EnableComObjectCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
888
- StartEvent . Add ( "EventLog" , opts . EnableEventLogCollector . ToString ( CultureInfo . InvariantCulture ) ) ;
889
- StartEvent . Add ( "Admin" , AsaHelpers . IsAdmin ( ) . ToString ( CultureInfo . InvariantCulture ) ) ;
890
- AsaTelemetry . TrackEvent ( "Run Command" , StartEvent ) ;
891
-
892
832
AdminOrQuit ( ) ;
893
833
894
- CheckFirstRun ( ) ;
895
-
896
834
int returnValue = ( int ) ASA_ERROR . NONE ;
897
835
opts . RunId = opts . RunId ? . Trim ( ) ?? DateTime . Now . ToString ( "o" , CultureInfo . InvariantCulture ) ;
898
836
@@ -1033,15 +971,9 @@ public static int RunCollectCommand(CollectCommandOptions opts)
1033
971
catch ( Exception e )
1034
972
{
1035
973
Log . Error ( Strings . Get ( "Err_CollectingFrom" ) , c . GetType ( ) . Name , e . Message , e . StackTrace ) ;
1036
- Dictionary < string , string > ExceptionEvent = new Dictionary < string , string > ( ) ;
1037
- ExceptionEvent . Add ( "Exception Type" , e . GetType ( ) . ToString ( ) ) ;
1038
- ExceptionEvent . Add ( "Stack Trace" , e . StackTrace ?? string . Empty ) ;
1039
- ExceptionEvent . Add ( "Message" , e . Message ) ;
1040
- AsaTelemetry . TrackEvent ( "CollectorCrashRogueException" , ExceptionEvent ) ;
1041
974
returnValue = 1 ;
1042
975
}
1043
976
}
1044
- AsaTelemetry . TrackEvent ( "End Command" , EndEvent ) ;
1045
977
1046
978
DatabaseManager . Commit ( ) ;
1047
979
return returnValue ;
0 commit comments