Updated ftp client
parent
653d925c24
commit
762e86151d
|
@ -64,9 +64,10 @@ def cli_parser():
|
|||
parser.print_help()
|
||||
sys.exit()
|
||||
|
||||
if (args.server == "ftp" or args.client == "ftp") and (
|
||||
args.username is None or args.password is None):
|
||||
print "[*] Error: FTP connections require a username and password!"
|
||||
if ((args.server == "ftp" or "sftp") or (args.client == "ftp" or "ftp"))\
|
||||
and (args.username is None or args.password is None):
|
||||
print "[*] Error: FTP or SFTP connections require \
|
||||
a username and password!".replace(' ', '')
|
||||
print "[*] Error: Please re-run and provide the required info!"
|
||||
sys.exit()
|
||||
|
||||
|
@ -76,7 +77,8 @@ def cli_parser():
|
|||
sys.exit()
|
||||
|
||||
if (args.client is not None) and (args.datatype is None):
|
||||
print "[*] Error: You need to tell Egress-Assess the type of data to send!"
|
||||
print "[*] Error: You need to tell Egress-Assess the type \
|
||||
of data to send!".replace(' ', '')
|
||||
print "[*] Error: to connect to. Please re-run with required info!"
|
||||
sys.exit()
|
||||
|
||||
|
@ -107,9 +109,9 @@ def randomNumbers(b):
|
|||
|
||||
def title_screen():
|
||||
os.system('clear')
|
||||
print "################################################################################"
|
||||
print "# Egress-Assess #"
|
||||
print "################################################################################\n"
|
||||
print "#" * 80
|
||||
print "#" + " " * 32 + "Egress-Assess" + " " * 33 + "#"
|
||||
print "#" * 80 + "\n"
|
||||
return
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ This is the ftp client code
|
|||
import os
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
from common import helpers
|
||||
from ftplib import FTP
|
||||
from ftplib import error_perm
|
||||
|
@ -35,16 +34,11 @@ class Client:
|
|||
print "[*] Error: Username or password is incorrect! Please re-run."
|
||||
sys.exit()
|
||||
|
||||
# Create file name and write out file for ftp transfer
|
||||
current_date = time.strftime("%m/%d/%Y")
|
||||
current_time = time.strftime("%H:%M:%S")
|
||||
ftp_file_name = current_date.replace("/", "") +\
|
||||
"_" + current_time.replace(":", "") + "ftp_data.txt"
|
||||
ftp_file_name = helpers.writeout_text_data(data_to_transmit)
|
||||
|
||||
with open(helpers.ea_path() + "/" + ftp_file_name, 'w') as cc_temp_file:
|
||||
cc_temp_file.write(data_to_transmit)
|
||||
|
||||
ftp.storlines("STOR " + ftp_file_name, open(helpers.ea_path() + "/" + ftp_file_name))
|
||||
ftp.storlines(
|
||||
"STOR " + ftp_file_name, open(helpers.ea_path()
|
||||
+ "/" + ftp_file_name))
|
||||
ftp.quit()
|
||||
os.remove(helpers.ea_path() + "/" + ftp_file_name)
|
||||
print "[*] File sent!!!"
|
||||
|
|
Loading…
Reference in New Issue