Downloading File To Local C Drive In Perspective

Good afternoon,

We have a config file at 'C:\TEMP\PD_CDT\C__USERS_Configuration.txt' on certain kiosk computers.

These kiosks run Perspective screens, and one screen on that display allows a user to enter a few details that are then written to the contents of the file at 'C:\TEMP\PD_CDT\C__USERS_Configuration.txt'.

The Write Configuration button uses this script:

def runAction(self, event):
	logger = system.util.getLogger('C9x_Quality_Display.ChangeLaunchedFile.Write')
	try:
		plant = self.getSibling("PlantDropdown").props.value
		device = self.getSibling("EnterDevice").props.text
		
		filepath = r'C:\TEMP\PD_CDT\C__USERS_Configuration.txt'
		data = "https://cmcignition03.challenge-mfg.com:8043/data/perspective/client/C9x_Quality_Display/Main/%s/%s"%(plant, device)
		data = data.encode('utf-8')
		
		logger.warn(system.file.writeFile(filepath, data))
		
		self.getSibling("PlantDropdown").props.value = ''
		self.getSibling("EnterDevice").props.text = ''
		
		logger.info('Plant/Device written to %s, %s/%s'%(self.session.props.address, plant, device))
		
	except Exception as e:
		
		logger.warn('%s'%(e))

The purpose of this script is to:

  1. Read values from dropdown and textbox
  2. Write these values to C:\TEMP\PD_CDT\C__USERS_Configuration.txt on the local machine
  3. Write '' to dropdown and textbox to rehide this button/let user know value was changed

At first, I thought that the system.file.writeFile(filepath, data) was failing silently, until I realized it is writing to the gateway's own file location.

That's not exactly what I wanted. I also don't want to use system.perspective.download() because that would just drop the file in the downloads folder, requiring the user to drag the new config file to the correct location. If that were the case, they might as well just update the file location in the config themselves manually.

Is what I am trying to do even possible? Can I write to the local computer without using Perspective's download?

No, not without the user selecting the right folder to which those settings should load.

Basically, you are asking if your malware-like behavior can be tolerated. (Because malware wants to do this same thing to compromise a target.)

Ok, thanks for the confirmation.