Search This Blog

Tuesday, January 11, 2011

Scapy

Scapy is a powerful interactive packet manipulation program. It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, match requests and replies, and much more. It can easily handle most classical tasks like scanning, tracerouting, probing, unit tests, attacks or network discovery (it can replace hping, 85% of nmap, arpspoof, arp-sk, arping, tcpdump, tethereal, p0f, etc.). It also performs very well at a lot of other specific tasks that most other tools can’t handle, like sending invalid frames, injecting your own 802.11 frames, combining technics (VLAN hopping+ARP cache poisoning, VOIP decoding on WEP encrypted channel, …), etc.

 Get Scapy 2.1.1 here

Black Berry IPD Files

IPD Files Demystified
Black Berry handheld devices have long been a favorite of the corporate executive but now with the release of a more mainstream multimedia capable mobile device in the Pearl and an aggressive advertising campaign, the Black Berry is bound to become a more popular device with non corporate types as well.
This mini white paper discusses the structure of the Black Berry backup or IPD file for the forensic examiner.
The IPD What is it?
The Black Berry Desktop software creates a proprietary backup of the databases on the Black Berry Handheld. This file is by default named in the following fashion
Backup-(current date,time and year)-.ipd
The files also default to the user’s “My Documents” folder. This, of course, may be changed by a user. The IPD file itself is a database of the databases.
IPD STRUCTURE
Below is a graphic of the IPD file.

As you can see from the graphic the IPD file begins with Inter@ctive Pager Backup/Restore File. The examiner may find this to be of use in search strings to find hidden or unallocated files.
Following this “header” the structure follows as is shown in the graphic below.

Here we can see that we have an one byte line feed (x/OA) followed by an one byte version (x/02) and a two byte indicator of the number of data bases in the file (in the above case x/3F).
Finally the names of the Databases follow after a 1 byte separator (x/00).
DATABASE NAME STRUCTURE
The databases within the file are constructed as follows
  • Database name length 2 bytes the length includes terminating null
  • Database name As long as the name length above
This is illustrated in the following graphic

After the database name length and name the database follows the following structure
  • Database ID Two bytes zero based position in the list of DB name blocks
  • Record Length 4 bytes
  • Database version 1 byte
  • DatabaseRecordHandler 2 bytes
  • Record Unique ID 4 bytes
  • Field length #1 2 bytes
  • Field type #1 1 byte
  • Field data #1 As long as field length
  • Field length #m 2 bytes
  • Field type #m 1 byte
  • Field data #m As long as the field length
