How do I know if a library is server-side or client-side library? - client-server

Correct me if I am wrong, a server side library runs on a server, and a client side library runs on the user's computer.
However, how do I know if a library runs on server or client? Is there a rule of thumb?
For example, why are node.js libraries server side libraries if you install it on your local machine and run it on your local machine?
If the library is executed somewhere locally but outside of a browser, is it still considered a client side library?

I would recommend you read these two articles. They should give you some clarity on Node.js functionality and server and client side scripting.
Server VS Client
https://skillcrush.com/2012/07/30/client-side-vs-server-side/
Intro to Node.js
https://www.google.com/amp/s/opensourceforu.com/2016/01/an-introduction-to-node-js-the-server-side-javascript/amp/

Related

Communication between Chrome javascript and native Windows code

I need to have a communication channel between my web application that runs on Chrome, and a native code on Windows. I need to run a native code when JS requests and pass the results back from native code. The environment is totally managed so I can set trusts and group policies, etc.
I can think of preparing a small web service that runs locally (and allows CORS) and call this service from javascript, but in this case i need to run this code forever.
Any advices will be very helpful. If it is possible i can try Windows registry write/read, pipes, shared memory, MMF or any other way to do it.
Thanks
There's a way to communicate with local processes without using an extension. Websockets aren't restricted to communicating with the same domain as the web page, they can communicate with a WebSocket server on localhost. You have to wrap your native code in a WebSocket server, libraries are available for that though.
Another method is Native Messaging, but it requires a browser extension:
Native messaging enables a WebExtension to exchange messages with a
native application installed on the user's computer.
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Native_messaging
https://developer.chrome.com/extensions/nativeMessaging

Implement WebSocket and LWSWS servers in same executable with libwebsockets

I'm trying to create a Web Socket server and a LWSWS web server provided in libwebsockets v2.0.
I just need a simple web server to provide HTML/JS/CSS content to the browser and a web sockets server to work with the Web front-end.
The only doc available is really short and doesn't say anything about that, as v2.0 is brand new. The libwebsockets GitHub recommand to refer to the LWSWS example in the project, but the procedures to implement and run a server for LWSWS and a Web Socket server are not matching (the first using libuv event loop, the other using built-in libwebsockets functions).
Maybe the only solution is implementing my own http callback but I want to make sure that there's no faster solution using LWSWS.
I managed to compile and run a LWSWS server from libwebsockets, embedding an HTTP Server and a Web Socket server in the same executable.
Guidelines
Use code from example lwsws/main.c, and copy .h and .c depencies to compile an LWSWS server
Use code from example plugin-standalone/protocol_example_standalone.c to compile your protocol plugin .dll
Create a quick server and vhost configuration from lwsws/etc-lwsws-conf.d-localhost-EXAMPLE and lwsws/etc-lwsws-conf-EXAMPLE
Put compiled plugins and libs at the right spot and enjoy your server
In case it might help !

Can I run a http server in nativescript?

Is it possible to run an in-app HTTP server with NativeScript either as a background service or as part of the foreground app itself ? I am looking to utilize a common code base across a system of applications which would communicate to a local server which handles some parts of the application's communication to my servers. Where, I intend to create a HTTP server in the app which can just serve as a REST server for the app. Is it possible ?
Thank you.
I don't think its possible since nativescript doesn't offer any module or plugin that supports the creation of http servers. First option is to look for a nativescript module in npm that supports http server creation, Second option is to create an http server using the native API's with javascript, Third and last option (which I prefer) is to make your own server using nodejs or any server side script and run that server on a certain machine then from your nativescript app you can access that server using the fetch module or the http module :)

How does port scanner portal works?

I visited http://www.andlabs.org/tools/jsrecon.html and it is allowing to do port-scan over the client network using web-socket. I am getting confused about this technology because if someone is scanning your network without including xss vulnerability to the website. Then why can't we install any Trojan or any customizable .exe to the client side using cmd?
Correct me if i am wrong here.
I don't understand your question regarding "Trojan" or ".exe", but you probably need to understand that this website instructs your browser to do something in the local network, there is no remote party involved in "network scanning".
This website does a very simple thing: it provides some JavaScript (JS) code that is executed locally (i.e. by the browser displaying this website). The JS code is (mis)using the Browser's websocket (and other) technologies for 'scanning' the local network (whatever this should mean, I did not dig into the details of the code).

VNC server -> websockify -> noVNC issue

Hello i have a bit of a problem using websockify.
I made executable for windows, then i start my websockify in cmd:
c:\web\websockify.exe 192.168.1.70:5901 192.168.1.70:5900
WARNING: no 'resource' module, daemonizing is slower or disabled
WebSocket server settings:
Listen on 192.168.1.70:5901
Flash security policy server
No SSL/TLS support (no cert file)
proxying from 192.168.1.70:5901 to 192.168.1.70:5900
so far all good. In the background VNC server is running on the same
computer at port 5900. The thing is i need to use websockify to be
able to use novnc on the other computer in local network.
I have latest novnc installed on latest XAMPP server (apache 2.2).
When i start vnc.html it asks for server, port, password. I typed
them in and press connect. I get an error on the websockify side:
WARNING: no 'resource' module, daemonizing is slower or disabled
Usage:
websockify.exe [options] [source_addr:]source_port target_addr:target_port
websockify.exe [options] [source_addr:]source_port -- WRAP_COMMAND_LINE
websockify.exe: error: no such option: --multiprocessing-fork
I can't connect using noVNC. I searched for internet to find solution
but did not find it.
Can someone help me get this apps together runnig?
or is there some more windows friendly solution with some other app that
does what websockify does?
br
Did you follow this guide? https://github.com/kanaka/websockify/wiki/Compiling-Websockify-as-Windows-Executable
Websockify uses the python multiprocessing module. This module is problematic on Windows, especially with older versions of python. You might try python 3.2 or greater and see if you have more success although no guarantees. Websockify is developed and tested on Linux only.
There used to be a pre-built version of Websockify for Windows that at least worked without multiprocessing (one client at a time), however, github dropped support for downloads so this build is no longer available.
Disclaimer: I made websockify.

Resources