Need help with a Windows copy script "with rules"

DaRk_ViVi

Sending you back... to the future!
OP
Member
Joined
Apr 13, 2004
Messages
1,121
Trophies
2
Age
36
Location
Asti, Italy
Website
www.darkvivi.it
XP
2,200
Country
Italy
Today a client got Cryptolocker and lost part of its files.
This is not a big issue as we have backup running and updated but I'm facing an issue on restoring files.

Long story short I need to run a copy script that act like this:

IF file.ext.enc is present in destination (C:\ folder)
\ Copy file.ext from source folder (on a nas)
\ Delete file.ext.enc
ELSE
Skip and go on with file2.ext.enc

It needs to check if there is there is the .enc file in the destination (aka the crypted one) and copy the file ONLY if exists (and in this case delete the .enc), else just go on with the next file/folder

This needs to go on for all folder and subfolder of the source and destination

Any help?
It doesn't need to be a script, I can also use some utility that does the same.

Thanks!
 

FaTaL_ErRoR

AKA ŦƕƎ ƠṀƐƝ
Member
Joined
Mar 9, 2014
Messages
491
Trophies
0
XP
443
Country
United States
Yeah, you use the copy file transacted function to look for the ext.enc file and return from it either bool or error. (error would be moving on to file2 ext.enc in your situation.)
A great spot for what you are looking for.
http://stackoverflow.com/questions/20187912/how-to-execute-certain-commands-if-a-file-does-not-exist
But, if your client has cryptolocker then why don't you use one of the many tools to decrypt?
http://www.thewindowsclub.com/list-ransomware-decryptor-tools
One of the funniest ransomewares ever made. If you need more help please feel free to ask for it.
 

DaRk_ViVi

Sending you back... to the future!
OP
Member
Joined
Apr 13, 2004
Messages
1,121
Trophies
2
Age
36
Location
Asti, Italy
Website
www.darkvivi.it
XP
2,200
Country
Italy
Yeah, you use the copy file transacted function to look for the ext.enc file and return from it either bool or error. (error would be moving on to file2 ext.enc in your situation.)
A great spot for what you are looking for.
http://stackoverflow.com/questions/20187912/how-to-execute-certain-commands-if-a-file-does-not-exist
But, if your client has cryptolocker then why don't you use one of the many tools to decrypt?
http://www.thewindowsclub.com/list-ransomware-decryptor-tools
One of the funniest ransomewares ever made. If you need more help please feel free to ask for it.

I've already tried that but didn't manage to get a decryption.
However I actually manage to get the job done with a bit more work:

- Dir the *.enc on the drive to a txt file
- A couple of replaces in the file to adapt the path to the backup
- I've used this website to merge the two txt to a single one adding the " and the copy command to the lines
- Saved it as a .bat and voilà
Bonus: scripted a deletion of *.enc and recovery instructions file in the restored folders

:)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Sicklyboy @ Sicklyboy:
    maaaaan that's so awesome but I also don't want to fork over a hundo for it
  • Veho @ Veho:
    The fuuuuu---
  • Veho @ Veho:
    I thought it was an actual xBox at that price.
  • Sicklyboy @ Sicklyboy:
    I wanna grab a 360 Slim and a 360 E one of these days. Missed the boat of getting them at their lowest though, once they were discontinued. Could've got them for cheap back when I was a broke 20 something working at Target, but then again, I was a broke 20 something working at Target
  • Veho @ Veho:
    Being broke is no fun.
  • K3Nv2 @ K3Nv2:
    @Sicklyboy, $150 isn't that bad for a jtag slim on ebay
  • Veho @ Veho:
    I only wish it was actually playable.
  • Veho @ Veho:
    There's a guy on the Tube of You that makes playable mechanical arcade games out of Lego. This could work on the same principle.
  • Veho @ Veho:
    Just a couple of guys taking their manatee out for some fresh air, why you have to molest them?
  • Veho @ Veho:
    Stupid Chinese shop switched their shipping company and this one is slooooooow.
  • LeoTCK @ LeoTCK:
    STOP BUYING CHINESE CRAP THEN
  • LeoTCK @ LeoTCK:
    SUPPORT LOCAL PRODUCTS, MAKE REVOLUTION
  • LeoTCK @ LeoTCK:
    THEY KEEP REMOVING LOCAL SHIt AND REPLACING WItH INFERIOR CHINESE CRAP
  • LeoTCK @ LeoTCK:
    THATS WHY MY PARTNER CANT GET A GOOTWEAR HIS SIZE ANYMORE
  • LeoTCK @ LeoTCK:
    HE HAS BIG FOOT AND BIG DUCK
  • LeoTCK @ LeoTCK:
    d*ck i mean*
  • LeoTCK @ LeoTCK:
    lol
  • Veho @ Veho:
    Mkay.
  • Veho @ Veho:
    I just ordered another package from China just to spite you.
  • SylverReZ @ SylverReZ:
    Leo could not withstand communism.
  • SylverReZ @ SylverReZ:
    Its OUR products to begin with lol.
    SylverReZ @ SylverReZ: Its OUR products to begin with lol.