In: Computer Science
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program: Your program will create a username of your choice using a Kali Linux command "useradd -m mark", then set the password for that user using the Kali Linux Command "echo "mark:10101111" | chpasswd". Then you create a dictionary file using the Kali Linux command "crunch 8 8 01 > mylist.txt" Your python script should crack the password for that user and display on the screen. Hint: Use tool john the ripper in your Kali Linux command line: "john --wordlist=/home/kali/mylist.txt /home/kali/myhash.txt" Please submit the following: 1. Source Code of Python script 2. Screen shot of your output of either IDLE or Python3 Linux CLI showing your polygon.
Answer
here is your answer, here i executed linux command in python using os.system(). Here first i created a directory to do all the works together. Here we need to create a user called mark. And then create the passwor for user mark. Then we need to use the password cracker john the ripper. Note that if we created a user.It will create an entry in /etc/passwd file for that user.We need to crack that password.
So here is the full code, all commands are given in your problem.
import os
#executing linux commands
os.system('useradd -m mark1')
os.system('echo "mark:10101111" | chpasswd')
os.system('crunch 8 8 01 > mylist.txt')
os.system('unshadow /etc/passwd /etc/shadow > myhash.txt ')
os.system('john --wordlist=/root/pythondi/mylist.txt myhash.txt') #change with it based on your directory
os.system('john --show myhash.txt')
output
here we used unshadow command, So every user can execute the script on newly created hash.
Any doubt please comment
Thanks in advance