Пример #1
0
 def run_payload_noop(self):
     """
     Send a no-op command to the payload.
     """
     Send.send_payload_cmd(Hardware.PAYLOAD_BUS_ID,
                           PayloadCommandId.NO_OP,
                           None) # no data        
Пример #2
0
 def abort_capture(self):
     """
     Send a command to the payload computer to abort any image capture operation.
     """
     Send.send_payload_cmd(Hardware.PAYLOAD_BUS_ID,
                           PayloadCommandId.ABORT_CAPTURE,
                           None) # no data
Пример #3
0
def test_startup_and_shutdown():
    # Create an agent that throws an exception when it receives
    # a payload command packet.
    a = Agent()
    a.bind_udp_sockets()
    a.service_handler["Payload Command"] = Agent.raise_exception

    # Run agent.
    t = threading.Thread(target=Agent.run, args=(a,))
    t.daemon = True
    t.start()

    # Send an ACK packet
    p = Packet()
    p.service = Supernova.service_id("Payload Command")
    p.dest_node = Supernova.get_my_id()
    p.ack = 1
    Send.send_to_self(p)   

    # Wait for and then assert that thread has *not* exited.
    t.join(0.01)
    assert t.is_alive()

    # Send a payload command packet -- SHUTDOWN
    p = Packet()
    p.service = Supernova.service_id("Payload Command")
    p.dest_node = Supernova.get_my_id()
    Send.send_to_self(p)   

    # Wait for and then assert that thread has exited.
    t.join(0.01)
    assert not t.is_alive()
Пример #4
0
def test_timeout():
    # Create an agent that throws an exception when it receives
    # a payload command packet.
    a = Agent()
    a.bind_udp_sockets()
    a.service_handler["Payload Command"] = Agent.raise_exception

    # Set a timeout that is << delay.
    Agent.TIMEOUT = 0.005

    # Run agent.
    t = threading.Thread(target=Agent.run, args=(a,))
    t.daemon = True
    t.start()

    # Delay
    time.sleep(0.02)

    # Send a payload command packet -- SHUTDOWN
    p = Packet()
    p.service = Supernova.service_id("Payload Command")
    p.dest_node = Supernova.get_my_id()
    Send.send_to_self(p)   

    # Wait for and then assert that thread has exited.
    t.join(0.01)
    assert not t.is_alive()
Пример #5
0
    def mai_reset(self):
        """
        Resets the ADACS.
        """

        DATA_LEN = 40 #always
        data = bytearray(DATA_LEN)

        # --- First command

        syncbyte    = 0xEB90 # TODO: the Pumpkin comments contain some confusing statements about endianness
        commandID   = 0x5A   # Reset step 1

        # Create data
        struct.pack_into('<HB', data, 0, syncbyte, commandID)

        # Add data checksum.  (This is different than the packet checksum.)
        checksum = 0xFFFF & sum(data[0:DATA_LEN]) 
        struct.pack_into('<H', data, 38, checksum) 

        Send.send_bus_cmd(BusCommands.MAI_CMD, data)

        # --- Second command

        commandID   = 0xF1   # Reset step 2

        # Create data
        struct.pack_into('<HB', data, 0, syncbyte, commandID)

        # Add data checksum.  (This is different than the packet checksum.)
        checksum = 0xFFFF & sum(data[0:DATA_LEN]) 
        struct.pack_into('<H', data, 38, checksum) 

        Send.send_bus_cmd(BusCommands.MAI_CMD, data)
Пример #6
0
	def __init__(self,s,host,port):
		s.connect((host,port)) # Connect to the given server host and port
		sendmsg=Send(s)
		recvmsg=Recieve(s)
		sendmsg.start()
		recvmsg.start()
		sendmsg.join()
		recvmsg.join()
Пример #7
0
    def run_capture_180(self, num_frames):
        """
        Send a command to the payload to run a 180-degree (four camera) capture
        for the specified number of frames.
        """

        Send.send_payload_cmd(Hardware.PAYLOAD_BUS_ID,
                              PayloadCommandId.CAPTURE_180,
                              bytearray([num_frames]) ) # no data
Пример #8
0
def main():
    # My payload ID
    my_id = 4

    print("Sending no-op command to bus...")
    bc = BusCommands(my_id)
    bc.noop()

    print("Sending shell command to self...")
    Send.send_payload_cmd(my_id, 0x00, "ls")
