Beispiel #1
0
            print(e)
            print("Couldn't receive socket data..")
        print(payload)
        log.insertRecord("Right node receive", payload)

        # write file to system
        try:
            fname = "payloadTeam4.json"
            with open(fname, "wb") as fh:
                fh.write(payload)

            fh = open(fname, "rb")
            payload = fh.read()
            fh.close()
        except Exception as e:
            print(e)
            print("Something went wrong")
        ianHmac.Hmac().wrap(payload)

        # put sftp file on server
        try:
            ianSftp.Client().put(fname)
            log.insertRecord("Right node send", payload)
        except Exception as e:
            print(e)
            print("Couldn't put sftp file on server")
        print("Please run botNode.py")
    except Exception as e:
        print(e)
        print("Something went wrong with right node")
Beispiel #2
0

if __name__ == "__main__":
    try:
        log = teamFourMongolog.Logger()
        log.insertRecord("Bottom node start", None)
    except Exception as e:
        print(e)
    pyro_object = eugenePyro.Sender()
    thread = Thread(target=threaded_function, args=(pyro_object, ))
    thread.start()

    # pull file from sftp server
    fname = "payloadTeam4.json"
    try:
        payload = ianSftp.Client().get(fname)
        payload = ianHmac.Hmac().unwrap().encode("utf-8")
    except Exception as e:
        print(e)
        print("Something is wrong with a file")
    print(payload)
    log.insertRecord("Bottom node receive", payload)

    # sending email
    try:
        emailSender = ianEmail.Email("Test subject", "*****@*****.**",
                                     "*****@*****.**")
        emailSender.sendMail(payload.decode("utf-8"))
    except Exception as e:
        print(e)
        print("Couldn't send email")
Beispiel #3
0
# Each lambda expression must return something to be used as the input (if required) in the next expression
steps = [
    # Kevin's Steps
	{"name": "encrypt", "action": lambda payload: rabbit.Encryptor(payload).encrypt(), "displayMessage": "Encrypting data..."},
	{"name": "rabbitSend", "action": lambda payload: rabbit.Sender(payload).send(), "displayMessage": "Sending RabbitMQ message..."},
	{"name": "rabbitReceive", "action": lambda void: rabbit.Receiver().receive(), "displayMessage": "Receiving RabbitMQ message..."},
	{"name": "decrypt", "action": lambda payload: rabbit.Decryptor(payload).decrypt(), "displayMessage": "Decrypting data..."},

    # Dustin's Steps
    {"name": "sslSend", "action": lambda payload: socketTeam4.SSLSender(payload).send(), "displayMessage": "Sending payload through SSL..."},
    # Socket listener is in separate file, TODO multithreading?
    
    # Ian's Steps
    # TODO get fname returned from Dustin's methods instead of hardcoding
    # The sftpSend step returns the filename, not the file
    {"name": "sftpSend", "action": lambda void: ianSftp.Client(fname).put(), "displayMessage": "Putting payload on FTP Server..."},
    # payload in this case is the filename, and not the json file
    {"name": "sftpReceive", "action": lambda payload: ianSftp.Client(fname).get(payload), "displayMessage": "Getting payload from FTP Server..."},

    # Eugene's Steps
	{"name": "pyroSend", "action": lambda payload: pyroTeam4.Sender(payload).send(), "displayMessage": "Sending data from Pyro4"},
	# Pyro listener is a daemon, separate file

]

# INITIALIZATION - Timer and Logger and Counter
log = mongolog.Logger()
t = timer.Stopwatch()
payload = None
i = 0
Beispiel #4
0
 def setUp(self):
     """Creating object for testing"""
     self.client = ianSftp.Client()
Beispiel #5
0
import ianSftp

cli = ianSftp.Client("payloadTeam4.json")
getFilename = cli.put()
payload = cli.get(getFilename)
print(payload)