122 Commits

Author SHA1 Message Date
wiire-a
c21e8b061c Fixed new PRNG false positive issue 2017-11-18 23:33:09 +01:00
rofl0r
7db5fd84f9 implement parallel cracking for ralink
since we already had realtek parallelized, let's do the same for
ralink too.

this commit is the result of a collaborative effort between
@wiire-a and myself.
2017-11-18 22:35:26 +00:00
wiire-a
14ad43fa6d Added crack of pin with -7
The two hashes (-s and -z) and -5 must be supplied.
2017-11-16 22:24:13 +01:00
wiire-a
7474c547eb Shrunk output format
The output has been shrunk to fit in 80 columns. To do so the colon ':'
has been removed as a byte separator. Moreover, some names (mostly the
keys), have been shortened. The WPS pin tag has been left unchanged
(except for a couple of spaces in between).
2017-11-16 22:21:06 +01:00
wiire-a
06ce5c870c Fixed redundant memcpy of E-S1 and E-S2 2017-11-16 14:43:27 +01:00
wiire-a
edd5d30b4c Added another simpler glibc PRNG
With these changes I was able to get a 9% increase in speed on my
laptop.
2017-11-16 14:38:45 +01:00
wiire-a
ceea7143cb Implemented faster glibc random function
The glibc random function has been rewritten is a simpler manner which
should make it faster to execute. Possibly up to a x2 increase in speed.
2017-11-15 19:14:28 +01:00
wiire-a
8b7b4b3172 Updated copyright information 2017-11-15 19:06:56 +01:00
wiire-a
4109810199 Print program version on stdout
All the other information is still printed on stderr. The idea to print
them on separate streams was to make it easier from wrappers to get the
version discarding all the other information, however this was never the
case until now.
2017-11-15 13:09:25 +01:00
wiire-a
c47b51baf0 Fixed previous commit 2017-11-15 13:02:56 +01:00
wiire-a
e265a62b1d Improved auto mode detection 2017-11-15 13:01:25 +01:00
wiire-a
6bdf8e8f37 Fixed a few warnings
Warnings were found with GCC, Clang and Cppcheck.
2017-11-13 12:23:44 +01:00
wiire-a
81301b7e71 Fixed potential integer overflow
The variable 'i' was of type uint_fast8_t which most compiler typedef as
unsigned char or uint8_t which both (in C99) can hold a number between 0
and 255. This could cause an integer overflow when seed was found in
mode 3 but the the program was unsuccessful to recover the PIN within
the first 255 tries of the first time window set in the future.

This bug was introduced when the constant MODE3_TRIES was increased to
10 minutes (60 * 10 = 600 which is > 255) in commit (d3e4aab).
2017-11-13 11:15:34 +01:00
wiire-a
0b56be18c7
Merge pull request #66 from rofl0r/destdir2
Makefile: add missing DESTDIR
2017-11-11 12:31:05 +01:00
rofl0r
329462e9e8 Makefile: add missing DESTDIR
somehow, this line got overlooked...
2017-11-11 10:48:36 +00:00
wiire-a
0ca5675813 Removed useless headers from random_r.c 2017-11-09 10:23:26 +01:00
wiire-a
d2e7ffaaa1 Removed boilerplate code from random_r.c
Removed all the code non relevant for the current implementation. This
should make a noticeable difference in speed and possibly allow the
compiler to optimize even more.
2017-11-08 21:58:10 +01:00
wiire-a
cb615a1a08 Formatted random_r.c 2017-11-08 21:12:19 +01:00
wiire-a
22f96521fc Switched to stack allocation during multithreading
For better performance.
2017-11-07 21:09:32 +01:00
wiire-a
e760fecda8 Added option -5 and display of secret nonces
This option is used to optionally decrypt ES-1 directly from M5, when
the Enrollee proves to the Registrar to know the PIN. As of right now it
must be used in conjunction with -7. With the introduction of this new
option, the display of ES-2 (and ES-1 when -5 is supplied) has been
added to the output.
2017-11-07 20:53:16 +01:00
wiire-a
60e8db7b93 Fixed random_r redefinition warning
See #64
2017-10-31 14:59:45 +01:00
wiire-a
d3e4aab2e8 Added forward and backward time windows when seed is found (mode 3)
Fixed #63. Added more debug info. Added separate seeds for secret
nonces.
2017-10-31 12:00:54 +01:00
wiire-a
2f1bbbea1d Renamed 'RT/MT' mode to 'RT/MT/CL' 2017-10-29 11:21:40 +01:00
wiire-a
4937d61d40 Fixed CFLAGS typo in Makefile
Introduced in (81d5b4b).
2017-10-25 09:57:00 +02:00
wiire-a
887fbbb33d Merge pull request #62 from rofl0r/makeit
Makefile improvements
2017-10-25 00:15:04 +02:00
rofl0r
c56e689f58 Makefile: use DESTDIR in the conventional way
DESTDIR gets only used in the install target, so prefix doesn't get
cluttered and can be used internally to reference file dependencies.
e.g. if for example a DB would be used, the filename to the DB could
be passed in CPPFLAGS like "-DDBPATH=$(PREFIX)/share/pixiewps.db".
this doesn't happen at the moment, but it's good practice to follow
the conventions.

