• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

AutoIT Encrypt_It funcs.

Status
Not open for further replies.

DDoSer

The Real DDoSer
User
Joined
Oct 9, 2013
Messages
352
Reputation
0
Reaction score
4,578
Points
243
Credits
0
‎11 Years of Service‎
51%
[HIDE-THANKS]

Code:
>#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.12.0
Script Name:               Encrypt_IT
Version:                1.3
Author:                    Joel Susser

Last Modifed:              06/04/2015
Description:               This script Encrypts selected text.
                           This program is ideal for sending encrypted text through normal emails.


                           - To activate program run the Executable Encrypt_it.exe
                           - To Encrypt Text, Select the Text and type 
                           - To Un-Encrypt Text, Select Text wrapped with <> Tags and then type 
                           - To Exit application, close it in the system tray.

Update functionalty:        -Fixed a logic bug 
                           -Added error checking for empty selection or missing tags
                           -Added a function to just view encrypted text (It doeesn't replace the text)
                           -Added scrowlable msgbox using Form and Edit Field


Example Encrypted Message:
0xAC974253127B228E1E5C87259AE31C22FF44723C24CB817D89E2206D7AE75BAC0A5B


#ce ----------------------------------------------------------------------------

$hWnd = WinGetHandle("[ACTIVE]", "") ;get handle of current window
WinActivate ( $hWnd )               ;active current window by handle

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 


const $sPassword = "password" ;should be changed.
Global $g_bPaused = False     ;probably not needed.
Global $sData = ""          ;initalize data storage variable to ""
Global $Encrypted = ""      ;initalize encrypted variable to ""

;setup hotkeys
HotKeySet("^!e", "Encrypt"); e
HotKeySet("^!u", "UnEncrypt_replace"); u
HotKeySet("^!v", "UnEncrypt_view"); v
;HotKeySet("{ESC}", "Terminate") ; Press Esc to terminate script

;create main loop to check for hotkeys
While 1
   Sleep(100)
WEnd

Func Terminate()
   Exit
EndFunc   ;==>Terminate

Func Encrypt()
   $hWnd = WinGetHandle("[ACTIVE]", "") ;active handle of windows that selection was made on when hot key pressed
   WinActivate ( $hWnd )
   WinActive ($hWnd)
send("^c")                         ;copy selected text to clipboard
;send("{CTRLDOWN}c{CTRLUP}")
sleep(1000);wait for selection to complete
;consolewrite($sData & @CRLF)
;wait for selection to complete
;$sData = ClipGet()
$sData =_ClipBoard_GetData ( $CF_TEXT ) ;convert clipboard data to pure text and move it to $sData variable
If Check_Unencrypted_Data_Good($sData) Then
    ;MsgBox($MB_SYSTEMMODAL, "", $sData)
    $Encrypted = _Crypt_EncryptData($sData, $sPassword, $CALG_RC4) ; encrypt $sData data and move it to $Encrypted
    ;MsgBox($MB_SYSTEMMODAL, '', $Encrypted)
    $sData = "" & $Encrypted & ""
    ClipPut($sData)                ;put $encrypted data back into cliboaard
     WinActivate ( $hWnd )             ;active windows by handle
     WinActive ($hWnd)                 ;wait for window to be active
     send("^v")                        ;send clipboard data to screen via v command
     sleep(1000)                       ;wait for clipboard push to completd
     ClipPut("");clear clipboard       ;clear the clipboard
EndIf
EndFunc



Func UnEncrypt_replace()
$hWnd = WinGetHandle("[ACTIVE]", "") ;active handle of windows that selection was made on when hot key pressed
WinActivate ( $hWnd )   ;active window by handle
WinActive ($hWnd)
send("^c") ;send clipboard data to screen
 ;send("{CTRLDOWN}c{CTRLUP}")
sleep(1000)
$sData = ClipGet()
 ;consolewrite($sData & @CRLF)
   if Check_if_Properly_Tagged($sData) then
       ;$sData =_ClipBoard_GetData ( $CF_TEXT ) ;convert clipboard data to pure text and put it in $sData variable
        $aArray=_StringBetween($sData,'','');remove tags
        $Encrypted = $aArray[0]
        ;MsgBox($MB_SYSTEMMODAL, "", $Encrypted)
        sleep(500)
        $sData = BinaryToString( _Crypt_DecryptData($Encrypted, $sPassword, $CALG_RC4)) ; de-crypt data
       ; MsgBox($MB_SYSTEMMODAL, "", $sData)
         ClipPut($sData) ;put data collected in clipboard
         send("^v") ;send clipboard to screen
         ; send("{CTRLDOWN}v{CTRLUP}")
         sleep(1000) ;wait for completion
         ClipPut("") ;clear clipboard
         ;MsgBox($MB_SYSTEMMODAL, "", "UnEncrypting")
   EndIf
EndFunc




Func UnEncrypt_view()
$hWnd = WinGetHandle("[ACTIVE]", "") ;active handle of windows that selection was made on when hot key pressed
WinActivate ( $hWnd )   ;active window by handle
WinActive ($hWnd)
send("^c")             ;send clipboard data to screen
; send("{CTRLDOWN}c{CTRLUP}")
sleep(1000)
$sData = ClipGet()
 ;consolewrite($sData & @CRLF)
;$sData =_ClipBoard_GetData ( $CF_TEXT ) ;convert clipboard data to pure text and put it in $sData variable

   if Check_if_Properly_Tagged($sData) then
        $aArray=_StringBetween($sData,'','');remove tags
        $Encrypted = $aArray[0]
        ;MsgBox($MB_SYSTEMMODAL, "", $Encrypted)
        sleep(500)
        $sData = BinaryToString( _Crypt_DecryptData($Encrypted, $sPassword, $CALG_RC4)) ; de-crypt data

       ; MsgBox($MB_SYSTEMMODAL, "", $sData)
         MsgBox_Scroll("Un-Encrypt Text", $sData)
   endif
 ClipPut("") ;clear clipboard
 ;MsgBox($MB_SYSTEMMODAL, "", "UnEncrypting")
EndFunc


;custom scrollable message box
func MsgBox_scroll($title, $text)
   $Form1 = GUICreate($title, 623, 436, 192, 132)
   $Edit1 = GUICtrlCreateEdit("", 8, 0, 593, 433)
   GUICtrlSetData(-1, $text)
   GUISetState(@SW_SHOW)
   #EndRegion ### END Koda GUI section ###

   While 1
       $nMsg = GUIGetMsg()
       Switch $nMsg
           Case $GUI_EVENT_CLOSE
               ;Exit
               GUIDelete ( $Form1 )
               ExitLoop
       EndSwitch
   WEnd
EndFunc

;check if cliboard is blank. If yes, there is a problem.
func Check_Unencrypted_Data_Good($sData)
   if $sData = "" Then
       MsgBox($MB_SYSTEMMODAL,"Error", "No Text Selected for Encryption")
       return False
   Else
       Return True
   EndIf
EndFunc

;check if clipboard data has the closing and starting tags. If not, there is a problem.
func Check_if_Properly_Tagged($sData)
   if ( StringInStr($sData, "") And StringInStr($sData, "") ) Then
       return  True
   Else
       MsgBox($MB_SYSTEMMODAL,"Error", "Missing Encyption Tag")
       return false
   EndIf
EndFunc
[/HIDE-THANKS]

 
Status
Not open for further replies.
Back
Top