-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Master2022E/3-setup-selenium-automation-test
Setup selenium automation test
- Loading branch information
Showing
16 changed files
with
539 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Capturing non encrypted RTP packets from a WebRTC session | ||
Following this [guide](https://blog.mozilla.org/webrtc/debugging-encrypted-rtp-is-more-fun-than-it-used-to-be/) | ||
for setting up firefox (ff) or the same procedure for the ff geckodriver. | ||
You would want to set these logging settings: | ||
|
||
``` | ||
Current Log Modules to timestamp,signaling:5,jsep:5,RtpLogger:5 | ||
The log file name to: /tmp/logs/moz.log | ||
``` | ||
They can be set as env variables or from this [configuration](about:networking#logging) page in firefox. | ||
|
||
Then you can start a webrtc session and find the log files that you set. | ||
When you have found the log files you can use the command: | ||
|
||
```shell | ||
egrep '(RTP_PACKET|RTCP_PACKET)' moz.log | cut -d '|' -f 2 | cut -d ' ' -f 5- | text2pcap -D -n -l 1 -i 17 -u 1234,1235 -t '%H:%M:%S.' - rtp_packets.pcap | ||
``` | ||
|
||
To obtain a pcap file with the RTP packets. The packets do not show any jitter or loss, | ||
but it is possible to see the RTP headers. | ||
|
||
The example packet file is from a webrtc session between a test client using ff and normal ff browser. | ||
The ff test client browser was running on an ubuntu VM with the ff geckodriver. | ||
The webrtc session was initiated from the normal ff browser. | ||
|
||
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
## Fake video and audio stream | ||
|
||
To simulate a Video and audio call, we create a fake webcame and microphone, which the browser can get as a input stream and use for the WebRTC stream/application. See the script [**setup_fake_webcam.sh**](../client_scripts/setup_fake_webcam.sh) for setting it up in ubuntu. | ||
|
||
The script requires an input video which can be fetched from the script [**get_bigbunny_video.sh**](../client_scripts/get_bigbunny_video.sh). | ||
|
||
To make sure that the selenium script uses the correct "fake" microphone, we need to make sure that any other microphone is disabled. In the VM running ubuntu it can be done by following the solution [here](https://askubuntu.com/questions/146654/how-can-i-completely-disable-internal-mic-and-webcam), by blacklisting "snd_hda_intel". | ||
|
||
## Development | ||
|
||
When developing in a VM with ssh in vs code, you can enable x11 Forwarding, by running an ssh session in another terminal window by running the command: | ||
|
||
```shell | ||
ssh -X user@VM | ||
``` | ||
|
||
|
||
|
||
|
||
## Tor and Firefox setup | ||
|
||
The client should have installed and setup a running instance of tor. | ||
See the script [**setup_tor.sh**](../client_scripts/setup_tor.sh) for ubuntu instructions | ||
|
||
We also need to install firefox, which the geckodriver uses. This should also be in the script. | ||
|
||
Now the following command should show the install path of firefox: | ||
|
||
```shell | ||
$ which firefox | ||
/usr/bin/firefox | ||
``` | ||
|
||
Because of the possible privacy leaks in using STUN and WebRTC, WebRTC has been disabled from the Tor Browser. So the project uses the firefox Browser, and sets the proxy settings to point at the local Tor proxy. A ff addon is needed for quick access to setting the Tor proxy. The [addon](https://addons.mozilla.org/en-US/firefox/addon/tortm-browser-button/) simply adds a button for toggling the tor proxy on and off. This can be used when testing manually in the browser. | ||
|
||
 | ||
|
||
When setting up the addon, it will ask for permisson to also run in "Private Window", press Allow and press Okay. | ||
|
||
 | ||
|
||
When the addon has been added, you simply need to press start and wait for the "Connected to 127.0.0.1:9050" message. Now you are connected to the Tor network. | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from stem import CircStatus | ||
from stem.control import Controller | ||
from hurry.filesize import size | ||
|
||
with Controller.from_port(port = 9051) as controller: | ||
controller.authenticate("kode112") | ||
|
||
bytes_read = controller.get_info("traffic/read") | ||
bytes_written = controller.get_info("traffic/written") | ||
traffic_downloaded = size(int(bytes_read)) | ||
traffic_uploaded = size(int(bytes_written)) | ||
|
||
print("I have downloaded:",traffic_downloaded,"\nI Have uploaded: ",traffic_uploaded) | ||
|
||
for circ in sorted(controller.get_circuits()): | ||
if circ.status != CircStatus.BUILT: | ||
continue | ||
|
||
print("") | ||
print("Circuit %s (%s)" % (circ.id, circ.purpose)) | ||
|
||
|
||
for i, entry in enumerate(circ.path): | ||
div = '+' if (i == len(circ.path) - 1) else '|' | ||
fingerprint, nickname = entry | ||
|
||
desc = controller.get_network_status(fingerprint, None) | ||
address = desc.address if desc else 'unknown' | ||
|
||
print(" %s- %s (%s, %s)" % (div, fingerprint, nickname, address)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import functools | ||
|
||
from stem import StreamStatus | ||
from stem.control import EventType, Controller | ||
|
||
def main(): | ||
print("Tracking requests for tor exits. Press 'enter' to end.") | ||
print("") | ||
|
||
with Controller.from_port(port=9051) as controller: | ||
controller.authenticate("kode112") | ||
|
||
stream_listener = functools.partial(stream_event, controller) | ||
controller.add_event_listener(stream_listener, EventType.STREAM) | ||
|
||
input() # wait for user to press enter | ||
|
||
|
||
def stream_event(controller, event): | ||
if event.status == StreamStatus.SUCCEEDED and event.circ_id: | ||
circ = controller.get_circuit(event.circ_id) | ||
|
||
exit_fingerprint = circ.path[-1][0] | ||
exit_relay = controller.get_network_status(exit_fingerprint) | ||
|
||
print("Exit relay for our connection to %s" % (event.target)) | ||
print(" address: %s:%i" % (exit_relay.address, exit_relay.or_port)) | ||
print(" fingerprint: %s" % exit_relay.fingerprint) | ||
print(" nickname: %s" % exit_relay.nickname) | ||
print(" locale: %s" % controller.get_info("ip-to-country/%s" % exit_relay.address, 'unknown')) | ||
print("") | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.