Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mobile-sec-notifier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tumbul, Erwin
mobile-sec-notifier
Commits
7bdbe960
Commit
7bdbe960
authored
3 years ago
by
Tumbul, Erwin
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/main' into feature/android_client
parents
6c4eaa1d
9d8a4ae2
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/python/client.py
+4
-4
4 additions, 4 deletions
client/python/client.py
protocol.md
+5
-5
5 additions, 5 deletions
protocol.md
server/server.py
+6
-5
6 additions, 5 deletions
server/server.py
with
15 additions
and
14 deletions
client/python/client.py
+
4
−
4
View file @
7bdbe960
...
@@ -5,7 +5,7 @@ sys.path.insert(0, '../../shared/netcode')
...
@@ -5,7 +5,7 @@ sys.path.insert(0, '../../shared/netcode')
import
queue
import
queue
import
grpc
import
grpc
from
shared.netcode.netcode_pb2
import
*
from
shared.netcode.netcode_pb2
import
*
from
shared.netcode.netcode_pb2_grpc
import
NotifierComStub
from
shared.netcode.netcode_pb2_grpc
import
NotifierCom
munication
Stub
usage
=
"
Usage:
\n
- Sender:
\n
./client.py 1
\n
- Receiver:
\n
./client.py 0
"
usage
=
"
Usage:
\n
- Sender:
\n
./client.py 1
\n
- Receiver:
\n
./client.py 0
"
...
@@ -38,10 +38,10 @@ if __name__ == "__main__":
...
@@ -38,10 +38,10 @@ if __name__ == "__main__":
print
(
"
Error: Connection to server failed.
"
)
print
(
"
Error: Connection to server failed.
"
)
exit
(
1
)
exit
(
1
)
stub
=
NotifierComStub
(
channel
)
stub
=
NotifierCom
munication
Stub
(
channel
)
if
is_sender
:
if
is_sender
:
response
=
stub
.
Open
Comm
(
Open
Comm
Request
(
challeng
e
=
1
))
response
=
stub
.
Open
(
OpenRequest
(
id_cod
e
=
1
))
print
(
response
)
print
(
response
)
sendQueue
=
queue
.
SimpleQueue
()
sendQueue
=
queue
.
SimpleQueue
()
...
@@ -58,7 +58,7 @@ if __name__ == "__main__":
...
@@ -58,7 +58,7 @@ if __name__ == "__main__":
sendQueue
.
put_nowait
(
Message
(
content
=
text
))
sendQueue
.
put_nowait
(
Message
(
content
=
text
))
else
:
else
:
response
=
stub
.
Answer
Comm
(
Answer
Comm
Request
(
challenge
=
1
))
response
=
stub
.
Answer
(
AnswerRequest
(
challenge
=
1
))
print
(
response
)
print
(
response
)
for
message
in
stub
.
ReceiveMessage
(
Nothing
()):
for
message
in
stub
.
ReceiveMessage
(
Nothing
()):
...
...
This diff is collapsed.
Click to expand it.
protocol.md
+
5
−
5
View file @
7bdbe960
...
@@ -7,12 +7,12 @@
...
@@ -7,12 +7,12 @@
1.
Authenticate to the server and establish communication.
1.
Authenticate to the server and establish communication.
1.
A tells the server to open a communication.
1.
A tells the server to open a communication.
2.
A sends an id_code to the server.
2.
A sends an id_code to the server.
3.
A gets a comm_id from the server.
3.
If someone answered with the same id_code,
A gets a comm_id from the server.
2.
B tells the server to answer A's communication request.
2.
B tells the server to answer A's communication request.
1.
B receives A's challenge.
2.
B sends A's id_code to the server.
2.
B answers the solution to the server.
3.
The server checks if it matches and returns a comm_id to B.
3.
The server checks the solution and accepts the communication establishment.
2.
Generate and exchange an ephemeral key.
2.
Generate and exchange an ephemeral key.
1.
A and B generate a RSA key-pair.
3.
Instantiate symmetric encryption using the ephemeral key.
3.
Instantiate symmetric encryption using the ephemeral key.
4.
Authenticate each other directly.
4.
Authenticate each other directly.
5.
(?) Check communication transcript (avoid malicious server).
5.
(?) Check communication transcript (avoid malicious server).
This diff is collapsed.
Click to expand it.
server/server.py
+
6
−
5
View file @
7bdbe960
...
@@ -7,32 +7,33 @@ from shared.netcode.netcode_pb2 import *
...
@@ -7,32 +7,33 @@ from shared.netcode.netcode_pb2 import *
from
shared.netcode.netcode_pb2_grpc
import
*
from
shared.netcode.netcode_pb2_grpc
import
*
class
NotifierService
(
NotifierComServicer
):
class
NotifierService
(
NotifierCom
munication
Servicer
):
def
Open
Comm
(
self
,
request
,
context
):
def
Open
(
self
,
request
,
context
):
# TODO: append id_code to list
# TODO: append id_code to list
# TODO: wait for id_code answered
# TODO: wait for id_code answered
# TODO: return comm_id
# TODO: return comm_id
return
CommResponse
()
return
CommResponse
()
def
Answer
Comm
(
self
,
request
,
context
):
def
Answer
(
self
,
request
,
context
):
# TODO: check if if_code can be answered
# TODO: check if if_code can be answered
# TODO: return comm_id
# TODO: return comm_id
return
CommResponse
()
return
CommResponse
()
def
ReceiveMessage
(
self
,
request
,
context
):
def
ReceiveMessage
(
self
,
request
,
context
):
# TODO: read comm_id and wait for messages
# TODO: read comm_id and wait for messages
yield
Message
(
content
=
"
test
"
)
yield
Message
(
comm_id
=-
1
,
content
=
"
test
"
)
def
SendMessage
(
self
,
request_iterator
,
context
):
def
SendMessage
(
self
,
request_iterator
,
context
):
for
msg
in
request_iterator
:
for
msg
in
request_iterator
:
# TODO: read comm_id and route message
# TODO: read comm_id and route message
print
(
msg
.
comm_id
)
print
(
msg
.
content
)
print
(
msg
.
content
)
return
Nothing
()
return
Nothing
()
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
server
=
grpc
.
server
(
futures
.
ThreadPoolExecutor
(
max_workers
=
10
))
server
=
grpc
.
server
(
futures
.
ThreadPoolExecutor
(
max_workers
=
10
))
add_NotifierComServicer_to_server
(
add_NotifierCom
munication
Servicer_to_server
(
NotifierService
(),
server
)
NotifierService
(),
server
)
server
.
add_insecure_port
(
'
[::]:8080
'
)
server
.
add_insecure_port
(
'
[::]:8080
'
)
server
.
start
()
server
.
start
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment