[PROGRAMMA] File cryptor & decryptor

« Older   Newer »
  Share  
I.Ren
CAT_IMG Posted on 11/5/2008, 11:25     +1   -1




Ecco qui il mio ultimo programma, che cripta e decripta ogni tipo di file, da txt, exe, rar, zip e tt gli altri. Il codice è il seguente, ma serve anche l'udf testo.au3 che trovate nell'apposita sezione.

CODICE
#include <GUIConstants.au3>
#include <Array.au3>
#include <String.au3>
#include <GuiListView.au3>
#include <Testo.au3>
Global $a = -1
$gui = GUICreate('File crypter & dectypter',300,200)
GUICtrlCreateLabel('File:',2,2)
GUICtrlSetFont(-1,8,5000)
$i1 = GUICtrlCreateInput('',2,25,260,20)
GUICtrlSetFont(-1,8,5000)
$sfoglia = GUICtrlCreateButton('...',265,24,30,20)
GUICtrlSetFont(-1,8,5000)
$crit = GUICtrlCreateButton('Crypt',2,50,80,20)
GUICtrlSetFont(-1,8,5000)
$dcrit = GUICtrlCreateButton('Decrypt',90,50,80,20)
GUICtrlSetFont(-1,8,5000)
$opzioni = GUICtrlCreateButton('About',250,2,40,15)
GUICtrlSetFont(-1,8,5000)
$lista = _GUICtrlListView_Create ($GUI,'File|Status|',2,80,300,113)
_GUICtrlListView_SetBkColor($lista,0xDDDDDD)

_GUICtrlListView_SetColumnWidth($lista,0,150)

GUISetBkColor(0xFFFFFFF)
GUISetState ( )

While 1
       Switch GUIGetMsg ()
       Case $opzioni
       opzioni()
       Case $dcrit
       $fdd = FileOpenDialog('Open file',@desktopdir,'All (*.*)')
       If @error Then
               ;nada;
       Else
       $pw = InputBox('Password','Insert pw','','*')
       decritta($fdd,$pw)
       _GUICtrlListView_AddSubItem($lista,$a,'Decrypted',1)
       EndIf
Case $crit
       $dove = FileSaveDialog('Save',@desktopdir,'All (*.*)')
       $pw2 = InputBox('Password','Insert pw','','*')
       crittafile(GUICtrlRead($i1),$pw2,$dove)
       _GUICtrlListView_AddSubItem($lista,$a,'Crypted',1)
       Case $sfoglia
       $fdc = FileOpenDialog('Select file',@desktopdir,'All file (*.*)')
       If @error Then
               ;nada;
       Else
       GUICtrlSetData($i1,$fdc)
       $a = $a + 1
       _GUICtrlListView_AddItem($lista,$fdc)
       _GUICtrlListView_AddSubItem($lista,$a,'Waiting',1)
       EndIf
       Case -3
       Exit
EndSwitch
WEnd

Func crittafile($file,$password,$dv)
SplashTextOn("Please Wait", "PLEASE WAIT NOW CRYPTING  FILE TO", 300, 100, @DesktopWidth - 310, @Desktopheight - 140 )
$name = $dv
$ext = Stringright($file, 3)
$name = $dv
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW CRYPTING  FILE [10% now open file]")
sleep(1000)
FileOpen($file, 16)
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW CRYPTING  FILE [40% now read file]")
sleep(1000)
$hex = FileRead($file)
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW CRYPTING  FILE [70% now changing string to hex]")
sleep(1000)
$hex = _StringToHex ($hex)
$hexen2 = StringLeft($hex, 3)
$hex = Stringtrimleft($hex, 3)
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW CRYPTING  FILE [90% now crypt string]")
sleep(1000)
$hex1 = _StringEncrypt(1, $hexen2, $password)
$password = _StringEncrypt(1, $password, "pw")
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW CRYPTING  FILE [99% now write file]")
sleep(1000)
FileWrite($name, $hex1&"|"&$hex &"|"&$ext&"|"&$password)
ControlSetText("Please Wait", "", "Static1", "DONE [100% file created]")
sleep(1000)
SplashOff ()
EndFunc

Func decritta($file,$pass)
$string = fileopen($file, 16)
$string2 = FileRead($file)
$string2 = StringSplit($string2, "|")
$1 = $string2[1]
$hex = $string2[2]
$ext2 = $string2[3]
$password = $string2[4]
$password = _StringEncrypt(0, $password, "pw")
if $pass = $password then
       SplashTextOn("Please Wait", "PLEASE WAIT NOW DECRYPTING  FILE TO", 300, 100, @DesktopWidth - 310, @Desktopheight - 140 )