Пример #9
0
    def power_cameras(self, enable):
        """
        Power on/off the camera hardware.
        """

        if (enable):
            Send.send_payload_cmd(Hardware.PAYLOAD_BUS_ID,
                                  PayloadCommandId.CAMERA_POWER_ON,
                                  None )
        else:
            Send.send_payload_cmd(Hardware.PAYLOAD_BUS_ID,
                                  PayloadCommandId.CAMERA_POWER_OFF,                     
                                  None )
Пример #10
0
    def recuperarSenha(self, user):
        send = Send()
        user = user.title()
        try:
            with sqlite3.connect('db1.db') as connection:
                cursor = connection.cursor()
                find_user = "******"

                results = cursor.execute(find_user, (user, )).fetchall()[0]

            send.sendMessage(results[0], results[1])
            return "enviado"
        except:
            return 'usuário não existe'
Пример #11
0
def ask_usr(file):
	# ask user to send
	base_file = os.path.basename(file)

	data = Data()
	win = Window(base_file)
	mail = Send()

	win.popup()
	if win.ed_msg_mail and win.adress_to and win.subject:
		mail.send_mail(win.adress_to, win.subject, win.ed_msg_mail, file)
	
	destination = data.sent_dir + base_file
	os.rename(file, destination)
Пример #12
0
    def start(self):
        """
        Создание сокета клиента.
        Подключение к серверу.
        Запуск потоков на отправку и чтение.
        """
        self.sock.connect((self.host, self.port))
        self.name = input('Your name: ')

        send = Send(self.sock, self.name, self)
        receive = Receive(self.sock, self.name, self)

        send.start()
        receive.start()

        return receive
Пример #13
0
def main():
    global _username, _domain, _classes, prevId

    init()

    print(Fore.WHITE + Style.BRIGHT + printBanner(), end='')

    with open(baseWritePath + prevId, 'r') as f:
        first = json.load(f)

    nextId = ''.join(
        random.choice(string.ascii_uppercase + string.digits)
        for _ in range(10))
    first['NextId'] = nextId

    with open(baseWritePath + prevId, 'w') as f:
        json.dump(first, f)

    prevId = nextId

    content = waitAndReadFile(baseReadPath + prevId)

    print("[+] Connection successfully established!")
    time.sleep(3)
    print("[+] Patching ETW...")
    time.sleep(7)
    print("[+] Manually loading kernel32.dll to avoid API hooks.")
    time.sleep(7)
    print("[+] Manually loading advapi32.dll to avoid API hooks.")
    time.sleep(5)
    print("[+] Patching AMSI...")
    time.sleep(5)
    print("[+] H4ck th3 Pl4n3t!")

    userAndDomain = content['Output']
    userAndDomain = userAndDomain.split("\\")
    _domain = userAndDomain[0]
    _username = userAndDomain[1]

    _classes.append(Download())
    _classes.append(Base64encode())
    _classes.append(Base64decode())
    _classes.append(Compile())
    _classes.append(Inject())
    _classes.append(Powershell())
    _classes.append(Send())
    _classes.append(Impersonate())
    _classes.append(Exfiltrate())
    _classes.append(Runas())
    _classes.append(Shell())

    mainConsole()

    deinit()
Пример #14
0
def test_send_bus_command():
    Send.send_bus_cmd(BusCommands.NO_OP, None)
    Send.send_bus_cmd(BusCommands.NO_OP, b"Foo")

    # Exceptional: Packet too long
    with pytest.raises(ValueError) as ex:
        Send.send_bus_cmd(0x00, bytearray(1000))
Пример #15
0
def test_send_payload_command():
    Send.send_payload_cmd(4, 0x00, None)
    Send.send_payload_cmd(4, 0x00, b"Command string")

    # Exceptional: Packet too long
    with pytest.raises(ValueError) as ex:
        Send.send_payload_cmd(4, 0x00, bytearray(1000))
Пример #16
0
 def __init__(self, s, host, port):
     s.connect((host, port))  # Connect to the given server host and port
     sendmsg = Send(s)
     recvmsg = Recieve(s)
     sendmsg.start()
     recvmsg.start()
     sendmsg.join()
     recvmsg.join()
