how to look for live index.html in ftp - html

We are using FileZilla as out FTP. At the moment, I want to insert a script in the live index.html. Unfortunately, there is more than 1 index.html files on the ftp.
I was wondering how to pinpoint the exact one?
Is there a way to trace it back using just the Google Chrome Inspect Element?
Thank you in advance!

By "live", I presume you mean the one displayed when you visit a particular URL; and by multiple index.html files existing, you presumably mean that there are multiple folders on the FTP server, and you don't know which one maps to the URL in question.
The short answer is no: the mapping from URL to directory structure can be configured however the administrator of the server wants, and is completely invisible to web browsers, so there is no general rule to find out.
Barring luck in finding some clue, you have two ways to attack the problem:
Firstly, you can search for distinctive content: take a copy of all the folders you think might be relevant, then do a "find in files" for some text you know is in the target file but unlikely to be elsewhere. At worst, you might narrow down the list of possibilities before trying the next approach.
Secondly, you can use trial and error: make a list of candidate files, then edit each in turn to add an innocuous but visible piece of text. Then load the target URL and see if it changed; if not, revert the file and try the next.

Related

Is there a simple way to change multiple image sources at once?

I have dozens of HTML files hosted on a platform that is soon being shutdown. 90% of the images within each HTML file are hosted on the dying platform and thus need to be re-hosted.
Is there a simple tool or method I can use to bulk download all the
images within an HTML file, so I can re-upload them to the new
platform
Is there a simple tool or method I can then use to rename all the references to Images in the HTML to reflect the new file path?
I am just going over my head here I am assuming following;
you have same domain but changing host servers assumption is you have control over code base. In this case then its simply code over the code and directory structure as its using ftp -> download from one -> ftp upload onto another. hypothetically things should work.
you are changing domain so it becomes a programmable issue i.e domain-a.com/someimage.jpg is now domain-b.com/someimage.jpg and it is being fetched by the browser on to which you have no control over.
if for any reason domain were to be the same and directory structure were to change all you had to do run bit of configuration on ht-access or virtual host or what ever and reroute things internally. ht-access example below
RewriteEngine on
RewriteRule ^somefolder/(.*) otherfolder1/$1
server would identify the URI if it matches the condition then it internally forwards it to otherfolder and /$1 appends what ever was after the matching condition e.g. domain.com/somefolder/myimage.jpg now becomes domain.com/otherfolder/myimage.jpg
BUT domain has to be the same because browser has to send it to the server where htaccess is residing. If its on some other server which is dying then solution is of no use.
Which means we have client side issue. Massive overkill hack so I wont even begin going down that track.
Easy but takes bit of time and in longer run helps a lot.
install vs code - if you haven't used this IDE its about time you should it helps you make better progammingly.
make copy of the folder you have where all your code is.
run VScode and go to file menu -> open folder
on left hand side you see files and structure of the folder meaning folder is successfully opened.
once again file menu -> Save Workspace as... prompt will pop up just gave project name or what ever honky doory you like to be. VScode now will configure things for you.
should be something like this
if it does not show then simple click the double file icon side pan will toggle.
now that we are done with this lest do the magic
6) click on search icon something similar to this will appear
little arrow on left gives other options such replace etc
shortcut Ctrl + Shift + F for search Ctrl + Shift + H for search and replace.
What it does it does not just search in a file it searches in all the files in given folder including sub directories and obviously you can replace them.
So you need quick dirty way of doing it which is more smarter than actually going over each file one by one then above would suffice.
Other than installing depending upon number of files it should take few second to a minute.
Ps I have quirky way of naming things probably have dozens of temp strings here and there and at times need to change them everywhere. This is what I do.

Get .html filename of a website with Firebug

How do I find the filename of an website I am inspecting with Firebug? As example when I look on http://example.org/ I can view inspect the Element, I see the whole html structure but I didn`t find the filename. I am searching for index.html or something in that way. Maybe this is an analog question, but I am not sure, because he/she is working with php. LINK
I know there are some solutions with Dreamweaver or other tools but I am searching for an easy way to figure that out with Firebug or an free Browser Add-On. I Hope you have a solution for that.
The URL you entered is the one that usually returns the main HTML contents. Though on most pages nowadays the HTML is altered using JavaScript. Also, pages are very often dynamically generated on the server.
So, in most cases there is no static .html file.
For what it's worth, you can see all network requests and their responses within Firebug's Net panel.
Note that the URL path doesn't necessarily reflect a file path on the server's file system. It is depending on the server configuration, where a specific URL maps to in the file system. The simplest example is the index file that is automatically called when a domain is accessed. In the case of http://example.org the server automatically loads a file index.html in the file system, for example.
So, in order to get the file name on the file system, you need to either check the server configuration or the related access logs.

How can I find my working directory?

