Reid  Rohan

Reid Rohan

1661785097

Localtunnel: Expose Yourself

localtunnel

localtunnel exposes your localhost to the world for easy testing and sharing! No need to mess with DNS or deploy just to have others test out your changes.

Great for working with browser testing tools like browserling or external api callback services like twilio which require a public url for callbacks.

Quickstart

npx localtunnel --port 8000

Installation

Globally

npm install -g localtunnel

As a dependency in your project

yarn add localtunnel

CLI usage

When localtunnel is installed globally, just use the lt command to start the tunnel.

lt --port 8000

Thats it! It will connect to the tunnel server, setup the tunnel, and tell you what url to use for your testing. This url will remain active for the duration of your session; so feel free to share it with others for happy fun time!

You can restart your local server all you want, lt is smart enough to detect this and reconnect once it is back.

Arguments

Below are some common arguments. See lt --help for additional arguments

  • --subdomain request a named subdomain on the localtunnel server (default is random characters)
  • --local-host proxy to a hostname other than localhost

You may also specify arguments via env variables. E.x.

PORT=3000 lt

API

The localtunnel client is also usable through an API (for test integration, automation, etc)

localtunnel(port [,options][,callback])

Creates a new localtunnel to the specified local port. Will return a Promise that resolves once you have been assigned a public localtunnel url. options can be used to request a specific subdomain. A callback function can be passed, in which case it won't return a Promise. This exists for backwards compatibility with the old Node-style callback API. You may also pass a single options object with port as a property.

const localtunnel = require('localtunnel');

(async () => {
  const tunnel = await localtunnel({ port: 3000 });

  // the assigned public url for your tunnel
  // i.e. https://abcdefgjhij.localtunnel.me
  tunnel.url;

  tunnel.on('close', () => {
    // tunnels are closed
  });
})();

options

  • port (number) [required] The local port number to expose through localtunnel.
  • subdomain (string) Request a specific subdomain on the proxy server. Note You may not actually receive this name depending on availability.
  • host (string) URL for the upstream proxy server. Defaults to https://localtunnel.me.
  • local_host (string) Proxy to this hostname instead of localhost. This will also cause the Host header to be re-written to this value in proxied requests.
  • local_https (boolean) Enable tunneling to local HTTPS server.
  • local_cert (string) Path to certificate PEM file for local HTTPS server.
  • local_key (string) Path to certificate key file for local HTTPS server.
  • local_ca (string) Path to certificate authority file for self-signed certificates.
  • allow_invalid_cert (boolean) Disable certificate checks for your local HTTPS server (ignore cert/key/ca options).

Refer to tls.createSecureContext for details on the certificate options.

Tunnel

The tunnel instance returned to your callback emits the following events

eventargsdescription
requestinfofires when a request is processed by the tunnel, contains method and path fields
errorerrfires when an error happens on the tunnel
close fires when the tunnel has closed

The tunnel instance has the following methods

methodargsdescription
close close the tunnel

other clients

Clients in other languages

go gotunnelme

go go-localtunnel

C#/.NET localtunnel-client

Rust rlt

server

See localtunnel/server for details on the server that powers localtunnel.

Download Details:

Author: localtunnel
Source Code: https://github.com/localtunnel/localtunnel 
License: MIT license

#javascript #local #expose 

What is GEEK

Buddha Community

Localtunnel: Expose Yourself
Reid  Rohan

Reid Rohan

1661785097

Localtunnel: Expose Yourself

localtunnel

localtunnel exposes your localhost to the world for easy testing and sharing! No need to mess with DNS or deploy just to have others test out your changes.

Great for working with browser testing tools like browserling or external api callback services like twilio which require a public url for callbacks.

Quickstart

npx localtunnel --port 8000

Installation

Globally

npm install -g localtunnel

As a dependency in your project

yarn add localtunnel

CLI usage

When localtunnel is installed globally, just use the lt command to start the tunnel.

lt --port 8000

Thats it! It will connect to the tunnel server, setup the tunnel, and tell you what url to use for your testing. This url will remain active for the duration of your session; so feel free to share it with others for happy fun time!

You can restart your local server all you want, lt is smart enough to detect this and reconnect once it is back.

Arguments

Below are some common arguments. See lt --help for additional arguments

  • --subdomain request a named subdomain on the localtunnel server (default is random characters)
  • --local-host proxy to a hostname other than localhost

You may also specify arguments via env variables. E.x.

PORT=3000 lt

API

The localtunnel client is also usable through an API (for test integration, automation, etc)

localtunnel(port [,options][,callback])

Creates a new localtunnel to the specified local port. Will return a Promise that resolves once you have been assigned a public localtunnel url. options can be used to request a specific subdomain. A callback function can be passed, in which case it won't return a Promise. This exists for backwards compatibility with the old Node-style callback API. You may also pass a single options object with port as a property.

const localtunnel = require('localtunnel');

(async () => {
  const tunnel = await localtunnel({ port: 3000 });

  // the assigned public url for your tunnel
  // i.e. https://abcdefgjhij.localtunnel.me
  tunnel.url;

  tunnel.on('close', () => {
    // tunnels are closed
  });
})();

options

  • port (number) [required] The local port number to expose through localtunnel.
  • subdomain (string) Request a specific subdomain on the proxy server. Note You may not actually receive this name depending on availability.
  • host (string) URL for the upstream proxy server. Defaults to https://localtunnel.me.
  • local_host (string) Proxy to this hostname instead of localhost. This will also cause the Host header to be re-written to this value in proxied requests.
  • local_https (boolean) Enable tunneling to local HTTPS server.
  • local_cert (string) Path to certificate PEM file for local HTTPS server.
  • local_key (string) Path to certificate key file for local HTTPS server.
  • local_ca (string) Path to certificate authority file for self-signed certificates.
  • allow_invalid_cert (boolean) Disable certificate checks for your local HTTPS server (ignore cert/key/ca options).

Refer to tls.createSecureContext for details on the certificate options.

Tunnel

The tunnel instance returned to your callback emits the following events

eventargsdescription
requestinfofires when a request is processed by the tunnel, contains method and path fields
errorerrfires when an error happens on the tunnel
close fires when the tunnel has closed

The tunnel instance has the following methods

methodargsdescription
close close the tunnel

other clients

Clients in other languages

go gotunnelme

go go-localtunnel

C#/.NET localtunnel-client

Rust rlt

server

See localtunnel/server for details on the server that powers localtunnel.

Download Details:

Author: localtunnel
Source Code: https://github.com/localtunnel/localtunnel 
License: MIT license

#javascript #local #expose 

Cakephp-expose: CakePHP Expose plugin

CakePHP Expose plugin   

Exposes UUIDs as public identifiers for your entities instead of numeric AIID (Auto Increment ID) primary keys.

This branch is for use with CakePHP 4.2+. For details see version map.

Key Goals

Cloaking/Obfuscation

  • True randomness, so you cannot determine order or count of records per time-frame.

Security

  • Mass assignment and marshalling does not allow setting this exposed field - it are hidden by default just as the primary key.

Robustness

  • Must work with also more complex queries and use cases, including the atomic updateAll(), deleteAll().
  • Speed should be similar to default approach.

Simplicity

  • Code changes from AIID exposure to UUID lookup should be minimal for all public endpoints.
  • The default shortener provided makes the UUIDs also only 22 chars long concise strings.

Installation

You can install this plugin into your CakePHP application using Composer.

The recommended way to install is:

composer require dereuromark/cakephp-expose

Then load the plugin with the following command:

bin/cake plugin load Expose

Usage

Expose Plugin Documentation

Set Up

We will now add a new UUID field to your entity for exposure. By default it is expected to be named uuid. You can configure it to be any other key.

The primary key id (auto-increment integer) will not be touched by this plugin/behavior.

By default this exposed field is also expected to be of a UUID type (either binary16/32 or char36 etc), recognized by CakePHP as such. If you plan on using a custom length/UUID-type (e.g. varchar64), then you need to make sure the mapping to a valid UUID type class happens in your configuration.

Adding the Behavior

In your Table class, add this in your initialize() method:

public function initialize(array $config): void {
    parent::initialize($config);

    ...
    $this->addBehavior('Expose.Expose');
}

New Table Migration

Now let's make sure you set up your new entity with this new field, ideally including it in the migration.

// Add your exposed field
$table->addColumn('uuid', 'uuid', [
    'default' => null,
    'null' => false, // Add it as true for existing entities first, then fill/populate, then set to false afterwards.
]);

// Besides primary key we will also want to have a unique index for quicker lookup on this exposed lookup field.
$table->addIndex(['uuid'], ['unique' => true]);

$table->create();

If you want to save disk space, you can also use binary UUID (16 instead of 32 char length):

$table->addColumn('uuid', 'binary', [
    'limit' => 16,
    ...

With 16 instead of 36 byte you save half of the disk storage needed, and long term this definitely can be a lot. As such this is the recommended type. On top you can later add shortening, for details see further down.

Existing Table Migration

If you already have a table, and you want to add it to this existing one:

// Add it as 'null' => true for existing entities first, then fill/populate, then set to false afterwards.
$table->addColumn('uuid', 'uuid', [
    'default' => null,
    'null' => false,
]);

$table->addIndex(['uuid'], ['unique' => true]);

$table->update();

Use the command here to generate a migration file for you:

bin/cake add_exposed_field PluginName.ModelName {MigrationName}

With -d/--dry-run you can output first what would be generated.

Tip: Binary UUID saves a lot of disk space in the long run. Use -b/--binary option here.

Then execute the migration using bin/cake migrations migrate.

Entity update

You want to make sure that neither primary key, nor this exposed field is patchable (when marshalling = mass assignment):

protected $_accessible = [
    '*' => true,
    'id' => false,
    'uuid' => false, // Your exposed field
];

Now you are all set to go.

Usage

When saving an entity it will auto-add the exposed field when marshalling/patching. If you don't need this before the entity is persisted, it is recommended to do this upon save:

public function initialize(array $config): void {
    parent::initialize($config);

    ...
    $this->addBehavior('Expose.Expose', ['on' => 'beforeSave']);
}

Then you would query now in your public actions based on this exposed field:

/**
 * @param string|null $uuid Exposed UUID.
 *
 *@return \Cake\Http\Response|null|void
 */
public function view($uuid = null) {
    $field = $this->Users->getExposedKey();
    $user = $this->Users->find('exposed', [$field => $uuid])->firstOrFail();

    $this->set(compact('user'));
}

Instead of primary key id and ->get($id) we work on uuid field now for public access.

And you can link in your templates using this exposed field instead:

<?php echo $this->Html->link($user->name, ['action' => 'view', $user->uuid]); ?>

Replacement for find('list')

There is also a list replacement:

/** @var string[] $users
$exposedUsers = $this->ExposedUsers
    ->find('exposedList')
    ->toArray();

Using the key directly in queries

In some cases you might want to manually use the field in a query. Here it is recommended to get the field as prefixed version:

$field = $this->Users->getExposedKey(true); // ModelName.field_name
...
->where([..., $field => $value])
...

Especially when you contain other relations, you should always prefix the fields to avoid naming collisions.

Pagination restrictions

Set a sortWhitelist into your pagination config:

    'sortWhitelist' => [
        'name',
    ],

The id should not be sortable or filterable here.

Using a different UUID generator

It uses UUID version 4 generator from CakePHP Text utility library by default. If you want to use a different generator, you need to create a custom database type extending the UuidType and overwrite the newId() method:

public function newId(): string {
    return MyAwesomeUuid::generate(); // or alike
}

Populating existing records

The behavior ships with a convenience command to be called from CLI. So just run this to populate the existing records with the missing UUID data.

bin/cake populate_exposed_field PluginName.ModelName

Make sure the Expose.Expose behavior is attached to this table class. Also execute the migration for the field to be added prior to running this.

Once all records are populated, you can make a second migration file and set the field to be DEFAULT NOT NULL and add a UNIQUE constraint. If you run here the first command again, it will display the code snippet for it:

bin/cake add_exposed_field PluginName.ModelName

You don't need the dry-run part here anymore, since it will just output the migration content in this case.

Superimposition

In some cases you don't want to modify all public actions and their templates. In that case you can use the superimpose functionality to map UUIDs to the primary key field on read, and the other way around on write.

For this load the Expose.Superimpose component in the controllers you want this, and only for those actions that are needed:

// in the initialize() method
$config = [
    'actions' => [
        'index',
        'view',
    ],
];
$this->loadComponent('Expose.Superimpose', $config);

The behavior takes sure that you can also continue use ->id access inside templates. With this it will superimpose that field with the UUID. The actual primary key value will be stored in _id property by default here.

If you want more control over the behavior, you can disable autoFinder and manually set your find('superimpose') where needed, including associations.

Saving records

With superimposed primary keys, saving - and in particularly updating - records becomes a bit more complicated. Here, the behavior tries to auto-convert the primary keys back before saving. What it currently cannot fully do yet is to take care of relations and their foreign keys. Do not activate this behavior for those cases (yet). The primary intend of Superimpose is still to make exposure more easy and convenient - as readonly lookups.

Tip: Make sure you don't have any validation or domain rules on the primary key (e.g. "integer"). Those would work against the behavior here.

If you want still want to partially use it on saving nested entities, you can set recursive option to false on the behavior. Then all relations will just use Expose - and you will just have to use the uuid field on those for follow up usage in that same request.

UUID Shortening

If you also want to shorten the resulting output UUID from 32 to 22 chars, go with ShortUuidType class which extends the binary one. Make sure that your uuid is set to the binary type as outlined above.

While Migrations/Phinx require this field type to be binary length 16, the schema in CakeCHP ORM itself represents this as binaryuuid type. So here we need to overwrite this type-mapping of CakePHP now.

In this case you need to specify the type-map in your bootstrap:

use Cake\Database\Type;

Type::map('binaryuuid', \Expose\Database\Type\ShortUuidType::class);

A UUID stored in the DB as 4e52c919-513e-4562-9248-7dd612c6c1ca would then be displayed and used as fpfyRTmt6XeE9ehEKZ5LwF for example. This can be a bit more user-friendly as it is shorter and selectable with a double click in most browsers and apps.

Make sure to include the required composer dependencies as listed at the top of the converter class. For the default one to work you need to run

composer require brick/math

You can select a different converter than the default Short one by configuring it through Expose.converter:

// e.g. in your app.php
'Expose.converter' => \Expose\Converter\KeikoShort::class,

Or write your own one on plugin or app level using the given interface:

namespace App\Converter;

use Expose\Converter\ConverterInterface;

class MyShort implements ConverterInterface {
    // implement the methods
}

You can even provide your own callable if needed for a constructor initialization:

'Expose.converter' => function () {
    return new KeikoShort(Dictionary::createAlphanumeric());
},

Note: Adding a shortener later on is BC in terms of accessibility. The record can still always also be accessed through the long 36-char string here. Just make sure you 301 SEO-redirect or use canonical linking if that is relevant for you and those records.

If you need to access your converter anywhere in your system, you use the factory:

use Expose\Converter\ConverterFactory;

$result = ConverterFactory::getConverter()->encode($value);
$result = ConverterFactory::getConverter()->decode($value);

Backend

The plugin comes with an optional and small admin backend to reverse UUIDs. This can come in handy sometimes.

Browse to /admin/expose for this. As long as you didn't disable the routes for the plugin it should be visible right away.

If you have Auth enabled, make sure to allow your user (or admin role) access. Using TinyAuth plugin, for example (in auth_acl.ini):

[Expose.Admin/Expose]
* = admin

Quick Start for adding to existing records

Faster than the speed of light:

  • Add the behavior and run bin/cake add_exposed_field PluginName.ModelName {MigrationName} to generate a migration for adding the field.
  • Execute the migration and then populate existing records using bin/cake populate_exposed_field PluginName.ModelName
  • Re-run bin/cake add_exposed_field PluginName.ModelName {MigrationName} to get a non-nullable field migration for your new field.
  • After also executing that migration all new records will automatically have their exposed field stored as well.

You are done and can now adjust your public actions to query by exposed field only and hide the primary key completely. Using Superimpose behavior on top of Expose means that you actually might not even have to modify any code. Should work out of the box.

More migration tips in Migrating section.

Why AIID and UUID as combination?

See Motivation for details.

Demo

See sandbox examples.

Author: Dereuromark
Source Code: https://github.com/dereuromark/cakephp-expose 
License: MIT license

#php #cakephp #expose 

Elon Musk EXPOSED! (Shocking TRUTH About The RICHEST Man)

Elon Musk: Space Genius or Elitist Billionaire Jerk Face? In this video, we take a deep look into Elon Musk’s past and show definitively that he is not all he says he is. We’ll pry open the secret playbook that Elon and the other elites are using to push YOU out of Bitcoin so they can keep it all to themselves.

Grab a bag of popcorn, we’re going IN and telling you why Elon Musk is BAD. We’ll cover the history and the rise of Elon Musk. Find out all the details about the shady things Elon has been doing his entire life.

0:00 Intro
1:00 Assumptions
1:55 Screwed Tesla Founders
3:52 Screwed Fisker
5:07 Tesla’s Impact on the Environment
6:44 SEC & Pumps
10:55 Errol Musk

📺 The video in this post was made by BitBoy Crypto
The origin of the article: https://www.youtube.com/watch?v=pi3JNzjifkI
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #elon musk #elon musk exposed #the richest man #elon musk exposed! (shocking truth about the richest man)

Igor Rodrigues

Igor Rodrigues

1591802180

Exposing localhost to the internet

Resources about services and projects which will let out expose local http servers to the internet.

#networking #web-development #proxy #localhost #expose

Private Link for Azure SQL Database - Part 1 | Data Exposed

In the first part of this two-part video segment, Rohit Nayak explains what Private Endpoint for Azure SQL Database is and how it relates to the overall conn

#azure #sql #database #exposed