diff options
-rw-r--r-- | src/main.c | 26 | ||||
-rw-r--r-- | src/scrounge.c | 4 | ||||
-rw-r--r-- | src/scrounge.h | 2 |
3 files changed, 20 insertions, 12 deletions
@@ -27,14 +27,12 @@ const char kPrintHelp[] = "\ usage: scrounge -l \n\ List all drive partition information. \n\ \n\ -usage: scrounge [-d drive] -s \n\ - Search drive for NTFS partitions. \n\ - \n\ usage: scrounge [-d drive] [-m mftoffset] [-c clustersize] [-o outdir] start end \n\ Scrounge data from a partition \n\ + -c Cluster size (in sectors, default of 8) \n\ -d Drive number \n\ + -k Number of sectors to skip when in mft not specified. \n\ -m Offset to mft (in sectors) \n\ - -c Cluster size (in sectors, default of 8) \n\ -o Directory to put scrounged files in \n\ start First sector of partition \n\ end Last sector of partition \n\ @@ -47,13 +45,11 @@ const char kPrintHelp[] = "\ usage: scrounge -l disk \n\ List all drive partition information. \n\ \n\ -usage: scrounge -s disk \n\ - Search drive for NTFS partitions. \n\ - \n\ usage: scrounge [-m mftoffset] [-c clustersize] [-o outdir] disk start end \n\ Scrounge data from a partition \n\ - -m Offset to mft (in sectors) \n\ -c Cluster size (in sectors, default of 8) \n\ + -k Number of sectors to skip when in mft not specified. \n\ + -m Offset to mft (in sectors) \n\ -o Directory to put scrounged files in \n\ disk The raw disk partitios (ie: /dev/hda) \n\ start First sector of partition \n\ @@ -80,6 +76,7 @@ int main(int argc, char* argv[]) int temp = 0; int mode = 0; int raw = 0; + uint64 skip = 0; unsigned long long ull; partitioninfo pi; char driveName[MAX_PATH + 1]; @@ -127,6 +124,17 @@ int main(int argc, char* argv[]) break; #endif + /* skip sectors */ + case 'k': + { + ull = strtoull(optarg, &end, 10); + if(*end != 0) + errx(2, "invalid skip number (must be positive)"); + + skip = ull; + } + break; + /* list mode */ case 'l': { @@ -240,7 +248,7 @@ int main(int argc, char* argv[]) else { warnx("Scrounging via raw search. Directory info will be discarded."); - scroungeUsingRaw(&pi); + scroungeUsingRaw(&pi, skip); } } diff --git a/src/scrounge.c b/src/scrounge.c index cbbb875..ad340b0 100644 --- a/src/scrounge.c +++ b/src/scrounge.c @@ -609,7 +609,7 @@ void scroungeUsingMFT(partitioninfo* pi) pi->mftmap = NULL; } -void scroungeUsingRaw(partitioninfo* pi) +void scroungeUsingRaw(partitioninfo* pi, uint64 skip) { byte buffSec[kSectorSize]; fchar_t dir[MAX_PATH + 1]; @@ -629,7 +629,7 @@ void scroungeUsingRaw(partitioninfo* pi) pi->locks = &locks; /* Loop through sectors */ - for(sec = pi->first; sec < pi->end; sec++) + for(sec = pi->first + skip; sec < pi->end; sec++) { if(checkLocationLock(&locks, sec)) continue; diff --git a/src/scrounge.h b/src/scrounge.h index c3985be..e75bb4e 100644 --- a/src/scrounge.h +++ b/src/scrounge.h @@ -28,7 +28,7 @@ void scroungeList(); #endif void scroungeListDrive(char* drive); void scroungeUsingMFT(partitioninfo* pi); -void scroungeUsingRaw(partitioninfo* pi); +void scroungeUsingRaw(partitioninfo* pi, uint64 skip); /* For compatibility */ void setFileAttributes(fchar_t* filename, uint32 flags); |