zackrspv
22nd February 2011 23:09 UTC
Read Remote File
Hello there!
Is it possible to read the contents of a remote text file (http server), without having to download the text file to the local machine?
Right now, i use INETC to obtain the text file, save it locally, read it, close it, compare values. I really dont want to do that, as that's how I verify version and password of a local tool i use.
i just want to be able to read the password from the website, and use that as a variable inside of the script.
Can this be done?
Afrow UK
22nd February 2011 23:14 UTC
Firstly I would argue that you shouldn't read a password. You should read a hash of it instead. Otherwise no not without writing your own dll/exe or modifying inetc to do it. It would be a handy feature of inetc I would agree (a /tostack option).
Stu
zackrspv
22nd February 2011 23:16 UTC
that bites :(
I really dont want to have to download the password.txt from my server lol.
I keep reading that there are other ways to validate input, like passwords, etc, but none really w/o hard coding the password inside of the script file.
Any good solutions out there to validate user input in order to launch the installer? Like, maybe a php script, or something that can be used?
Dunno, just frustrating :(
Anders
22nd February 2011 23:18 UTC
You could probably call WinINet or WinHTTP function with the system plugin, see http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx for a list of functions
zackrspv
22nd February 2011 23:34 UTC
There is this plugin: http://nsis.sourceforge.net/NsisUrlLib_plug-in
However, even when following the instructions, it doesn't seem to ever return anything.
NsisUrlLib::UrlOpen /NOUNLOAD "http://www.mydomain.com/text.txt"
NsisUrlLib::IterateLine /NOUNLOAD
Pop $1
The above variable, $1, actually is blank.
if i were to Pop $R1 right after the UrlOpen, i'd see some sort of transfer error. nothing other specific than that. If it'd work, this would rock, and solve the issue of reading remote files, but, sadly, not working :(
Afrow UK
23rd February 2011 00:02 UTC
If you are validating a password as I said you should hash it and check that instead. When possible you should always avoid having a copy of the actual password. Also instead of downloading the hash/password, instead POST the hash/password to a web script which does the validation and outputs some success string. Note that this could be bypassed by using a proxy or by changing the hosts file.
Stu