Exemple #1
0
print('Secure Copy - version ' + version + '\n')

#Check for config, build if necessary
config.read('conf.cfg')
if not config.has_section('Directories'):
	print ('[!] Config file malformed or missing.')
	while True:
		buildSelection = raw_input(' Would you like to run buildConf now to create a new config? ').lower()
		if buildSelection in ('yes', 'y'):
			print(' running buildConf.py...')
			buildConf()
			config.read('conf.cfg')
			from timedExit import timedExit
			break
		elif buildSelection in ('no', 'n'):
			timedExit('[!] Config file failed to load! Verify state and integrity of the file!', 7, 1)
		else:
			print(' Unsupported response. Supported responses are: yes, y, no, n [case insensitive]')
else:
	print ('Config loaded successfully!')

#redefine all config variables for easier calling
PSCP = 'PSCP.exe'
downloadDir = config.get('Directories', 'downloaddir')
fileDir = config.get('Directories', 'fileDir')
user =  config.get('Login', 'user')
host =  config.get('Login', 'host')

while True:
	selection = raw_input('Transfer or Grab files? ').lower()
	
Exemple #2
0
		else:
			print('[!] Invalid response. Supported responses are: yes, y, no, no (case insensitive)')

	config.add_section('Login')

	sshUser = raw_input('The user you will be logging in as: ')
	config.set('Login', 'User', sshUser)
	sshHost = raw_input('The host you will be connecting to: ')
	config.set('Login', 'Host', sshHost)

	config.add_section('Misc')

	#while loop to ensure value entered is an integer
	while True:
		waitTime = raw_input('Amount of time (in seconds) that the script will wait before auto-closing: ')
		if not waitTime.isdigit():
			print('[!] Invalid entry. Only integers may be used for wait time.')
		else:
			config.set('Misc', 'waitTime', waitTime)
			break

	#Write config file
	with open('conf.cfg', 'w') as configfile:
		config.write(configfile)
		print('Config written successfully! \n')

#Have script run itself if run seperate from SC
if __name__ == '__main__':
	buildConf()
	timedExit(None, 6, 1)