Пример #17
0
    def run_shell(packet):
        """ The "shell" command runs a bash command.

        It can be split across multiple packets, in which case
        the string will be accumulated between the first and
        last packets, and it will be run when the last packet
        is received.
        """

        if (packet.seq_flags & Packet.SEQ_FLAG_FIRST):
            # On the first packet, clear whatever old command string
            PayloadCommandHandler.shell_cmd = ""

        PayloadCommandHandler.shell_cmd = PayloadCommandHandler.shell_cmd + packet.data.decode("utf-8")
        shell_cmd = PayloadCommandHandler.shell_cmd
        shell_rsl = ""

        if (packet.seq_flags & Packet.SEQ_FLAG_LAST):

            # On the last packet, we actually run the command
            print("Running in shell...\n $ %s \n" % (shell_cmd))

            # TODO: add some safeguards against timeout
            try:
                shell_rsl = subprocess.check_output(shell_cmd, shell=True, stderr=subprocess.STDOUT)
                # Or, if we don't want to use the shell interpreter:
                # shell_rsl = subprocess.check_output(shlex.split(shell_cmd), shell=False)
            except subprocess.CalledProcessError as e:
                shell_rsl = "ERROR exit=%d %s" % (e.returncode, e.output)

            if PayloadCommandHandler.DEBUG:
                print('================= BEGIN OUTPUT =================')
                print(shell_rsl)
                print('================== END OUTPUT ==================')

            # Send reponse packet
            # TODO: send back to packet source
            Send.send_payload_cmd(4, PayloadCommandHandler.SHELL_RESP, shell_rsl)
Пример #18
0
    def mai_set_time(self, gpstime):
        """
        Sets the ADACS clock.

        Arguments:
            gpstime - GPS time is a linear count of seconds elapsed since 0h Jan 6, 1980.
        """

        DATA_LEN = 40 #always
        data = bytearray(DATA_LEN)

        syncbyte    = 0xEB90 # TODO: the Pumpkin comments contain some confusing statements about endianness
        commandID   = 0x44   # set GPS time

        # Create data
        struct.pack_into('<HBL', data, 0, syncbyte, commandID, 
                         gpstime)

        # Add data checksum.  (This is different than the packet checksum.)
        checksum = 0xFFFF & sum(data[0:DATA_LEN]) 
        struct.pack_into('<H', data, 38, checksum) 

        Send.send_bus_cmd(BusCommands.MAI_CMD, data)
Пример #19
0
    def mai_set_latlong(self, longitude, latitude, start_time, stop_time):
        """
        Sets the programmed latitude and logitude mode.

        Description: Loads an Earth latitude and longitude target and start and stop time (in GPS seconds)
            in which to operate. This command is shared with both normal Lat/Long and Lat/Long sun (i.e.
            either ACS mode will use the Lat/Long start/stop time loaded to perform it's pointing).
            The Lat//Long or Lat/Long-Sun ACS mode needs to be commanded to use this data. The ACS
            mode does not change until the start time is reached. The selected Lat/Long ACS mode will then
            start. When the stop time is reached, the ACS mode automatically returns to either normal (nadir)
            or normal-Sun ACS mode.

        TODO: what if the start time is before the current time?

        Arguments:
            longitude: Geodetic Longitude in ECEF +180:-180 deg = +32767:-32767 0.005493332 deg/lsb
            latitude:  Geodetic Latitude in ECEF +90:-90 deg = +16384:-16384 0.005493332 deg/lsb
            start_time: gul_GPStime_LLstart (sec)
            stop_time:  gul_GPStime_LLend (sec)
        """

        DATA_LEN = 40 #always
        data = bytearray(DATA_LEN)

        syncbyte    = 0xEB90 # TODO: the Pumpkin comments contain some confusing statements about endianness
        commandID   = 0x51   # "torque command" (says manual)

        # Create data
        struct.pack_into('<HBhhLL', data, 0, syncbyte, commandID, 
                         longitude, latitude,
                         start_time, stop_time)

        # Add data checksum.  (This is different than the packet checksum.)
        checksum = 0xFFFF & sum(data[0:DATA_LEN]) 
        struct.pack_into('<H', data, 38, checksum) 

        Send.send_bus_cmd(BusCommands.MAI_CMD, data)
Пример #20
0
def main():
	global _username,_domain,_classes, prevId

	init()

	print(Fore.WHITE + Style.BRIGHT + printBanner() , end='')

	with open(baseWritePath + prevId, 'r') as f:
		first = json.load(f)

	nextId = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
	first['NextId'] =  nextId

	with open(baseWritePath + prevId, 'w') as f:
		json.dump(first, f)

	prevId = nextId

	content = waitAndReadFile(baseReadPath + prevId)

	userAndDomain = content['Output']
	userAndDomain = userAndDomain.split("\\")
	_domain = userAndDomain[0]
	_username = userAndDomain[1]
	


	_classes.append(Download())
	_classes.append(Execute())
	_classes.append(Move())
	_classes.append(Base64encode())
	_classes.append(Base64decode())
	_classes.append(Compile())
	_classes.append(Inject())
	_classes.append(Downexec())
	_classes.append(Powershell())
	_classes.append(Send())
	_classes.append(Impersonate())
	_classes.append(Exfiltrate())
	_classes.append(Runas())
	_classes.append(Shell())


	mainConsole()

	deinit()
Пример #21
0
def test_error_cases():

    # Exceptional: Invalid parameter type
    with pytest.raises(TypeError) as ex:
        Send.send(bytearray(266))

    # Exceptional: Invalid parameter type
    with pytest.raises(TypeError) as ex:
        Send.send_payload_cmd(4, 0x00, 0x00)

    # Exceptional: Invalid parameter type
    with pytest.raises(TypeError) as ex:
        Send.send_bus_cmd(0x00, 0x00)
Пример #22
0
def display_page(pathname):
    if pathname == '/download':
        return Download()
    elif pathname == '/table':
        return Table()
    elif pathname == '/app':
        return App()
    elif pathname == '/apka':
        return Apka(r, t, df1)
    elif pathname == '/charts':
        return Charts(r, t, df1)
    elif pathname == '/calc':
        return Calc(r, t, df1)
    elif pathname == '/report':
        return Report(r, t, df1)
    elif pathname == '/send':
        return Send(r, t)
    else:
        return Home()
Пример #23
0
    def __init__(self, parent):
        super(QWidget, self).__init__(parent)
        self.layout = QVBoxLayout(self)

        # Initialize tab screen
        self.tabs = QTabWidget()
        self.balanceTab = QWidget()
        self.sendTab = QWidget()
        self.receiveTab = QWidget()
        self.tabs.resize(800, 600)

        # Add tabs
        self.tabs.addTab(self.balanceTab, "Balance")
        self.tabs.addTab(self.sendTab, "Send")
        self.tabs.addTab(self.receiveTab, "Receive")

        # create balance tab
        self.balanceTab.layout = QVBoxLayout(self)
        self.balance = Balance()
        self.balanceTab.layout.addWidget(self.balance)
        self.balanceTab.setLayout(self.balanceTab.layout)

        #create send tab
        self.sendTab.layout = QVBoxLayout(self)
        self.send = Send()
        self.sendTab.layout.addWidget(self.send)
        self.sendTab.setLayout(self.sendTab.layout)

        #create receive tab
        self.receiveTab.layout = QVBoxLayout(self)
        self.receive = Receive()
        self.receiveTab.layout.addWidget(self.receive)
        self.receiveTab.setLayout(self.receiveTab.layout)

        # Add tabs to widget
        self.layout.addWidget(self.tabs)
        self.setLayout(self.layout)
Пример #24
0
    def deploy_solar_panels(self):
        """
        Send a command to the bus to trigger solar panel deployment.

        TODO: should the burns happen sequentially or at once?
        """

        burn_time = 10 #seconds

        for num in range(1,5):
            Send.send_bus_cmd(BusCommands.PRM_CMD,
                              bytearray([0x05, num, 0x00]) )
            Send.send_bus_cmd(BusCommands.PRM_CMD,
                              bytearray([0x07, num, 0x00]) )
            Send.send_bus_cmd(BusCommands.PRM_CMD,
                              bytearray([0x09, num, burn_time]) )

            # XXX: On the simulator, a small delay is required or the
            # XXX: fourth wire fails to fire.
            time.sleep(0.1)
