File Search for Application Protection

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: May 2009
Posts: 110
Reputation: papanyquiL is on a distinguished road 
Solved Threads: 11
papanyquiL papanyquiL is offline Offline
Junior Poster

File Search for Application Protection

 
0
  #1
Sep 17th, 2009
Hi everyone. Basically what I want to do is search for a specific *.exe file upon initialization of my application. The *.exe file that I want to search for happens to be a .NET debugging tool. When / if my application finds this file, I want it to automatically close and delete itself. The problem is, not everybody will have that *.exe file installed in the same place. Is there a way I can search the entire HD instead of specific folders to find the file? Would @"C:\" search the desktop, My Documents, etc? I'm also not really sure how I can make my program delete itself upon detection; maybe I should start a new thread for that after I figure this out.

Thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 903
Reputation: DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough 
Solved Threads: 144
DdoubleD DdoubleD is offline Offline
Posting Shark

Re: File Search for Application Protection

 
0
  #2
Sep 18th, 2009
Why would you want your application to delete itself?
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: File Search for Application Protection

 
0
  #3
Sep 18th, 2009
This piece of code enumerate on the local drives then gets it root path then search for every exe on you can use SystemFileInfo to handle nested directories...
  1. foreach (System.IO.DriveInfo dirveInfo in System.IO.DriveInfo.GetDrives())
  2. {
  3. foreach(System.IO.FileInfo fileInfo in dirveInfo.RootDirectory.GetFiles("*.exe"))
  4. ///add the exe in list or handle it as you like
  5. }
Last edited by Ramy Mahrous; Sep 18th, 2009 at 11:21 am.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: File Search for Application Protection

 
0
  #4
Sep 18th, 2009
What are you trying to accomplish here? I only can only think of one type of software that behaves like this.............

Please elaborate
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 110
Reputation: papanyquiL is on a distinguished road 
Solved Threads: 11
papanyquiL papanyquiL is offline Offline
Junior Poster

Re: File Search for Application Protection

 
0
  #5
Sep 18th, 2009
Basically I'm adding a few levels of protection scheme. I'm searching all drives for programs like .NET Reflector and some various .NET deobfuscation / debugging tools. When/if these are found my program will delete itself. I have all of this ontop of a custom serial algorithm based on Genetics and Sudoku(LOL). Of course, if this were commercial software I would never go through that much trouble, but it's for a class I'm in to help demonstrate security vulnerabilities.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 903
Reputation: DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough 
Solved Threads: 144
DdoubleD DdoubleD is offline Offline
Posting Shark

Re: File Search for Application Protection

 
0
  #6
Sep 18th, 2009
I still don't understand, but to search an entire drive for a file is not difficult to do:
  1. DirectoryInfo di = new DirectoryInfo(@"c:\");
  2. FileInfo[] finfos = di.GetFiles("*.exe", SearchOption.AllDirectories);
  3. foreach (FileInfo fi in finfos)
  4. ; // do something with the file info
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: File Search for Application Protection

 
0
  #7
Sep 18th, 2009
Something I begun to note is most of askers ignore my reply... and even don't comment, what does it mean????!!!
@papanyquiL didn't you see my reply?? or I should clarify?? or you aren't satisfied with the code??
Last edited by Ramy Mahrous; Sep 18th, 2009 at 4:08 pm.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 110
Reputation: papanyquiL is on a distinguished road 
Solved Threads: 11
papanyquiL papanyquiL is offline Offline
Junior Poster

Re: File Search for Application Protection

 
0
  #8
Sep 19th, 2009
Originally Posted by Ramy Mahrous View Post
Something I begun to note is most of askers ignore my reply... and even don't comment, what does it mean????!!!
@papanyquiL didn't you see my reply?? or I should clarify?? or you aren't satisfied with the code??
Yes Ramy I saw your reply and it worked fine. I just forgot to mark this thread as solved because I was answering some other questions. Thanks for the help everyone
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC