security - is there anyway to know server file directory structure in java? -
I am trying to access a remote file on the server for one study purposes.
My server is as simple as the following:
- This is a basic Spring MVC project
- This is an index that is "HelloWald" and existing server time
What I'm trying to do is down:
- Login URL (for example,
http: //192.168 .0.1: 8080 / test )
- Find the absolute path to the index that is somewhere on the server (remote file)
- "HelloWald" to "Hi, John!" Open and Edit
I already tried with HttpUrlConnection, but the methods of that class did not match my objectives The second attempt was with the file class. I have put a URI in the file, but the URI only considers the "file: //" protocol.
How do I change that text to a remote server computer?
3 that are not using 2 codes: - Use SSH to access the server and change
index.html using your worldwide shell text editor (div class = "text-mail" itemprop = "text">
Such as Vi, Nano etc.)
- Use SFTP to access and overwrite the server's file system
index.html in a new string Or version.
- Create a
REST -interface on your server that allows you to change the content. This coding is required and I do not know whether the amount of effort is actually appropriate for your purposes.
Edit:
Do you think you want to change a remote file without any 'interaction' of this remote server, Such as a REST-interface or whatever it is possibly so easily, it will create a great security vulnerability for the system. That's why you always need to contact the server, e.g. Through a
REST -interface or preference, you can not type in some
java code and magically modify a remote file. With the only
Java you can do that the only thing is to access the server via
ssh or
HTTP and it can be accessed by a remote server It means that you have to do some work on your server side to make such modifications possible.
- Use SFTP to access and overwrite the server's file system
- Login URL (for example,
Comments
Post a Comment