mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
ui: allow to use multiple protobuffer versions
Protobuffers compiled with protobuf < 3.20.0 are incompatible with protobuf >= 4.0.0: https://github.com/evilsocket/opensnitch/wiki/GUI-known-problems#gui-does-not-show-up This has been a source of problems for some users (#1214, #647), and in some distributions, previous protobuffer does no longer work due to incompatibility with the protobuf package version installed (OpenSuse Tumbleweed). So in order to solve this issue, we provide several protobuffers, for old and new protobuf versions: proto/ui_pb2* for protobuf >= 4.0.0 proto/pre3200/ui_pb2* for protobuf >= 3.6.0 and < 3.20.0 To avoid import errors, each protobuffer must be placed in its own directory, and the name of the protobuffer files must be named with the syntax <prefix>_pb2.py/<prefix>_pb2_grpc.py: ui_pb2.py and ui_pb2_grpc.py The default compiled protobuffer will be opensnitch/proto/ui_*.py instead of opensnitch/ui_*.py
This commit is contained in:
parent
4282fe4ce5
commit
f91f1a9e7b
22 changed files with 2769 additions and 30 deletions
|
@ -1,3 +1,4 @@
|
|||
recursive-include opensnitch/proto *
|
||||
recursive-include opensnitch/res *
|
||||
recursive-include opensnitch/i18n *.qm
|
||||
recursive-include opensnitch/database/migrations *.sql
|
||||
|
|
|
@ -42,9 +42,10 @@ from opensnitch.service import UIService
|
|||
from opensnitch.config import Config
|
||||
from opensnitch.utils import Themes, Utils, Versions, Message
|
||||
from opensnitch.utils.xdg import xdg_opensnitch_dir, xdg_current_session
|
||||
import opensnitch.ui_pb2
|
||||
from opensnitch.ui_pb2_grpc import add_UIServicer_to_server
|
||||
|
||||
from opensnitch import auth
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
app_id = os.path.join(xdg_opensnitch_dir, "io.github.evilsocket.opensnitch")
|
||||
|
||||
|
@ -203,7 +204,7 @@ Examples:
|
|||
('grpc.max_receive_message_length', maxmsglen),
|
||||
))
|
||||
|
||||
add_UIServicer_to_server(service, server)
|
||||
ui_pb2_grpc.add_UIServicer_to_server(service, server)
|
||||
|
||||
auth_type = auth.Simple
|
||||
if args.socket_auth != None:
|
||||
|
|
|
@ -11,10 +11,11 @@ from opensnitch.utils import Icons, Message
|
|||
from opensnitch.config import Config
|
||||
from opensnitch.nodes import Nodes
|
||||
from opensnitch.dialogs.firewall_rule import FwRuleDialog
|
||||
from opensnitch import ui_pb2
|
||||
import opensnitch.firewall as Fw
|
||||
import opensnitch.firewall.profiles as FwProfiles
|
||||
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
DIALOG_UI_PATH = "%s/../res/firewall.ui" % os.path.dirname(sys.modules[__name__].__file__)
|
||||
class FirewallDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
||||
|
|
|
@ -9,10 +9,11 @@ from PyQt5.QtCore import QCoreApplication as QC
|
|||
from opensnitch.config import Config
|
||||
from opensnitch.nodes import Nodes
|
||||
from opensnitch.utils import NetworkServices, NetworkInterfaces, QuickHelp, Icons, Utils
|
||||
from opensnitch import ui_pb2
|
||||
import opensnitch.firewall as Fw
|
||||
from opensnitch.firewall.utils import Utils as FwUtils
|
||||
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
DIALOG_UI_PATH = "%s/../res/firewall_rule.ui" % os.path.dirname(sys.modules[__name__].__file__)
|
||||
class FwRuleDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
||||
|
|
|
@ -14,7 +14,9 @@ from opensnitch.utils import Message, QuickHelp, Themes, Icons, languages
|
|||
from opensnitch.utils.xdg import Autostart
|
||||
from opensnitch.notifications import DesktopNotifications
|
||||
|
||||
from opensnitch import ui_pb2, auth
|
||||
from opensnitch import auth
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
DIALOG_UI_PATH = "%s/../res/preferences.ui" % os.path.dirname(sys.modules[__name__].__file__)
|
||||
class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
||||
|
|
|
@ -4,7 +4,9 @@ import json
|
|||
|
||||
from PyQt5 import QtCore, QtGui, uic, QtWidgets
|
||||
|
||||
from opensnitch import ui_pb2
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
from opensnitch.nodes import Nodes
|
||||
from opensnitch.desktop_parser import LinuxDesktopParser
|
||||
from opensnitch.utils import Message, Icons
|
||||
|
|
|
@ -20,7 +20,8 @@ from opensnitch.version import version
|
|||
from opensnitch.actions import Actions
|
||||
from opensnitch.rules import Rules, Rule
|
||||
|
||||
from opensnitch import ui_pb2
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
DIALOG_UI_PATH = "%s/../res/prompt.ui" % os.path.dirname(sys.modules[__name__].__file__)
|
||||
class PromptDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
||||
|
|
|
@ -7,10 +7,12 @@ import re
|
|||
import sys
|
||||
import os
|
||||
import pwd
|
||||
from opensnitch import ui_pb2
|
||||
import time
|
||||
import ipaddress
|
||||
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
from opensnitch.config import Config
|
||||
from opensnitch.nodes import Nodes
|
||||
from opensnitch.database import Database
|
||||
|
|
|
@ -8,7 +8,6 @@ import io
|
|||
from PyQt5 import QtCore, QtGui, uic, QtWidgets
|
||||
from PyQt5.QtCore import QCoreApplication as QC
|
||||
|
||||
from opensnitch import ui_pb2
|
||||
from opensnitch.config import Config
|
||||
from opensnitch.version import version
|
||||
from opensnitch.nodes import Nodes
|
||||
|
@ -27,6 +26,9 @@ from opensnitch.utils.xdg import xdg_current_desktop
|
|||
from opensnitch.actions import Actions
|
||||
from opensnitch.rules import Rule, Rules
|
||||
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
DIALOG_UI_PATH = "%s/../res/stats.ui" % os.path.dirname(sys.modules[__name__].__file__)
|
||||
class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from PyQt5.QtCore import QObject, QCoreApplication as QC
|
||||
from google.protobuf import json_format
|
||||
from opensnitch import ui_pb2
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
from opensnitch.nodes import Nodes
|
||||
from .enums import *
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
from opensnitch import ui_pb2
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
from .enums import *
|
||||
|
||||
class Chains():
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
from opensnitch import ui_pb2
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
from .enums import *
|
||||
|
||||
class Expr():
|
||||
|
|
|
@ -3,7 +3,9 @@ from PyQt5.QtCore import QCoreApplication as QC
|
|||
from google.protobuf.json_format import MessageToJson
|
||||
import uuid
|
||||
|
||||
from opensnitch import ui_pb2
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
from .enums import Operator
|
||||
from .exprs import ExprLog
|
||||
|
||||
|
|
|
@ -4,12 +4,14 @@ from datetime import datetime
|
|||
import time
|
||||
import json
|
||||
|
||||
from opensnitch import ui_pb2
|
||||
from opensnitch.database import Database
|
||||
from opensnitch.config import Config
|
||||
from opensnitch.utils import NetworkInterfaces
|
||||
from opensnitch.rules import Rules
|
||||
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
class Nodes(QObject):
|
||||
__instance = None
|
||||
nodesUpdated = pyqtSignal(int) # total
|
||||
|
|
57
ui/opensnitch/proto/__init__.py
Normal file
57
ui/opensnitch/proto/__init__.py
Normal file
|
@ -0,0 +1,57 @@
|
|||
# Copyright (C) 2018 Simone Margaritelli
|
||||
# 2019-2025 Gustavo Iñiguez Goia
|
||||
#
|
||||
# This file is part of OpenSnitch.
|
||||
#
|
||||
# OpenSnitch is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OpenSnitch is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenSnitch. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from packaging.version import Version
|
||||
import importlib
|
||||
from opensnitch.utils import Versions
|
||||
|
||||
# Protobuffers compiled with protobuf < 3.20.0 are incompatible with
|
||||
# protobuf >= 4.0.0
|
||||
# https://github.com/evilsocket/opensnitch/wiki/GUI-known-problems#gui-does-not-show-up
|
||||
#
|
||||
# In order to solve this issue, we provide several protobuffers:
|
||||
# proto.ui_pb2* for protobuf >= 4.0.0
|
||||
# proto.pre3200.ui_pb2* for protobuf >= 3.6.0 and < 3.20.0
|
||||
#
|
||||
# To avoid import errors, each protobuffer must be placed in its own directory,
|
||||
# and the name of the protobuffer files must be named with the syntax
|
||||
# <prefix>_pb2.py/<prefix>_pb2_grpc.py:
|
||||
# ui_pb2.py and ui_pb2_grpc.py
|
||||
|
||||
default_pb = "opensnitch.proto.ui_pb2"
|
||||
default_grpc = "opensnitch.proto.ui_pb2_grpc"
|
||||
old_pb = "opensnitch.proto.pre3200.ui_pb2"
|
||||
old_grpc = "opensnitch.proto.pre3200.ui_pb2_grpc"
|
||||
|
||||
def import_():
|
||||
"""load the protobuffer needed based on the grpc and protobuffer version
|
||||
installed in the system.
|
||||
"""
|
||||
try:
|
||||
gui_version, grpc_version, proto_version = Versions.get()
|
||||
proto_ver = default_pb
|
||||
grpc_ver = default_grpc
|
||||
|
||||
if Version(proto_version) < Version("3.20.0"):
|
||||
proto_ver = old_pb
|
||||
grpc_ver = old_grpc
|
||||
|
||||
return importlib.import_module(proto_ver), importlib.import_module(grpc_ver)
|
||||
except Exception as e:
|
||||
print("error importing protobuffer: ", repr(e))
|
||||
return importlib.import_module(default_pb, default_grpc)
|
2247
ui/opensnitch/proto/pre3200/ui_pb2.py
Normal file
2247
ui/opensnitch/proto/pre3200/ui_pb2.py
Normal file
File diff suppressed because one or more lines are too long
114
ui/opensnitch/proto/pre3200/ui_pb2_grpc.py
Normal file
114
ui/opensnitch/proto/pre3200/ui_pb2_grpc.py
Normal file
|
@ -0,0 +1,114 @@
|
|||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
import grpc
|
||||
|
||||
from . import ui_pb2 as ui__pb2
|
||||
|
||||
|
||||
class UIStub(object):
|
||||
# missing associated documentation comment in .proto file
|
||||
pass
|
||||
|
||||
def __init__(self, channel):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
"""
|
||||
self.Ping = channel.unary_unary(
|
||||
'/protocol.UI/Ping',
|
||||
request_serializer=ui__pb2.PingRequest.SerializeToString,
|
||||
response_deserializer=ui__pb2.PingReply.FromString,
|
||||
)
|
||||
self.AskRule = channel.unary_unary(
|
||||
'/protocol.UI/AskRule',
|
||||
request_serializer=ui__pb2.Connection.SerializeToString,
|
||||
response_deserializer=ui__pb2.Rule.FromString,
|
||||
)
|
||||
self.Subscribe = channel.unary_unary(
|
||||
'/protocol.UI/Subscribe',
|
||||
request_serializer=ui__pb2.ClientConfig.SerializeToString,
|
||||
response_deserializer=ui__pb2.ClientConfig.FromString,
|
||||
)
|
||||
self.Notifications = channel.stream_stream(
|
||||
'/protocol.UI/Notifications',
|
||||
request_serializer=ui__pb2.NotificationReply.SerializeToString,
|
||||
response_deserializer=ui__pb2.Notification.FromString,
|
||||
)
|
||||
self.PostAlert = channel.unary_unary(
|
||||
'/protocol.UI/PostAlert',
|
||||
request_serializer=ui__pb2.Alert.SerializeToString,
|
||||
response_deserializer=ui__pb2.MsgResponse.FromString,
|
||||
)
|
||||
|
||||
|
||||
class UIServicer(object):
|
||||
# missing associated documentation comment in .proto file
|
||||
pass
|
||||
|
||||
def Ping(self, request, context):
|
||||
# missing associated documentation comment in .proto file
|
||||
pass
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def AskRule(self, request, context):
|
||||
# missing associated documentation comment in .proto file
|
||||
pass
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def Subscribe(self, request, context):
|
||||
# missing associated documentation comment in .proto file
|
||||
pass
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def Notifications(self, request_iterator, context):
|
||||
# missing associated documentation comment in .proto file
|
||||
pass
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def PostAlert(self, request, context):
|
||||
# missing associated documentation comment in .proto file
|
||||
pass
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
|
||||
def add_UIServicer_to_server(servicer, server):
|
||||
rpc_method_handlers = {
|
||||
'Ping': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Ping,
|
||||
request_deserializer=ui__pb2.PingRequest.FromString,
|
||||
response_serializer=ui__pb2.PingReply.SerializeToString,
|
||||
),
|
||||
'AskRule': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.AskRule,
|
||||
request_deserializer=ui__pb2.Connection.FromString,
|
||||
response_serializer=ui__pb2.Rule.SerializeToString,
|
||||
),
|
||||
'Subscribe': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Subscribe,
|
||||
request_deserializer=ui__pb2.ClientConfig.FromString,
|
||||
response_serializer=ui__pb2.ClientConfig.SerializeToString,
|
||||
),
|
||||
'Notifications': grpc.stream_stream_rpc_method_handler(
|
||||
servicer.Notifications,
|
||||
request_deserializer=ui__pb2.NotificationReply.FromString,
|
||||
response_serializer=ui__pb2.Notification.SerializeToString,
|
||||
),
|
||||
'PostAlert': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.PostAlert,
|
||||
request_deserializer=ui__pb2.Alert.FromString,
|
||||
response_serializer=ui__pb2.MsgResponse.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
'protocol.UI', rpc_method_handlers)
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
110
ui/opensnitch/proto/ui_pb2.py
Normal file
110
ui/opensnitch/proto/ui_pb2.py
Normal file
File diff suppressed because one or more lines are too long
198
ui/opensnitch/proto/ui_pb2_grpc.py
Normal file
198
ui/opensnitch/proto/ui_pb2_grpc.py
Normal file
|
@ -0,0 +1,198 @@
|
|||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
"""Client and server classes corresponding to protobuf-defined services."""
|
||||
import grpc
|
||||
|
||||
from . import ui_pb2 as ui__pb2
|
||||
|
||||
|
||||
class UIStub(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def __init__(self, channel):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
"""
|
||||
self.Ping = channel.unary_unary(
|
||||
'/protocol.UI/Ping',
|
||||
request_serializer=ui__pb2.PingRequest.SerializeToString,
|
||||
response_deserializer=ui__pb2.PingReply.FromString,
|
||||
)
|
||||
self.AskRule = channel.unary_unary(
|
||||
'/protocol.UI/AskRule',
|
||||
request_serializer=ui__pb2.Connection.SerializeToString,
|
||||
response_deserializer=ui__pb2.Rule.FromString,
|
||||
)
|
||||
self.Subscribe = channel.unary_unary(
|
||||
'/protocol.UI/Subscribe',
|
||||
request_serializer=ui__pb2.ClientConfig.SerializeToString,
|
||||
response_deserializer=ui__pb2.ClientConfig.FromString,
|
||||
)
|
||||
self.Notifications = channel.stream_stream(
|
||||
'/protocol.UI/Notifications',
|
||||
request_serializer=ui__pb2.NotificationReply.SerializeToString,
|
||||
response_deserializer=ui__pb2.Notification.FromString,
|
||||
)
|
||||
self.PostAlert = channel.unary_unary(
|
||||
'/protocol.UI/PostAlert',
|
||||
request_serializer=ui__pb2.Alert.SerializeToString,
|
||||
response_deserializer=ui__pb2.MsgResponse.FromString,
|
||||
)
|
||||
|
||||
|
||||
class UIServicer(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def Ping(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 AskRule(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 Subscribe(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 Notifications(self, request_iterator, 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 PostAlert(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_UIServicer_to_server(servicer, server):
|
||||
rpc_method_handlers = {
|
||||
'Ping': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Ping,
|
||||
request_deserializer=ui__pb2.PingRequest.FromString,
|
||||
response_serializer=ui__pb2.PingReply.SerializeToString,
|
||||
),
|
||||
'AskRule': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.AskRule,
|
||||
request_deserializer=ui__pb2.Connection.FromString,
|
||||
response_serializer=ui__pb2.Rule.SerializeToString,
|
||||
),
|
||||
'Subscribe': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Subscribe,
|
||||
request_deserializer=ui__pb2.ClientConfig.FromString,
|
||||
response_serializer=ui__pb2.ClientConfig.SerializeToString,
|
||||
),
|
||||
'Notifications': grpc.stream_stream_rpc_method_handler(
|
||||
servicer.Notifications,
|
||||
request_deserializer=ui__pb2.NotificationReply.FromString,
|
||||
response_serializer=ui__pb2.Notification.SerializeToString,
|
||||
),
|
||||
'PostAlert': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.PostAlert,
|
||||
request_deserializer=ui__pb2.Alert.FromString,
|
||||
response_serializer=ui__pb2.MsgResponse.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
'protocol.UI', rpc_method_handlers)
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
||||
|
||||
|
||||
# This class is part of an EXPERIMENTAL API.
|
||||
class UI(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
@staticmethod
|
||||
def Ping(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, '/protocol.UI/Ping',
|
||||
ui__pb2.PingRequest.SerializeToString,
|
||||
ui__pb2.PingReply.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def AskRule(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, '/protocol.UI/AskRule',
|
||||
ui__pb2.Connection.SerializeToString,
|
||||
ui__pb2.Rule.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Subscribe(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, '/protocol.UI/Subscribe',
|
||||
ui__pb2.ClientConfig.SerializeToString,
|
||||
ui__pb2.ClientConfig.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Notifications(request_iterator,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.stream_stream(request_iterator, target, '/protocol.UI/Notifications',
|
||||
ui__pb2.NotificationReply.SerializeToString,
|
||||
ui__pb2.Notification.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def PostAlert(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, '/protocol.UI/PostAlert',
|
||||
ui__pb2.Alert.SerializeToString,
|
||||
ui__pb2.MsgResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@ -1,10 +1,12 @@
|
|||
from PyQt5.QtCore import QObject, pyqtSignal
|
||||
|
||||
from opensnitch import ui_pb2
|
||||
from opensnitch.database import Database
|
||||
from opensnitch.database.enums import RuleFields
|
||||
from opensnitch.config import Config
|
||||
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
import os
|
||||
import json
|
||||
from slugify import slugify
|
||||
|
|
|
@ -12,8 +12,8 @@ import copy
|
|||
path = os.path.abspath(os.path.dirname(__file__))
|
||||
sys.path.append(path)
|
||||
|
||||
from opensnitch import ui_pb2
|
||||
from opensnitch import ui_pb2_grpc
|
||||
import opensnitch.proto as proto
|
||||
ui_pb2, ui_pb2_grpc = proto.import_()
|
||||
|
||||
from opensnitch.dialogs.prompt import PromptDialog
|
||||
from opensnitch.dialogs.stats import StatsDialog
|
||||
|
|
|
@ -6,32 +6,21 @@
|
|||
%:
|
||||
dh $@ --with python3 --buildsystem=python_distutils
|
||||
|
||||
|
||||
override_dh_auto_clean:
|
||||
rm -f opensnitch/resources_rc.py
|
||||
rm -rf opensnitch/i18n/
|
||||
python3 setup.py clean -a
|
||||
find . -name \*.pyc -exec rm {} \;
|
||||
|
||||
|
||||
|
||||
override_dh_auto_build:
|
||||
python3 setup.py build --force
|
||||
|
||||
|
||||
|
||||
override_dh_auto_install:
|
||||
cd i18n; make
|
||||
cp -r i18n/locales/ opensnitch/i18n/
|
||||
pyrcc5 -o opensnitch/resources_rc.py opensnitch/res/resources.qrc
|
||||
sed -i 's/^import ui_pb2/from . import ui_pb2/' opensnitch/ui_pb2*
|
||||
find opensnitch/proto/ -name 'ui_pb2_grpc.py' -exec sed -i 's/^import ui_pb2/from . import ui_pb2/' {} \;
|
||||
python3 setup.py install --force --root=debian/python3-opensnitch-ui --no-compile -O0 --install-layout=deb
|
||||
|
||||
|
||||
|
||||
override_dh_python2:
|
||||
dh_python2 --no-guessing-versions
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue