Autopsy  4.7.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
JLNK.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2012 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.coreutils;
20 
21 import java.io.File;
22 import java.util.ArrayList;
23 import java.util.List;
24 
25 import org.openide.util.NbBundle;
31 
36 public class JLNK {
37 
38  private int header;
39  private byte[] linkClassIdentifier;
40  private List<LinkFlags> linkFlags;
41  private List<FileAttributesFlags> fileAttributesFlags;
42  private long crtime;
43  private long atime;
44  private long mtime;
45  private int fileSize;
46  private int iconIndex;
47  private int showCommand;
48  private short hotKey;
49 
50  private List<String> linkTargetIdList;
51 
53  private String localBasePath;
54  private String commonPathSuffix;
55  private String localBasePathUnicode;
56  private String commonPathSuffixUnicode;
57 
58  private String name;
59  private String relativePath;
60  private String workingDir;
61  private String arguments;
62  private String iconLocation;
63 
64  private int driveSerialNumber;
66  private String volumeLabel;
67 
68  private List<CommonNetworkRelativeLinkFlags> commonNetworkRelativeListFlags;
70  private boolean unicodeNetAndDeviceName;
71  private String netName;
72  private String netNameUnicode;
73  private String deviceName;
74  private String deviceNameUnicode;
75 
76  public JLNK(int header, byte[] linkClassIdentifier, int linkFlags,
77  int fileAttributesFlags, long crtime, long atime,
78  long mtime, int fileSize, int iconIndex, int showCommand, short hotKey,
79  List<String> linkTargetIdList,
80  boolean hasUnicodeLocalBaseAndCommonSuffixOffset,
81  String localBasePath, String commonPathSuffix, String localBasePathUnicode,
82  String commonPathSuffixUnicode, String name, String relativePath,
83  String workingDir, String arguments, String iconLocation, int driveSerialNumber,
84  DriveType driveType, String volumeLabel,
85  int commonNetworkRelativeListFlags,
86  NetworkProviderType networkProviderType, boolean unicodeNetAndDeviceName,
87  String netName, String netNameUnicode, String deviceName,
88  String deviceNameUnicode) {
89  this.header = header;
90  this.linkClassIdentifier = linkClassIdentifier;
91  this.linkFlags = new ArrayList<LinkFlags>();
92  for (LnkEnums.LinkFlags enumVal : LnkEnums.LinkFlags.values()) {
93  if ((linkFlags & enumVal.getFlag()) == enumVal.getFlag()) {
94  this.linkFlags.add(enumVal);
95  }
96  }
97  this.fileAttributesFlags = new ArrayList<FileAttributesFlags>();
98  for (LnkEnums.FileAttributesFlags enumVal : LnkEnums.FileAttributesFlags.values()) {
99  if ((fileAttributesFlags & enumVal.getFlag()) == enumVal.getFlag()) {
100  this.fileAttributesFlags.add(enumVal);
101  }
102  }
103  this.crtime = crtime;
104  this.atime = atime;
105  this.mtime = mtime;
106  this.fileSize = fileSize;
107  this.iconIndex = iconIndex;
108  this.showCommand = showCommand;
109  this.hotKey = hotKey;
110  this.linkTargetIdList = linkTargetIdList;
111  this.hasUnicodeLocalBaseAndCommonSuffixOffset = hasUnicodeLocalBaseAndCommonSuffixOffset;
112  this.localBasePath = localBasePath;
113  this.commonPathSuffix = commonPathSuffix;
114  this.localBasePathUnicode = localBasePathUnicode;
115  this.commonPathSuffixUnicode = commonPathSuffixUnicode;
116  this.name = name;
117  this.relativePath = relativePath;
118  this.workingDir = workingDir;
119  this.arguments = arguments;
120  this.iconLocation = iconLocation;
121  this.driveSerialNumber = driveSerialNumber;
122  this.driveType = driveType;
123  this.volumeLabel = volumeLabel;
124  this.commonNetworkRelativeListFlags = new ArrayList<CommonNetworkRelativeLinkFlags>();
125  for (LnkEnums.CommonNetworkRelativeLinkFlags enumVal : LnkEnums.CommonNetworkRelativeLinkFlags.values()) {
126  if ((commonNetworkRelativeListFlags & enumVal.getFlag()) == enumVal.getFlag()) {
127  this.commonNetworkRelativeListFlags.add(enumVal);
128  }
129  }
130  this.networkProviderType = networkProviderType;
131  this.unicodeNetAndDeviceName = unicodeNetAndDeviceName;
132  this.netName = netName;
133  this.netNameUnicode = netNameUnicode;
134  this.deviceName = deviceName;
135  this.deviceNameUnicode = deviceNameUnicode;
136  }
137 
138  public String getArguments() {
139  return arguments;
140  }
141 
142  public List<CommonNetworkRelativeLinkFlags> getCommonNetworkRelativeListFlags() {
144  }
145 
146  public String getCommonPathSuffix() {
147  return commonPathSuffix;
148  }
149 
150  public String getCommonPathSuffixUnicode() {
152  }
153 
154  public long getCrtime() {
155  return crtime;
156  }
157 
158  public long getCtime() {
159  return atime;
160  }
161 
162  public String getDeviceName() {
163  return deviceName;
164  }
165 
166  public String getDeviceNameUnicode() {
167  return deviceNameUnicode;
168  }
169 
170  public int getDriveSerialNumber() {
171  return driveSerialNumber;
172  }
173 
175  return driveType;
176  }
177 
178  public List<FileAttributesFlags> getFileAttributesFlags() {
179  return fileAttributesFlags;
180  }
181 
182  public int getFileSize() {
183  return fileSize;
184  }
185 
188  }
189 
190  public int getHeader() {
191  return header;
192  }
193 
194  public short getHotKey() {
195  return hotKey;
196  }
197 
198  public List<String> getLinkTargetIdList() {
199  return linkTargetIdList;
200  }
201 
202  public int getIconIndex() {
203  return iconIndex;
204  }
205 
206  public String getIconLocation() {
207  return iconLocation;
208  }
209 
210  public byte[] getLinkClassIdentifier() {
211  return linkClassIdentifier;
212  }
213 
214  public List<LinkFlags> getLinkFlags() {
215  return linkFlags;
216  }
217 
218  public String getLocalBasePath() {
219  return localBasePath;
220  }
221 
222  public String getLocalBasePathUnicode() {
223  return localBasePathUnicode;
224  }
225 
226  public long getMtime() {
227  return mtime;
228  }
229 
230  public String getName() {
231  return name;
232  }
233 
234  public String getNetName() {
235  return netName;
236  }
237 
238  public String getNetNameUnicode() {
239  return netNameUnicode;
240  }
241 
243  return networkProviderType;
244  }
245 
246  public String getRelativePath() {
247  return relativePath;
248  }
249 
250  public int getShowCommand() {
251  return showCommand;
252  }
253 
254  public boolean isUnicodeNetAndDeviceName() {
256  }
257 
258  public String getVolumeLabel() {
259  return volumeLabel;
260  }
261 
262  public String getWorkingDir() {
263  return workingDir;
264  }
265 
266  public String getBestPath() {
267  if (localBasePathUnicode != null && !localBasePathUnicode.isEmpty()) {
268  if (commonPathSuffixUnicode != null) {
269  return localBasePathUnicode + commonPathSuffixUnicode;
270  } else if (commonPathSuffix != null) {
271  return localBasePathUnicode + commonPathSuffix;
272  }
273  } else if (localBasePath != null && !localBasePath.isEmpty()) {
274  if (commonPathSuffixUnicode != null) {
275  return localBasePath + commonPathSuffixUnicode;
276  } else if (commonPathSuffix != null) {
277  return localBasePath + commonPathSuffix;
278  }
279  } else if (netNameUnicode != null && !netNameUnicode.isEmpty()) {
280  if (commonPathSuffixUnicode != null && !commonPathSuffixUnicode.isEmpty()) {
281  return netNameUnicode + "\\" + commonPathSuffixUnicode;
282  } else if (commonPathSuffix != null && !commonPathSuffix.isEmpty()) {
283  return netNameUnicode + "\\" + commonPathSuffix;
284  }
285  } else if (netName != null && !netName.isEmpty()) {
286  if (commonPathSuffixUnicode != null && !commonPathSuffixUnicode.isEmpty()) {
287  return netName + "\\" + commonPathSuffixUnicode;
288  } else if (commonPathSuffix != null && !commonPathSuffix.isEmpty()) {
289  return netName + "\\" + commonPathSuffix;
290  }
291  } else if (linkTargetIdList != null && !linkTargetIdList.isEmpty()) {
292  String ret = "";
293  for (String s : linkTargetIdList) {
294  ret += s;
295  }
296  return ret;
297  }
298  return NbBundle.getMessage(this.getClass(), "JLNK.noPrefPath.text");
299  }
300 
301  public String getBestName() {
302  return new File(getBestPath()).getName(); // not very cross platform :(
303  }
304 
305 }
boolean isHasUnicodeLocalBaseAndCommonSuffixOffset()
Definition: JLNK.java:186
List< CommonNetworkRelativeLinkFlags > commonNetworkRelativeListFlags
Definition: JLNK.java:68
NetworkProviderType getNetworkProviderType()
Definition: JLNK.java:242
List< String > getLinkTargetIdList()
Definition: JLNK.java:198
JLNK(int header, byte[] linkClassIdentifier, int linkFlags, int fileAttributesFlags, long crtime, long atime, long mtime, int fileSize, int iconIndex, int showCommand, short hotKey, List< String > linkTargetIdList, boolean hasUnicodeLocalBaseAndCommonSuffixOffset, String localBasePath, String commonPathSuffix, String localBasePathUnicode, String commonPathSuffixUnicode, String name, String relativePath, String workingDir, String arguments, String iconLocation, int driveSerialNumber, DriveType driveType, String volumeLabel, int commonNetworkRelativeListFlags, NetworkProviderType networkProviderType, boolean unicodeNetAndDeviceName, String netName, String netNameUnicode, String deviceName, String deviceNameUnicode)
Definition: JLNK.java:76
List< FileAttributesFlags > fileAttributesFlags
Definition: JLNK.java:41
List< LinkFlags > getLinkFlags()
Definition: JLNK.java:214
List< CommonNetworkRelativeLinkFlags > getCommonNetworkRelativeListFlags()
Definition: JLNK.java:142
List< LinkFlags > linkFlags
Definition: JLNK.java:40
NetworkProviderType networkProviderType
Definition: JLNK.java:69
List< FileAttributesFlags > getFileAttributesFlags()
Definition: JLNK.java:178
boolean hasUnicodeLocalBaseAndCommonSuffixOffset
Definition: JLNK.java:52

Copyright © 2012-2016 Basis Technology. Generated on: Mon Jun 18 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.