Ejemplo n.º 1
0
static void list_key(key_serial_t key)
{
	char *buffer, *c;
	int rc;

	rc = keyctl_describe_alloc(key, &buffer);
	if (rc < 0) {
		switch (errno) {
		case EKEYEXPIRED:
			printf("Expired key not displayed\n");
			break;
		default:
			xlog_err("Failed to describe key: %m");
		}
		return;
	}

	c = strrchr(buffer, ';');
	if (!c) {
		xlog_err("Unparsable key not displayed\n");
		goto out_free;
	}
	printf("  %s\n", ++c);

out_free:
	free(buffer);
}
Ejemplo n.º 2
0
void MyMenu::set_target()
{
	
	QStringList items;
    bool ok;
	const struct access_point *aps;
	
	
	aps = get_fap();
	
	
	while (aps!=NULL){
		if (is_part_handshake(aps)==1)
			items << QString::number(aps->id +1);
		aps = aps->next;
	
	}
	
	if (items.isEmpty() == false){		
		QString item = QInputDialog::getItem(this, tr("Ap to crack"),
											 tr("Select ap:"), items, 0, false, &ok);
		
		aps = get_iap(item.toUInt()-1);
		
		if (aps == NULL){
			xlog_err(LEVEL5,this,"Alert","Can't have a null ap here in set target");
			return ;
		}else{
			sniff->crack->set_ap(aps);
		}
		
	}else{
		xlog_err(LEVEL10,this,"Alert","Can't find any ap with eapol messages");
	}
}
Ejemplo n.º 3
0
char MySniff::cfg_read_fname(char *file_name)
{
	if (this->status==TH_STARTED){
		this->stop();
	}
	
	if (this->status==TH_STOPPED){
		new_dev_clean();
		
		if (file_name==NULL){
			xlog_err(LEVEL2,parent,"Alert","Null file name");
			return -1;
		}	
		if (set_read_file(file_name) != 0){
			xlog_err(LEVEL2,parent,"Alert","Can't set read file name");
			return -1;
		}
		
		if (set_interface() < 0){
			xlog_err(LEVEL2,parent,"Alert","Can't read data from %s",file_name);
			return -1; 
		}
		
		settings = settings | XSNIFF_SETTING_IS_SET_INTERFACE;
		return 0;
	}else{
		xlog_err(LEVEL2,parent,"Alert","Can't stop thread, before starting a new one (in read)");
		return -1;		
	}	
	

	
}
Ejemplo n.º 4
0
static void
simulate_unmon (char *calling, char *unmonitoring, char *as, char *proggy)
{
  CLIENT *client;
  sm_stat *result;
  mon_id mon_id;

  xlog (D_GENERAL, "Calling %s (as %s) to unmonitor %s", calling, as,
	   unmonitoring);

  if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));

  mon_id.my_id.my_name = xstrdup (as);
  mon_id.my_id.my_prog = atoi (proggy) * SIM_SM_PROG;
  mon_id.my_id.my_vers = SIM_SM_VERS;
  mon_id.my_id.my_proc = SIM_SM_MON;
  mon_id.mon_name = unmonitoring;

  if (!(result = sm_unmon_1 (&mon_id, client)))
    xlog_err ("%s", clnt_sperror (client, "sm_unmon_1"));

  free (mon_id.my_id.my_name);
  xlog (D_GENERAL, "SM_UNMON request returned state: %d\n", result->state);
  exit (0);
}
Ejemplo n.º 5
0
static key_serial_t find_key_by_type_and_desc(const char *type,
		const char *desc, key_serial_t destringid)
{
	char buf[BUFSIZ];
	key_serial_t key;
	FILE *fp;

	if ((fp = fopen(PROCKEYS, "r")) == NULL) {
		xlog_err("fopen(%s) failed: %m", PROCKEYS);
		return -1;
	}

	key = -1;
	while(fgets(buf, BUFSIZ, fp) != NULL) {
		unsigned int id;

		if (strstr(buf, type) == NULL)
			continue;
		if (strstr(buf, desc) == NULL)
			continue;
		if (sscanf(buf, "%x %*s", &id) != 1) {
			xlog_err("Unparsable keyring entry in %s", PROCKEYS);
			continue;
		}

		key = (key_serial_t)id;
		break;
	}

	fclose(fp);
	return key;
}
Ejemplo n.º 6
0
void MyMenu::set_capture_interface()
{
//! [2]
	
	pcap_if_t *alldevsp,*listall;
	char errbuf[PCAP_ERRBUF_SIZE];
	
	
	//if (status == TH_STARTED){
	//	xlog_err(LEVEL9,this,"INFO","First you must stop capture")
	//}
	
	//errbuf[0]='\0';
	
	
	if (pcap_findalldevs(&alldevsp,errbuf)!=0){
		
		xlog_err(LEVEL2,this,"Alert","Can't get interfaces: %s",errbuf);
		
		return ;
	}
		
	
    QStringList items;
    
	if (alldevsp==NULL){
		xlog_err(LEVEL2,this,"Alert","Can't find devices. Check your permissions!");
		//pcap_freealldevs(alldevsp);
		return ;
	}
	
	//
	listall=alldevsp;
	while (listall!=NULL){
		items << tr(listall->name);
		listall=listall->next;
	}
	
	pcap_freealldevs(alldevsp);
	
	
	
    bool ok;
    QString item = QInputDialog::getItem(this, tr("Wireless interface"),
                                         tr("Wireless interface:"), items, 0, false, &ok);
    if (ok && !item.isEmpty()){
		if (sniff->cfg_interface(item.toLatin1().data())==0){
			start_menu->setDisabled(FALSE);
			mstart_start->setDisabled(FALSE);
			mstart_stop->setDisabled(TRUE);
		}
	}

}
Ejemplo n.º 7
0
static void
simulate_crash (char *host)
{
  CLIENT *client;

  if ((client = clnt_create (host, SM_PROG, SM_VERS, "udp")) == NULL)
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));

  if (!sm_simu_crash_1 (NULL, client))
    xlog_err ("%s", clnt_sperror (client, "sm_simu_crash_1"));

  exit (0);
}
Ejemplo n.º 8
0
/*
 * Find the name@domain string from either a user or group id
 */
