mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-22 06:52:12 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d01b00b4f8 | ||
|
|
3c0c8408f6 | ||
|
|
a619de6134 | ||
|
|
3176688f3e | ||
|
|
b03f063e89 | ||
|
|
f9fd45f129 | ||
|
|
d10dca3bed | ||
|
|
8fa0d8c1f4 | ||
|
|
47ff866968 | ||
|
|
edfabad8a1 | ||
|
|
2f44978db4 | ||
|
|
fbe6e9d150 | ||
|
|
3ba8d3814b | ||
|
|
124ec1e4a9 | ||
|
|
57c14286db | ||
|
|
ae5d2355cb |
12
README
12
README
@@ -10,14 +10,22 @@ make install
|
||||
|
||||
The ncurses, pthreads and parted libraries are required for compiling.
|
||||
For any problems, please use the Github page:
|
||||
https://github.com/abeverley/nwipe
|
||||
https://github.com/martijnvanbrummelen/nwipe
|
||||
|
||||
Andy Beverley
|
||||
Martijn van Brummelen
|
||||
|
||||
|
||||
RELEASE NOTES
|
||||
=============
|
||||
|
||||
v0.18
|
||||
=====
|
||||
- Fixed grammar.
|
||||
- Move from loff_t to off64_t for musl libc support.
|
||||
- Add "--nosignals" option.
|
||||
- Automake needs the dist_ prefix to include man pages in 'make dist'.
|
||||
- Remove more compiler warnings.
|
||||
- Add libintl, libuuid dependencies to allow parted static link
|
||||
|
||||
v0.17
|
||||
=====
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
nwipe is a command that will securely erase disks using a variety of
|
||||
recognised methods. It is a fork of the dwipe command used by
|
||||
Darik's Boot and Nuke (dban). nwipe is included with partedmagic if
|
||||
Darik's Boot and Nuke (dban). nwipe is included with partedmagic if you
|
||||
want a quick and easy bootable CD version. nwipe was created out of
|
||||
a need to run the DBAN dwipe command outside of DBAN, in order to
|
||||
allow its use with any host distribution, thus giving better hardware
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.64])
|
||||
AC_INIT(nwipe, 0.17, andy@andybev.com)
|
||||
AM_INIT_AUTOMAKE(nwipe, 0.17)
|
||||
AC_INIT(nwipe, 0.18, git@brumit.nl)
|
||||
AM_INIT_AUTOMAKE(nwipe, 0.18)
|
||||
AC_OUTPUT(Makefile src/Makefile man/Makefile)
|
||||
AC_CONFIG_SRCDIR([src/nwipe.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@@ -42,7 +42,9 @@ PKG_CHECK_MODULES(
|
||||
)]
|
||||
)
|
||||
|
||||
AC_CHECK_LIB([parted], [ped_device_probe_all], ,[AC_MSG_ERROR([parted development library not found])])
|
||||
AC_CHECK_LIB([intl], [libintl_dgettext]) # needed to statically link libparted, but not given in its pkgconfig file
|
||||
AC_CHECK_LIB([uuid], [uuid_generate]) # needed to statically link libparted, but not given in its pkgconfig file
|
||||
PKG_CHECK_MODULES([PARTED], [libparted])
|
||||
AC_CHECK_LIB([pthread], [main], ,[AC_MSG_ERROR([pthread development library not found])])
|
||||
|
||||
# Checks for header files.
|
||||
|
||||
@@ -1 +1 @@
|
||||
man_MANS = nwipe.1
|
||||
dist_man_MANS = nwipe.1
|
||||
|
||||
@@ -40,6 +40,9 @@ Open devices in sync mode
|
||||
\fB\-\-nowait\fR
|
||||
Do not wait for a key before exiting (default is to wait).
|
||||
.TP
|
||||
\fB\-\-nosignals\fR
|
||||
Do not allow signals to interrupt a wipe (default is to allow).
|
||||
.TP
|
||||
\fB\-\-nogui\fR
|
||||
Do not show the GUI interface. Can only be used with the autonuke option.
|
||||
Nowait option is automatically invoked with the nogui option.
|
||||
|
||||
@@ -7,3 +7,5 @@ AM_LDFLAGS =
|
||||
# the previous manual Makefile
|
||||
bin_PROGRAMS = nwipe
|
||||
nwipe_SOURCES = context.h isaac_rand.c logging.h options.h prng.h nwipe.c gui.c isaac_rand.h method.h pass.c device.c gui.h isaac_standard.h mt19937ar-cok.c nwipe.h mt19937ar-cok.h pass.h device.h logging.c method.c options.c prng.c version.c version.h
|
||||
nwipe_CFLAGS = $(PARTED_CFLAGS)
|
||||
nwipe_LDADD = $(PARTED_LIBS)
|
||||
|
||||
@@ -82,7 +82,7 @@ typedef struct nwipe_context_t_
|
||||
int device_minor; /* The minor device number. */
|
||||
int device_part; /* The device partition or slice number. */
|
||||
char* device_name; /* The device file name. */
|
||||
loff_t device_size; /* The device size in bytes. */
|
||||
off64_t device_size; /* The device size in bytes. */
|
||||
struct stat device_stat; /* The device file state from fstat(). */
|
||||
nwipe_device_t device_type; /* Indicates an IDE, SCSI, or Compaq SMART device. */
|
||||
int device_target; /* The device target. */
|
||||
|
||||
24
src/nwipe.c
24
src/nwipe.c
@@ -69,9 +69,6 @@ int main( int argc, char** argv )
|
||||
/* Initialised and populated in device scan. */
|
||||
nwipe_context_t **c1 = 0;
|
||||
|
||||
/* The array of pointers to contexts that will actually be wiped. */
|
||||
nwipe_context_t **c2 = (nwipe_context_t **)malloc(nwipe_enumerated * sizeof(nwipe_context_t *));
|
||||
|
||||
/* Parse command line options. */
|
||||
nwipe_optind = nwipe_options_parse( argc, argv );
|
||||
|
||||
@@ -108,6 +105,9 @@ int main( int argc, char** argv )
|
||||
}
|
||||
|
||||
|
||||
/* The array of pointers to contexts that will actually be wiped. */
|
||||
nwipe_context_t **c2 = (nwipe_context_t **)malloc(nwipe_enumerated * sizeof(nwipe_context_t *));
|
||||
|
||||
/* Open the entropy source. */
|
||||
nwipe_entropy = open( NWIPE_KNOB_ENTROPY, O_RDONLY );
|
||||
|
||||
@@ -147,12 +147,14 @@ int main( int argc, char** argv )
|
||||
nwipe_misc_thread_data.gui_thread = &nwipe_gui_thread;
|
||||
nwipe_thread_data_ptr.nwipe_misc_thread_data = &nwipe_misc_thread_data;
|
||||
|
||||
pthread_attr_t pthread_attr;
|
||||
pthread_attr_init(&pthread_attr);
|
||||
pthread_attr_setdetachstate(&pthread_attr, PTHREAD_CREATE_DETACHED);
|
||||
|
||||
pthread_create( &nwipe_sigint_thread, &pthread_attr, signal_hand, &nwipe_thread_data_ptr);
|
||||
if( !nwipe_options.nosignals )
|
||||
{
|
||||
pthread_attr_t pthread_attr;
|
||||
pthread_attr_init(&pthread_attr);
|
||||
pthread_attr_setdetachstate(&pthread_attr, PTHREAD_CREATE_DETACHED);
|
||||
|
||||
pthread_create( &nwipe_sigint_thread, &pthread_attr, signal_hand, &nwipe_thread_data_ptr);
|
||||
}
|
||||
|
||||
/* A context struct for each device has already been created. */
|
||||
/* Now set specific nwipe options */
|
||||
@@ -354,7 +356,7 @@ int main( int argc, char** argv )
|
||||
}
|
||||
|
||||
|
||||
if( c2[i]->device_size == (loff_t)-1 )
|
||||
if( c2[i]->device_size == (off64_t)-1 )
|
||||
{
|
||||
/* We cannot determine the size of this device. */
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
@@ -367,7 +369,7 @@ int main( int argc, char** argv )
|
||||
/* Reset the file pointer. */
|
||||
r = lseek( c2[i]->device_fd, 0, SEEK_SET );
|
||||
|
||||
if( r == (loff_t)-1 )
|
||||
if( r == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_ERROR, "Unable to reset the '%s' file offset.", c2[i]->device_name );
|
||||
@@ -523,7 +525,7 @@ void *signal_hand(void *ptr)
|
||||
|
||||
if ( c[i]->thread )
|
||||
{
|
||||
char *status;
|
||||
char *status = "";
|
||||
switch( c[i]->pass_type )
|
||||
{
|
||||
case NWIPE_PASS_FINAL_BLANK:
|
||||
|
||||
@@ -81,6 +81,9 @@ int nwipe_options_parse( int argc, char** argv )
|
||||
/* Whether to exit after wiping or wait for a keypress. */
|
||||
{ "nowait", no_argument, 0, 0 },
|
||||
|
||||
/* Whether to allow signals to interrupt a wipe. */
|
||||
{ "nosignals", no_argument, 0, 0 },
|
||||
|
||||
/* Whether to exit after wiping or wait for a keypress. */
|
||||
{ "nogui", no_argument, 0, 0 },
|
||||
|
||||
@@ -114,6 +117,7 @@ int nwipe_options_parse( int argc, char** argv )
|
||||
nwipe_options.rounds = 1;
|
||||
nwipe_options.noblank = 0;
|
||||
nwipe_options.nowait = 0;
|
||||
nwipe_options.nosignals= 0;
|
||||
nwipe_options.nogui = 0;
|
||||
nwipe_options.sync = 0;
|
||||
nwipe_options.verify = NWIPE_VERIFY_LAST;
|
||||
@@ -151,6 +155,12 @@ int nwipe_options_parse( int argc, char** argv )
|
||||
break;
|
||||
}
|
||||
|
||||
if( strcmp( nwipe_options_long[i].name, "nosignals" ) == 0 )
|
||||
{
|
||||
nwipe_options.nosignals = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if( strcmp( nwipe_options_long[i].name, "nogui" ) == 0 )
|
||||
{
|
||||
nwipe_options.nogui = 1;
|
||||
@@ -332,6 +342,11 @@ void nwipe_options_log( void )
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " do not wait for a key before exiting" );
|
||||
}
|
||||
|
||||
if( nwipe_options.nosignals )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " do not allow signals to interrupt a wipe" );
|
||||
}
|
||||
|
||||
if( nwipe_options.nogui )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " do not show GUI interface" );
|
||||
@@ -394,6 +409,7 @@ display_help()
|
||||
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("");
|
||||
|
||||
@@ -49,6 +49,7 @@ typedef struct /* nwipe_options_t */
|
||||
int autonuke; /* Do not prompt the user for confirmation when set. */
|
||||
int noblank; /* Do not perform a final blanking pass. */
|
||||
int nowait; /* Do not wait for a final key before exiting. */
|
||||
int nosignals; /* Do not allow signals to interrupt a wipe. */
|
||||
int nogui ; /* Do not show the GUI. */
|
||||
char* banner; /* The product banner shown on the top line of the screen. */
|
||||
// nwipe_method_t method; /* A function pointer to the wipe method that will be used. */
|
||||
|
||||
24
src/pass.c
24
src/pass.c
@@ -46,7 +46,7 @@ int nwipe_random_verify( nwipe_context_t* c )
|
||||
size_t blocksize;
|
||||
|
||||
/* The result buffer for calls to lseek. */
|
||||
loff_t offset;
|
||||
off64_t offset;
|
||||
|
||||
/* The input buffer. */
|
||||
char* b;
|
||||
@@ -98,7 +98,7 @@ int nwipe_random_verify( nwipe_context_t* c )
|
||||
/* Reset the pass byte counter. */
|
||||
c->pass_done = 0;
|
||||
|
||||
if( offset == (loff_t)-1 )
|
||||
if( offset == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
|
||||
@@ -177,7 +177,7 @@ int nwipe_random_verify( nwipe_context_t* c )
|
||||
/* Bump the file pointer to the next block. */
|
||||
offset = lseek( c->device_fd, s, SEEK_CUR );
|
||||
|
||||
if( offset == (loff_t)-1 )
|
||||
if( offset == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial read.", c->device_name );
|
||||
@@ -225,7 +225,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
|
||||
size_t blocksize;
|
||||
|
||||
/* The result buffer for calls to lseek. */
|
||||
loff_t offset;
|
||||
off64_t offset;
|
||||
|
||||
/* The output buffer. */
|
||||
char* b;
|
||||
@@ -267,7 +267,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
|
||||
/* Reset the pass byte counter. */
|
||||
c->pass_done = 0;
|
||||
|
||||
if( offset == (loff_t)-1 )
|
||||
if( offset == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
|
||||
@@ -328,7 +328,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
|
||||
/* Bump the file pointer to the next block. */
|
||||
offset = lseek( c->device_fd, s, SEEK_CUR );
|
||||
|
||||
if( offset == (loff_t)-1 )
|
||||
if( offset == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial write.", c->device_name );
|
||||
@@ -388,7 +388,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
size_t blocksize;
|
||||
|
||||
/* The result buffer for calls to lseek. */
|
||||
loff_t offset;
|
||||
off64_t offset;
|
||||
|
||||
/* The input buffer. */
|
||||
char* b;
|
||||
@@ -470,7 +470,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
/* Reset the pass byte counter. */
|
||||
c->pass_done = 0;
|
||||
|
||||
if( offset == (loff_t)-1 )
|
||||
if( offset == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
|
||||
@@ -534,7 +534,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
/* Bump the file pointer to the next block. */
|
||||
offset = lseek( c->device_fd, s, SEEK_CUR );
|
||||
|
||||
if( offset == (loff_t)-1 )
|
||||
if( offset == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial read.", c->device_name );
|
||||
@@ -587,7 +587,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
size_t blocksize;
|
||||
|
||||
/* The result buffer for calls to lseek. */
|
||||
loff_t offset;
|
||||
off64_t offset;
|
||||
|
||||
/* The output buffer. */
|
||||
char* b;
|
||||
@@ -638,7 +638,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
/* Reset the pass byte counter. */
|
||||
c->pass_done = 0;
|
||||
|
||||
if( offset == (loff_t)-1 )
|
||||
if( offset == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
|
||||
@@ -697,7 +697,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
/* Bump the file pointer to the next block. */
|
||||
offset = lseek( c->device_fd, s, SEEK_CUR );
|
||||
|
||||
if( offset == (loff_t)-1 )
|
||||
if( offset == (off64_t)-1 )
|
||||
{
|
||||
nwipe_perror( errno, __FUNCTION__, "lseek" );
|
||||
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial write.", c->device_name );
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* used by configure to dynamically assign those values
|
||||
* to documentation files.
|
||||
*/
|
||||
const char *version_string = "0.17";
|
||||
const char *version_string = "0.18";
|
||||
const char *program_name = "nwipe";
|
||||
const char *author_name = "Andy Beverley";
|
||||
const char *email_address = "andy@andybev.com";
|
||||
const char *years = "2012";
|
||||
const char *author_name = "Martijn van Brummelen";
|
||||
const char *email_address = "git@brumit.nl";
|
||||
const char *years = "2016";
|
||||
const char *copyright = "Copyright Darik Horn <dajhorn-dban@vanadac.com>\n\
|
||||
Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>\n\
|
||||
This is free software; see the source for copying conditions.\n\
|
||||
|
||||
Reference in New Issue
Block a user