Merge branch 'master' into SyncChanges

This commit is contained in:
Legogizmo
2019-11-07 11:22:43 -06:00
committed by GitHub
8 changed files with 57 additions and 38 deletions

4
README
View File

@@ -10,7 +10,7 @@ parted
Debian & Ubuntu prerequisites
============================
If you compiling nwipe from source the following will need to be installed first
If you are compiling nwipe from source the following will need to be installed first
sudo apt install build-essential
sudo apt install pkg-config
@@ -52,7 +52,7 @@ this can be done using the alternate compile commands
make
make install
The '-O0 -g' flags disable optimisations, this is required if your debugging with
The '-O0 -g' flags disable optimisations, this is required if you're debugging with
gdb in an IDE such as Kdevelop. Without these optimisations disabled you won't be
able to see the values of many variables in nwipe, not to mention the IDE won't step
through the code properly.

View File

@@ -7,9 +7,8 @@ allow its use with any host distribution, thus giving better hardware
support.
To use from the git repository, first create all the autoconf files with
./init.sh
`./init.sh`
Then do the standard ./configure --prefix=/usr && make && make install
For developer & release notes please see the [README file](README)
Then do the standard `./configure --prefix=/usr && make && make install`
For developers & release notes please see the [README file](README)

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT(nwipe, 0.26, git@brumit.nl)
AM_INIT_AUTOMAKE(nwipe, 0.26)
AC_INIT([nwipe], [0.26], [git@brumit.nl])
AM_INIT_AUTOMAKE
AC_OUTPUT(Makefile src/Makefile man/Makefile)
AC_CONFIG_SRCDIR([src/nwipe.c])
AC_CONFIG_HEADERS([config.h])

View File

@@ -44,7 +44,7 @@ char *trim(char *str);
int nwipe_device_scan( nwipe_context_t*** c )
{
/**
* Scans the the filesystem for storage device names.
* Scans the filesystem for storage device names.
*
* @parameter device_names A reference to a null array pointer.
* @modifies device_names Populates device_names with an array of nwipe_contect_t
@@ -90,7 +90,10 @@ int nwipe_device_get( nwipe_context_t*** c, char **devnamelist, int ndevnames )
dev = ped_device_get(devnamelist[i]);
if (!dev)
break;
{
nwipe_log( NWIPE_LOG_WARNING, "Device %s not found", devnamelist[i] );
continue;
}
if (check_device(c, dev, dcount))
dcount++;
@@ -148,6 +151,7 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
next_device->device_name = dev->path;
next_device->device_size = dev->length * dev->sector_size;
next_device->device_size_text = ped_unit_format_byte(dev, dev->length * dev->sector_size);
next_device->result = -2;
/* Attempt to get serial number of device. */
if ( (fd = open ( next_device->device_name = dev->path, O_RDONLY)) == ERR )
{

View File

@@ -1839,9 +1839,9 @@ void *nwipe_gui_status( void *ptr )
else
{
if( c[i]->result == 0 ) { mvwprintw( main_window, yy++, 4, "(success) " ); }
else if( c[i]->signal ) { mvwprintw( main_window, yy++, 4, "(failure, signal %i) ", c[i]->signal ); }
else { mvwprintw( main_window, yy++, 4, "(failure, code %i) ", c[i]->result ); }
if( c[i]->result == 0 ) { mvwprintw( main_window, yy++, 4, "(SUCCESS!) " ); }
else if( c[i]->signal ) { mvwprintw( main_window, yy++, 4, "(>>> FAILURE! <<<, signal %i) ", c[i]->signal ); }
else { mvwprintw( main_window, yy++, 4, "(>>>FAILURE!<<<, code %i) ", c[i]->result ); }
} /* child returned */

View File

@@ -327,6 +327,7 @@ int nwipe_log_sysinfo()
char path[256];
char cmd[50];
int len;
int r; /* A result buffer. */
/* Remove or add keywords to be searched, depending on what information is to
be logged, making sure the last entry in the array is a NULL string. To remove
@@ -359,13 +360,13 @@ int nwipe_log_sysinfo()
keywords_idx = 0;
/* Run the dmidecode command to retrieve system serial number */
/* Run the dmidecode command to retrieve each dmidecode keyword, one at a time */
while ( dmidecode_keywords[keywords_idx][0] != 0 )
{
sprintf(cmd,"dmidecode -s %s", &dmidecode_keywords[keywords_idx][0] );
fp = popen(cmd, "r");
if (fp == NULL ) {
nwipe_log( NWIPE_LOG_INFO, "Failed to run command dmidecode -s %s", &dmidecode_keywords[keywords_idx][0], path );
nwipe_log( NWIPE_LOG_INFO, "nwipe_log_sysinfo: Failed to create stream to %s", cmd );
return 1;
}
/* Read the output a line at a time - output it. */
@@ -379,7 +380,12 @@ int nwipe_log_sysinfo()
nwipe_log( NWIPE_LOG_INFO, "%s = %s", &dmidecode_keywords[keywords_idx][0], path );
}
/* close */
pclose(fp);
r = pclose(fp);
if( r > 0 )
{
nwipe_log( NWIPE_LOG_INFO, "nwipe_log_sysinfo(): dmidecode failed, \"%s\" exit status = %u", cmd, WEXITSTATUS( r ));
return 1;
}
keywords_idx++;
}
return 0;

View File

@@ -554,8 +554,8 @@ void *signal_hand(void *ptr)
else
{
if( c[i]->result == 0 ) { nwipe_log( NWIPE_LOG_INFO, "%s: Success", c[i]->device_name ); }
else if( c[i]->signal ) { nwipe_log( NWIPE_LOG_INFO, "%s: Failure: signal %i", c[i]->device_name, c[i]->signal ); }
else { nwipe_log( NWIPE_LOG_INFO, "%s: Failure: code %i", c[i]->device_name, c[i]->result ); }
else if( c[i]->signal ) { nwipe_log( NWIPE_LOG_INFO, "%s: >>> FAILURE! <<<: signal %i", c[i]->device_name, c[i]->signal ); }
else { nwipe_log( NWIPE_LOG_INFO, "%s: >>> FAILURE! <<<: code %i", c[i]->device_name, c[i]->result ); }
}
}