Пример #25
0
def mainloop():
    print(f"Starting netMonitor in {CONFIG['env']}")
    dbApi = DbApi()
    send = Send()
    send.sendInitial(f"Starting netMonitor in {CONFIG['env']}")
    netApi = NetApi()
    send.sendError(dbApi.test())
    lastTimestamp = None
    while True:
        try:
            currtime = time.time()
            distance = 300 - currtime % 300
            alligned_time = currtime + distance
            time.sleep(distance)  # wait to the next 5 min
            timestamp = datetime.datetime.fromtimestamp(
                int(alligned_time))  # everyone gets same 5min alligned time
            try:
                data = netApi.getData()
                dbApi.dbCollect(data, timestamp)
                try:
                    send.sendCheck(dbApi, lastTimestamp, timestamp)
                except Exception as e:
                    send.sendError(
                        f"Possible sending messages unsuccesful, because of {str(e)}"
                    )
                lastTimestamp = timestamp
            except Exception as e:
                send.sendError(
                    f"DataCollection unsuccesful, because of {str(e)}")
        except Exception as e:
            send.sendError(f"Fail in Mainloop pending 290s, because of {e}")
            time.sleep(290)
Пример #26
0
    def run_echo(packet):
        """ The "echo" command simply sends back a packet with the same data.

        """
        # TODO: send back to packet source
        Send.send_payload_cmd(4, PayloadCommandHandler.ECHO_RESP, packet.data)
Пример #27
0
 def SendMsg(self):
     #print "Type Message...\n"
     s = Send(None, server=True,
              serverList=self.clientSock)  # Server Send Object initalized
     s.start()  # Server Send Started
     s.join()
Пример #28
0
    def mai_set_mode(self, mode):
        """
        Sets the ACDACS operational mode.

        Arguments:
            mode - integer between 0 and 9, inclusive

        More details:
            Mode 0: Test mode. The system receives and executes wheel torque and speed commands, and
                dipole commands manually from the user. The magnetometer and sun sensors are sampled and
                attitude is computed. No closed loop control is performed. This is intended for ground test and
                system check-out on-orbit.

            Mode 1: Acquisition mode. The system computes magnetic coil commands to reduce spacecraft
                rate as measured by the magnetometer (or external magnetometer readings). Note only torques
                perpendicular to the current magnetic field can be produced. Over an orbit, spacecraft rates are
                ground general maintained to 2x orbit rate (average inertial rate of magnetic field). The magnetometer and
                sun sensors are sampled and attitude is computed. Any reaction wheel speeds from normal
                operation or bias operation will be commanded to zero, inducing spacecraft speeds if acquisition
                mode is commanded (note that this does not apply acquisition/Bdot operation temporarily applied
                due to temporary loss of 3-axis attitude from other modes below. When power is initially
                applied, the system enters Acquisition Mode.

            Mode 3: Normal Mode. A zero momentum, magnetic momentum management mode. The
                system endeavors to maintain a nadir pointing attitude based on Earth sensor/magnetometer or sun
                sensor/magnetometer attitude determination. An offset quaternion may also be commanded with
                the Qbo command. ADACS firmware will be set to maintain the desired LVLH attitude (spacecraft
                axes can be selected based on desired mounting of the ADACS and sensor orientations if
                communicated to MAI). The system computes reaction wheel torque commands by a quaternion
                feedback control law. Momentum is managed magnetically to maintain offset reaction wheel
                speeds. As reaction wheel speeds cannot be maintained at very low speeds (<20-40 RPM), if
                normal mode is planned as a full-time operational mode, offset reaction wheel speeds are
                recommended (requires magnetic torqueing to maintain offset wheel speeds).
                If a valid 3-axis attitude is not available, normal mode will revert to b-dot mode, as with acquisition
                mode, with the exception that reaction wheel speeds are maintained at the last
                commanded/integrated speed (not commanded to zero speed as with the commanded acquisition
                mode). As with other closed loop control modes, if the magnetic field is not valid, closed loop
                control is disabled.

            Mode 4: Lat/Long Mode. This mode allows the user to select a fixed latitude and longitude at
                some time in the future (defined as a start and stop GPS time) loaded with a separate lat/long
                command. Valid 3-axis attitude is required to perform pointing, either with Sun/Mag or
                Earth/Mag. The offset pointing from nadir, except for short duration lat/long modes will generally
                violate nadir pointing requirements for Earth/Mag, thus, care should be taken to command lat/long
                outside of eclipse periods.
                When this ACS mode is selected, the current attitude is used until the start time (which is expected
                to be normal mode to limit slew times to the lat/long). Thus, the selected lat/long point on the
                Earth surface should be in view of the satellite as it flies over during the start/stop time period. The
                control system maintains nominal pointing to the lat/long point, which can also be offset with the
                Qbo offset quaternion, if commanded. After the stop time occurs, control is automatically
                transitioned to normal mode.

            Mode 5: QbX Mode. A momentum biased, Bdot damping mode for the QbX satellite. The X
                axis wheel is command to a constant speed. Aerodynamic stabilization points the satellite into the
                ram. Bdot damping orients the pitch axis to the orbit normal.

            Mode 7: Normal-Sun Mode. This mode provides nadir pointing for the primary axis, and rotates
                about the nadir axis to optimize solar pointing for a secondary axis (currently an axis 45 degrees
                between the X and Y axes, although this can be modified in firmware based on selected
                configuration). Rotation about the nadir axis is controlled from +/-30 degrees of the sun projected
                onto the orbit plane to prevent high rates due to singularity or near singularities.

            Mode 8: Lat/Long-Sun Mode. This mode operates similar to normal Lat/Long mode, with the
                exception of rotation about the primary axis, which uses the normal-Sun mode logic to optimize
                solar pointing. As with normal Lat/Long, the ACS mode used prior to the start time is maintained,
                and control is autonomously switched to Normal-Sun mode after the stop time. This mode shares
                the same Lat/Long configuration command with normal Lat/Long.

            Mode 9: Qinertial Mode. This mode provides inertial pointing using a commanded quaternion
                as part of the mode parameters and the current 3-axis attitude knowledge quaternion. As the
                requirements for Earth/mag 3-axis attitude moves at orbit rate, it is likely this mode will be used
                with Sun/mag and thus will lose inertial pointing during eclipse.
        """

        DATA_LEN = 40 #always
        data = bytearray(DATA_LEN)

        syncbyte    = 0xEB90 # TODO: the Pumpkin comments contain some confusing statements about endianness
        commandID   = 0x00   # SET_MODE

        # Create data
        struct.pack_into('<HBB', data, 0, syncbyte, commandID, mode) 

        # Add data checksum.  (This is different than the packet checksum.)
        checksum = 0xFFFF & sum(data[0:DATA_LEN]) 
        struct.pack_into('<H', data, 38, checksum) 

        Send.send_bus_cmd(BusCommands.MAI_CMD, data)