int name_lookup(char *id, key_serial_t key, int type)
{
	char name[IDMAP_NAMESZ];
	char domain[NFS4_MAX_DOMAIN_LEN];
	uid_t uid;
	gid_t gid;
	int rc;

	rc = nfs4_get_default_domain(NULL, domain, NFS4_MAX_DOMAIN_LEN);
	if (rc != 0) {
		xlog_errno(rc,
			"name_lookup: nfs4_get_default_domain failed: %m");
		rc = -1;
		goto out;
	}

	if (type == USER) {
		uid = atoi(id);
		rc = nfs4_uid_to_name(uid, domain, name, IDMAP_NAMESZ);
	} else {
		gid = atoi(id);
		rc = nfs4_gid_to_name(gid, domain, name, IDMAP_NAMESZ);
	}
	if (rc < 0)
		xlog_errno(rc, "name_lookup: %s: failed: %m",
			(type == USER ? "nfs4_uid_to_name" : "nfs4_gid_to_name"));

	if (rc == 0) {
		rc = keyctl_instantiate(key, &name, strlen(name), 0);
		if (rc < 0)
			xlog_err("name_lookup: keyctl_instantiate failed: %m");
	}
out:
	return rc;
}
Ejemplo n.º 9
0
void
simulator (int argc, char **argv)
{
  xlog_stderr (1);
  xlog_syslog (0);
  xlog_open ("statd simulator");

  if (argc == 2)
    if (!strcasecmp (*argv, "crash"))
      simulate_crash (*(&argv[1]));

  if (argc == 3) {
    if (!strcasecmp (*argv, "stat"))
      simulate_stat (*(&argv[1]), *(&argv[2]));
  }
  if (argc == 4) {
    if (!strcasecmp (*argv, "unmon_all"))
      simulate_unmon_all (*(&argv[1]), *(&argv[2]), *(&argv[3]));
  }
  if (argc == 5) {
    if (!strcasecmp (*argv, "unmon"))
      simulate_unmon (*(&argv[1]), *(&argv[2]), *(&argv[3]), *(&argv[4]));
  }
  if (argc == 6) {
    if (!strcasecmp (*argv, "mon"))
      simulate_mon (*(&argv[1]), *(&argv[2]), *(&argv[3]), *(&argv[4]),
		    *(&argv[5]));
  }
  xlog_err ("WTF?  Give me something I can use!");
}
Ejemplo n.º 10
0
static void list_keys(const char *ring_name, key_serial_t ring_id)
{
	key_serial_t *key;
	void *keylist;
	int count;

	count = keyctl_read_alloc(ring_id, &keylist);
	if (count < 0) {
		xlog_err("Failed to read keyring %s: %m", ring_name);
		return;
	}
	count /= (int)sizeof(*key);

	switch (count) {
	case 0:
		printf("No %s keys found.\n", ring_name);
		break;
	case 1:
		printf("1 %s key found:\n", ring_name);
		break;
	default:
		printf("%u %s keys found:\n", count, ring_name);
	}

	for (key = keylist; count--; key++)
		list_key(*key);

	free(keylist);
}
Ejemplo n.º 11
0
char MySniff::stop_hop_freq()
{	
	
	if ((settings & XSNIFF_SETTING_HOP_FREQ) == 0){
		xlog_err(LEVEL1,parent,"Bug","Can't stop hop_freq (not started)");
	}
	
	if (pthread_cancel(th_hop_freq) != 0){
		log_err(LEVEL10,(char *)"Can't stop thread (qt-hop-freq): %s",(char *)strerror(errno));
		xlog_err(LEVEL1,parent,"Alert","Can't stop thread (qt-hop-freq): %s",(char *)strerror(errno));
		settings = settings & (~XSNIFF_SETTING_HOP_FREQ);
		return -1;
	}else{
		settings = settings & (~XSNIFF_SETTING_HOP_FREQ);
		return 0;
	}
}
Ejemplo n.º 12
0
char MySniff::clear_ap()
{
	if (status != TH_STOPPED){
		xlog_err(LEVEL6,parent,"Alert","You must stop capture before clearing all data");
		return -1;
	}

	ap_clean();	
	return 0;
}
Ejemplo n.º 13
0
/* 
 * Error-checking strdup() wrapper.
 */
