ZerBea / hcxtools

A small set of tools to convert packets from capture files to hash files for use with Hashcat or John the Ripper.
MIT License
2.03k stars 393 forks source link

Using system-wide oui? #89

Closed thatguyatgithub closed 5 years ago

thatguyatgithub commented 5 years ago

Hi! I've prepared a patch for Debian for using system-wide ieee OUI, instead of depending on an internet connection (situations you may perfectly encounter when using hcxtools).

It would be great if you could have some sort of structure to default on a path, before using local user's home for it to download it. This would help drop this nasty nasty patch.

thanks in advance!

Index: hcxtools/whoismac.c
===================================================================
--- hcxtools.orig/whoismac.c
+++ hcxtools/whoismac.c
@@ -447,8 +447,9 @@ char *hexessidname = NULL;
 char *essidname = NULL;
 char *hash16800line = NULL;
 char *hash2500line = NULL;
+char *ouiname = NULL;
 const char confdirname[] = ".hcxtools";
-const char ouiname[] = ".hcxtools/oui.txt";
+

 while ((auswahl = getopt(argc, argv, "m:v:p:P:e:x:dh")) != -1)
        {
@@ -553,6 +554,15 @@ if(stat(confdirname, &statinfo) == -1)
 if(mode == 'd')
        downloadoui(ouiname);

+
+// Debian IEEE Data is present, using that...
+if(stat("/usr/share/ieee-data/oui.txt", &statinfo) == 0)
+{
+    ouiname = "/usr/share/ieee-data/oui.txt";
+}
+else
+    ouiname = ".hcxtools/oui.txt";
+
 if(stat(ouiname, &statinfo) != 0)
        {
        fprintf(stderr, "can't stat %s\n"
Index: hcxtools/wlanhcx2ssid.c
===================================================================
--- hcxtools.orig/wlanhcx2ssid.c
+++ hcxtools/wlanhcx2ssid.c
@@ -828,8 +828,8 @@ uid_t uid;
 struct passwd *pwd;
 FILE* fhoui;
 unsigned long long int vendoroui;
-
-const char ouiname[] = "/.hcxtools/oui.txt";
+struct stat statinfo;
+char *ouiname = NULL;

 char ouipathname[PATH_MAX +1];
 char linein[256];
@@ -842,6 +842,14 @@ if (pwd == NULL)
        exit(EXIT_FAILURE);
        }

+// Debian IEEE Data is present, using that...
+if(stat("/usr/share/ieee-data/oui.txt", &statinfo) == 0)
+{
+    ouiname = "/usr/share/ieee-data/oui.txt";
+}
+else
+    ouiname = ".hcxtools/oui.txt";
+
 strcpy(ouipathname, pwd->pw_dir);
 strcat(ouipathname, ouiname);
ZerBea commented 5 years ago

Added support for Debian systemwide oui.txt: https://github.com/ZerBea/hcxtools/commit/1cb8cc65013d1e9aa40123ed2c7eccd27065d803 Please test and close issue, if it works. Thanks for reporting that.

ZerBea commented 5 years ago

Made some more changes. Now we assume that, if a user downloads the oui, he want use this one instead of the systemwide one. If he doesn't want that, he must delete the local oui.txt

thatguyatgithub commented 5 years ago

Made some more changes.

Are those changes from https://github.com/ZerBea/hcxtools/commit/8b19bcc ?

Now we assume that, if a user downloads the oui, he want use this one instead of the systemwide one. If he doesn't want that, he must delete the local oui.txt

They work as expected, and that logic is actually much better, awesome!

Thanks!

ZerBea commented 5 years ago

No problem, you're welcome. Hope to see hcxtools/hcxdumptool sooner or later in debian repository.