Question: # First, you will need a variable with a list of most commonly used passwords to iterate through when trying to hack the users password.
# First, you will need a variable with a list of most commonly used passwords to iterate through when trying to hack the users password.
# Create a variable that stores the content from the most commonly used password file.
# *Important* Use the file path .\10k-most-common-passwords.txt
# YOUR CODE BELOW HERE
$commonPasswordList = Get-content .\10k-most-common-passwords.txt
# Second,a variable is needed that stores the victim's username. HINT: 'Luke'
# YOUR CODE BELOW HERE
$victim = "Luke"
# Now you are ready to design your function.
# Your function name will need 2 parameters.
# One for the username and one for the password list
# YOUR CODE BELOW HERE
function Bruteforce ($username, $commonPasswordList)
{
# Now you are ready to begin testing each password for your brute force attack!
# Write a foreach loop method to itereate through each common password in the password file.
# (Hint: You should be calling the variable that contains all passwords)
# YOUR CODE BELOW HERE
foreach ($pass in $commonPasswordList)
{
# You will need to build an array of user credentials to attack with.
# 1. Create an empty array.
# 2. Add your victim's username variable to the array. HINT: To add items to an array you must use += operator
# 3. Add a potential password to the array.
# YOUR CODE BELOW HERE
$arr = @()
$arr += $victim
$arr += $pass
## DO NOT MODIFY ##
Write-Host "--------------"
# The Invoke-Expression cmdlet is used to call other powershell scripts.
# Below will invoke Login.ps1 and pass a username and password.
# Your job is to pass the user credential array created above.
# Remember will need to be replaced with a variable name. Example: $arr
# YOU MUST MODIFY LINE BELOW
Invoke-Expression "& `".\Login.ps1`" $arr" -OutVariable out
# Now, you have submitted a username and password to the login screen, next is to find out if we had a match.
# Write an if-statement that will let you know a match has been found.
# (HINT: The $out varialbe will equal either "Access Denied" or "Access Granted"
# YOUR CODE BELOW HERE
{
# Add a statement that will return password once a match is found
# YOUR CODE BELOW HERE
}
}
}
Bruteforce 'Luke' $commonPasswordList
#-----------------------------------------------------------[Execution]------------------------------------------------------------
# Finally, you are ready to execute your function! Good Luck
# Example, [function name] $victim $commonPasswordsList
# One final hint, a password match should happen around 15 seconds :)
# YOUR CODE BELOW HERE
I am using powershell and just wondering why i can get access granted and keep getting access denied. can you show how you do it and explain.
its just powersehll
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
