Created
September 20, 2021 04:22
-
-
Save matheusfillipe/83b5431bb31c4c146ae087b8bd8503ca to your computer and use it in GitHub Desktop.
Receive pulseaudio's rtp stream on windows's vlc
This file contains hidden or 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
| vlc_path="\"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\"" | |
| import socket | |
| import struct | |
| import textwrap | |
| from scapy.all import * | |
| import os | |
| from elevate import elevate | |
| elevate() | |
| def startVlc(dest_port): | |
| pt=str(dest_port) | |
| print("\n\nDetected RTP port: "+pt) | |
| #launch vlc | |
| import subprocess | |
| subprocess.Popen(vlc_path+" rtp://@:"+pt, shell=False) | |
| import sys, os, traceback, types | |
| s = socket.socket(socket.AF_INET,socket.SOCK_RAW,socket.IPPROTO_IP) | |
| s.bind(("10.42.0.1",0)) | |
| s.setsockopt(socket.IPPROTO_IP,socket.IP_HDRINCL,1) | |
| s.ioctl(socket.SIO_RCVALL,socket.RCVALL_ON) | |
| while True: | |
| packet=s.recvfrom(10000) | |
| packet = packet[0] | |
| ip = IP(packet) | |
| if ip.proto==17 and ip.dst=='10.42.0.1': | |
| ip.show() | |
| if str(ip.dport).startswith("46"): | |
| startVlc(ip.dport) | |
| break | |
| #input("VLC launched!") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment