📄 btscanner.h.in
字号:
/* * btscanner - Displays the output of Bluetooth scans * Copyright (C) 2003 Pentest Limited * * Written 2003 by Tim Hurman <timh at pentest.co.uk> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE * FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE * IS DISCLAIMED. *//* * btscanner.h: keep a bluetooth card scanning the network to find devices * that are discoverable. Heavily based on hcitool.c */#ifndef BTSCANNER_H#define BTSCANNER_H/* headers need for bluetooth */#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <bluetooth/bluetooth.h>#include <bluetooth/hci.h>#include <bluetooth/hci_lib.h>#include <bluetooth/sdp.h>#include <bluetooth/sdp_lib.h>#include <gdbm.h>/* the sdp list holder */struct search_context { char *svc; /* Service */ uuid_t group; /* Browse group */ int tree; /* Display full attribute tree */ uint32_t handle; /* Service record handle */ sdp_record_t *rec; struct search_context *sub; /* sub context head */ struct search_context *next; /* next in this context */};typedef struct search_context search_context_t;/* the linked list to hold the address info */struct device{ bdaddr_t bdaddr; uint16_t clk_off; uint32_t class; char *name; struct device *next; /* advanced info */ struct hci_version version; int got_version; unsigned char features[8]; int got_features; int8_t rssi; uint8_t rssi_status; uint8_t lq; uint8_t lq_status; search_context_t *sdp_info; /* how many times have we scanned */ unsigned int scan_count; uint16_t last_scanned;};typedef struct device device_t;/* the screen lines */struct scr_line{ char *line; struct scr_line *next;};typedef struct scr_line scr_line_t;/* the struct that holds all the details on the threads */#define MAX_WORK_THREADS 3struct proc_info{ /* generic struct info */ pthread_mutex_t proc_info_mutex; pthread_t thr_ids[MAX_WORK_THREADS]; int thr_died[MAX_WORK_THREADS]; char *scanner_error; char *info_error; GDBM_FILE ouidb; char *ouidb_filename; char *title; size_t tlen; /* bluetooth device info, all ro */ int dev_id; bdaddr_t dev_bd; pthread_mutex_t dev_mutex; /* ll of found devices + lock */ device_t *dhead; pthread_mutex_t dhead_mutex; /* further queries info */ bdaddr_t query_bd; /* when this is non zero, we scan the address */ /* the screen output */ scr_line_t *scr_head; int scr_lines; int scr_lines_start; int scr_lines_end;};/* holds the doloop var */pthread_key_t doloop_key;/* functions */void *bs_runscan(void *);void *bs_runscreen(void *);void *bs_runinfo(void *);/* linked list functions */device_t *bs_find_item(struct proc_info *, device_t *);int bs_processlines(struct proc_info *, char *);/* OUI interface */#define OUIDB_FILE "@prefix@/etc/oui.txt"int ouidb_init (struct proc_info*, const char *);int ouidb_close (struct proc_info *);char *ouidb_query(struct proc_info *, bdaddr_t *);/* service classes */#define CLASS_BITMASK 0#define CLASS_CHOOSE 1struct sub_classes{ uint32_t class_id; char *class_name;};typedef struct sub_classes sub_classes_t;struct classes{ uint32_t class_id; uint32_t sub_major_mask; uint32_t sub_minor_mask; uint8_t type; sub_classes_t *sub_major; sub_classes_t *sub_minor; char *class_name;};typedef struct classes classes_t;/* SDP interface */int bs_print_services(struct proc_info *, search_context_t *);#endif /* BTSCANNER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -