Advertisement
Guest User

Untitled

a guest
May 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.30 KB | None | 0 0
  1. diff --git a/common.mak b/common.mak
  2. index a8475a1..0851625 100644
  3. --- a/common.mak
  4. +++ b/common.mak
  5. @@ -133,6 +133,18 @@ ifeq ($(OSNAME), Linux)
  6.     endif
  7.  endif
  8.  
  9. +ifeq ($(ht_channels), true)
  10. +HT_CHANNELS     = true
  11. +endif
  12. +
  13. +ifeq ($(HT_CHANNELS), true)
  14. +   # HT_CHANNELS depends on CONFIG_LIBNL
  15. +   ifneq (,$(findstring DCONFIG_LIBNL, $(COMMON_CFLAGS)))
  16. +       COMMON_CFLAGS += -DHT_CHANNELS
  17. +   endif
  18. +endif
  19. +
  20. +
  21.  ifeq ($(subst TRUE,true,$(filter TRUE true,$(airpcap) $(AIRPCAP))),true)
  22.     LIBAIRPCAP = -DHAVE_AIRPCAP -I$(AC_ROOT)/../developers/Airpcap_Devpack/include
  23.  endif
  24. diff --git a/src/airodump-ng.c b/src/airodump-ng.c
  25. index 0ce2131..b999267 100644
  26. --- a/src/airodump-ng.c
  27. +++ b/src/airodump-ng.c
  28. @@ -65,6 +65,10 @@
  29.  #include <pcre.h>
  30.  #endif
  31.  
  32. +#ifdef HT_CHANNELS
  33. +#include <linux/nl80211.h>
  34. +#endif //HT_CHANNELS
  35. +
  36.  #include "version.h"
  37.  #include "pcap.h"
  38.  #include "uniqueiv.h"
  39. @@ -5415,7 +5419,11 @@ void channel_hopper(struct wif *wi[], int if_num, int chan_count, pid_t parent)
  40.  
  41.              ch = G.channels[ch_idx];
  42.  
  43. +#ifdef HT_CHANNELS
  44. +            if(wi_set_ht_channel(wi[card], ch, G.htval) == 0 )
  45. +#else
  46.              if(wi_set_channel(wi[card], ch ) == 0 )
  47. +#endif
  48.              {
  49.                  G.channel[card] = ch;
  50.                  unused = write( G.cd_pipe[1], &card, sizeof(int) );
  51. @@ -5966,7 +5974,11 @@ int check_channel(struct wif *wi[], int cards)
  52.          {
  53.              memset(G.message, '\x00', sizeof(G.message));
  54.              snprintf(G.message, sizeof(G.message), "][ fixed channel %s: %d ", wi_get_ifname(wi[i]), chan);
  55. +#ifdef HT_CHANNELS
  56. +            wi_set_ht_channel(wi[i], G.channel[i], G.htval);
  57. +#else
  58.              wi_set_channel(wi[i], G.channel[i]);
  59. +#endif
  60.          }
  61.      }
  62.      return 0;
  63. @@ -6148,6 +6160,11 @@ int main( int argc, char *argv[] )
  64.      fd_set             rfds;
  65.  
  66.      static struct option long_options[] = {
  67. +#ifdef HT_CHANNELS
  68. +        {"ht20",     0, 0, '2'},
  69. +        {"ht40-",    0, 0, '3'},
  70. +        {"ht40+",    0, 0, '5'},
  71. +#endif
  72.          {"band",     1, 0, 'b'},
  73.          {"beacon",   0, 0, 'e'},
  74.          {"beacons",  0, 0, 'e'},
  75. @@ -6263,6 +6280,9 @@ int main( int argc, char *argv[] )
  76.      G.file_write_interval = 5; // Write file every 5 seconds by default
  77.      G.maxsize_wps_seen  =  6;
  78.      G.show_wps     = 0;
  79. +#ifdef HT_CHANNELS
  80. +    G.htval        = 0;
  81. +#endif
  82.  #ifdef HAVE_PCRE
  83.      G.f_essid_regex = NULL;
  84.  #endif
  85. @@ -6744,6 +6764,18 @@ int main( int argc, char *argv[] )
  86.                      G.active_scan_sim = 0;
  87.                  break;
  88.  
  89. +#ifdef HT_CHANNELS
  90. +            case '2':
  91. +                G.htval = NL80211_CHAN_HT20;
  92. +                break;
  93. +            case '3':
  94. +                G.htval = NL80211_CHAN_HT40MINUS;
  95. +                break;
  96. +            case '5':
  97. +                G.htval = NL80211_CHAN_HT40PLUS;
  98. +                break;
  99. +#endif //HT_CHANNELS
  100. +
  101.              default : goto usage;
  102.          }
  103.      } while ( 1 );
  104. @@ -6901,7 +6933,11 @@ usage:
  105.              {
  106.                  for( i=0; i<G.num_cards; i++ )
  107.                  {
  108. +#ifdef HT_CHANNELS
  109. +                    wi_set_ht_channel(wi[i], G.channel[0], G.htval);
  110. +#else
  111.                      wi_set_channel(wi[i], G.channel[0]);
  112. +#endif
  113.                      G.channel[i] = G.channel[0];
  114.                  }
  115.                  G.singlechan = 1;
  116. diff --git a/src/airodump-ng.h b/src/airodump-ng.h
  117. index 8358cb3..bce189c 100644
  118. --- a/src/airodump-ng.h
  119. +++ b/src/airodump-ng.h
  120. @@ -476,6 +476,9 @@ struct globals
  121.      int file_write_interval;
  122.      u_int maxsize_wps_seen;
  123.      int show_wps;
  124. +#ifdef HT_CHANNELS
  125. +    int htval;
  126. +#endif
  127.  }
  128.  G;
  129.  
  130. diff --git a/src/osdep/linux.c b/src/osdep/linux.c
  131. index 034c4a0..3beb171 100644
  132. --- a/src/osdep/linux.c
  133. +++ b/src/osdep/linux.c
  134. @@ -943,8 +943,14 @@ static int ieee80211_channel_to_frequency(int chan)
  135.      return (chan + 1000) * 5;
  136.  }
  137.  
  138. +static int linux_set_ht_channel_nl80211(struct wif *wi, int channel, unsigned int htval);
  139.  static int linux_set_channel_nl80211(struct wif *wi, int channel)
  140.  {
  141. +    return linux_set_ht_channel_nl80211(wi, channel, NL80211_CHAN_NO_HT);
  142. +}
  143. +
  144. +static int linux_set_ht_channel_nl80211(struct wif *wi, int channel, unsigned int htval)
  145. +{
  146.      struct priv_linux *dev = wi_priv(wi);
  147.      char s[32];
  148.      int pid, status, unused;
  149. @@ -952,7 +958,6 @@ static int linux_set_channel_nl80211(struct wif *wi, int channel)
  150.      unsigned int devid;
  151.      struct nl_msg *msg;
  152.      unsigned int freq;
  153. -    unsigned int htval = NL80211_CHAN_NO_HT;
  154.  
  155.      memset( s, 0, sizeof( s ) );
  156.  
  157. @@ -2192,10 +2197,13 @@ static struct wif *linux_open(char *iface)
  158.          wi->wi_write            = linux_write;
  159.  #ifdef CONFIG_LIBNL
  160.          linux_nl80211_init(&state);
  161. +#ifdef HT_CHANNELS
  162. +        wi->wi_set_ht_channel      = linux_set_ht_channel_nl80211;
  163. +#endif //HT_CHANNELS
  164.          wi->wi_set_channel      = linux_set_channel_nl80211;
  165.  #else
  166.          wi->wi_set_channel      = linux_set_channel;
  167. -#endif
  168. +#endif //CONFIG_LIBNL
  169.          wi->wi_get_channel      = linux_get_channel;
  170.          wi->wi_set_freq        = linux_set_freq;
  171.          wi->wi_get_freq        = linux_get_freq;
  172. diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c
  173. index f54a2db..bf636b0 100644
  174. --- a/src/osdep/osdep.c
  175. +++ b/src/osdep/osdep.c
  176. @@ -40,6 +40,14 @@ int wi_write(struct wif *wi, unsigned char *h80211, int len,
  177.          return wi->wi_write(wi, h80211, len, ti);
  178.  }
  179.  
  180. +#ifdef HT_CHANNELS
  181. +int wi_set_ht_channel(struct wif *wi, int chan, unsigned int htval)
  182. +{
  183. +        assert(wi->wi_set_ht_channel);
  184. +        return wi->wi_set_ht_channel(wi, chan, htval);
  185. +}
  186. +#endif
  187. +
  188.  int wi_set_channel(struct wif *wi, int chan)
  189.  {
  190.          assert(wi->wi_set_channel);
  191. diff --git a/src/osdep/osdep.h b/src/osdep/osdep.h
  192. index 5a67283..71cfa15 100644
  193. --- a/src/osdep/osdep.h
  194. +++ b/src/osdep/osdep.h
  195. @@ -85,6 +85,9 @@ struct wif {
  196.                             struct rx_info *ri);
  197.          int     (*wi_write)(struct wif *wi, unsigned char *h80211, int len,
  198.                              struct tx_info *ti);
  199. +#ifdef HT_CHANNELS
  200. +        int     (*wi_set_ht_channel)(struct wif *wi, int chan, unsigned int htval);
  201. +#endif
  202.          int     (*wi_set_channel)(struct wif *wi, int chan);
  203.          int     (*wi_get_channel)(struct wif *wi);
  204.          int     (*wi_set_freq)(struct wif *wi, int freq);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement