Skip to content

Commit

Permalink
Merge pull request #2 from Debian/license
Browse files Browse the repository at this point in the history
update license header of files to BSD-3-clause
  • Loading branch information
joswr1ght authored Jul 3, 2018
2 parents c200863 + 0907168 commit bfd7d7e
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 110 deletions.
11 changes: 2 additions & 9 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: common.h,v 4.1 2008-03-20 16:49:38 jwright Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

/*
Expand Down
55 changes: 24 additions & 31 deletions cowpatty.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: cowpatty.c 264 2009-07-03 15:15:50Z jwright $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

/*
Expand Down Expand Up @@ -299,7 +292,7 @@ int getpacket(struct capture_data *capdata)
/* Loop on pcap_next_ex until we get a packet we want, return from
* this while loop. This is kinda hack.
*/
while ((ret = pcap_next_ex(p, &h, (const u_char **)&packet))
while ((ret = pcap_next_ex(p, &h, (const u_char **)&packet))
&& ret > 0) {

/* Determine offset to EAP frame based on link type */
Expand Down Expand Up @@ -343,7 +336,7 @@ int getpacket(struct capture_data *capdata)
case DLT_PRISM_HEADER:
/* 802.11 frames with AVS header, AVS header is 144
* bytes */

/* If this is not a data packet, get the next frame */
dot11 = ((struct dot11hdr *)(packet+144));
if (dot11->u1.fc.type != DOT11_FC_TYPE_DATA) {
Expand Down Expand Up @@ -372,14 +365,14 @@ int getpacket(struct capture_data *capdata)
*/
rtaphdr = (struct ieee80211_radiotap_header *)packet;
/* rtap is LE */
rtaphdrlen = le16_to_cpu(rtaphdr->it_len);
/* Sanity check on header length, 10 bytes is min
rtaphdrlen = le16_to_cpu(rtaphdr->it_len);

/* Sanity check on header length, 10 bytes is min
802.11 len */
if (rtaphdrlen > (h->len - 10)) {
return -2; /* Bad radiotap data */
}

capdata->dstmac_offset = 4 + rtaphdrlen;
capdata->srcmac_offset = 10 + rtaphdrlen;

Expand Down Expand Up @@ -418,7 +411,7 @@ void handle_dot1x(struct crack_data *cdata, struct capture_data *capdata,

/* We're going after the last three frames in the 4-way handshake.
In the last frame of the TKIP exchange, the authenticator nonce is
omitted. In cases where there is a unicast and a multicast key
omitted. In cases where there is a unicast and a multicast key
distributed, frame 4 will include the authenticator nonce. In some
cases however, there is no multicast key distribution, so frame 4 has
no authenticator nonce. For this reason, we need to capture information
Expand Down Expand Up @@ -457,7 +450,7 @@ void handle_dot1x(struct crack_data *cdata, struct capture_data *capdata,

if (cdata->ver == WPA_KEY_INFO_TYPE_HMAC_MD5_RC4) {
/* Check for WPA key, and pairwise key type */
if (eapolkeyhdr->type != 254 ||
if (eapolkeyhdr->type != 254 ||
(key_info & WPA_KEY_INFO_KEY_TYPE) == 0) {
return;
}
Expand Down Expand Up @@ -517,14 +510,14 @@ void handle_dot1x(struct crack_data *cdata, struct capture_data *capdata,
} else {

/* Check for frame 1 of the 4-way handshake */
if ((key_info & WPA_KEY_INFO_MIC) == 0
if ((key_info & WPA_KEY_INFO_MIC) == 0
&& (key_info & WPA_KEY_INFO_ACK)
&& (key_info & WPA_KEY_INFO_INSTALL) == 0 ) {
/* All we need from this frame is the authenticator nonce */
memcpy(cdata->anonce, eapolkeyhdr->key_nonce,
sizeof(cdata->anonce));
cdata->anonceset = 1;

/* Check for frame 2 of the 4-way handshake */
} else if ((key_info & WPA_KEY_INFO_MIC)
&& (key_info & WPA_KEY_INFO_INSTALL) == 0
Expand Down Expand Up @@ -625,7 +618,7 @@ int nexthashrec(FILE * fp, struct hashdb_rec *rec)
int recordlength, wordlen;

if (fread(&rec->rec_size, sizeof(rec->rec_size), 1, fp) != 1) {

perror("fread");
return -1;
}
Expand Down Expand Up @@ -683,10 +676,10 @@ void hmac_hash(int ver, u8 *key, int hashlen, u8 *buf, int buflen, u8 *mic)
}
}

int hashfile_attack(struct user_opt *opt, char *passphrase,
int hashfile_attack(struct user_opt *opt, char *passphrase,
struct crack_data *cdata)
{

FILE *fp;
int reclen, wordlen;
u8 pmk[32];
Expand Down Expand Up @@ -717,7 +710,7 @@ int hashfile_attack(struct user_opt *opt, char *passphrase,

/* Ensure selected SSID matches what's stored in the header record */
if (memcmp(hf_head.ssid, opt->ssid, hf_head.ssidlen) != 0) {

memcpy(&headerssid, hf_head.ssid, hf_head.ssidlen);
headerssid[hf_head.ssidlen] = 0; /* NULL terminate string */

Expand All @@ -737,7 +730,7 @@ int hashfile_attack(struct user_opt *opt, char *passphrase,

/* nexthashrec returns the length of the record, test to ensure
passphrase is greater than 8 characters */
wordlen = rec.rec_size -
wordlen = rec.rec_size -
(sizeof(rec.pmk) + sizeof(rec.rec_size));
if (wordlen < 8) {
printf("Found a record that was too short, this "
Expand Down Expand Up @@ -767,7 +760,7 @@ int hashfile_attack(struct user_opt *opt, char *passphrase,
if (opt->verbose > 1) {
printf("Calculating PTK for \"%s\".\n", passphrase);
}

if (opt->verbose > 2) {
printf("PMK is");
lamont_hdump(pmk, sizeof(pmk));
Expand Down Expand Up @@ -816,10 +809,10 @@ int hashfile_attack(struct user_opt *opt, char *passphrase,
return 1;
}

int dictfile_attack(struct user_opt *opt, char *passphrase,
int dictfile_attack(struct user_opt *opt, char *passphrase,
struct crack_data *cdata)
{

FILE *fp;
int fret;
u8 pmk[32];
Expand Down Expand Up @@ -854,8 +847,8 @@ int dictfile_attack(struct user_opt *opt, char *passphrase,

/*
* Test length of word. IEEE 802.11i indicates the passphrase
* must be at least 8 characters in length, and no more than 63
* characters in length.
* must be at least 8 characters in length, and no more than 63
* characters in length.
*/
if (fret < 8 || fret > 63) {
if (opt->verbose) {
Expand All @@ -878,7 +871,7 @@ int dictfile_attack(struct user_opt *opt, char *passphrase,
if (opt->verbose > 1) {
printf("Calculating PMK for \"%s\".\n", passphrase);
}

pbkdf2_sha1(passphrase, opt->ssid, strlen(opt->ssid), 4096,
pmk, sizeof(pmk), USECACHED);

Expand Down Expand Up @@ -1040,7 +1033,7 @@ int dictfile_attack(struct user_opt *opt, char *passphrase,
printstats(start, end, wordstested);
return 0;
} else {
printf("Unable to identify the PSK from the dictionary file. "
printf("Unable to identify the PSK from the dictionary file. "
"Try expanding your\npassphrase list, and double-check"
" the SSID. Sorry it didn't work out.\n");
gettimeofday(&end, 0);
Expand Down
11 changes: 2 additions & 9 deletions cowpatty.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: cowpatty.h,v 4.3 2008-11-12 14:22:27 jwright Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

/*
Expand Down
17 changes: 5 additions & 12 deletions genpmk.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: genpmk.c,v 4.1 2008-03-20 16:49:38 jwright Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

#include <stdlib.h>
Expand Down Expand Up @@ -169,7 +162,7 @@ int main(int argc, char **argv)
create the file. */
ret = stat(opt.hashfile, &teststat);
if (errno == ENOENT || teststat.st_size == 0) {
/* File does not exist or is empty, populate header and
/* File does not exist or is empty, populate header and
create */
printf("File %s does not exist, creating.\n", opt.hashfile);
memcpy(hf_header.ssid, opt.ssid, strlen(opt.ssid));
Expand Down Expand Up @@ -213,7 +206,7 @@ int main(int argc, char **argv)
opt.ssid, hf_header.ssid);
exit(-1);
}

printf("File %s exists, appending new data.\n", opt.hashfile);
if (fopen(opt.hashfile, "ab") == NULL) {
perror("fopen");
Expand Down Expand Up @@ -242,7 +235,7 @@ int main(int argc, char **argv)
/*
* Test length of word. IEEE 802.11i indicates the passphrase must be
* at least 8 characters in length, and no more than 63 characters in
* length.
* length.
*/
if (fret < 8 || fret > 63) {
if (opt.verbose) {
Expand Down
11 changes: 2 additions & 9 deletions md5.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: md5.h,v 4.1 2008-03-20 16:49:38 jwright Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

/*
Expand Down
19 changes: 6 additions & 13 deletions sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: sha1.c,v 4.2 2008-03-20 16:49:38 jwright Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

/*
Expand Down Expand Up @@ -47,7 +40,7 @@ void sha1_mac(unsigned char *key, unsigned int key_len,
SHA1Final(mac, &context);
}

/* HMAC code is based on RFC 2104
/* HMAC code is based on RFC 2104
Modifications (hacks) by Joshua Wright. Optimized a bit for pbkdf2
processing by caching values that are repetitive. There is some repetitive
code in this function, which I've retained to make it more readable (for my
Expand Down Expand Up @@ -122,7 +115,7 @@ void hmac_sha1_vector(unsigned char *key, unsigned int key_len,
/* End NOCACHED SHA1 processing */
/* This code attempts to optimize the hmac-sha1 process by caching
values that remain constant for the same key. This code is called
many times by pbkdf2, so all optimizations help.
many times by pbkdf2, so all optimizations help.
If we've gotten here, we want to use caching, and have already cached
the values for k_ipad and k_opad after SHA1Update. */
Expand Down Expand Up @@ -210,8 +203,8 @@ void sha1_prf(unsigned char *key, unsigned int key_len,
size_t pos, plen;
u8 hash[SHA1_MAC_LEN];
size_t label_len = strlen(label);
unsigned char *addr[] = { (unsigned char *)label,
(unsigned char *)&zero,
unsigned char *addr[] = { (unsigned char *)label,
(unsigned char *)&zero,
data,
(unsigned char *)&counter };
unsigned int len[] = { label_len, 1, data_len, 1 };
Expand Down
11 changes: 2 additions & 9 deletions sha1.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: sha1.h,v 4.1 2008-03-20 16:49:38 jwright Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

/*
Expand Down
11 changes: 2 additions & 9 deletions utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: utils.c,v 4.2 2008-03-20 16:49:38 jwright Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

/*
Expand Down
11 changes: 2 additions & 9 deletions utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
*
* $Id: utils.h,v 4.1 2007-11-03 20:28:39 jwright Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING for more
* details.
*
* coWPAtty is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This software may be modified and distributed under the terms
* of the BSD-3-clause license. See the LICENSE file for details.
*/

/*
Expand Down

0 comments on commit bfd7d7e

Please sign in to comment.