Example #1
0
    def __writer__(self, entrada):
        file = open(self.destino, "w")
        invertido = entrada.swapcase()
        print(invertido)

        file.write(invertido)
        client(message=invertido)
Example #2
0
 def __reader__(self):
     texto = ""
     file = open(self.origem, "r")
     texto = file.readline()
     print(texto)
     print("Uso do Socket:")
     client(message=texto)
Example #3
0
 def __read__(self):
     texto = ""
     file = open(self.origem, "rb")
     pessoas = pickle.load(file)
     qtd = len(pessoas)
     for p in pessoas:
         print("Bytes do Objeto: {}".format(sys.getsizeof(p)))
         client(message=p, size=qtd)
         qtd = qtd - 1
Example #4
0
    def _envio_(self):
        file = open(self.destino, "wb")
        pickle.dump(self.dados, file)
        message = self.dados
        obj_bytes = pickle.dumps(self.dados)
        qtd = self.size

        for p in self.dados:
            print("Bytes do Objeto: {}".format(sys.getsizeof(p)))
            client(message=p, size=qtd)
            qtd = qtd - 1
 def sendingLoop(self):
     while (not self._preempted):
         # if there is something to be sent, then send it
         if (not self._sendingQueue.empty()):
             print("Sending...")
             print("Time: " + str(time.time()))
             data = self._sendingQueue.get()
             if (not self._ipAddr == "10.0.0.97"):
                 client(data, "10.0.0.97")
         time.sleep(1)
     print("Sending thread exited successfully.")
def add_player(name):
    global _id
    player = client(_id, name)
    players.append(player)
    _id += 1
    player.send("\n")
    return player
 def LoginWrapper(self):
     self.client = client('http://18.213.123.42', 3500)
     self.email = self.EmailEdit.text()
     self.password = self.PassEdit.text()
     #print("email :"+self.email+"\npassword :"+self.password)
     self.msg, self.status = self.client.login(self.email, self.password)
     print(self.status, self.msg)
     self.customResMsg(self.status, self.msg)
Example #8
0
        def on_load(self, view):                
                print 'thread runnin'
                print self.Recv_data, 'printing'
                thread.start_new_thread(self.update, (view,''))

                chat = client('*****@*****.**', 'OlinCollege')
                chat.use_signals(signals=['SIGHUP','SIGTERM','SIGINT'])
                chat.connect()
                chat.process(block=False)
                chat.send("test")
Example #9
0
def main():
    print(
        '1.send details 2.get credentials 3.generate cert 4.client 5.server 6.send device parameters'
    )
    x = int(input("Enter choice: "))
    if (x == 1):
        send_data()
    elif (x == 2):
        while (True):
            receive_data()
            time.sleep(1800)
    elif (x == 3):
        generate_cert()

    elif (x == 4):
        client()
    elif (x == 5):
        server()
    else:
        dparams()
Example #10
0
 def __init__(self):
     self.server = server()
     self.finger_table = table()
     self.server.listen_()
     self.local_ip = socket.gethostbyname(socket.gethostname())
     self.client = client()
     self.friends = []
     self.private_key = rsa.generate(1024)
     self.public_key = self.private_key.publickey()
     self.to_msg = None
     self.from_msg = None
     self.messages = {}
Example #11
0
 def RegisterWrapper(self):
     #print "we are in Reg Warpper"
     self.client = client('http://18.213.123.42', 3500)
     self.name = self.NameEdit.text()
     self.email = self.EmailEdit.text()
     self.password = self.PassEdit.text()
     self.org = self.OrgEdit.text()
     #print("user :"******"\nemail :"+self.email+"\npassword :"******"\norg :"+self.org)
     self.msg, self.status = self.client.register(self.name, self.email,
                                                  self.password, self.org)
     #print(self.status)
     self.customResMsg(self.status, self.msg)
Example #12
0
    lcounter.pack(pady=15)
    butV = Button(f,
                  text='Voltar',
                  command=qualifyReturn,
                  width=12,
                  font='verdana 10 bold')
    butV.pack()
    f.pack()


#Instancias da classe tk que é a biblioteca usada para desenvolver a interface,
#da classe cliente e da classe api
s = Tk()
s.title('Autorama')
s.geometry('680x570')
c = client()
a = api()

#As linhas de código abaixo em sua maioria dizem respeito a instâncias de componentes de tela,
#como botões, labels, inputs e etc, despensa explicações

#Componentes da tela de configuração do RFID e servidor

screen1 = Frame(s)
framer1 = Frame(screen1)
framer2 = Frame(screen1)
framer3 = Frame(screen1)
framer4 = Frame(screen1)
framer5 = Frame(screen1)
framer6 = Frame(screen1)
Example #13
0
def main():
    c = client('localhost', 12333)
    c.start()
