Accueil > > > CODE POUR DISTRIBUER SES PATCH[MASM]
CODE POUR DISTRIBUER SES PATCH[MASM]
Information sur la source
Description
c pas trop compliquer mais g galéré un moment pour y arriver..donc ca peut servir au autre!!
Source
- .386
- .model flat,stdcall
- option casemap:none
- WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
-
- include \masm32\include\windows.inc
- include \masm32\include\user32.inc
- include \masm32\include\kernel32.inc
- include \masm32\include\comdlg32.inc
-
-
- includelib \masm32\lib\user32.lib
- includelib \masm32\lib\kernel32.lib
- includelib \masm32\lib\comdlg32.lib
-
-
-
-
- .data
- ButtonID equ 1
- ButtonID1 equ 2
- MAXSIZE equ 260
- OUTPUTSIZE equ 512
-
- ClassName db "SimpleWinClass",0
- AppName db " -=EEDY 31 patch=-",0
-
- ButtonClassName db "button",0
- ButtonText db "Go!!",0
- ButtonText1 db "Quitter",0
-
- MenuName db "FirstMenu",0
- ofn OPENFILENAME <>
- FilterString db "All Files",0,"*.*",0
- db "eXecutables",0,"*.exe",0,0
- Exe db MAXSIZE dup(0)
- OurTitle db "Choisis le file à cracker",0
-
- MsgCaption db "Erreur",0
- MsgBoxText db "Fichier protégé en écriture ou utilisé!!",0
-
- MsgCaption1 db "Succès!!",0
- MsgBoxText1 db "Fichier patché avec succès",0
-
-
- NbBytesWritten dd 0
-
- hInstance HINSTANCE ?
- CommandLine LPSTR ?
- hwndButton HWND ?
- hwndButton1 HWND ?
- handle dd ?
-
- byte_a_ecrire db 90h
-
-
-
- .code
- start:
- invoke GetModuleHandle, NULL
- mov hInstance,eax
- invoke GetCommandLine
- invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
- invoke ExitProcess,eax
-
- WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
- LOCAL wc:WNDCLASSEX
- LOCAL msg:MSG
- LOCAL hwnd:HWND
- mov wc.cbSize,SIZEOF WNDCLASSEX
- mov wc.style, WS_TILED
- mov wc.lpfnWndProc, OFFSET WndProc
- mov wc.cbClsExtra,NULL
- mov wc.cbWndExtra,NULL
- push hInst
- pop wc.hInstance
- mov wc.hbrBackground,COLOR_BTNTEXT +1
- mov wc.lpszClassName,OFFSET ClassName
- invoke LoadIcon,NULL,IDI_APPLICATION
- mov wc.hIcon,eax
- mov wc.hIconSm,eax
- invoke LoadCursor,NULL,IDC_ARROW
- mov wc.hCursor,eax
- invoke RegisterClassEx, addr wc
- INVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,\
- WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\
- CW_USEDEFAULT,250,200,NULL,NULL,\
- hInst,NULL
- mov hwnd,eax
- INVOKE ShowWindow, hwnd,SW_SHOWNORMAL
- INVOKE UpdateWindow, hwnd
- .WHILE TRUE
- INVOKE GetMessage, ADDR msg,NULL,0,0
- .BREAK .IF (!eax)
- INVOKE TranslateMessage, ADDR msg
- INVOKE DispatchMessage, ADDR msg
- .ENDW
- mov eax,msg.wParam
- ret
- WinMain endp
-
- WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
-
- .IF uMsg==WM_DESTROY
- invoke PostQuitMessage,NULL
- .elseif uMsg==WM_CREATE
- ; --> CREER BUTTON
- invoke CreateWindowEx,NULL, ADDR ButtonClassName,\
- ADDR ButtonText,\
- WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\
- 10,140,100,20,hWnd,ButtonID,hInstance,NULL
- mov hwndButton,eax
-
- ; --> CREER BUTTON
- invoke CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText1,\
- WS_CHILD or WS_VISIBLE or BS_PUSHBUTTON ,\
- 130,140,100,20,hWnd,ButtonID1,hInstance,NULL
- mov hwndButton1,eax
-
-
-
-
-
- .ELSEIF uMsg==WM_COMMAND
- mov eax,wParam
- .if ax==1
-
- mov ofn.lStructSize,SIZEOF ofn
- push hWnd
- pop ofn.hWndOwner
- push hInstance
- pop ofn.hInstance
- mov ofn.lpstrFilter, OFFSET FilterString
- mov ofn.lpstrFile, OFFSET Exe
- mov ofn.nMaxFile,MAXSIZE
- mov ofn.Flags, OFN_FILEMUSTEXIST or \
- OFN_PATHMUSTEXIST or OFN_LONGNAMES or\
- OFN_EXPLORER or OFN_HIDEREADONLY
- mov ofn.lpstrTitle, OFFSET OurTitle
- invoke GetOpenFileName, ADDR ofn
-
- .if eax==TRUE
-
- ;Ouverture de l'exe
-
- invoke CreateFileA,offset Exe,0C0000000h ,1,0,3,80h,0
- mov handle, eax
- ;TRES IMPORTANT DE L'OUVRIR DE CETTE FACON SINON CA MARCHE PAS!!
-
-
- .if eax==INVALID_HANDLE_VALUE
- invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
- jmp @end
- .endif
-
- ;Deplacement dans le fichier
-
- invoke SetFilePointer,handle,0FEh,0,0 ;on se place a l'offset FE
- ;Ecriture dans le fichier
- mov esi,offset byte_a_ecrire
- invoke WriteFile,handle,esi,1,offset NbBytesWritten,0
-
- ;et voila!
- invoke MessageBox, NULL,addr MsgBoxText1, addr MsgCaption1, MB_OK
- invoke CloseHandle,handle
-
- .endif
-
-
- .else
- invoke DestroyWindow, hWnd
-
- .endif
- .ELSE
- @end:
- invoke DefWindowProc,hWnd,uMsg,wParam,lParam
- ret
- .ENDIF
- xor eax,eax
- ret
- WndProc endp
- end start
.386
.model flat,stdcall
option casemap:none
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\comdlg32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\comdlg32.lib
.data
ButtonID equ 1
ButtonID1 equ 2
MAXSIZE equ 260
OUTPUTSIZE equ 512
ClassName db "SimpleWinClass",0
AppName db " -=EEDY 31 patch=-",0
ButtonClassName db "button",0
ButtonText db "Go!!",0
ButtonText1 db "Quitter",0
MenuName db "FirstMenu",0
ofn OPENFILENAME <>
FilterString db "All Files",0,"*.*",0
db "eXecutables",0,"*.exe",0,0
Exe db MAXSIZE dup(0)
OurTitle db "Choisis le file à cracker",0
MsgCaption db "Erreur",0
MsgBoxText db "Fichier protégé en écriture ou utilisé!!",0
MsgCaption1 db "Succès!!",0
MsgBoxText1 db "Fichier patché avec succès",0
NbBytesWritten dd 0
hInstance HINSTANCE ?
CommandLine LPSTR ?
hwndButton HWND ?
hwndButton1 HWND ?
handle dd ?
byte_a_ecrire db 90h
.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, WS_TILED
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNTEXT +1
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc
INVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,\
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\
CW_USEDEFAULT,250,200,NULL,NULL,\
hInst,NULL
mov hwnd,eax
INVOKE ShowWindow, hwnd,SW_SHOWNORMAL
INVOKE UpdateWindow, hwnd
.WHILE TRUE
INVOKE GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
INVOKE TranslateMessage, ADDR msg
INVOKE DispatchMessage, ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.elseif uMsg==WM_CREATE
; --> CREER BUTTON
invoke CreateWindowEx,NULL, ADDR ButtonClassName,\
ADDR ButtonText,\
WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\
10,140,100,20,hWnd,ButtonID,hInstance,NULL
mov hwndButton,eax
; --> CREER BUTTON
invoke CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText1,\
WS_CHILD or WS_VISIBLE or BS_PUSHBUTTON ,\
130,140,100,20,hWnd,ButtonID1,hInstance,NULL
mov hwndButton1,eax
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
.if ax==1
mov ofn.lStructSize,SIZEOF ofn
push hWnd
pop ofn.hWndOwner
push hInstance
pop ofn.hInstance
mov ofn.lpstrFilter, OFFSET FilterString
mov ofn.lpstrFile, OFFSET Exe
mov ofn.nMaxFile,MAXSIZE
mov ofn.Flags, OFN_FILEMUSTEXIST or \
OFN_PATHMUSTEXIST or OFN_LONGNAMES or\
OFN_EXPLORER or OFN_HIDEREADONLY
mov ofn.lpstrTitle, OFFSET OurTitle
invoke GetOpenFileName, ADDR ofn
.if eax==TRUE
;Ouverture de l'exe
invoke CreateFileA,offset Exe,0C0000000h ,1,0,3,80h,0
mov handle, eax
;TRES IMPORTANT DE L'OUVRIR DE CETTE FACON SINON CA MARCHE PAS!!
.if eax==INVALID_HANDLE_VALUE
invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
jmp @end
.endif
;Deplacement dans le fichier
invoke SetFilePointer,handle,0FEh,0,0 ;on se place a l'offset FE
;Ecriture dans le fichier
mov esi,offset byte_a_ecrire
invoke WriteFile,handle,esi,1,offset NbBytesWritten,0
;et voila!
invoke MessageBox, NULL,addr MsgBoxText1, addr MsgCaption1, MB_OK
invoke CloseHandle,handle
.endif
.else
invoke DestroyWindow, hWnd
.endif
.ELSE
@end:
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
WndProc endp
end start
Conclusion
des amélioration a venir et je suis en train de concocter un patcher ki compare le fichier d'origine et celui patché et ki sort un patch à distibuer automatikement(100% asm bien sur!) donc a bientot !!
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
[FRAMEWORK 4] LES TASKS ET LE THREAD UI[FRAMEWORK 4] LES TASKS ET LE THREAD UI par fathi
Je viens de passer quelques temps au TechDay's et j'ai pu voir pas mal de session intéressante. Par contre une chose m'a un peu étonné lors de certaines de ces sessions qui abordaient les améliorations du framework .NET (donc le 4.5) : en gros, bea...
Cliquez pour lire la suite de l'article par fathi WORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBEWORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBE par JeremyJeanson
Depuis déjà un an, je conseille vivement les utilisateurs de Workflow Foundation 3 à migrer vers la version 4. L'information qui va suivre ne devrait donc pas trop prendre au dépourvu les personnes qui m'ont suivi. Je profite de ce poste, pour faire le re...
Cliquez pour lire la suite de l'article par JeremyJeanson TECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PCTECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PC par ROMELARD Fabrice
Speakers: Thierry Rapatout, Antoine Petit et Xavier Trebbia Cette session entre dans le cadre des RDV Décideurs des TechDays 2012, elle est liée à la consumérisation de l'IT et la mise en place du "DeskTop as a Service" dans de plus en ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLETECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLE par ROMELARD Fabrice
Speakers: Julien Marechal, Gautier Confiant, Sébastien MEYER La session débute par le positionnement de la solution System Center par rapport aux concepts d'organisation ITIL. Le portail du catalogue de se...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : PLEINIèRE SECOND JOURTECHDAYS PARIS 2012 : PLEINIèRE SECOND JOUR par ROMELARD Fabrice
Après une première journée dédiée aux développeurs, cette seconde journée est dédiée au monde des entreprises et de ses applications. Ainsi, cette pleinière est dédiée à faire un 360 de l'évolution des applications Business aux demandes ac...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|