diff --git a/docker-compose.yml b/docker-compose.yml index 316ac3d..bd36fce 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: yarilo: image: typicalam/yarilo:latest - command: --battery_file=/app/battery/battery_level --oid_file=/app/data/oid.txt --save_path=/app/saves --db_file=/app/saves/yarilo_database.db --sniff_file=/tmp/pcap/wireshark_sample.pcap + command: --log_level=debug --battery_file=/app/battery/battery_level --oid_file=/app/data/oid.txt --save_path=/app/saves --db_file=/app/saves/yarilo_database.db --iface=wlan1 volumes: - /tmp/saves:/app/saves - ./pcap:/tmp/pcap diff --git a/gui-2.0/.gitignore b/gui-2.0/.gitignore new file mode 100644 index 0000000..eff7e2d --- /dev/null +++ b/gui-2.0/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +.lgd-nfy0 \ No newline at end of file diff --git a/gui-2.0/Font/Font00.ttf b/gui-2.0/Font/Font00.ttf new file mode 100644 index 0000000..e85ffd1 Binary files /dev/null and b/gui-2.0/Font/Font00.ttf differ diff --git a/gui-2.0/Font/Font01.ttf b/gui-2.0/Font/Font01.ttf new file mode 100644 index 0000000..60e872e Binary files /dev/null and b/gui-2.0/Font/Font01.ttf differ diff --git a/gui-2.0/Font/Font02.ttf b/gui-2.0/Font/Font02.ttf new file mode 100644 index 0000000..f8f46ee Binary files /dev/null and b/gui-2.0/Font/Font02.ttf differ diff --git a/gui-2.0/button_handler.py b/gui-2.0/button_handler.py new file mode 100644 index 0000000..07d75d9 --- /dev/null +++ b/gui-2.0/button_handler.py @@ -0,0 +1,29 @@ +import RPi.GPIO as GPIO + +BUTTON_PINS = { + 17: "ACCEPT", + 22: "REFUSE", + 26: "DOWN", + 13: "LEFT", + 6: "RIGHT", + 5: "UP" +} + +class ButtonHandler: + def __init__(self, callback): + """ + :param callback: A function that accepts (channel, button_name) + """ + self.callback = callback + GPIO.setmode(GPIO.BCM) + for pin in BUTTON_PINS: + GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) + try: + GPIO.remove_event_detect(pin) + except RuntimeError: + pass + GPIO.add_event_detect(pin, GPIO.RISING, callback=self.handle_button, bouncetime=100) + + def handle_button(self, channel): + button_name = BUTTON_PINS.get(channel, "UNKNOWN") + self.callback(channel, button_name) \ No newline at end of file diff --git a/gui-2.0/client.py b/gui-2.0/client.py new file mode 100644 index 0000000..05d4205 --- /dev/null +++ b/gui-2.0/client.py @@ -0,0 +1,141 @@ +import grpc +import os +import sys +sys.path.append(os.path.dirname(__file__)) +import service_pb2, service_pb2_grpc + +class Client: + def __init__(self, host='localhost', port=9090): + self.channel = grpc.insecure_channel(f'{host}:{port}') + self.stub = service_pb2_grpc.SnifferStub(self.channel) + # Cache the primary sniffer if available + self._sniffer_uuid = None + + def _get_primary_sniffer_uuid(self): + if self._sniffer_uuid is None: + response = self.stub.SnifferList(service_pb2.Empty()) + if response.sniffers: + self._sniffer_uuid = response.sniffers[0].uuid + else: + raise ValueError("No sniffers found.") + return self._sniffer_uuid + + def is_connected(self): + try: + self.stub.SnifferList(service_pb2.Empty()) + return True + except grpc.RpcError as e: + if e.code() == grpc.StatusCode.UNAVAILABLE: + print("gRPC Error: Unable to connect to the server.") + else: + print(f"gRPC Error: {e.details()} (Code: {e.code()})") + return False + + def get_sniffer_list(self): + response = self.stub.SnifferList(service_pb2.Empty()) + if not response.sniffers: + return "No sniffers found." + sniffers = [ + f"uuid: {sniffer.uuid} interface name: {sniffer.net_iface_name}\nfilename: {sniffer.filename}\n" + for sniffer in response.sniffers + ] + return "Sniffers:\n" + "\n".join(sniffers) + + def get_access_point_list(self): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.APGetRequest(sniffer_uuid=uuid) + response = self.stub.AccessPointList(request) + if not response.nets: + return "No access points found." + access_points = [f"{ap.ssid} - {ap.bssid}\n" for ap in response.nets] + return "Access Points:\n" + "".join(access_points) + except ValueError as e: + return str(e) + + def get_networks_list(self): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.APGetRequest(sniffer_uuid=uuid) + response = self.stub.AccessPointList(request) + if not response.nets: + return "No networks found." + networks = [str([network.ssid, network.bssid]) for network in response.nets] + return networks + except ValueError as e: + return str(e) + + def create_recording(self): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.RecordingCreateRequest( + sniffer_uuid=uuid, + name='Manual_recording', + raw=True + ) + response = self.stub.RecordingCreate(request) + return str(response) + except ValueError as e: + return str(e) + + def create_APrecording(self, bssid): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.APCreateRecordingRequest( + sniffer_uuid=uuid, + name='AccessPoint_recording', + bssid=bssid, + raw=True + ) + response = self.stub.RecordingCreate(request) + return str(response) + except ValueError as e: + return str(e) + + def get_battery(self): + try: + response = self.stub.BatteryGetLevel(service_pb2.Empty()) + # Use the float value directly from response.percentage + formated_resp = f"{response.percentage:.0f}" + formated_resp = int(formated_resp) + return formated_resp + except grpc.RpcError as e: + return "Get battery error" + + def start_focus(self, network): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.FocusStartRequest( + sniffer_uuid=uuid, + bssid=network + ) + response = self.stub.FocusStart(request) + print(response) + return str(response) + except grpc.RpcError as e: + print(e) + return "Start focus error" + + def get_active_focus(self): + try: + uuid = self._get_primary_sniffer_uuid() + response = self.stub.FocusGetActive(uuid) + return str(response) + except grpc.RpcError as e: + print(e) + return "Get active focus error" + + def ignore_AP(self, network): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.APIgnoreRequest( + sniffer_uuid=uuid, + use_ssid=False, + bssid=network, + ssid="" + ) + response = self.stub.AccessPointIgnore(request) + return str(response) + except grpc.RpcError as e: + print(e) + return "Ignore AP error" \ No newline at end of file diff --git a/gui-2.0/display.py b/gui-2.0/display.py new file mode 100644 index 0000000..6b602a1 --- /dev/null +++ b/gui-2.0/display.py @@ -0,0 +1,57 @@ +from lib import LCD_2inch4 +import spidev +from PIL import Image, ImageDraw, ImageFont + +# Constants +RST = 27 +DC = 25 +BL = 18 +BUS = 0 +DEVICE = 0 +FONT_SIZE = 25 + +class Display: + def __init__(self): + self.disp = LCD_2inch4.LCD_2inch4( + spi=spidev.SpiDev(BUS, DEVICE), spi_freq=40000000, rst=RST, dc=DC, bl=BL) + self.disp.Init() + self.disp.clear() + + self.elements = [] + + # Set up drawing + self.width = 320 + self.height = 240 + self.image = Image.new("RGB", (self.width, self.height), "white") + self.draw = ImageDraw.Draw(self.image) + + # Load font + self.font = ImageFont.load_default() + + # Note: GPIO/button handling is now managed via ButtonHandler + + def update(self): + image_to_disp = self.image.rotate(180) + self.disp.ShowImage(image_to_disp) + + def clear(self): + self.draw.rectangle((0, 0, self.width, self.height), fill="white") + + def draw_text(self, text, position, color="white"): + self.draw.text(position, text, fill=color, font=self.font) + + def draw_rectangle(self, bbox, color="white", outline=None): + self.draw.rectangle(bbox, fill=color, outline=outline) + + def add_element(self, element): + self.elements.append(element) + + def render(self): + self.clear() + for element in self.elements: + element.draw(self.draw) + self.update() + + def cleanup(self): + self.disp.reset() + self.disp.clear() \ No newline at end of file diff --git a/gui-2.0/lib/LCD_2inch4.py b/gui-2.0/lib/LCD_2inch4.py new file mode 100644 index 0000000..f108c1d --- /dev/null +++ b/gui-2.0/lib/LCD_2inch4.py @@ -0,0 +1,187 @@ + +import time +from . import lcdconfig +import numbers + +class LCD_2inch4(lcdconfig.RaspberryPi): + + width = 240 + height = 320 + def command(self, cmd): + self.digital_write(self.DC_PIN, self.GPIO.LOW) + self.spi_writebyte([cmd]) + + def data(self, val): + self.digital_write(self.DC_PIN, self.GPIO.HIGH) + self.spi_writebyte([val]) + def reset(self): + """Reset the display""" + self.GPIO.output(self.RST_PIN,self.GPIO.HIGH) + time.sleep(0.01) + self.GPIO.output(self.RST_PIN,self.GPIO.LOW) + time.sleep(0.01) + self.GPIO.output(self.RST_PIN,self.GPIO.HIGH) + time.sleep(0.01) + + def Init(self): + """Initialize dispaly""" + self.module_init() + self.reset() + + self.command(0x11)#'''Sleep out''' + + self.command(0xCF)# + self.data(0x00)# + self.data(0xC1)# + self.data(0X30)# + self.command(0xED)# + self.data(0x64)# + self.data(0x03)# + self.data(0X12)# + self.data(0X81)# + self.command(0xE8)# + self.data(0x85)# + self.data(0x00)# + self.data(0x79)# + self.command(0xCB)# + self.data(0x39)# + self.data(0x2C)# + self.data(0x00)# + self.data(0x34)# + self.data(0x02)# + self.command(0xF7)# + self.data(0x20)# + self.command(0xEA)# + self.data(0x00)# + self.data(0x00)# + self.command(0xC0)#'''Power control''' + self.data(0x1D)#'''VRH[5:0]''' + self.command(0xC1)#'''Power control''' + self.data(0x12)#'''SAP[2:0]#BT[3:0]''' + self.command(0xC5)#'''VCM control''' + self.data(0x33)# + self.data(0x3F)# + self.command(0xC7)#'''VCM control''' + self.data(0x92)# + self.command(0x3A)#'''Memory Access Control''' + self.data(0x55)# + self.command(0x36)#'''Memory Access Control''' + self.data(0x08)# + self.command(0xB1)# + self.data(0x00)# + self.data(0x12)# + self.command(0xB6)#'''Display Function Control''' + self.data(0x0A)# + self.data(0xA2)# + + self.command(0x44)# + self.data(0x02)# + + self.command(0xF2)#'''3Gamma Function Disable''' + self.data(0x00)# + self.command(0x26)#'''Gamma curve selected''' + self.data(0x01)# + self.command(0xE0)#'''Set Gamma''' + self.data(0x0F)# + self.data(0x22)# + self.data(0x1C)# + self.data(0x1B)# + self.data(0x08)# + self.data(0x0F)# + self.data(0x48)# + self.data(0xB8)# + self.data(0x34)# + self.data(0x05)# + self.data(0x0C)# + self.data(0x09)# + self.data(0x0F)# + self.data(0x07)# + self.data(0x00)# + self.command(0XE1)#'''Set Gamma''' + self.data(0x00)# + self.data(0x23)# + self.data(0x24)# + self.data(0x07)# + self.data(0x10)# + self.data(0x07)# + self.data(0x38)# + self.data(0x47)# + self.data(0x4B)# + self.data(0x0A)# + self.data(0x13)# + self.data(0x06)# + self.data(0x30)# + self.data(0x38)# + self.data(0x0F)# + self.command(0x29)#'''Display on''' + + + def SetWindows(self, Xstart, Ystart, Xend, Yend): + #set the X coordinates + self.command(0x2A) + self.data(Xstart>>8) #Set the horizontal starting point to the high octet + self.data(Xstart & 0xff) #Set the horizontal starting point to the low octet + self.data(Xend>>8) #Set the horizontal end to the high octet + self.data((Xend - 1) & 0xff)#Set the horizontal end to the low octet + + #set the Y coordinates + self.command(0x2B) + self.data(Ystart>>8) + self.data((Ystart & 0xff)) + self.data(Yend>>8) + self.data((Yend - 1) & 0xff ) + + self.command(0x2C) + + def ShowImage(self,Image,Xstart=0,Ystart=0): + """Set buffer to value of Python Imaging Library image.""" + """Write display buffer to physical display""" + imwidth, imheight = Image.size + if imwidth == self.height and imheight == self.width: + img = self.np.asarray(Image) + pix = self.np.zeros((imheight,imwidth , 2), dtype = self.np.uint8) + + pix[...,[0]] = self.np.add(self.np.bitwise_and(img[...,[0]],0xF8),self.np.right_shift(img[...,[1]],5)) + pix[...,[1]] = self.np.add(self.np.bitwise_and(self.np.left_shift(img[...,[1]],3),0xE0), self.np.right_shift(img[...,[2]],3)) + + pix = pix.flatten().tolist() + + self.command(0x36) + self.data(0x78) + self.SetWindows ( 0, 0, self.height, self.width) + self.digital_write(self.DC_PIN,self.GPIO.HIGH) + for i in range(0,len(pix),4096): + self.spi_writebyte(pix[i:i+4096]) + + else : + img = self.np.asarray(Image) + pix = self.np.zeros((imheight,imwidth , 2), dtype = self.np.uint8) + + pix[...,[0]] = self.np.add(self.np.bitwise_and(img[...,[0]],0xF8),self.np.right_shift(img[...,[1]],5)) + pix[...,[1]] = self.np.add(self.np.bitwise_and(self.np.left_shift(img[...,[1]],3),0xE0), self.np.right_shift(img[...,[2]],3)) + + pix = pix.flatten().tolist() + self.command(0x36) + self.data(0x08) + self.SetWindows ( 0, 0, self.width, self.height) + self.digital_write(self.DC_PIN,self.GPIO.HIGH) + for i in range(0,len(pix),4096): + self.spi_writebyte(pix[i:i+4096]) + + def clear(self): + """Clear contents of image buffer""" + _buffer = [0xff]*(self.width * self.height * 2) + time.sleep(0.02) + self.SetWindows ( 0, 0, self.width, self.height) + self.digital_write(self.DC_PIN,self.GPIO.HIGH) + for i in range(0,len(_buffer),4096): + self.spi_writebyte(_buffer[i:i+4096]) + + def clear_color(self,color): + """Clear contents of image buffer""" + _buffer = [color>>8, color & 0xff]*(self.width * self.height) + time.sleep(0.02) + self.SetWindows ( 0, 0, self.width, self.height) + self.digital_write(self.DC_PIN,self.GPIO.HIGH) + for i in range(0,len(_buffer),4096): + self.spi_writebyte(_buffer[i:i+4096]) diff --git a/gui-2.0/lib/__init__.py b/gui-2.0/lib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gui-2.0/lib/__init__.pyc b/gui-2.0/lib/__init__.pyc new file mode 100644 index 0000000..7b0b4ea Binary files /dev/null and b/gui-2.0/lib/__init__.pyc differ diff --git a/gui-2.0/lib/lcdconfig.py b/gui-2.0/lib/lcdconfig.py new file mode 100644 index 0000000..77b058f --- /dev/null +++ b/gui-2.0/lib/lcdconfig.py @@ -0,0 +1,111 @@ +# /***************************************************************************** +# * | File : epdconfig.py +# * | Author : Waveshare team +# * | Function : Hardware underlying interface +# * | Info : +# *---------------- +# * | This version: V1.0 +# * | Date : 2019-06-21 +# * | Info : +# ****************************************************************************** +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documnetation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + +import os +import sys +import time +import spidev +import logging +import numpy as np + +class RaspberryPi: + def __init__(self,spi=spidev.SpiDev(0,0),spi_freq=40000000,rst = 27,dc = 25,bl = 18,bl_freq=1000,i2c=None,i2c_freq=100000): + import RPi.GPIO + self.np=np + self.RST_PIN= rst + self.DC_PIN = dc + self.BL_PIN = bl + self.SPEED =spi_freq + self.BL_freq=bl_freq + self.GPIO = RPi.GPIO + #self.GPIO.cleanup() + self.GPIO.setmode(self.GPIO.BCM) + self.GPIO.setwarnings(False) + self.GPIO.setup(self.RST_PIN, self.GPIO.OUT) + self.GPIO.setup(self.DC_PIN, self.GPIO.OUT) + self.GPIO.setup(self.BL_PIN, self.GPIO.OUT) + self.GPIO.output(self.BL_PIN, self.GPIO.HIGH) + #Initialize SPI + self.SPI = spi + if self.SPI!=None : + self.SPI.max_speed_hz = spi_freq + self.SPI.mode = 0b00 + + def digital_write(self, pin, value): + self.GPIO.output(pin, value) + + def digital_read(self, pin): + return self.GPIO.input(pin) + + def delay_ms(self, delaytime): + time.sleep(delaytime / 1000.0) + + def spi_writebyte(self, data): + if self.SPI!=None : + self.SPI.writebytes(data) + def bl_DutyCycle(self, duty): + self._pwm.ChangeDutyCycle(duty) + + def bl_Frequency(self,freq): + self._pwm.ChangeFrequency(freq) + + def module_init(self): + self.GPIO.setup(self.RST_PIN, self.GPIO.OUT) + self.GPIO.setup(self.DC_PIN, self.GPIO.OUT) + self.GPIO.setup(self.BL_PIN, self.GPIO.OUT) + self._pwm=self.GPIO.PWM(self.BL_PIN,self.BL_freq) + self._pwm.start(100) + if self.SPI!=None : + self.SPI.max_speed_hz = self.SPEED + self.SPI.mode = 0b00 + return 0 + + def module_exit(self): + logging.debug("spi end") + if self.SPI!=None : + self.SPI.close() + + logging.debug("gpio cleanup...") + self.GPIO.output(self.RST_PIN, 1) + self.GPIO.output(self.DC_PIN, 0) + self._pwm.stop() + time.sleep(0.001) + self.GPIO.output(self.BL_PIN, 1) + #self.GPIO.cleanup() + + +''' +if os.path.exists('/sys/bus/platform/drivers/gpiomem-bcm2835'): + implementation = RaspberryPi() + +for func in [x for x in dir(implementation) if not x.startswith('_')]: + setattr(sys.modules[__name__], func, getattr(implementation, func)) +''' + +### END OF FILE ### diff --git a/gui-2.0/lib/lcdconfig.pyc b/gui-2.0/lib/lcdconfig.pyc new file mode 100644 index 0000000..c06fa5e Binary files /dev/null and b/gui-2.0/lib/lcdconfig.pyc differ diff --git a/gui-2.0/main.py b/gui-2.0/main.py new file mode 100644 index 0000000..daaa5ad --- /dev/null +++ b/gui-2.0/main.py @@ -0,0 +1,47 @@ +from display import Display +from pages.main_menu import MainMenu +from button_handler import ButtonHandler +from pages.page import Page +from client import Client +from time import sleep + +def button_callback(channel, button_name): + if display.current_page: + if button_name == "UP": + display.current_page.scroll("up") + elif button_name == "DOWN": + display.current_page.scroll("down") + elif button_name == "LEFT": + display.current_page.navigate("left") + elif button_name == "RIGHT": + display.current_page.navigate("right") + elif button_name == "ACCEPT": + focused = display.current_page.focusable_elements[display.current_page.focus_index] + if hasattr(focused, "press"): + focused.press() + elif button_name == "REFUSE": + Page.go_back(display) + display.current_page.render() + +def main(): + global display + display = Display() + client = Client() + if client.is_connected(): + main_menu = MainMenu(display, client) + Page.open_page(main_menu) + main_menu.batt_bar.set_level(client.get_battery()) + main_menu.render() + + bh = ButtonHandler(callback=button_callback) + + try: + while True: + sleep(0.1) + except KeyboardInterrupt: + pass + finally: + display.cleanup() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/gui-2.0/pages/feedback_page.py b/gui-2.0/pages/feedback_page.py new file mode 100644 index 0000000..c48a108 --- /dev/null +++ b/gui-2.0/pages/feedback_page.py @@ -0,0 +1,19 @@ +from pages.page import Page +from widgets import Label, Background, Button +from PIL import ImageFont + +class FeedbackPage(Page): + def __init__(self, display, text): + self.text = text + super().__init__(display) + + def body(self): + self.bckgr = Background(color="green") + self.lbl = Label(10, 108, self.text, color="black") + self.lbl.font = ImageFont.truetype("Font/Font02.ttf", 16) + + self.back_btn = Button(10, 200, width=300, height=30, text="Back", action=lambda: Page.go_back(self.display)) + + self.add_element(self.bckgr) + self.add_element(self.lbl) + self.add_element(self.back_btn) diff --git a/gui-2.0/pages/green_page.py b/gui-2.0/pages/green_page.py new file mode 100644 index 0000000..dd76536 --- /dev/null +++ b/gui-2.0/pages/green_page.py @@ -0,0 +1,12 @@ +from pages.page import Page +from widgets import Label, Background +from PIL import ImageFont + +class GreenPage(Page): + def body(self): + self.bckgr = Background(color="green") + self.lbl = Label(100, 50, "Button press", color="black") + self.lbl.font = ImageFont.truetype("Font/Font02.ttf", 24) + + self.add_element(self.bckgr) + self.add_element(self.lbl) diff --git a/gui-2.0/pages/list_detail_page.py b/gui-2.0/pages/list_detail_page.py new file mode 100644 index 0000000..3c476b1 --- /dev/null +++ b/gui-2.0/pages/list_detail_page.py @@ -0,0 +1,26 @@ +import copy +from pages.page import Page +from widgets import Label +from PIL import ImageFont + +class ListDetailPage(Page): + def __init__(self, display, header, elements): + self.detail_header = header + self.detail_elements = elements + self.copied_elements = [copy.copy(el) for el in elements] + super().__init__(display) + + def body(self): + header_label = Label(None, None, self.detail_header, color="Black") + header_label.font = ImageFont.truetype("Font/Font02.ttf", 30) + self.add_element(header_label) + y = 50 + for el in self.copied_elements: + el.x = 10 + el.y = y + el.font = ImageFont.truetype("Font/Font02.ttf", 16) + self.add_element(el) + y += el.height + 10 + + def cleanup_copies(self): + self.copied_elements.clear() \ No newline at end of file diff --git a/gui-2.0/pages/main_menu.py b/gui-2.0/pages/main_menu.py new file mode 100644 index 0000000..1b16c00 --- /dev/null +++ b/gui-2.0/pages/main_menu.py @@ -0,0 +1,49 @@ +from widgets import Label, Button, ElementList, BatteryBar +from pages.page import Page +from pages.list_detail_page import ListDetailPage +from pages.green_page import GreenPage +from pages.feedback_page import FeedbackPage +from PIL import ImageFont + +class MainMenu(Page): + def __init__(self, display, client): + self.client = client + super().__init__(display) + + def body(self): + self.batt_bar = BatteryBar(0, 0) + + self.title = Label(None, None, "Yarilo", color="black") + self.title.font = ImageFont.truetype("Font/Font02.ttf", 24) + + self.ap_list = ElementList(None, None, spacing=5, header="Access Points", text_color="black", clickable=True, action=self.list_pressed, limit_to_five=True) + self.populate_access_points() + + self.save_recording_btn = Button(None, None, width=300, height=30, text="Save Recording", action=lambda: self.create_recording_with_feedback_page()) + + self.add_element(self.batt_bar) + self.add_element(self.title) + self.add_element(self.ap_list) + self.add_element(self.save_recording_btn) + + def populate_access_points(self): + ap_str = self.client.get_access_point_list() + ap_lines = ap_str.split('\n')[1:] + for line in ap_lines: + if line.strip(): + self.ap_list.add_element(Button(None, None, width=300, height=20, text = line, action=self.sample_action)) + + def sample_action(self): + new_page = GreenPage(self.display) + Page.open_page(new_page) + + def list_pressed(self, elementlist): + header_text = elementlist.header.text if elementlist.header else "Details" + detail_elements = elementlist.elements[1:] if elementlist.header else elementlist.elements + new_page = ListDetailPage(self.display, header_text, detail_elements) + Page.open_page(new_page) + + def create_recording_with_feedback_page(self): + response = self.client.create_recording() + new_page = FeedbackPage(self.display, response) + Page.open_page(new_page) \ No newline at end of file diff --git a/gui-2.0/pages/page.py b/gui-2.0/pages/page.py new file mode 100644 index 0000000..779905b --- /dev/null +++ b/gui-2.0/pages/page.py @@ -0,0 +1,83 @@ +class Page: + pages_stack = [] + + def __init__(self, display): + self.display = display + self.elements = [] + self.focusable_elements = [] + self.scroll_offset = 0 + self.focus_index = 0 + self.body() + for el in self.elements: + el.base_y = el.y + self.highlight_focused() + + def body(self): + raise NotImplementedError("Subclasses must implement the body() method.") + + def add_element(self, element): + DEFAULT_X = 10 + DEFAULT_SPACING = 20 + + if element.x is None: + element.x = DEFAULT_X + if element.y is None: + if self.elements: + last = self.elements[-1] + if hasattr(last, "layout"): + last.layout() + element.y = last.y + last.height + DEFAULT_SPACING + else: + element.y = DEFAULT_SPACING + + self.elements.append(element) + if hasattr(element, "set_focus"): + self.focusable_elements.append(element) + + def render(self): + self.display.elements = [] + for element in self.elements: + self.display.add_element(element) + self.display.render() + + def scroll(self, direction): + SCROLL_STEP = 50 + total_height = max([el.base_y + el.height for el in self.elements], default=0) + max_scroll = max(total_height+25 - self.display.height, 0) + if direction == "up": + self.scroll_offset = max(0, self.scroll_offset - SCROLL_STEP) + elif direction == "down": + self.scroll_offset = min(max_scroll, self.scroll_offset + SCROLL_STEP) + self.update_scroll() + + def navigate(self, direction): + if direction == "left": + self.focus_index -= 1 + if self.focus_index < 0: + self.focus_index = len(self.focusable_elements) - 1 + elif direction == "right": + self.focus_index = (self.focus_index + 1) % len(self.focusable_elements) + self.highlight_focused() + + def highlight_focused(self): + for idx, element in enumerate(self.focusable_elements): + if hasattr(element, "set_focus"): + element.set_focus(idx == self.focus_index) + + def update_scroll(self): + for element in self.elements: + element.y = element.base_y - self.scroll_offset + self.render() + + @classmethod + def open_page(cls, new_page): + cls.pages_stack.append(new_page) + new_page.display.current_page = new_page + new_page.render() + + @classmethod + def go_back(cls, display): + if len(cls.pages_stack) > 1: + cls.pages_stack.pop() + display.current_page = cls.pages_stack[-1] + display.current_page.render() \ No newline at end of file diff --git a/gui-2.0/pages/test_page.py b/gui-2.0/pages/test_page.py new file mode 100644 index 0000000..e1c8204 --- /dev/null +++ b/gui-2.0/pages/test_page.py @@ -0,0 +1,26 @@ +from widgets import Label, Button, ElementList +from pages.page import Page +from PIL import ImageFont + +class TestPage(Page): + def body(self): + self.title = Label(50, 10, "Test Page", color="green") + self.title.font = ImageFont.truetype("Font/Font02.ttf", 24) + + self.btn_ok = Button(50, 40, 100, 40, "OK", action=self.sample_action, bg_color="blue", text_color="white") + + self.lst = ElementList(50, 100, header="List of items", text_color="black", spacing=1) + self.lst.add_element(Label(50, 200, "Item 1", color="black")) + self.lst.add_element(Label(50, 210, "Item 2", color="black")) + + self.btn_lst = ElementList(50, 150, header="Buttons", text_color="black", spacing=5) + self.btn_lst.add_element(Button(50, 160, 100, 20, "Button 1", action=self.sample_action, bg_color="blue", text_color="white")) + self.btn_lst.add_element(Button(50, 200, 100, 20, "Button 2", action=self.sample_action, bg_color="blue", text_color="white")) + + self.add_element(self.title) + self.add_element(self.btn_ok) + self.add_element(self.lst) + self.add_element(self.btn_lst) + + def sample_action(self): + print("Button Pressed!") \ No newline at end of file diff --git a/gui-2.0/service_pb2.py b/gui-2.0/service_pb2.py new file mode 100644 index 0000000..6293b59 --- /dev/null +++ b/gui-2.0/service_pb2.py @@ -0,0 +1,167 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: service.proto +# Protobuf Python Version: 5.28.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 28, + 1, + '', + 'service.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x12\x05proto\x1a\x1fgoogle/protobuf/timestamp.proto\"5\n\tRadioInfo\x12\x0c\n\x04rssi\x18\x08 \x01(\x05\x12\r\n\x05noise\x18\t \x01(\x05\x12\x0b\n\x03snr\x18\n \x01(\x05\"\xc2\x01\n\x0c\x43lientWindow\x12)\n\x05start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x03\x65nd\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05\x65nded\x18\x03 \x01(\x08\x12\x11\n\tdecrypted\x18\x04 \x01(\x08\x12\x14\n\x0cpacket_count\x18\x05 \x01(\r\x12\x19\n\x11\x61uth_packet_count\x18\x06 \x01(\r\x12\x0b\n\x03ptk\x18\x07 \x01(\t\"\xae\x02\n\nClientInfo\x12\x0e\n\x06hwaddr\x18\x01 \x01(\t\x12\x10\n\x08hostname\x18\x02 \x01(\t\x12\x0c\n\x04ipv4\x18\x03 \x01(\t\x12\x0c\n\x04ipv6\x18\x04 \x01(\t\x12\x14\n\x0csent_unicast\x18\x05 \x01(\r\x12\x12\n\nsent_total\x18\x06 \x01(\r\x12\x10\n\x08received\x18\x07 \x01(\r\x12$\n\nradio_info\x18\x08 \x01(\x0b\x32\x10.proto.RadioInfo\x12\x12\n\npmf_active\x18\t \x01(\x08\x12\x0e\n\x06router\x18\n \x01(\x08\x12\x1f\n\x17\x63urrent_eapol_pkt_count\x18\x0b \x01(\r\x12$\n\x07windows\x18\x0c \x03(\x0b\x32\x13.proto.ClientWindow\x12\x15\n\rdevice_vendor\x18\r \x01(\t\"\xc1\x01\n\x0bGroupWindow\x12)\n\x05start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x03\x65nd\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05\x65nded\x18\x03 \x01(\x08\x12\x11\n\tdecrypted\x18\x04 \x01(\x08\x12\x14\n\x0cpacket_count\x18\x05 \x01(\r\x12\x19\n\x11\x61uth_packet_count\x18\x06 \x01(\r\x12\x0b\n\x03gtk\x18\x07 \x01(\t\"\xe4\x02\n\x10WiFiStandardInfo\x12 \n\x03std\x18\x01 \x01(\x0e\x32\x13.proto.WiFiStandard\x12!\n\x19single_beamformer_support\x18\x02 \x01(\x08\x12!\n\x19single_beamformee_support\x18\x03 \x01(\x08\x12 \n\x18multi_beamformer_support\x18\x04 \x01(\x08\x12 \n\x18multi_beamformee_support\x18\x05 \x01(\x08\x12\x19\n\x11mcs_supported_idx\x18\x06 \x03(\r\x12/\n\x14modulation_supported\x18\x07 \x03(\x0e\x32\x11.proto.Modulation\x12!\n\x19spatial_streams_supported\x18\x08 \x03(\r\x12\x35\n\x18\x63hannel_widths_supported\x18\t \x03(\x0e\x32\x13.proto.ChannelWidth\"-\n\x0eMulticastGroup\x12\x0c\n\x04\x61\x64\x64r\x18\x01 \x01(\t\x12\r\n\x05\x63ount\x18\x02 \x01(\r\"[\n\x0b\x43hannelInfo\x12\x19\n\x11\x63ontrol_frequency\x18\x01 \x01(\r\x12\x0f\n\x07\x63hannel\x18\x02 \x01(\r\x12 \n\x04type\x18\x03 \x01(\x0e\x32\x12.proto.ChannelType\"\xe5\x03\n\x0f\x41\x63\x63\x65ssPointInfo\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x1e\n\x16\x65ncrypted_packet_count\x18\x03 \x01(\r\x12\x1e\n\x16\x64\x65\x63rypted_packet_count\x18\x04 \x01(\r\x12$\n\nradio_info\x18\x05 \x01(\x0b\x32\x10.proto.RadioInfo\x12\x13\n\x0bpmf_capable\x18\x06 \x01(\x08\x12\x14\n\x0cpmf_required\x18\x07 \x01(\x08\x12-\n\x11supported_chanels\x18\x08 \x03(\x0b\x32\x12.proto.ChannelInfo\x12\x34\n\x13supported_standards\x18\t \x03(\x0b\x32\x17.proto.WiFiStandardInfo\x12/\n\x10multicast_groups\x18\n \x03(\x0b\x32\x15.proto.MulticastGroup\x12(\n\x08security\x18\x0b \x03(\x0e\x32\x16.proto.NetworkSecurity\x12\"\n\x07\x63lients\x18\x0c \x03(\x0b\x32\x11.proto.ClientInfo\x12)\n\rgroup_windows\x18\r \x03(\x0b\x32\x12.proto.GroupWindow\x12\x15\n\rdevice_vendor\x18\x0e \x01(\t\"\x16\n\x03Raw\x12\x0f\n\x07payload\x18\x01 \x01(\x0c\"s\n\x03\x41RP\x12\x19\n\x11sender_ip_address\x18\x01 \x01(\t\x12\x1a\n\x12sender_mac_address\x18\x02 \x01(\t\x12\x19\n\x11target_ip_address\x18\x03 \x01(\t\x12\x1a\n\x12target_mac_address\x18\x04 \x01(\t\"\x99\x01\n\x04ICMP\x12\x1e\n\x04type\x18\x01 \x01(\x0e\x32\x10.proto.ICMP.Type\x12\x0c\n\x04\x63ode\x18\x02 \x01(\r\"c\n\x04Type\x12\x0e\n\nECHO_REPLY\x10\x00\x12\x1b\n\x17\x44\x45STINATION_UNREACHABLE\x10\x03\x12\x10\n\x0c\x45\x43HO_REQUEST\x10\x08\x12\x11\n\rTIME_EXCEEDED\x10\x0b\x12\t\n\x05OTHER\x10\x0c\"\x95\x02\n\x06ICMPv6\x12 \n\x04type\x18\x01 \x01(\x0e\x32\x12.proto.ICMPv6.Type\x12\x0c\n\x04\x63ode\x18\x02 \x01(\r\x12\x10\n\x08\x63hecksum\x18\x03 \x01(\r\"\xc8\x01\n\x04Type\x12\x08\n\x04NONE\x10\x00\x12\x11\n\x0c\x45\x43HO_REQUEST\x10\x80\x01\x12\x0f\n\nECHO_REPLY\x10\x81\x01\x12\x1b\n\x17\x44\x45STINATION_UNREACHABLE\x10\x01\x12\x12\n\x0ePACKET_TOO_BIG\x10\x02\x12\x11\n\rTIME_EXCEEDED\x10\x03\x12\x15\n\x11PARAMETER_PROBLEM\x10\x04\x12\x1a\n\x15NEIGHBOR_SOLICITATION\x10\x87\x01\x12\x1b\n\x16NEIGHBOR_ADVERTISEMENT\x10\x88\x01\"\xd5\x01\n\x03\x44NS\x12\n\n\x02id\x18\x01 \x01(\r\x12\n\n\x02qr\x18\x02 \x01(\x08\x12&\n\tquestions\x18\x03 \x03(\x0b\x32\x13.proto.DNS.Question\x12*\n\x07\x61nswers\x18\x04 \x03(\x0b\x32\x19.proto.DNS.ResourceRecord\x1a&\n\x08Question\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\r\x1a:\n\x0eResourceRecord\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\r\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\x9f\x01\n\x04\x44HCP\x12\x14\n\x0cmessage_type\x18\x01 \x01(\r\x12\x16\n\x0etransaction_id\x18\x02 \x01(\r\x12\x19\n\x11\x63lient_ip_address\x18\x03 \x01(\t\x12\x17\n\x0fyour_ip_address\x18\x04 \x01(\t\x12\x19\n\x11server_ip_address\x18\x05 \x01(\t\x12\x1a\n\x12\x63lient_mac_address\x18\x06 \x01(\t\"\xa8\x01\n\x06\x44HCPv6\x12\x14\n\x0cmessage_type\x18\x01 \x01(\r\x12\x16\n\x0etransaction_id\x18\x02 \x01(\r\x12%\n\x07options\x18\x03 \x03(\x0b\x32\x14.proto.DHCPv6.Option\x1aI\n\x06Option\x12\x13\n\x0boption_code\x18\x01 \x01(\r\x12\x15\n\roption_length\x18\x02 \x01(\r\x12\x13\n\x0boption_data\x18\x03 \x01(\x0c\"\x82\x02\n\x02IP\x12\x16\n\x0esource_address\x18\x01 \x01(\t\x12\x1b\n\x13\x64\x65stination_address\x18\x02 \x01(\t\x12\x0b\n\x03ttl\x18\x03 \x01(\r\x12\x10\n\x08protocol\x18\x04 \x01(\r\x12\x14\n\x0ctotal_length\x18\x05 \x01(\r\x12\x0f\n\x07payload\x18\x06 \x01(\x0c\x12&\n\rnext_protocol\x18\x07 \x01(\x0e\x32\x0f.proto.Protocol\x12\x1b\n\x04icmp\x18\x08 \x01(\x0b\x32\x0b.proto.ICMPH\x00\x12\x19\n\x03tcp\x18\t \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\n \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04next\"\x93\x02\n\x04IPv6\x12\x16\n\x0esource_address\x18\x01 \x01(\t\x12\x1b\n\x13\x64\x65stination_address\x18\x02 \x01(\t\x12\x11\n\thop_limit\x18\x03 \x01(\r\x12\x13\n\x0bnext_header\x18\x04 \x01(\r\x12\x16\n\x0epayload_length\x18\x05 \x01(\r\x12\x0f\n\x07payload\x18\x06 \x01(\x0c\x12&\n\rnext_protocol\x18\x07 \x01(\x0e\x32\x0f.proto.Protocol\x12\x1f\n\x06icmpv6\x18\x08 \x01(\x0b\x32\r.proto.ICMPv6H\x00\x12\x19\n\x03tcp\x18\t \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\n \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04next\"\xa8\x01\n\x03TCP\x12\x13\n\x0bsource_port\x18\x01 \x01(\r\x12\x18\n\x10\x64\x65stination_port\x18\x02 \x01(\r\x12\x17\n\x0fsequence_number\x18\x03 \x01(\r\x12\x1d\n\x15\x61\x63knowledgment_number\x18\x04 \x01(\r\x12\x13\n\x0bwindow_size\x18\x05 \x01(\r\x12\x0b\n\x03syn\x18\x06 \x01(\x08\x12\x0b\n\x03\x61\x63k\x18\x07 \x01(\x08\x12\x0b\n\x03\x66in\x18\x08 \x01(\x08\"\xbd\x01\n\x03UDP\x12\x13\n\x0bsource_port\x18\x01 \x01(\r\x12\x18\n\x10\x64\x65stination_port\x18\x02 \x01(\r\x12&\n\rnext_protocol\x18\x04 \x01(\x0e\x32\x0f.proto.Protocol\x12\x19\n\x03\x64ns\x18\x05 \x01(\x0b\x32\n.proto.DNSH\x00\x12\x1b\n\x04\x64hcp\x18\x06 \x01(\x0b\x32\x0b.proto.DHCPH\x00\x12\x1f\n\x06\x64hcpv6\x18\x07 \x01(\x0b\x32\r.proto.DHCPv6H\x00\x42\x06\n\x04next\"\xb8\x03\n\x06Packet\x12\x30\n\x0c\x63\x61pture_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03src\x18\x02 \x01(\t\x12\x0b\n\x03\x64st\x18\x03 \x01(\t\x12!\n\x08protocol\x18\x04 \x01(\x0e\x32\x0f.proto.Protocol\x12\x19\n\x03raw\x18\x05 \x01(\x0b\x32\n.proto.RawH\x00\x12\x19\n\x03\x61rp\x18\x06 \x01(\x0b\x32\n.proto.ARPH\x00\x12\x1b\n\x04icmp\x18\x07 \x01(\x0b\x32\x0b.proto.ICMPH\x00\x12\x1f\n\x06icmpv6\x18\x08 \x01(\x0b\x32\r.proto.ICMPv6H\x00\x12\x19\n\x03\x64ns\x18\t \x01(\x0b\x32\n.proto.DNSH\x00\x12\x1b\n\x04\x64hcp\x18\n \x01(\x0b\x32\x0b.proto.DHCPH\x00\x12\x1f\n\x06\x64hcpv6\x18\x0b \x01(\x0b\x32\r.proto.DHCPv6H\x00\x12\x17\n\x02ip\x18\x0c \x01(\x0b\x32\t.proto.IPH\x00\x12\x1b\n\x04ipv6\x18\r \x01(\x0b\x32\x0b.proto.IPv6H\x00\x12\x19\n\x03tcp\x18\x0e \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\x0f \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04\x64\x61ta\"h\n\tRecording\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x10\n\x08\x66ilename\x18\x03 \x01(\t\x12%\n\x08\x64\x61talink\x18\x04 \x01(\x0e\x32\x13.proto.DataLinkType\"\x07\n\x05\x45mpty\"!\n\tSnifferID\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\"]\n\x14SnifferCreateRequest\x12\x15\n\ris_file_based\x18\x01 \x01(\x08\x12\x16\n\x0enet_iface_name\x18\x02 \x01(\t\x12\x16\n\x0erecording_uuid\x18\x03 \x01(\t\";\n\x13SnifferListResponse\x12$\n\x08sniffers\x18\x01 \x03(\x0b\x32\x12.proto.SnifferInfo\"\\\n\x0bSnifferInfo\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x15\n\ris_file_based\x18\x02 \x01(\x08\x12\x16\n\x0enet_iface_name\x18\x03 \x01(\t\x12\x10\n\x08\x66ilename\x18\x04 \x01(\t\"/\n\x10\x42\x61sicNetworkInfo\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"7\n\x0e\x41PListResponse\x12%\n\x04nets\x18\x01 \x03(\x0b\x32\x17.proto.BasicNetworkInfo\"3\n\x0c\x41PGetRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"3\n\rAPGetResponse\x12\"\n\x02\x61p\x18\x01 \x01(\x0b\x32\x16.proto.AccessPointInfo\"Q\n\x18\x41PProvidePasswordRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x10\n\x08password\x18\x03 \x01(\t\"\xc2\x01\n\x19\x41PProvidePasswordResponse\x12?\n\x05state\x18\x01 \x01(\x0e\x32\x30.proto.APProvidePasswordResponse.DecryptionState\"d\n\x0f\x44\x65\x63ryptionState\x12\r\n\tDECRYPTED\x10\x00\x12\x13\n\x0fNOT_ENOUGH_DATA\x10\x01\x12\x16\n\x12INCORRECT_PASSWORD\x10\x02\x12\x15\n\x11\x41LREADY_DECRYPTED\x10\x03\"[\n\x1b\x41PGetDecryptedStreamRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x17\n\x0finclude_payload\x18\x03 \x01(\x08\"6\n\x0f\x41PDeauthRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"Q\n\x15\x41PDeauthClientRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x13\n\x0b\x63lient_addr\x18\x03 \x01(\t\"L\n\x10\x41PGetHashRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x13\n\x0b\x63lient_addr\x18\x03 \x01(\t\"$\n\x11\x41PGetHashResponse\x12\x0f\n\x07hc22000\x18\x01 \x01(\t\"V\n\x0f\x41PIgnoreRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x10\n\x08use_ssid\x18\x02 \x01(\x08\x12\r\n\x05\x62ssid\x18\x03 \x01(\t\x12\x0c\n\x04ssid\x18\x04 \x01(\t\"Z\n\x18\x41PCreateRecordingRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\r\n\x05\x62ssid\x18\x03 \x01(\t\x12\x0b\n\x03raw\x18\x04 \x01(\x08\"?\n\x19\x41PCreateRecordingResponse\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0cpacket_count\x18\x02 \x01(\r\"8\n\x11\x46ocusStartRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"9\n\x12\x46ocusStartResponse\x12#\n\x07\x63hannel\x18\x01 \x01(\x0b\x32\x12.proto.ChannelInfo\"Z\n\x16\x46ocusGetActiveResponse\x12\r\n\x05\x62ssid\x18\x01 \x01(\t\x12\x0c\n\x04ssid\x18\x02 \x01(\t\x12#\n\x07\x63hannel\x18\x03 \x01(\x0b\x32\x12.proto.ChannelInfo\"I\n\x16RecordingCreateRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0b\n\x03raw\x18\x03 \x01(\x08\"=\n\x17RecordingCreateResponse\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0cpacket_count\x18\x02 \x01(\r\"B\n\x14RecordingListRequest\x12*\n\rallowed_types\x18\x01 \x03(\x0e\x32\x13.proto.DataLinkType\"=\n\x15RecordingListResponse\x12$\n\nrecordings\x18\x01 \x03(\x0b\x32\x10.proto.Recording\"F\n\x1dRecordingLoadDecryptedRequest\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x17\n\x0finclude_payload\x18\x02 \x01(\x08\".\n\x1cNetworkInterfaceListResponse\x12\x0e\n\x06ifaces\x18\x01 \x03(\t\"\xcf\x01\n\x08LogEntry\x12-\n\ttimestamp\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x05level\x18\x02 \x01(\x0e\x32\x18.proto.LogEntry.LogLevel\x12\r\n\x05scope\x18\x03 \x01(\t\x12\x0f\n\x07payload\x18\x04 \x01(\t\"K\n\x08LogLevel\x12\t\n\x05TRACE\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\x01\x12\x08\n\x04INFO\x10\x02\x12\x08\n\x04WARN\x10\x03\x12\x07\n\x03\x45RR\x10\x04\x12\x0c\n\x08\x43RITICAL\x10\x05\"-\n\x17\x42\x61tteryGetLevelResponse\x12\x12\n\npercentage\x18\x01 \x01(\x02*}\n\x0fNetworkSecurity\x12\x08\n\x04OPEN\x10\x00\x12\x07\n\x03WEP\x10\x01\x12\x07\n\x03WPA\x10\x02\x12\x11\n\rWPA2_Personal\x10\x03\x12\x13\n\x0fWPA2_Enterprise\x10\x04\x12\x11\n\rWPA3_Personal\x10\x05\x12\x13\n\x0fWPA3_Enterprise\x10\x06*X\n\x0cWiFiStandard\x12\n\n\x06\x44ot11A\x10\x00\x12\n\n\x06\x44ot11B\x10\x01\x12\n\n\x06\x44ot11G\x10\x02\x12\n\n\x06\x44ot11N\x10\x03\x12\x0b\n\x07\x44ot11AC\x10\x04\x12\x0b\n\x07\x44ot11AX\x10\x05*X\n\nModulation\x12\x07\n\x03\x43\x43K\x10\x00\x12\x08\n\x04\x42PSK\x10\x01\x12\x08\n\x04QPSK\x10\x02\x12\t\n\x05QAM16\x10\x03\x12\t\n\x05QAM64\x10\x04\x12\n\n\x06QAM256\x10\x05\x12\x0b\n\x07QAM1024\x10\x06*N\n\x0c\x43hannelWidth\x12\n\n\x06\x43HAN20\x10\x00\x12\n\n\x06\x43HAN40\x10\x01\x12\n\n\x06\x43HAN80\x10\x02\x12\r\n\tCHAN80_80\x10\x03\x12\x0b\n\x07\x43HAN160\x10\x04*d\n\x0b\x43hannelType\x12\t\n\x05NO_HT\x10\x00\x12\x08\n\x04HT20\x10\x01\x12\r\n\tHT40MINUS\x10\x02\x12\x0c\n\x08HT40PLUS\x10\x03\x12\t\n\x05VHT80\x10\x04\x12\x0c\n\x08VHT80P80\x10\x05\x12\n\n\x06VHT160\x10\x06*\xb7\x01\n\x08Protocol\x12\r\n\tPROTO_RAW\x10\x00\x12\r\n\tPROTO_ARP\x10\x01\x12\x0e\n\nPROTO_ICMP\x10\x02\x12\x10\n\x0cPROTO_ICMPv6\x10\x03\x12\r\n\tPROTO_DNS\x10\x04\x12\x0e\n\nPROTO_DHCP\x10\x05\x12\x10\n\x0cPROTO_DHCPv6\x10\x06\x12\x0c\n\x08PROTO_IP\x10\x07\x12\x0e\n\nPROTO_IPv6\x10\x08\x12\r\n\tPROTO_TCP\x10\t\x12\r\n\tPROTO_UDP\x10\n*A\n\x0c\x44\x61taLinkType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0c\n\x08RADIOTAP\x10\x01\x12\x0c\n\x08RAW80211\x10\x02\x12\x08\n\x04\x45TH2\x10\x03\x32\xed\x0b\n\x07Sniffer\x12>\n\rSnifferCreate\x12\x1b.proto.SnifferCreateRequest\x1a\x10.proto.SnifferID\x12\x30\n\x0eSnifferDestroy\x12\x10.proto.SnifferID\x1a\x0c.proto.Empty\x12\x37\n\x0bSnifferList\x12\x0c.proto.Empty\x1a\x1a.proto.SnifferListResponse\x12:\n\x0f\x41\x63\x63\x65ssPointList\x12\x10.proto.SnifferID\x1a\x15.proto.APListResponse\x12;\n\x0e\x41\x63\x63\x65ssPointGet\x12\x13.proto.APGetRequest\x1a\x14.proto.APGetResponse\x12_\n\x1a\x41\x63\x63\x65ssPointProvidePassword\x12\x1f.proto.APProvidePasswordRequest\x1a .proto.APProvidePasswordResponse\x12T\n\x1d\x41\x63\x63\x65ssPointGetDecryptedStream\x12\".proto.APGetDecryptedStreamRequest\x1a\r.proto.Packet0\x01\x12\x39\n\x11\x41\x63\x63\x65ssPointDeauth\x12\x16.proto.APDeauthRequest\x1a\x0c.proto.Empty\x12\x45\n\x17\x41\x63\x63\x65ssPointDeauthClient\x12\x1c.proto.APDeauthClientRequest\x1a\x0c.proto.Empty\x12G\n\x12\x41\x63\x63\x65ssPointGetHash\x12\x17.proto.APGetHashRequest\x1a\x18.proto.APGetHashResponse\x12\x39\n\x11\x41\x63\x63\x65ssPointIgnore\x12\x16.proto.APIgnoreRequest\x1a\x0c.proto.Empty\x12\x41\n\x16\x41\x63\x63\x65ssPointListIgnored\x12\x10.proto.SnifferID\x1a\x15.proto.APListResponse\x12_\n\x1a\x41\x63\x63\x65ssPointCreateRecording\x12\x1f.proto.APCreateRecordingRequest\x1a .proto.APCreateRecordingResponse\x12\x41\n\nFocusStart\x12\x18.proto.FocusStartRequest\x1a\x19.proto.FocusStartResponse\x12\x41\n\x0e\x46ocusGetActive\x12\x10.proto.SnifferID\x1a\x1d.proto.FocusGetActiveResponse\x12+\n\tFocusStop\x12\x10.proto.SnifferID\x1a\x0c.proto.Empty\x12P\n\x0fRecordingCreate\x12\x1d.proto.RecordingCreateRequest\x1a\x1e.proto.RecordingCreateResponse\x12J\n\rRecordingList\x12\x1b.proto.RecordingListRequest\x1a\x1c.proto.RecordingListResponse\x12O\n\x16RecordingLoadDecrypted\x12$.proto.RecordingLoadDecryptedRequest\x1a\r.proto.Packet0\x01\x12I\n\x14NetworkInterfaceList\x12\x0c.proto.Empty\x1a#.proto.NetworkInterfaceListResponse\x12/\n\x0cLogGetStream\x12\x0c.proto.Empty\x1a\x0f.proto.LogEntry0\x01\x12?\n\x0f\x42\x61tteryGetLevel\x12\x0c.proto.Empty\x1a\x1e.proto.BatteryGetLevelResponseb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'service_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals['_NETWORKSECURITY']._serialized_start=6608 + _globals['_NETWORKSECURITY']._serialized_end=6733 + _globals['_WIFISTANDARD']._serialized_start=6735 + _globals['_WIFISTANDARD']._serialized_end=6823 + _globals['_MODULATION']._serialized_start=6825 + _globals['_MODULATION']._serialized_end=6913 + _globals['_CHANNELWIDTH']._serialized_start=6915 + _globals['_CHANNELWIDTH']._serialized_end=6993 + _globals['_CHANNELTYPE']._serialized_start=6995 + _globals['_CHANNELTYPE']._serialized_end=7095 + _globals['_PROTOCOL']._serialized_start=7098 + _globals['_PROTOCOL']._serialized_end=7281 + _globals['_DATALINKTYPE']._serialized_start=7283 + _globals['_DATALINKTYPE']._serialized_end=7348 + _globals['_RADIOINFO']._serialized_start=57 + _globals['_RADIOINFO']._serialized_end=110 + _globals['_CLIENTWINDOW']._serialized_start=113 + _globals['_CLIENTWINDOW']._serialized_end=307 + _globals['_CLIENTINFO']._serialized_start=310 + _globals['_CLIENTINFO']._serialized_end=612 + _globals['_GROUPWINDOW']._serialized_start=615 + _globals['_GROUPWINDOW']._serialized_end=808 + _globals['_WIFISTANDARDINFO']._serialized_start=811 + _globals['_WIFISTANDARDINFO']._serialized_end=1167 + _globals['_MULTICASTGROUP']._serialized_start=1169 + _globals['_MULTICASTGROUP']._serialized_end=1214 + _globals['_CHANNELINFO']._serialized_start=1216 + _globals['_CHANNELINFO']._serialized_end=1307 + _globals['_ACCESSPOINTINFO']._serialized_start=1310 + _globals['_ACCESSPOINTINFO']._serialized_end=1795 + _globals['_RAW']._serialized_start=1797 + _globals['_RAW']._serialized_end=1819 + _globals['_ARP']._serialized_start=1821 + _globals['_ARP']._serialized_end=1936 + _globals['_ICMP']._serialized_start=1939 + _globals['_ICMP']._serialized_end=2092 + _globals['_ICMP_TYPE']._serialized_start=1993 + _globals['_ICMP_TYPE']._serialized_end=2092 + _globals['_ICMPV6']._serialized_start=2095 + _globals['_ICMPV6']._serialized_end=2372 + _globals['_ICMPV6_TYPE']._serialized_start=2172 + _globals['_ICMPV6_TYPE']._serialized_end=2372 + _globals['_DNS']._serialized_start=2375 + _globals['_DNS']._serialized_end=2588 + _globals['_DNS_QUESTION']._serialized_start=2490 + _globals['_DNS_QUESTION']._serialized_end=2528 + _globals['_DNS_RESOURCERECORD']._serialized_start=2530 + _globals['_DNS_RESOURCERECORD']._serialized_end=2588 + _globals['_DHCP']._serialized_start=2591 + _globals['_DHCP']._serialized_end=2750 + _globals['_DHCPV6']._serialized_start=2753 + _globals['_DHCPV6']._serialized_end=2921 + _globals['_DHCPV6_OPTION']._serialized_start=2848 + _globals['_DHCPV6_OPTION']._serialized_end=2921 + _globals['_IP']._serialized_start=2924 + _globals['_IP']._serialized_end=3182 + _globals['_IPV6']._serialized_start=3185 + _globals['_IPV6']._serialized_end=3460 + _globals['_TCP']._serialized_start=3463 + _globals['_TCP']._serialized_end=3631 + _globals['_UDP']._serialized_start=3634 + _globals['_UDP']._serialized_end=3823 + _globals['_PACKET']._serialized_start=3826 + _globals['_PACKET']._serialized_end=4266 + _globals['_RECORDING']._serialized_start=4268 + _globals['_RECORDING']._serialized_end=4372 + _globals['_EMPTY']._serialized_start=4374 + _globals['_EMPTY']._serialized_end=4381 + _globals['_SNIFFERID']._serialized_start=4383 + _globals['_SNIFFERID']._serialized_end=4416 + _globals['_SNIFFERCREATEREQUEST']._serialized_start=4418 + _globals['_SNIFFERCREATEREQUEST']._serialized_end=4511 + _globals['_SNIFFERLISTRESPONSE']._serialized_start=4513 + _globals['_SNIFFERLISTRESPONSE']._serialized_end=4572 + _globals['_SNIFFERINFO']._serialized_start=4574 + _globals['_SNIFFERINFO']._serialized_end=4666 + _globals['_BASICNETWORKINFO']._serialized_start=4668 + _globals['_BASICNETWORKINFO']._serialized_end=4715 + _globals['_APLISTRESPONSE']._serialized_start=4717 + _globals['_APLISTRESPONSE']._serialized_end=4772 + _globals['_APGETREQUEST']._serialized_start=4774 + _globals['_APGETREQUEST']._serialized_end=4825 + _globals['_APGETRESPONSE']._serialized_start=4827 + _globals['_APGETRESPONSE']._serialized_end=4878 + _globals['_APPROVIDEPASSWORDREQUEST']._serialized_start=4880 + _globals['_APPROVIDEPASSWORDREQUEST']._serialized_end=4961 + _globals['_APPROVIDEPASSWORDRESPONSE']._serialized_start=4964 + _globals['_APPROVIDEPASSWORDRESPONSE']._serialized_end=5158 + _globals['_APPROVIDEPASSWORDRESPONSE_DECRYPTIONSTATE']._serialized_start=5058 + _globals['_APPROVIDEPASSWORDRESPONSE_DECRYPTIONSTATE']._serialized_end=5158 + _globals['_APGETDECRYPTEDSTREAMREQUEST']._serialized_start=5160 + _globals['_APGETDECRYPTEDSTREAMREQUEST']._serialized_end=5251 + _globals['_APDEAUTHREQUEST']._serialized_start=5253 + _globals['_APDEAUTHREQUEST']._serialized_end=5307 + _globals['_APDEAUTHCLIENTREQUEST']._serialized_start=5309 + _globals['_APDEAUTHCLIENTREQUEST']._serialized_end=5390 + _globals['_APGETHASHREQUEST']._serialized_start=5392 + _globals['_APGETHASHREQUEST']._serialized_end=5468 + _globals['_APGETHASHRESPONSE']._serialized_start=5470 + _globals['_APGETHASHRESPONSE']._serialized_end=5506 + _globals['_APIGNOREREQUEST']._serialized_start=5508 + _globals['_APIGNOREREQUEST']._serialized_end=5594 + _globals['_APCREATERECORDINGREQUEST']._serialized_start=5596 + _globals['_APCREATERECORDINGREQUEST']._serialized_end=5686 + _globals['_APCREATERECORDINGRESPONSE']._serialized_start=5688 + _globals['_APCREATERECORDINGRESPONSE']._serialized_end=5751 + _globals['_FOCUSSTARTREQUEST']._serialized_start=5753 + _globals['_FOCUSSTARTREQUEST']._serialized_end=5809 + _globals['_FOCUSSTARTRESPONSE']._serialized_start=5811 + _globals['_FOCUSSTARTRESPONSE']._serialized_end=5868 + _globals['_FOCUSGETACTIVERESPONSE']._serialized_start=5870 + _globals['_FOCUSGETACTIVERESPONSE']._serialized_end=5960 + _globals['_RECORDINGCREATEREQUEST']._serialized_start=5962 + _globals['_RECORDINGCREATEREQUEST']._serialized_end=6035 + _globals['_RECORDINGCREATERESPONSE']._serialized_start=6037 + _globals['_RECORDINGCREATERESPONSE']._serialized_end=6098 + _globals['_RECORDINGLISTREQUEST']._serialized_start=6100 + _globals['_RECORDINGLISTREQUEST']._serialized_end=6166 + _globals['_RECORDINGLISTRESPONSE']._serialized_start=6168 + _globals['_RECORDINGLISTRESPONSE']._serialized_end=6229 + _globals['_RECORDINGLOADDECRYPTEDREQUEST']._serialized_start=6231 + _globals['_RECORDINGLOADDECRYPTEDREQUEST']._serialized_end=6301 + _globals['_NETWORKINTERFACELISTRESPONSE']._serialized_start=6303 + _globals['_NETWORKINTERFACELISTRESPONSE']._serialized_end=6349 + _globals['_LOGENTRY']._serialized_start=6352 + _globals['_LOGENTRY']._serialized_end=6559 + _globals['_LOGENTRY_LOGLEVEL']._serialized_start=6484 + _globals['_LOGENTRY_LOGLEVEL']._serialized_end=6559 + _globals['_BATTERYGETLEVELRESPONSE']._serialized_start=6561 + _globals['_BATTERYGETLEVELRESPONSE']._serialized_end=6606 + _globals['_SNIFFER']._serialized_start=7351 + _globals['_SNIFFER']._serialized_end=8868 +# @@protoc_insertion_point(module_scope) diff --git a/gui-2.0/service_pb2_grpc.py b/gui-2.0/service_pb2_grpc.py new file mode 100644 index 0000000..2fc7337 --- /dev/null +++ b/gui-2.0/service_pb2_grpc.py @@ -0,0 +1,1006 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + +import service_pb2 as service__pb2 + +GRPC_GENERATED_VERSION = '1.68.1' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + f' but the generated code in service_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + + +class SnifferStub(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SnifferCreate = channel.unary_unary( + '/proto.Sniffer/SnifferCreate', + request_serializer=service__pb2.SnifferCreateRequest.SerializeToString, + response_deserializer=service__pb2.SnifferID.FromString, + _registered_method=True) + self.SnifferDestroy = channel.unary_unary( + '/proto.Sniffer/SnifferDestroy', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.SnifferList = channel.unary_unary( + '/proto.Sniffer/SnifferList', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.SnifferListResponse.FromString, + _registered_method=True) + self.AccessPointList = channel.unary_unary( + '/proto.Sniffer/AccessPointList', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.APListResponse.FromString, + _registered_method=True) + self.AccessPointGet = channel.unary_unary( + '/proto.Sniffer/AccessPointGet', + request_serializer=service__pb2.APGetRequest.SerializeToString, + response_deserializer=service__pb2.APGetResponse.FromString, + _registered_method=True) + self.AccessPointProvidePassword = channel.unary_unary( + '/proto.Sniffer/AccessPointProvidePassword', + request_serializer=service__pb2.APProvidePasswordRequest.SerializeToString, + response_deserializer=service__pb2.APProvidePasswordResponse.FromString, + _registered_method=True) + self.AccessPointGetDecryptedStream = channel.unary_stream( + '/proto.Sniffer/AccessPointGetDecryptedStream', + request_serializer=service__pb2.APGetDecryptedStreamRequest.SerializeToString, + response_deserializer=service__pb2.Packet.FromString, + _registered_method=True) + self.AccessPointDeauth = channel.unary_unary( + '/proto.Sniffer/AccessPointDeauth', + request_serializer=service__pb2.APDeauthRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointDeauthClient = channel.unary_unary( + '/proto.Sniffer/AccessPointDeauthClient', + request_serializer=service__pb2.APDeauthClientRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointGetHash = channel.unary_unary( + '/proto.Sniffer/AccessPointGetHash', + request_serializer=service__pb2.APGetHashRequest.SerializeToString, + response_deserializer=service__pb2.APGetHashResponse.FromString, + _registered_method=True) + self.AccessPointIgnore = channel.unary_unary( + '/proto.Sniffer/AccessPointIgnore', + request_serializer=service__pb2.APIgnoreRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointListIgnored = channel.unary_unary( + '/proto.Sniffer/AccessPointListIgnored', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.APListResponse.FromString, + _registered_method=True) + self.AccessPointCreateRecording = channel.unary_unary( + '/proto.Sniffer/AccessPointCreateRecording', + request_serializer=service__pb2.APCreateRecordingRequest.SerializeToString, + response_deserializer=service__pb2.APCreateRecordingResponse.FromString, + _registered_method=True) + self.FocusStart = channel.unary_unary( + '/proto.Sniffer/FocusStart', + request_serializer=service__pb2.FocusStartRequest.SerializeToString, + response_deserializer=service__pb2.FocusStartResponse.FromString, + _registered_method=True) + self.FocusGetActive = channel.unary_unary( + '/proto.Sniffer/FocusGetActive', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.FocusGetActiveResponse.FromString, + _registered_method=True) + self.FocusStop = channel.unary_unary( + '/proto.Sniffer/FocusStop', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.RecordingCreate = channel.unary_unary( + '/proto.Sniffer/RecordingCreate', + request_serializer=service__pb2.RecordingCreateRequest.SerializeToString, + response_deserializer=service__pb2.RecordingCreateResponse.FromString, + _registered_method=True) + self.RecordingList = channel.unary_unary( + '/proto.Sniffer/RecordingList', + request_serializer=service__pb2.RecordingListRequest.SerializeToString, + response_deserializer=service__pb2.RecordingListResponse.FromString, + _registered_method=True) + self.RecordingLoadDecrypted = channel.unary_stream( + '/proto.Sniffer/RecordingLoadDecrypted', + request_serializer=service__pb2.RecordingLoadDecryptedRequest.SerializeToString, + response_deserializer=service__pb2.Packet.FromString, + _registered_method=True) + self.NetworkInterfaceList = channel.unary_unary( + '/proto.Sniffer/NetworkInterfaceList', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.NetworkInterfaceListResponse.FromString, + _registered_method=True) + self.LogGetStream = channel.unary_stream( + '/proto.Sniffer/LogGetStream', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.LogEntry.FromString, + _registered_method=True) + self.BatteryGetLevel = channel.unary_unary( + '/proto.Sniffer/BatteryGetLevel', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.BatteryGetLevelResponse.FromString, + _registered_method=True) + + +class SnifferServicer(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + def SnifferCreate(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SnifferDestroy(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SnifferList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGet(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointProvidePassword(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGetDecryptedStream(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointDeauth(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointDeauthClient(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGetHash(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointIgnore(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointListIgnored(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointCreateRecording(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusStart(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusGetActive(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusStop(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingCreate(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingLoadDecrypted(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def NetworkInterfaceList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def LogGetStream(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def BatteryGetLevel(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_SnifferServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SnifferCreate': grpc.unary_unary_rpc_method_handler( + servicer.SnifferCreate, + request_deserializer=service__pb2.SnifferCreateRequest.FromString, + response_serializer=service__pb2.SnifferID.SerializeToString, + ), + 'SnifferDestroy': grpc.unary_unary_rpc_method_handler( + servicer.SnifferDestroy, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'SnifferList': grpc.unary_unary_rpc_method_handler( + servicer.SnifferList, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.SnifferListResponse.SerializeToString, + ), + 'AccessPointList': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointList, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.APListResponse.SerializeToString, + ), + 'AccessPointGet': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointGet, + request_deserializer=service__pb2.APGetRequest.FromString, + response_serializer=service__pb2.APGetResponse.SerializeToString, + ), + 'AccessPointProvidePassword': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointProvidePassword, + request_deserializer=service__pb2.APProvidePasswordRequest.FromString, + response_serializer=service__pb2.APProvidePasswordResponse.SerializeToString, + ), + 'AccessPointGetDecryptedStream': grpc.unary_stream_rpc_method_handler( + servicer.AccessPointGetDecryptedStream, + request_deserializer=service__pb2.APGetDecryptedStreamRequest.FromString, + response_serializer=service__pb2.Packet.SerializeToString, + ), + 'AccessPointDeauth': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointDeauth, + request_deserializer=service__pb2.APDeauthRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointDeauthClient': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointDeauthClient, + request_deserializer=service__pb2.APDeauthClientRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointGetHash': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointGetHash, + request_deserializer=service__pb2.APGetHashRequest.FromString, + response_serializer=service__pb2.APGetHashResponse.SerializeToString, + ), + 'AccessPointIgnore': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointIgnore, + request_deserializer=service__pb2.APIgnoreRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointListIgnored': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointListIgnored, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.APListResponse.SerializeToString, + ), + 'AccessPointCreateRecording': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointCreateRecording, + request_deserializer=service__pb2.APCreateRecordingRequest.FromString, + response_serializer=service__pb2.APCreateRecordingResponse.SerializeToString, + ), + 'FocusStart': grpc.unary_unary_rpc_method_handler( + servicer.FocusStart, + request_deserializer=service__pb2.FocusStartRequest.FromString, + response_serializer=service__pb2.FocusStartResponse.SerializeToString, + ), + 'FocusGetActive': grpc.unary_unary_rpc_method_handler( + servicer.FocusGetActive, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.FocusGetActiveResponse.SerializeToString, + ), + 'FocusStop': grpc.unary_unary_rpc_method_handler( + servicer.FocusStop, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'RecordingCreate': grpc.unary_unary_rpc_method_handler( + servicer.RecordingCreate, + request_deserializer=service__pb2.RecordingCreateRequest.FromString, + response_serializer=service__pb2.RecordingCreateResponse.SerializeToString, + ), + 'RecordingList': grpc.unary_unary_rpc_method_handler( + servicer.RecordingList, + request_deserializer=service__pb2.RecordingListRequest.FromString, + response_serializer=service__pb2.RecordingListResponse.SerializeToString, + ), + 'RecordingLoadDecrypted': grpc.unary_stream_rpc_method_handler( + servicer.RecordingLoadDecrypted, + request_deserializer=service__pb2.RecordingLoadDecryptedRequest.FromString, + response_serializer=service__pb2.Packet.SerializeToString, + ), + 'NetworkInterfaceList': grpc.unary_unary_rpc_method_handler( + servicer.NetworkInterfaceList, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.NetworkInterfaceListResponse.SerializeToString, + ), + 'LogGetStream': grpc.unary_stream_rpc_method_handler( + servicer.LogGetStream, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.LogEntry.SerializeToString, + ), + 'BatteryGetLevel': grpc.unary_unary_rpc_method_handler( + servicer.BatteryGetLevel, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.BatteryGetLevelResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'proto.Sniffer', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('proto.Sniffer', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class Sniffer(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + @staticmethod + def SnifferCreate(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferCreate', + service__pb2.SnifferCreateRequest.SerializeToString, + service__pb2.SnifferID.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def SnifferDestroy(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferDestroy', + service__pb2.SnifferID.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def SnifferList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferList', + service__pb2.Empty.SerializeToString, + service__pb2.SnifferListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointList', + service__pb2.SnifferID.SerializeToString, + service__pb2.APListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGet(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointGet', + service__pb2.APGetRequest.SerializeToString, + service__pb2.APGetResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointProvidePassword(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointProvidePassword', + service__pb2.APProvidePasswordRequest.SerializeToString, + service__pb2.APProvidePasswordResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGetDecryptedStream(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/AccessPointGetDecryptedStream', + service__pb2.APGetDecryptedStreamRequest.SerializeToString, + service__pb2.Packet.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointDeauth(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointDeauth', + service__pb2.APDeauthRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointDeauthClient(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointDeauthClient', + service__pb2.APDeauthClientRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGetHash(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointGetHash', + service__pb2.APGetHashRequest.SerializeToString, + service__pb2.APGetHashResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointIgnore(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointIgnore', + service__pb2.APIgnoreRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointListIgnored(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointListIgnored', + service__pb2.SnifferID.SerializeToString, + service__pb2.APListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointCreateRecording(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointCreateRecording', + service__pb2.APCreateRecordingRequest.SerializeToString, + service__pb2.APCreateRecordingResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusStart(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusStart', + service__pb2.FocusStartRequest.SerializeToString, + service__pb2.FocusStartResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusGetActive(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusGetActive', + service__pb2.SnifferID.SerializeToString, + service__pb2.FocusGetActiveResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusStop(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusStop', + service__pb2.SnifferID.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingCreate(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/RecordingCreate', + service__pb2.RecordingCreateRequest.SerializeToString, + service__pb2.RecordingCreateResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/RecordingList', + service__pb2.RecordingListRequest.SerializeToString, + service__pb2.RecordingListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingLoadDecrypted(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/RecordingLoadDecrypted', + service__pb2.RecordingLoadDecryptedRequest.SerializeToString, + service__pb2.Packet.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def NetworkInterfaceList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/NetworkInterfaceList', + service__pb2.Empty.SerializeToString, + service__pb2.NetworkInterfaceListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def LogGetStream(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/LogGetStream', + service__pb2.Empty.SerializeToString, + service__pb2.LogEntry.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def BatteryGetLevel(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/BatteryGetLevel', + service__pb2.Empty.SerializeToString, + service__pb2.BatteryGetLevelResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) diff --git a/gui-2.0/widgets.py b/gui-2.0/widgets.py new file mode 100644 index 0000000..f44cdae --- /dev/null +++ b/gui-2.0/widgets.py @@ -0,0 +1,164 @@ +from PIL import ImageFont +from PIL import ImageDraw + +class GUIElement: + def __init__(self, x, y, width, height, font=None): + self.x = x + self.y = y + self.width = width + self.height = height + self.parent_page = None + self.font = font or ImageFont.load_default() + + + def draw(self, draw): + pass + +class Background(GUIElement): + def __init__(self, color="white"): + super().__init__(0, 0, 320, 240) + self.color = color + + def draw(self, draw): + draw.rectangle((0, 0, self.width, self.height), fill=self.color) + +class FlowContainer(GUIElement): + def __init__(self, x=0, y=0, spacing=10): + super().__init__(x, y, width=0, height=0) + self.spacing = spacing + self.children = [] + + def add_child(self, child): + self.children.append(child) + + def layout(self): + """Automatically assigns x/y to children vertically.""" + current_y = self.y + max_width = 0 + for child in self.children: + if child.x is None: + child.x = self.x + if child.y is None: + child.y = current_y + current_y += child.height + self.spacing + max_width = max(max_width, child.width) + self.width = max_width + self.height = current_y - self.y + + def draw(self, draw): + self.layout() + for child in self.children: + child.draw(draw) + +class Label(GUIElement): + def __init__(self, x, y, text, color="white"): + super().__init__(x, y, 0, 0) + self.text = text + self.color = color + bbox = self.font.getbbox(text) + self.width = bbox[2] - bbox[0] + self.height = bbox[3] - bbox[1] + + def draw(self, draw): + draw.text((self.x, self.y), self.text, font=self.font, fill=self.color) + +class Button(GUIElement): + def __init__(self, x, y, width, height, text, action=None, bg_color="gray", text_color="white"): + super().__init__(x, y, width, height) + self.text = text + self.action = action + self.bg_color = bg_color + self.text_color = text_color + self.focused = False + + def set_focus(self, is_focused): + self.focused = is_focused + + def draw(self, draw): + if self.focused: + border_color = "red" + draw.rectangle((self.x-2, self.y-2, self.x+self.width+2, self.y+self.height+2), fill=border_color) + draw.rectangle((self.x, self.y, self.x+self.width, self.y+self.height), fill=self.bg_color) + bbox = self.font.getbbox(self.text) + text_width = bbox[2] - bbox[0] + text_height = bbox[3] - bbox[1] + text_x = self.x + (self.width - text_width) // 2 + text_y = self.y + (self.height - text_height) // 2 + draw.text((text_x, text_y), self.text, font=self.font, fill=self.text_color) + + def press(self): + if self.action: + self.action() + +class ElementList(GUIElement): + def __init__(self, x, y, spacing=10, header=None, text_color="white", clickable=False, action=None, limit_to_five=False): + super().__init__(x, y, 0, 0) + self.spacing = spacing + self.elements = [] + self.text_color = text_color + self.width = 0 + self.focused = False + self.clickable = clickable + self.action = action + self.limit_to_five = limit_to_five # New parameter + + if header is not None: + if isinstance(header, str): + self.header = Label(x, y, header, color=self.text_color) + self.elements.append(self.header) + else: + raise ValueError("Header must be a string") + else: + self.header = None + + def add_element(self, element): + self.elements.append(element) + + def layout(self): + current_y = self.y + self.width = 0 + elements_to_show = self.elements[:5] if self.limit_to_five else self.elements + + for element in elements_to_show: + element.x = self.x + element.y = current_y + current_y += element.height + self.spacing + self.width = max(self.width, element.width) + self.height = current_y - self.y + + def draw(self, draw): + self.layout() + # Draw only the elements that were laid out. + elements_to_show = self.elements[:5] if self.limit_to_five else self.elements + for element in elements_to_show: + element.draw(draw) + if self.focused: + draw.rectangle((self.x-2, self.y-2, self.x+self.width+2, self.y+self.height+2), outline="red") + + def set_focus(self, is_focused): + self.focused = is_focused + + def press(self): + if self.clickable and self.action: + self.action(self) + +class BatteryBar(GUIElement): + def __init__(self, x, y, width=320, height=20, level=0, bg_color="gray", fg_color="green"): + super().__init__(x, y, width, height) + self.level = level + self.bg_color = bg_color + self.fg_color = fg_color + self.font = ImageFont.truetype("Font/Font02.ttf", 18) + + def set_level(self, level): + self.level = level + + def draw(self, draw): + if isinstance(self.level,int): + draw.rectangle((self.x, self.y, self.x + self.width, self.y + self.height), fill=self.bg_color) + fill_width = (self.width * self.level) // 100 + draw.rectangle((self.x, self.y, self.x + fill_width, self.y + self.height), fill=self.fg_color) + draw.text((self.x+5, self.y), f"{self.level}%", font=self.font, fill="black") + else: + draw.rectangle((self.x, self.y, self.x + 320, self.y + self.height), fill="red") + draw.text((self.x+5, self.y), f"{self.level}", font=self.font, fill="black") \ No newline at end of file diff --git a/gui/.gitignore b/gui/.gitignore new file mode 100644 index 0000000..eff7e2d --- /dev/null +++ b/gui/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +.lgd-nfy0 \ No newline at end of file diff --git a/gui/button_handler.py b/gui/button_handler.py new file mode 100644 index 0000000..07d75d9 --- /dev/null +++ b/gui/button_handler.py @@ -0,0 +1,29 @@ +import RPi.GPIO as GPIO + +BUTTON_PINS = { + 17: "ACCEPT", + 22: "REFUSE", + 26: "DOWN", + 13: "LEFT", + 6: "RIGHT", + 5: "UP" +} + +class ButtonHandler: + def __init__(self, callback): + """ + :param callback: A function that accepts (channel, button_name) + """ + self.callback = callback + GPIO.setmode(GPIO.BCM) + for pin in BUTTON_PINS: + GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) + try: + GPIO.remove_event_detect(pin) + except RuntimeError: + pass + GPIO.add_event_detect(pin, GPIO.RISING, callback=self.handle_button, bouncetime=100) + + def handle_button(self, channel): + button_name = BUTTON_PINS.get(channel, "UNKNOWN") + self.callback(channel, button_name) \ No newline at end of file diff --git a/gui/client.py b/gui/client.py new file mode 100644 index 0000000..cf160ec --- /dev/null +++ b/gui/client.py @@ -0,0 +1,148 @@ +import grpc +import os +import sys +sys.path.append(os.path.dirname(__file__)) +import service_pb2, service_pb2_grpc + +class Client: + def __init__(self, host='localhost', port=9090): + self.channel = grpc.insecure_channel(f'{host}:{port}') + self.stub = service_pb2_grpc.SnifferStub(self.channel) + self._sniffer_uuid = None + + def _get_primary_sniffer_uuid(self): + if self._sniffer_uuid is None: + response = self.stub.SnifferList(service_pb2.Empty()) + if response.sniffers: + self._sniffer_uuid = response.sniffers[0].uuid + else: + raise ValueError("No sniffers found.") + return self._sniffer_uuid + + def is_connected(self): + try: + self.stub.SnifferList(service_pb2.Empty()) + return True + except grpc.RpcError as e: + if e.code() == grpc.StatusCode.UNAVAILABLE: + print("gRPC Error: Unable to connect to the server.") + else: + print(f"gRPC Error: {e.details()} (Code: {e.code()})") + return False + + def get_sniffer_list(self): + response = self.stub.SnifferList(service_pb2.Empty()) + if not response.sniffers: + return "No sniffers found." + sniffers = [ + f"uuid: {sniffer.uuid} interface name: {sniffer.net_iface_name}\nfilename: {sniffer.filename}\n" + for sniffer in response.sniffers + ] + return "Sniffers:\n" + "\n".join(sniffers) + + def get_access_point_list(self): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.APGetRequest(sniffer_uuid=uuid) + response = self.stub.AccessPointList(request) + if not response.nets: + return "No access points found." + access_points = [f"{ap.ssid} - {ap.bssid}\n" for ap in response.nets] + return "Access Points:\n" + "".join(access_points) + except ValueError as e: + return str(e) + + def create_recording(self): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.RecordingCreateRequest( + sniffer_uuid=uuid, + name='Manual_recording', + raw=True + ) + response = self.stub.RecordingCreate(request) + return str(response) + except ValueError as e: + return str(e) + + def create_APrecording(self, network): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.APCreateRecordingRequest( + sniffer_uuid=uuid, + name='AccessPoint_recording', + bssid=network, + raw=True + ) + response = self.stub.AccessPointCreateRecording(request) + return str(response) + except ValueError as e: + return "Create AP recording error" + + def get_battery(self): + try: + response = self.stub.BatteryGetLevel(service_pb2.Empty()) + formated_resp = f"{response.percentage:.0f}" + formated_resp = int(formated_resp) + return formated_resp + except grpc.RpcError as e: + return "Get battery error" + + def start_focus(self, network): + try: + uuid = self._get_primary_sniffer_uuid() + self.stop_focus() + request = service_pb2.FocusStartRequest( + sniffer_uuid=uuid, + bssid=network + ) + response = self.stub.FocusStart(request) + return str(response) + except grpc.RpcError as e: + return "Start focus error" + + def stop_focus(self): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.SnifferID(sniffer_uuid=uuid) + response = self.stub.FocusStop(request) + except grpc.RpcError as e: + return "Stop focus error" + + def get_active_focus(self): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.SnifferID(sniffer_uuid=uuid) + response = self.stub.FocusGetActive(request) + return str(response) + except grpc.RpcError as e: + return "Get active focus error" + + def ignore_AP(self, network_bssid, network_ssid, use_ssid=False): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.APIgnoreRequest( + sniffer_uuid=uuid, + use_ssid=use_ssid, + bssid=network_bssid, + ssid=network_ssid + ) + self.stub.AccessPointIgnore(request) + if use_ssid: + return f"Ignored whole network:\n{network_ssid}" + else: + return f"Ignored AP {network_ssid}\nBSSID {network_bssid}" + except grpc.RpcError as e: + return "Ignore AP error" + + def list_ignored(self): + try: + uuid = self._get_primary_sniffer_uuid() + request = service_pb2.SnifferID(sniffer_uuid=uuid) + response = self.stub.AccessPointListIgnored(request) + if not response.nets: + return "No ignored APs found." + ignored_APs = [f"{ap.ssid} - {ap.bssid}\n" for ap in response.nets] + return "".join(ignored_APs) + except grpc.RpcError as e: + return "List ignored error" \ No newline at end of file diff --git a/gui/display.py b/gui/display.py new file mode 100644 index 0000000..ab30bdd --- /dev/null +++ b/gui/display.py @@ -0,0 +1,55 @@ +from lib import LCD_2inch4 +import spidev +from PIL import Image, ImageDraw, ImageFont + +# Constants +RST = 27 +DC = 25 +BL = 18 +BUS = 0 +DEVICE = 0 +FONT_SIZE = 25 + +class Display: + def __init__(self): + self.disp = LCD_2inch4.LCD_2inch4( + spi=spidev.SpiDev(BUS, DEVICE), spi_freq=40000000, rst=RST, dc=DC, bl=BL) + self.disp.Init() + self.disp.clear() + + self.elements = [] + + self.width = 320 + self.height = 240 + self.image = Image.new("RGB", (self.width, self.height), "white") + self.draw = ImageDraw.Draw(self.image, "RGBA") + + self.font = ImageFont.load_default() + + + def update(self): + #image_to_disp = self.image.rotate(180) + image_to_disp = self.image.transpose(Image.ROTATE_180) + self.disp.ShowImage(image_to_disp) + + def clear(self): + self.draw.rectangle((0, 0, self.width, self.height), fill="white") + + def draw_text(self, text, position, color="white"): + self.draw.text(position, text, fill=color, font=self.font) + + def draw_rectangle(self, bbox, color="white", outline=None): + self.draw.rectangle(bbox, fill=color, outline=outline) + + def add_element(self, element): + self.elements.append(element) + + def render(self): + self.clear() + for element in self.elements: + element.draw(self.draw) + self.update() + + def cleanup(self): + self.disp.reset() + self.disp.clear() \ No newline at end of file diff --git a/gui/main.py b/gui/main.py new file mode 100644 index 0000000..1f04c5c --- /dev/null +++ b/gui/main.py @@ -0,0 +1,64 @@ +from display import Display +from button_handler import ButtonHandler +from pages.main_menu import MainMenu +from pages.page import Page +from pages.feedback_page import FeedbackPage +from client import Client +from time import sleep + +def button_callback(channel, button_name): + if display.current_page: + if button_name == "UP": + display.current_page.scroll("up") + elif button_name == "DOWN": + display.current_page.scroll("down") + elif button_name == "LEFT": + display.current_page.navigate("left") + elif button_name == "RIGHT": + display.current_page.navigate("right") + elif button_name == "ACCEPT": + focused = display.current_page.focusable_elements[display.current_page.focus_index] + if hasattr(focused, "press"): + focused.press() + elif button_name == "REFUSE": + Page.go_back(display) + display.current_page.render() + +def main(): + global display + ap_status = False + + display = Display() + client = Client() + + for i in range(3): + try: + if client.is_connected(): + main_menu = MainMenu(display, client, ap_status) + Page.open_page(main_menu) + main_menu.batt_bar.set_level(client.get_battery()) + main_menu.render() + + bh = ButtonHandler(callback=button_callback) + + try: + while True: + sleep(0.1) + except KeyboardInterrupt: + pass + finally: + display.cleanup() + exit() + else: + error_page = FeedbackPage(display, "No connection to server. Retrying.", with_button=False, bg_color="red") + Page.open_page(error_page) + error_page.render() + sleep(5) + except ValueError as e: + error_page = FeedbackPage(display, "No connection to server. Retrying.", with_button=False, bg_color="red") + Page.open_page(error_page) + error_page.render() + sleep(5) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/gui/pages/feedback_page.py b/gui/pages/feedback_page.py new file mode 100644 index 0000000..f4e5cb1 --- /dev/null +++ b/gui/pages/feedback_page.py @@ -0,0 +1,22 @@ +from pages.page import Page +from widgets import Label, Background, Button +from PIL import ImageFont + +class FeedbackPage(Page): + def __init__(self, display, text, with_button=True, bg_color="green"): + self.text = text + self.with_button = with_button + self.bg_color = bg_color + super().__init__(display) + + def body(self): + self.bckgr = Background(color=self.bg_color) + self.lbl = Label(10, 20, self.text, color="black") + self.lbl.font = ImageFont.truetype("Font/Font02.ttf", 16) + + self.back_btn = Button(10, 200, width=300, height=30, text="Back", action=lambda: Page.go_back(self.display)) + + self.add_element(self.bckgr) + self.add_element(self.lbl) + if self.with_button: + self.add_element(self.back_btn) diff --git a/gui/pages/focus_ignore_page.py b/gui/pages/focus_ignore_page.py new file mode 100644 index 0000000..5f3fa6c --- /dev/null +++ b/gui/pages/focus_ignore_page.py @@ -0,0 +1,68 @@ +from pages.page import Page +from pages.feedback_page import FeedbackPage +from widgets import Label, Button +from PIL import ImageFont + +class FocusIgnorePage(Page): + def __init__(self, display, client, with_button=True, name="No name detected", bssid="No BSSID detected"): + self.client = client + self.with_button = with_button + self.name = name + self.bssid = bssid + super().__init__(display) + + def body(self): + self.lbl = Label(10, 10, f"Currently selected AP:", color="black") + self.lbl.font = ImageFont.truetype("Font/Font02.ttf", 24) + + self.name_lbl = Label(10, 40, f"Name: {self.name}", color="black") + self.name_lbl.font = ImageFont.truetype("Font/Font02.ttf", 20) + + self.bssid_lbl = Label(10, 70, f"BSSID: {self.bssid}", color="black") + self.bssid_lbl.font = ImageFont.truetype("Font/Font02.ttf", 20) + + self.focus_btn = Button(10, 100, width=145, height=30, text="Focus", action=lambda: self.focus_with_feedback_page()) + self.ignore_btn = Button(165, 100, width=145, height=30, text="Ignore AP", action=lambda: self.ignore_AP_with_feedback_page()) + + self.create_APrecording_btn = Button(10, 150, width=300, height=30, text="Create AP recording", action=lambda: self.create_APrecording_with_feedback_page()) + + self.back_btn = Button(10, 200, width=300, height=30, text="Back", action=lambda: Page.go_back(self.display)) + + self.add_element(self.lbl) + self.add_element(self.name_lbl) + self.add_element(self.bssid_lbl) + self.add_element(self.focus_btn) + self.add_element(self.ignore_btn) + self.add_element(self.create_APrecording_btn) + if self.with_button: + self.add_element(self.back_btn) + + def sample_action(self): + pass + + def focus_with_feedback_page(self): + response = self.client.start_focus(network=self.bssid) + if response == "Start focus error": + new_page = FeedbackPage(self.display, "Error starting focus", with_button=True, bg_color="red") + Page.open_page(new_page) + else: + new_page = FeedbackPage(self.display, f"Focus started\nLog:\n{response}", with_button=True, bg_color="green") + Page.open_page(new_page) + + def ignore_AP_with_feedback_page(self): + response = self.client.ignore_AP(network_bssid=self.bssid, network_ssid=self.name, use_ssid=False) + if response == "Ignore AP error": + new_page = FeedbackPage(self.display, "Error ignoring AP", with_button=True, bg_color="red") + Page.open_page(new_page) + else: + new_page = FeedbackPage(self.display, f"{response}", with_button=True, bg_color="green") + Page.open_page(new_page) + + def create_APrecording_with_feedback_page(self): + response = self.client.create_APrecording(network=self.bssid) + if response == "Create AP recording error": + new_page = FeedbackPage(self.display, "Error creating AP recording", with_button=True, bg_color="red") + Page.open_page(new_page) + else: + new_page = FeedbackPage(self.display, f"Created AP recording.\nLog:\n{response}", with_button=True, bg_color="green") + Page.open_page(new_page) \ No newline at end of file diff --git a/gui/pages/green_page.py b/gui/pages/green_page.py new file mode 100644 index 0000000..dd76536 --- /dev/null +++ b/gui/pages/green_page.py @@ -0,0 +1,12 @@ +from pages.page import Page +from widgets import Label, Background +from PIL import ImageFont + +class GreenPage(Page): + def body(self): + self.bckgr = Background(color="green") + self.lbl = Label(100, 50, "Button press", color="black") + self.lbl.font = ImageFont.truetype("Font/Font02.ttf", 24) + + self.add_element(self.bckgr) + self.add_element(self.lbl) diff --git a/gui/pages/list_detail_page.py b/gui/pages/list_detail_page.py new file mode 100644 index 0000000..0084f10 --- /dev/null +++ b/gui/pages/list_detail_page.py @@ -0,0 +1,41 @@ +import copy +from pages.page import Page +from pages.focus_ignore_page import FocusIgnorePage +from widgets import Label +from PIL import ImageFont + +class ListDetailPage(Page): + def __init__(self, display, client, header, elements, is_ap_list=False): + self.client = client + self.detail_header = header + self.detail_elements = elements + self.copied_elements = [copy.copy(el) for el in elements] + self.is_ap_list = is_ap_list + if self.is_ap_list: + self.aps = {} + super().__init__(display) + + def body(self): + header_label = Label(None, None, self.detail_header, color="Black") + header_label.font = ImageFont.truetype("Font/Font02.ttf", 30) + self.add_element(header_label) + y = 50 + for el in self.copied_elements: + el.x = 10 + el.y = y + el.font = ImageFont.truetype("Font/Font02.ttf", 16) + + if self.is_ap_list: + self.prepare_aps(el) + + self.add_element(el) + y += el.height + 10 + + def cleanup_copies(self): + self.copied_elements.clear() + + def prepare_aps(self, el): + el_name = el.text.split(" - ")[0] + el_bssid = el.text.split(" - ")[1] + self.aps[el_bssid] = el_name + el.action = lambda: Page.open_page(FocusIgnorePage(self.display, self.client, name=el_name, bssid=el_bssid)) \ No newline at end of file diff --git a/gui/pages/main_menu.py b/gui/pages/main_menu.py new file mode 100644 index 0000000..6cc4f61 --- /dev/null +++ b/gui/pages/main_menu.py @@ -0,0 +1,112 @@ +from widgets import Label, Button, ElementList, BatteryBar +from pages.page import Page +from pages.list_detail_page import ListDetailPage +from pages.green_page import GreenPage +from pages.feedback_page import FeedbackPage +from PIL import ImageFont +import os + +class MainMenu(Page): + def __init__(self, display, client, ap_status): + self.client = client + self.ap_status = ap_status + super().__init__(display) + + def body(self): + self.batt_bar = BatteryBar(0, 0) + self.batt_bar.set_level(self.client.get_battery()) + + self.title = Label(10, 20, "Yarilo", color="black") + self.title.font = ImageFont.truetype("Font/Font02.ttf", 24) + + self.ap_status_lbl = Label(220, 25, "YariloAP is ON" if self.ap_status else "YariloAP is OFF", color="black") + self.ap_status_lbl.font = ImageFont.truetype("Font/Font02.ttf", 18) + + self.ap_list = ElementList(None, None, spacing=5, header="Access Points", text_color="black", clickable=True, + action=self.aps_list_pressed, limit_to_five=True) + self.populate_access_points() + + self.save_recording_btn = Button(None, None, width=300, height=30, text="Save Recording", + action=lambda: self.create_recording_with_feedback_page()) + + if self.ap_status: + self.switch_ap_btn = Button(None, None, width=300, height=30, text="Switch YariloAP OFF", action=lambda: self.switch_ap()) + else: + self.switch_ap_btn = Button(None, None, width=300, height=30, text="Switch YariloAP ON", action=lambda: self.switch_ap()) + + self.get_active_focus_btn = Button(None, None, width=300, height=30, text="Get active focus", + action=lambda: self.get_acticve_focus_with_feedback_page()) + + self.stop_focus_btn = Button(None, None, width=300, height=30, text="Stop focus", + action=lambda: self.stop_focus_with_feedback()) + + self.get_ignored_btn = Button(None, None, width=300, height=30, text="Get ignored APs", + action=lambda: self.get_ignored_with_feedback_page()) + + + self.add_element(self.batt_bar) + self.add_element(self.title) + self.add_element(self.ap_status_lbl) + self.add_element(self.ap_list) + self.add_element(self.save_recording_btn) + self.add_element(self.switch_ap_btn) + self.add_element(self.get_active_focus_btn) + self.add_element(self.stop_focus_btn) + self.add_element(self.get_ignored_btn) + + def populate_access_points(self): + ap_str = self.client.get_access_point_list() + ap_lines = ap_str.split('\n')[1:] + for line in ap_lines: + if line.strip(): + self.ap_list.add_element(Button(None, None, width=300, height=20, text = line, action=self.sample_action)) + + def sample_action(self): + new_page = GreenPage(self.display) + Page.open_page(new_page) + + def list_pressed(self, elementlist): + header_text = elementlist.header.text if elementlist.header else "Details" + detail_elements = elementlist.elements[1:] if elementlist.header else elementlist.elements + new_page = ListDetailPage(self.display, header_text, detail_elements) + Page.open_page(new_page) + + def aps_list_pressed(self, elementlist): + header_text = elementlist.header.text if elementlist.header else "Details" + detail_elements = elementlist.elements[1:] if elementlist.header else elementlist.elements + new_page = ListDetailPage(self.display, self.client, header_text, detail_elements, is_ap_list=True) + Page.open_page(new_page) + + def create_recording_with_feedback_page(self): + response = self.client.create_recording() + new_page = FeedbackPage(self.display, response) + Page.open_page(new_page) + + def switch_ap(self): + if self.ap_status == False: + os.system('systemctl start yarilo-ap') + elif self.ap_status == True: + os.system('systemctl stop yarilo-ap') + + def get_acticve_focus_with_feedback_page(self): + response = self.client.get_active_focus() + if response == "Get active focus error": + new_page = FeedbackPage(self.display, "Error getting active focus", with_button=True, bg_color="red") + Page.open_page(new_page) + else: + new_page = FeedbackPage(self.display, f"Active focus log:\n{response}") + Page.open_page(new_page) + + def get_ignored_with_feedback_page(self): + response = self.client.list_ignored() + new_page = FeedbackPage(self.display, f"Ignored APs:\n{response}") + Page.open_page(new_page) + + def stop_focus_with_feedback(self): + response = self.client.stop_focus() + if response == "Stop focus error": + new_page = FeedbackPage(self.display, "Error stopping focus", with_button=True, bg_color="red") + Page.open_page(new_page) + else: + new_page = FeedbackPage(self.display, f"Focus stopped", with_button=True, bg_color="green") + Page.open_page(new_page) \ No newline at end of file diff --git a/gui/pages/page.py b/gui/pages/page.py new file mode 100644 index 0000000..5598a3e --- /dev/null +++ b/gui/pages/page.py @@ -0,0 +1,94 @@ +class Page: + pages_stack = [] + + def __init__(self, display): + self.display = display + self.elements = [] + self.focusable_elements = [] + self.scroll_offset = 0 + self.focus_index = 0 + self.body() + for el in self.elements: + el.base_y = el.y + self.highlight_focused() + + def body(self): + raise NotImplementedError("Subclasses must implement the body() method.") + + def add_element(self, element): + DEFAULT_X = 10 + DEFAULT_SPACING = 20 + + if element.x is None: + element.x = DEFAULT_X + if element.y is None: + if self.elements: + last = self.elements[-1] + if hasattr(last, "layout"): + last.layout() + element.y = last.y + last.height + DEFAULT_SPACING + else: + element.y = DEFAULT_SPACING + + self.elements.append(element) + if hasattr(element, "set_focus"): + self.focusable_elements.append(element) + + def render(self): + self.display.elements = [] + for element in self.elements: + self.display.add_element(element) + self.display.render() + + def scroll(self, direction): + SCROLL_STEP = 50 + total_height = max([el.base_y + el.height for el in self.elements], default=0) + max_scroll = max(total_height+25 - self.display.height, 0) + if direction == "up": + self.scroll_offset = max(0, self.scroll_offset - SCROLL_STEP) + elif direction == "down": + self.scroll_offset = min(max_scroll, self.scroll_offset + SCROLL_STEP) + self.update_scroll() + + def navigate(self, direction): + if direction == "left": + self.focus_index -= 1 + if self.focus_index < 0: + self.focus_index = len(self.focusable_elements) - 1 + elif direction == "right": + self.focus_index = (self.focus_index + 1) % len(self.focusable_elements) + self.highlight_focused() + + def highlight_focused(self): + for idx, element in enumerate(self.focusable_elements): + if hasattr(element, "set_focus"): + element.set_focus(idx == self.focus_index) + + def update_scroll(self): + for element in self.elements: + element.y = element.base_y - self.scroll_offset + self.render() + + def update_page(self): + + self.elements = [] + self.focusable_elements = [] + self.scroll_offset = 0 + self.focus_index = 0 + self.body() + for el in self.elements: + el.base_y = el.y + + @classmethod + def open_page(cls, new_page): + cls.pages_stack.append(new_page) + new_page.display.current_page = new_page + new_page.render() + + @classmethod + def go_back(cls, display): + if len(cls.pages_stack) > 1: + cls.pages_stack.pop() + display.current_page = cls.pages_stack[-1] + display.current_page.update_page() + display.current_page.render() \ No newline at end of file diff --git a/gui/pages/test_page.py b/gui/pages/test_page.py new file mode 100644 index 0000000..e1c8204 --- /dev/null +++ b/gui/pages/test_page.py @@ -0,0 +1,26 @@ +from widgets import Label, Button, ElementList +from pages.page import Page +from PIL import ImageFont + +class TestPage(Page): + def body(self): + self.title = Label(50, 10, "Test Page", color="green") + self.title.font = ImageFont.truetype("Font/Font02.ttf", 24) + + self.btn_ok = Button(50, 40, 100, 40, "OK", action=self.sample_action, bg_color="blue", text_color="white") + + self.lst = ElementList(50, 100, header="List of items", text_color="black", spacing=1) + self.lst.add_element(Label(50, 200, "Item 1", color="black")) + self.lst.add_element(Label(50, 210, "Item 2", color="black")) + + self.btn_lst = ElementList(50, 150, header="Buttons", text_color="black", spacing=5) + self.btn_lst.add_element(Button(50, 160, 100, 20, "Button 1", action=self.sample_action, bg_color="blue", text_color="white")) + self.btn_lst.add_element(Button(50, 200, 100, 20, "Button 2", action=self.sample_action, bg_color="blue", text_color="white")) + + self.add_element(self.title) + self.add_element(self.btn_ok) + self.add_element(self.lst) + self.add_element(self.btn_lst) + + def sample_action(self): + print("Button Pressed!") \ No newline at end of file diff --git a/gui/service_pb2.py b/gui/service_pb2.py new file mode 100644 index 0000000..6293b59 --- /dev/null +++ b/gui/service_pb2.py @@ -0,0 +1,167 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: service.proto +# Protobuf Python Version: 5.28.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 28, + 1, + '', + 'service.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x12\x05proto\x1a\x1fgoogle/protobuf/timestamp.proto\"5\n\tRadioInfo\x12\x0c\n\x04rssi\x18\x08 \x01(\x05\x12\r\n\x05noise\x18\t \x01(\x05\x12\x0b\n\x03snr\x18\n \x01(\x05\"\xc2\x01\n\x0c\x43lientWindow\x12)\n\x05start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x03\x65nd\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05\x65nded\x18\x03 \x01(\x08\x12\x11\n\tdecrypted\x18\x04 \x01(\x08\x12\x14\n\x0cpacket_count\x18\x05 \x01(\r\x12\x19\n\x11\x61uth_packet_count\x18\x06 \x01(\r\x12\x0b\n\x03ptk\x18\x07 \x01(\t\"\xae\x02\n\nClientInfo\x12\x0e\n\x06hwaddr\x18\x01 \x01(\t\x12\x10\n\x08hostname\x18\x02 \x01(\t\x12\x0c\n\x04ipv4\x18\x03 \x01(\t\x12\x0c\n\x04ipv6\x18\x04 \x01(\t\x12\x14\n\x0csent_unicast\x18\x05 \x01(\r\x12\x12\n\nsent_total\x18\x06 \x01(\r\x12\x10\n\x08received\x18\x07 \x01(\r\x12$\n\nradio_info\x18\x08 \x01(\x0b\x32\x10.proto.RadioInfo\x12\x12\n\npmf_active\x18\t \x01(\x08\x12\x0e\n\x06router\x18\n \x01(\x08\x12\x1f\n\x17\x63urrent_eapol_pkt_count\x18\x0b \x01(\r\x12$\n\x07windows\x18\x0c \x03(\x0b\x32\x13.proto.ClientWindow\x12\x15\n\rdevice_vendor\x18\r \x01(\t\"\xc1\x01\n\x0bGroupWindow\x12)\n\x05start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x03\x65nd\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05\x65nded\x18\x03 \x01(\x08\x12\x11\n\tdecrypted\x18\x04 \x01(\x08\x12\x14\n\x0cpacket_count\x18\x05 \x01(\r\x12\x19\n\x11\x61uth_packet_count\x18\x06 \x01(\r\x12\x0b\n\x03gtk\x18\x07 \x01(\t\"\xe4\x02\n\x10WiFiStandardInfo\x12 \n\x03std\x18\x01 \x01(\x0e\x32\x13.proto.WiFiStandard\x12!\n\x19single_beamformer_support\x18\x02 \x01(\x08\x12!\n\x19single_beamformee_support\x18\x03 \x01(\x08\x12 \n\x18multi_beamformer_support\x18\x04 \x01(\x08\x12 \n\x18multi_beamformee_support\x18\x05 \x01(\x08\x12\x19\n\x11mcs_supported_idx\x18\x06 \x03(\r\x12/\n\x14modulation_supported\x18\x07 \x03(\x0e\x32\x11.proto.Modulation\x12!\n\x19spatial_streams_supported\x18\x08 \x03(\r\x12\x35\n\x18\x63hannel_widths_supported\x18\t \x03(\x0e\x32\x13.proto.ChannelWidth\"-\n\x0eMulticastGroup\x12\x0c\n\x04\x61\x64\x64r\x18\x01 \x01(\t\x12\r\n\x05\x63ount\x18\x02 \x01(\r\"[\n\x0b\x43hannelInfo\x12\x19\n\x11\x63ontrol_frequency\x18\x01 \x01(\r\x12\x0f\n\x07\x63hannel\x18\x02 \x01(\r\x12 \n\x04type\x18\x03 \x01(\x0e\x32\x12.proto.ChannelType\"\xe5\x03\n\x0f\x41\x63\x63\x65ssPointInfo\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x1e\n\x16\x65ncrypted_packet_count\x18\x03 \x01(\r\x12\x1e\n\x16\x64\x65\x63rypted_packet_count\x18\x04 \x01(\r\x12$\n\nradio_info\x18\x05 \x01(\x0b\x32\x10.proto.RadioInfo\x12\x13\n\x0bpmf_capable\x18\x06 \x01(\x08\x12\x14\n\x0cpmf_required\x18\x07 \x01(\x08\x12-\n\x11supported_chanels\x18\x08 \x03(\x0b\x32\x12.proto.ChannelInfo\x12\x34\n\x13supported_standards\x18\t \x03(\x0b\x32\x17.proto.WiFiStandardInfo\x12/\n\x10multicast_groups\x18\n \x03(\x0b\x32\x15.proto.MulticastGroup\x12(\n\x08security\x18\x0b \x03(\x0e\x32\x16.proto.NetworkSecurity\x12\"\n\x07\x63lients\x18\x0c \x03(\x0b\x32\x11.proto.ClientInfo\x12)\n\rgroup_windows\x18\r \x03(\x0b\x32\x12.proto.GroupWindow\x12\x15\n\rdevice_vendor\x18\x0e \x01(\t\"\x16\n\x03Raw\x12\x0f\n\x07payload\x18\x01 \x01(\x0c\"s\n\x03\x41RP\x12\x19\n\x11sender_ip_address\x18\x01 \x01(\t\x12\x1a\n\x12sender_mac_address\x18\x02 \x01(\t\x12\x19\n\x11target_ip_address\x18\x03 \x01(\t\x12\x1a\n\x12target_mac_address\x18\x04 \x01(\t\"\x99\x01\n\x04ICMP\x12\x1e\n\x04type\x18\x01 \x01(\x0e\x32\x10.proto.ICMP.Type\x12\x0c\n\x04\x63ode\x18\x02 \x01(\r\"c\n\x04Type\x12\x0e\n\nECHO_REPLY\x10\x00\x12\x1b\n\x17\x44\x45STINATION_UNREACHABLE\x10\x03\x12\x10\n\x0c\x45\x43HO_REQUEST\x10\x08\x12\x11\n\rTIME_EXCEEDED\x10\x0b\x12\t\n\x05OTHER\x10\x0c\"\x95\x02\n\x06ICMPv6\x12 \n\x04type\x18\x01 \x01(\x0e\x32\x12.proto.ICMPv6.Type\x12\x0c\n\x04\x63ode\x18\x02 \x01(\r\x12\x10\n\x08\x63hecksum\x18\x03 \x01(\r\"\xc8\x01\n\x04Type\x12\x08\n\x04NONE\x10\x00\x12\x11\n\x0c\x45\x43HO_REQUEST\x10\x80\x01\x12\x0f\n\nECHO_REPLY\x10\x81\x01\x12\x1b\n\x17\x44\x45STINATION_UNREACHABLE\x10\x01\x12\x12\n\x0ePACKET_TOO_BIG\x10\x02\x12\x11\n\rTIME_EXCEEDED\x10\x03\x12\x15\n\x11PARAMETER_PROBLEM\x10\x04\x12\x1a\n\x15NEIGHBOR_SOLICITATION\x10\x87\x01\x12\x1b\n\x16NEIGHBOR_ADVERTISEMENT\x10\x88\x01\"\xd5\x01\n\x03\x44NS\x12\n\n\x02id\x18\x01 \x01(\r\x12\n\n\x02qr\x18\x02 \x01(\x08\x12&\n\tquestions\x18\x03 \x03(\x0b\x32\x13.proto.DNS.Question\x12*\n\x07\x61nswers\x18\x04 \x03(\x0b\x32\x19.proto.DNS.ResourceRecord\x1a&\n\x08Question\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\r\x1a:\n\x0eResourceRecord\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\r\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\x9f\x01\n\x04\x44HCP\x12\x14\n\x0cmessage_type\x18\x01 \x01(\r\x12\x16\n\x0etransaction_id\x18\x02 \x01(\r\x12\x19\n\x11\x63lient_ip_address\x18\x03 \x01(\t\x12\x17\n\x0fyour_ip_address\x18\x04 \x01(\t\x12\x19\n\x11server_ip_address\x18\x05 \x01(\t\x12\x1a\n\x12\x63lient_mac_address\x18\x06 \x01(\t\"\xa8\x01\n\x06\x44HCPv6\x12\x14\n\x0cmessage_type\x18\x01 \x01(\r\x12\x16\n\x0etransaction_id\x18\x02 \x01(\r\x12%\n\x07options\x18\x03 \x03(\x0b\x32\x14.proto.DHCPv6.Option\x1aI\n\x06Option\x12\x13\n\x0boption_code\x18\x01 \x01(\r\x12\x15\n\roption_length\x18\x02 \x01(\r\x12\x13\n\x0boption_data\x18\x03 \x01(\x0c\"\x82\x02\n\x02IP\x12\x16\n\x0esource_address\x18\x01 \x01(\t\x12\x1b\n\x13\x64\x65stination_address\x18\x02 \x01(\t\x12\x0b\n\x03ttl\x18\x03 \x01(\r\x12\x10\n\x08protocol\x18\x04 \x01(\r\x12\x14\n\x0ctotal_length\x18\x05 \x01(\r\x12\x0f\n\x07payload\x18\x06 \x01(\x0c\x12&\n\rnext_protocol\x18\x07 \x01(\x0e\x32\x0f.proto.Protocol\x12\x1b\n\x04icmp\x18\x08 \x01(\x0b\x32\x0b.proto.ICMPH\x00\x12\x19\n\x03tcp\x18\t \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\n \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04next\"\x93\x02\n\x04IPv6\x12\x16\n\x0esource_address\x18\x01 \x01(\t\x12\x1b\n\x13\x64\x65stination_address\x18\x02 \x01(\t\x12\x11\n\thop_limit\x18\x03 \x01(\r\x12\x13\n\x0bnext_header\x18\x04 \x01(\r\x12\x16\n\x0epayload_length\x18\x05 \x01(\r\x12\x0f\n\x07payload\x18\x06 \x01(\x0c\x12&\n\rnext_protocol\x18\x07 \x01(\x0e\x32\x0f.proto.Protocol\x12\x1f\n\x06icmpv6\x18\x08 \x01(\x0b\x32\r.proto.ICMPv6H\x00\x12\x19\n\x03tcp\x18\t \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\n \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04next\"\xa8\x01\n\x03TCP\x12\x13\n\x0bsource_port\x18\x01 \x01(\r\x12\x18\n\x10\x64\x65stination_port\x18\x02 \x01(\r\x12\x17\n\x0fsequence_number\x18\x03 \x01(\r\x12\x1d\n\x15\x61\x63knowledgment_number\x18\x04 \x01(\r\x12\x13\n\x0bwindow_size\x18\x05 \x01(\r\x12\x0b\n\x03syn\x18\x06 \x01(\x08\x12\x0b\n\x03\x61\x63k\x18\x07 \x01(\x08\x12\x0b\n\x03\x66in\x18\x08 \x01(\x08\"\xbd\x01\n\x03UDP\x12\x13\n\x0bsource_port\x18\x01 \x01(\r\x12\x18\n\x10\x64\x65stination_port\x18\x02 \x01(\r\x12&\n\rnext_protocol\x18\x04 \x01(\x0e\x32\x0f.proto.Protocol\x12\x19\n\x03\x64ns\x18\x05 \x01(\x0b\x32\n.proto.DNSH\x00\x12\x1b\n\x04\x64hcp\x18\x06 \x01(\x0b\x32\x0b.proto.DHCPH\x00\x12\x1f\n\x06\x64hcpv6\x18\x07 \x01(\x0b\x32\r.proto.DHCPv6H\x00\x42\x06\n\x04next\"\xb8\x03\n\x06Packet\x12\x30\n\x0c\x63\x61pture_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03src\x18\x02 \x01(\t\x12\x0b\n\x03\x64st\x18\x03 \x01(\t\x12!\n\x08protocol\x18\x04 \x01(\x0e\x32\x0f.proto.Protocol\x12\x19\n\x03raw\x18\x05 \x01(\x0b\x32\n.proto.RawH\x00\x12\x19\n\x03\x61rp\x18\x06 \x01(\x0b\x32\n.proto.ARPH\x00\x12\x1b\n\x04icmp\x18\x07 \x01(\x0b\x32\x0b.proto.ICMPH\x00\x12\x1f\n\x06icmpv6\x18\x08 \x01(\x0b\x32\r.proto.ICMPv6H\x00\x12\x19\n\x03\x64ns\x18\t \x01(\x0b\x32\n.proto.DNSH\x00\x12\x1b\n\x04\x64hcp\x18\n \x01(\x0b\x32\x0b.proto.DHCPH\x00\x12\x1f\n\x06\x64hcpv6\x18\x0b \x01(\x0b\x32\r.proto.DHCPv6H\x00\x12\x17\n\x02ip\x18\x0c \x01(\x0b\x32\t.proto.IPH\x00\x12\x1b\n\x04ipv6\x18\r \x01(\x0b\x32\x0b.proto.IPv6H\x00\x12\x19\n\x03tcp\x18\x0e \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\x0f \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04\x64\x61ta\"h\n\tRecording\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x10\n\x08\x66ilename\x18\x03 \x01(\t\x12%\n\x08\x64\x61talink\x18\x04 \x01(\x0e\x32\x13.proto.DataLinkType\"\x07\n\x05\x45mpty\"!\n\tSnifferID\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\"]\n\x14SnifferCreateRequest\x12\x15\n\ris_file_based\x18\x01 \x01(\x08\x12\x16\n\x0enet_iface_name\x18\x02 \x01(\t\x12\x16\n\x0erecording_uuid\x18\x03 \x01(\t\";\n\x13SnifferListResponse\x12$\n\x08sniffers\x18\x01 \x03(\x0b\x32\x12.proto.SnifferInfo\"\\\n\x0bSnifferInfo\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x15\n\ris_file_based\x18\x02 \x01(\x08\x12\x16\n\x0enet_iface_name\x18\x03 \x01(\t\x12\x10\n\x08\x66ilename\x18\x04 \x01(\t\"/\n\x10\x42\x61sicNetworkInfo\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"7\n\x0e\x41PListResponse\x12%\n\x04nets\x18\x01 \x03(\x0b\x32\x17.proto.BasicNetworkInfo\"3\n\x0c\x41PGetRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"3\n\rAPGetResponse\x12\"\n\x02\x61p\x18\x01 \x01(\x0b\x32\x16.proto.AccessPointInfo\"Q\n\x18\x41PProvidePasswordRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x10\n\x08password\x18\x03 \x01(\t\"\xc2\x01\n\x19\x41PProvidePasswordResponse\x12?\n\x05state\x18\x01 \x01(\x0e\x32\x30.proto.APProvidePasswordResponse.DecryptionState\"d\n\x0f\x44\x65\x63ryptionState\x12\r\n\tDECRYPTED\x10\x00\x12\x13\n\x0fNOT_ENOUGH_DATA\x10\x01\x12\x16\n\x12INCORRECT_PASSWORD\x10\x02\x12\x15\n\x11\x41LREADY_DECRYPTED\x10\x03\"[\n\x1b\x41PGetDecryptedStreamRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x17\n\x0finclude_payload\x18\x03 \x01(\x08\"6\n\x0f\x41PDeauthRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"Q\n\x15\x41PDeauthClientRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x13\n\x0b\x63lient_addr\x18\x03 \x01(\t\"L\n\x10\x41PGetHashRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x13\n\x0b\x63lient_addr\x18\x03 \x01(\t\"$\n\x11\x41PGetHashResponse\x12\x0f\n\x07hc22000\x18\x01 \x01(\t\"V\n\x0f\x41PIgnoreRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x10\n\x08use_ssid\x18\x02 \x01(\x08\x12\r\n\x05\x62ssid\x18\x03 \x01(\t\x12\x0c\n\x04ssid\x18\x04 \x01(\t\"Z\n\x18\x41PCreateRecordingRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\r\n\x05\x62ssid\x18\x03 \x01(\t\x12\x0b\n\x03raw\x18\x04 \x01(\x08\"?\n\x19\x41PCreateRecordingResponse\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0cpacket_count\x18\x02 \x01(\r\"8\n\x11\x46ocusStartRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"9\n\x12\x46ocusStartResponse\x12#\n\x07\x63hannel\x18\x01 \x01(\x0b\x32\x12.proto.ChannelInfo\"Z\n\x16\x46ocusGetActiveResponse\x12\r\n\x05\x62ssid\x18\x01 \x01(\t\x12\x0c\n\x04ssid\x18\x02 \x01(\t\x12#\n\x07\x63hannel\x18\x03 \x01(\x0b\x32\x12.proto.ChannelInfo\"I\n\x16RecordingCreateRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0b\n\x03raw\x18\x03 \x01(\x08\"=\n\x17RecordingCreateResponse\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0cpacket_count\x18\x02 \x01(\r\"B\n\x14RecordingListRequest\x12*\n\rallowed_types\x18\x01 \x03(\x0e\x32\x13.proto.DataLinkType\"=\n\x15RecordingListResponse\x12$\n\nrecordings\x18\x01 \x03(\x0b\x32\x10.proto.Recording\"F\n\x1dRecordingLoadDecryptedRequest\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x17\n\x0finclude_payload\x18\x02 \x01(\x08\".\n\x1cNetworkInterfaceListResponse\x12\x0e\n\x06ifaces\x18\x01 \x03(\t\"\xcf\x01\n\x08LogEntry\x12-\n\ttimestamp\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x05level\x18\x02 \x01(\x0e\x32\x18.proto.LogEntry.LogLevel\x12\r\n\x05scope\x18\x03 \x01(\t\x12\x0f\n\x07payload\x18\x04 \x01(\t\"K\n\x08LogLevel\x12\t\n\x05TRACE\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\x01\x12\x08\n\x04INFO\x10\x02\x12\x08\n\x04WARN\x10\x03\x12\x07\n\x03\x45RR\x10\x04\x12\x0c\n\x08\x43RITICAL\x10\x05\"-\n\x17\x42\x61tteryGetLevelResponse\x12\x12\n\npercentage\x18\x01 \x01(\x02*}\n\x0fNetworkSecurity\x12\x08\n\x04OPEN\x10\x00\x12\x07\n\x03WEP\x10\x01\x12\x07\n\x03WPA\x10\x02\x12\x11\n\rWPA2_Personal\x10\x03\x12\x13\n\x0fWPA2_Enterprise\x10\x04\x12\x11\n\rWPA3_Personal\x10\x05\x12\x13\n\x0fWPA3_Enterprise\x10\x06*X\n\x0cWiFiStandard\x12\n\n\x06\x44ot11A\x10\x00\x12\n\n\x06\x44ot11B\x10\x01\x12\n\n\x06\x44ot11G\x10\x02\x12\n\n\x06\x44ot11N\x10\x03\x12\x0b\n\x07\x44ot11AC\x10\x04\x12\x0b\n\x07\x44ot11AX\x10\x05*X\n\nModulation\x12\x07\n\x03\x43\x43K\x10\x00\x12\x08\n\x04\x42PSK\x10\x01\x12\x08\n\x04QPSK\x10\x02\x12\t\n\x05QAM16\x10\x03\x12\t\n\x05QAM64\x10\x04\x12\n\n\x06QAM256\x10\x05\x12\x0b\n\x07QAM1024\x10\x06*N\n\x0c\x43hannelWidth\x12\n\n\x06\x43HAN20\x10\x00\x12\n\n\x06\x43HAN40\x10\x01\x12\n\n\x06\x43HAN80\x10\x02\x12\r\n\tCHAN80_80\x10\x03\x12\x0b\n\x07\x43HAN160\x10\x04*d\n\x0b\x43hannelType\x12\t\n\x05NO_HT\x10\x00\x12\x08\n\x04HT20\x10\x01\x12\r\n\tHT40MINUS\x10\x02\x12\x0c\n\x08HT40PLUS\x10\x03\x12\t\n\x05VHT80\x10\x04\x12\x0c\n\x08VHT80P80\x10\x05\x12\n\n\x06VHT160\x10\x06*\xb7\x01\n\x08Protocol\x12\r\n\tPROTO_RAW\x10\x00\x12\r\n\tPROTO_ARP\x10\x01\x12\x0e\n\nPROTO_ICMP\x10\x02\x12\x10\n\x0cPROTO_ICMPv6\x10\x03\x12\r\n\tPROTO_DNS\x10\x04\x12\x0e\n\nPROTO_DHCP\x10\x05\x12\x10\n\x0cPROTO_DHCPv6\x10\x06\x12\x0c\n\x08PROTO_IP\x10\x07\x12\x0e\n\nPROTO_IPv6\x10\x08\x12\r\n\tPROTO_TCP\x10\t\x12\r\n\tPROTO_UDP\x10\n*A\n\x0c\x44\x61taLinkType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0c\n\x08RADIOTAP\x10\x01\x12\x0c\n\x08RAW80211\x10\x02\x12\x08\n\x04\x45TH2\x10\x03\x32\xed\x0b\n\x07Sniffer\x12>\n\rSnifferCreate\x12\x1b.proto.SnifferCreateRequest\x1a\x10.proto.SnifferID\x12\x30\n\x0eSnifferDestroy\x12\x10.proto.SnifferID\x1a\x0c.proto.Empty\x12\x37\n\x0bSnifferList\x12\x0c.proto.Empty\x1a\x1a.proto.SnifferListResponse\x12:\n\x0f\x41\x63\x63\x65ssPointList\x12\x10.proto.SnifferID\x1a\x15.proto.APListResponse\x12;\n\x0e\x41\x63\x63\x65ssPointGet\x12\x13.proto.APGetRequest\x1a\x14.proto.APGetResponse\x12_\n\x1a\x41\x63\x63\x65ssPointProvidePassword\x12\x1f.proto.APProvidePasswordRequest\x1a .proto.APProvidePasswordResponse\x12T\n\x1d\x41\x63\x63\x65ssPointGetDecryptedStream\x12\".proto.APGetDecryptedStreamRequest\x1a\r.proto.Packet0\x01\x12\x39\n\x11\x41\x63\x63\x65ssPointDeauth\x12\x16.proto.APDeauthRequest\x1a\x0c.proto.Empty\x12\x45\n\x17\x41\x63\x63\x65ssPointDeauthClient\x12\x1c.proto.APDeauthClientRequest\x1a\x0c.proto.Empty\x12G\n\x12\x41\x63\x63\x65ssPointGetHash\x12\x17.proto.APGetHashRequest\x1a\x18.proto.APGetHashResponse\x12\x39\n\x11\x41\x63\x63\x65ssPointIgnore\x12\x16.proto.APIgnoreRequest\x1a\x0c.proto.Empty\x12\x41\n\x16\x41\x63\x63\x65ssPointListIgnored\x12\x10.proto.SnifferID\x1a\x15.proto.APListResponse\x12_\n\x1a\x41\x63\x63\x65ssPointCreateRecording\x12\x1f.proto.APCreateRecordingRequest\x1a .proto.APCreateRecordingResponse\x12\x41\n\nFocusStart\x12\x18.proto.FocusStartRequest\x1a\x19.proto.FocusStartResponse\x12\x41\n\x0e\x46ocusGetActive\x12\x10.proto.SnifferID\x1a\x1d.proto.FocusGetActiveResponse\x12+\n\tFocusStop\x12\x10.proto.SnifferID\x1a\x0c.proto.Empty\x12P\n\x0fRecordingCreate\x12\x1d.proto.RecordingCreateRequest\x1a\x1e.proto.RecordingCreateResponse\x12J\n\rRecordingList\x12\x1b.proto.RecordingListRequest\x1a\x1c.proto.RecordingListResponse\x12O\n\x16RecordingLoadDecrypted\x12$.proto.RecordingLoadDecryptedRequest\x1a\r.proto.Packet0\x01\x12I\n\x14NetworkInterfaceList\x12\x0c.proto.Empty\x1a#.proto.NetworkInterfaceListResponse\x12/\n\x0cLogGetStream\x12\x0c.proto.Empty\x1a\x0f.proto.LogEntry0\x01\x12?\n\x0f\x42\x61tteryGetLevel\x12\x0c.proto.Empty\x1a\x1e.proto.BatteryGetLevelResponseb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'service_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals['_NETWORKSECURITY']._serialized_start=6608 + _globals['_NETWORKSECURITY']._serialized_end=6733 + _globals['_WIFISTANDARD']._serialized_start=6735 + _globals['_WIFISTANDARD']._serialized_end=6823 + _globals['_MODULATION']._serialized_start=6825 + _globals['_MODULATION']._serialized_end=6913 + _globals['_CHANNELWIDTH']._serialized_start=6915 + _globals['_CHANNELWIDTH']._serialized_end=6993 + _globals['_CHANNELTYPE']._serialized_start=6995 + _globals['_CHANNELTYPE']._serialized_end=7095 + _globals['_PROTOCOL']._serialized_start=7098 + _globals['_PROTOCOL']._serialized_end=7281 + _globals['_DATALINKTYPE']._serialized_start=7283 + _globals['_DATALINKTYPE']._serialized_end=7348 + _globals['_RADIOINFO']._serialized_start=57 + _globals['_RADIOINFO']._serialized_end=110 + _globals['_CLIENTWINDOW']._serialized_start=113 + _globals['_CLIENTWINDOW']._serialized_end=307 + _globals['_CLIENTINFO']._serialized_start=310 + _globals['_CLIENTINFO']._serialized_end=612 + _globals['_GROUPWINDOW']._serialized_start=615 + _globals['_GROUPWINDOW']._serialized_end=808 + _globals['_WIFISTANDARDINFO']._serialized_start=811 + _globals['_WIFISTANDARDINFO']._serialized_end=1167 + _globals['_MULTICASTGROUP']._serialized_start=1169 + _globals['_MULTICASTGROUP']._serialized_end=1214 + _globals['_CHANNELINFO']._serialized_start=1216 + _globals['_CHANNELINFO']._serialized_end=1307 + _globals['_ACCESSPOINTINFO']._serialized_start=1310 + _globals['_ACCESSPOINTINFO']._serialized_end=1795 + _globals['_RAW']._serialized_start=1797 + _globals['_RAW']._serialized_end=1819 + _globals['_ARP']._serialized_start=1821 + _globals['_ARP']._serialized_end=1936 + _globals['_ICMP']._serialized_start=1939 + _globals['_ICMP']._serialized_end=2092 + _globals['_ICMP_TYPE']._serialized_start=1993 + _globals['_ICMP_TYPE']._serialized_end=2092 + _globals['_ICMPV6']._serialized_start=2095 + _globals['_ICMPV6']._serialized_end=2372 + _globals['_ICMPV6_TYPE']._serialized_start=2172 + _globals['_ICMPV6_TYPE']._serialized_end=2372 + _globals['_DNS']._serialized_start=2375 + _globals['_DNS']._serialized_end=2588 + _globals['_DNS_QUESTION']._serialized_start=2490 + _globals['_DNS_QUESTION']._serialized_end=2528 + _globals['_DNS_RESOURCERECORD']._serialized_start=2530 + _globals['_DNS_RESOURCERECORD']._serialized_end=2588 + _globals['_DHCP']._serialized_start=2591 + _globals['_DHCP']._serialized_end=2750 + _globals['_DHCPV6']._serialized_start=2753 + _globals['_DHCPV6']._serialized_end=2921 + _globals['_DHCPV6_OPTION']._serialized_start=2848 + _globals['_DHCPV6_OPTION']._serialized_end=2921 + _globals['_IP']._serialized_start=2924 + _globals['_IP']._serialized_end=3182 + _globals['_IPV6']._serialized_start=3185 + _globals['_IPV6']._serialized_end=3460 + _globals['_TCP']._serialized_start=3463 + _globals['_TCP']._serialized_end=3631 + _globals['_UDP']._serialized_start=3634 + _globals['_UDP']._serialized_end=3823 + _globals['_PACKET']._serialized_start=3826 + _globals['_PACKET']._serialized_end=4266 + _globals['_RECORDING']._serialized_start=4268 + _globals['_RECORDING']._serialized_end=4372 + _globals['_EMPTY']._serialized_start=4374 + _globals['_EMPTY']._serialized_end=4381 + _globals['_SNIFFERID']._serialized_start=4383 + _globals['_SNIFFERID']._serialized_end=4416 + _globals['_SNIFFERCREATEREQUEST']._serialized_start=4418 + _globals['_SNIFFERCREATEREQUEST']._serialized_end=4511 + _globals['_SNIFFERLISTRESPONSE']._serialized_start=4513 + _globals['_SNIFFERLISTRESPONSE']._serialized_end=4572 + _globals['_SNIFFERINFO']._serialized_start=4574 + _globals['_SNIFFERINFO']._serialized_end=4666 + _globals['_BASICNETWORKINFO']._serialized_start=4668 + _globals['_BASICNETWORKINFO']._serialized_end=4715 + _globals['_APLISTRESPONSE']._serialized_start=4717 + _globals['_APLISTRESPONSE']._serialized_end=4772 + _globals['_APGETREQUEST']._serialized_start=4774 + _globals['_APGETREQUEST']._serialized_end=4825 + _globals['_APGETRESPONSE']._serialized_start=4827 + _globals['_APGETRESPONSE']._serialized_end=4878 + _globals['_APPROVIDEPASSWORDREQUEST']._serialized_start=4880 + _globals['_APPROVIDEPASSWORDREQUEST']._serialized_end=4961 + _globals['_APPROVIDEPASSWORDRESPONSE']._serialized_start=4964 + _globals['_APPROVIDEPASSWORDRESPONSE']._serialized_end=5158 + _globals['_APPROVIDEPASSWORDRESPONSE_DECRYPTIONSTATE']._serialized_start=5058 + _globals['_APPROVIDEPASSWORDRESPONSE_DECRYPTIONSTATE']._serialized_end=5158 + _globals['_APGETDECRYPTEDSTREAMREQUEST']._serialized_start=5160 + _globals['_APGETDECRYPTEDSTREAMREQUEST']._serialized_end=5251 + _globals['_APDEAUTHREQUEST']._serialized_start=5253 + _globals['_APDEAUTHREQUEST']._serialized_end=5307 + _globals['_APDEAUTHCLIENTREQUEST']._serialized_start=5309 + _globals['_APDEAUTHCLIENTREQUEST']._serialized_end=5390 + _globals['_APGETHASHREQUEST']._serialized_start=5392 + _globals['_APGETHASHREQUEST']._serialized_end=5468 + _globals['_APGETHASHRESPONSE']._serialized_start=5470 + _globals['_APGETHASHRESPONSE']._serialized_end=5506 + _globals['_APIGNOREREQUEST']._serialized_start=5508 + _globals['_APIGNOREREQUEST']._serialized_end=5594 + _globals['_APCREATERECORDINGREQUEST']._serialized_start=5596 + _globals['_APCREATERECORDINGREQUEST']._serialized_end=5686 + _globals['_APCREATERECORDINGRESPONSE']._serialized_start=5688 + _globals['_APCREATERECORDINGRESPONSE']._serialized_end=5751 + _globals['_FOCUSSTARTREQUEST']._serialized_start=5753 + _globals['_FOCUSSTARTREQUEST']._serialized_end=5809 + _globals['_FOCUSSTARTRESPONSE']._serialized_start=5811 + _globals['_FOCUSSTARTRESPONSE']._serialized_end=5868 + _globals['_FOCUSGETACTIVERESPONSE']._serialized_start=5870 + _globals['_FOCUSGETACTIVERESPONSE']._serialized_end=5960 + _globals['_RECORDINGCREATEREQUEST']._serialized_start=5962 + _globals['_RECORDINGCREATEREQUEST']._serialized_end=6035 + _globals['_RECORDINGCREATERESPONSE']._serialized_start=6037 + _globals['_RECORDINGCREATERESPONSE']._serialized_end=6098 + _globals['_RECORDINGLISTREQUEST']._serialized_start=6100 + _globals['_RECORDINGLISTREQUEST']._serialized_end=6166 + _globals['_RECORDINGLISTRESPONSE']._serialized_start=6168 + _globals['_RECORDINGLISTRESPONSE']._serialized_end=6229 + _globals['_RECORDINGLOADDECRYPTEDREQUEST']._serialized_start=6231 + _globals['_RECORDINGLOADDECRYPTEDREQUEST']._serialized_end=6301 + _globals['_NETWORKINTERFACELISTRESPONSE']._serialized_start=6303 + _globals['_NETWORKINTERFACELISTRESPONSE']._serialized_end=6349 + _globals['_LOGENTRY']._serialized_start=6352 + _globals['_LOGENTRY']._serialized_end=6559 + _globals['_LOGENTRY_LOGLEVEL']._serialized_start=6484 + _globals['_LOGENTRY_LOGLEVEL']._serialized_end=6559 + _globals['_BATTERYGETLEVELRESPONSE']._serialized_start=6561 + _globals['_BATTERYGETLEVELRESPONSE']._serialized_end=6606 + _globals['_SNIFFER']._serialized_start=7351 + _globals['_SNIFFER']._serialized_end=8868 +# @@protoc_insertion_point(module_scope) diff --git a/gui/service_pb2_grpc.py b/gui/service_pb2_grpc.py new file mode 100644 index 0000000..2fc7337 --- /dev/null +++ b/gui/service_pb2_grpc.py @@ -0,0 +1,1006 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + +import service_pb2 as service__pb2 + +GRPC_GENERATED_VERSION = '1.68.1' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + f' but the generated code in service_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + + +class SnifferStub(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SnifferCreate = channel.unary_unary( + '/proto.Sniffer/SnifferCreate', + request_serializer=service__pb2.SnifferCreateRequest.SerializeToString, + response_deserializer=service__pb2.SnifferID.FromString, + _registered_method=True) + self.SnifferDestroy = channel.unary_unary( + '/proto.Sniffer/SnifferDestroy', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.SnifferList = channel.unary_unary( + '/proto.Sniffer/SnifferList', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.SnifferListResponse.FromString, + _registered_method=True) + self.AccessPointList = channel.unary_unary( + '/proto.Sniffer/AccessPointList', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.APListResponse.FromString, + _registered_method=True) + self.AccessPointGet = channel.unary_unary( + '/proto.Sniffer/AccessPointGet', + request_serializer=service__pb2.APGetRequest.SerializeToString, + response_deserializer=service__pb2.APGetResponse.FromString, + _registered_method=True) + self.AccessPointProvidePassword = channel.unary_unary( + '/proto.Sniffer/AccessPointProvidePassword', + request_serializer=service__pb2.APProvidePasswordRequest.SerializeToString, + response_deserializer=service__pb2.APProvidePasswordResponse.FromString, + _registered_method=True) + self.AccessPointGetDecryptedStream = channel.unary_stream( + '/proto.Sniffer/AccessPointGetDecryptedStream', + request_serializer=service__pb2.APGetDecryptedStreamRequest.SerializeToString, + response_deserializer=service__pb2.Packet.FromString, + _registered_method=True) + self.AccessPointDeauth = channel.unary_unary( + '/proto.Sniffer/AccessPointDeauth', + request_serializer=service__pb2.APDeauthRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointDeauthClient = channel.unary_unary( + '/proto.Sniffer/AccessPointDeauthClient', + request_serializer=service__pb2.APDeauthClientRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointGetHash = channel.unary_unary( + '/proto.Sniffer/AccessPointGetHash', + request_serializer=service__pb2.APGetHashRequest.SerializeToString, + response_deserializer=service__pb2.APGetHashResponse.FromString, + _registered_method=True) + self.AccessPointIgnore = channel.unary_unary( + '/proto.Sniffer/AccessPointIgnore', + request_serializer=service__pb2.APIgnoreRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointListIgnored = channel.unary_unary( + '/proto.Sniffer/AccessPointListIgnored', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.APListResponse.FromString, + _registered_method=True) + self.AccessPointCreateRecording = channel.unary_unary( + '/proto.Sniffer/AccessPointCreateRecording', + request_serializer=service__pb2.APCreateRecordingRequest.SerializeToString, + response_deserializer=service__pb2.APCreateRecordingResponse.FromString, + _registered_method=True) + self.FocusStart = channel.unary_unary( + '/proto.Sniffer/FocusStart', + request_serializer=service__pb2.FocusStartRequest.SerializeToString, + response_deserializer=service__pb2.FocusStartResponse.FromString, + _registered_method=True) + self.FocusGetActive = channel.unary_unary( + '/proto.Sniffer/FocusGetActive', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.FocusGetActiveResponse.FromString, + _registered_method=True) + self.FocusStop = channel.unary_unary( + '/proto.Sniffer/FocusStop', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.RecordingCreate = channel.unary_unary( + '/proto.Sniffer/RecordingCreate', + request_serializer=service__pb2.RecordingCreateRequest.SerializeToString, + response_deserializer=service__pb2.RecordingCreateResponse.FromString, + _registered_method=True) + self.RecordingList = channel.unary_unary( + '/proto.Sniffer/RecordingList', + request_serializer=service__pb2.RecordingListRequest.SerializeToString, + response_deserializer=service__pb2.RecordingListResponse.FromString, + _registered_method=True) + self.RecordingLoadDecrypted = channel.unary_stream( + '/proto.Sniffer/RecordingLoadDecrypted', + request_serializer=service__pb2.RecordingLoadDecryptedRequest.SerializeToString, + response_deserializer=service__pb2.Packet.FromString, + _registered_method=True) + self.NetworkInterfaceList = channel.unary_unary( + '/proto.Sniffer/NetworkInterfaceList', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.NetworkInterfaceListResponse.FromString, + _registered_method=True) + self.LogGetStream = channel.unary_stream( + '/proto.Sniffer/LogGetStream', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.LogEntry.FromString, + _registered_method=True) + self.BatteryGetLevel = channel.unary_unary( + '/proto.Sniffer/BatteryGetLevel', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.BatteryGetLevelResponse.FromString, + _registered_method=True) + + +class SnifferServicer(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + def SnifferCreate(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SnifferDestroy(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SnifferList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGet(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointProvidePassword(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGetDecryptedStream(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointDeauth(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointDeauthClient(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGetHash(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointIgnore(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointListIgnored(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointCreateRecording(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusStart(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusGetActive(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusStop(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingCreate(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingLoadDecrypted(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def NetworkInterfaceList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def LogGetStream(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def BatteryGetLevel(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_SnifferServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SnifferCreate': grpc.unary_unary_rpc_method_handler( + servicer.SnifferCreate, + request_deserializer=service__pb2.SnifferCreateRequest.FromString, + response_serializer=service__pb2.SnifferID.SerializeToString, + ), + 'SnifferDestroy': grpc.unary_unary_rpc_method_handler( + servicer.SnifferDestroy, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'SnifferList': grpc.unary_unary_rpc_method_handler( + servicer.SnifferList, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.SnifferListResponse.SerializeToString, + ), + 'AccessPointList': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointList, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.APListResponse.SerializeToString, + ), + 'AccessPointGet': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointGet, + request_deserializer=service__pb2.APGetRequest.FromString, + response_serializer=service__pb2.APGetResponse.SerializeToString, + ), + 'AccessPointProvidePassword': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointProvidePassword, + request_deserializer=service__pb2.APProvidePasswordRequest.FromString, + response_serializer=service__pb2.APProvidePasswordResponse.SerializeToString, + ), + 'AccessPointGetDecryptedStream': grpc.unary_stream_rpc_method_handler( + servicer.AccessPointGetDecryptedStream, + request_deserializer=service__pb2.APGetDecryptedStreamRequest.FromString, + response_serializer=service__pb2.Packet.SerializeToString, + ), + 'AccessPointDeauth': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointDeauth, + request_deserializer=service__pb2.APDeauthRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointDeauthClient': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointDeauthClient, + request_deserializer=service__pb2.APDeauthClientRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointGetHash': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointGetHash, + request_deserializer=service__pb2.APGetHashRequest.FromString, + response_serializer=service__pb2.APGetHashResponse.SerializeToString, + ), + 'AccessPointIgnore': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointIgnore, + request_deserializer=service__pb2.APIgnoreRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointListIgnored': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointListIgnored, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.APListResponse.SerializeToString, + ), + 'AccessPointCreateRecording': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointCreateRecording, + request_deserializer=service__pb2.APCreateRecordingRequest.FromString, + response_serializer=service__pb2.APCreateRecordingResponse.SerializeToString, + ), + 'FocusStart': grpc.unary_unary_rpc_method_handler( + servicer.FocusStart, + request_deserializer=service__pb2.FocusStartRequest.FromString, + response_serializer=service__pb2.FocusStartResponse.SerializeToString, + ), + 'FocusGetActive': grpc.unary_unary_rpc_method_handler( + servicer.FocusGetActive, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.FocusGetActiveResponse.SerializeToString, + ), + 'FocusStop': grpc.unary_unary_rpc_method_handler( + servicer.FocusStop, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'RecordingCreate': grpc.unary_unary_rpc_method_handler( + servicer.RecordingCreate, + request_deserializer=service__pb2.RecordingCreateRequest.FromString, + response_serializer=service__pb2.RecordingCreateResponse.SerializeToString, + ), + 'RecordingList': grpc.unary_unary_rpc_method_handler( + servicer.RecordingList, + request_deserializer=service__pb2.RecordingListRequest.FromString, + response_serializer=service__pb2.RecordingListResponse.SerializeToString, + ), + 'RecordingLoadDecrypted': grpc.unary_stream_rpc_method_handler( + servicer.RecordingLoadDecrypted, + request_deserializer=service__pb2.RecordingLoadDecryptedRequest.FromString, + response_serializer=service__pb2.Packet.SerializeToString, + ), + 'NetworkInterfaceList': grpc.unary_unary_rpc_method_handler( + servicer.NetworkInterfaceList, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.NetworkInterfaceListResponse.SerializeToString, + ), + 'LogGetStream': grpc.unary_stream_rpc_method_handler( + servicer.LogGetStream, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.LogEntry.SerializeToString, + ), + 'BatteryGetLevel': grpc.unary_unary_rpc_method_handler( + servicer.BatteryGetLevel, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.BatteryGetLevelResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'proto.Sniffer', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('proto.Sniffer', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class Sniffer(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + @staticmethod + def SnifferCreate(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferCreate', + service__pb2.SnifferCreateRequest.SerializeToString, + service__pb2.SnifferID.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def SnifferDestroy(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferDestroy', + service__pb2.SnifferID.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def SnifferList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferList', + service__pb2.Empty.SerializeToString, + service__pb2.SnifferListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointList', + service__pb2.SnifferID.SerializeToString, + service__pb2.APListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGet(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointGet', + service__pb2.APGetRequest.SerializeToString, + service__pb2.APGetResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointProvidePassword(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointProvidePassword', + service__pb2.APProvidePasswordRequest.SerializeToString, + service__pb2.APProvidePasswordResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGetDecryptedStream(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/AccessPointGetDecryptedStream', + service__pb2.APGetDecryptedStreamRequest.SerializeToString, + service__pb2.Packet.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointDeauth(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointDeauth', + service__pb2.APDeauthRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointDeauthClient(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointDeauthClient', + service__pb2.APDeauthClientRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGetHash(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointGetHash', + service__pb2.APGetHashRequest.SerializeToString, + service__pb2.APGetHashResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointIgnore(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointIgnore', + service__pb2.APIgnoreRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointListIgnored(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointListIgnored', + service__pb2.SnifferID.SerializeToString, + service__pb2.APListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointCreateRecording(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointCreateRecording', + service__pb2.APCreateRecordingRequest.SerializeToString, + service__pb2.APCreateRecordingResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusStart(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusStart', + service__pb2.FocusStartRequest.SerializeToString, + service__pb2.FocusStartResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusGetActive(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusGetActive', + service__pb2.SnifferID.SerializeToString, + service__pb2.FocusGetActiveResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusStop(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusStop', + service__pb2.SnifferID.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingCreate(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/RecordingCreate', + service__pb2.RecordingCreateRequest.SerializeToString, + service__pb2.RecordingCreateResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/RecordingList', + service__pb2.RecordingListRequest.SerializeToString, + service__pb2.RecordingListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingLoadDecrypted(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/RecordingLoadDecrypted', + service__pb2.RecordingLoadDecryptedRequest.SerializeToString, + service__pb2.Packet.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def NetworkInterfaceList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/NetworkInterfaceList', + service__pb2.Empty.SerializeToString, + service__pb2.NetworkInterfaceListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def LogGetStream(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/LogGetStream', + service__pb2.Empty.SerializeToString, + service__pb2.LogEntry.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def BatteryGetLevel(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/BatteryGetLevel', + service__pb2.Empty.SerializeToString, + service__pb2.BatteryGetLevelResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) diff --git a/gui/src/main.py b/gui/src/main.py deleted file mode 100644 index 8a433fa..0000000 --- a/gui/src/main.py +++ /dev/null @@ -1,249 +0,0 @@ -import os -import RPi.GPIO as GPIO -import sys -from time import sleep, time -dirname = os.path.dirname(__file__) -sys.path.append(os.path.join(dirname, '..')) -from PIL import Image, ImageDraw, ImageFont -import spidev as SPI -from lib import LCD_2inch4 -import client -import textwrap - -# Constants -RST = 27 -DC = 25 -BL = 18 -bus = 0 -device = 0 -fontsize = 25 - -BUTTON_PINS = { - 17: "ACCEPT", - 22: "REFUSE", - 26: "DOWN", - 13: "LEFT", - 6: "RIGHT", - 5: "UP" -} - -stealth_mode = False - -class Display: - def __init__(self): - self.disp = LCD_2inch4.LCD_2inch4(spi=SPI.SpiDev(bus, device), spi_freq=40000000, rst=RST, dc=DC, bl=BL) - self.disp.Init() - self.disp.command(0x36) - self.disp.data(0x20) - self.disp.clear() - self.in_menu = False - self.scrollable = False - self.scroll_offset = 0 - self.horizontal_scroll_offset = 0 - self.current_message = None - self.current_color = "BLACK" - self.current_lines = [] - self.current_font = None - self.battery_font = None - self.current_y = 0 - self.current_text_height = 0 - self.battery_level = "Battery N/A" - - def update_battery_level(self): - try: - self.battery_level = f"{client.get_battery()}" - except Exception as e: - self.battery_level = "Battery N/A" - self.refresh() - - def show_message(self, message, color="BLACK"): - self.in_menu = False - self.scrollable = False - self.current_message = message - self.current_color = color - size = (320, 240) - background = Image.new("RGB", size, (240, 255, 180)) - draw = ImageDraw.Draw(background) - font = ImageFont.truetype(os.path.join(os.path.dirname(__file__), '../Font/Font02.ttf'), fontsize) - self.current_font = font - battery_font = ImageFont.truetype(os.path.join(os.path.dirname(__file__), '../Font/Font02.ttf'), fontsize - 5) - self.battery_font = battery_font - - max_width = size[0] - #wrapped_text = textwrap.fill(message, width=max_width // fontsize * 16) - - lines = message.split('\n') - self.current_lines = lines - text_height = len(lines) * fontsize - self.current_text_height = text_height - - y = (size[1] - text_height) // 2 + 30 - self.current_y = y - self.update_battery_level() - - #print(lines) - - if text_height > size[1] - 20: - self.current_y = 30 - self.scrollable = True - self.draw_text() - else: - self.scrollable = False - y_offset = y - for line in lines: - draw.text((5, y_offset), line, fill=color, font=font) - y_offset += fontsize - draw.text((5, 5), self.battery_level, fill="BLACK", font=battery_font) - self.disp.ShowImage(background.rotate(180)) - - def draw_text(self): - size = (320, 240) - background = Image.new("RGB", size, (240, 255, 180)) - draw = ImageDraw.Draw(background) - - y_offset = self.current_y - self.scroll_offset - x_offset = 5 + self.horizontal_scroll_offset - for line in self.current_lines: - draw.text((x_offset, y_offset), line, fill=self.current_color, font=self.current_font) - y_offset += fontsize - - battery_padding = 10 - battery_text_height = 20 - battery_area_height = battery_text_height + battery_padding - draw.rectangle((0, 0, size[0], battery_area_height), fill=(240, 255, 180)) - - draw.text((5, 5), self.battery_level, fill="BLACK", font=self.battery_font) - - self.disp.ShowImage(background.rotate(180)) - - - def refresh(self): - if self.current_message: - self.draw_text() - - def show_list(self, items, selected_index): - self.in_menu = True - size = (320, 240) - background = Image.new("RGB", size, (240, 255, 180)) - draw = ImageDraw.Draw(background) - font = ImageFont.truetype(os.path.join(os.path.dirname(__file__), '../Font/Font02.ttf'), fontsize) - - for i, item in enumerate(items): - color = "RED" if i == selected_index else "BLACK" - draw.text((10, 30 + i * 30), item, fill=color, font=font) - draw.text((5, 5), self.battery_level, fill="BLACK", font=self.battery_font) - self.disp.ShowImage(background.rotate(180)) - - def clear(self): - self.disp.reset() - self.disp.clear() - - -class ListMenu: - def __init__(self, display): - self.display = display - self.stealth_text = "Stealth mode (OFF)" - if stealth_mode: - self.stealth_text = "Stealth mode (ON)" - else: - self.stealth_text = "Stealth mode (OFF)" - self.items = ["Get sniffer list", "Get access point list", "Create recording", "Restart"] - self.selected_index = 0 - - def navigate(self, direction="NONE"): - if direction == "UP": - self.selected_index = (self.selected_index - 1) % len(self.items) - sleep(0.1) - elif direction == "DOWN": - self.selected_index = (self.selected_index + 1) % len(self.items) - sleep(0.1) - elif direction == "NONE": - self.selected_index = self.selected_index - sleep(0.1) - self.display.show_list(self.items, self.selected_index) - - def select(self): - selected_item = self.items[self.selected_index] - return selected_item - - def refuse(self): - self.display.show_message("Action Refused!") - - -class ButtonHandler: - def __init__(self, menu, display): - self.menu = menu - self.display = display - GPIO.setmode(GPIO.BCM) - for pin in BUTTON_PINS.keys(): - GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) - - def listen(self): - while True: - for pin, action in BUTTON_PINS.items(): - if GPIO.input(pin) == GPIO.HIGH: - if action in ["UP", "DOWN"] and display.in_menu == True: - self.menu.navigate(action) - elif action in ["UP", "DOWN"] and display.scrollable == True: - if action == "UP" and self.display.scroll_offset > 0: - self.display.scroll_offset -= 40 - self.display.refresh() - elif action == "DOWN" and self.display.scroll_offset < self.display.current_text_height - 240: - self.display.scroll_offset += 40 - self.display.refresh() - elif action == "LEFT" and not display.in_menu and self.display.horizontal_scroll_offset < 0: - self.display.horizontal_scroll_offset += 40 - self.display.refresh() - elif action == "RIGHT" and not display.in_menu and self.display.horizontal_scroll_offset > self.display.current_font.getbbox(self.display.current_message)[1] - 320: - self.display.horizontal_scroll_offset -= 40 - self.display.refresh() - elif action == "ACCEPT": - selected = self.menu.select() - if selected == "Get sniffer list": - self.display.show_message(client.get_sniffer_list()) - elif selected == "Get access point list": - self.display.show_message(client.get_access_point_list()) - elif selected == "Create recording": - self.display.show_message(client.create_recording()) - elif selected == "Get battery": - self.display.show_message(client.get_battery()) - elif selected == "Stealth mode" and stealth_mode == False: - os.system("systemctl stop hostapd") - self.display.show_message("Stealth mode ENABLED!", "GREEN") - elif selected == "Stealth mode" and stealth_mode == True: - os.system("systemctl start hostapd") - self.display.show_message("Stealth mode DISABLED!", "GREEN") - elif selected == "Restart": - self.cleanup() - return - elif action == "REFUSE" and display.in_menu == False: - self.menu.navigate("NONE") - display.scroll_offset = 0 - - def cleanup(self): - display.clear() - os.system('sudo reboot') - -if __name__ == "__main__": - try: - display = Display() - menu = ListMenu(display) - button_handler = ButtonHandler(menu, display) - client = client.Client() - if not client.is_connected(): - display.show_message("Failed to connect to server!", "RED") - sleep(3) - display.clear() - sys.exit() - else: - display.show_message("Connected to sniffer!", "GREEN") - sleep(2) - menu.navigate() - button_handler.listen() - except KeyboardInterrupt: - GPIO.cleanup() - sys.exit() - except RuntimeError as e: - print(f"Runtime error: {e}") - GPIO.cleanup() - sys.exit() \ No newline at end of file diff --git a/gui/widgets.py b/gui/widgets.py new file mode 100644 index 0000000..571afca --- /dev/null +++ b/gui/widgets.py @@ -0,0 +1,171 @@ +from PIL import ImageFont +from PIL import ImageDraw + +class GUIElement: + def __init__(self, x, y, width, height, font=None): + self.x = x + self.y = y + self.base_y = y + self.width = width + self.height = height + self.parent_page = None + self.font = font or ImageFont.load_default() + + + def draw(self, draw): + pass + +class Background(GUIElement): + def __init__(self, color="white"): + super().__init__(0, 0, 320, 240) + self.color = color + + def draw(self, draw): + draw.rectangle((0, 0, self.width, self.height), fill=self.color) + +class FlowContainer(GUIElement): + def __init__(self, x=0, y=0, spacing=10): + super().__init__(x, y, width=0, height=0) + self.spacing = spacing + self.children = [] + + def add_child(self, child): + self.children.append(child) + + def layout(self): + """Automatically assigns x/y to children vertically.""" + current_y = self.y + max_width = 0 + for child in self.children: + if child.x is None: + child.x = self.x + if child.y is None: + child.y = current_y + current_y += child.height + self.spacing + max_width = max(max_width, child.width) + self.width = max_width + self.height = current_y - self.y + + def draw(self, draw): + self.layout() + for child in self.children: + child.draw(draw) + +class Label(GUIElement): + def __init__(self, x, y, text, color="white"): + super().__init__(x, y, 0, 0) + self.text = text + self.color = color + bbox = self.font.getbbox(text) + self.width = bbox[2] - bbox[0] + self.height = bbox[3] - bbox[1] + + def draw(self, draw): + draw.text((self.x, self.y), self.text, font=self.font, fill=self.color) + +class Button(GUIElement): + def __init__(self, x, y, width, height, text, action=None, bg_color="gray", text_color="white"): + super().__init__(x, y, width, height) + self.text = text + self.action = action + self.bg_color = bg_color + self.text_color = text_color + self.focused = False + + def set_focus(self, is_focused): + self.focused = is_focused + + def draw(self, draw): + if self.focused: + border_color = "red" + draw.rectangle((self.x-2, self.y-2, self.x+self.width+2, self.y+self.height+2), fill=border_color) + draw.rectangle((self.x, self.y, self.x+self.width, self.y+self.height), fill=self.bg_color) + bbox = self.font.getbbox(self.text) + text_width = bbox[2] - bbox[0] + text_height = bbox[3] - bbox[1] + text_x = self.x + (self.width - text_width) // 2 + text_y = self.y + (self.height - text_height) // 2 + draw.text((text_x, text_y), self.text, font=self.font, fill=self.text_color) + + def press(self): + if self.action: + self.action() + +class ElementList(GUIElement): + def __init__(self, x, y, spacing=10, header=None, text_color="white", clickable=False, action=None, limit_to_five=False): + super().__init__(x, y, 0, 0) + self.spacing = spacing + self.elements = [] + self.text_color = text_color + self.width = 0 + self.focused = False + self.clickable = clickable + self.action = action + self.limit_to_five = limit_to_five # New parameter + + if header is not None: + if isinstance(header, str): + self.header = Label(x, y, header, color=self.text_color) + self.elements.append(self.header) + else: + raise ValueError("Header must be a string") + else: + self.header = None + + def add_element(self, element): + self.elements.append(element) + + def layout(self): + current_y = self.y + self.width = 0 + elements_to_show = self.elements[:5] if self.limit_to_five else self.elements + + for element in elements_to_show: + element.x = self.x + element.y = current_y + current_y += element.height + self.spacing + self.width = max(self.width, element.width) + self.height = current_y - self.y + + def draw(self, draw): + self.layout() + elements_to_show = self.elements[:5] if self.limit_to_five else self.elements + for element in elements_to_show: + element.draw(draw) + if self.focused: + draw.rectangle((self.x-2, self.y-2, self.x+self.width+2, self.y+self.height+2), outline="red") + if self.limit_to_five and len(self.elements) > 5: + fade_height = 25 + fade_y_start = self.y + self.height - fade_height + for i in range(fade_height): + alpha = int(0 + i * 255 / fade_height) + fade_color = (255, 255, 255, alpha) + draw.rectangle((self.x, fade_y_start + i, self.x + self.width, fade_y_start + i + 1), fill=fade_color) + + def set_focus(self, is_focused): + self.focused = is_focused + + def press(self): + if self.clickable and self.action: + self.action(self) + +class BatteryBar(GUIElement): + def __init__(self, x, y, width=320, height=20, level=0, bg_color="gray", fg_color="green"): + super().__init__(x, y, width, height) + self.level = level + self.bg_color = bg_color + self.fg_color = fg_color + self.font = ImageFont.truetype("Font/Font02.ttf", 18) + + def set_level(self, level): + self.level = level + + def draw(self, draw): + if isinstance(self.level,int): + draw.rectangle((self.x, self.y, self.x + self.width, self.y + self.height), fill=self.bg_color) + fill_width = (self.width * self.level) // 100 + draw.rectangle((self.x, self.y, self.x + fill_width, self.y + self.height), fill=self.fg_color) + draw.text((self.x+5, self.y), f"{self.level}%", font=self.font, fill="black") + else: + draw.rectangle((self.x, self.y, self.x + 320, self.y + self.height), fill="red") + draw.text((self.x+5, self.y), f"{self.level}", font=self.font, fill="black") \ No newline at end of file diff --git a/gui_old/Font/Font00.ttf b/gui_old/Font/Font00.ttf new file mode 100644 index 0000000..e85ffd1 Binary files /dev/null and b/gui_old/Font/Font00.ttf differ diff --git a/gui_old/Font/Font01.ttf b/gui_old/Font/Font01.ttf new file mode 100644 index 0000000..60e872e Binary files /dev/null and b/gui_old/Font/Font01.ttf differ diff --git a/gui_old/Font/Font02.ttf b/gui_old/Font/Font02.ttf new file mode 100644 index 0000000..f8f46ee Binary files /dev/null and b/gui_old/Font/Font02.ttf differ diff --git a/gui_old/lib/LCD_2inch4.py b/gui_old/lib/LCD_2inch4.py new file mode 100644 index 0000000..f108c1d --- /dev/null +++ b/gui_old/lib/LCD_2inch4.py @@ -0,0 +1,187 @@ + +import time +from . import lcdconfig +import numbers + +class LCD_2inch4(lcdconfig.RaspberryPi): + + width = 240 + height = 320 + def command(self, cmd): + self.digital_write(self.DC_PIN, self.GPIO.LOW) + self.spi_writebyte([cmd]) + + def data(self, val): + self.digital_write(self.DC_PIN, self.GPIO.HIGH) + self.spi_writebyte([val]) + def reset(self): + """Reset the display""" + self.GPIO.output(self.RST_PIN,self.GPIO.HIGH) + time.sleep(0.01) + self.GPIO.output(self.RST_PIN,self.GPIO.LOW) + time.sleep(0.01) + self.GPIO.output(self.RST_PIN,self.GPIO.HIGH) + time.sleep(0.01) + + def Init(self): + """Initialize dispaly""" + self.module_init() + self.reset() + + self.command(0x11)#'''Sleep out''' + + self.command(0xCF)# + self.data(0x00)# + self.data(0xC1)# + self.data(0X30)# + self.command(0xED)# + self.data(0x64)# + self.data(0x03)# + self.data(0X12)# + self.data(0X81)# + self.command(0xE8)# + self.data(0x85)# + self.data(0x00)# + self.data(0x79)# + self.command(0xCB)# + self.data(0x39)# + self.data(0x2C)# + self.data(0x00)# + self.data(0x34)# + self.data(0x02)# + self.command(0xF7)# + self.data(0x20)# + self.command(0xEA)# + self.data(0x00)# + self.data(0x00)# + self.command(0xC0)#'''Power control''' + self.data(0x1D)#'''VRH[5:0]''' + self.command(0xC1)#'''Power control''' + self.data(0x12)#'''SAP[2:0]#BT[3:0]''' + self.command(0xC5)#'''VCM control''' + self.data(0x33)# + self.data(0x3F)# + self.command(0xC7)#'''VCM control''' + self.data(0x92)# + self.command(0x3A)#'''Memory Access Control''' + self.data(0x55)# + self.command(0x36)#'''Memory Access Control''' + self.data(0x08)# + self.command(0xB1)# + self.data(0x00)# + self.data(0x12)# + self.command(0xB6)#'''Display Function Control''' + self.data(0x0A)# + self.data(0xA2)# + + self.command(0x44)# + self.data(0x02)# + + self.command(0xF2)#'''3Gamma Function Disable''' + self.data(0x00)# + self.command(0x26)#'''Gamma curve selected''' + self.data(0x01)# + self.command(0xE0)#'''Set Gamma''' + self.data(0x0F)# + self.data(0x22)# + self.data(0x1C)# + self.data(0x1B)# + self.data(0x08)# + self.data(0x0F)# + self.data(0x48)# + self.data(0xB8)# + self.data(0x34)# + self.data(0x05)# + self.data(0x0C)# + self.data(0x09)# + self.data(0x0F)# + self.data(0x07)# + self.data(0x00)# + self.command(0XE1)#'''Set Gamma''' + self.data(0x00)# + self.data(0x23)# + self.data(0x24)# + self.data(0x07)# + self.data(0x10)# + self.data(0x07)# + self.data(0x38)# + self.data(0x47)# + self.data(0x4B)# + self.data(0x0A)# + self.data(0x13)# + self.data(0x06)# + self.data(0x30)# + self.data(0x38)# + self.data(0x0F)# + self.command(0x29)#'''Display on''' + + + def SetWindows(self, Xstart, Ystart, Xend, Yend): + #set the X coordinates + self.command(0x2A) + self.data(Xstart>>8) #Set the horizontal starting point to the high octet + self.data(Xstart & 0xff) #Set the horizontal starting point to the low octet + self.data(Xend>>8) #Set the horizontal end to the high octet + self.data((Xend - 1) & 0xff)#Set the horizontal end to the low octet + + #set the Y coordinates + self.command(0x2B) + self.data(Ystart>>8) + self.data((Ystart & 0xff)) + self.data(Yend>>8) + self.data((Yend - 1) & 0xff ) + + self.command(0x2C) + + def ShowImage(self,Image,Xstart=0,Ystart=0): + """Set buffer to value of Python Imaging Library image.""" + """Write display buffer to physical display""" + imwidth, imheight = Image.size + if imwidth == self.height and imheight == self.width: + img = self.np.asarray(Image) + pix = self.np.zeros((imheight,imwidth , 2), dtype = self.np.uint8) + + pix[...,[0]] = self.np.add(self.np.bitwise_and(img[...,[0]],0xF8),self.np.right_shift(img[...,[1]],5)) + pix[...,[1]] = self.np.add(self.np.bitwise_and(self.np.left_shift(img[...,[1]],3),0xE0), self.np.right_shift(img[...,[2]],3)) + + pix = pix.flatten().tolist() + + self.command(0x36) + self.data(0x78) + self.SetWindows ( 0, 0, self.height, self.width) + self.digital_write(self.DC_PIN,self.GPIO.HIGH) + for i in range(0,len(pix),4096): + self.spi_writebyte(pix[i:i+4096]) + + else : + img = self.np.asarray(Image) + pix = self.np.zeros((imheight,imwidth , 2), dtype = self.np.uint8) + + pix[...,[0]] = self.np.add(self.np.bitwise_and(img[...,[0]],0xF8),self.np.right_shift(img[...,[1]],5)) + pix[...,[1]] = self.np.add(self.np.bitwise_and(self.np.left_shift(img[...,[1]],3),0xE0), self.np.right_shift(img[...,[2]],3)) + + pix = pix.flatten().tolist() + self.command(0x36) + self.data(0x08) + self.SetWindows ( 0, 0, self.width, self.height) + self.digital_write(self.DC_PIN,self.GPIO.HIGH) + for i in range(0,len(pix),4096): + self.spi_writebyte(pix[i:i+4096]) + + def clear(self): + """Clear contents of image buffer""" + _buffer = [0xff]*(self.width * self.height * 2) + time.sleep(0.02) + self.SetWindows ( 0, 0, self.width, self.height) + self.digital_write(self.DC_PIN,self.GPIO.HIGH) + for i in range(0,len(_buffer),4096): + self.spi_writebyte(_buffer[i:i+4096]) + + def clear_color(self,color): + """Clear contents of image buffer""" + _buffer = [color>>8, color & 0xff]*(self.width * self.height) + time.sleep(0.02) + self.SetWindows ( 0, 0, self.width, self.height) + self.digital_write(self.DC_PIN,self.GPIO.HIGH) + for i in range(0,len(_buffer),4096): + self.spi_writebyte(_buffer[i:i+4096]) diff --git a/gui_old/lib/__init__.py b/gui_old/lib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gui_old/lib/__init__.pyc b/gui_old/lib/__init__.pyc new file mode 100644 index 0000000..7b0b4ea Binary files /dev/null and b/gui_old/lib/__init__.pyc differ diff --git a/gui_old/lib/__pycache__/LCD_2inch4.cpython-311.pyc b/gui_old/lib/__pycache__/LCD_2inch4.cpython-311.pyc new file mode 100644 index 0000000..124d4f6 Binary files /dev/null and b/gui_old/lib/__pycache__/LCD_2inch4.cpython-311.pyc differ diff --git a/gui_old/lib/__pycache__/__init__.cpython-311.pyc b/gui_old/lib/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..07a7132 Binary files /dev/null and b/gui_old/lib/__pycache__/__init__.cpython-311.pyc differ diff --git a/gui_old/lib/__pycache__/lcdconfig.cpython-311.pyc b/gui_old/lib/__pycache__/lcdconfig.cpython-311.pyc new file mode 100644 index 0000000..6c49d8b Binary files /dev/null and b/gui_old/lib/__pycache__/lcdconfig.cpython-311.pyc differ diff --git a/gui_old/lib/lcdconfig.py b/gui_old/lib/lcdconfig.py new file mode 100644 index 0000000..77b058f --- /dev/null +++ b/gui_old/lib/lcdconfig.py @@ -0,0 +1,111 @@ +# /***************************************************************************** +# * | File : epdconfig.py +# * | Author : Waveshare team +# * | Function : Hardware underlying interface +# * | Info : +# *---------------- +# * | This version: V1.0 +# * | Date : 2019-06-21 +# * | Info : +# ****************************************************************************** +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documnetation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + +import os +import sys +import time +import spidev +import logging +import numpy as np + +class RaspberryPi: + def __init__(self,spi=spidev.SpiDev(0,0),spi_freq=40000000,rst = 27,dc = 25,bl = 18,bl_freq=1000,i2c=None,i2c_freq=100000): + import RPi.GPIO + self.np=np + self.RST_PIN= rst + self.DC_PIN = dc + self.BL_PIN = bl + self.SPEED =spi_freq + self.BL_freq=bl_freq + self.GPIO = RPi.GPIO + #self.GPIO.cleanup() + self.GPIO.setmode(self.GPIO.BCM) + self.GPIO.setwarnings(False) + self.GPIO.setup(self.RST_PIN, self.GPIO.OUT) + self.GPIO.setup(self.DC_PIN, self.GPIO.OUT) + self.GPIO.setup(self.BL_PIN, self.GPIO.OUT) + self.GPIO.output(self.BL_PIN, self.GPIO.HIGH) + #Initialize SPI + self.SPI = spi + if self.SPI!=None : + self.SPI.max_speed_hz = spi_freq + self.SPI.mode = 0b00 + + def digital_write(self, pin, value): + self.GPIO.output(pin, value) + + def digital_read(self, pin): + return self.GPIO.input(pin) + + def delay_ms(self, delaytime): + time.sleep(delaytime / 1000.0) + + def spi_writebyte(self, data): + if self.SPI!=None : + self.SPI.writebytes(data) + def bl_DutyCycle(self, duty): + self._pwm.ChangeDutyCycle(duty) + + def bl_Frequency(self,freq): + self._pwm.ChangeFrequency(freq) + + def module_init(self): + self.GPIO.setup(self.RST_PIN, self.GPIO.OUT) + self.GPIO.setup(self.DC_PIN, self.GPIO.OUT) + self.GPIO.setup(self.BL_PIN, self.GPIO.OUT) + self._pwm=self.GPIO.PWM(self.BL_PIN,self.BL_freq) + self._pwm.start(100) + if self.SPI!=None : + self.SPI.max_speed_hz = self.SPEED + self.SPI.mode = 0b00 + return 0 + + def module_exit(self): + logging.debug("spi end") + if self.SPI!=None : + self.SPI.close() + + logging.debug("gpio cleanup...") + self.GPIO.output(self.RST_PIN, 1) + self.GPIO.output(self.DC_PIN, 0) + self._pwm.stop() + time.sleep(0.001) + self.GPIO.output(self.BL_PIN, 1) + #self.GPIO.cleanup() + + +''' +if os.path.exists('/sys/bus/platform/drivers/gpiomem-bcm2835'): + implementation = RaspberryPi() + +for func in [x for x in dir(implementation) if not x.startswith('_')]: + setattr(sys.modules[__name__], func, getattr(implementation, func)) +''' + +### END OF FILE ### diff --git a/gui_old/lib/lcdconfig.pyc b/gui_old/lib/lcdconfig.pyc new file mode 100644 index 0000000..c06fa5e Binary files /dev/null and b/gui_old/lib/lcdconfig.pyc differ diff --git a/gui_old/src/__pycache__/client.cpython-311.pyc b/gui_old/src/__pycache__/client.cpython-311.pyc new file mode 100644 index 0000000..0973dd3 Binary files /dev/null and b/gui_old/src/__pycache__/client.cpython-311.pyc differ diff --git a/gui_old/src/__pycache__/service_pb2.cpython-311.pyc b/gui_old/src/__pycache__/service_pb2.cpython-311.pyc new file mode 100644 index 0000000..e96fff2 Binary files /dev/null and b/gui_old/src/__pycache__/service_pb2.cpython-311.pyc differ diff --git a/gui_old/src/__pycache__/service_pb2_grpc.cpython-311.pyc b/gui_old/src/__pycache__/service_pb2_grpc.cpython-311.pyc new file mode 100644 index 0000000..af93c9d Binary files /dev/null and b/gui_old/src/__pycache__/service_pb2_grpc.cpython-311.pyc differ diff --git a/gui/src/client.py b/gui_old/src/client.py similarity index 51% rename from gui/src/client.py rename to gui_old/src/client.py index 208fc05..441444a 100644 --- a/gui/src/client.py +++ b/gui_old/src/client.py @@ -38,6 +38,16 @@ def get_access_point_list(self): access_points = [f"{ap.ssid} - bssid: {ap.bssid}\n" for ap in response.nets] return "Access Points:\n" + "".join(access_points) + def get_networks_list(self): + uuid = self.stub.SnifferList(service_pb2.Empty()).sniffers[0].uuid + request = service_pb2.APGetRequest(sniffer_uuid=uuid) + response = self.stub.AccessPointList(request) + if not response.nets: + return "No networks found." + else: + networks = [str([network.ssid, network.bssid]) for network in response.nets] + return networks + def create_recording(self): uuid = self.stub.SnifferList(service_pb2.Empty()).sniffers[0].uuid request = service_pb2.RecordingCreateRequest( @@ -47,6 +57,17 @@ def create_recording(self): ) response = self.stub.RecordingCreate(request) return str(response) + + def create_APrecording(self, bssid): + uuid = self.stub.SnifferList(service_pb2.Empty()).sniffers[0].uuid + request = service_pb2.APCreateRecordingRequest( + sniffer_uuid=uuid, + name='AccessPoint_recording', + bssid=bssid, + raw=True + ) + response = self.stub.RecordingCreate(request) + return str(response) def get_battery(self): try: @@ -55,3 +76,42 @@ def get_battery(self): return f"{formated_resp}" except grpc._channel._InactiveRpcError as e: return f"Get battery error" + + def start_focus(self, network): + try: + uuid = self.stub.SnifferList(service_pb2.Empty()).sniffers[0].uuid + request = service_pb2.FocusStartRequest( + sniffer_uuid=uuid, + bssid=network + ) + response = self.stub.FocusStart(request) + print(response) + return str(response) + except grpc._channel._InactiveRpcError as e: + print(e) + return f"Start focus error" + + def get_active_focus(self): + try: + uuid = self.stub.SnifferList(service_pb2.Empty()).sniffers[0].uuid + response = self.stub.FocusGetActive(uuid) + return str(response) + except grpc._channel._InactiveRpcError as e: + print(e) + return f"Get active focus error" + + def ignore_AP(self, network): + try: + uuid = self.stub.SnifferList(service_pb2.Empty()).sniffers[0].uuid + request = service_pb2.APIgnoreRequest( + sniffer_uuid=uuid, + use_ssid=False, + bssid=network, + ssid="" + ) + response = self.stub.AccessPointIgnore(request) + return str(response) + except grpc._channel._InactiveRpcError as e: + print(e) + return f"Ignore AP error" + diff --git a/gui_old/src/main.py b/gui_old/src/main.py new file mode 100644 index 0000000..fe4836d --- /dev/null +++ b/gui_old/src/main.py @@ -0,0 +1,340 @@ +import os +import RPi.GPIO as GPIO +import sys +from time import sleep, time +dirname = os.path.dirname(__file__) +sys.path.append(os.path.join(dirname, '..')) +from PIL import Image, ImageDraw, ImageFont +import spidev as SPI +from lib import LCD_2inch4 +import client +import textwrap + +# Constants +RST = 27 +DC = 25 +BL = 18 +BUS = 0 +DEVICE = 0 +FONT_SIZE = 25 + +BUTTON_PINS = { + 17: "ACCEPT", + 22: "REFUSE", + 26: "DOWN", + 13: "LEFT", + 6: "RIGHT", + 5: "UP" +} + +STEALTH_MODE = False + +class Display: + def __init__(self): + self.disp = LCD_2inch4.LCD_2inch4(spi=SPI.SpiDev(BUS, DEVICE), spi_freq=40000000, rst=RST, dc=DC, bl=BL) + self.disp.Init() + self.disp.command(0x36) + self.disp.data(0x20) + self.disp.clear() + self.scrollable = False + self.scroll_offset = 0 + self.horizontal_scroll_offset = 0 + self.current_message = None + self.current_color = "BLACK" + self.current_lines = [] + self.current_font = None + self.battery_font = None + self.current_y = 0 + self.current_text_height = 0 + self.battery_level = "Battery N/A" + + def update_battery_level(self): + try: + self.battery_level = f"{client.get_battery()}" + except Exception: + self.battery_level = "Battery N/A" + self.refresh() + + def show_message(self, message, color="BLACK"): + self.scrollable = False + self.current_message = message + self.current_color = color + size = (320, 240) + background = Image.new("RGB", size, (240, 255, 180)) + draw = ImageDraw.Draw(background) + font = ImageFont.truetype(os.path.join(os.path.dirname(__file__), '../Font/Font02.ttf'), FONT_SIZE) + self.current_font = font + battery_font = ImageFont.truetype(os.path.join(os.path.dirname(__file__), '../Font/Font02.ttf'), FONT_SIZE - 5) + self.battery_font = battery_font + + lines = message.split('\n') + self.current_lines = lines + text_height = len(lines) * FONT_SIZE + self.current_text_height = text_height + + y = (size[1] - text_height) // 2 + 30 + self.current_y = y + self.update_battery_level() + + if text_height > size[1] - 20: + self.current_y = 30 + self.scrollable = True + self.draw_text() + else: + self.scrollable = False + y_offset = y + for line in lines: + draw.text((5, y_offset), line, fill=color, font=font) + y_offset += FONT_SIZE + draw.text((5, 5), self.battery_level, fill="BLACK", font=battery_font) + self.disp.ShowImage(background.rotate(180)) + + def draw_text(self): + size = (320, 240) + background = Image.new("RGB", size, (240, 255, 180)) + draw = ImageDraw.Draw(background) + + y_offset = self.current_y - self.scroll_offset + x_offset = 5 + self.horizontal_scroll_offset + for line in self.current_lines: + draw.text((x_offset, y_offset), line, fill=self.current_color, font=self.current_font) + y_offset += FONT_SIZE + + battery_padding = 10 + battery_text_height = 20 + battery_area_height = battery_text_height + battery_padding + draw.rectangle((0, 0, size[0], battery_area_height), fill=(240, 255, 180)) + + draw.text((5, 5), self.battery_level, fill="BLACK", font=self.battery_font) + + self.disp.ShowImage(background.rotate(180)) + + def refresh(self): + if self.current_message: + self.draw_text() + + def show_list(self, items, selected_index, horizontal_scroll_offset=0): + size = (320, 240) + background = Image.new("RGB", size, (240, 255, 180)) + draw = ImageDraw.Draw(background) + font = ImageFont.truetype(os.path.join(os.path.dirname(__file__), '../Font/Font02.ttf'), FONT_SIZE) + + max_visible_items = size[1] // FONT_SIZE - 2 + if selected_index < self.scroll_offset: + self.scroll_offset = selected_index + elif selected_index >= self.scroll_offset + max_visible_items: + self.scroll_offset = selected_index - max_visible_items + 1 + + for i, item in enumerate(items): + if self.scroll_offset <= i < self.scroll_offset + max_visible_items: + color = "RED" if i == selected_index else "BLACK" + draw.text((10 + horizontal_scroll_offset, 30 + (i - self.scroll_offset) * 30), item, fill=color, font=font) + draw.text((5, 5), self.battery_level, fill="BLACK", font=self.battery_font) + self.disp.ShowImage(background.rotate(180)) + + def clear(self): + self.disp.reset() + self.disp.clear() + +class ListMenu: + def __init__(self, display): + self.display = display + self.stealth_text = "Stealth mode (ON)" if STEALTH_MODE else "Stealth mode (OFF)" + self.items = ["Get sniffer list", "Get access point list", "Focus/Ignore network", "Active focus", "Create recording", "Restart"] + self.selected_index = 0 + self.currently_in = "menu" + + def navigate(self, direction="NONE"): + display.scroll_offset = 0 + if direction == "UP": + self.selected_index = (self.selected_index - 1) % len(self.items) + elif direction == "DOWN": + self.selected_index = (self.selected_index + 1) % len(self.items) + sleep(0.1) + self.display.show_list(self.items, self.selected_index) + self.currently_in = "menu" + + def select(self): + self.currently_in = self.items[self.selected_index] + return self.items[self.selected_index] + +class NetworksList: + def __init__(self, display, networks=[]): + self.display = display + self.items = networks + self.selected_index = 0 + self.selected_bssid = None + self.horizontal_scroll_offset = 0 + + def navigate(self, direction="NONE"): + if direction == "UP": + self.selected_index = (self.selected_index - 1) % len(self.items) + elif direction == "DOWN": + self.selected_index = (self.selected_index + 1) % len(self.items) + elif direction == "LEFT" and self.horizontal_scroll_offset < 0: + self.horizontal_scroll_offset += 40 + elif direction == "RIGHT" and self.horizontal_scroll_offset > -self.get_max_horizontal_scroll(): + self.horizontal_scroll_offset -= 40 + sleep(0.1) + self.display.show_list(self.items, self.selected_index, self.horizontal_scroll_offset) + + def select(self): + return self.items[self.selected_index] + + def get_max_horizontal_scroll(self): + max_length = max([len(item) for item in self.items]) + return max_length * FONT_SIZE - 320 + +class NetworkOptionsList: + def __init__(self, display, selected_bssid=None): + self.display = display + self.items = ["Focus network", "Ignore network"] + self.selected_index = 0 + self.selected_bssid = selected_bssid + + def navigate(self, direction="NONE"): + if direction == "UP": + self.selected_index = (self.selected_index - 1) % len(self.items) + elif direction == "DOWN": + self.selected_index = (self.selected_index + 1) % len(self.items) + sleep(0.1) + self.display.show_list(self.items, self.selected_index) + + def select(self): + return self.items[self.selected_index] + +class ButtonHandler: + def __init__(self, menu, display): + self.menu = menu + self.display = display + self.networks_list = None + self.network_options_list = None + GPIO.setmode(GPIO.BCM) + for pin in BUTTON_PINS.keys(): + GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) + self.action_map = { + "UP": self.handle_up_down, + "DOWN": self.handle_up_down, + "LEFT": self.handle_left_right, + "RIGHT": self.handle_left_right, + "ACCEPT": self.handle_accept, + "REFUSE": self.handle_refuse + } + + def listen(self): + while True: + for pin, action in BUTTON_PINS.items(): + if GPIO.input(pin) == GPIO.HIGH: + if action in self.action_map: + self.action_map[action](action) + + def handle_up_down(self, action): + if self.menu.currently_in == "menu": + self.menu.navigate(action) + elif self.menu.currently_in == "networks": + self.networks_list.navigate(action) + elif self.menu.currently_in == "network_options": + self.network_options_list.navigate(action) + elif self.display.scrollable: + if action == "UP" and self.display.scroll_offset > 0: + self.display.scroll_offset -= 40 + self.display.refresh() + elif action == "DOWN" and self.display.scroll_offset < self.display.current_text_height - 240: + self.display.scroll_offset += 40 + self.display.refresh() + + def handle_left_right(self, action): + if self.menu.currently_in == "networks": + self.networks_list.navigate(action) + elif not self.menu.currently_in in ["menu", "network_options"]: + if action == "LEFT" and self.display.horizontal_scroll_offset < 0: + self.display.horizontal_scroll_offset += 40 + self.display.refresh() + elif action == "RIGHT" and self.display.horizontal_scroll_offset > self.display.current_font.getbbox(self.display.current_message)[1] - 320: + self.display.horizontal_scroll_offset -= 40 + self.display.refresh() + + def handle_accept(self, action): + if self.menu.currently_in == "menu": + selected = self.menu.select() + self.handle_accept_action(selected) + elif self.menu.currently_in == "networks": + selected_network = self.networks_list.select() + self.network_options_list = NetworkOptionsList(self.display, selected_network.split(',')[1].strip(" ']").replace(":", "-")) + self.menu.currently_in = "network_options" + self.network_options_list.navigate() + elif self.menu.currently_in == "network_options": + selected_option = self.network_options_list.select() + self.handle_network_option_action(selected_option, self.network_options_list.selected_bssid) + + def handle_refuse(self, action): + if not self.menu.currently_in == "menu": + self.menu.navigate("NONE") + self.display.scroll_offset = 0 + + def handle_accept_action(self, selected): + if selected == "Get sniffer list": + self.display.show_message(client.get_sniffer_list()) + elif selected == "Get access point list": + self.display.show_message(client.get_access_point_list()) + elif selected == "Create recording": + self.display.show_message(client.create_recording()) + elif selected == "Get battery": + self.display.show_message(client.get_battery()) + elif selected == "Stealth mode" and not STEALTH_MODE: + os.system("systemctl stop hostapd") + self.display.show_message("Stealth mode ENABLED!", "GREEN") + elif selected == "Stealth mode" and STEALTH_MODE: + os.system("systemctl start hostapd") + self.display.show_message("Stealth mode DISABLED!", "GREEN") + elif selected == "Focus/Ignore network": + self.handle_focus_ignore() + elif selected == "Active focus": + self.display.show_message(client.get_active_focus()) + elif selected == "Restart": + self.cleanup() + + def handle_focus_ignore(self): + networks = client.get_networks_list() + self.networks_list = NetworksList(self.display, networks) + self.menu.currently_in = "networks" + self.networks_list.navigate() + + def handle_network_option_action(self, selected_option, bssid): + if selected_option == "Focus network": + self.display.show_message(client.start_focus(bssid)) + elif selected_option == "Ignore network": + self.display.show_message(client.ignore_AP(bssid)) + self.menu.currently_in = "menu" + + def cleanup(self): + self.display.clear() + os.system('sudo reboot') + +if __name__ == "__main__": + try: + display = Display() + menu = ListMenu(display) + button_handler = ButtonHandler(menu, display) + client = client.Client() + for i in range(4): + if not client.is_connected(): + display.show_message("Failed to connect to server! Retrying...", "RED") + sleep(3) + if not client.is_connected(): + display.show_message("Failed to connect to server!", "RED") + sleep(2) + display.clear() + sys.exit() + else: + display.show_message("Connected to sniffer!", "GREEN") + sleep(1) + menu.navigate() + button_handler.listen() + except KeyboardInterrupt: + GPIO.cleanup() + sys.exit() + except RuntimeError as e: + print(f"Runtime error: {e}") + GPIO.cleanup() + sys.exit() \ No newline at end of file diff --git a/gui/src/nodisplay.py b/gui_old/src/nodisplay.py similarity index 100% rename from gui/src/nodisplay.py rename to gui_old/src/nodisplay.py diff --git a/gui_old/src/service_pb2.py b/gui_old/src/service_pb2.py new file mode 100644 index 0000000..6293b59 --- /dev/null +++ b/gui_old/src/service_pb2.py @@ -0,0 +1,167 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: service.proto +# Protobuf Python Version: 5.28.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 28, + 1, + '', + 'service.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x12\x05proto\x1a\x1fgoogle/protobuf/timestamp.proto\"5\n\tRadioInfo\x12\x0c\n\x04rssi\x18\x08 \x01(\x05\x12\r\n\x05noise\x18\t \x01(\x05\x12\x0b\n\x03snr\x18\n \x01(\x05\"\xc2\x01\n\x0c\x43lientWindow\x12)\n\x05start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x03\x65nd\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05\x65nded\x18\x03 \x01(\x08\x12\x11\n\tdecrypted\x18\x04 \x01(\x08\x12\x14\n\x0cpacket_count\x18\x05 \x01(\r\x12\x19\n\x11\x61uth_packet_count\x18\x06 \x01(\r\x12\x0b\n\x03ptk\x18\x07 \x01(\t\"\xae\x02\n\nClientInfo\x12\x0e\n\x06hwaddr\x18\x01 \x01(\t\x12\x10\n\x08hostname\x18\x02 \x01(\t\x12\x0c\n\x04ipv4\x18\x03 \x01(\t\x12\x0c\n\x04ipv6\x18\x04 \x01(\t\x12\x14\n\x0csent_unicast\x18\x05 \x01(\r\x12\x12\n\nsent_total\x18\x06 \x01(\r\x12\x10\n\x08received\x18\x07 \x01(\r\x12$\n\nradio_info\x18\x08 \x01(\x0b\x32\x10.proto.RadioInfo\x12\x12\n\npmf_active\x18\t \x01(\x08\x12\x0e\n\x06router\x18\n \x01(\x08\x12\x1f\n\x17\x63urrent_eapol_pkt_count\x18\x0b \x01(\r\x12$\n\x07windows\x18\x0c \x03(\x0b\x32\x13.proto.ClientWindow\x12\x15\n\rdevice_vendor\x18\r \x01(\t\"\xc1\x01\n\x0bGroupWindow\x12)\n\x05start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x03\x65nd\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05\x65nded\x18\x03 \x01(\x08\x12\x11\n\tdecrypted\x18\x04 \x01(\x08\x12\x14\n\x0cpacket_count\x18\x05 \x01(\r\x12\x19\n\x11\x61uth_packet_count\x18\x06 \x01(\r\x12\x0b\n\x03gtk\x18\x07 \x01(\t\"\xe4\x02\n\x10WiFiStandardInfo\x12 \n\x03std\x18\x01 \x01(\x0e\x32\x13.proto.WiFiStandard\x12!\n\x19single_beamformer_support\x18\x02 \x01(\x08\x12!\n\x19single_beamformee_support\x18\x03 \x01(\x08\x12 \n\x18multi_beamformer_support\x18\x04 \x01(\x08\x12 \n\x18multi_beamformee_support\x18\x05 \x01(\x08\x12\x19\n\x11mcs_supported_idx\x18\x06 \x03(\r\x12/\n\x14modulation_supported\x18\x07 \x03(\x0e\x32\x11.proto.Modulation\x12!\n\x19spatial_streams_supported\x18\x08 \x03(\r\x12\x35\n\x18\x63hannel_widths_supported\x18\t \x03(\x0e\x32\x13.proto.ChannelWidth\"-\n\x0eMulticastGroup\x12\x0c\n\x04\x61\x64\x64r\x18\x01 \x01(\t\x12\r\n\x05\x63ount\x18\x02 \x01(\r\"[\n\x0b\x43hannelInfo\x12\x19\n\x11\x63ontrol_frequency\x18\x01 \x01(\r\x12\x0f\n\x07\x63hannel\x18\x02 \x01(\r\x12 \n\x04type\x18\x03 \x01(\x0e\x32\x12.proto.ChannelType\"\xe5\x03\n\x0f\x41\x63\x63\x65ssPointInfo\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x1e\n\x16\x65ncrypted_packet_count\x18\x03 \x01(\r\x12\x1e\n\x16\x64\x65\x63rypted_packet_count\x18\x04 \x01(\r\x12$\n\nradio_info\x18\x05 \x01(\x0b\x32\x10.proto.RadioInfo\x12\x13\n\x0bpmf_capable\x18\x06 \x01(\x08\x12\x14\n\x0cpmf_required\x18\x07 \x01(\x08\x12-\n\x11supported_chanels\x18\x08 \x03(\x0b\x32\x12.proto.ChannelInfo\x12\x34\n\x13supported_standards\x18\t \x03(\x0b\x32\x17.proto.WiFiStandardInfo\x12/\n\x10multicast_groups\x18\n \x03(\x0b\x32\x15.proto.MulticastGroup\x12(\n\x08security\x18\x0b \x03(\x0e\x32\x16.proto.NetworkSecurity\x12\"\n\x07\x63lients\x18\x0c \x03(\x0b\x32\x11.proto.ClientInfo\x12)\n\rgroup_windows\x18\r \x03(\x0b\x32\x12.proto.GroupWindow\x12\x15\n\rdevice_vendor\x18\x0e \x01(\t\"\x16\n\x03Raw\x12\x0f\n\x07payload\x18\x01 \x01(\x0c\"s\n\x03\x41RP\x12\x19\n\x11sender_ip_address\x18\x01 \x01(\t\x12\x1a\n\x12sender_mac_address\x18\x02 \x01(\t\x12\x19\n\x11target_ip_address\x18\x03 \x01(\t\x12\x1a\n\x12target_mac_address\x18\x04 \x01(\t\"\x99\x01\n\x04ICMP\x12\x1e\n\x04type\x18\x01 \x01(\x0e\x32\x10.proto.ICMP.Type\x12\x0c\n\x04\x63ode\x18\x02 \x01(\r\"c\n\x04Type\x12\x0e\n\nECHO_REPLY\x10\x00\x12\x1b\n\x17\x44\x45STINATION_UNREACHABLE\x10\x03\x12\x10\n\x0c\x45\x43HO_REQUEST\x10\x08\x12\x11\n\rTIME_EXCEEDED\x10\x0b\x12\t\n\x05OTHER\x10\x0c\"\x95\x02\n\x06ICMPv6\x12 \n\x04type\x18\x01 \x01(\x0e\x32\x12.proto.ICMPv6.Type\x12\x0c\n\x04\x63ode\x18\x02 \x01(\r\x12\x10\n\x08\x63hecksum\x18\x03 \x01(\r\"\xc8\x01\n\x04Type\x12\x08\n\x04NONE\x10\x00\x12\x11\n\x0c\x45\x43HO_REQUEST\x10\x80\x01\x12\x0f\n\nECHO_REPLY\x10\x81\x01\x12\x1b\n\x17\x44\x45STINATION_UNREACHABLE\x10\x01\x12\x12\n\x0ePACKET_TOO_BIG\x10\x02\x12\x11\n\rTIME_EXCEEDED\x10\x03\x12\x15\n\x11PARAMETER_PROBLEM\x10\x04\x12\x1a\n\x15NEIGHBOR_SOLICITATION\x10\x87\x01\x12\x1b\n\x16NEIGHBOR_ADVERTISEMENT\x10\x88\x01\"\xd5\x01\n\x03\x44NS\x12\n\n\x02id\x18\x01 \x01(\r\x12\n\n\x02qr\x18\x02 \x01(\x08\x12&\n\tquestions\x18\x03 \x03(\x0b\x32\x13.proto.DNS.Question\x12*\n\x07\x61nswers\x18\x04 \x03(\x0b\x32\x19.proto.DNS.ResourceRecord\x1a&\n\x08Question\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\r\x1a:\n\x0eResourceRecord\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\r\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\x9f\x01\n\x04\x44HCP\x12\x14\n\x0cmessage_type\x18\x01 \x01(\r\x12\x16\n\x0etransaction_id\x18\x02 \x01(\r\x12\x19\n\x11\x63lient_ip_address\x18\x03 \x01(\t\x12\x17\n\x0fyour_ip_address\x18\x04 \x01(\t\x12\x19\n\x11server_ip_address\x18\x05 \x01(\t\x12\x1a\n\x12\x63lient_mac_address\x18\x06 \x01(\t\"\xa8\x01\n\x06\x44HCPv6\x12\x14\n\x0cmessage_type\x18\x01 \x01(\r\x12\x16\n\x0etransaction_id\x18\x02 \x01(\r\x12%\n\x07options\x18\x03 \x03(\x0b\x32\x14.proto.DHCPv6.Option\x1aI\n\x06Option\x12\x13\n\x0boption_code\x18\x01 \x01(\r\x12\x15\n\roption_length\x18\x02 \x01(\r\x12\x13\n\x0boption_data\x18\x03 \x01(\x0c\"\x82\x02\n\x02IP\x12\x16\n\x0esource_address\x18\x01 \x01(\t\x12\x1b\n\x13\x64\x65stination_address\x18\x02 \x01(\t\x12\x0b\n\x03ttl\x18\x03 \x01(\r\x12\x10\n\x08protocol\x18\x04 \x01(\r\x12\x14\n\x0ctotal_length\x18\x05 \x01(\r\x12\x0f\n\x07payload\x18\x06 \x01(\x0c\x12&\n\rnext_protocol\x18\x07 \x01(\x0e\x32\x0f.proto.Protocol\x12\x1b\n\x04icmp\x18\x08 \x01(\x0b\x32\x0b.proto.ICMPH\x00\x12\x19\n\x03tcp\x18\t \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\n \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04next\"\x93\x02\n\x04IPv6\x12\x16\n\x0esource_address\x18\x01 \x01(\t\x12\x1b\n\x13\x64\x65stination_address\x18\x02 \x01(\t\x12\x11\n\thop_limit\x18\x03 \x01(\r\x12\x13\n\x0bnext_header\x18\x04 \x01(\r\x12\x16\n\x0epayload_length\x18\x05 \x01(\r\x12\x0f\n\x07payload\x18\x06 \x01(\x0c\x12&\n\rnext_protocol\x18\x07 \x01(\x0e\x32\x0f.proto.Protocol\x12\x1f\n\x06icmpv6\x18\x08 \x01(\x0b\x32\r.proto.ICMPv6H\x00\x12\x19\n\x03tcp\x18\t \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\n \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04next\"\xa8\x01\n\x03TCP\x12\x13\n\x0bsource_port\x18\x01 \x01(\r\x12\x18\n\x10\x64\x65stination_port\x18\x02 \x01(\r\x12\x17\n\x0fsequence_number\x18\x03 \x01(\r\x12\x1d\n\x15\x61\x63knowledgment_number\x18\x04 \x01(\r\x12\x13\n\x0bwindow_size\x18\x05 \x01(\r\x12\x0b\n\x03syn\x18\x06 \x01(\x08\x12\x0b\n\x03\x61\x63k\x18\x07 \x01(\x08\x12\x0b\n\x03\x66in\x18\x08 \x01(\x08\"\xbd\x01\n\x03UDP\x12\x13\n\x0bsource_port\x18\x01 \x01(\r\x12\x18\n\x10\x64\x65stination_port\x18\x02 \x01(\r\x12&\n\rnext_protocol\x18\x04 \x01(\x0e\x32\x0f.proto.Protocol\x12\x19\n\x03\x64ns\x18\x05 \x01(\x0b\x32\n.proto.DNSH\x00\x12\x1b\n\x04\x64hcp\x18\x06 \x01(\x0b\x32\x0b.proto.DHCPH\x00\x12\x1f\n\x06\x64hcpv6\x18\x07 \x01(\x0b\x32\r.proto.DHCPv6H\x00\x42\x06\n\x04next\"\xb8\x03\n\x06Packet\x12\x30\n\x0c\x63\x61pture_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03src\x18\x02 \x01(\t\x12\x0b\n\x03\x64st\x18\x03 \x01(\t\x12!\n\x08protocol\x18\x04 \x01(\x0e\x32\x0f.proto.Protocol\x12\x19\n\x03raw\x18\x05 \x01(\x0b\x32\n.proto.RawH\x00\x12\x19\n\x03\x61rp\x18\x06 \x01(\x0b\x32\n.proto.ARPH\x00\x12\x1b\n\x04icmp\x18\x07 \x01(\x0b\x32\x0b.proto.ICMPH\x00\x12\x1f\n\x06icmpv6\x18\x08 \x01(\x0b\x32\r.proto.ICMPv6H\x00\x12\x19\n\x03\x64ns\x18\t \x01(\x0b\x32\n.proto.DNSH\x00\x12\x1b\n\x04\x64hcp\x18\n \x01(\x0b\x32\x0b.proto.DHCPH\x00\x12\x1f\n\x06\x64hcpv6\x18\x0b \x01(\x0b\x32\r.proto.DHCPv6H\x00\x12\x17\n\x02ip\x18\x0c \x01(\x0b\x32\t.proto.IPH\x00\x12\x1b\n\x04ipv6\x18\r \x01(\x0b\x32\x0b.proto.IPv6H\x00\x12\x19\n\x03tcp\x18\x0e \x01(\x0b\x32\n.proto.TCPH\x00\x12\x19\n\x03udp\x18\x0f \x01(\x0b\x32\n.proto.UDPH\x00\x42\x06\n\x04\x64\x61ta\"h\n\tRecording\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x10\n\x08\x66ilename\x18\x03 \x01(\t\x12%\n\x08\x64\x61talink\x18\x04 \x01(\x0e\x32\x13.proto.DataLinkType\"\x07\n\x05\x45mpty\"!\n\tSnifferID\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\"]\n\x14SnifferCreateRequest\x12\x15\n\ris_file_based\x18\x01 \x01(\x08\x12\x16\n\x0enet_iface_name\x18\x02 \x01(\t\x12\x16\n\x0erecording_uuid\x18\x03 \x01(\t\";\n\x13SnifferListResponse\x12$\n\x08sniffers\x18\x01 \x03(\x0b\x32\x12.proto.SnifferInfo\"\\\n\x0bSnifferInfo\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x15\n\ris_file_based\x18\x02 \x01(\x08\x12\x16\n\x0enet_iface_name\x18\x03 \x01(\t\x12\x10\n\x08\x66ilename\x18\x04 \x01(\t\"/\n\x10\x42\x61sicNetworkInfo\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"7\n\x0e\x41PListResponse\x12%\n\x04nets\x18\x01 \x03(\x0b\x32\x17.proto.BasicNetworkInfo\"3\n\x0c\x41PGetRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"3\n\rAPGetResponse\x12\"\n\x02\x61p\x18\x01 \x01(\x0b\x32\x16.proto.AccessPointInfo\"Q\n\x18\x41PProvidePasswordRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x10\n\x08password\x18\x03 \x01(\t\"\xc2\x01\n\x19\x41PProvidePasswordResponse\x12?\n\x05state\x18\x01 \x01(\x0e\x32\x30.proto.APProvidePasswordResponse.DecryptionState\"d\n\x0f\x44\x65\x63ryptionState\x12\r\n\tDECRYPTED\x10\x00\x12\x13\n\x0fNOT_ENOUGH_DATA\x10\x01\x12\x16\n\x12INCORRECT_PASSWORD\x10\x02\x12\x15\n\x11\x41LREADY_DECRYPTED\x10\x03\"[\n\x1b\x41PGetDecryptedStreamRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x17\n\x0finclude_payload\x18\x03 \x01(\x08\"6\n\x0f\x41PDeauthRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"Q\n\x15\x41PDeauthClientRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x13\n\x0b\x63lient_addr\x18\x03 \x01(\t\"L\n\x10\x41PGetHashRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\x12\x13\n\x0b\x63lient_addr\x18\x03 \x01(\t\"$\n\x11\x41PGetHashResponse\x12\x0f\n\x07hc22000\x18\x01 \x01(\t\"V\n\x0f\x41PIgnoreRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x10\n\x08use_ssid\x18\x02 \x01(\x08\x12\r\n\x05\x62ssid\x18\x03 \x01(\t\x12\x0c\n\x04ssid\x18\x04 \x01(\t\"Z\n\x18\x41PCreateRecordingRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\r\n\x05\x62ssid\x18\x03 \x01(\t\x12\x0b\n\x03raw\x18\x04 \x01(\x08\"?\n\x19\x41PCreateRecordingResponse\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0cpacket_count\x18\x02 \x01(\r\"8\n\x11\x46ocusStartRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\r\n\x05\x62ssid\x18\x02 \x01(\t\"9\n\x12\x46ocusStartResponse\x12#\n\x07\x63hannel\x18\x01 \x01(\x0b\x32\x12.proto.ChannelInfo\"Z\n\x16\x46ocusGetActiveResponse\x12\r\n\x05\x62ssid\x18\x01 \x01(\t\x12\x0c\n\x04ssid\x18\x02 \x01(\t\x12#\n\x07\x63hannel\x18\x03 \x01(\x0b\x32\x12.proto.ChannelInfo\"I\n\x16RecordingCreateRequest\x12\x14\n\x0csniffer_uuid\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0b\n\x03raw\x18\x03 \x01(\x08\"=\n\x17RecordingCreateResponse\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x14\n\x0cpacket_count\x18\x02 \x01(\r\"B\n\x14RecordingListRequest\x12*\n\rallowed_types\x18\x01 \x03(\x0e\x32\x13.proto.DataLinkType\"=\n\x15RecordingListResponse\x12$\n\nrecordings\x18\x01 \x03(\x0b\x32\x10.proto.Recording\"F\n\x1dRecordingLoadDecryptedRequest\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x17\n\x0finclude_payload\x18\x02 \x01(\x08\".\n\x1cNetworkInterfaceListResponse\x12\x0e\n\x06ifaces\x18\x01 \x03(\t\"\xcf\x01\n\x08LogEntry\x12-\n\ttimestamp\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x05level\x18\x02 \x01(\x0e\x32\x18.proto.LogEntry.LogLevel\x12\r\n\x05scope\x18\x03 \x01(\t\x12\x0f\n\x07payload\x18\x04 \x01(\t\"K\n\x08LogLevel\x12\t\n\x05TRACE\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\x01\x12\x08\n\x04INFO\x10\x02\x12\x08\n\x04WARN\x10\x03\x12\x07\n\x03\x45RR\x10\x04\x12\x0c\n\x08\x43RITICAL\x10\x05\"-\n\x17\x42\x61tteryGetLevelResponse\x12\x12\n\npercentage\x18\x01 \x01(\x02*}\n\x0fNetworkSecurity\x12\x08\n\x04OPEN\x10\x00\x12\x07\n\x03WEP\x10\x01\x12\x07\n\x03WPA\x10\x02\x12\x11\n\rWPA2_Personal\x10\x03\x12\x13\n\x0fWPA2_Enterprise\x10\x04\x12\x11\n\rWPA3_Personal\x10\x05\x12\x13\n\x0fWPA3_Enterprise\x10\x06*X\n\x0cWiFiStandard\x12\n\n\x06\x44ot11A\x10\x00\x12\n\n\x06\x44ot11B\x10\x01\x12\n\n\x06\x44ot11G\x10\x02\x12\n\n\x06\x44ot11N\x10\x03\x12\x0b\n\x07\x44ot11AC\x10\x04\x12\x0b\n\x07\x44ot11AX\x10\x05*X\n\nModulation\x12\x07\n\x03\x43\x43K\x10\x00\x12\x08\n\x04\x42PSK\x10\x01\x12\x08\n\x04QPSK\x10\x02\x12\t\n\x05QAM16\x10\x03\x12\t\n\x05QAM64\x10\x04\x12\n\n\x06QAM256\x10\x05\x12\x0b\n\x07QAM1024\x10\x06*N\n\x0c\x43hannelWidth\x12\n\n\x06\x43HAN20\x10\x00\x12\n\n\x06\x43HAN40\x10\x01\x12\n\n\x06\x43HAN80\x10\x02\x12\r\n\tCHAN80_80\x10\x03\x12\x0b\n\x07\x43HAN160\x10\x04*d\n\x0b\x43hannelType\x12\t\n\x05NO_HT\x10\x00\x12\x08\n\x04HT20\x10\x01\x12\r\n\tHT40MINUS\x10\x02\x12\x0c\n\x08HT40PLUS\x10\x03\x12\t\n\x05VHT80\x10\x04\x12\x0c\n\x08VHT80P80\x10\x05\x12\n\n\x06VHT160\x10\x06*\xb7\x01\n\x08Protocol\x12\r\n\tPROTO_RAW\x10\x00\x12\r\n\tPROTO_ARP\x10\x01\x12\x0e\n\nPROTO_ICMP\x10\x02\x12\x10\n\x0cPROTO_ICMPv6\x10\x03\x12\r\n\tPROTO_DNS\x10\x04\x12\x0e\n\nPROTO_DHCP\x10\x05\x12\x10\n\x0cPROTO_DHCPv6\x10\x06\x12\x0c\n\x08PROTO_IP\x10\x07\x12\x0e\n\nPROTO_IPv6\x10\x08\x12\r\n\tPROTO_TCP\x10\t\x12\r\n\tPROTO_UDP\x10\n*A\n\x0c\x44\x61taLinkType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0c\n\x08RADIOTAP\x10\x01\x12\x0c\n\x08RAW80211\x10\x02\x12\x08\n\x04\x45TH2\x10\x03\x32\xed\x0b\n\x07Sniffer\x12>\n\rSnifferCreate\x12\x1b.proto.SnifferCreateRequest\x1a\x10.proto.SnifferID\x12\x30\n\x0eSnifferDestroy\x12\x10.proto.SnifferID\x1a\x0c.proto.Empty\x12\x37\n\x0bSnifferList\x12\x0c.proto.Empty\x1a\x1a.proto.SnifferListResponse\x12:\n\x0f\x41\x63\x63\x65ssPointList\x12\x10.proto.SnifferID\x1a\x15.proto.APListResponse\x12;\n\x0e\x41\x63\x63\x65ssPointGet\x12\x13.proto.APGetRequest\x1a\x14.proto.APGetResponse\x12_\n\x1a\x41\x63\x63\x65ssPointProvidePassword\x12\x1f.proto.APProvidePasswordRequest\x1a .proto.APProvidePasswordResponse\x12T\n\x1d\x41\x63\x63\x65ssPointGetDecryptedStream\x12\".proto.APGetDecryptedStreamRequest\x1a\r.proto.Packet0\x01\x12\x39\n\x11\x41\x63\x63\x65ssPointDeauth\x12\x16.proto.APDeauthRequest\x1a\x0c.proto.Empty\x12\x45\n\x17\x41\x63\x63\x65ssPointDeauthClient\x12\x1c.proto.APDeauthClientRequest\x1a\x0c.proto.Empty\x12G\n\x12\x41\x63\x63\x65ssPointGetHash\x12\x17.proto.APGetHashRequest\x1a\x18.proto.APGetHashResponse\x12\x39\n\x11\x41\x63\x63\x65ssPointIgnore\x12\x16.proto.APIgnoreRequest\x1a\x0c.proto.Empty\x12\x41\n\x16\x41\x63\x63\x65ssPointListIgnored\x12\x10.proto.SnifferID\x1a\x15.proto.APListResponse\x12_\n\x1a\x41\x63\x63\x65ssPointCreateRecording\x12\x1f.proto.APCreateRecordingRequest\x1a .proto.APCreateRecordingResponse\x12\x41\n\nFocusStart\x12\x18.proto.FocusStartRequest\x1a\x19.proto.FocusStartResponse\x12\x41\n\x0e\x46ocusGetActive\x12\x10.proto.SnifferID\x1a\x1d.proto.FocusGetActiveResponse\x12+\n\tFocusStop\x12\x10.proto.SnifferID\x1a\x0c.proto.Empty\x12P\n\x0fRecordingCreate\x12\x1d.proto.RecordingCreateRequest\x1a\x1e.proto.RecordingCreateResponse\x12J\n\rRecordingList\x12\x1b.proto.RecordingListRequest\x1a\x1c.proto.RecordingListResponse\x12O\n\x16RecordingLoadDecrypted\x12$.proto.RecordingLoadDecryptedRequest\x1a\r.proto.Packet0\x01\x12I\n\x14NetworkInterfaceList\x12\x0c.proto.Empty\x1a#.proto.NetworkInterfaceListResponse\x12/\n\x0cLogGetStream\x12\x0c.proto.Empty\x1a\x0f.proto.LogEntry0\x01\x12?\n\x0f\x42\x61tteryGetLevel\x12\x0c.proto.Empty\x1a\x1e.proto.BatteryGetLevelResponseb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'service_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals['_NETWORKSECURITY']._serialized_start=6608 + _globals['_NETWORKSECURITY']._serialized_end=6733 + _globals['_WIFISTANDARD']._serialized_start=6735 + _globals['_WIFISTANDARD']._serialized_end=6823 + _globals['_MODULATION']._serialized_start=6825 + _globals['_MODULATION']._serialized_end=6913 + _globals['_CHANNELWIDTH']._serialized_start=6915 + _globals['_CHANNELWIDTH']._serialized_end=6993 + _globals['_CHANNELTYPE']._serialized_start=6995 + _globals['_CHANNELTYPE']._serialized_end=7095 + _globals['_PROTOCOL']._serialized_start=7098 + _globals['_PROTOCOL']._serialized_end=7281 + _globals['_DATALINKTYPE']._serialized_start=7283 + _globals['_DATALINKTYPE']._serialized_end=7348 + _globals['_RADIOINFO']._serialized_start=57 + _globals['_RADIOINFO']._serialized_end=110 + _globals['_CLIENTWINDOW']._serialized_start=113 + _globals['_CLIENTWINDOW']._serialized_end=307 + _globals['_CLIENTINFO']._serialized_start=310 + _globals['_CLIENTINFO']._serialized_end=612 + _globals['_GROUPWINDOW']._serialized_start=615 + _globals['_GROUPWINDOW']._serialized_end=808 + _globals['_WIFISTANDARDINFO']._serialized_start=811 + _globals['_WIFISTANDARDINFO']._serialized_end=1167 + _globals['_MULTICASTGROUP']._serialized_start=1169 + _globals['_MULTICASTGROUP']._serialized_end=1214 + _globals['_CHANNELINFO']._serialized_start=1216 + _globals['_CHANNELINFO']._serialized_end=1307 + _globals['_ACCESSPOINTINFO']._serialized_start=1310 + _globals['_ACCESSPOINTINFO']._serialized_end=1795 + _globals['_RAW']._serialized_start=1797 + _globals['_RAW']._serialized_end=1819 + _globals['_ARP']._serialized_start=1821 + _globals['_ARP']._serialized_end=1936 + _globals['_ICMP']._serialized_start=1939 + _globals['_ICMP']._serialized_end=2092 + _globals['_ICMP_TYPE']._serialized_start=1993 + _globals['_ICMP_TYPE']._serialized_end=2092 + _globals['_ICMPV6']._serialized_start=2095 + _globals['_ICMPV6']._serialized_end=2372 + _globals['_ICMPV6_TYPE']._serialized_start=2172 + _globals['_ICMPV6_TYPE']._serialized_end=2372 + _globals['_DNS']._serialized_start=2375 + _globals['_DNS']._serialized_end=2588 + _globals['_DNS_QUESTION']._serialized_start=2490 + _globals['_DNS_QUESTION']._serialized_end=2528 + _globals['_DNS_RESOURCERECORD']._serialized_start=2530 + _globals['_DNS_RESOURCERECORD']._serialized_end=2588 + _globals['_DHCP']._serialized_start=2591 + _globals['_DHCP']._serialized_end=2750 + _globals['_DHCPV6']._serialized_start=2753 + _globals['_DHCPV6']._serialized_end=2921 + _globals['_DHCPV6_OPTION']._serialized_start=2848 + _globals['_DHCPV6_OPTION']._serialized_end=2921 + _globals['_IP']._serialized_start=2924 + _globals['_IP']._serialized_end=3182 + _globals['_IPV6']._serialized_start=3185 + _globals['_IPV6']._serialized_end=3460 + _globals['_TCP']._serialized_start=3463 + _globals['_TCP']._serialized_end=3631 + _globals['_UDP']._serialized_start=3634 + _globals['_UDP']._serialized_end=3823 + _globals['_PACKET']._serialized_start=3826 + _globals['_PACKET']._serialized_end=4266 + _globals['_RECORDING']._serialized_start=4268 + _globals['_RECORDING']._serialized_end=4372 + _globals['_EMPTY']._serialized_start=4374 + _globals['_EMPTY']._serialized_end=4381 + _globals['_SNIFFERID']._serialized_start=4383 + _globals['_SNIFFERID']._serialized_end=4416 + _globals['_SNIFFERCREATEREQUEST']._serialized_start=4418 + _globals['_SNIFFERCREATEREQUEST']._serialized_end=4511 + _globals['_SNIFFERLISTRESPONSE']._serialized_start=4513 + _globals['_SNIFFERLISTRESPONSE']._serialized_end=4572 + _globals['_SNIFFERINFO']._serialized_start=4574 + _globals['_SNIFFERINFO']._serialized_end=4666 + _globals['_BASICNETWORKINFO']._serialized_start=4668 + _globals['_BASICNETWORKINFO']._serialized_end=4715 + _globals['_APLISTRESPONSE']._serialized_start=4717 + _globals['_APLISTRESPONSE']._serialized_end=4772 + _globals['_APGETREQUEST']._serialized_start=4774 + _globals['_APGETREQUEST']._serialized_end=4825 + _globals['_APGETRESPONSE']._serialized_start=4827 + _globals['_APGETRESPONSE']._serialized_end=4878 + _globals['_APPROVIDEPASSWORDREQUEST']._serialized_start=4880 + _globals['_APPROVIDEPASSWORDREQUEST']._serialized_end=4961 + _globals['_APPROVIDEPASSWORDRESPONSE']._serialized_start=4964 + _globals['_APPROVIDEPASSWORDRESPONSE']._serialized_end=5158 + _globals['_APPROVIDEPASSWORDRESPONSE_DECRYPTIONSTATE']._serialized_start=5058 + _globals['_APPROVIDEPASSWORDRESPONSE_DECRYPTIONSTATE']._serialized_end=5158 + _globals['_APGETDECRYPTEDSTREAMREQUEST']._serialized_start=5160 + _globals['_APGETDECRYPTEDSTREAMREQUEST']._serialized_end=5251 + _globals['_APDEAUTHREQUEST']._serialized_start=5253 + _globals['_APDEAUTHREQUEST']._serialized_end=5307 + _globals['_APDEAUTHCLIENTREQUEST']._serialized_start=5309 + _globals['_APDEAUTHCLIENTREQUEST']._serialized_end=5390 + _globals['_APGETHASHREQUEST']._serialized_start=5392 + _globals['_APGETHASHREQUEST']._serialized_end=5468 + _globals['_APGETHASHRESPONSE']._serialized_start=5470 + _globals['_APGETHASHRESPONSE']._serialized_end=5506 + _globals['_APIGNOREREQUEST']._serialized_start=5508 + _globals['_APIGNOREREQUEST']._serialized_end=5594 + _globals['_APCREATERECORDINGREQUEST']._serialized_start=5596 + _globals['_APCREATERECORDINGREQUEST']._serialized_end=5686 + _globals['_APCREATERECORDINGRESPONSE']._serialized_start=5688 + _globals['_APCREATERECORDINGRESPONSE']._serialized_end=5751 + _globals['_FOCUSSTARTREQUEST']._serialized_start=5753 + _globals['_FOCUSSTARTREQUEST']._serialized_end=5809 + _globals['_FOCUSSTARTRESPONSE']._serialized_start=5811 + _globals['_FOCUSSTARTRESPONSE']._serialized_end=5868 + _globals['_FOCUSGETACTIVERESPONSE']._serialized_start=5870 + _globals['_FOCUSGETACTIVERESPONSE']._serialized_end=5960 + _globals['_RECORDINGCREATEREQUEST']._serialized_start=5962 + _globals['_RECORDINGCREATEREQUEST']._serialized_end=6035 + _globals['_RECORDINGCREATERESPONSE']._serialized_start=6037 + _globals['_RECORDINGCREATERESPONSE']._serialized_end=6098 + _globals['_RECORDINGLISTREQUEST']._serialized_start=6100 + _globals['_RECORDINGLISTREQUEST']._serialized_end=6166 + _globals['_RECORDINGLISTRESPONSE']._serialized_start=6168 + _globals['_RECORDINGLISTRESPONSE']._serialized_end=6229 + _globals['_RECORDINGLOADDECRYPTEDREQUEST']._serialized_start=6231 + _globals['_RECORDINGLOADDECRYPTEDREQUEST']._serialized_end=6301 + _globals['_NETWORKINTERFACELISTRESPONSE']._serialized_start=6303 + _globals['_NETWORKINTERFACELISTRESPONSE']._serialized_end=6349 + _globals['_LOGENTRY']._serialized_start=6352 + _globals['_LOGENTRY']._serialized_end=6559 + _globals['_LOGENTRY_LOGLEVEL']._serialized_start=6484 + _globals['_LOGENTRY_LOGLEVEL']._serialized_end=6559 + _globals['_BATTERYGETLEVELRESPONSE']._serialized_start=6561 + _globals['_BATTERYGETLEVELRESPONSE']._serialized_end=6606 + _globals['_SNIFFER']._serialized_start=7351 + _globals['_SNIFFER']._serialized_end=8868 +# @@protoc_insertion_point(module_scope) diff --git a/gui_old/src/service_pb2_grpc.py b/gui_old/src/service_pb2_grpc.py new file mode 100644 index 0000000..2fc7337 --- /dev/null +++ b/gui_old/src/service_pb2_grpc.py @@ -0,0 +1,1006 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + +import service_pb2 as service__pb2 + +GRPC_GENERATED_VERSION = '1.68.1' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + f' but the generated code in service_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + + +class SnifferStub(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SnifferCreate = channel.unary_unary( + '/proto.Sniffer/SnifferCreate', + request_serializer=service__pb2.SnifferCreateRequest.SerializeToString, + response_deserializer=service__pb2.SnifferID.FromString, + _registered_method=True) + self.SnifferDestroy = channel.unary_unary( + '/proto.Sniffer/SnifferDestroy', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.SnifferList = channel.unary_unary( + '/proto.Sniffer/SnifferList', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.SnifferListResponse.FromString, + _registered_method=True) + self.AccessPointList = channel.unary_unary( + '/proto.Sniffer/AccessPointList', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.APListResponse.FromString, + _registered_method=True) + self.AccessPointGet = channel.unary_unary( + '/proto.Sniffer/AccessPointGet', + request_serializer=service__pb2.APGetRequest.SerializeToString, + response_deserializer=service__pb2.APGetResponse.FromString, + _registered_method=True) + self.AccessPointProvidePassword = channel.unary_unary( + '/proto.Sniffer/AccessPointProvidePassword', + request_serializer=service__pb2.APProvidePasswordRequest.SerializeToString, + response_deserializer=service__pb2.APProvidePasswordResponse.FromString, + _registered_method=True) + self.AccessPointGetDecryptedStream = channel.unary_stream( + '/proto.Sniffer/AccessPointGetDecryptedStream', + request_serializer=service__pb2.APGetDecryptedStreamRequest.SerializeToString, + response_deserializer=service__pb2.Packet.FromString, + _registered_method=True) + self.AccessPointDeauth = channel.unary_unary( + '/proto.Sniffer/AccessPointDeauth', + request_serializer=service__pb2.APDeauthRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointDeauthClient = channel.unary_unary( + '/proto.Sniffer/AccessPointDeauthClient', + request_serializer=service__pb2.APDeauthClientRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointGetHash = channel.unary_unary( + '/proto.Sniffer/AccessPointGetHash', + request_serializer=service__pb2.APGetHashRequest.SerializeToString, + response_deserializer=service__pb2.APGetHashResponse.FromString, + _registered_method=True) + self.AccessPointIgnore = channel.unary_unary( + '/proto.Sniffer/AccessPointIgnore', + request_serializer=service__pb2.APIgnoreRequest.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.AccessPointListIgnored = channel.unary_unary( + '/proto.Sniffer/AccessPointListIgnored', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.APListResponse.FromString, + _registered_method=True) + self.AccessPointCreateRecording = channel.unary_unary( + '/proto.Sniffer/AccessPointCreateRecording', + request_serializer=service__pb2.APCreateRecordingRequest.SerializeToString, + response_deserializer=service__pb2.APCreateRecordingResponse.FromString, + _registered_method=True) + self.FocusStart = channel.unary_unary( + '/proto.Sniffer/FocusStart', + request_serializer=service__pb2.FocusStartRequest.SerializeToString, + response_deserializer=service__pb2.FocusStartResponse.FromString, + _registered_method=True) + self.FocusGetActive = channel.unary_unary( + '/proto.Sniffer/FocusGetActive', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.FocusGetActiveResponse.FromString, + _registered_method=True) + self.FocusStop = channel.unary_unary( + '/proto.Sniffer/FocusStop', + request_serializer=service__pb2.SnifferID.SerializeToString, + response_deserializer=service__pb2.Empty.FromString, + _registered_method=True) + self.RecordingCreate = channel.unary_unary( + '/proto.Sniffer/RecordingCreate', + request_serializer=service__pb2.RecordingCreateRequest.SerializeToString, + response_deserializer=service__pb2.RecordingCreateResponse.FromString, + _registered_method=True) + self.RecordingList = channel.unary_unary( + '/proto.Sniffer/RecordingList', + request_serializer=service__pb2.RecordingListRequest.SerializeToString, + response_deserializer=service__pb2.RecordingListResponse.FromString, + _registered_method=True) + self.RecordingLoadDecrypted = channel.unary_stream( + '/proto.Sniffer/RecordingLoadDecrypted', + request_serializer=service__pb2.RecordingLoadDecryptedRequest.SerializeToString, + response_deserializer=service__pb2.Packet.FromString, + _registered_method=True) + self.NetworkInterfaceList = channel.unary_unary( + '/proto.Sniffer/NetworkInterfaceList', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.NetworkInterfaceListResponse.FromString, + _registered_method=True) + self.LogGetStream = channel.unary_stream( + '/proto.Sniffer/LogGetStream', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.LogEntry.FromString, + _registered_method=True) + self.BatteryGetLevel = channel.unary_unary( + '/proto.Sniffer/BatteryGetLevel', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.BatteryGetLevelResponse.FromString, + _registered_method=True) + + +class SnifferServicer(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + def SnifferCreate(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SnifferDestroy(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SnifferList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGet(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointProvidePassword(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGetDecryptedStream(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointDeauth(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointDeauthClient(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointGetHash(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointIgnore(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointListIgnored(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AccessPointCreateRecording(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusStart(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusGetActive(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FocusStop(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingCreate(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordingLoadDecrypted(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def NetworkInterfaceList(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def LogGetStream(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def BatteryGetLevel(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_SnifferServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SnifferCreate': grpc.unary_unary_rpc_method_handler( + servicer.SnifferCreate, + request_deserializer=service__pb2.SnifferCreateRequest.FromString, + response_serializer=service__pb2.SnifferID.SerializeToString, + ), + 'SnifferDestroy': grpc.unary_unary_rpc_method_handler( + servicer.SnifferDestroy, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'SnifferList': grpc.unary_unary_rpc_method_handler( + servicer.SnifferList, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.SnifferListResponse.SerializeToString, + ), + 'AccessPointList': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointList, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.APListResponse.SerializeToString, + ), + 'AccessPointGet': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointGet, + request_deserializer=service__pb2.APGetRequest.FromString, + response_serializer=service__pb2.APGetResponse.SerializeToString, + ), + 'AccessPointProvidePassword': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointProvidePassword, + request_deserializer=service__pb2.APProvidePasswordRequest.FromString, + response_serializer=service__pb2.APProvidePasswordResponse.SerializeToString, + ), + 'AccessPointGetDecryptedStream': grpc.unary_stream_rpc_method_handler( + servicer.AccessPointGetDecryptedStream, + request_deserializer=service__pb2.APGetDecryptedStreamRequest.FromString, + response_serializer=service__pb2.Packet.SerializeToString, + ), + 'AccessPointDeauth': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointDeauth, + request_deserializer=service__pb2.APDeauthRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointDeauthClient': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointDeauthClient, + request_deserializer=service__pb2.APDeauthClientRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointGetHash': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointGetHash, + request_deserializer=service__pb2.APGetHashRequest.FromString, + response_serializer=service__pb2.APGetHashResponse.SerializeToString, + ), + 'AccessPointIgnore': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointIgnore, + request_deserializer=service__pb2.APIgnoreRequest.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'AccessPointListIgnored': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointListIgnored, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.APListResponse.SerializeToString, + ), + 'AccessPointCreateRecording': grpc.unary_unary_rpc_method_handler( + servicer.AccessPointCreateRecording, + request_deserializer=service__pb2.APCreateRecordingRequest.FromString, + response_serializer=service__pb2.APCreateRecordingResponse.SerializeToString, + ), + 'FocusStart': grpc.unary_unary_rpc_method_handler( + servicer.FocusStart, + request_deserializer=service__pb2.FocusStartRequest.FromString, + response_serializer=service__pb2.FocusStartResponse.SerializeToString, + ), + 'FocusGetActive': grpc.unary_unary_rpc_method_handler( + servicer.FocusGetActive, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.FocusGetActiveResponse.SerializeToString, + ), + 'FocusStop': grpc.unary_unary_rpc_method_handler( + servicer.FocusStop, + request_deserializer=service__pb2.SnifferID.FromString, + response_serializer=service__pb2.Empty.SerializeToString, + ), + 'RecordingCreate': grpc.unary_unary_rpc_method_handler( + servicer.RecordingCreate, + request_deserializer=service__pb2.RecordingCreateRequest.FromString, + response_serializer=service__pb2.RecordingCreateResponse.SerializeToString, + ), + 'RecordingList': grpc.unary_unary_rpc_method_handler( + servicer.RecordingList, + request_deserializer=service__pb2.RecordingListRequest.FromString, + response_serializer=service__pb2.RecordingListResponse.SerializeToString, + ), + 'RecordingLoadDecrypted': grpc.unary_stream_rpc_method_handler( + servicer.RecordingLoadDecrypted, + request_deserializer=service__pb2.RecordingLoadDecryptedRequest.FromString, + response_serializer=service__pb2.Packet.SerializeToString, + ), + 'NetworkInterfaceList': grpc.unary_unary_rpc_method_handler( + servicer.NetworkInterfaceList, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.NetworkInterfaceListResponse.SerializeToString, + ), + 'LogGetStream': grpc.unary_stream_rpc_method_handler( + servicer.LogGetStream, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.LogEntry.SerializeToString, + ), + 'BatteryGetLevel': grpc.unary_unary_rpc_method_handler( + servicer.BatteryGetLevel, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.BatteryGetLevelResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'proto.Sniffer', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('proto.Sniffer', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class Sniffer(object): + """The Sniffer service is responsible for capturing data from a file or a + network interface card and relaying the data to clients. + """ + + @staticmethod + def SnifferCreate(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferCreate', + service__pb2.SnifferCreateRequest.SerializeToString, + service__pb2.SnifferID.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def SnifferDestroy(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferDestroy', + service__pb2.SnifferID.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def SnifferList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/SnifferList', + service__pb2.Empty.SerializeToString, + service__pb2.SnifferListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointList', + service__pb2.SnifferID.SerializeToString, + service__pb2.APListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGet(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointGet', + service__pb2.APGetRequest.SerializeToString, + service__pb2.APGetResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointProvidePassword(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointProvidePassword', + service__pb2.APProvidePasswordRequest.SerializeToString, + service__pb2.APProvidePasswordResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGetDecryptedStream(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/AccessPointGetDecryptedStream', + service__pb2.APGetDecryptedStreamRequest.SerializeToString, + service__pb2.Packet.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointDeauth(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointDeauth', + service__pb2.APDeauthRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointDeauthClient(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointDeauthClient', + service__pb2.APDeauthClientRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointGetHash(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointGetHash', + service__pb2.APGetHashRequest.SerializeToString, + service__pb2.APGetHashResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointIgnore(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointIgnore', + service__pb2.APIgnoreRequest.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointListIgnored(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointListIgnored', + service__pb2.SnifferID.SerializeToString, + service__pb2.APListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AccessPointCreateRecording(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/AccessPointCreateRecording', + service__pb2.APCreateRecordingRequest.SerializeToString, + service__pb2.APCreateRecordingResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusStart(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusStart', + service__pb2.FocusStartRequest.SerializeToString, + service__pb2.FocusStartResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusGetActive(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusGetActive', + service__pb2.SnifferID.SerializeToString, + service__pb2.FocusGetActiveResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def FocusStop(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/FocusStop', + service__pb2.SnifferID.SerializeToString, + service__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingCreate(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/RecordingCreate', + service__pb2.RecordingCreateRequest.SerializeToString, + service__pb2.RecordingCreateResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/RecordingList', + service__pb2.RecordingListRequest.SerializeToString, + service__pb2.RecordingListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def RecordingLoadDecrypted(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/RecordingLoadDecrypted', + service__pb2.RecordingLoadDecryptedRequest.SerializeToString, + service__pb2.Packet.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def NetworkInterfaceList(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/NetworkInterfaceList', + service__pb2.Empty.SerializeToString, + service__pb2.NetworkInterfaceListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def LogGetStream(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/proto.Sniffer/LogGetStream', + service__pb2.Empty.SerializeToString, + service__pb2.LogEntry.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def BatteryGetLevel(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/proto.Sniffer/BatteryGetLevel', + service__pb2.Empty.SerializeToString, + service__pb2.BatteryGetLevelResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True)