Software
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWARESoftware

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #1  
Old September 12th, 2005, 09:44 AM
LabRat404's Avatar
LabRat404 LabRat404 is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: in the Bash shell
Posts: 382 LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 18 h 38 m 32 sec
Reputation Power: 48
Send a message via AIM to LabRat404 Send a message via Yahoo to LabRat404
modify every file on a drive at once

Long Story Short

I need an easy way to remove "FILE.VBS" from EVERY single ZIP file on each partition of my hard drive.

Short Story Long

I couldn't think of a good title for this thread.

My problem is this: On Saturday, I realized that I had some kind of Trojan on my PC. Normally, this is absolutely no problem. Trojans are easy to remove and move on from. But this one is a major pain in my ass.

Virus Scaners like ClamWin detected it as a Worm.
It calls itself GedZac Labs in each of its infections.
I've easily gotten rid of the Worm.
It added a file, "FILE.VBS", to every ZIP file on my hard drive (via pkzip that it places inside your system dir)
it infected EVERY htm, vbs, js, php, (and many other files) file on my hard drive by appnding itself as VB Script to the each file.

Saturday, I got rid of the worm.
Sunday, I finished manually disinfecting all my html files I wanted to keep
Now today is monday, and I'm still trying to find a practical way to fix the zip files.

I have 8 Hard Drive Partitions, and I easily got rid of these files manually from 7 of them, but my backup drive, H, has hundreds of ZIP files, and I need to find a quick way to remove this file from each zip file.

here's what I've tried so far:

Dos Commands:

dir c:\ d:\ e:\ f:\ g:\ h:\ i:\ j:\ /a /s /b > file.txt
find ".zip" file.txt /i > zips.txt

that made a list of every zip file in every folder on every hard drive that I have, and I wrote a VB6 program to open up the zips.txt file and add "pkzip -d " to the beginning of each line, and " file.vbs" after each, and renamed the zips.txt to zips.bat. now zips.bat is a batch file that will use pkzip to remove file.vbs from every zip file on my machine. Only one problem: pkzip doesn't accept windows style paths. it needs 8 character file names or shorter, and no spaces. now dir /x will give you the short versions of a directory list, but cannot be used in combination with /b, bare format, which is neccessary to remove all the junk from the DIR command ( it prints ONLY file names one line at a time ).

I've also thought about writing a program to just scan every folder for *.zip files, and then save its path and convert it to "dos format", but that will also be a pain in the ass.

One way that I found to work (sort of), is using the DOS command "DIR /x /p" in a folder where there are a lot of ZIP files, and manually selecting the text of each "short format file name", and pasting it into a text file, and running my program on it to add the PK zip command to it, put pkzip and that batch output file into the directory, and watch each file get fixed. but that only works for folders with lots of files, I mostly just have lots of folders :-p

Any Ideas???

edit: seems the dos version of 7-Zip works with long path names if you put it in quotes, I'll try that soon. still in need of more practical ideas though.
__________________
Interactive Entertainment | Let me get this straight... these people adamantly believe that all this hard evidence of evolution is nonsense, but yet adamantly believe that some geenie popped out of a bottle at the beginning of time, did a little dance and some hokus pokus, and created life....

Last edited by LabRat404 : September 12th, 2005 at 01:27 PM.

Reply With Quote
  Trader Rating: 2 · #2  
Old September 12th, 2005, 10:49 AM
Dngrsone's Avatar
Dngrsone Dngrsone is offline
Tickled pink
Dev Hardware God 7th Plane (8000 - 8499 posts)
 
Join Date: May 2004
Location: in the real world
Posts: 8,329 Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 129th Grade (Above 100000 Reputation Level)  Folding Points: 432392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 432392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 432392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 432392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 432392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 432392 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Days 9 h 9 m 46 sec
Reputation Power: 9598
Stoopid question... is there a .zip utility for linux that will accept long names? Perhaps you could run a linux script to accomplish your goal.
__________________
Ask Questions the Smart Way


"I like doggies....and apparently dinousaurs, mostly because they eat cats!" --Nilpo

Enable BSOD: Control Panel/Systems, Advanced Tab, hit the Settings button under Startup and Recovery, and under the System Failure area, uncheck the Automatically Restart checkbox.

Reply With Quote
  Trader Rating: 0 · #3  
Old September 12th, 2005, 12:51 PM
LabRat404's Avatar
LabRat404 LabRat404 is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: in the Bash shell
Posts: 382 LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 18 h 38 m 32 sec
Reputation Power: 48
Send a message via AIM to LabRat404 Send a message via Yahoo to LabRat404
Quote:
Originally Posted by Dngrsone
Stoopid question... is there a .zip utility for linux that will accept long names? Perhaps you could run a linux script to accomplish your goal.


I did think about that, and I'm sure a bash script would be far more versatile than a DOS Batch. I do have one NTFS partition that it wouldnt work for, but it has few zip files on it so its not an issue.

I may read up on bash scripting if the 7-Zip method doesn't turn out to work.