char *
xstrdup (const char *string)
{
  char *result;

  /* Will only fail if underlying malloc() fails (ENOMEM). */
  if (!(result = strdup (string)))
    xlog_err ("strdup failed");

  return (result);
}
Ejemplo n.º 14
0
/*
 * Clear all the keys on the given keyring
 */
static int keyring_clear(const char *keyring)
{
	key_serial_t key;

	key = find_key_by_type_and_desc("keyring", keyring, 0);
	if (key == -1) {
		xlog_err("'%s' keyring was not found.", keyring);
		return EXIT_FAILURE;
	}

	if (keyctl_clear(key) < 0) {
		xlog_err("keyctl_clear(0x%x) failed: %m",
				(unsigned int)key);
		return EXIT_FAILURE;
	}
	
	if (verbose)
		xlog_warn("'%s' cleared", keyring);

	return EXIT_SUCCESS;
}
Ejemplo n.º 15
0
/*
 * Clear all the keys on the given keyring
 */
static int keyring_clear(char *keyring)
{
	FILE *fp;
	char buf[BUFSIZ];
	key_serial_t key;

	if (keyring == NULL)
		keyring = DEFAULT_KEYRING;

	if ((fp = fopen(PROCKEYS, "r")) == NULL) {
		xlog_err("fopen(%s) failed: %m", PROCKEYS);
		return 1;
	}

	while(fgets(buf, BUFSIZ, fp) != NULL) {
		if (strstr(buf, "keyring") == NULL)
			continue;
		if (strstr(buf, keyring) == NULL)
			continue;
		if (verbose) {
			*(strchr(buf, '\n')) = '\0';
			xlog_warn("clearing '%s'", buf);
		}
		/*
		 * The key is the first arugment in the string
		 */
		*(strchr(buf, ' ')) = '\0';
		sscanf(buf, "%x", &key);
		if (keyctl_clear(key) < 0) {
			xlog_err("keyctl_clear(0x%x) failed: %m", key);
			fclose(fp);
			return 1;
		}
		fclose(fp);
		return 0;
	}
	xlog_err("'%s' keyring was not found.", keyring);
	fclose(fp);
	return 1;
}
Ejemplo n.º 16
0
char MySniff::stop()
{
	int thret;
	if (status == TH_STOPPED){
		xlog_err(LEVEL9,parent,"Alert","Capture is already stopped");
		return -1;
	}
	
	
	if ((thret=pthread_cancel(th_start_capture)) != 0){
		if (thret!=ESRCH){
			xlog_err(LEVEL7,parent,"Alert","Can't stop thread: %s",(char *)strerror(errno));
			return -1;
		}else{
			status = TH_STOPPED;
			log_err(LEVEL10,(char *)"XAlert (warning): Thread already stopped");
			
			if ((settings & XSNIFF_SETTING_HOP_FREQ) != 0){
				if (this->stop_hop_freq() != 0){
					xlog_err(LEVEL2,parent,"Warning","Capture stopped but it is a problem with stopping frequencies change");
				}
			}
			stop_clean();
			
			return 0;
		}
	}else{
		status = TH_STOPPED;
		
		if ((settings & XSNIFF_SETTING_HOP_FREQ) != 0){
			if (this->stop_hop_freq() != 0){
				xlog_err(LEVEL2,parent,"Warning","Capture stopped but it is a problem with stopping frequencies change");
			}
		}
		
		stop_clean();
		return 0;
	}
}
Ejemplo n.º 17
0
/*
 * List all keys on a keyring
 */
