2012-11-22 36 views
4

我昨天下载了一个程序,它用于加密和安全。除非有人问我,否则我不会在这里命名,但它具有使指定文件夹内的文件完全不可见的功能。如何使文件真正隐藏在目录中?

我已经隐藏的文件和文件夹 - 选择,也隐藏受保护的操作系统文件 - 未选但这些文件从视图中完全消失,不以搜索显示无论是。我将这个文件夹从VMware Workstation复制到我的主机上,并且文件仍然超级隐藏!根据Windows,文件夹中有零个文件。

这怎么巫术magick可能吗?我想在我自己的加密程序中使用Delphi进行模拟。我还没有找到任何方式在这里,并通过谷歌,建议如何可能,但实际的程序帮助文件说,他们仍然在文件夹中,但不注册大多数正常的Windows软件处理文件。

这是那些问题,我不能给任何代码,以显示我曾经试过一次,而是开到了什么,我可以尝试也许这里有人知道它到底是怎么做的建议吗?

+4

您希望我们帮助您构建rootkit吗? –

+0

@DavidHeffernan - 我没有兴趣构建rootkit,也没有任何其他形式的讨厌的东西。我只是想知道如何以这种方式隐藏这些文件。我目前正在寻找来自bummi的答案。 – Shambhala

+0

你所描述的技术术语是rootkit。 –

回答

7

由于更少信息 一个拥有将在NTFS上使用替代文件流,它可以添加到文件和文件夹。你可以在comandline上输入“notepad C:\ temp:hidden1.txt”来试试这个,如果你选择yes,那么将创建新的文件流。保存后,您可以按照相同的方式重新打开它。这也可以从delphi完成(加载/保存)。只有在使用NTFS时才会有效。 我不知道,如果在描述的情况下使用这种方法时,发现广告可以用下面的代码来完成:

unit u_ListADS; 

// 20120928 by Thomas Wassermann 
// www.devworx.de 
interface 

uses 
    Windows, Messages, SysUtils, Variants, Classes, StrUtils; 

Procedure GetADS(List: TStrings; const Path, WildCard: String; Recursiv: Boolean = false); 

function NtQueryInformationFile(FileHandle: Cardinal; IoStatusBlock: Pointer; FileInformation: Pointer; FileInformationLength: Cardinal; 
    FileInformationClass: Cardinal): Cardinal; stdcall; external 'ntdll.dll'; 

implementation 

type 
    _FILE_STREAM_INFORMATION = record 
    NextEntryOffset: Cardinal; 
    StreamNameLength: Cardinal; 
    StreamSize: int64; 
    StreamAllocationSize: int64; 
    StreamName: array [0 .. MAX_PATH] of WideChar; 
    end; 

    PFILE_STREAM_INFORMATION = ^_FILE_STREAM_INFORMATION; 

function GetStreams(aFilename: String): TStringList; 
var 
    FileHandle: Integer; 
    FileName: array [0 .. MAX_PATH] of WideChar; 
    StreamName: String; 
    InfoBlock: _FILE_STREAM_INFORMATION; 
    StatusBlock: record Status: Cardinal; 
         Information: PDWORD; 
       end; 

    Procedure Analyze; 
    begin 
     CopyMemory(@FileName, @InfoBlock.StreamName, InfoBlock.StreamNameLength); 
     StreamName := Copy(Filename, 1, PosEx(':', Filename, 2) - 1); 
     if StreamName <> ':' then Result.Add(StreamName); 
    end; 
begin 
    Result := TStringList.Create; 
    FileHandle := FileOpen(aFilename, GENERIC_READ); 
    NtQueryInformationFile(FileHandle, @StatusBlock, @InfoBlock, SizeOf(InfoBlock), 22); 
    FileClose(FileHandle); 
    if InfoBlock.StreamNameLength <> 0 then 
    Repeat 

     if (InfoBlock.NextEntryOffset <> 0) then 
     begin 
     InfoBlock := PFILE_STREAM_INFORMATION(PByte(@InfoBlock) + InfoBlock.NextEntryOffset)^; 
     Analyze; 
     end; 
    until InfoBlock.NextEntryOffset = 0 
end; 

Procedure GetADS(List: TStrings; const Path, WildCard: String; Recursiv: Boolean = false); 
    Var 
    SR: SysUtils.TSearchRec; 
    RES: Integer; 
    SP: String; 
    StreamList: TStringList; 
    i: Integer; 
    begin 
    if length(Path) = 0 then 
     exit; 
    if length(WildCard) = 0 then 
     exit; 
    SP := IncludeTrailingBackSlash(Path) + WildCard; 
    RES := FindFirst(IncludeTrailingBackSlash(Path) + '*.*', faDirectory, SR); 
    While RES = 0 Do 
    Begin 
     If (SR.attr And faDirectory) <> 0 Then 
     If SR.Name[1] <> '.' Then 
      if Recursiv then 
      GetADS(List, IncludeTrailingBackSlash(Path) + SR.Name, WildCard, Recursiv); 
     RES := FindNext(SR); 
    End; 
    SysUtils.FindClose(SR); 
    RES := FindFirst(SP, $27, SR); 
    While RES = 0 Do 
    Begin 
     StreamList := GetStreams(IncludeTrailingBackSlash(Path) + SR.Name); 
     for i := 0 to StreamList.Count - 1 do 
     List.Add(IncludeTrailingBackSlash(Path) + SR.Name + StreamList[i]); 
     StreamList.Free; 
     RES := FindNext(SR); 
    End; 
    SysUtils.FindClose(SR); 
    end; 

end. 

呼叫可能是如

GetADS(Listbox1.Items,Directory.Text, WildCards.Text,rekursiv.checked); 
+0

这太棒了!我刚刚阅读了很多内容,并在.txt文件中隐藏了文本。在某种程度上,它有点像隐写术? – Shambhala

+1

+1不错!现在,我该如何删除“C:\ temp:hidden1.txt”? :-P – kobik

+0

删除不是那么容易,不幸的是我只能提供德文链接http://de.wikipedia.org/wiki/Alternativer_Datenstrom,或许有人知道英文 – bummi