<commit_before>var child_process = require('child_process');
var exec = child_process.exec;
var fs = require('fs');
var tmp = require('tmp');

// Collection of functions for easy access to network manipulation tools on
// a Reaspberry PI.
class commands {

  // Simple function for using the command line for taking down an interface.
  static takeDown(iface, callback) {
    exec('iw dev '+iface+' del', callback);
  }
  
  static bringUp(iface, callback){
    exec('ifconfig ' + iface + ' up', callback)
  }

  static configureApIp(ip,callback){
    exec('ifconfig uap0 ' + ip, callback)
  }

  static addApInterface(callback) {
    exec('iw phy phy0 interface add uap0 type __ap', callback)
  }

  static startWpaSupplicant(callback) {
    console.log('should be starting the wpa thing')
    exec('wpa_supplicant -B -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf', callback)
  }

  static listNetworks(callback){
    exec('wpa_cli -i wlan0 list_networks', callback)
  }

  static stopAP(callback) {
    exec('pkill hostapd dnsmasq', callback)
  }

  // Simplified function for making use of ifconfig command line tool.
  //ifconfig -v wlan0 inet 172.24.1.1
  //ifconfig -v wlan0 broadcast 172.24.1.255
  static ifconfig(iface, addressType, address, callback) {
    exec('ifconfig ' + iface + " "+ addressType + " " + address, callback);
  }

  // Simplified interface to iptables.<commit_msg>more debug<commit_after>var log = require('../../../log').logger('network');
var child_process = require('child_process');
var exec = child_process.exec;
var fs = require('fs');
var tmp = require('tmp');

// Collection of functions for easy access to network manipulation tools on
// a Reaspberry PI.
class commands {

  // Simple function for using the command line for taking down an interface.
  static takeDown(iface, callback) {
    exec('iw dev '+iface+' del', callback);
  }
  
  static bringUp(iface, callback){
    exec('ifconfig ' + iface + ' up', callback)
  }

  static configureApIp(ip,callback){
    exec('ifconfig uap0 ' + ip, callback)
  }

  static addApInterface(callback) {
    exec('iw phy phy0 interface add uap0 type __ap', callback)
  }

  static startWpaSupplicant(callback) {
    log.debug('##### should be starting the wpa thing')
    exec('wpa_supplicant -B -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf', callback)
  }

  static listNetworks(callback){
    exec('wpa_cli -i wlan0 list_networks', callback)
  }

  static stopAP(callback) {
    exec('pkill hostapd dnsmasq', callback)
  }

  // Simplified function for making use of ifconfig command line tool.
  //ifconfig -v wlan0 inet 172.24.1.1
  //ifconfig -v wlan0 broadcast 172.24.1.255
  static ifconfig(iface, addressType, address, callback) {
    exec('ifconfig ' + iface + " "+ addressType + " " + address, callback);
  }

  // Simplified interface to iptables.
{'fraction_non_alphanumeric': 0.12221448467966574, 'fraction_numerical': 0.019498607242339833, 'mean_word_length': 3.686786296900489, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3384415', 'n_tokens_mistral': 965, 'n_tokens_neox': 917, 'n_words': 272}