static int list_keyring(const char *keyring)
{
	key_serial_t key;

	key = find_key_by_type_and_desc("keyring", keyring, 0);
	if (key == -1) {
		xlog_err("'%s' keyring was not found.", keyring);
		return EXIT_FAILURE;
	}

	list_keys(keyring, key);
	return EXIT_SUCCESS;
}
Ejemplo n.º 18
0
///???????????????????????????????????????????????????
void MySniff::soft_stop()
{
	status = TH_STOPPED;
	
	if ((settings & XSNIFF_SETTING_HOP_FREQ) != 0){
		if (this->stop_hop_freq() != 0){
			xlog_err(LEVEL2,parent,"Warning","Capture stopped but it is a problem with stopping frequencies change");
		}
	}
	
	stop_clean();

}
Ejemplo n.º 19
0
/*
 * Error-checking malloc() wrapper.
 */
void *
xmalloc (size_t size)
{
  void *ptr;

  if (size == 0)
    return ((void *)NULL);

  if (!(ptr = malloc (size)))
    xlog_err ("malloc failed");

  return (ptr);
}
Ejemplo n.º 20
0
char MySniff::start_hop_freq()
{	
	
	if ((settings & XSNIFF_SETTING_IS_SET_INTERFACE) == 0){
		xlog_err(LEVEL2,parent,"Alert","Can't hop freq interface is not set!");
		return -1;
	}
	
	if ((settings & XSNIFF_SETTING_IS_SET_FREQ) == 0){
		xlog_err(LEVEL2,parent,"BUG","Can't hop freq without channel initialisation!");	
		return -1;
	}
	
	if (pthread_create(&th_hop_freq,NULL,main_hop,NULL) != 0){
		log_err(LEVEL1,(char *)"Can't create thread (qt-hop-freq): %s",(char *)strerror(errno));
		xlog_err(LEVEL1,parent,"Alert","Can't create thread (qt-hop-freq): %s",(char *)strerror(errno));
		return -1;
	}else{
		
		settings = settings | XSNIFF_SETTING_HOP_FREQ;
		return 0;
	}
}
Ejemplo n.º 21
0
char MySniff::cfg_interface(char *name)
{
	new_dev_clean();
	set_dev_name(name);
	if (set_interface()<0){
		xlog_err(LEVEL2,parent,"Alert","This is not an supported wireless device. Check if the device is wireless and you have enabled monitor mode");
		return -1; 
	}
	
//TODO 	we should use G.freq and not default one
	
	settings = settings | XSNIFF_SETTING_IS_SET_INTERFACE; 
	
	if (is_offline() == 0){
		if (this->cfg_chann()!=0){
			xlog_err(LEVEL7,parent,"Alert","Please set custom channels before start capturing");
			//return -1;
			//!?
		}
	}
	
	return 0;
}
Ejemplo n.º 22
0
char MyMenu::stop_capture()
{
	//
	if (sniff->stop()==0){
		set_menu->setDisabled(FALSE);
		mstart_start->setDisabled(FALSE);
		mstart_stop->setDisabled(TRUE);
		return 0;
	}else{
		xlog_err(LEVEL2,this,"Alert","Can't stop capture");
		return -1;
	}
	
}
Ejemplo n.º 23
0
static void
simulate_mon (char *calling, char *monitoring, char *as, char *proggy,
	      char *fool)
{
  CLIENT *client;
  sm_stat_res *result;
  mon mon;

  xlog (D_GENERAL, "Calling %s (as %s) to monitor %s", calling, as,
	   monitoring);

  if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));

  memcpy (mon.priv, fool, SM_PRIV_SIZE);
  mon.mon_id.my_id.my_name = xstrdup (as);
  sim_port = atoi (proggy) * SIM_SM_PROG;
  mon.mon_id.my_id.my_prog = sim_port; /* Pseudo-dummy */
  mon.mon_id.my_id.my_vers = SIM_SM_VERS;
  mon.mon_id.my_id.my_proc = SIM_SM_MON;
  mon.mon_id.mon_name = monitoring;

  if (!(result = sm_mon_1 (&mon, client)))
    xlog_err ("%s", clnt_sperror (client, "sm_mon_1"));

  free (mon.mon_id.my_id.my_name);

  if (result->res_stat != STAT_SUCC) {
    xlog_err ("SM_MON request failed, state: %d", result->state);
  } else {
    xlog (D_GENERAL, "SM_MON result successful, state: %d\n", result->state);
    xlog (D_GENERAL, "Waiting for callback");
    daemon_simulator ();
    exit (0);
  }
}
Ejemplo n.º 24
0
static void
simulate_stat (char *calling, char *monitoring)
{
  CLIENT *client;
  sm_name checking;
  sm_stat_res *result;
  
  if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));

  checking.mon_name = monitoring;

  if (!(result = sm_stat_1 (&checking, client)))
    xlog_err ("%s", clnt_sperror (client, "sm_stat_1"));

  if (result->res_stat == STAT_SUCC)
    xlog (D_GENERAL, "STAT_SUCC from %s for %s, state: %d", calling,
	     monitoring, result->state);
  else
    xlog (D_GENERAL, "STAT_FAIL from %s for %s, state: %d", calling,
	     monitoring, result->state);

  exit (0);
}
Ejemplo n.º 25
0
char MyMenu::start_capture()
{
	
	if (sniff->start()!=0){
		xlog_err(LEVEL2,this,"Alert","Can't start capture");
		return -1;
	}
	
	set_menu->setDisabled(TRUE);
	mstart_start->setDisabled(TRUE);
	mstart_stop->setDisabled(FALSE);
	
	return 0;
	
}
Ejemplo n.º 26
0
/*
 * Find either a user or group id based on the name@domain string
 */