The database has a unique id that is followed by the record length and the record ID. Each record will have a variable number of fields (as shown in the table by field #1 …field #m) that have a structure of length, type and data.
This is illustrated in the below graphic

This short white paper attempted to show the structure of the Black Berry backup file commonly known as the IPD file. The IPD file can be loaded into a Black Berry simulator or third party software such as the Amber Black Berry Converter to extract evidence. Examiners are encouraged to do their own research and validation into the file.
CITATIONS
1. http://www.BlackBerry.com/developers/journal/jan_2006/ipd_file_format.shtm

General Studies


  • भारत के तीन बड़े गेंहू  उत्पादक राज्य - उत्तरप्रदेश > पंजाब  > हरियाणा



  • विश्व के सर्वाधिक सिंचित क्षेत्र - भारत > चाइना



  • किस तारीख को दोपहर में  आपकी छाया सबसे छोटी होती है - २२ जून



  • स्टेनलेस स्टील में carbon होता है - ०.२५ %



  • धान के खेत से निकलने वाली गैस है - मीथेन



  • भारत में स्वेत क्रांती के जनक - वर्गीस  कुरियन



  • लछु महाराज - कत्थक



  • गिरिजा देवी - शास्त्रीय गायन



  • पंडित रविशंकर - सितार वादन 



  • किशन महाराज - तबला वादन



  • अमजद अली खान - सरोद वादन



  • शिवकुमार शर्मा - संतूर वादन



  • विलायत खान - सितार वादन



  • हरिप्रसाद चोरसिया  - बांसुरी वादन



  • भारतीय  दर्शन को षड्दर्शन कहा जाता है - संख्या  दर्शन - कपिल, योग - पतंजलि, न्याय दर्शन - गौतम, वैशेषिक दर्शन - कणाद, मिमंषा - जैमिनी, वेदान्त - भगवत गीता



  • RSA & AES in JAVA

    Listing 1. RSA Key Generator
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ObjectOutputStream;
    import java.security.GeneralSecurityException;
    import java.security.KeyPair;
    import java.security.KeyPairGenerator;
    import java.security.SecureRandom;
    public class RSAKeyGenerator {
    private static final int KEYSIZE = 8192;
    public static void main(String[] args) {
    generateKey("RSA_private.key","RSA_public.key");
    }
    public static void generateKey(String privateKey, String publicKey) {
    try {
    KeyPairGenerator pairgen = KeyPairGenerator.getInstance("RSA");
    SecureRandom random = new SecureRandom();
    pairgen.initialize(KEYSIZE, random);
    KeyPair keyPair = pairgen.generateKeyPair();
    ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(publicKey));
    out.writeObject(keyPair.getPublic());
    out.close();
    out = new ObjectOutputStream(new FileOutputStream(privateKey));
    out.writeObject(keyPair.getPrivate());
    out.close();
    } catch (IOException e) {
    System.err.println(e);
    } catch (GeneralSecurityException e) {
    System.err.println(e);
    }
    }
    }




    Listing 2. Encryption Method
    public void encryptToOutputFile(String publicKeyFile, String inputFile, String outputFile) throws FileNotFoundException,
    IOException, ClassNotFoundException, GeneralSecurityException {
    KeyGenerator keygen = KeyGenerator.getInstance("AES");
    SecureRandom random = new SecureRandom();
    keygen.init(random);
    SecretKey key = keygen.generateKey();
    // Wrap with public key
    ObjectInputStream keyIn = new ObjectInputStream(new FileInputStream(publicKeyFile));
    Key publicKey = (Key) keyIn.readObject();
    keyIn.close();
    Cipher cipher = Cipher.getInstance("RSA");
    cipher.init(Cipher.WRAP_MODE, publicKey);
    byte[] wrappedKey = cipher.wrap(key);
    DataOutputStream out = new DataOutputStream(new FileOutputStream(outputFile));
    out.writeInt(wrappedKey.length);
    out.write(wrappedKey);
    InputStream in = new FileInputStream(inputFile);
    cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.ENCRYPT_MODE, key);
    crypt(in, out, cipher);
    in.close();
    out.close();
    }



    Listing 3. Decryption Method
    public void decryptFromOutputFile(String privatecKeyFile, String inputFile, String
    outputFile) throws IOException, ClassNotFoundException,
    GeneralSecurityException {
    DataInputStream in = new DataInputStream(new FileInputStream(inputFile));
    int length = in.readInt();
    byte[] wrappedKey = new byte[length];
    in.read(wrappedKey, 0, length);
    // Open with private key
    ObjectInputStream keyIn = new ObjectInputStream(new FileInputStream(privatec
    KeyFile));
    Key privateKey = (Key) keyIn.readObject();
    keyIn.close();
    Cipher cipher = Cipher.getInstance("RSA");
    cipher.init(Cipher.UNWRAP_MODE, privateKey);
    Key key = cipher.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY);
    OutputStream out = new FileOutputStream(outputFile);
    cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, key);
    crypt(in, out, cipher);
    in.close();
    out.close();
    }



    Listing 4. Key File Transformer
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.security.GeneralSecurityException;
    import java.security.Key;
    /*
    * Private/Public Key File to Encoded Key Byte[]
    */
    public class KeyToByteArray {
    public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException,
    GeneralSecurityException {
    /*
    * Define Arguments
    */
    ObjectInputStream keyIn = new ObjectInputStream(new FileInputStream("RSA_private.key"));
    Key privateKey = (Key) keyIn.readObject();
    keyIn.close();
    byte[] k = privateKey.getEncoded();
    System.out.println(privateKey.getFormat());
    System.out.println(k.length);
    for(int i = 0; i < k.length; i++) {
    System.out.print(k[i]);
    }
    System.out.println();
    System.out.println("Created byte[] of length : " + k.length);
    System.out.println("Convert byte[] to String : " + bytesToHex(k));
    System.out.println("---------------------------------");
    System.out.println();
    System.out.print("byte[] encPKe = { ");
    int j = 0;
    for (int i = 0; i < k.length; i++) {
    if(i == k.length-1)
    System.out.print("(byte)0x" + byteToHex(k[i]) + " ");
    else
    System.out.print("(byte)0x" + byteToHex(k[i]) + ", ");
    j++;
    if(j == 6) {
    System.out.println();
    j = 0;
    }
    }
    System.out.println("};");
    System.out.println();
    }
    public static String bytesToHex(byte[] data) {
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < data.length; i++) {
    buf.append(byteToHex(data[i]).toUpperCase());
    }
    return (buf.toString());
    }
    public static String byteToHex(byte data) {
    StringBuffer buf = new StringBuffer();
    buf.append(toHexChar((data >>> 4) & 0x0F));
    buf.append(toHexChar(data & 0x0F));
    return buf.toString();
    }
    public static char toHexChar(int i) {
    if ((0 <= i) && (i <= 9)) {
    return (char) ('0' + i);
    } else {
    return (char) ('a' + (i – 10));
    }
    }
    }




    Listing 5. Modified Encryption Method
    public void encryptWKf(byte[] encPk, String inputFile, String outputFile) throws FileNotFoundException, IOException,
    ClassNotFoundException, GeneralSecurityException { …



    Listing 6. Modified Decryption Method
    public String decryptWKf(byte[] encPk, String inputFile) throws IOException, ClassNotFoundException, GeneralSecurityException { …



    Listing 7. Modified Encryption Method 2
    public void encryptWKf(byte[] encPk, String in, String outputFile) throws FileNotFoundException, IOException,
    ClassNotFoundException, GeneralSecurityException { …



    Listing 8. PKCS8 Key Specifications
    // make key out of encrypted private key byte[]
    PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encPk);
    KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    PrivateKey privateKey = keyFactory.generatePrivate(keySpec);




    Listing 9. X509 Key Specifications
    // make key out of encrypted public key byte[]
    X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encPk);
    KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    PublicKey publicKey = keyFactory.generatePublic(keySpec);


    Source : Hacking Magazine

    Wednesday, January 5, 2011

    Boost HDD Performance

    Win9x sets DMA to OFF by default. You have to switch it on. In theory, enabling DMA increases UDMA Hard Disk access to 33.3 MB/sec. In practice, speed will increase substantially from the old standard of 16MB/sec. Furthermore, DMA uses only 25% of CPU resources compared to 40% normally. Nearly all 5400rpm/7200rpm, and some lower speed, drives, support DMA.

    Now I'll tell you about it. Ready ?

    Right-click on "my computer". Now click on "properties". Now search for "devide manager" and click properties of your hard drive. It should have an option called "DMA". By enabling this, your hard drive should show an increase in performance. Also, this method can increase the transfer rate of your CD/DVD-ROM or CD/DVD-Writer, possibly eliminating those under buffer run errors.

    Again, an easy tweak which could improve you hard drive's performance

    Security Tips and Fraud Prevention

    For any User, maintaining the account’s security is the top priority. To augment the security measures that the Online Service Provide on your behalf, there are steps that you can take to help protect your account from fraud and scams.
    Note: Here we will be using the URL www.WebsiteName.com for explaining you. This can be the Domain name of the Online Service you are Using. But for Explanation Purpose we will be using WebsiteName as the Name of the Website and www.WebsiteName.com as the URL.
    Website Security
    • Use SSL Connection: To safely and securely access your account, open a new web browser (e.g., Internet Explorer or Netscape) and type the URL in the following way:
      https://www.WebsiteName.com/.
    • As you can see I have written https:// instead of http:// which you use normally. This can be used in those website which provide SSL Authentication. Not all Websites provide SSL( Secure Sockets Layer ) but most of the Online Services like GMail, Yahoo, MSN, Orkut, Facebook, eBay etc provide SSL.
    Password Safety
    • Never share your password: Any Website representative will never ask you for your password. If you believe someone has learned your password, please change it immediately.
    • Create a secure password: Choose a password that uses a combination of letters, numbers, and symbols. For example, $coo!place2l!ve or 2Barry5Bonds#1. Avoid choosing obvious words or dates such as a nickname or your birth date.
    • Keep your password unique: Don’t use the same password for all the online services such as AOL, eBay, MSN, or Yahoo. Using the same password for multiple websites increases the likelihood that someone could learn your password and gain access to your account.
    Email Security
    • Look for a Greeting: Any Website will never send an email with the greeting “Dear WebsiteName User” or “Dear WebsiteName Member.” Real WebsiteName emails will address you by your first and last name or the business name associated with your WebsiteName account. If you believe you have received a fraudulent email, Send a copy of the spoofed e-mail you received to your ISP’s abuse desk. The e-mail address for this is usually abuse@yourisp.com or postmaster@yourisp.com but if you are not sure, visit your ISP’s Web site and search for the information - it will be there.
    • Don’t share personal information via email: Any Website will never ask you to enter your password or financial information in an email or send such information in an email. You should only share information about your account once you have logged in to your Account.
    • Don’t download attachments: Any Website will never send you an attachment or Software update to install on your computer.

    Call Forging

    Want to Spoof a identity of caller,we have brought some intresting trick.
    Call Forging is the trick by which you can spoof the identity of the
    caller and misguide the calle.
    By call forging the caller identity is spoofed and can be easily done
    by the folllowing way.
    This post is written for educational purpose and dont misuse it.
    Basics of Call Forging
    Firstly the voip is used to call via internet PC to a telephone.
    In the Voip there is a loop hole which allow a intruder to spoof
    a call.
    There are many website on the net which provide the facility of the
    internet calling.
    This website work as follows,first the call the source phone no then
    the destiation number and then bridge them togather.
    Here there is no authentication done by the website and server are
    normally located in US and so tracing of the intruder is not possible.
    Thus the intruder logs on to this server and gives a wrong source number
    and then place a call over internet which is actually a spoofed call
    which shows wrong identity.
    Also there a no laws regarding the call spoofing in India and so a intruder
    if gets traced is easily backed by the loophole of no laws for it.
    thus if you get calls from other numbers dont trust it they may be spoofed
    calls
    This post is written only for awareness and for educational purpose.