import java.awt.BorderLayout;
public class av extends JFrame {
private JPanel contentPane;
private JButton btnNewButton;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
av frame = new av();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public av() {
setTitle("Evil AV");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setForeground(Color.WHITE);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
btnNewButton = new JButton("Full scan");
JButton button = new JButton("Scan file");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup()
.addContainerGap(257, Short.MAX_VALUE)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE)
.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE))
.addGap(26))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(33)
.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
.addGap(18)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
.addContainerGap(121, Short.MAX_VALUE))
);
contentPane.setLayout(gl_contentPane);
}
}
btnNewButton = new JButton("Full scan");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileInputStream allHDscan;
allHDscan = new FileInputStream("here");
}
});
Im trying to get the path of a computer to start with the scanning but when I try:btnNewButton = new JButton("Full scan");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileInputStream allHDscan;
allHDscan = new FileInputStream("here");
}
});
I dont know what to put between "here" it doesnt look well I think that I would need a method called getpath() but examples on the web are fews besides I started java a week ago :P so any suggestions?
class EnvPath { public static void main(String[] args) {
System.out.println( System.getenv("PATH") );
}}
besides I started java a week ago
so any suggestions?
import java.io.*;
public class test
{
public static void main(String[] args)
{
File[] roots = File.listRoots();
for(int i=0;i<roots.length;i++)
System.out.println(roots[i]);
}
}
C:\Users\nohusuro\Desktop>javac -d . *.java && java test
C:\
D:\
E:\
F:\
G:\
X:\
Z:\
sh-3.2$ javac -d . *.java && java test
/
You could also use javax.swing.filechooser.FileSystemView which is more advanced version that can you get more information such as drive name. And if you wanted to get really advanced you could implement JNI and mix Java with any other language (preferably C). See example below.nice post dude very useful look I want to make button "full scan" to start scanning the hard drive but I can easly set a name of the path but what happens if the path is alike as the one that I set for example in linux the path is "root" and in windows the path is "C or D" however they are named I will have to read the user`s path name? or I need to use a thing named getdefault directory? for example:
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html#examp (http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html#examp)
public File getHomeDirectory() {
369: return createFileObject(System.getProperty("user.home"));
370: }
371:
372: /**
373: * Return the user's default starting directory for the file chooser.
374: *
375: * @return a <code>File</code> object representing the default
376: * starting folder
377: */
378:... public File getDefaultDirectory() {
379: File f = (File)ShellFolder.get("fileChooserDefaultFolder");
380:... if (isFileSystemRoot(f)) {
381: f = createFileSystemRoot(f);
382: }
Like already stated in/by previous posts and or comments. The hard part is NOT making a simple AV, the work is keeping it up to date with the latest threats. That is, a static signature scanner'ish type. If you want a good AV, you need something that can make sense out of machine code, and look for common malware movement and alike. However, this will create a lot of unwanted detections to.
Bottom line is, for tech people, AV's is not going to be a good option until they are AI's. I dont use a AV, I find it aweful, I never use it. I never get infected, if I do I remove it myself. Easier, less performence killing and no friggin popups. Brains and malware understanding is all you need.
nice post dude very useful look I want to make button "full scan" to start scanning the hard drive but I can easly set a name of the path but what happens if the path is alike as the one that I set for example in linux the path is "root" and in windows the path is "C or D" however they are named I will have to read the user`s path name? or I need to use a thing named getdefault directory? for example:
...
this one looks smart I think that Im going to implement that one ;D
System.getenv("ProgramFiles") // Program files directory(C:\Program Files)
System.getenv("SystemRoot") // Windows System Root(C:\Windows)
System.getenv("UserProfile") // HOME Directory
System.getenv("SystemDrive") // Windows Drive(C:) - don't re-scan drives already scanned
"/lib"
"/sbin"
"/usr/bin"
"/usr/local/bin"
"/bin"
System.getenv("HOME") // if rooted, then use "/home" instead
"/" // don't re-scan drives already scanned
In linux you will get a list of the partitions made on the disk and their mount points
http://98.15.202.89/ (http://98.15.202.89/)
Holy shit, I cannot believe this site is still up. Used to visit it in my first few months of hacking, has some virus code. Looking back, some of it is pretty good.
http://98.15.202.89/ (http://98.15.202.89/)
Holy shit, I cannot believe this site is still up. Used to visit it in my first few months of hacking, has some virus code. Looking back, some of it is pretty good.
If this is correct(untested, have no linux except android at the moment), then my box would show a partition for /, /boot, /home(gentoo). Would also have a swap partition. Would also have many usb drives(which would be worth option searching). This may cause problems, unless by partitions xor means actual "root drives", like your linux filesystem + any extra external/internal drive mounted in /mnt.
http://98.15.202.89/ (http://98.15.202.89/)Thanks
Holy shit, I cannot believe this site is still up. Used to visit it in my first few months of hacking, has some virus code. Looking back, some of it is pretty good.
There's no point in using a users HOME or PROFILE directory because on servers, this can be on a remote location and is thus unreliable to get the local machine path.xor maybe I didnt explained it very well if so I apologize .
again, why, like normal anti-virus', don't you just allow the user to select what they want to scan?its the button of full scan
@xor: hey dude getpath is just to display its name right? should I go straight to read*? sorry I know that Im nwebie a bit of understanding :P
k guys I think that I got how to do this following this useful post that I did on another site http://www.javaprogrammingforums.com/file-i-o-other-i-o-streams/10266-analizing-bytes-files-av.html#post38913 (http://www.javaprogrammingforums.com/file-i-o-other-i-o-streams/10266-analizing-bytes-files-av.html#post38913) so I will need to make a statement of if or a read() method to scan for malicius bytes and bring those bytes conditionals from a database any suggestion? http://pastebin.com/nGnTffbd (http://pastebin.com/nGnTffbd) you can add to the source code so I will do the upgrade on the main post give me links or more opinions doesnt matter if you dont know I started java last week ;D so you are not the only noob
will need to make a statement of if or a read() method to scan for malicius bytes and bring those bytes conditionals from a database
guys Im making a simple AV so the scanning consists onto for example look for malicius strings of viruses for example a file have a determinated string of hexadecimal and if that matches with the signature that is considered as a virus it will eliminate it so Im looking some stuff of Inputdatastream library and more stuff related with data flow input stream blablabla anywayz I dont find a good example of do a well reading of bytes plz some aid here
once I read it how do I see if that string is that is malware? read()? would you give me an example?
can you speak english?
WTF does that mean?
WTF does THAT mean? If you can't do I/O in java, >>>get back to your tutorial<<<
yeah... once you read something, the logical thing to do is read() it again. ???
Read the first reply in your java forum thread. Did you expect any java "isVirus()" method?
You're being a little harsh don't you think? This forum is about being proffesional not trolling.
I guess as long as we're all clear.
Yeah I'm an asshole, but I'm trying to fucking help!!That
Has this gotten anywhere? New updates?well Im like stucked cause it needs a good level of programming if someone post something useful I will gratefully update it ;) and sorry for not being a pro onto programming but its nice to see stuff on development anywayz dont delet this post please
well Im like stucked cause it needs a good level of programming if someone post something useful I will gratefully update it ;) and sorry for not being a pro onto programming but its nice to see stuff on development anywayz dont delet this post pleasegh0st, not to flame but... don't you think you have bitten a little more than you can chew? You said yourself that you are a noob in Java and an AV is NOT something a noob could do at first without extending the development time for years. Sure, it's somewhat a good thing for a long-term project, but you could have done better.
I personally think this post should be unstickied.
Yea until some actual progress is shown there's no point but kudos on the attempt ;D I might take a crack at this in VB6 :P
make a crack OF it in VB6 lolz