Skip to content

Commit

Permalink
add network scanning feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mp3butcher committed Oct 7, 2024
1 parent 9c63ba0 commit c251294
Show file tree
Hide file tree
Showing 30 changed files with 4,156 additions and 1,546 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Build artifacts to link to release

on:
workflow_dispatch:
inputs:
version:
description: 'Version number'
required: true
push:
tags:
- '*'
Expand All @@ -9,7 +14,7 @@ jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
with:
node-version: '20'
Expand All @@ -28,7 +33,7 @@ jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
with:
node-version: '20'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-winget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
shell: cmd
run: |
curl https://aka.ms/wingetcreate/latest -L --output wingetcreate.exe
wingetcreate.exe update StefanLobbenmeier.youtube-dl-gui -s true -u https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/download/v%APP_VERSION%/Open-Video-Downloader-Setup-%APP_VERSION%.exe -v %APP_VERSION% -t %WINGET_TOKEN%
wingetcreate.exe update mp3butcher.youtube-dl-gui -s true -u https://github.com/mp3butcher/youtube-dl-gui/releases/download/v%APP_VERSION%/Open-Video-Downloader-Setup-%APP_VERSION%.exe -v %APP_VERSION% -t %WINGET_TOKEN%
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
<img src="https://raw.githubusercontent.com/StefanLobbenmeier/youtube-dl-gui/v2.0.0/renderer/img/icon.png" alt="logo" align="left" height="100"/>