Else
       msgbox(64, "Error", "wrong password")
       Exit
EndIf
$1 = _StringEncrypt(0, $1, $pass)
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW DECRYPTING  FILE [10% now decrypting password]")
sleep(1000)
$hex = $1&$hex
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW DECRYPTING  FILE [40% now Combining Binary Data]")
sleep(1000)
$hex = _HexToString ($hex)
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW DECRYPTING  FILE [70% now Convering Hex Data Back To Binary]")
sleep(1000)
$Save = ' '&$ext2&' Files (*.'&$ext2&')'
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW DECRYPTING  FILE [77% now Waiting for user to save]")
sleep(1000)
$ext = FileSaveDialog("Save As", @desktopdir, $Save)
$name = Stringright($file, 6)
$name = Stringtrimright($name, 4)
ControlSetText("Please Wait", "", "Static1", "PLEASE WAIT NOW DECRYPTING  FILE [99% now Wrapping file and saving]")
sleep(1000)
FileWrite($ext&"."&$string2[3], binary($hex))
ControlSetText("Please Wait", "", "Static1", "DONE! [100% file created!]")
       sleep(1000)
splashoff ()
EndFunc

Func opzioni()
Global $in = 1
$gui = GUICreate('About',300,200)
$tab = GUICtrlCreateTab(0,0,300,20)
$ab = GUICtrlCreateTabItem('About')
$e = GUICtrlCreateEdit('',2,30,300,170)

GUISetState ( )

While 1
       Switch GUIGetMsg ()
       Case $GUI_EVENT_CLOSE
       Exit
EndSwitch
If $in = 1 Then
       scrivitestodasinistracontrollo('Author:'&@CRLF&@CRLF&'I.Ren'&@CRLF&@CRLF&'Programmed whit:'&@CRLF&@CRLF&'Autoit '&@AutoItVersion&@CRLF&@CRLF&'Autoit editor:'&@CRLF&@CRLF&'Scite4',$gui,$e,100)
       $in = 0
EndIf
WEnd
EndFunc


Ditemi ke ne pensate!

Edited by I.Ren - 11/5/2008, 13:51

Download attachment
File_cryptor___decryptor.zip ( Number of downloads: 29 )

 
Top
irojet
CAT_IMG Posted on 11/5/2008, 15:33     +1   -1




archivio corrotto...prova a ricrearlo
 
Top
Divine Soul
CAT_IMG Posted on 14/5/2008, 18:36     +1   -1




Funziona e pure bene, ottimo

;)
 
Top
irojet
CAT_IMG Posted on 17/5/2008, 13:22     +1   -1




ho compilato il codice...sei sicuro che non ci sia qualche errore?
per criptare funziona alla perfezione, ma se poi voglio decriptare un file che ho appena criptato metto la pwd che ho scelto in precedenza e mi da errore
 
Top
...{[(VoV)]}...
CAT_IMG Posted on 19/5/2008, 17:49     +1   -1




CITAZIONE
ho compilato il codice...sei sicuro che non ci sia qualche errore?
per criptare funziona alla perfezione, ma se poi voglio decriptare un file che ho appena criptato metto la pwd che ho scelto in precedenza e mi da errore

mi da lo stesso errore...
controlla che il codice postato sia lo stesso che hai usato per il programma ;)
 
Top
I.Ren
CAT_IMG Posted on 19/5/2008, 17:52     +1   -1




CITAZIONE
mi da lo stesso errore...
controlla che il codice postato sia lo stesso che hai usato per il programma

ummm. stai attento, xchè dopo aver criptato si crea un altro file. Decripta quello
 
Top
...{[(VoV)]}...
CAT_IMG Posted on 19/5/2008, 18:38     +1   -1




CITAZIONE
ummm. stai attento, xchè dopo aver criptato si crea un altro file. Decripta quello

già fatto ma non mi riconosce la password quando provo a decriptarlo
 
Top
...{[(VoV)]}...
CAT_IMG Posted on 20/5/2008, 19:45     +1   -1




sto ancora attendendo una risposta ^^
anche perchè non rispondendo fai sorgere qualche dubbio sulla paternità del programma ;)
 
Top
I.Ren
CAT_IMG Posted on 21/5/2008, 13:35     +1   -1




CITAZIONE
sto ancora attendendo una risposta ^^
anche perchè non rispondendo fai sorgere qualche dubbio sulla paternità del programma

1 - nn so ke dirti.. agli altri va e anke a me!
 
Top
8 replies since 11/5/2008, 11:25   239 views
  Share