static int id_lookup(char *name_at_domain, key_serial_t key, int type)
{
	char id[MAX_ID_LEN];
	uid_t uid = 0;
	gid_t gid = 0;
	int rc;

	if (type == USER) {
		rc = nfs4_owner_to_uid(name_at_domain, &uid);
		sprintf(id, "%u", uid);
	} else {
		rc = nfs4_group_owner_to_gid(name_at_domain, &gid);
		sprintf(id, "%u", gid);
	}
	if (rc < 0) {
		xlog_errno(rc, "id_lookup: %s: failed: %m",
			(type == USER ? "nfs4_owner_to_uid" : "nfs4_group_owner_to_gid"));
		return EXIT_FAILURE;
	}

	rc = EXIT_SUCCESS;
	if (keyctl_instantiate(key, id, strlen(id) + 1, 0)) {
		switch (errno) {
		case EDQUOT:
		case ENFILE:
		case ENOMEM:
			/*
			 * The keyring is full. Clear the keyring and try again
			 */
			rc = keyring_clear(DEFAULT_KEYRING);
			if (rc)
				break;
			if (keyctl_instantiate(key, id, strlen(id) + 1, 0)) {
				rc = EXIT_FAILURE;
				xlog_err("id_lookup: keyctl_instantiate failed: %m");
			}
			break;
		default:
			rc = EXIT_FAILURE;
			break;
		}
	}

	return rc;
}
Ejemplo n.º 27
0
void MyMenu::load_dictionary()
{
	QString fileName; 
	fileName = QFileDialog::getOpenFileName(this,
		tr("Load dictionary"), "", "Any file (*)");
	if (fileName!=NULL){
		if (sniff->crack->set_filename(fileName.toLatin1().data())==0){
			//start_menu->setDisabled(TRUE);
			//sniff->start_offline();
			//sniff->
			//mstart_start->setDisabled(FALSE);
			//mstart_stop->setDisabled(TRUE);
			
		}else{
			xlog_err(LEVEL2,this,"Alert","Can't load dictionary");
		}
	}
}
Ejemplo n.º 28
0
char MySniff::cfg_chann(char *channels)
{
	int tmp;
	uint8_t default_channels[]=
	{
		1, 7, 13, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12, 0
		//1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0
	};
	
	if (is_offline() != 0){
		xlog_err(LEVEL1,parent,"Alert","Can't set channels in offline mode");
		return -1;
	}
	
	if ((settings & XSNIFF_SETTING_IS_SET_INTERFACE) == 0){
		xlog_err(LEVEL2,parent,"Alert","First you must configure interface!");
		return -1;
	}
	
	if (channels==NULL){
		if (init_default_channels(default_channels) < 0){
			xlog_err(LEVEL2,parent,"Alert","Can't init default channels");
			return -1;
		}
		
	}else{
		if (parse_own_channels(channels)<0){
			xlog_err(LEVEL2,parent,"Alert","Can't parse channels. You must enter just positive numbers (lower than 255) and comas Eg: 1,2,3,4,5");
			return -1;
		}
	}
	
	tmp=verify_freq();
	if (tmp!=0){
		if (tmp>0){
			xlog_err(LEVEL2,parent,"Alert","Unsuported channel %d (%d MHz)",get_channel(tmp-1),get_freq(tmp-1));
			return -1;
		}else{
			xlog_err(LEVEL2,parent,"Alert","Can't set channels");
			return -1;
		}
	}
		
	settings = settings | XSNIFF_SETTING_IS_SET_FREQ; 
	
	return 0;
	
}
Ejemplo n.º 29
0
void MyMenu::open_capture_file()
{
	QString fileName; 
	fileName = QFileDialog::getOpenFileName(this,
		tr("Open PCAP file"), "", "PCAP file (*.cap);;Any file (*)");
	if (fileName!=NULL){
		if (sniff->cfg_read_fname(fileName.toLatin1().data())==0){
			
			start_menu->setDisabled(TRUE);
			mstart_start->setDisabled(FALSE);
			mstart_stop->setDisabled(TRUE);
			set_menu->setDisabled(TRUE);
			
			sniff->start_offline();
			//mstart_start->setDisabled(FALSE);
			//mstart_stop->setDisabled(TRUE);
		}else{
			xlog_err(LEVEL2,this,"Alert","Can't open filename");
		}
	}
}
Ejemplo n.º 30
0
char MySniff::start()
{	
	if (status != TH_STOPPED){
		xlog_err(LEVEL9,parent,"Alert","Capture is already started");
		return -1;
	}
	
	if ((settings & XSNIFF_SETTING_IS_SET_INTERFACE) == 0){
		xlog_err(LEVEL2,parent,"Alert","Interface is not set!");
		return -1;
	}
	
	if (is_offline() == 0){
		if ((settings & XSNIFF_SETTING_IS_SET_FREQ) == 0){
			if (this->cfg_chann()!=0){
				xlog_err(LEVEL2,parent,"Alert","Can't run start without channel initialisation!");	
				return -1;
			}
		}
	}
	
	if (is_everything_set()!=0){
		xlog_err(LEVEL2,parent,"Alert","Can't start. Error: %d",is_everything_set());
		return -1;
	}
	
	if (pthread_create(&th_start_capture,NULL,main_loop,NULL) != 0){
		log_err(LEVEL1,(char *)"Can't create thread: %s",(char *)strerror(errno));
		xlog_err(LEVEL1,parent,"Alert","Can't create thread: %s",(char *)strerror(errno));
		return -1;
	}else{
		status = TH_STARTED;
		//pthread_join(th_start_capture,&value_ptr);
		
		if (is_offline() == 0){
			if (this->start_hop_freq() != 0){
				xlog_err(LEVEL2,parent,"Warning","Capture started but will listen only on current channel");
			}
		}
		
		return 0;
	}
}