# Open Video Downloader (youtube-dl-gui)
[![version badge](https://img.shields.io/github/v/release/StefanLobbenmeier/youtube-dl-gui?label=latest-release)](https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/latest)
[![version badge](https://img.shields.io/github/v/release/mp3butcher/youtube-dl-gui?label=latest-release)](https://github.com/mp3butcher/youtube-dl-gui/releases/latest)
[![license](https://img.shields.io/github/license/StefanLobbenmeier/youtube-dl-gui)](https://github.com/StefanLobbenmeier/youtube-dl-gui/blob/master/LICENSE)
[![coverage badge](https://img.shields.io/codecov/c/github/StefanLobbenmeier/youtube-dl-gui)](https://app.codecov.io/gh/StefanLobbenmeier/youtube-dl-gui)
[![downloads](https://img.shields.io/github/downloads/StefanLobbenmeier/youtube-dl-gui/total)](https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/latest)
[![CI badge](https://img.shields.io/github/actions/workflow/status/StefanLobbenmeier/youtube-dl-gui/continuous-integration.yaml)](https://github.com/StefanLobbenmeier/youtube-dl-gui/actions)
[![coverage badge](https://img.shields.io/codecov/c/github/mp3butcher/youtube-dl-gui)](https://app.codecov.io/gh/mp3butcher/youtube-dl-gui)
[![downloads](https://img.shields.io/github/downloads/mp3butcher/youtube-dl-gui/total)](https://github.com/mp3butcher/youtube-dl-gui/releases/latest)
[![CI badge](https://img.shields.io/github/actions/workflow/status/mp3butcher/youtube-dl-gui/continuous-integration.yaml)](https://github.com/mp3butcher/youtube-dl-gui/actions)

https://github.com/StefanLobbenmeier/youtube-dl-gui

A cross-platform GUI for youtube-dl made in Electron and node.js

based on https://github.com/StefanLobbenmeier/youtube-dl-gui but adding a traffic scanning feature (using mitmproxy)

- I] When scanner activated the first time don't forget to install mitmproxy authority certificate (cf image)
![Screenshot from 2024-10-07 16-37-04](https://github.com/user-attachments/assets/3fb3bb86-d5a8-44d8-ab8e-05429bd8fb4c)
- II] I recommend to use browser proxy switcher extension such as [this extension](https://chromewebstore.google.com/detail/proxy-switcher/iejkjpdckomcjdhmkemlfdapjodcpgih?hl=fr) to easily enable/disable proxy usage while browsing (set it up proxy=localhost and port=15930)
![Screenshot from 2024-10-07 16-43-32](https://github.com/user-attachments/assets/a4650d10-a2f0-4059-b72c-9a241e550338)
- III] Browse to a streaming content and let the scanner capture the video

### Features:
- Download from all kind of platforms: YouTube, vimeo, twitter & many more
Expand All @@ -20,11 +26,12 @@ A cross-platform GUI for youtube-dl made in Electron and node.js
- Multithreaded, up to 32 videos can be downloaded synchronously
- Shows how much size the download will use up on your system
- The app automatically keeps ytdl up-to-date
- The app include a network scanner through a binding with mitmproxy

Be sure to check out [a demo gif of the application](#Demo-gif)!

## How to use
1. Download the [applicable installer or executable](https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/latest) for your system.
1. Download the [applicable installer or executable](https://github.com/mp3butcher/youtube-dl-gui/releases/latest) for your system.
2. If you are on windows, make sure that the [Microsoft Visual C++ 2010 Redistributable Package (x86)](https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe) is installed.
3. Paste a link into the box up top.
4. Wait for the app to gather all required metadata.
Expand All @@ -44,7 +51,7 @@ Please see if the answer is in the [frequently answered questions](https://githu
Still haven't found your answer? [Open up an issue](https://github.com/StefanLobbenmeier/youtube-dl-gui/issues), and describe the problem you're facing.

## Building from source
First, clone the repository using `git clone https://github.com/StefanLobbenmeier/youtube-dl-gui.git`.
First, clone the repository using `git clone https://github.com/mp3butcher/youtube-dl-gui.git`.

Then navigate to the directory and install the npm modules by executing: `npm install`.

Expand Down
115 changes: 115 additions & 0 deletions binaries/send_traffic_to_videodownloader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import asyncio
import base64
import socket, threading
import queue
import time

from mitmproxy import ctx
from mitmproxy import http
LISTENING_PORT = 12000
# Queue to hold shared data
data_queue = queue.Queue(maxsize=15)

def startserver(selfs):
data=''
try:
while data=='':
try:
data=selfs.socket_connection.recv(1)
print(data)
selfs.socket_instance.close();
selfs.socket_connection.close();
ctx.master.shutdown()
except:
pass
if data_queue.qsize()>0:
msg = data_queue.get()
if msg is not None:
selfs.socket_connection.send(msg.encode())
#else:
# if selfs.socket_connection.recv(data)>0:selfs.socket_connection .send('testconnection'.encode()) #dirty connection test require to exit properly
#time.sleep(1)
except:
selfs.socket_instance.close();
selfs.socket_connection.close();
ctx.master.shutdown()
selfs.socket_instance.close();
selfs.socket_connection.close();
ctx.master.shutdown()
class TrafficLogger:
def __init__(self):

# Create server and specifying that it can only handle 4 connections by time!
self.socket_instance = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#self.socket_instance.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket_instance.bind(('127.0.0.1', LISTENING_PORT))
self.socket_instance.listen(1) #limit to one client
print('Server running!')
# Accept client connection


self.socket_connection, self.address = self.socket_instance.accept()
self.socket_connection.setblocking(False)
print('new listener!')

# Create a thread
thread = threading.Thread(target=startserver, args=([self]))

# Start the thread
thread.start()

def __del__(self):
print("Object destroyed")
#self.socket_instance.close();


def request(self, flow):
self.checkflow(flow, False)
def response(self, flow):
self.checkflow(flow, True)
return

def checkflow(self,flow,isrep):

#print("FOR: " + flow.request.url)
url='"'+flow.request.method + " " + flow.request.url+ " " + flow.request.http_version+'"'
url='"' + flow.request.url+ '"'



headers="["
#print("-"*50 + "request headers:")
for k, v in flow.request.headers.items():
#print("%-20s: %s" % (k.upper(), v))
if k!='If-Range':
headers=headers+'{"k":"'+k+'"'+',"v":'+'"'+v.replace("\"","\\\"")+'"'+'},'
headers=headers[:-1]+"]"
rheaders="[]"
#print("-"*50 + "response headers:")
if isrep:
rheaders="["
for k, v in flow.response.headers.items():
#print("%-20s: %s" % (k.upper(), v))
#print("-"*50 + "request headers:")
rheaders=rheaders+'{"k":"'+k+'"'+',"v":'+'"'+v.replace("\"","\\\"")+'"'+'},'
rheaders=rheaders[:-1]+"]"
#don't send large response
data=""
if isrep:
if len(flow.response.text)<50000000:
#print(flow.response.text);

try:
#data=flow.response.text.replace("\"","\\\"") #.encode("utf-8")# str(flow.response.text, encoding='utf-8') #flow.response.text.decode("utf-8");
data=base64.b64encode(flow.response.content).decode("ascii")
except:
data=""
msg='{"url":'+url+',"headers":'+headers+',"rheaders":'+rheaders+',"response":"'+data+'"}'
#self.socket_instance.send(len(msg))
data_queue.put(msg)
#if self.socket_connection.send(msg.encode()) ==0:
# self.socket_connection.close();
# self.socket_instance.close();


addons = [TrafficLogger()]
Loading

0 comments on commit c251294

Please sign in to comment.