Autopsy  3.1
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  private int header;
38  private byte[] linkClassIdentifier;
39  private List<LinkFlags> linkFlags;
40  private List<FileAttributesFlags> fileAttributesFlags;
41  private long crtime;
42  private long atime;
43  private long mtime;
44  private int fileSize;
45  private int iconIndex;
46  private int showCommand;
47  private short hotKey;
48 
49  private List<String> linkTargetIdList;
50 
52  private String localBasePath;
53  private String commonPathSuffix;
54  private String localBasePathUnicode;
55  private String commonPathSuffixUnicode;
56 
57  private String name;
58  private String relativePath;
59  private String workingDir;
60  private String arguments;
61  private String iconLocation;
62 
63  private int driveSerialNumber;
65  private String volumeLabel;
66 
67  private List<CommonNetworkRelativeLinkFlags> commonNetworkRelativeListFlags;
69  private boolean unicodeNetAndDeviceName;
70  private String netName;
71  private String netNameUnicode;
72  private String deviceName;
73  private String deviceNameUnicode;
74 
75  public JLNK(int header, byte[] linkClassIdentifier, int linkFlags,
76  int fileAttributesFlags, long crtime, long atime,
77  long mtime, int fileSize, int iconIndex, int showCommand, short hotKey,
78  List<String> linkTargetIdList,
79  boolean hasUnicodeLocalBaseAndCommonSuffixOffset,
80  String localBasePath, String commonPathSuffix, String localBasePathUnicode,
81  String commonPathSuffixUnicode, String name, String relativePath,
82  String workingDir, String arguments, String iconLocation, int driveSerialNumber,
83  DriveType driveType, String volumeLabel,
84  int commonNetworkRelativeListFlags,
85  NetworkProviderType networkProviderType, boolean unicodeNetAndDeviceName,
86  String netName, String netNameUnicode, String deviceName,
87  String deviceNameUnicode) {
88  this.header = header;
89  this.linkClassIdentifier = linkClassIdentifier;
90  this.linkFlags = new ArrayList<LinkFlags>();
91  for(LnkEnums.LinkFlags enumVal : LnkEnums.LinkFlags.values()) {
92  if((linkFlags & enumVal.getFlag()) == enumVal.getFlag()) {
93  this.linkFlags.add(enumVal);
94  }
95  }
96  this.fileAttributesFlags = new ArrayList<FileAttributesFlags>();
97  for(LnkEnums.FileAttributesFlags enumVal : LnkEnums.FileAttributesFlags.values()) {
98  if((fileAttributesFlags & enumVal.getFlag()) == enumVal.getFlag()) {
99  this.fileAttributesFlags.add(enumVal);
100  }
101  }
102  this.crtime = crtime;
103  this.atime = atime;
104  this.mtime = mtime;
105  this.fileSize = fileSize;
106  this.iconIndex = iconIndex;
107  this.showCommand = showCommand;
108  this.hotKey = hotKey;
109  this.linkTargetIdList = linkTargetIdList;
110  this.hasUnicodeLocalBaseAndCommonSuffixOffset = hasUnicodeLocalBaseAndCommonSuffixOffset;
111  this.localBasePath = localBasePath;
112  this.commonPathSuffix = commonPathSuffix;
113  this.localBasePathUnicode = localBasePathUnicode;
114  this.commonPathSuffixUnicode = commonPathSuffixUnicode;
115  this.name = name;
116  this.relativePath = relativePath;
117  this.workingDir = workingDir;
118  this.arguments = arguments;
119  this.iconLocation = iconLocation;
120  this.driveSerialNumber = driveSerialNumber;
121  this.driveType = driveType;
122  this.volumeLabel = volumeLabel;
123  this.commonNetworkRelativeListFlags = new ArrayList<CommonNetworkRelativeLinkFlags>();
124  for(LnkEnums.CommonNetworkRelativeLinkFlags enumVal : LnkEnums.CommonNetworkRelativeLinkFlags.values()) {
125  if((commonNetworkRelativeListFlags & enumVal.getFlag()) == enumVal.getFlag()) {
126  this.commonNetworkRelativeListFlags.add(enumVal);
127  }
128  }
129  this.networkProviderType = networkProviderType;
130  this.unicodeNetAndDeviceName = unicodeNetAndDeviceName;
131  this.netName = netName;
132  this.netNameUnicode = netNameUnicode;
133  this.deviceName = deviceName;
134  this.deviceNameUnicode = deviceNameUnicode;
135  }
136 
137  public String getArguments() {
138  return arguments;
139  }
140 
141  public List<CommonNetworkRelativeLinkFlags> getCommonNetworkRelativeListFlags() {
143  }
144 
145  public String getCommonPathSuffix() {
146  return commonPathSuffix;
147  }
148 
149  public String getCommonPathSuffixUnicode() {
151  }
152 
153  public long getCrtime() {
154  return crtime;
155  }
156 
157  public long getCtime() {
158  return atime;
159  }
160 
161  public String getDeviceName() {
162  return deviceName;
163  }
164 
165  public String getDeviceNameUnicode() {
166  return deviceNameUnicode;
167  }
168 
169  public int getDriveSerialNumber() {
170  return driveSerialNumber;
171  }
172 
174  return driveType;
175  }
176 
177  public List<FileAttributesFlags> getFileAttributesFlags() {
178  return fileAttributesFlags;
179  }
180 
181  public int getFileSize() {
182  return fileSize;
183  }
184 
187  }
188 
189  public int getHeader() {
190  return header;
191  }
192 
193  public short getHotKey() {
194  return hotKey;
195  }
196 
197  public List<String> getLinkTargetIdList() {
198  return linkTargetIdList;
199  }
200 
201  public int getIconIndex() {
202  return iconIndex;
203  }
204 
205  public String getIconLocation() {
206  return iconLocation;
207  }
208 
209  public byte[] getLinkClassIdentifier() {
210  return linkClassIdentifier;
211  }
212 
213  public List<LinkFlags> getLinkFlags() {
214  return linkFlags;
215  }
216 
217  public String getLocalBasePath() {
218  return localBasePath;
219  }
220 
221  public String getLocalBasePathUnicode() {
222  return localBasePathUnicode;
223  }
224 
225  public long getMtime() {
226  return mtime;
227  }
228 
229  public String getName() {
230  return name;
231  }
232 
233  public String getNetName() {
234  return netName;
235  }
236 
237  public String getNetNameUnicode() {
238  return netNameUnicode;
239  }
240 
242  return networkProviderType;
243  }
244 
245  public String getRelativePath() {
246  return relativePath;
247  }
248 
249  public int getShowCommand() {
250  return showCommand;
251  }
252 
253  public boolean isUnicodeNetAndDeviceName() {
255  }
256 
257  public String getVolumeLabel() {
258  return volumeLabel;
259  }
260 
261  public String getWorkingDir() {
262  return workingDir;
263  }
264 
265 
266 
267  public String getBestPath() {
268  if(localBasePathUnicode != null && !localBasePathUnicode.isEmpty()) {
269  if(commonPathSuffixUnicode != null) {
270  return localBasePathUnicode + commonPathSuffixUnicode;
271  } else if(commonPathSuffix != null) {
272  return localBasePathUnicode + commonPathSuffix;
273  }
274  } else if(localBasePath != null && !localBasePath.isEmpty()) {
275  if(commonPathSuffixUnicode != null) {
276  return localBasePath + commonPathSuffixUnicode;
277  } else if(commonPathSuffix != null) {
278  return localBasePath + commonPathSuffix;
279  }
280  } else if(netNameUnicode != null && !netNameUnicode.isEmpty()) {
281  if(commonPathSuffixUnicode != null && !commonPathSuffixUnicode.isEmpty()) {
282  return netNameUnicode + "\\" + commonPathSuffixUnicode;
283  } else if(commonPathSuffix != null && !commonPathSuffix.isEmpty()) {
284  return netNameUnicode + "\\" + commonPathSuffix;
285  }
286  } else if(netName != null && !netName.isEmpty()) {
287  if(commonPathSuffixUnicode != null && !commonPathSuffixUnicode.isEmpty()) {
288  return netName + "\\" + commonPathSuffixUnicode;
289  } else if(commonPathSuffix != null && !commonPathSuffix.isEmpty()) {
290  return netName + "\\" + commonPathSuffix;
291  }
292  } else if(linkTargetIdList != null && !linkTargetIdList.isEmpty()) {
293  String ret = "";
294  for(String s : linkTargetIdList) {
295  ret += s;
296  }
297  return ret;
298  }
299  return NbBundle.getMessage(this.getClass(), "JLNK.noPrefPath.text");
300  }
301 
302  public String getBestName() {
303  return new File(getBestPath()).getName(); // not very cross platform :(
304  }
305 
306 }
boolean isHasUnicodeLocalBaseAndCommonSuffixOffset()
Definition: JLNK.java:185
List< CommonNetworkRelativeLinkFlags > commonNetworkRelativeListFlags
Definition: JLNK.java:67
NetworkProviderType getNetworkProviderType()
Definition: JLNK.java:241
List< String > getLinkTargetIdList()
Definition: JLNK.java:197
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:75
List< FileAttributesFlags > fileAttributesFlags
Definition: JLNK.java:40
List< LinkFlags > getLinkFlags()
Definition: JLNK.java:213
List< CommonNetworkRelativeLinkFlags > getCommonNetworkRelativeListFlags()
Definition: JLNK.java:141
NetworkProviderType networkProviderType
Definition: JLNK.java:68
List< FileAttributesFlags > getFileAttributesFlags()
Definition: JLNK.java:177
boolean hasUnicodeLocalBaseAndCommonSuffixOffset
Definition: JLNK.java:51

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.