-
Notifications
You must be signed in to change notification settings - Fork 284
/
Copy pathFileSystemObject.cs
145 lines (118 loc) · 3.95 KB
/
FileSystemObject.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
using Microsoft.CST.AttackSurfaceAnalyzer.Types;
using System;
using System.Collections.Generic;
namespace Microsoft.CST.AttackSurfaceAnalyzer.Objects
{
public class FileSystemObject : CollectObject
{
public FileSystemObject(string Path)
{
this.Path = Path;
}
public FileSystemObject()
{
Path = string.Empty;
}
public override RESULT_TYPE ResultType => RESULT_TYPE.FILE;
/// <summary>
/// If this is windows executable what DLL Characteristics are set
/// </summary>
public List<DLLCHARACTERISTICS>? Characteristics { get; set; }
/// <summary>
/// A hash of the file (if collected)
/// </summary>
public string? ContentHash { get; set; }
/// <summary>
/// When was the file created in UTC
/// </summary>
public DateTime Created { get; set; }
/// <summary>
/// .ToString of Mono FileTypes result. Not available on Windows.
/// </summary>
public string? FileType { get; set; }
/// <summary>
/// The group of the file.
/// </summary>
public string? Group { get; set; }
/// <summary>
/// The File's path
/// </summary>
public override string Identity
{
get
{
return Path;
}
}
/// <summary>
/// If the file is a directory
/// </summary>
public bool? IsDirectory { get; set; }
/// <summary>
/// If the file is an executable
/// </summary>
public bool? IsExecutable { get; set; }
/// <summary>
/// The type of the executable if it is one
/// </summary>
public EXECUTABLE_TYPE ExecutableType { get; set; } = EXECUTABLE_TYPE.UNKNOWN;
/// <summary>
/// If the file is a link
/// </summary>
public bool? IsLink { get; set; }
/// <summary>
/// When was the file last modified in UTC
/// </summary>
public DateTime LastModified { get; set; }
/// <summary>
/// Signature information for signed Mac binaries.
/// </summary>
public MacSignature? MacSignatureStatus { get; set; }
/// <summary>
/// The owner of the file.
/// </summary>
public string? Owner { get; set; }
/// <summary>
/// The location on disk of the file
/// </summary>
public string Path { get; set; }
/// <summary>
/// What are the permissions of this file.
/// </summary>
public Dictionary<string, string>? Permissions { get; set; }
/// <summary>
/// A string representation of the permissions
/// </summary>
public string? PermissionsString { get; set; }
/// <summary>
/// If the SetGid bit is set
/// </summary>
public bool? SetGid { get; set; }
/// <summary>
/// If the SetUid bit is set
/// </summary>
public bool? SetUid { get; set; }
/// <summary>
/// Signature information for signed Windows binaries.
/// </summary>
public Signature? SignatureStatus { get; set; }
/// <summary>
/// File size in bytes
/// </summary>
public long? Size { get; set; }
public long? SizeOnDisk { get; internal set; }
/// <summary>
/// If this is a link where does it point to.
/// </summary>
public string? Target { get; set; }
public bool ShouldSerializeCharacteristics()
{
return Characteristics?.Count > 0;
}
public bool ShouldSerializePermissions()
{
return Permissions?.Count > 0;
}
}
}