Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
wifi-qr-code-generator
Advanced tools
⭐️ Star us on GitHub — it helps!
wifi-qr-code-generator is an npm module to generate a QR Code to connect to your WiFi. Supports WiFi QR Codes in PNG, SVG, Terminal and UTF output formats. Works in both node server and browser.
Using NPM:
$ npm install wifi-qr-code-generator
Using Yarn:
$ yarn add wifi-qr-code-generator
const qrcode = require('wifi-qr-code-generator')
const pr = qrcode.generateWifiQRCode({
ssid: 'Hello world',
password: 'testpass',
encryption: 'WPA',
hiddenSSID: false,
outputFormat: { type: 'image/png' }
})
pr.then((data) => console.log(data))
This prints the following output:
data:image/png;base64,iVBORw0KGgoAAA...
You can pass this data URL to an html img
tag to generate the following QR code image:
Main API call is generateWifiQRCode
which is shown in the example above. This method takes an object of the following format:
export interface Config {
ssid: string
password: string
encryption: 'WPA' | 'WEP' | 'None'
hiddenSSID: boolean
outputFormat: OutputFormat
}
export interface OutputFormat {
type: 'image/png' | 'utf8' | 'svg' | 'terminal'
}
ssid
: string representation of your wireless SSID (Wifi name). Max length possible for WiFi SSID is 32 characters for most routers. However this library doesn't impose any limitation on the length of SSID that can be passed in.password
: string representation of your WiFi passwordencryption
: Possible values here are WPA
, WEP
and None
. If you are using WPA2, enter WPA
. Please note that WEP protocol has multiple security vulnerabilities and you shouldn't be configuring your WiFi router to use WEP at all.hiddenSSID
: should be true
if your router is configured to NOT broadcast your SSID. Else false
outputFormat
: An object that has a single type
fieldPossible values of type
are:
"image/png"
: generateWifiQRCode
will generates a data URL representing a PNG image"svg"
: generateWifiQRCode
will generates an SVG image in string formatutf8
: generateWifiQRCode
will generates a UTF8 representation of the QR codeterminal
: generateWifiQRCode
will generates a string that can be pretty printed as QR code in the terminalconst qrcode = require('wifi-qr-code-generator')
const pr = qrcode.generateWifiQRCode({
ssid: 'Hello world',
password: 'testpass',
encryption: 'WPA',
hiddenSSID: false,
outputFormat: { type: 'svg' }
})
pr.then((data) => console.log(data))
This prints the following output:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 41 41" shape-rendering="crispEdges">...
You can use the generated SVG directly in your HTML page to display the QR code.
const qrcode = require('wifi-qr-code-generator')
const pr = qrcode.generateWifiQRCode({
ssid: 'Hello world',
password: 'testpass',
encryption: 'WPA',
hiddenSSID: false,
outputFormat: { type: 'utf8' }
})
pr.then((data) => console.log(data))
This prints the following output:
█▀▀▀▀▀█ █▀█ █ ▀▄█▄ ▄█▄▄▄▀ █▀▀▀▀▀█
█ ███ █ ▀▄▄▄▀ █ ▀▀▄ ▀██ █ ███ █
█ ▀▀▀ █ ▀█ ▀ █▀ ▀█ ██ ██ █ ▀▀▀ █
▀▀▀▀▀▀▀ ▀▄█▄▀▄█ ▀▄█▄█▄█ █ ▀▀▀▀▀▀▀
█ █▀█▀██▀▄ ▀▀ ▀▄▀▀██ ▀▄▄█ █▄██▀
▀▄█▀▀ ▀█▄ ▄██ █ ██▀ ▄▀ ███ ▀█ █
▄ ▄█▄▀▀█▄ █▀██▀ ██▀▄▀██▀██▀ ▀█▄█▀
██▄▀▀▀▀▀▄▄▀▄▀ ▄▀▄▀▄ ▀▀▀ ▀ ▀ ▄█
▄ █▄▀▄▀ ▄▄ ▄ ██▄█ ▀▀ ▄ ▄▄▄▄ ▄▄ ▄▄
▀█▀█▄█▀ ▄█▄▀ █▄ ▄▄██▄ ▄ ▀ ▀▄▄ ▀▀
▄ ▀ ▀ ▀▄▄▄▄ ▀█ ▄▄▄ █▀▄ ▄▀▀▀ ▀ █▄
█ ▀███▀ ▄███▄█▀▀█▄█ █▄█▀█▄ ▄▀▀▀
▀▀ ▀ ▄▀▄▄▄███ ▀▀█ ███▀▀▀█▄▄ ▀
█▀▀▀▀▀█ █▄█ ▀▄ █ ▀ ▀▀▀▀█ ▀ █ ▄█▄
█ ███ █ █▄██▀ █▀ ▀▀▀█▀ █▀▀▀▀▀▄▄▀
█ ▀▀▀ █ ▀█ █▄▄█▀█ ▀ ▀ ▀▄ █▀ █▀
▀▀▀▀▀▀▀ ▀ ▀▀ ▀▀ ▀▀▀ ▀▀ ▀▀▀
const qrcode = require('wifi-qr-code-generator')
const pr = qrcode.generateWifiQRCode({
ssid: 'Hello world',
password: 'testpass',
encryption: 'WPA',
hiddenSSID: false,
outputFormat: { type: 'terminal' }
})
pr.then((data) => console.log(data))
This generates the following QR code in your terminal:
👤 Anoop Kunjuraman
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Give a ⭐️ if this project helped you!
Copyright © 2020 Anoop Kunjuraman.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator
FAQs
NPM module to generate a QR Code for WIFI ssid and password
The npm package wifi-qr-code-generator receives a total of 246 weekly downloads. As such, wifi-qr-code-generator popularity was classified as not popular.
We found that wifi-qr-code-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.