View File

@@ -339,7 +339,7 @@ int nwipe_options_parse( int argc, char** argv )
break;
case 'V': /* Rounds option. */
case 'V': /* Version option. */
printf ( "%s version %s\n", program_name, version_string );
exit( EXIT_SUCCESS );
@@ -434,38 +434,48 @@ display_help()
{
printf("Usage: %s [options] [device1] [device2] ...\n", program_name);
printf("Options:\n" );
puts(" -V, --version Prints the version number");
puts(" -h, --help Prints this help");
puts(" --autonuke If no devices have been specified on the command line, starts wiping all");
puts(" devices immediately. If devices have been specified, starts wiping only");
puts(" those specified devices immediately.");
/* Limit line length to a maximum of 80 characters so it looks good in 80x25 terminals i.e shredos */
/* ___12345678901234567890123456789012345678901234567890123456789012345678901234567890< Do not exceed */
puts(" -V, --version Prints the version number\n");
puts(" -h, --help Prints this help\n");
puts(" --autonuke If no devices have been specified on the command line,");
puts(" starts wiping all devices immediately. If devices have");
puts(" been specified, starts wiping only those specified");
puts(" devices immediately.\n");
puts(" --sync=NUM Will preform a sync after NUM writes (default: 0)");
puts(" 0 - fdatasync after the disk is completely written");
puts(" 1 - fdatasync after every write");
puts(" 1000000 - fdatasync after 1000000 writes ect.");
puts(" --verify=TYPE Whether to perform verification of erasure (default: last)");
puts(" --verify=TYPE Whether to perform verification of erasure");
puts(" (default: last)");
puts(" off - Do not verify");
puts(" last - Verify after the last pass");
puts(" all - Verify every pass");
puts(" -m, --method=METHOD The wiping method (default: dodshort). See man page for more details.");
puts(" all - Verify every pass\n");
puts(" -m, --method=METHOD The wiping method. See man page for more details.");
puts(" (default: dodshort)");
puts(" dod522022m / dod - 7 pass DOD 5220.22-M method");
puts(" dodshort / dod3pass - 3 pass DOD method");
puts(" gutmann - Peter Gutmann's Algorithm");
puts(" ops2 - RCMP TSSIT OPS-II");
puts(" random / prng / stream - PRNG Stream");
puts(" zero / quick - Overwrite with zeros");
puts(" -l, --logfile=FILE Filename to log to. Default is STDOUT");
puts(" -p, --prng=METHOD PRNG option (mersenne|twister|isaac)" );
puts(" -r, --rounds=NUM Number of times to wipe the device using the selected method (default: 1)" );
puts(" --noblank Do not blank disk after wipe (default is to complete a final blank pass)" );
puts(" --nowait Do not wait for a key before exiting (default is to wait)" );
puts(" --nosignals Do not allow signals to interrupt a wipe (default is to allow)" );
puts(" --nogui Do not show the GUI interface. Automatically invokes the nowait option" );
puts(" Must be used with --autonuke option. Send SIGUSR1 to log current stats");
puts(" -e, --exclude=DEVICES Up to ten comma separted devices to be excluded, examples:");
puts(" zero / quick - Overwrite with zeros\n");
puts(" -l, --logfile=FILE Filename to log to. Default is STDOUT\n");
puts(" -p, --prng=METHOD PRNG option (mersenne|twister|isaac)\n");
puts(" -r, --rounds=NUM Number of times to wipe the device using the selected");
puts(" method (default: 1)\n" );
puts(" --noblank Do not blank disk after wipe");
puts(" (default is to complete a final blank pass)\n" );
puts(" --nowait Do not wait for a key before exiting");
puts(" (default is to wait)\n" );
puts(" --nosignals Do not allow signals to interrupt a wipe");
puts(" (default is to allow)\n" );
puts(" --nogui Do not show the GUI interface. Automatically invokes" );
puts(" the nowait option. Must be used with the --autonuke");
puts(" option. Send SIGUSR1 to log current stats\n");
puts(" -e, --exclude=DEVICES Up to ten comma separted devices to be excluded");
puts(" --exclude=/dev/sdc");
puts(" --exclude=/dev/sdc,/dev/sdd");
puts(" --exclude=/dev/sdc,/dev/sdd,/dev/mapper/cryptswap1");
puts(" --exclude=/dev/sdc,/dev/sdd,/dev/mapper/cryptswap1\n");
puts("");
exit( EXIT_SUCCESS );
}