How to incrementally search for files in a website? - html

this is a hypothetical question for an intro to servers course.
Say you want to search for all available .txt files in a web directory such as
http://xyz123madeupname.com/files
A .txt file that is available to you is called http://xyz123madeupwebsitename.com/files/1256
Another .txt file that is available to you is called http://xyz123madeupwebsitename.com/files/1795
You want to find out what other files are available to you from this directory.
How would you do that without manually entering a number and checking to see if a .txt file is available to you? Is there a tool you could use to incrementally check files/1 to 2000 and see if there is a .txt at that page?
Thanks,
Buddy

Simple answer is no. If the web server has been configured correctly it will serve a default document, and if that document is found in the folder, that's what you'll get. You can't make a request that says "show me your directory tree." because of permission and security implications. So anything professionally coded won't let you do this. Many sites deliberately dispense with the robots.txt file because it could tell attackers where things like scripts are located. (Many other sites just forget to create one, of course.) See Directory traversal attack, Robots.txt

Related

Beckhoff: choosing configuration file

Sorry for the noob question. I have a Beckhoff digital output module and need the appropriate configuration file. Downloaded the available files from the official site and in the description the wanted model was there.
To be more specific, I need the configuration for EL2809, however in the downloads I can only find intermediate xmls (EL25xx and EL29xx). Would they work too? What is the process to choose a config file?

Copy a file to the clipboard in HTML

I've Googled around this for an hour and not found anything suitable, but it feels like something that surely should exist and be quite easy/common? So I'm asking here.
I'm planning on hosting a number of small files on my server. These contain Midi information (used in music production).
What I want is to create an HTML page that lists each of these midi files, and allows the user to click a button to copy the file straight to their clipboard, so that they don't have to download each file and then locate it in their downloads folder.
I can't find any solution for this. I've found lots of solutions for copying text, but I want to copy a file instead - Is this possible?
Primarily I'm open to using HTML, PHP or JavaScript.
Thanks in advance for any assistance.

Import files into a directory on a HTML document

I am wondering if I can have a webpage where I can tell it to grab my file and put it in a directory, such as: "http://example.ex/folder". Meaning the file I provided is put into the "folder" folder.
Overall process:
Button says: "Import file"
I select a file, and my file is "text.txt"
It takes my file "text.txt" and adds it to the local system/directory of the website.
You can do this using JQuery File Upload and then adding a backend service that captures the file and saves it.
For example, here is a repository that has a basic Python (Flask) server integrated with JQuery File Upload that will take an uploaded file and place it on the server:
https://github.com/ngoduykhanh/flask-file-uploader
I'd put the rest of the code here, but it is a lot - and requires HTML, JavaScript and a back-end language (like Python).
Here is the documentation on JQuery File Upload: https://github.com/blueimp/jQuery-File-Upload
As a word of caution, DO NOT TRUST ANYTHING UPLOADED TO YOUR SERVER. Meaning, do not put it out on the open internet without some sort of authentication or checks in place to make sure only files you intend are uploaded. Otherwise, people will find it and upload scripts turning your device into a Bitcoin miner, spam relay, or bot host.
Instead of doing it this way, why not use SFTP to upload it to your server to host? At least that way you can lock down access.

How to handle uploading html content to an AppEngine application?

I would like to allow my users to upload HTML content to my AppEngine web app. However if I am using the Blobstore to upload all the files (HTML files, css files, images etc.) this causes a problem as all the links to other files (pages, resources) will not work.
I see two possibilities, but both of them are not very pretty and I would like to avoid using them:
Go over all the links in the html files and change them to the relevant blob key.
Save a mapping between a file and a blob key, catch all the redirections and serve the blobs (could cause problems with same name files).
How can I solve this elegantly without having to go over and change my user's files?
Because app engine is running your content on multiple servers, you are not able to write to the filesystem. What you could do is ask them to upload a zip file containing their html, css, js, images,... The zipfile module from python is available in appengine, so you can unzip these files, and store them individually. This way, you know the directory structure of the zip. This allows you to create a mapping of relative paths to the content in the blobstore. I don't have enough experience with zipfile to write a full example here, I hope someone more experienced can edit my answer, or create a new one with an example.
Saving a mapping is the best option here. You'll need to identify a group of files in some way, since multiple users may upload a file with the same name, then associate unique pathnames with each file in that group. You can use key names to make it a simple datastore get to find the blob associated with a given path. No redirects are required - just use the standard Blobstore serving approach of setting the blobstore header to have App Engine serve the blob to the user.
Another option is to upload a zip, as Frederik suggests. There's no need to unpack and store the files individually, though - you can serve them directly out of the zip in blobstore, as this demo app does.

A web-page that would provide a user to download a certain file from it, but would not disclose the location of that file - is it possible at all?

(I am sorry if my question is not in the right place. (I've been thinking for awhile and came up to the conclusion that this one is the best place for my question)
Is it possible to create such an HTML web-page that would provide a user to download a certain file from it, but would not disclose the location of that file (i.e. the user would not know the URL of the file that he is downloading).
If yes, would you, please, give me some directions as to which HTML code I should use to create such a page.
The HTML page would provide a link to a server side script passing a filename or other unique moniker:
Download Now
The script would read the identifier, derive a full path from it, load the file and write it back with the appropriate headers/mime type causing the browser to prompt the user with the normal download dialog.
The only location data available to the user would be the link to the script - which would - unless you add some security - serve back the file just as if it were a standard url pointing to a file.
(PHP Example)
With pure html, no. But with a serverside script (php, c#, vb, perl, or other) yes. You would stream the file to user. In that case just the serverside script has access to the origin files