Shell Scripting - Password Generator
Skills:
Tool Use & Function Calling80%
Key Takeaways
This video by HackerSploit covers creating a password generator using shell scripting, a computer program designed to be run by the Unix shell, a command-line interpreter.
Full Transcript
[Laughter] hey guys hackers floyd here back again with another video and welcome back to the shield scripting course in this video we're going to be looking at how to generate uh or how to create our very own random password generator now this is probably one of the best uh scripts that i would recommend for you you know to get started with uh with bash or shell scripting for that matter and it's really really awesome in the sense that it once we're done it will allow us to generate passwords of any length and uh with a certain type of encoding uh giving us a a specific set of characters to work with all right so i have my environment set up and i'm using nano and i've already created the shell file right here mine is called passwordgenerator.shell i've increased the size uh off of the text in nano so that you guys can see uh what exactly is going on what and what i'm typing um so before we get started i just want to let you know uh a specific tool or library that we'll be using to generate this password all right now this as i mentioned is a very very exciting script to make because it really again shows you the power of uh offshore scripting now we will be using a tool or a library depending on how you view it called openssl all right so you might be asking yourself well what exactly is openssl well openssl is simply a toolkit that is used by by or for the transport layer uh in terms of its security to secure different uh to secure various aspects of the connectivity for example sockets etc now we are not going to be using that functionality instead we are going to be using its cryptographic toolkit or its library all right and the algorithms there in in the sense that openssl allows us to generate to generate a whole variety or a length of characters in a specific in a specific format in terms of an encryption algorithm or a cryptographic algorithm algorithm for example hexadecimal or base64 now that's what we're going to be using so without further ado let's get started so the first thing i'm going to do is i'm going to create my shebang here oops already the first spelling mistake i apologize for that and uh we'll just comment this and say uh simple uh password generator um uh for these videos and the other ones that will follow we will be generating our own scripts are useful scripts that is i will be posting these scripts on github on my repository so you can check them out if you're uh if you're interested and you can also improve them if you want and also let me know what you guys come up with as well i would love to check them out that is a random password generator all right and we are now are going to start our script really simply so uh we need to prompt the user the script is going to be designed in the following way we're going to prompt the user to enter the length of the of the password they want to generate so for example the length could be let's say 12 characters or 15 characters whatever they want we will we will allow them to do that so uh we'll say echo and remember you can improve upon the script if you want to so we're going to say echo this is uh is a simple generator well actually it's not simple because the uh the the complexity of the passwords that it does generate are very very good and i use it myself uh before setting uh different passwords for different services so this is a simple password generator and again we can use another echo here saying uh please enter the um length of of uh the password all right yeah something really simple like that um and we'll say down below here we'll start read we'll read and we'll save it to a variable so we'll say read and we'll save this to a variable called pass pass length um yeah oops link like so password length and after this we now go into the uh to a very very simple process that will involve a for loop and i'll explain why so what's going to happen is the user is going to um is going to enter the uh the length of the password now we need to use open sl but we need to do it need to use open sl but we need to do it in in regards to the amount of passwords we want to generate for but you know we will implement this functionality later but for now uh we we could give the user an option to enter or an option of maybe five passwords from which they could choose one from now we look at that in a second but i said we're going to use a for loop so we can say for example for uh for p uh in in the sequence of uh we can say sequence one for now and i'll explain why so sequence one and then we're gonna say do now in here is where we we would use openssl so we simply put in the command as you would enter into the terminal or the bash uh so we'll say open um ssl and then now the syntax for for open ssl in regards to generating random characters is as follows so open ssl random some of you may know this but if you don't worry don't worry we then select our encoding algorithm uh which or our encryption algorithm which could be anything but i recommend for password generators it be base64 you so for that we can just type in base64 all right now after this what would happen is open ssl would generate a random base64 characters but it does not know to what extent you want to use in regards to the cryptographic library of openness of base64 or the maximum length of characters of base64 what do i mean by this uh base64 has a a limited character set similar to what our alphabet has you know so for example uh you know the numeric uh uh the the uh the order of numerix is from zero to uh to nine not really ten in base 64 it has its own length it's about 48 characters so you can specify out of which of those 48 characters you want to use but in this case i'm just going to use all 48 all 48 characters and i'm going to cut i'm going to pipe this through and i'm going to cut 40 specify the length of the password and out of those 48 that will it will generate randomly in base 64. we need to know when to stop it based on uh the password length that the user will specify all right so to do that we select the the cut operator which is c1 which means column one we are cutting from the first column or the first letter all the way to the uh length of the password which the user specified which is assigned to the variable password length all right and uh what uh what's happening here let me just explain it one more time if you're using openssl to generate a random characters in base64 format uh through the whole character range of base64 we're then cutting this we're piping it and cutting it uh from the first character to the to the password length which is what the user specified so in reality we have generated um you know a random base 64 characters but we're generating them and we're going to cut from the first letter all the way to what the user specified which is perfect because that is the uh indeed the um the length of the password that the user did wanted to specify all right and i'm going to hit done and yeah that pretty much should be it so let me just save this and let me exit and we're going to launch the password generator so i'm going to launch it and as you can see it is going to prompt us and say this is a simple password generator please enter the length of the password so i'm going to hit the length of 20 and there you are so you can see it generates a fantastic password for us with different characters both lowercase and uppercase with a special symbols like the plus symbol now what if we wanted variety in regards to the um we wanted variety in regards to the passwords that are being generated well to do that we can simply increase the number of uh of passwords that we're generating using the sequence operator in the for loop so if i just clear this up and we use nano here again and now in the sequence that's the reason i specified that we can use the sequence here otherwise i could just leave it as one and you know but we want a sequence here so we're going to say sequence of one to five all right and from there it will generate five passwords from the from which the user can select the one and they feel is appropriate for them okay so let's save this and let's exit and we're just going to run the script one more time and i'm going to enter a length of what i see miss i feel is suitable which is around 25 and i'm going to hit enter and there you are so it's going to it's going to generate five random passwords uh and all using the uh the specific uh parameters that we specified in regards to uh the length of the password and the encoding so the first one is there looks quite good and we have the other ones right here which you can select from now most of you in your mind right now would be we will be asking well can we use other algorithms in apart from base64 well yes you can but the problem is with the other ones is they're not very conducive for safe passwords if you know what i mean so for example with basic stiff uh with base64 it has the most robust character set out of out of the other encoding or encryption algorithms whatever you want to call them and i can explain this or show you this in a second so instead of using uh base64 what if i were to use something like hexadecimal as i specified in the beginning so we'll use hexadecimal and we can keep the 48 because that will again just generate 48 uh off the random and then split them uh just as we did in the previous uh with base64 so let's exit now and you'll see what i'm talking about if you know what a safe password is all right so i'm going to hit enter and we can enter a length of 20 again and as you can see these are not considered safe passwords at all because they only contain numbers and lower case letters which can be very easy to brute force or to hack for that matter so uh in regards or we have to keep the password um password generator rules intact where password should contain uppercase lowercase numbers and special characters to make the password as complex as and as random as possible now that is going to be it for this video this is a very very simple password generator but as i mentioned it gets the job done now i will be posting this script on my github so you can check it out for yourself and you can also improve it and also send me the links to it and i'll check it out and or maybe we can make a video new in the improved ones all right so that is going to be it for this video i just wanted to start off with a more exciting type of script that we can create and uh yeah i hope you liked this video if you did please leave a like down below if you have any questions or suggestions let me know in the comment section on my social networks or on my website and i'll be seeing you in the next video [Music] peace [Music] you
Original Description
Hey guys! HackerSploit here back again with another video, in this series we will be looking at how to create shell scripts.
A shell script is a computer program designed to be run by the Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages
Github Repo: https://github.com/AlexisAhmed/Shell-Scripts
⭐Help Support HackerSploit by using the following links:
🔗 NordVPN: https://nordvpn.org/hacker
Use the link above or the code below for 77% Off your order
Promo Code: hacker
Patreon: http://patreon.com/hackersploit
I Hope you enjoy/enjoyed the video.
If you have any questions or suggestions feel free to ask them in the comments section or on my social networks.
🔗 HackerSploit Website: https://hsploit.com/
🔗 HackerSploit Android App: https://play.google.com/store/apps/details?id=com.hsploitnews.hsploit&hl=en
🔹 Support The Channel
NordVPN Affiliate Link: https://nordvpn.org/hacker
Patreon: http://patreon.com/hackersploit
🔹 Get Our Courses
Get a special discount on our courses:
The Complete Deep Web Course 2018:
https://www.udemy.com/the-complete-deep-web-course-2017/?couponCode=DWCBP2017
🔹 SOCIAL NETWORKS - Connect With Us!
-------------------------------
Facebook: https://www.facebook.com/HackerSploit/
Twitter: https://twitter.com/HackerSploit
Patreon: http://patreon.com/hackersploit
--------------------------------
Thanks for watching!
Благодаря за гледането
Kiitos katsomisesta
感谢您观看
Merci d'avoir regardé
Grazie per la visione
Gracias por ver
شكرا للمشاهدة
دیکھنے کے لیے شکریہ
देखने के लिए धन्यवाद
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from HackerSploit · HackerSploit · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
How To Install Kali Linux 2.0 On Virtual Box
HackerSploit
100 Subscriber Q&A! - How I Learned Ethical Hacking
HackerSploit
BlackArch Linux Review - Better Than Kali Linux?
HackerSploit
How to Access the Deep Web Safely | Deep Web Starter Guide 1.0
HackerSploit
Wireshark Tutorial for Beginners - Installation
HackerSploit
Wireshark Tutorial for Beginners - Overview of the environment
HackerSploit
Wireshark Tutorial for Beginners - Capture options
HackerSploit
Wireshark Tutorial for Beginners - Filters
HackerSploit
Complete Ethical Hacking Course - Become a Hacker Today - #1 Hacking Terminology
HackerSploit
Complete Ethical Hacking Course #2 - Installing Kali Linux
HackerSploit
Parrot OS 3.5 Review | The Best Kali Linux Alternative
HackerSploit
Nmap Tutorial For Beginners - 1 - What is Nmap?
HackerSploit
Katoolin | How To Install Pentesting Tools On Any Linux Distro
HackerSploit
Nmap Tutorial For Beginners - 2 - Advanced Scanning
HackerSploit
Nmap Tutorial For Beginners - 3 - Aggressive Scanning
HackerSploit
Zenmap Tutorial For Beginners
HackerSploit
How To Setup Proxychains In Kali Linux - #1 - Stay Anonymous
HackerSploit
How To Setup Proxychains In Kali Linux - #2 - Change Your IP
HackerSploit
How To Change Mac Address In Kali Linux | Macchanger
HackerSploit
How To Setup And Use anonsurf On Kali Linux | Stay Anonymous
HackerSploit
Ubuntu 17.04 "Zesty Zapus" Review - Bye Unity
HackerSploit
VPN And DNS For Beginners | Kali Linux
HackerSploit
Tails OS Installation And Review - Access The Deep Web/Dark Net
HackerSploit
Steganography Tutorial - Hide Messages In Images
HackerSploit
The Lazy Script - Kali Linux 2017.1 - Automate Penetration Testing!
HackerSploit
Best Linux Distributions For Penetration Testing
HackerSploit
Netcat Tutorial - The Swiss Army Knife Of Networking - Reverse Shell
HackerSploit
Gaining Access - Web Server Hacking - Metasploitable - #1
HackerSploit
Web Server Hacking - FTP Backdoor Command Execution With Metasploit - #2
HackerSploit
How To Install Kali Linux On VMware - Complete Guide 2018
HackerSploit
Q&A #1 - Best Cyber-security Certifications?
HackerSploit
Terminator - Kali Linux - Multiple Terminals
HackerSploit
Shodan Search Engine Tutorial - Access Routers,Servers,Webcams + Install CLI
HackerSploit
Q&A #2 - Mr Robot?
HackerSploit
Metasploit Community Web GUI - Installation And Overview
HackerSploit
Linux Expl0rer - Forensics Toolbox - Installation & Configuration
HackerSploit
QuasarRAT - The Best Windows RAT? - Remote Administration Tool for Windows
HackerSploit
Metasploit For Beginners - #1 - The Basics - Modules, Exploits & Payloads
HackerSploit
Metasploit For Beginners - #2 - Understanding Metasploit Modules
HackerSploit
Kali Linux Quick Tips - #1 - Adding a non-root user
HackerSploit
Metasploit For Beginners - #3 - Information Gathering - Auxiliary Scanners
HackerSploit
Spectre Meltdown Vulnerability - How To Check Your System
HackerSploit
Metasploit For Beginners - #4 - Basic Exploitation
HackerSploit
ARP Spoofing With arpspoof - MITM
HackerSploit
WordPress Vulnerability Scanning With WPScan
HackerSploit
Generating A PHP Backdoor with weevely
HackerSploit
Nikto Web Vulnerability Scanner - Web Penetration Testing - #1
HackerSploit
How To Install Kali Linux On Windows 10 - Windows Subsystem For Linux
HackerSploit
Stacer - System Optimizer And Monitoring Tool For Linux
HackerSploit
Kali Linux 2018.1 - Kernel Updates & Patches
HackerSploit
MITM With Ettercap - ARP Poisoning
HackerSploit
Password Cracking With John The Ripper - RAR/ZIP & Linux Passwords
HackerSploit
How To Detect Rootkits On Kali Linux - chkrootkit & rkhunter
HackerSploit
Channel Updates - How To Post Questions & Video Suggestions
HackerSploit
Web App Penetration Testing - #1 - Setting Up Burp Suite
HackerSploit
Web App Penetration Testing - #2 - Spidering & DVWA
HackerSploit
Cl0neMast3r - GitHub Repository Cloning Tool
HackerSploit
Kali Linux On Windows 10 Official - WSL - Installation & Configuration
HackerSploit
DoS/DDoS Protection - How To Enable ICMP, UDP & TCP Flood Filtering
HackerSploit
Web App Penetration Testing - #3 - Brute Force With Burp Suite
HackerSploit
More on: Tool Use & Function Calling
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
When AI Asks for More Electricity Than a Country Can Imagine
Medium · AI
You Are Not Behind. The World Is.
Medium · AI
Career choice with the advent of AI - pure Computer Science or learn software with a background of core engineering area
Dev.to AI
The AI Hype Cycle: Calm Before the Next Breakthrough?
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI