Batch Index du Forum
S’enregistrerRechercherFAQMembresGroupesConnexion
Répondre au sujet Page 1 sur 1
[Autoit] Wifi Passwords Recovery by Hackoo
Auteur Message
Répondre en citant
Message [Autoit] Wifi Passwords Recovery by Hackoo 
Salut tout le monde Smile
Je suis entrain de "traduire" mon batch Wifi Passwords Recovery.bat (Batch Pastebin Source) vers Autoit.
Version en Batch : Wifi Passwords Recovery by Hackoo

Version Autoit :
Code:
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=wifi.ico ; icon downloaded  from [ http://www.iconarchive.com/show/action-circles-icons-by-fasticon/Circle-wifi-icon.html ]
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Constants.au3>
#include <Array.au3>
#include <String.au3>
#include <MsgBoxConstants.au3>
#include <WinAPI.au3>
#include <File.au3>
Global $Title = "Wifi Passwords Recovery by Hackoo 2018"
If Not @Compiled Then Exit MsgBox(48,$Title,"Please compile this as a console application to see what this function does.") ;Exit if script is not compiled
$dll = DllOpen("Kernel32.dll") ;Open Kernel32.dll because we will be using it a lot
$hnd = _WinAPI_GetStdHandle(1) ;Get the AutoIt process's standard output handle
_WinAPI_SetConsoleTextAttribute($hnd, "6", $dll) ;Change text color to Green (https://www.autoitscript.com/forum/topic/110218-_winapi_setconsoletextattribute/)
Global $msg = "" & @CRLF
       $msg &="                ***********************************************" & @CRLF
      $msg &="                     "      &       $Title     &                   @CRLF
      $msg &="                ***********************************************" & @CRLF
      $msg &="                [N] [SSID] ===============>  "& Chr(34) & "Password" & Chr(34) & @CRLF & @CRLF
ConsoleWrite($msg)
If Not IsAdmin() Then Exit MsgBox(48, $Title, "This Application must be run with admin rights !")
Global $MyCmd = _GetDOSOutput('netsh wlan show profiles')
Global $res = ""
Global $Pass = ""
$sSSID = StringRegExp($MyCmd, '(?si)\s*.*?:\s*(.*?)' & @CR, 3)
For $i = 1 To UBound($sSSID) - 1
   $GetPassword = _GetDOSOutput('netsh wlan show profiles ' & Chr(34) & $sSSID[$i] & Chr(34) & _
         ' key=clear | find "Conten"')
   $Pass = StringRegExp($GetPassword, ":\s(.*)", 3)
   If $Pass[0] <> "" Then
      _WinAPI_SetConsoleTextAttribute($hnd, "10", $dll)
      $res &= '                [' & $i & '] ' & '[' & $sSSID[$i] & ']' & " =======> " & Chr(34) & $Pass[0] & Chr(34) & @CRLF
   Else
      _WinAPI_SetConsoleTextAttribute($hnd, "4", $dll) ; Set color to Red
      $res &= '                [' & $i & '] ' & '[' & $sSSID[$i] & ']' & " =======> Password is empty !" & @CRLF
   EndIf
Next
ConsoleWrite($res)
Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = ""
Local $aPathSplit = _PathSplit(@ScriptFullPath, $sDrive, $sDir, $sFileName, $sExtension)
FileDelete($sFileName & ".txt")
FileWrite($sFileName & ".txt", $msg & $res)
_WinAPI_SetConsoleTextAttribute($hnd, "11", $dll)
ConsoleWrite(@CRLF & _
"                All Wifi SSID with their passwords are extracted successfully !" & @CRLF & _
"                Saved into file " & Chr(34) & $sFileName & ".txt" & Chr(34))
While 1 ;Hold script in a loop until closed
   Sleep(500)
WEnd
;--------------------------------------------------------------------------------------------------
Func _GetDOSOutput($Command)
   Local $iPid, $sOutput = ''
   $iPid = Run('"' & @ComSpec & '" /C ' & $Command, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
   $sOutput &= StdoutRead($iPid, False, False)
   While @error = 0
      Sleep(10)
      $sOutput &= StdoutRead($iPid, False, False)
   WEnd
   Return $sOutput
EndFunc   ;==>_GetDOSOutput
;--------------------------------------------------------------------------------------------------
; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_SetConsoleTextAttribute
; Description ...: Changes the text and/or background color of text in the Windows console.
; Syntax.........: _WinAPI_SetConsoleTextAttribute($hConsole, $iColor, $hDLL = "Kernel32.dll")
; Parameters ....: $hConsole    - Handle to the console screen buffer
;                  $iColor      - Color style to apply to the console.
;                  $hDLL        - Handle to the DLL to call. (Leave blank to open Kernel32.dll each call)
; Return values .: Success      - True
;                  Failure      - False
; Author ........: Ken Piper (Kealper)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........: @@MsdnLink@@ SetConsoleTextAttribute
; Example .......:
; ===============================================================================================================================
Func _WinAPI_SetConsoleTextAttribute($hConsole, $iColor, $hDLL = "Kernel32.dll")
   $ret = DllCall($hDLL, "BOOL", "SetConsoleTextAttribute", "HANDLE", $hConsole, "WORD", $iColor)
   If @error Then Return SetError(@error, @extended, False)
   Return $ret[0]
EndFunc   ;==>_WinAPI_SetConsoleTextAttribute
;===============================================================================================================================

Autoit Pastebin Source ==> Wifi Passwords Recovery.au3

NB : Il faut compiler cette source avec la version console et l'exécuter en tant qu'administrateur pour voir le résultat, sinon vous recevez un message comme ceci :
Citation:
! Your script requires Admin rights while SciTE is running at normal level.
! This means no Console output from the script will be displayed and SciTE will show the script as ended right away.





______________________________________________________
Mes Contributions en Téléchargement
Message Publicité 
PublicitéSupprimer les publicités ?


Montrer les messages depuis:
Répondre au sujet Page 1 sur 1
  



Index | créer un forum | Forum gratuit d’entraide | Annuaire des forums gratuits | Signaler une violation | Conditions générales d'utilisation
Copyright 2008 - 2016 // Batch