Пример #29
0
def thread1_keyboard():
    # Send user input, one line at a time
    print("----- Remote terminal ----- \n")
    while(True):
        cmd = raw_input()
        Send.send_payload_cmd(DEST_ID, PayloadCommandHandler.SHELL_CMD, cmd)
Пример #30
0
import schedule
import time
import serial

import json
import os

CONFIG = os.path.dirname(os.path.realpath(__file__)) + '/config.json'

with open(CONFIG) as file:
    json_data = json.load(file)


def job():
    status.run()
    send.send_string(status.status)


if __name__ == "__main__":

    status = Status(json_data["url"], json_data["groups"]["groups_num"])
    send = Send(json_data["serial"]["interface"],
                json_data["serial"]["baud_rate"])
    #
    schedule.every(1).seconds.do(job)
    while 1:
        schedule.run_pending()
        time.sleep(1)

    send.close()
Пример #31
0
 def __init__(self, chat_id=None):
     Send.__init__(self, chat_id)
     self.document = None  # file_id or string representation of file
     self.name = None
Пример #32
0
from picamera import PiCamera
import time
import cv2
from firebase import firebase
from send import Send
firebase = firebase.FirebaseApplication(
    'https://facerec-437f1.firebaseio.com/', None)
from getInfo import get_info
names, images = get_info()
encodings = []
for i in range(0, len(names)):
    encodings.append(fr.face_encodings(images[i])[0])
    print(names[i] + "done")

model = Predict(names, encodings)
send_name = Send()
print("starting model")
cap = cv2.VideoCapture(0)
i = 0
temp = ""
while cap.isOpened():
    ret, frame = cap.read()
    cv2.imshow("test", frame)
    if (i % 5 == 0):

        face_locations = fr.face_locations(frame)
        n = []
        if (len(face_locations)):
            n = model.get_name(frame, face_locations)
            if (temp != n[0]):
                print(n[0])
