Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Configuração de UI Avançada
- const createStealthElement = (tag, styles) => {
- const el = document.createElement(tag);
- Object.assign(el.style, {
- position: 'fixed',
- zIndex: '2147483647',
- padding: '8px 16px',
- background: '#2c3e50',
- color: 'white',
- border: 'none',
- borderRadius: '4px',
- cursor: 'pointer',
- boxShadow: '0 2px 5px rgba(0,0,0,0.3)',
- fontSize: '14px',
- right: '10px',
- ...styles
- });
- return el;
- };
- const button = createStealthElement('button', { top: '10px' });
- button.textContent = 'Selecionar Vídeo';
- const deleteButton = createStealthElement('button', { top: '50px' });
- deleteButton.textContent = 'Remover Vídeo';
- deleteButton.style.display = 'none';
- document.body.append(button, deleteButton);
- // Estado Global Seguro
- let customStream = null;
- let videoBlob = null;
- let originalAPIs = {};
- // Sobrescrita de APIs Críticas
- const overrideMediaAPIs = () => {
- originalAPIs.getUserMedia = navigator.mediaDevices.getUserMedia;
- originalAPIs.createObjectURL = URL.createObjectURL;
- originalAPIs.mediaDevices = navigator.mediaDevices;
- navigator.mediaDevices.getUserMedia = async constraints => {
- if (constraints.video && customStream) {
- return customStream.clone();
- }
- return originalAPIs.getUserMedia(constraints);
- };
- URL.createObjectURL = function(blob) {
- if (blob instanceof Blob && videoBlob) {
- return originalAPIs.createObjectURL(videoBlob);
- }
- return originalAPIs.createObjectURL(blob);
- };
- };
- // Sistema de Streaming Híbrido
- const createHybridStream = async (file) => {
- const video = document.createElement('video');
- video.src = URL.createObjectURL(file);
- await new Promise(resolve => video.onloadedmetadata = resolve);
- // Configuração do Canvas
- const canvas = document.createElement('canvas');
- const ctx = canvas.getContext('2d');
- [canvas.width, canvas.height] = [video.videoWidth, video.videoHeight];
- // Renderização de Vídeo
- video.play();
- const drawFrame = () => {
- if (!video.paused && !video.ended) {
- ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
- requestAnimationFrame(drawFrame);
- }
- };
- drawFrame();
- // Captura de Áudio
- const audioContext = new AudioContext();
- const source = audioContext.createMediaElementSource(video);
- const destination = audioContext.createMediaStreamDestination();
- source.connect(audioContext.destination);
- source.connect(destination);
- // Combinação de Streams
- const stream = canvas.captureStream(30);
- stream.addTrack(destination.stream.getAudioTracks()[0]);
- return stream;
- };
- // Sistema de Monitoramento Reforçado
- const initAdvancedObserver = () => {
- const observer = new MutationObserver(mutations => {
- mutations.forEach(({target, attributeName}) => {
- // Detecção de elementos de vídeo
- if (target instanceof HTMLVideoElement) {
- if (target.src.startsWith('blob:') && videoBlob) {
- target.src = URL.createObjectURL(videoBlob);
- }
- // Substituição silenciosa de streams
- if (target.srcObject && !target.srcObject.getTracks().some(t => t.label === 'custom')) {
- target.srcObject = customStream;
- }
- }
- });
- });
- observer.observe(document, {
- subtree: true,
- childList: true,
- attributes: true,
- attributeFilter: ['src', 'srcObject']
- });
- };
- // Controles Interativos
- button.onclick = async () => {
- try {
- const [file] = await new Promise(resolve => {
- const input = document.createElement('input');
- input.type = 'file';
- input.accept = 'video/*';
- input.onchange = () => resolve(input.files);
- input.click();
- });
- videoBlob = file;
- customStream = await createHybridStream(file);
- overrideMediaAPIs();
- initAdvancedObserver();
- // Atualização de UI
- button.textContent = 'Transmissão Ativa ✅';
- deleteButton.style.display = 'block';
- // Injeção contínua de metadados
- const injectMetadata = () => {
- if (customStream) {
- customStream.getTracks().forEach(track => {
- track.contentHint = 'detailed';
- if (track.kind === 'video') {
- track.applyConstraints({
- advanced: [{ width: 1280, height: 720 }]
- });
- }
- });
- }
- };
- setInterval(injectMetadata, 1000);
- } catch (error) {
- console.error('Erro na transmissão:', error);
- }
- };
- deleteButton.onclick = () => {
- customStream?.getTracks().forEach(track => {
- track.stop();
- track.enabled = false;
- });
- customStream = null;
- videoBlob = null;
- // Restauração gradual das APIs
- setTimeout(() => {
- navigator.mediaDevices.getUserMedia = originalAPIs.getUserMedia;
- URL.createObjectURL = originalAPIs.createObjectURL;
- }, 1000);
- button.textContent = 'Selecionar Vídeo';
- deleteButton.style.display = 'none';
- };
- // Inicialização Segura
- window.addEventListener('load', () => {
- setTimeout(() => {
- if (!document.querySelector('#stealth-overlay')) {
- overrideMediaAPIs();
- initAdvancedObserver();
- }
- }, 3000);
- });
Advertisement
Add Comment
Please, Sign In to add comment