diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a82df7f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.*
+!.gitignore
+build/
+dist/
+
diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..5055a5a
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,13 @@
+v1.2.0 [2021-07-26]
+- (Fix) External USB drives weren't being detected on Windows 10.
+
+v1.1.0 [2009-02-02]
+- (New) Suspected worm file extension list updated. Also removes any autorun.inf file found in the drive root.
+- (New) Now can detect the following file extensions: exe, cmd, bat, vb, vbs, vbe, vbscript, js, jse, ws, wsf, wsh, pif, scr, sct, script.
+
+v1.0.1 [2008-09-08]
+- (Fix) Newly attached mass storage devices weren't getting detected.
+
+v1.0.0 [2008-08-26]
+- First release.
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..55f3f3f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,24 @@
+USB Worm Protection License
+
+Copyright (c) 2021 Sharafat Ibn Mollah Mosharraf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, and/or sublicense the Software,
+and to permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+1. The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+2. If the source code is modified, the "About" section of the application shall
+include "Original Software Credit: Sharafat Ibn Mollah Mosharraf (www.sharafat.co.uk)".
+3. No commercial transactions are allowed. Therefore, the Software cannot be sold.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..98efc6a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,29 @@
+# USB Worm Protection
+USB Worm Protection provides you with an easy and highly efficient way to scan your hard
+disk and USB devices for computer worms. This reliable and intuitive piece of software
+is a great tool for every computer user that wants to protect their systems against
+these types of malware programs.
+
+USB Worm Protection is a simple-to-use program designed to rid your USB flash disks of
+files infected with worms. It packs several handy features that can be figured out even
+by users with little or no experience in antivirus systems.
+
+At initialization, the tool creates an icon in the system tray area, where you can access
+options and configure settings.
+
+Aside from scanning the USB flash disks, USB Worm Protection is also capable of scanning
+your local drives for worms. This process shows the total scanned, detected and suspected
+items, start and finish time, and duration. Every detected worm or suspected file can be
+deleted, skipped or sent to the quarantine.
+
+As far as program preferences go, you can enable silent scan mode, set the tool to prompt
+for an action against suspected files, and configure scan notification options (e.g. remove
+slide-in dialogs after the scan is done). A restart of USB Worm Protection is required to
+apply the new changes.
+
+The application uses a moderate-to-high amount of CPU and RAM, but it doesn't interrupt user
+activity, since it can run silently in the background, alongside other processes.
+
+[Description provided courtesy of Softpedia and Softoxi.]
+
+For more information, please visit [http://usbwp.sharafat.co.uk](http://usbwp.sharafat.co.uk)
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..d305965
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project USB Worm Protection.
+
+
+
diff --git a/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
new file mode 100644
index 0000000..3c8dd2f
Binary files /dev/null and b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar differ
diff --git a/lib/hamcrest/hamcrest-core-1.3.jar b/lib/hamcrest/hamcrest-core-1.3.jar
new file mode 100644
index 0000000..9d5fe16
Binary files /dev/null and b/lib/hamcrest/hamcrest-core-1.3.jar differ
diff --git a/lib/junit_4/junit-4.13.1-javadoc.jar b/lib/junit_4/junit-4.13.1-javadoc.jar
new file mode 100644
index 0000000..d284bd0
Binary files /dev/null and b/lib/junit_4/junit-4.13.1-javadoc.jar differ
diff --git a/lib/junit_4/junit-4.13.1-sources.jar b/lib/junit_4/junit-4.13.1-sources.jar
new file mode 100644
index 0000000..b68ac35
Binary files /dev/null and b/lib/junit_4/junit-4.13.1-sources.jar differ
diff --git a/lib/junit_4/junit-4.13.1.jar b/lib/junit_4/junit-4.13.1.jar
new file mode 100644
index 0000000..b376ffc
Binary files /dev/null and b/lib/junit_4/junit-4.13.1.jar differ
diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties
new file mode 100644
index 0000000..1ebe18e
--- /dev/null
+++ b/lib/nblibraries.properties
@@ -0,0 +1,16 @@
+libs.CopyLibs.classpath=\
+ ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
+libs.CopyLibs.displayName=CopyLibs Task
+libs.CopyLibs.prop-version=3.0
+libs.hamcrest.classpath=\
+ ${base}/hamcrest/hamcrest-core-1.3.jar
+libs.hamcrest.displayName=Hamcrest 1.3
+libs.hamcrest.prop-maven-dependencies=org.hamcrest:hamcrest-core:1.3:jar
+libs.junit_4.classpath=\
+ ${base}/junit_4/junit-4.13.1.jar
+libs.junit_4.displayName=JUnit 4.12
+libs.junit_4.javadoc=\
+ ${base}/junit_4/junit-4.13.1-javadoc.jar
+libs.junit_4.prop-maven-dependencies=junit:junit:4.13.1:jar
+libs.junit_4.src=\
+ ${base}/junit_4/junit-4.13.1-sources.jar
diff --git a/manifest.mf b/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
new file mode 100644
index 0000000..8172051
--- /dev/null
+++ b/nbproject/build-impl.xml
@@ -0,0 +1,1796 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.src.dir
+ Must set test.test.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
new file mode 100644
index 0000000..8edf169
--- /dev/null
+++ b/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=c760dccb
+build.xml.script.CRC32=6a848cfb
+build.xml.stylesheet.CRC32=f85dc8f2@1.99.0.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=c760dccb
+nbproject/build-impl.xml.script.CRC32=ea629f84
+nbproject/build-impl.xml.stylesheet.CRC32=d549e5cc@1.99.0.48
diff --git a/nbproject/private/config.properties b/nbproject/private/config.properties
new file mode 100644
index 0000000..e69de29
diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties
new file mode 100644
index 0000000..e7eab02
--- /dev/null
+++ b/nbproject/private/private.properties
@@ -0,0 +1,8 @@
+compile.on.save=true
+do.depend=false
+do.jar=true
+do.jlink=true
+javac.debug=true
+javadoc.preview=true
+jlink.strip=false
+user.properties.file=/Users/sharafat/Library/Application Support/NetBeans/12.4/build.properties
diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml
new file mode 100644
index 0000000..4750962
--- /dev/null
+++ b/nbproject/private/private.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 0000000..eccdbc2
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,84 @@
+#Mon Jul 26 18:50:12 BDT 2021
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit_4.classpath}:\
+ ${libs.hamcrest.classpath}
+excludes=
+javac.processorpath=\
+ ${javac.classpath}
+dist.javadoc.dir=${dist.dir}/javadoc
+src.src.dir=src
+run.modulepath=\
+ ${javac.modulepath}
+annotation.processing.enabled=true
+build.sysclasspath=ignore
+debug.modulepath=${run.modulepath}
+javac.compilerargs=
+javadoc.noindex=false
+javadoc.private=false
+javadoc.author=false
+endorsed.classpath=
+main.class=Main
+junit.selected.version=3
+source.encoding=UTF-8
+javac.source=16
+includes=**
+javadoc.use=true
+jar.compress=true
+javadoc.nonavbar=false
+annotation.processing.enabled.in.editor=false
+javadoc.notree=false
+annotation.processing.processors.list=
+application.vendor=sharafat
+javac.deprecation=false
+jlink.launcher=true
+javadoc.additionalparam=
+jlink.launcher.name=USB Worm Protection
+build.generated.sources.dir=${build.dir}/generated-sources
+javadoc.splitindex=true
+javac.processormodulepath=
+run.jvmargs=
+jlink.additionalmodules=
+javadoc.encoding=${source.encoding}
+javac.classpath=
+mkdist.disabled=false
+run.test.modulepath=\
+ ${javac.test.modulepath}
+build.classes.excludes=**/*.java,**/*.form
+dist.jlink.dir=${dist.dir}/jlink
+dist.jar=${dist.dir}/USB_Worm_Protection.jar
+build.classes.dir=${build.dir}/classes
+debug.test.modulepath=${run.test.modulepath}
+build.test.classes.dir=${build.dir}/test/classes
+javadoc.windowtitle=
+build.test.results.dir=${build.dir}/test/results
+dist.dir=dist
+build.dir=build
+dist.archive.excludes=
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+build.generated.dir=${build.dir}/generated
+javadoc.version=false
+application.title=USB Worm Protection
+javac.test.modulepath=\
+ ${javac.modulepath}
+debug.test.classpath=${run.test.classpath}
+javac.external.vm=true
+javac.target=16
+platform.active=default_platform
+manifest.file=manifest.mf
+javadoc.html5=false
+javac.test.processorpath=${javac.test.classpath}
+meta.inf.dir=${src.dir}/META-INF
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+dist.jlink.output=${dist.jlink.dir}/USB_Worm_Protection
+annotation.processing.run.all.processors=true
+javac.modulepath=
+jlink.additionalparam=
+debug.classpath=${run.classpath}
+test.test.dir=test
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 0000000..1c09b65
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,18 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ USB Worm Protection
+
+
+
+
+
+
+
+
+ ./lib/nblibraries.properties
+
+
+
diff --git a/src/About.form b/src/About.form
new file mode 100644
index 0000000..9c6100f
--- /dev/null
+++ b/src/About.form
@@ -0,0 +1,111 @@
+
+
+
diff --git a/src/About.java b/src/About.java
new file mode 100644
index 0000000..7bcd7e9
--- /dev/null
+++ b/src/About.java
@@ -0,0 +1,172 @@
+/*
+ * About.java
+ *
+ * Created on July 23, 2008, 12:37 PM
+ */
+
+import java.net.URI;
+import java.awt.*;
+
+/**
+ *
+ * @author Sharafat
+ */
+public class About extends javax.swing.JPanel {
+
+ /** Creates new form About */
+ public About() {
+ initComponents();
+ if (Desktop.isDesktopSupported()) {
+ desktop = Desktop.getDesktop();
+ }
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ licence = new javax.swing.JLabel();
+ website = new javax.swing.JLabel();
+ email = new javax.swing.JLabel();
+ heading = new javax.swing.JLabel();
+ logo = new javax.swing.JLabel();
+ jLabel1 = new javax.swing.JLabel();
+
+ setBackground(new java.awt.Color(255, 255, 255));
+
+ licence.setText("License Agreement:
You are free to copy, modify and redistribute this program provided that - - Commercial transactions might not be involved.
- If you modify this program, you must include at least the following line in the About section:
\"Original software credit: Sharafat Ibn Mollah Mosharraf (www.sharafat.co.uk)\"
");
+
+ website.setText("www.sharafat.co.uk");
+ website.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ websiteMouseClicked(evt);
+ }
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ websiteMouseEntered(evt);
+ }
+ public void mouseExited(java.awt.event.MouseEvent evt) {
+ websiteMouseExited(evt);
+ }
+ });
+
+ email.setText("sharafat_8271@yahoo.co.uk");
+ email.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ emailMouseClicked(evt);
+ }
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ emailMouseEntered(evt);
+ }
+ public void mouseExited(java.awt.event.MouseEvent evt) {
+ emailMouseExited(evt);
+ }
+ });
+
+ heading.setText("USB Worm Protection
Version: 1.2 Build 2021.07.26");
+ heading.setVerticalAlignment(javax.swing.SwingConstants.TOP);
+
+ logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/USBWP_logo.png"))); // NOI18N
+ logo.setVerticalAlignment(javax.swing.SwingConstants.TOP);
+
+ jLabel1.setText("Crafted with Love by:
Sharafat Ibn Mollah Mosharraf
Founder & CEO, Eximus Technologies
www.eximustech.com");
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap(29, Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel1)
+ .addComponent(email, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(website)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(logo)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(heading, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(licence, javax.swing.GroupLayout.PREFERRED_SIZE, 372, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(10, 10, 10))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(logo)
+ .addComponent(heading))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jLabel1)
+ .addGap(0, 0, 0)
+ .addComponent(email)
+ .addGap(0, 0, 0)
+ .addComponent(website)
+ .addGap(18, 18, 18)
+ .addComponent(licence)
+ .addContainerGap())
+ );
+
+ website.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ }// //GEN-END:initComponents
+
+private void emailMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_emailMouseClicked
+ if (desktop.isSupported(Desktop.Action.MAIL)) {
+ try {
+ uri = new URI("mailto", "sharafat_8271@yahoo.co.uk", null);
+ desktop.mail(uri);
+ } catch (Exception ex) {}
+ }
+}//GEN-LAST:event_emailMouseClicked
+
+private void emailMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_emailMouseEntered
+ if (desktop.isSupported(Desktop.Action.MAIL)) {
+ email.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ email.setForeground(Color.RED);
+ }
+}//GEN-LAST:event_emailMouseEntered
+
+private void websiteMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_websiteMouseEntered
+ if (desktop.isSupported(Desktop.Action.MAIL)) {
+ website.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ website.setForeground(Color.RED);
+ }
+}//GEN-LAST:event_websiteMouseEntered
+
+private void websiteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_websiteMouseClicked
+ if (desktop.isSupported(Desktop.Action.BROWSE)) {
+ try {
+ uri = new URI("http://www.sharafat.co.uk");
+ desktop.browse(uri);
+ } catch (Exception ex) {}
+ }
+}//GEN-LAST:event_websiteMouseClicked
+
+private void websiteMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_websiteMouseExited
+ if (desktop != null) {
+ website.setForeground(Color.BLACK);
+ }
+}//GEN-LAST:event_websiteMouseExited
+
+private void emailMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_emailMouseExited
+ if (desktop != null) {
+ email.setForeground(Color.BLACK);
+ }
+}//GEN-LAST:event_emailMouseExited
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel email;
+ private javax.swing.JLabel heading;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel licence;
+ private javax.swing.JLabel logo;
+ private javax.swing.JLabel website;
+ // End of variables declaration//GEN-END:variables
+
+ // Custom Field declarations
+ private Desktop desktop;
+ private URI uri;
+}
diff --git a/src/DetectRemovableDevices.java b/src/DetectRemovableDevices.java
new file mode 100644
index 0000000..b685884
--- /dev/null
+++ b/src/DetectRemovableDevices.java
@@ -0,0 +1,146 @@
+import java.util.ArrayList;
+import java.io.File;
+import javax.swing.filechooser.FileSystemView;
+
+/**
+ *
+ * @author Sharafat
+ */
+public class DetectRemovableDevices implements Runnable {
+ public Thread t;
+ private ScansManager scansManager;
+ private boolean isProtectionEnabled = true;
+ private ArrayList permanentDrives = new ArrayList(10);
+ private ArrayList newDrives = new ArrayList(10);
+ private ArrayList detectedDrives = new ArrayList(10);
+ private File[] currentDrives;
+
+ DetectRemovableDevices(ScansManager scansManager) {
+ this.scansManager = scansManager;
+ t = new Thread(this, "Removable Media Detection");
+ t.start();
+ }
+
+ public void run() {
+ // Detect currently attached drives and treat those as permanent drives
+ File[] permaDrives = File.listRoots();
+ for (File drive : permaDrives) {
+ String description = FileSystemView.getFileSystemView().getSystemTypeDescription(drive);
+ if (description != null && "Local Disk".equalsIgnoreCase(description)) {
+ permanentDrives.add(drive);
+ }
+ }
+
+ // Start detecting removable devices
+ while (isProtectionEnabled) {
+ continuouslyDetectRemovableDevices();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {}
+ }
+ }
+
+ private void continuouslyDetectRemovableDevices() {
+ currentDrives = File.listRoots();
+
+ if ((currentDrives.length - detectedDrives.size()) < permanentDrives.size()) {
+ boolean notPresentInDetectedDrives = true;
+ for (int i = 0; i < detectedDrives.size(); i++) {
+ File testPresenceOfDetectedDrives = detectedDrives.get(i);
+ if (!testPresenceOfDetectedDrives.exists()) {
+ notPresentInDetectedDrives = false;
+ detectedDrives.remove(i);
+ }
+ }
+ if (notPresentInDetectedDrives) {
+ for (int i = 0; i < permanentDrives.size(); i++) {
+ boolean isInCurrentDrives = false;
+ for (int j = 0; j < currentDrives.length; j++) {
+ if (permanentDrives.get(i).toString()
+ .equals(currentDrives[j].getAbsolutePath())) {
+ isInCurrentDrives = true;
+ break;
+ }
+ }
+ if (!isInCurrentDrives) {
+ permanentDrives.remove(i--);
+ if (i < 0) {
+ i = 0;
+ }
+ }
+ }
+ }
+ return;
+ } else if ((currentDrives.length - detectedDrives.size()) > permanentDrives.size()) {
+ //Detect newly added drives
+ int j = 0;
+ for (int i = 0; i < currentDrives.length; i++) {
+ try {
+ if (!permanentDrives.get(j).toString()
+ .equals(currentDrives[i].toString())) {
+ boolean isAvailableInDetectedDrives = false;
+ for (int k = 0; k < detectedDrives.size(); k++) {
+ if (detectedDrives.get(k).toString()
+ .equals(currentDrives[i].toString())) {
+ isAvailableInDetectedDrives = true;
+ break;
+ }
+ }
+ if (!isAvailableInDetectedDrives) {
+ newDrives.add(currentDrives[i]);
+ }
+ continue;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ boolean isAvailableInDetectedDrives = false;
+ for (int k = 0; k < detectedDrives.size(); k++) {
+ if (detectedDrives.get(k).toString().equals(currentDrives[i].toString())) {
+ isAvailableInDetectedDrives = true;
+ break;
+ }
+ }
+ if (!isAvailableInDetectedDrives) {
+ newDrives.add(currentDrives[i]);
+ }
+ }
+ j++;
+ }
+
+ //Start scanning newly added drives
+ int newDrivesSize = newDrives.size();
+ for (int i = 0; i < newDrivesSize; i++) {
+ // Check for drives without disks, e.g., card readers without memory cards inserted
+ if (FileSystemView.getFileSystemView().getSystemDisplayName(newDrives.get(0)).equals("")) {
+ detectedDrives.add(newDrives.get(0));
+ newDrives.remove(0);
+ continue;
+ }
+
+ // If the new drive is scannable, call ScansManager for scanning
+ String driveType = FileSystemView.getFileSystemView()
+ .getSystemTypeDescription(newDrives.get(0));
+ if (driveType != null
+ && (driveType.equalsIgnoreCase("Local Disk")
+ || driveType.equalsIgnoreCase("Removable Disk")
+ || driveType.equalsIgnoreCase("USB Drive")
+ || driveType.equalsIgnoreCase("Network Drive"))) {
+ scansManager.performScan(newDrives.get(0));
+ }
+
+ // Mark this drive as detected
+ detectedDrives.add(newDrives.get(0));
+ newDrives.remove(0);
+ }
+ }
+
+ }
+
+ public void disableProtection(){
+ isProtectionEnabled = false;
+ }
+
+ public void enableProtection(){
+ isProtectionEnabled = true;
+ }
+
+}
diff --git a/src/Main.java b/src/Main.java
new file mode 100644
index 0000000..54b4f5c
--- /dev/null
+++ b/src/Main.java
@@ -0,0 +1,112 @@
+import javax.swing.*;
+import java.io.*;
+
+/**
+ *
+ * @author Sharafat
+ */
+public class Main {
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) {
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ // Set Windows Look-&-Feel
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Exception e) {}
+
+ // Construct the preferences panel
+ PreferencesPanel prefPanel = new PreferencesPanel();
+
+ // Load the default preference values
+ boolean shouldDoSilentScan = true;
+ int suspectedFileAction = 0; // 0 = Prompt, 1 = Delete, 2 = Quarantine, 3 = Leave
+ int protectionEnableStatus = 0; // 0 = Enabled or Enable at next program restart,
+ // 1 = Enable at user request only
+ boolean shouldShowSlideInScanDialog = true;
+ boolean shouldRemoveSlideInDialogAfterScan = false;
+ boolean shouldAlwaysDisplayScanDetails = false;
+
+ // Change the default preference values if necessary
+ File prefFile = new File("preferences.dat");
+ boolean prefFileExists = prefFile.exists();
+ if (prefFileExists) {
+ // Read the preferences and set the values
+ Preferences preferences = new Preferences();
+ ObjectInputStream obin = null;
+ try {
+ obin = new ObjectInputStream(new FileInputStream("preferences.dat"));
+ preferences = (Preferences) obin.readObject();
+
+ shouldDoSilentScan = preferences.shouldDoSilentScan;
+ suspectedFileAction = preferences.suspectedFileAction;
+ protectionEnableStatus = preferences.protectionEnableStatus;
+ shouldShowSlideInScanDialog = preferences.shouldShowSlideInScanDialog;
+ shouldRemoveSlideInDialogAfterScan = preferences.shouldRemoveSlideInDialogAfterScan;
+ shouldAlwaysDisplayScanDetails = preferences.shouldAlwaysDisplayScanDetails;
+ } catch (Exception e) {
+ } finally {
+ try {
+ obin.close();
+ } catch (Exception e) {}
+ }
+
+ // Modify the preferences panel according to user's selected preferences
+ prefPanel.setPreferences(preferences);
+ }
+
+ // Start Scans Manager
+ Object[] param = {shouldDoSilentScan, suspectedFileAction, shouldShowSlideInScanDialog,
+ shouldRemoveSlideInDialogAfterScan, shouldAlwaysDisplayScanDetails};
+
+ ScansManager scansManager = new ScansManager(param);
+
+ // Construct the Scan and About panels
+ ScanPanel scanPanel = new ScanPanel(scansManager);
+ About aboutPanel = new About();
+
+ // Construct the main window
+ MainWindow mainWindow = new MainWindow(aboutPanel, scanPanel, prefPanel);
+
+ // Start detecting removable devices
+ DetectRemovableDevices detectRemDev = new DetectRemovableDevices(scansManager);
+
+ // Construct the system tray according to protection status
+ if (protectionEnableStatus == 1) { // i.e. "Enable at user request only"
+ // Disable on-access protection
+ detectRemDev.disableProtection();
+
+ // Construct tray icon with the disabled icon
+ new ProgramTrayIcon(mainWindow, scansManager, detectRemDev, false);
+
+ // Display a slide-in message warning the user about the disabled protection
+ SlideInDialog protectDisabledMsg = new SlideInDialog();
+ protectDisabledMsg.bodyPanel.add(new JLabel(
+ "Protection against worms is disabled.",
+ new ImageIcon(getClass().getResource("/images/attention.png")),
+ SwingConstants.CENTER));
+ protectDisabledMsg.background.setIcon(new ImageIcon(getClass()
+ .getResource("/images/background_yellow.png")));
+ new SlideInNotification(protectDisabledMsg);
+ } else {
+ // Construct tray icon with the enabled icon
+ new ProgramTrayIcon(mainWindow, scansManager, detectRemDev, true);
+ }
+
+ }
+ });
+ }
+
+ /**
+ * Method for checking another instance of the program. (Used by JavaExe)
+ * @param args
+ * @return true
+ */
+ public static boolean isOneInstance(String[] args) {
+ return true;
+ };
+
+}
diff --git a/src/MainWindow.form b/src/MainWindow.form
new file mode 100644
index 0000000..524db6b
--- /dev/null
+++ b/src/MainWindow.form
@@ -0,0 +1,276 @@
+
+
+
diff --git a/src/MainWindow.java b/src/MainWindow.java
new file mode 100644
index 0000000..5edf389
--- /dev/null
+++ b/src/MainWindow.java
@@ -0,0 +1,315 @@
+/*
+ * MainWindow.java
+ *
+ * Created on July 23, 2008, 5:31 AM
+ */
+
+import java.awt.*;
+
+/**
+ *
+ * @author Sharafat
+ */
+public class MainWindow extends javax.swing.JFrame {
+ About aboutPanel;
+ ScanPanel scanPanel;
+ PreferencesPanel prefPanel;
+
+ /** Creates new form MainWindow
+ * @param aboutPanel The About Panel
+ * @param scanPanel The Scan Panel
+ * @param prefPanel The Preferences Panel
+ * @param scanFrame The Scan Frame
+ */
+ public MainWindow(About aboutPanel, ScanPanel scanPanel, PreferencesPanel prefPanel) {
+ this.aboutPanel = aboutPanel;
+ this.scanPanel = scanPanel;
+ this.prefPanel = prefPanel;
+ initComponents();
+ panel.add(scanPanel);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ panel = new javax.swing.JPanel();
+ jLayeredPane1 = new javax.swing.JLayeredPane();
+ scanLbl = new javax.swing.JLabel();
+ jLabel1 = new javax.swing.JLabel();
+ jLayeredPane2 = new javax.swing.JLayeredPane();
+ prefLbl = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLayeredPane3 = new javax.swing.JLayeredPane();
+ aboutLbl = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLayeredPane4 = new javax.swing.JLayeredPane();
+ title = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+
+ setTitle("USB Worm Protection");
+ setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
+ setIconImage(Toolkit.getDefaultToolkit().getImage(Main.class.getResource("images/icon.png")));
+ setResizable(false);
+
+ panel.setBackground(new java.awt.Color(255, 255, 255));
+ panel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
+
+ scanLbl.setBackground(new java.awt.Color(255, 255, 255));
+ scanLbl.setFont(new java.awt.Font("Arial", 1, 12));
+ scanLbl.setForeground(new java.awt.Color(255, 255, 255));
+ scanLbl.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/scan.png"))); // NOI18N
+ scanLbl.setText("Scan");
+ scanLbl.setIconTextGap(7);
+ scanLbl.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ scanLblMouseClicked(evt);
+ }
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ scanLblMouseEntered(evt);
+ }
+ public void mouseExited(java.awt.event.MouseEvent evt) {
+ scanLblMouseExited(evt);
+ }
+ });
+ scanLbl.setBounds(10, 0, 160, 27);
+ jLayeredPane1.add(scanLbl, javax.swing.JLayeredPane.DEFAULT_LAYER);
+ scanLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/header_blue.png"))); // NOI18N
+ jLabel1.setBounds(0, 0, 170, 27);
+ jLayeredPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);
+
+ prefLbl.setBackground(new java.awt.Color(255, 255, 255));
+ prefLbl.setFont(new java.awt.Font("Arial", 0, 12));
+ prefLbl.setForeground(new java.awt.Color(255, 255, 255));
+ prefLbl.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/preferences.png"))); // NOI18N
+ prefLbl.setText("Preferences");
+ prefLbl.setIconTextGap(7);
+ prefLbl.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ prefLblMouseClicked(evt);
+ }
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ prefLblMouseEntered(evt);
+ }
+ public void mouseExited(java.awt.event.MouseEvent evt) {
+ prefLblMouseExited(evt);
+ }
+ });
+ prefLbl.setBounds(10, 0, 160, 25);
+ jLayeredPane2.add(prefLbl, javax.swing.JLayeredPane.DEFAULT_LAYER);
+ prefLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+
+ jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/header_blue.png"))); // NOI18N
+ jLabel2.setBounds(0, 0, 170, 27);
+ jLayeredPane2.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);
+
+ aboutLbl.setBackground(new java.awt.Color(255, 255, 255));
+ aboutLbl.setFont(new java.awt.Font("Arial", 0, 12));
+ aboutLbl.setForeground(new java.awt.Color(255, 255, 255));
+ aboutLbl.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/about.png"))); // NOI18N
+ aboutLbl.setText("About");
+ aboutLbl.setIconTextGap(7);
+ aboutLbl.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ aboutLblMouseClicked(evt);
+ }
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ aboutLblMouseEntered(evt);
+ }
+ public void mouseExited(java.awt.event.MouseEvent evt) {
+ aboutLblMouseExited(evt);
+ }
+ });
+ aboutLbl.setBounds(10, 0, 160, 27);
+ jLayeredPane3.add(aboutLbl, javax.swing.JLayeredPane.DEFAULT_LAYER);
+ aboutLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+
+ jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/header_blue.png"))); // NOI18N
+ jLabel3.setBounds(0, 0, 170, 27);
+ jLayeredPane3.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);
+
+ title.setBackground(new java.awt.Color(255, 255, 255));
+ title.setFont(new java.awt.Font("Arial", 1, 12));
+ title.setForeground(new java.awt.Color(255, 255, 255));
+ title.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/scan.png"))); // NOI18N
+ title.setText("Scan");
+ title.setIconTextGap(7);
+ title.setBounds(6, 0, 430, 27);
+ jLayeredPane4.add(title, javax.swing.JLayeredPane.DEFAULT_LAYER);
+
+ jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/header_blue_2.png"))); // NOI18N
+ jLabel4.setBounds(0, 0, 436, 27);
+ jLayeredPane4.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLayeredPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
+ .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
+ .addComponent(jLayeredPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, 436, Short.MAX_VALUE)
+ .addComponent(jLayeredPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 436, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLayeredPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLayeredPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLayeredPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ protected void scanLabelClicked() {
+ prefLbl.setFont(new Font("Arial", 0, 12));
+ prefLbl.setText("Preferences");
+ scanLbl.setFont(new Font("Arial", 1, 12));
+ aboutLbl.setFont(new Font("Arial", 0, 12));
+ aboutLbl.setText("About");
+
+ title.setIcon(new javax.swing.ImageIcon(
+ getClass().getResource("/images/scan.png")));
+ title.setText("Scan");
+
+ scanPanel.displayDrives();
+ panel.removeAll();
+ validate();
+ panel.repaint();
+ panel.add(scanPanel);
+ }
+
+ protected void preferencesLabelClicked() {
+ prefLbl.setFont(new Font("Arial", 1, 12));
+ scanLbl.setFont(new Font("Arial", 0, 12));
+ scanLbl.setText("Scan");
+ aboutLbl.setFont(new Font("Arial", 0, 12));
+ aboutLbl.setText("About");
+
+ title.setIcon(new javax.swing.ImageIcon(
+ getClass().getResource("/images/preferences.png")));
+ title.setText("Preferences");
+
+ panel.removeAll();
+ validate();
+ panel.repaint();
+ panel.add(prefPanel);
+ }
+
+ protected void aboutLabelClicked() {
+ prefLbl.setFont(new Font("Arial", 0, 12));
+ prefLbl.setText("Preferences");
+ scanLbl.setFont(new Font("Arial", 0, 12));
+ scanLbl.setText("Scan");
+ aboutLbl.setFont(new Font("Arial", 1, 12));
+
+ title.setIcon(new javax.swing.ImageIcon(
+ getClass().getResource("/images/about.png")));
+ title.setText("About");
+
+ panel.removeAll();
+ validate();
+ panel.repaint();
+ panel.add(aboutPanel);
+ }
+
+private void scanLblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_scanLblMouseClicked
+ scanLabelClicked();
+}//GEN-LAST:event_scanLblMouseClicked
+
+private void prefLblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_prefLblMouseClicked
+ preferencesLabelClicked();
+}//GEN-LAST:event_prefLblMouseClicked
+
+private void aboutLblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_aboutLblMouseClicked
+ aboutLabelClicked();
+}//GEN-LAST:event_aboutLblMouseClicked
+
+private void scanLblMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_scanLblMouseEntered
+ if (scanLbl.getFont().isBold()) {
+ scanLbl.setText("Scan");
+ } else {
+ scanLbl.setText("Scan");
+ }
+}//GEN-LAST:event_scanLblMouseEntered
+
+private void scanLblMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_scanLblMouseExited
+ if (scanLbl.getFont().isBold()) {
+ scanLbl.setText("Scan");
+ } else {
+ scanLbl.setText("Scan");
+ }
+}//GEN-LAST:event_scanLblMouseExited
+
+private void prefLblMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_prefLblMouseEntered
+ if (prefLbl.getFont().isBold()) {
+ prefLbl.setText("Preferences");
+ } else {
+ prefLbl.setText("Preferences");
+ }
+}//GEN-LAST:event_prefLblMouseEntered
+
+private void prefLblMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_prefLblMouseExited
+ if (prefLbl.getFont().isBold()) {
+ prefLbl.setText("Preferences");
+ } else {
+ prefLbl.setText("Preferences");
+ }
+}//GEN-LAST:event_prefLblMouseExited
+
+private void aboutLblMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_aboutLblMouseEntered
+ if (aboutLbl.getFont().isBold()) {
+ aboutLbl.setText("About");
+ } else {
+ aboutLbl.setText("About");
+ }
+}//GEN-LAST:event_aboutLblMouseEntered
+
+private void aboutLblMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_aboutLblMouseExited
+ if (aboutLbl.getFont().isBold()) {
+ aboutLbl.setText("About");
+ } else {
+ aboutLbl.setText("About");
+ }
+}//GEN-LAST:event_aboutLblMouseExited
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel aboutLbl;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLayeredPane jLayeredPane1;
+ private javax.swing.JLayeredPane jLayeredPane2;
+ private javax.swing.JLayeredPane jLayeredPane3;
+ private javax.swing.JLayeredPane jLayeredPane4;
+ protected javax.swing.JPanel panel;
+ private javax.swing.JLabel prefLbl;
+ private javax.swing.JLabel scanLbl;
+ private javax.swing.JLabel title;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/src/Main_SystemEventManagement.java b/src/Main_SystemEventManagement.java
new file mode 100644
index 0000000..59129d0
Binary files /dev/null and b/src/Main_SystemEventManagement.java differ
diff --git a/src/PauseProtection.form b/src/PauseProtection.form
new file mode 100644
index 0000000..b254026
--- /dev/null
+++ b/src/PauseProtection.form
@@ -0,0 +1,309 @@
+
+
+
diff --git a/src/PauseProtection.java b/src/PauseProtection.java
new file mode 100644
index 0000000..bafea73
--- /dev/null
+++ b/src/PauseProtection.java
@@ -0,0 +1,406 @@
+/*
+ * PauseProtection.java
+ *
+ * Created on July 25, 2008, 1:42 PM
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import java.io.*;
+
+/**
+ *
+ * @author Sharafat
+ */
+public class PauseProtection extends javax.swing.JDialog {
+ private boolean[] isProtectionEnabled;
+ private MenuItem protectionStatus;
+ private DetectRemovableDevices detectRemDev;
+ private ScansManager scansManager;
+ protected Timer timer;
+
+ /** Creates new form PauseProtection */
+ public PauseProtection(Frame parent, boolean modal, Object[] param) {
+ super(parent, modal);
+ isProtectionEnabled = (boolean[]) param[0];
+ protectionStatus = (MenuItem) param[1];
+ detectRemDev = (DetectRemovableDevices) param[2];
+ scansManager = (ScansManager) param[3];
+ initComponents();
+ }
+
+ private void pauseProtection() {
+ isProtectionEnabled[0] = false;
+ protectionStatus.setLabel("Resume Protection");
+ TrayIcon[] trayIcon = SystemTray.getSystemTray().getTrayIcons();
+ trayIcon[0].setImage(new ImageIcon(Main.class.getResource(
+ "/images/disabledTrayIcon.png"), "Tray Icon (Disabled)").getImage());
+ trayIcon[0].setToolTip("USB Worm Protection (Protection Disabled)");
+ detectRemDev.disableProtection();
+ }
+
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ warning = new javax.swing.JLabel();
+ cancel = new javax.swing.JButton();
+ mainPanel = new javax.swing.JPanel();
+ inPanel = new javax.swing.JLayeredPane();
+ time = new javax.swing.JComboBox();
+ inLabel = new javax.swing.JLabel();
+ inHeadingLabel = new javax.swing.JLabel();
+ jLabel1 = new javax.swing.JLabel();
+ bgInPanel = new javax.swing.JLabel();
+ nextPanel = new javax.swing.JLayeredPane();
+ nextLabel = new javax.swing.JLabel();
+ nextLabelHeading = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ bgNextPanel = new javax.swing.JLabel();
+ userRequestPanel = new javax.swing.JLayeredPane();
+ userRequestLabel = new javax.swing.JLabel();
+ userRequestHeadingLabel = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ bgUserReqPanel = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("USB Worm Protection");
+ setName("pauseDialog"); // NOI18N
+ setResizable(false);
+
+ warning.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/warning.png"))); // NOI18N
+ warning.setText("Protection will be suspended.
Enable protection again:Protection will be suspended; it will be resumed automatically in 1 minute.