Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: analizing bytes of files for an AV

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question analizing bytes of files for an AV

    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


  2. #2
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: analizing bytes of files for an AV

    FileInputStream should be enough for your requirements:
    FileInputStream (Java Platform SE 6)

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: analizing bytes of files for an AV

    once I read it how do I see if that string is that is malware? read()? would you give me an example
    ?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,628
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: analizing bytes of files for an AV

    how do I see if that string is that is malware
    If you are reading executable files like .exe you will not be reading Strings. It will be a sequence of bytes.
    As I understand AV software, they have large dictionaries of sequences of bytes that are in malware.
    The AV software understands the structure of the executable files and knows where to look in them to find the sequence of bytes that that have been found in previously detected malware.

    There are several read methods that you can use to read enough bytes to fill a large array where you can search for the malware byte sequence.
    Once you have read the bytes from the file you compare them byte by byte for a match.
    There could be classes and methods to help you do that, I'm not sure. Otherwise its loops and arrays.
    Last edited by Norm; August 7th, 2011 at 05:41 PM.

  5. The Following User Says Thank You to Norm For This Useful Post:

    JavaPF (August 9th, 2011)

Similar Threads

  1. Seraching through files in a folder for a pattern match inside the files.
    By dazzabiggs in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 2nd, 2011, 08:35 AM
  2. Replies: 1
    Last Post: March 22nd, 2011, 06:59 PM
  3. get client action from bytes
    By ighor10 in forum Java Networking
    Replies: 1
    Last Post: February 14th, 2011, 04:15 PM
  4. How to Get the size of a file in bytes
    By JavaPF in forum File Input/Output Tutorials
    Replies: 1
    Last Post: June 8th, 2009, 10:19 AM
  5. How to Get the size of a file in bytes
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 1
    Last Post: June 8th, 2009, 10:19 AM

Tags for this Thread