Skip to content

Commit

Permalink
prepare reading track file generated by gpsbabel
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Sep 8, 2024
1 parent cb2e316 commit cff1845
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
35 changes: 15 additions & 20 deletions hcxpcapngtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -5669,24 +5669,17 @@ printcontentinfo();
return;
}
/*===========================================================================*/
static bool processgpxfile(char *gpxinname)
static bool processtrackfile(char *trackinname)
{
static FILE *fh_gpxin;
static struct stat statinfo;
static int *gpxstart;
static FILE *fh_trackin;

if(stat(gpxinname, &statinfo) != 0) return false;
if(statinfo.st_size == 0) return false;
if((gpxstart = calloc(1, statinfo.st_size)) == NULL) return false;
if((fh_gpxin = fopen(gpxinname, "r")) == NULL)
if((fh_trackin = fopen(trackinname, "r")) == NULL)
{
free(gpxstart);
return false;

}


free(gpxstart);
fclose(fh_gpxin);
fclose(fh_trackin);
return true;
}
/*===========================================================================*/
Expand Down Expand Up @@ -6060,7 +6053,9 @@ fprintf(stdout, "%s %s (C) %s ZeroBeat\n"
"--eapmd5-john=<file> : output EAP MD5 CHALLENGE (john chap)\n"
"--eapleap=<file> : output EAP LEAP and MSCHAPV2 CHALLENGE (hashcat -m 5500, john netntlm)\n"
"--tacacs-plus=<file> : output TACACS PLUS v1 (hashcat -m 16100, john tacacs-plus)\n"
// "--gpxin=<file> : input GPX file\n"
// "--track=<file> : input TRACK file (No,Latitude,Longitude,Altitude,Date,Time)\n"
// " gpsbabel -t -i GPS_IN_FORMAT -f GPS_IN_FILE -o unicsv -F TRACK_FILE\n"
// " gpsbabel -t -i GPS_IN_FORMAT -f GPS_IN_FILE -x track,move=TIME_ADJUST_TO_SYSTEM_CLOCKTIME -o unicsv -F TRACK_FILE\n"
"--nmea=<file> : output GPS data in NMEA 0183 format\n"
" format: NMEA 0183 $GPGGA, $GPRMC, $GPWPL\n"
" to convert it to gpx, use GPSBabel:\n"
Expand Down Expand Up @@ -6172,7 +6167,7 @@ static char *essidproberequestoutname;
static char *deviceinfooutname;
static char *identityoutname;
static char *usernameoutname;
static char *gpxinname;
static char *trackinname;
static char *nmeaoutname;
static char *csvoutname;
static char *logoutname;
Expand Down Expand Up @@ -6220,7 +6215,7 @@ static const struct option long_options[] =
{"nonce-error-corrections", required_argument, NULL, HCX_NC},
{"ignore-ie", no_argument, NULL, HCX_IE},
{"max-essids", required_argument, NULL, HCX_ESSIDS},
{"gpxin", required_argument, NULL, HCX_GPX_IN},
{"track-in", required_argument, NULL, HCX_TRACK_IN},
{"nmea", required_argument, NULL, HCX_NMEA_OUT},
{"csv", required_argument, NULL, HCX_CSV_OUT},
{"raw-out", required_argument, NULL, HCX_RAW_OUT},
Expand Down Expand Up @@ -6265,7 +6260,7 @@ essidproberequestoutname = NULL;
identityoutname = NULL;
usernameoutname = NULL;
deviceinfooutname = NULL;
gpxinname = NULL;
trackinname = NULL;
nmeaoutname = NULL;
csvoutname = NULL;
logoutname = NULL;
Expand Down Expand Up @@ -6380,8 +6375,8 @@ while((auswahl = getopt_long (argc, argv, short_options, long_options, &index))
deviceinfooutname = optarg;
break;

case HCX_GPX_IN:
gpxinname = optarg;
case HCX_TRACK_IN:
trackinname = optarg;
break;

case HCX_NMEA_OUT:
Expand Down Expand Up @@ -6756,9 +6751,9 @@ if(hccapoutnamedeprecated != NULL)
}
}

if(gpxinname != NULL)
if(trackinname != NULL)
{
if(processgpxfile(gpxinname) == false) exitcode = EXIT_FAILURE;
if(processtrackfile(trackinname) == false) exitcode = EXIT_FAILURE;
}

for(index = optind; index < argc; index++)
Expand Down
2 changes: 1 addition & 1 deletion include/hcxpcapngtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define HCX_PMKIDEAPOLJTR_OUT_DEPRECATED 20
#define HCX_PREFIX_OUT 21
#define HCX_ADD_TIMESTAMP 22
#define HCX_GPX_IN 23
#define HCX_TRACK_IN 23
#define HCX_PMKIDEAPOL_OUT 'o'
#define HCX_ESSID_OUT 'E'
#define HCX_ESSIDPROBEREQUEST_OUT 'R'
Expand Down

0 comments on commit cff1845

Please sign in to comment.