SlideShare a Scribd company logo
1 of 5
Download to read offline
Title : Tool to display the partition information only
Name : Shivakumar Koppad
ID : 14043513
Date : 06/03/2015
Module code : EE6012
Lecturer : Dr. Donal Heffernan
Assignment#1
Requirements :
This program was created by using Microsoft Visual C++ 2010. Class for the
partition table was defined in order to restores information about partitions, to
configure the location of the first byte of the partition Information and to copy
the contents of an array from the memory cache to the private member array.
Features that were implemented:
There are four features that were implemented in this program:
1- The number of partitions on the disk is represented.
2- The start sector of the partition is represented.
3- The file system type of the partition is represented.
4- The size of the partition in sectors in MB is represented.
Testing and Result:
1- The source code EE6012_phase1 was created and implemented.
2- The new folder which named Shiva was created in the local Disk(E:).
3- The executed file in the debug in Shiva.exe was copied and pasted in Shiva in
order to read the image.
4- The Sample_1.dd image file was used in Shiva.
5- Program is implemented in a command window by going to the
right path (E: Shiva >) and typing (Shiva.exe Sample_1.dd)
Instructions for running the program:
1. The executable file Shiva.exe was created.
2. The folder called Shiva was created in the local Disk(E:).
3. Copied the executable file Shiva.exe (found in ‘Debug ‘ folder and Sample_1.dd
and put them in Shiva in the local Disk(E:).
4. Implement the program in the command window by going to the right path
(E: Shiva >) and typing (Shiva.exe Sample_1.dd)
Drawbacks:
To calculate the partition in MB, multiplying the partition in sectors by 512,
because sector size is 512 and divide the result by 1MB = 1024 * 1024 Bytes.
To calculate the information correctly, information must be changed to
big_endian format because the format of information is little_endian.
Source code:
//////////////////////////////////////////////////////////////////////
/////////////////
//Student Name: Shivakumar Koppad
// Student ID: 14043513
//////////////////////////////////////////////////////////////////////
/////////////////
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
class Partition
{
public:
Partition( unsigned int byte);
string getFileSysType();
unsigned int getSizeOfPartition();
unsigned int getStartSector();
unsigned int get1stByteOfPartition();
void setFields(unsigned char *store);
bool isAssigned();
private:
unsigned char bytes[32];
unsigned int firstByteOfPartition;
};
Partition::Partition( unsigned int newbyte)
{
firstByteOfPartition = newbyte;
}
void Partition::setFields( unsigned char *store)
{
for(int i = 0; i < 32; i++)
{
bytes[i] = store[i];
}
}
unsigned int Partition::get1stByteOfPartition()
{
return firstByteOfPartition;
}
string Partition::getFileSysType()
{
string FSys = "";
switch(bytes[4])
{
case 0: FSys = "Unknown or empty" ;
break;
case 1: FSys = "12-bit FAT" ;
break;
case 4: FSys = "16-bit FAT (< 32MB)";
break;
case 5: FSys = "Extended MS-DOS Partition" ;
break;
case 6: FSys = "FAT-16 (32MB to 2GB)" ;
break;
case 7: FSys = "NTFS";
break;
case 11: FSys = "FAT-32 (CHS)" ;
break;
case 12: FSys = "FAT-32 (LBA)" ;
break;
case 14: FSys = "FAT-16 (LBA)" ;
break;
default: FSys = "Not recognized" ;
}
return FSys;
}
bool Partition::isAssigned()
{
bool assigned = true;
if(bytes[4] == 0)
{
assigned = false;
}
return assigned;
}
unsigned int Partition::getStartSector()
{
unsigned int bigEndian = 0;
for(int i = 0xB; i >= 0x8; i--)
{
bigEndian = bigEndian << 8;
bigEndian = bigEndian | bytes[i];
}
return bigEndian;
}
unsigned int Partition::getSizeOfPartition()
{
unsigned int bigEndian = 0;
for(int i = 0xF; i >= 0xC; i--)
{
bigEndian = bigEndian << 8;
bigEndian = bigEndian | bytes[i];
}
return bigEndian;
}
int main(int argc, char *argv[])
{
unsigned char store[64];
unsigned int offset = 0;
unsigned int clusterSectorAddress = 0;
unsigned int sizeMB;
int numOfPartns;
if(argc != 2)
{
cout << "Usage: EE6012 Assignment 1 n";
return 1;
}
ifstream img(argv[1], ios::in | ios::binary);
if(!img)
{
cout << "Error!! Cannot open image file. n";
return 1;
}
Partition partition[4] = {0x1BE, 0x1CE, 0x1DE, 0x1EE};
cout << "PARTITION INFORMATION:nn";
numOfPartns = 0;
for(int n = 0; n < 4; n++)
{
offset = partition[n].get1stByteOfPartition();
img.clear();
img.seekg(offset, ios::beg);
img.read(( char *)store, 16);
partition[n].setFields(store);
cout << "Partition number: " << n + 1 << endl;
cout << "Assigned: " << boolalpha <<partition[n].isAssigned() <<
endl;
cout << "Start sector: " << dec << partition[n].getStartSector() <<
endl;
sizeMB = (partition[n].getSizeOfPartition() * 512) / (1024 * 1024);
cout << "Size of partition: " << dec <<
partition[n].getSizeOfPartition() << " sectors (" << sizeMB << " MB) n";
cout << "Type of File System: " << partition[n].getFileSysType() <<
endl;
cout << "n";
if(partition[n].isAssigned() == true)
{
numOfPartns++;
}
}
cout << "The number of assigned partitions: " << numOfPartns << endl;
cout << "nn";
img.close();
return 0;
};

More Related Content

Viewers also liked

CIsco ACL- Network and host security
CIsco ACL- Network and host securityCIsco ACL- Network and host security
CIsco ACL- Network and host securityShiv Koppad
 
BIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabBIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabShiv Koppad
 
Conclusion team work
Conclusion team workConclusion team work
Conclusion team workstarcandy0507
 
Computer forensics
Computer forensicsComputer forensics
Computer forensicsdeaneal
 
IT Asset Management System for UL-Software Engineering
IT Asset Management System for UL-Software EngineeringIT Asset Management System for UL-Software Engineering
IT Asset Management System for UL-Software EngineeringShiv Koppad
 
What is tackled in the Java EE Security API (Java EE 8)
What is tackled in the Java EE Security API (Java EE 8)What is tackled in the Java EE Security API (Java EE 8)
What is tackled in the Java EE Security API (Java EE 8)Rudy De Busscher
 

Viewers also liked (7)

CIsco ACL- Network and host security
CIsco ACL- Network and host securityCIsco ACL- Network and host security
CIsco ACL- Network and host security
 
BIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabBIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using Matlab
 
Conclusion team work
Conclusion team workConclusion team work
Conclusion team work
 
Computer forensics
Computer forensicsComputer forensics
Computer forensics
 
IT Asset Management System for UL-Software Engineering
IT Asset Management System for UL-Software EngineeringIT Asset Management System for UL-Software Engineering
IT Asset Management System for UL-Software Engineering
 
14047721
1404772114047721
14047721
 
What is tackled in the Java EE Security API (Java EE 8)
What is tackled in the Java EE Security API (Java EE 8)What is tackled in the Java EE Security API (Java EE 8)
What is tackled in the Java EE Security API (Java EE 8)
 

Similar to Partition Tool

Cis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCIS321
 
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxStudent Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxflorriezhamphrey3065
 
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeDEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeFelipe Prado
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsPetr Dvorak
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical fileAnkit Dixit
 
Classes(or Libraries)#include #include #include #include.docx
Classes(or Libraries)#include #include #include #include.docxClasses(or Libraries)#include #include #include #include.docx
Classes(or Libraries)#include #include #include #include.docxbrownliecarmella
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOSPetr Dvorak
 
eZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedeZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedBertrand Dunogier
 
Apache ant
Apache antApache ant
Apache antkoniik
 
Z OS IBM Utilities
Z OS IBM UtilitiesZ OS IBM Utilities
Z OS IBM Utilitieskapa rohit
 
Question IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxQuestion IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxaudeleypearl
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applicationsjeromevdl
 
Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesDevry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesnoahjamessss
 
Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesDevry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filescskvsmi44
 
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovWorkshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovFwdays
 
Assignment of SOS operating systemThe file lmemman.c has one incom.pdf
Assignment of SOS operating systemThe file lmemman.c has one incom.pdfAssignment of SOS operating systemThe file lmemman.c has one incom.pdf
Assignment of SOS operating systemThe file lmemman.c has one incom.pdfsktambifortune
 

Similar to Partition Tool (20)

Cis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential files
 
Clean code
Clean codeClean code
Clean code
 
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxStudent Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
 
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeDEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
 
Why learn Internals?
Why learn Internals?Why learn Internals?
Why learn Internals?
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical file
 
Classes(or Libraries)#include #include #include #include.docx
Classes(or Libraries)#include #include #include #include.docxClasses(or Libraries)#include #include #include #include.docx
Classes(or Libraries)#include #include #include #include.docx
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOS
 
eZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedeZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisited
 
Apache ant
Apache antApache ant
Apache ant
 
Z OS IBM Utilities
Z OS IBM UtilitiesZ OS IBM Utilities
Z OS IBM Utilities
 
Question IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxQuestion IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docx
 
Lec05 buffers basic_examples
Lec05 buffers basic_examplesLec05 buffers basic_examples
Lec05 buffers basic_examples
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applications
 
Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesDevry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-files
 
Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesDevry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-files
 
File organization
File organizationFile organization
File organization
 
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovWorkshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
 
Assignment of SOS operating systemThe file lmemman.c has one incom.pdf
Assignment of SOS operating systemThe file lmemman.c has one incom.pdfAssignment of SOS operating systemThe file lmemman.c has one incom.pdf
Assignment of SOS operating systemThe file lmemman.c has one incom.pdf
 

Partition Tool

  • 1. Title : Tool to display the partition information only Name : Shivakumar Koppad ID : 14043513 Date : 06/03/2015 Module code : EE6012 Lecturer : Dr. Donal Heffernan Assignment#1 Requirements : This program was created by using Microsoft Visual C++ 2010. Class for the partition table was defined in order to restores information about partitions, to configure the location of the first byte of the partition Information and to copy the contents of an array from the memory cache to the private member array. Features that were implemented: There are four features that were implemented in this program: 1- The number of partitions on the disk is represented. 2- The start sector of the partition is represented. 3- The file system type of the partition is represented. 4- The size of the partition in sectors in MB is represented. Testing and Result: 1- The source code EE6012_phase1 was created and implemented. 2- The new folder which named Shiva was created in the local Disk(E:). 3- The executed file in the debug in Shiva.exe was copied and pasted in Shiva in order to read the image. 4- The Sample_1.dd image file was used in Shiva. 5- Program is implemented in a command window by going to the right path (E: Shiva >) and typing (Shiva.exe Sample_1.dd) Instructions for running the program: 1. The executable file Shiva.exe was created. 2. The folder called Shiva was created in the local Disk(E:). 3. Copied the executable file Shiva.exe (found in ‘Debug ‘ folder and Sample_1.dd and put them in Shiva in the local Disk(E:). 4. Implement the program in the command window by going to the right path (E: Shiva >) and typing (Shiva.exe Sample_1.dd)
  • 2. Drawbacks: To calculate the partition in MB, multiplying the partition in sectors by 512, because sector size is 512 and divide the result by 1MB = 1024 * 1024 Bytes. To calculate the information correctly, information must be changed to big_endian format because the format of information is little_endian. Source code: ////////////////////////////////////////////////////////////////////// ///////////////// //Student Name: Shivakumar Koppad // Student ID: 14043513 ////////////////////////////////////////////////////////////////////// ///////////////// #include <iostream> #include <string> #include <fstream> using namespace std; class Partition { public: Partition( unsigned int byte); string getFileSysType(); unsigned int getSizeOfPartition(); unsigned int getStartSector(); unsigned int get1stByteOfPartition(); void setFields(unsigned char *store); bool isAssigned(); private: unsigned char bytes[32]; unsigned int firstByteOfPartition; }; Partition::Partition( unsigned int newbyte) { firstByteOfPartition = newbyte; } void Partition::setFields( unsigned char *store) { for(int i = 0; i < 32; i++)
  • 3. { bytes[i] = store[i]; } } unsigned int Partition::get1stByteOfPartition() { return firstByteOfPartition; } string Partition::getFileSysType() { string FSys = ""; switch(bytes[4]) { case 0: FSys = "Unknown or empty" ; break; case 1: FSys = "12-bit FAT" ; break; case 4: FSys = "16-bit FAT (< 32MB)"; break; case 5: FSys = "Extended MS-DOS Partition" ; break; case 6: FSys = "FAT-16 (32MB to 2GB)" ; break; case 7: FSys = "NTFS"; break; case 11: FSys = "FAT-32 (CHS)" ; break; case 12: FSys = "FAT-32 (LBA)" ; break; case 14: FSys = "FAT-16 (LBA)" ; break; default: FSys = "Not recognized" ; } return FSys; } bool Partition::isAssigned() { bool assigned = true; if(bytes[4] == 0) { assigned = false;
  • 4. } return assigned; } unsigned int Partition::getStartSector() { unsigned int bigEndian = 0; for(int i = 0xB; i >= 0x8; i--) { bigEndian = bigEndian << 8; bigEndian = bigEndian | bytes[i]; } return bigEndian; } unsigned int Partition::getSizeOfPartition() { unsigned int bigEndian = 0; for(int i = 0xF; i >= 0xC; i--) { bigEndian = bigEndian << 8; bigEndian = bigEndian | bytes[i]; } return bigEndian; } int main(int argc, char *argv[]) { unsigned char store[64]; unsigned int offset = 0; unsigned int clusterSectorAddress = 0; unsigned int sizeMB; int numOfPartns; if(argc != 2) { cout << "Usage: EE6012 Assignment 1 n"; return 1; } ifstream img(argv[1], ios::in | ios::binary); if(!img)
  • 5. { cout << "Error!! Cannot open image file. n"; return 1; } Partition partition[4] = {0x1BE, 0x1CE, 0x1DE, 0x1EE}; cout << "PARTITION INFORMATION:nn"; numOfPartns = 0; for(int n = 0; n < 4; n++) { offset = partition[n].get1stByteOfPartition(); img.clear(); img.seekg(offset, ios::beg); img.read(( char *)store, 16); partition[n].setFields(store); cout << "Partition number: " << n + 1 << endl; cout << "Assigned: " << boolalpha <<partition[n].isAssigned() << endl; cout << "Start sector: " << dec << partition[n].getStartSector() << endl; sizeMB = (partition[n].getSizeOfPartition() * 512) / (1024 * 1024); cout << "Size of partition: " << dec << partition[n].getSizeOfPartition() << " sectors (" << sizeMB << " MB) n"; cout << "Type of File System: " << partition[n].getFileSysType() << endl; cout << "n"; if(partition[n].isAssigned() == true) { numOfPartns++; } } cout << "The number of assigned partitions: " << numOfPartns << endl; cout << "nn"; img.close(); return 0; };