How can I access my SQLite3 database on a live application? - node.js

So basically I have a SQLite3 Database that I am using for a Discord Bot. Is it possible for me to access my database file to check what's inside while the application is hosted and live?
I've considered that it is probably possible to do this from the command line within my terminal that I use to access the virtual host, but I do not know where to begin/what to input.
Ideally I would want to be able to view the file inside the DB Browser for SQLite program, for visual purposes, but for starters I want to know if its possible to see the live-updated database remotely, as my application is hosted on a virtual host/machine.

You can install phpliteadmin (https://www.phpliteadmin.org/) on your server to view your database.
Otherwise your can download your database file and view it in a client (Example of online client: https://extendsclass.com/sqlite-browser.html)

Related

Where is the data stored in localhost?

i followed a tutorial and made a todo list web app using nodejs, express and ejs. after completing i used ngrok to make my localhost public so that i can share it with my friends, now i've realized that the tasks that i add on my todo list are saved in my server unless i restart it or close it completely. i want to know where the tasks which is a is stored in my local machine, does nodejs store it, or its saved in the memory of my local machine, more importantly if its already being stored somewhere why do i have to worry about using a database server like mongodb or firebase? hope my question is clear.
If you store your data in array or something in your code i can say "Yes. the data would be stored in the memory of your local machine".
And you don't have to worry about database if you don't have to permanently store your data.

Access database from different network

I am trying to build a react-native application and to do so, I am following this tutorial : https://www.youtube.com/playlist?list=PLB97yPrFwo5hMR8znwt0NqgmmqzoPemnT
My application is like a form. People must enter some data into some fields and they will be sent into a database. People can later see their form from the application. So it is like simple a CRUD todo list application.
However, I do not want to use on-demand cloud computing platforms (AWS, GCP, OVH, ...) to store my data. I have my own server at home (NUC Intel) and want to use it as the application's server (store the data in there).
On my server I want to have a mongodb database and make it available from any computers that request it with the correct credentials. I would add firewalls as well for security.
This way, the react native application will be able to access read and write from this database wherever they are in the world as long as they have internet available.
As my backend I will use nodejs and express.
As my front end React Native and Redux.
Any ideas or tutorials I could follow ? I have been looking a lot but all the tutorials end by storing their database in GCP or AWS ... So is it possible to access mongodb database from a different network? Or would MySQL be a better solution?

Is there a way to "escape" linux commands?

I'm making an service that will allow users to post files to my web server which will then copy that file (after a few checks) to the image server. The main way of communicating between my web server and my image server will be scp. However, I also want to maintain user filenames, so it would look like this:
User posts their file to web server
Web server checks if the file is supported
Web server checks if file is under file size limit
Web server says OK and tries to send to image server
Web server runs ("scp " + filepath + " root#imageServer:~/images")
Image server receives the file and is ready to send the file to user on request (the folder is public and will be served by nginx)
the dangerous part here is the scp command. I'm not an expert on security, but is there a way that this command can get hijacked the same way a database can get SQL injection? What if somebody named their file to be malicious. Is there a way to safely join the filename to the script? To safely "escape" the command?
I'm using express (node.js) for the web server. Is there another way to send files from the web server to a simple Ubuntu install without unix commands or writing up a REST api for the image server? Is there is, then I might not need to "escape" at all
Btw, the reason why I'm choosing to have the image server and the web server separate is because I want to scale the application in the future. For example, if there were 10 web servers and no central image server, then it would be impossible to retrieve files if the file isn't on the web server you request from.
You can run an external command without a shell (and therefore without issues with shell metacharacters) using child_process.spawn (or other methods in child_process). (Obviously, you must not specify the shell option as anything other than the default false.)
That lets you not worry about metacharacters in the filepath, but it seems to me that there are plenty of other issues with letting the user provide a filepath name to be used as such on a live filesystem. Personally, I'd autogenerate safe, short names and keep the correspondence from user name to filesystem name in a database somewhere.

How to open database in web browser locally with IBM Notes

I have Domino Server running locally. I can assess for example the log.nsf and names.nsf databases in the browser (ie. http://localhost/log.nsf).
But I also created my own databases for example test.nsf
when visiting http://localhost/test.nsf, I see this:
Error 404
HTTP Web Server: IBM Notes Exception - File does not exist
What do I need to do to access views and agents from my own created databases
I try to -basically- answer this from the dialog that we had in the comments:
IBM Notes / Domino is a Client- Server solution where IBM Domino is the server and IBM Notes is the client.
Usually you work with the client and connect to the server that is on another machine.
Notes client is -by default- installed in C:\Program Files (x86)\IBM\Notes and the Data- directory (containing the personal addressbook of the user named names.nsf, the bookmarks and desktop and the client log.nsf) is in C:\Program Files (x86)\IBM\Notes\Data (ignoring multiuser setup on purpose as it makes things to complicated).
A Domino server is -again by default- installed in C:\Program Files (x86)\IBM\Domino, its data directory is in C:\Program Files (x86)\IBM\Domino\Data.
There is a names.nsf and a log.nsf there as well, but names.nsf is the Domino Directory of the server and log.nsf the log of... you guess.
Now one can of course install Notes and Domino on the same machine, but still they are two distinct programs.
To access Databases from a Domino server, you NEVER access them directly via file system but use the Open- Dialog to open them from the server.
If you want to access the files via admin- client (that can be installed along with the Notes Client), then you select "Open Server" from the File- Menu to access it. AGAIN: Don't access server files "directly" although they are on the same machine.
When creating new databases (from client or admin) select the Server to create them, NOT "Local".
What is the problem with the question: You created a database in the Data- directory of the client. The server does NOT know of this database as it has its own Data- directory. it will show the message you wrote.
Create it in the Data- Directory of the server instead then it will work.
Of course one could just copy the database from Notes\Data to Domino\Data.
But this will -by default- not work either: Out of the box the Notes Client encrypts every local database with the user's ID file. When copied over to Domino the server will not be able to read it. You need to decrypt to database before copy, you can do that in the properties of the database.
All together seems, that you need a training for whatever you try to do, otherwise this question will be your least problem.

store string inside machine without using Database

I have created NodeJS application that communicate with SerialPort for example COM7.
because the COM name is not static it could be change all the time.
I'm looking for a way to save COM7 as a String inside a machine, and able to fetch it to NodeJS code.
and also change it remotly.
It is the same idea like database, but I see it really unnecessary to start database for only 1 record.
Look like Session on php but permanent.
** OS: Raspbian.
Thanks.

Resources