You'll have to bear with my slightly on this, but please ask if I have left out any pertinent information. I have just taken over a project to create a dashboard for my team. This dashboard has been made using a niche third-party tool that nobody here will have used before. The third party tool auto-generates some code to display "markers" on a webpage. "Markers" being some proprietary code to query a database/apply custom styling etc.
I am trying to display a webpage within the page that has been generated, and I’d like to point this to a local webpage (ie on my C drive). If I pass it an absolute path, then this results in a warning in IE9 as I am mixing data sources - a https website pointing to a http web page. It will display after ignoring the warning, but my userbase is not comfortable enough with computers to ask them to do this.
I believe if I pass it a relative path then it should work, but I can’t find out what directory to base this path off and it doesn’t appear to be anywhere obvious. So, in my current page I have an image with the web address of : https://website:8443/websitereport/images/buttons/locked.gif. What I need to know is where the “websitereport/images” folder is stored so that I can put my webpage in there to give the webpage a relative path. The HTML for this image is :
<img id="dvp_locationbar_lock" class="dvp_imagebutton" style="" dvp_title="ui.tip.lock-page" dvp_image="locationBarPageUnlockedImage" src="/websitereport/images/buttons/unlocked.gif" title="Lock this page">
What are my options for discovering where this folder is stored locally? I am running Apache Tomcat 7.0. It is not displaying if I use the path based off
C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\work\Catalina\websitereport
of
\websitereport\page.html
And I cannot find it anywhere obvious in the Apache folder. I have tried :
Searching - no results.
Using PHP to print the current working directory - cannot find out
where to edit the webpage.
Looking at images/information on the existing webpage. They all point
to folders I cannot find.
Inspecting with firebug.
In short, you can't rely on the files being on disk at all - they might be just contained in a *.war file, containing the whole application. Or they might be generated on-the-fly, despite the name sounding like an actual file.
Also, you should not arbitrarily write within a directory even if you find it (my closest guess would be tomcat's webapps/websitereport/ directory if it exists) because nobody will know that something changed during the time since last deployment. So, on the next update of the application, you'll end up overwriting all of your changes again. You typically change the underlying application and redeploy.
You might also find a few references in tomcat's conf/localhost/ directory or even in conf/server.xml, but it all depends on how your server was administered

Opening directories in HTML

In some websites, I see links that look like this:
Link
The link doesn't go to an html file, but a folder (I believe). I was wondering if this has any purpose, and how to do this. Is there a default file to open when opening a directory? Because when I try something like this, I click the link, then I see a list of files in that folder, and I have to click on the proper link.
Everywhere I look, it says you should do links like this:
Link
Should I just let it go? I'm awfully curious.
This is something that is controlled by the web server. Some will look for a file called default.htm, others will look for index.html. It's usually configurable, and sometimes the server may look for any of a number of variations of index or default.
If such a file is not found, the server will often display a directory listing of all the files found in that folder, but usually that's not a good idea for security reasons. Again, this is something that can be controlled in the settings for the server.
Allowing directory listing is VERY dangerous and ill-advised practice. You should hide real directory structure of your site by all means.
PHPDL is a Php script that lists all the files in a directory (except itself of course). What sets PHPDL apart is that everything the script needs is in one file, including the file-type icons it uses.
Note: You can rename the script to anything you want. It will not list itself as a file to download.
This script safe and usefull, see demos:
http://greg-j.com/projects/phpdl/PHPDL-v2.php
http://greg-j.com/projects/phpdl/PHPDL-lite.php

Encrypt CSS external link and restrict access to it

I have a new client who asked me to make 2 websites and no payment so far!
I have the ftp accounts, but he can always close my access and leave me without pay.
Can I upload the CSS to another server of mine and encrypt the link to CSS file?
If yes, can I restrict peoples to see the file if they find the URL to CSS file?
Thank you!
If they are his hosting accounts, then accessing them to tamper with the code for the purpose of disabling his sites without his authorisation is probably illegal.
If he hasn't paid you, you own the copyright. If he refuses to pay you, file a DMCA complaint with his hosting company.
Technological measures like this are futile and unprofessional. Next time use a contract.
This is simple. Same scenario happened to me, and what I did was added an new index.html which was an under-construction page, and renamed the original index.php as index_to_be.php.
I then added a redirection using htaccess to the new index.html.
The client contacted me straight away and paid up in no time.
If you don't know how to use htaccess, you can simply add a header location value to the top php page.
header("location:index.html");
The best way to do this is to create a simple PHP file that allows you to access, edit and delete files on the server. You can also search for a ready made lightweight ftp script. Place the PHP file somewhere on the server nested in other folders and name it something like temp.php. Now even if the client blocked you access to the server, you can still access, edit and delete files on the server by pointing your URL to temp.php. When you get paid, be kind enough to remove the file. Don't forget to password protect it.
In your PHP file you can use opendir() to read files from a directory, and unlink() to delete files. If all you want to do is be able to delete files, then the script will not take you more then a minute to create.
UPDATE
You can use the following lightweight ftp script that will let you view, edit delete files and also give you the option to password protect it. http://sourceforge.net/projects/pafm/
You could remove the style sheet from the client's site, upload it to one of your servers and embed it from there:
<link rel="stylesheet" href="http://your.server/styles.css">
however, you will not be able to seriously obfuscate this. One idea that comes to mind is to add a huge number of spaces before the "link" tag to hide it in the source code view.
<link rel="stylesheet".....>
You could also lazy load it using jQuery, but that would disable the style sheet for users who have JavaScript turned off - mostly a no-go.
In the end, no matter what you do, all this will be trivially easy to circumvent. There is no way to reliably keep control over the site in the scenario you describe. Like #thirtydot says, the best thing to do is to send a screenshot instead.
This is probably like trying to kill a fly with a ICBM but...
You could always use a JavaScript to add the link element to the DOM, and run the JavaScript code through a JS obfusticator.
But still, that's hackish, and overkill, and ways you can get the link anyway.