I should have mentioned before, but I'm tripple booting Win98se, Win2kPro, and Slackware Linux 10.1 -current.

edit: come to think of it, there is a 7-Zip port for linux, called "Project 7-Zip"

edit: if I could figure out how to get "ls" to list directory entries one line at a time, with no time, size, or permission information, I'd be doing pretty good with a bash script.
edit: "ls" can't do what I need :-( .. .but DOS "dir" can...imagine that. I need a linux equvalent of DOS's "DIR /a /s /b"

Last edited by LabRat404 : September 12th, 2005 at 01:27 PM.

Reply With Quote
  Trader Rating: 0 · #4  
Old September 12th, 2005, 01:51 PM
LabRat404's Avatar
LabRat404 LabRat404 is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: in the Bash shell
Posts: 382 LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 18 h 38 m 32 sec
Reputation Power: 48
Send a message via AIM to LabRat404 Send a message via Yahoo to LabRat404
This seems to be the easiest solution:

dos command: DIR h:\ /a /s /b > 1.txt

that will create a file, "1.txt", containing the relative path of every file on the hard drive one entry per line.

run my stupid VB6 program (because I really don't feel like spending the extra time to write a C program for this one time situarion...though I'm starting to feel a little inspired ;-)

the program reads in every line that ends with ".ZIP" from the file "1.txt" case insensitively via ucase(). it then appends the line to "3.bat" with some other varialbles as follows:

"7za -d " & chr(22) & TheLine & chr(22) & " file.vbs >> log.txt"

which ends up looking something like this:

7za -d "H:\path\path\archive.zip" file.vbs >> log.txt

then run 3.bat, and watch all those annoying little file.vbs files dissappear from all my precious .ZIP files across the entire H drive.

BAM like SPAM.

now, search for any file access problems in log.txt, and the few that it finds can be done manually.

Last edited by LabRat404 : September 12th, 2005 at 02:35 PM.

Reply With Quote
  Trader Rating: 0 · #5  
Old September 12th, 2005, 02:57 PM
Chillywilly's Avatar
Chillywilly Chillywilly is offline
SouL Stripper
Dev Hardware Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2004
Location: Alcatraz (UK)
Posts: 1,790 Chillywilly User rank is Sergeant Major (2000 - 5000 Reputation Level)Chillywilly User rank is Sergeant Major (2000 - 5000 Reputation Level)Chillywilly User rank is Sergeant Major (2000 - 5000 Reputation Level)Chillywilly User rank is Sergeant Major (2000 - 5000 Reputation Level)Chillywilly User rank is Sergeant Major (2000 - 5000 Reputation Level)Chillywilly User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 13 h 19 m 54 sec
Reputation Power: 36
This might help you.

Couldn't be bothered reading the post (Ahh sue me) but i saw something to do with linux, so don't know if this will work. But should work on the other OS's you've got running.
__________________

DynaSig: Free Dynamic Forum Signatures!
----------You don't need a reason to help someone...-----------

Reply With Quote
  Trader Rating: 0 · #6  
Old September 12th, 2005, 04:08 PM
LabRat404's Avatar
LabRat404 LabRat404 is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: in the Bash shell
Posts: 382 LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 18 h 38 m 32 sec
Reputation Power: 48
Send a message via AIM to LabRat404 Send a message via Yahoo to LabRat404
Quote:
Originally Posted by Chillywilly
This might help you.

Couldn't be bothered reading the post (Ahh sue me) but i saw something to do with linux, so don't know if this will work. But should work on the other OS's you've got running.


definately an interesting program. you couldn't read the one sentence under Long Story Short? oh well, thanks for posting anyhow :-)

Reply With Quote
  Trader Rating: 0 · #7  
Old September 12th, 2005, 08:49 PM
illarin's Avatar
illarin illarin is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 147 illarin User rank is Corporal (100 - 500 Reputation Level)illarin User rank is Corporal (100 - 500 Reputation Level)illarin User rank is Corporal (100 - 500 Reputation Level)illarin User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 40749 Folding Title: Beginner FolderFolding Points: 40749 Folding Title: Beginner FolderFolding Points: 40749 Folding Title: Beginner Folder
Time spent in forums: 2 Days 19 h 26 m 42 sec
Reputation Power: 6
Boot up with a live cd.. mount your drive (read-write).. replace / with the path to your drive.. and let her rip.

find / -name *.zip -print |xargs -i zip -d {} FILE.VBS

Be aware that FILE.VBS is case sensitive.

Reply With Quote
  Trader Rating: 0 · #8  
Old September 13th, 2005, 12:24 PM
LabRat404's Avatar
LabRat404 LabRat404 is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: in the Bash shell
Posts: 382 LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 18 h 38 m 32 sec
Reputation Power: 48
Send a message via AIM to LabRat404 Send a message via Yahoo to LabRat404
Quote:
Originally Posted by illarin
Boot up with a live cd.. mount your drive (read-write).. replace / with the path to your drive.. and let her rip.

find / -name *.zip -print |xargs -i zip -d {} FILE.VBS

Be aware that FILE.VBS is case sensitive.


