Let's say you want to host domains first.com and second.com.
Create folders for their files:
| var net = require('net'); | |
| var sockets = []; | |
| var port = 8000; | |
| var guestId = 0; | |
| var server = net.createServer(function(socket) { | |
| // Increment | |
| guestId++; | |
| socket.nickname = "Guest" + guestId; |
| /* | |
| ** | |
| ** Example of Interprocess communication in Node.js through a UNIX domain socket | |
| ** | |
| ** Usage: | |
| ** server> MODE=server node ipc.example.js | |
| ** client> MODE=client node ipc.example.js | |
| ** | |
| */ |
| var net = require('net'); | |
| // creates the server | |
| var server = net.createServer(); | |
| //emitted when server closes ...not emitted until all connections closes. | |
| server.on('close',function(){ | |
| console.log('Server closed !'); | |
| }); |
This is an example of using module tls in NodeJS to create a client securely connecting to a TLS server.
It is a modified version from documentation about TLS, in which:
| const electron = require('electron'); | |
| const path = require('path'); | |
| const fs = require('fs'); | |
| class Store { | |
| constructor(opts) { | |
| // Renderer process has to get `app` module via `remote`, whereas the main process can get it directly | |
| // app.getPath('userData') will return a string of the user's app data directory path. | |
| const userDataPath = (electron.app || electron.remote.app).getPath('userData'); | |
| // We'll use the `configName` property to set the file name and path.join to bring it all together as a string |
| references = {} | |
| dictionary = [] | |
| def randomized(x, y): | |
| from random import randint | |
| return randint(x, y) | |
| def cracker_per_digit(x): |
| import { createCipheriv, createDecipheriv, randomBytes } from "crypto"; | |
| const ENCRYPTION_KEY: string = process.env.ENCRYPTION_KEY || ""; // Must be 256 bits (32 characters) | |
| const IV_LENGTH: number = 16; // For AES, this is always 16 | |
| /** | |
| * Will generate valid encryption keys for use | |
| * Not used in the code below, but generate one and store it in ENV for your own purposes | |
| */ | |
| export function keyGen() { |
| var time = 60; var clock = 300; function TimeHack(){ | |
| setInterval(function Applytime() { | |
| document.getElementsByClassName('timerLabel whiteTextWithShadow font-60 ng-binding')["0"].innerText = time; document.getElementsByClassName('timerLabel whiteTextWithShadow font-60 ng-binding')["0"].innerHtml = time; | |
| document.getElementsByClassName('clockHand').rotate = clock; | |
| }, 1);}; function TimeHackm() { | |
| setInterval(function Addtime() { | |
| time = time + 1; | |
| clock = clock + 6; | |
| }, 1000);} | |
| var score = 1; |