mtotheikle / EWU-OIT-SSN-Scanner

3 stars 0 forks source link

Add Exclusion Paths #1

Open mtotheikle opened 12 years ago

mtotheikle commented 12 years ago

After discussion with James, we would like to be able to control/add exclusion paths so that the scan does not have to go through every file/folder.

Need more details on how we should implement this.

sturakov commented 12 years ago

Greetings everyone,

I just wanted to post a few musings about this issue and my understanding of it.

Adding exclusion paths via GUI...Perhaps a new form should be opened when the user clicks on to add Exclusion Paths?

Adding the paths themselves may be done via an openFileDialog, so the user can select the path via a file-dialog system and then the program could grab the path-string from the result. He could keep doing this and keep adding paths.

A dataGridViewer may be used to display all the paths in a nice list format.

Portability/Storage: I thought perhaps we could create a separate SQL table? The SQL table could store all the paths, but then the table would have to be installed alongside the program whenever the program is installed. I'm not too entirely sure what would be the best way to handle this, let me know if you guys have any ideas.

When the scanner builds the directories to scan, there is a complexity problem. They build the directories via tree-traversal. They use a stack to push a "root" directory and then they access the stack to push on all the "children" of the directories. This makes sense with the tree-structure of the file-system. An issue might be on how to properly implement the checking of the exclusion paths and the paths that are added to the stack. I think this might be cleverly solved.

The biggest issue, thus far, is actually comparing the paths. I don't know if i'm having a silly issue with this, but i'm having a hard time comparing something like... Say I want to exclude C:\ from the scans...Then C:\Users\Aleks should not be scanned right?

I'm having a hard time finding some way of saying these paths are "equal", that C:\ umbrellas anything afterwards.. C:*.

I'm researching this quite a bit, i'm sure i'll find some solution. I just wanted to provide an update on this issue.

mtotheikle commented 12 years ago

Good stuff here.

We can discuss it more Tuesday as far as the GUI stuff.

Some possible solutions might be from here http://stackoverflow.com/questions/2281531/how-can-i-compare-directory-paths-in-c

I would say we do want to avoid and file I/O when comparing paths as that will get expensive.

sturakov commented 12 years ago

I was actually looking at that post on stackoverflow when you posted it haha.

An update on what I'm doing:

I spent most of Saturday researching some ways to exclude paths. This, as I mentioned, will include comparing paths. The link to stackoverflow was a good start, but it mentioned lexicographical comparisons. This is an issue because comparing C:\ to D:\ will return a -1, because C:\ is lexicographically less than D:... So depending on how the code is written, excluding the drive C:\ might also exclude the drive D:. I could explain this in more detail on Tuesday if needed. Plus, I was going down the path of complicated sub-string parsing on comparing paths and other logical checks. In a few words, not a good way to go.

But anyway, After a bunch of time spent testing and researching, I found a nice and simple solution. It's kind of funny in an infuriating way that it was so simple and nice haha.

The good news: I'm fairly confident I can exclude paths correctly in the code, all I need now is the team-okayed GUI design on how to get the paths from the user and the okay to start editing the code.

sturakov commented 12 years ago

An update:

I believe I have successfully implemented the exclusion paths on top of the previous teams code.

I started up the scanner and went to the exclusion paths. I excluded all the drives on my computer except C:. And for C:\, I excluded C:\Windows and C:\Users\Aleks.

I then ran the scanner under Administrator mode.

The scan actually COMPLETED successfully, scanning a total of 3431 files, 1674 hits, and taking about 10 minutes.

I'm sure more testing is needed for greater robustness...But it actually scanned. So, i'm happy.

Some notes: The GUI portion of exclusion paths may look funny on first start-up. I hard-coded an exclusion path automatically, and added the method right after the initialization. It seems the initialization method is still doing stuff when my method is called, i'm not sure if it's some internal threading thing or what..But activating the GUI again fixes the small graphical error.

Future improvements: The way the directories are gathered may have to be re-written, as discussed in class. This would be mainly to reduce memory usage and improve scanning time.

sturakov commented 12 years ago

Except for more testing, general bug finding, and possibly GUI improvements.. I believe this issue may be closed.