Пример #33
0
 def __init__(self, chat_id=None):
     Send.__init__(self, chat_id)
     self.audio = None  # file_id or string representation of audio file
     self.duration = None
     self.performer = None
     self.title = None
Пример #34
0
 def __init__(self, chat_id=None):
     Send.__init__(self, chat_id)
     self.text = None
     self.disable_web_page_preview = False  # (optional)
     self.parse_mode = None  # 'Markdown' or 'HTML' (optional)
Пример #35
0
 def __init__(self, chat_id=None):
     Send.__init__(self, chat_id)
     self.sticker = None  # file_id or string representation of sticker
Пример #36
0
            cursor.execute('''DELETE FROM colab WHERE id = ?''', (id, ))
            connection.commit()

    def recuperarSenha(self, user):
        send = Send()
        user = user.title()
        try:
            with sqlite3.connect('db1.db') as connection:
                cursor = connection.cursor()
                find_user = "******"

                results = cursor.execute(find_user, (user, )).fetchall()[0]

            send.sendMessage(results[0], results[1])
            return "enviado"
        except:
            return 'usuário não existe'


banco = Banco()
x = "Crystian"
send = Send()
'''
send.sendMessage("123", "*****@*****.**")
'''
#print(banco.recuperarSenha(x))
'''
banco.ajeitarTabelas()
banco.criarTabelas()
'''
Пример #37
0
class Gui:
    send = Send()
    receive = Receive()

    def on_ptt_toggled(self, button, name):
        if button.get_active():
            self.send.start()
            print "PTT on"
        else:
            self.send.stop()
            print "PTT off"

    def on_quit_clicked(self, button, name):
        self.receive.quit()
        self.send.quit()
        gtk.main_quit()

    def delete_event(self, widget, event, data=None):
        gtk.main_quit()
        return False

    def enter_callback(self, widget, entry):
        entry_text = entry.get_text()
        print "Entry contents: %s\n" % entry_text

    def __init__(self):

        # Create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        # Set the window title
        self.window.set_title("Audio Chat")

        # Set a handler for delete_event, that exit Gtk
        self.window.connect("delete_event", self.delete_event)

        # Sets the border width of the window.
        self.window.set_border_width(20)

        # Create a vertical box
        vbox = gtk.VBox(True, 2)

        # Put the vbox in the main window
        self.window.add(vbox)

        # Create the ptt button
        button = gtk.ToggleButton("PTT")

        # When the button is toggled, we call the "callback" method
        # with a pointer to "button" as its argument
        button.connect("toggled", self.on_ptt_toggled, "ptt")

        # Insert PTT button
        vbox.pack_start(button, True, True, 2)

        button.show()

        # Create "Quit" button
        button = gtk.Button("Quit")

        # If the button is clicked, we call the main_quit function
        button.connect("clicked", self.on_quit_clicked, "quit")

        # Insert the quit button
        vbox.pack_start(button, True, True, 2)

        # Entry
        entry = gtk.Entry(50)
        entry.connect("activate", self.enter_callback, entry)
        entry.set_text("Dst IP")
        entry.select_region(0, len(entry.get_text()))
        vbox.pack_start(entry, gtk.TRUE, gtk.TRUE, 0)

        entry.show()
        button.show()
        vbox.show()
        self.window.show()

        # Start receiver pipe
        self.receive.start()
# interactive console for sending messages
# by oran collins
# github.com/wisehackermonkey
# [email protected]
# 20200516
from send import Send
from display import Display

try:
    text = ""
    print("Type <quit> or <exit> to close program")
    while text != "quit":
        Display().messages()
        text = input("--> ")
        if text == "":
            continue
        if text in ["quit", "exit", "q", ""]:
            break
        Send().message(text)

except KeyboardInterrupt as error:
    print("Program closed")
    exit()
Пример #39
0
 def __init__(self, chat_id=None):
     Send.__init__(self, chat_id)
     self.photo = None  # file_id or string representation of image
     self.name = None  # including file extension (i.e.: .jpg)
     self.caption = None
Пример #40
0
	def SendMsg(self):
		#print "Type Message...\n"
		s=Send(None,server=True,serverList=self.clientSock) # Server Send Object initalized
		s.start() # Server Send Started
		s.join()