I've got slackware so I'm all set.

that almost works, but the paths contain spaces so I've got to throw in quotes around the file and path with escape characters. Also, the ZIP extentions may be in any case, so case insensitivity is important for the "find" command.

find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS

I've also got to output everything to a log file, so I can go through and pick out files that it had trouble with. the "zip" command won't output errors to a file via ">" with cygwin, so that doesn't look like it will work.

I think I'm just going to do this:

find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS \>\> log.txt >> dos.bat

boot into windows, and run dos.bat. that should do the trick. this is much the same as my idea for writing a program to format file output from a dir command, but much much easier.

Last edited by LabRat404 : September 13th, 2005 at 12:30 PM.

Reply With Quote
  Trader Rating: 0 · #9  
Old September 13th, 2005, 07:39 PM
illarin's Avatar
illarin illarin is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 147 illarin User rank is Corporal (100 - 500 Reputation Level)illarin User rank is Corporal (100 - 500 Reputation Level)illarin User rank is Corporal (100 - 500 Reputation Level)illarin User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 40749 Folding Title: Beginner FolderFolding Points: 40749 Folding Title: Beginner FolderFolding Points: 40749 Folding Title: Beginner Folder
Time spent in forums: 2 Days 19 h 26 m 42 sec
Reputation Power: 6
Quote:
Originally Posted by LabRat404
I've got slackware so I'm all set.

that almost works, but the paths contain spaces so I've got to throw in quotes around the file and path with escape characters. Also, the ZIP extentions may be in any case, so case insensitivity is important for the "find" command.

find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS

I've also got to output everything to a log file, so I can go through and pick out files that it had trouble with. the "zip" command won't output errors to a file via ">" with cygwin, so that doesn't look like it will work.

I think I'm just going to do this:

find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS \>\> log.txt >> dos.bat

boot into windows, and run dos.bat. that should do the trick. this is much the same as my idea for writing a program to format file output from a dir command, but much much easier.
Good call on the -iname.

Couple of comments, though.

dos.bat isn't going to end up with anything in it.. but I don't think you really need it, since xargs executes zip for each element. Unless you were doing something else with the zips later? Also, the output for zip errors will be to stderr (descriptor 2) and the backslashes on the redirection confuses zip.. a workaround to that is..

(find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS 2>> log.txt) 2>> dos.bat

But dos.bat still ends up empty. =)

If you have cygwin you may be able to do the whole thing from windows.

Reply With Quote
  Trader Rating: 0 · #10  
Old September 14th, 2005, 10:35 AM
LabRat404's Avatar
LabRat404 LabRat404 is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: in the Bash shell
Posts: 382 LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level)LabRat404 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 18 h 38 m 32 sec
Reputation Power: 48
Send a message via AIM to LabRat404 Send a message via Yahoo to LabRat404
Quote:
Originally Posted by illarin
Good call on the -iname.

Couple of comments, though.

dos.bat isn't going to end up with anything in it.. but I don't think you really need it, since xargs executes zip for each element. Unless you were doing something else with the zips later? Also, the output for zip errors will be to stderr (descriptor 2) and the backslashes on the redirection confuses zip.. a workaround to that is..

(find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS 2>> log.txt) 2>> dos.bat

But dos.bat still ends up empty. =)

If you have cygwin you may be able to do the whole thing from windows.


what I meant was this:

$ find / -iname *.zip -print | xargs -i echo zip -d \"{}\" FILE.VBS \>\> log.txt >> dos.bat

the difference is that I echo the command to a file, dos.bat.

Yes, the errors wouln't output to the file as I expected, so thanks for the info on the descriptor 2 thing.

Using xargs and zip in combination with the escaped quotes on boths sides of the {}, there was some issue passing the command to zip, and zip complained. I was forced to write the command as output to a file, and execute the file; it also seems '-print' is automatically specified with the 'find' command:

$ find /mnt/win -iname *.zip | xargs -i echo zip -d \"{}\" FILE.VBS >> ~/script
$ chmod a+x ~/script
$ ~/script

I also had to perform a "find and replace" on the file "~/script" within kwrite, and change all single quotes within file paths to \' otherwise xargs complained. Other than that, it worked. However, I will have to do it one more time with the 2>> to find which files "zip" had problems accessing.

I had cygwin, but I scrapped the installation because it had some issues. I'm going to reinstall soon.


Here's a weird thing:
I have each of my windows partitions, c through i, and my win2k partition mounted under /mnt/win as /mnt/win/c, /mnt/win/d, ..., etc, and /mnt/win/2k. if I did this from my home directory:

$ find /mnt/win/c -iname *.zip

it would only find a few of the many zip files. if I then did this:

$ cd /mnt/win/c
$ find ./ -iname *.zip

that would find all them! maybe theres a bug in 'find'? or maybe theres some rule I'm unaware of when searching mounted drives?

edit: edited the hell out of this post. it's perfect now :-)

Last edited by LabRat404 : September 14th, 2005 at 11:00 AM.

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWARESoftware > modify every file on a drive at once


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
     
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT