{"id":933,"date":"2025-01-02T06:24:50","date_gmt":"2025-01-02T03:24:50","guid":{"rendered":"https:\/\/itgen.itbumper.com\/?page_id=933"},"modified":"2025-01-02T06:24:51","modified_gmt":"2025-01-02T03:24:51","slug":"0035_bash-strong-wi-fi","status":"publish","type":"page","link":"https:\/\/itgen.itbumper.com\/?page_id=933","title":{"rendered":"0035_Bash: Strong-Wi-Fi"},"content":{"rendered":"<p style=\"text-align: justify;\">The script asks the user for the name of the Wi-Fi wireless network (SSID), generates a random 63-character WPA key, and displays all the data on the screen. After that, the user enters an email address to which the script sends two files: a QR code for connecting to the network and a text file indicating the network name (SSID) and the generated key.<\/p>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#!\/bin\/bash\n\n# Set a charset\nCHARSET=&quot;utf-8&quot;\n\n# Clearing the screen\nclear\n\n# Getting the height of the terminal\nrows=$(tput lines)\n\n# Calculating the average row\nmiddle_row=$((rows \/ 2))\n\n# Move the cursor to the middle of the screen in height\ntput cup $middle_row 0\n\n# Requesting the name of the Wi-Fi wireless network\nread -p &quot;Enter the name of the wireless network. ((SSID-up to 32, without spaces and special characters): &quot; SSID\n\n# Length of the WPA key (maximum 63 characters)\nKEY_LENGTH=63\t# Up to\nENCRYPTION=WPA\t# WPA \/WEP \/ NONE\n\n# Generate a random key from letters, numbers, and special characters\nKEY=$(tr -dc 'A-Za-z0-9_!@#$%^&amp;*()' &lt;\/dev\/urandom | head -c $KEY_LENGTH)\n\n# QR code generation\necho -e &quot;Wireless Network Name (SSID): $SSID\\nType of encryption (NONE\/WEP\/WPA): $ENCRYPTION\\nWireless Network key: $KEY&quot; &gt; email_body.txt\nWIFI_STRING=&quot;WIFI:T:$ENCRYPTION;S:$SSID;P:$KEY;;&quot;\n            qrencode -o wifi_qr.png &quot;$WIFI_STRING&quot;\n            GENERATED_FILES+=(wifi_qr.png email_body.txt)\necho\necho\necho\necho &quot;Name of the wireless network (SSID):&quot; $SSID\necho &quot;Type of encryption (NONE\/WEP\/WPA):&quot; $ENCRYPTION\necho &quot;Wireless Network key:&quot; $KEY\n\n\n# Request for an email address to send the data to\necho\necho\necho\nread -p &quot;Enter the email address to send the data to:&quot; EMAIL \n\n# Sending by \u0435mail\nset -x\nsendemail -f &lt;sender email&gt; -t &quot;$EMAIL&quot; -u &quot;YOUR QR Code&quot; -m &quot;Information about the Wi-Fi wireless network in the attachment&quot; -s &lt;your an email server&gt; -a ${GENERATED_FILES&#x5B;@]} -o message-charset=$CHARSET\n\n# Deleting temporary files\nrm -f  ${GENERATED_FILES&#x5B;@]}\n\necho Done.\n\n\n### hint ###\n#sudo apt install sendemail libio-socket-ssl-perl libnet-ssleay-perl\n#sendemail -f &quot;Sender Name &lt;sender@example.com&gt;&quot; \\\n#          -t recipient@example.com \\\n#          -u &quot;Personalized Email&quot; \\\n#          -m &quot;This email has a custom sender name.&quot; \\\n#          -s smtp.example.com:587 \\\n#          -xu sender@example.com \\\n#          -xp &quot;password&quot;\n\n#sendemail -f sender@example.com -t recipient@example.com \\ -u &quot;Log Test&quot; -m &quot;This email will be logged.&quot; \\ -s smtp.yourserver.com:25 -l \/path\/to\/logfile.log\n\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>The script asks the user for the name of the Wi-Fi wireless network (SSID), generates a random 63-character WPA key, and displays all the data on the screen. After that, the user enters an email address to which the script sends two files: a QR code for connecting to the network and a text file &hellip; <a href=\"https:\/\/itgen.itbumper.com\/?page_id=933\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;0035_Bash: Strong-Wi-Fi&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/pages\/933"}],"collection":[{"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=933"}],"version-history":[{"count":1,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/pages\/933\/revisions"}],"predecessor-version":[{"id":934,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/pages\/933\/revisions\/934"}],"wp:attachment":[{"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}