Example #14
0
def main():
    Client=client()
    Client.program_start()
Example #15
0
 def test_client_wo_args(self):
     self.assertEqual(client())
Example #16
0
 def test_client_with_args(self):
     self.assertEqual(client(sys.argv[1:]))
Example #17
0
from client import *

Lydia = client("Lydia")
Lydia.initializeConnection()
Example #18
0
          '7207290314169028145_n.jpg?_nc_ht=instagram.fsvg1-1.fna.fbcdn.net&_nc_cat=106&_nc_ohc=sKNKR76hvLQA' \
          'X9GI5MR&oh=d5c528a6e6c7c6e3534e9bfc935a986c&oe=5EA41047'


def download_picture(image_url, image_name):
    image_name = image_name + '.jpg'
    # Open the url image, set stream to True, this will return the stream content.
    resp = requests.get(image_url, stream=True)
    # Open a local file with wb ( write binary ) permission.
    local_file = open(image_name, 'wb')
    # Set decode_content value to True, otherwise the downloaded image file's size will be zero.
    resp.raw.decode_content = True
    # Copy the response stream raw data to local image file.
    shutil.copyfileobj(resp.raw, local_file)
    # Remove the image url response object.
    del resp


image_url = 'https://www.instagram.com/p/B91h_lSJC9A/'

page = requests.get(image_url)
soup = BeautifulSoup(page.content, "html.parser")


image_desc = soup.find_all('', class_="_6lAjh")
image_desc

text = 'Here you can put your caption for the post' + '\r\n' + 'new line #hashtag'
with client(username, password) as cli:
    cli.upload(image, text)
Example #19
0
    torrent_name = input("Enter torrent file name \n")
    torrent_file = check_path_and_locations.chk_torrent_file(torrent_name)
    path = input("Enter the location where you want to store the file \n")
    location = check_path_and_locations.chk_path(path)
    file_name = input("Enter the file name \n")
    print("-----------------------------")
    log_file = input("Please enter the name for log_file \n")
    print("-----------------------------")
    file_location = os.path.join(location, file_name + ".bin")
    t = decode_torrent(torrent_file, file_location, log_file)
    tracker_url = urlparse(t.announce)
    if (tracker_url.scheme == "udp"):
        conn = udp_conn(t, t.announce)
        peer_ip = conn.connection_udp()
        scheme = 'udp'
    else:
        conn = http_connection(t, t.announce)
        peer_ip = conn.connect_to_tracker()
        scheme = 'http'
    print("Connection with torrent successful")
    peers = peer_ip_extraction(peer_ip, scheme, t)
    peer_ips = peers.ip_extraction()
    peer_conn = peer_connection(peer_ips, t)
    torrent_client = client(t.info_hash, t.peer_id)
    handshake = torrent_client.handshake_request()
    intersted_msg = torrent_client.interested_request()
    print("Peer List extracted successfully")
    t_main = threading.Thread(target=peer_conn.connection_of_peer_with_client,
                              args=(handshake, intersted_msg))
    t_main.start()
Example #20
0
from client import *
isValid = True

print("Hello, welcome to Lydia and Tristan's Irc Chat!")
name = input("Please enter your username: "******"Please enter your username: ")
    user = client(name)
    isValid = user.initializeConnection()

Example #21
0
import sys

def inputCommand(droid):
    title = 'Free Wifi For Everyone!'
    message = ('voulez vous afficher le reseau le plus près de vous?')
    droid.dialogCreateAlert(title, message)
    #droid.dialogCreateAlert(title, message)
    droid.dialogSetPositiveButtonText('Yes')
    droid.dialogSetNegativeButtonText('No')
    #droid.dialogSetNeutralButtonText('Cancel')
    droid.dialogShow()
    response = droid.dialogGetResponse().result
    droid.dialogDismiss()
    #return response['which'] in ('positive', 'negative', 'neutral')
    return response

if __name__ == '__main__':
    droid = android.Android()
    #my_client = Client.client("162.209.100.18", 60017)
    my_client = client(android.Android().dialogGetInput('IP').result,android.Android().dialogGetInput('Port').result)
    response = inputCommand(droid)
    
    if not 'which' in response or response['which'] != 'positive': 
        sys.exit()
    
    while True:
        droid.dialogCreateSpinnerProgress('Nous calculons votre position', 'Veuillez patienter')
        droid.dialogShow()
        my_client.Localiser()
        droid.dialogDismiss()
        time.sleep(300)
Example #22
0
import Pyro4
from dictionary import dictionary, ResourceManager
import client

data_store = dictionary()
user1 = client("user1", data_store)

print user1.get('key1')
print user1.delete('key1')
Example #23
0
def main():
    pserver()
    client()
    client()