additionally, remove the "rm" command in the install target - running
`make install` should never ever delete files from user's prefix.
2017-10-24 22:53:29 +01:00
rofl0r
367697a24f Makefile: rename CCFLAGS to CFLAGS
the latter is the standard way of naming it.
it was pretty surprising when doing

    make CFLAGS="-O0 -g"

ended up running `gcc -O0 -g -O3 ...`
2017-10-24 22:44:29 +01:00
wiire-a
2b3dc759f1 Merge pull request #61 from binarymaster/master
Fix compilation in mingw-w64
2017-10-22 14:22:02 +02:00
Stas'M
3fbd36a735 Fix compilation in mingw-w64 2017-10-22 15:17:41 +03:00
wiire-a
e4d1bde5bb Merge pull request #60 from rofl0r/no_attr
Add workaround for mingw toolchains with broken pthread_attr_t support
2017-10-22 13:39:40 +02:00
rofl0r
147a615891 add workaround for mingw toolchains with broken pthread_attr_t support
toolchains from https://sourceforge.net/projects/mingw-w64/ don't
define PTHREAD_STACK_MIN, and when using pthread_attr_t fail due to
internal bugs in their atomics implementation:

   __buildlogicali(_InterlockedAnd, __LONG32, and)
   mingw32/include/psdk_inc/intrin-impl.h:977:1:
   error: static declaration of '_InterlockedAnd' follows non-static declaration

OTOH, they implement pthread support without the need of external DLL's,
so using them might be preferable.
2017-10-22 12:35:37 +01:00
wiire-a
d12f0ea0a2 Added option -7
This option is used to decrypt the field encrypted settings in M7, which
contains the wireless configuration of the AP. This option exploits a
misconfigured crypto library that always generates the same random
number, resulting in always generating the same static Private key (and
Public key). Hence, Diffie-Hellman encryption can be broken and the
passphrase recovered by anyone passively sniffing the air.
2017-10-22 12:04:20 +02:00
wiire-a
9af4c43b73 Added missing frees 2017-10-22 02:45:07 +02:00
wiire-a
537dd74029 Merge pull request #58 from rofl0r/pthread_stack
Set a reasonable stacksize for threads to prevent huge waste with GLIBC
2017-10-15 20:47:17 +02:00
rofl0r
7cad1983da set a reasonable stacksize for threads to prevent huge waste with GLIBC
GLIBC defaults to giving new threads an insanely huge 8MB stack each, which
causes unnecessary memory waste. we set it to a conservative 64KB, even though
we need less than 1KB ourselves, to give sufficient leeway to buffers used
by libc itself when calling out to some of its functions.
2017-10-15 17:53:50 +01:00
wiire-a
6ee757e808 Updated usage screen 2017-10-14 12:03:32 +02:00
wiire-a
7a875fb09d Updated README 2017-10-14 12:01:41 +02:00
wiire-a
7d0f03d400 Changed default behavior to use all cores available
Used workaround to make it compile on Windows with some MinGW
installations
2017-10-14 11:43:10 +02:00
wiire-a
e2f480a900 Added libpthread dependency 2017-10-09 23:53:24 +02:00
wiire-a
4c25e2059d Removed useless C99 compilation guard 2017-10-09 23:47:59 +02:00
wiire-a
f424be2590 Merge pull request #55 from rofl0r/pthreads
Implement -j option for parallel cracks using pthreads
2017-10-09 23:45:14 +02:00
rofl0r
1e69706bb9 fix endless loop when seed wraps around from 0 to 0xffffffff
the issue could be experienced when the full brute-force space
till the unix epoch was searched.

test with: --start 02/1970 --end 01/1970
2017-10-09 22:36:04 +01:00
rofl0r
80f7774e98 implement -j option for parallel cracks using pthreads
a user-defined number of jobs (N) is started, each one is assigned
SECS_PER_JOB_BLOCK seeds to iterate over, after finishing the block
N * SECS_PER_JOB_BLOCK jobs are skipped, and it goes on again.
that way it is assured that more recent seeds get treated first.
in preliminary tests with a seed 2 years ago, using 8 jobs the
cracking time was reduced from 77 to 24 seconds.
it is possible that adjusting SECS_PER_JOB_BLOCK to a higher value
than currently speeds up cracking even more, since there will be
less "interruptions" in the CPUs branch prediction.
2017-10-09 00:07:08 +01:00
wiire-a
cbcbbd143b Changed time span to +-1 day 2017-10-08 18:23:37 +02:00
wiire-a
6c145761c3 Merge pull request #54 from rofl0r/inline
Fix inline so -O0 works too
2017-10-08 16:22:31 +02:00
wiire-a
9f39191ff2 Merge pull request #53 from rofl0r/getopt
Group getopt non-option arguments together for POSIX compat
2017-10-08 16:22:14 +02:00
rofl0r
cd61db2be5 fix inline so -O0 works too 2017-10-08 14:51:21 +01:00
rofl0r
1a395250c6 group getopt non-option arguments together for POSIX compat
for compatibility with POSIX getopt, non-option arguments
should be grouped together, since on the first occurence
of such an argument, it will consider all following arguments
non-option arguments too. this could be an issue with alternative
libc implementations.
2017-10-08 13:39:47 +01:00
wiire-a
3c8daf98df Updated to 1.3 v1.3 2017-10-07 18:13:10 +02:00
wiire-a
f33dd7a99d Updated to 1.3 2017-10-07 18:11:23 +02:00