views:

243

answers:

2

Hi All.
I am working to enhance some features of a web based apps.
Sometimes for legitimate purposes you may want to spoof the referring URL when opening a web page.
Constraints: Javascript disabled (as a company policy), browser: Firefox. Language: VB scripting is a must.
I tried:

Option Explicit
Dim objShell, url, referringUrl
url="http://www.examplemainsite.com"
referringUrl="http://access1.examplemainsite.com/preparefordownload.html"
Set objShell=CreateObject("WScript.Shell")
objShell.Run "firefox.exe" & referingUrl
WScript.Sleep 5000 'just for user to wait until full loading of the web page
objShell.SendKeys url ' I need now to open the url
objShell.SendKeys "{ENTER}"

The problem is that when testing, from web server no referring url is sent and therefore the new admin guys are not granted access.

Reasons behind: as the activity increased, new administrators have to help me in handling issues. Instead of creating sessions cookies and authentication (that I will however consider in the future if no other way), they might want get quick access to the core files without the burden to follow a long list of URLs until to get free access to the repository (as normal users do after they click on some pages with ads from the sponsors). As the access is granted (without user and password and no cookies mechanism) only coming from certain urls, you might probably wonder why not providing the new admistrators with the referring url by mail and solve the problem. The answer: there are many locations and for each I have defined a unique referring URL. Those referring URLs need to be changed very often as to avoid users to spread them all over after they have downloaded the video and thus having the url. I have decided to put the referring urls at the disposal of new administrators that will load them from local using a vbscript that accesses a location from the server that is not made public.

A: 

Simply requesting one URL after another in sequence does not make a referring URL. You would need to inject the link into the DOM in the Firefox page and click on the link programmatically to do it that way. Probably better to see if you can modify the headers directly. You should be able to set up a Fiddler rule to do this.

Martin Smith
Unfortunately, I am not used with DOM. Also not heard about Fiddler rule, but I am willing to learn.Any reference? or maybe some code example where to start from to get used with?Highly appreciate.Thanks
carmao
Martin Smith
A: 

Sorry to add details of question here referring to Martin answer, but comment link under each comment does not work for me (I can not figure out why).

@Martin:
I think the addon indicated needs to be used somehow
(although
1. it is designed - out of specs - to block some urls, not to programmatically configure some url
2. some issues with the current version of that addon were raised out of what I see on the link indicated).

I could not imagine the administrators change the referring URL manually using that addon (it is too frequent the change, i.e. many times a day).
Preferably to be used programatically to extract automatically the info from the respective central location (and vb script is the cheap and most simple platform I used as it could be found most common to any user machine which has Windows installed on it, and vb scripting contained in it by default - the new administrators are coming from the most active users, I would prefer not to deploy any other apps unless there is no other choice)

carmao
I searched on mozilla site. Firefox has a configuration file (prefs.js). It can be used to configure (again using some batches like vb script) a proxy programmatically by modifying some lines therein.Trying to find out a config line in the prefs.js file to setup the refering url, it seems there is none. However, I found an interesting entry (network.http.sendRefererHeader) and a similar entry for https, but not solving my issue.P.S. I notice that comment link under each answer is functional now (?!...)
carmao