Seite 1 von 1

ProcessCrasher

Verfasst: 25.03.2007 15:53
von Thorium
Nein, das hier hat nix mit Viren oder sonstiger Maleware zu tun :!:

Das Programm crasht wie der Name schon sagt laufende Prozesse unter Windows auf Mausklick. Nun werden sich wohl einige fragen wo da der Sinn liegt. Das will ich natürlich erklären:

Ich bin auf die Idee gekommen, als ich versuchte meine UMTS-Verbindung zu optimieren. Die Verbindung läuft über eine Verbindungssoftware von e-Plus. Beim experimentieren mit dieser Software ist sie mir gecrasht allerdings stellte ich mit erstaunen fest das die Internetverbindung weiterhin bestand. Die UMTS-Karte tat weiterhin ihren Dienst. Also scheint die Verbindung über einen Treiber zu laufen, welcher bei einem Crash der Anwendung nicht beendet wird. Der Vorteil bei der UMTS-Verbindung ohne Verbindungssoftware ist: konstantere Geschwindigkeit, etwas niedrigerer Ping und wesentlich höhere Stabilität. Also hab ich mir ein Programm geschrieben mit dem ich Anwendungen crashen kann. Denn beim "killen" per Taskmanager wird die UMTS-Karte runtergefahren und die Verbindung ist futsch.

Das ganze funktioniert indem ein paar Bytes Code in den zu crashenden Prozess injiziert werden, welche eine "division by zero"-Exception auslösen.

Warnung: Nutzen des Programms auf eigene Gefahr! Benutzt es nur wenn ihr genau wisst was ihr da tut. Wenn eine Anwendung gecrasht wird, welche gerade eine Datei auf die Festplatte schreibt, kann diese Datei beschädigt werden :!:

Service-Prozesse können nicht gecrasht werden, genauso wie geschützte Prozesse unter Vista.

Unterstützte Bestriebssysteme: Win95/98/ME/2000/XP (warscheinlich auch Vista, konnte ich nicht testen)

Download: ProcessCrasher 1.01

Screenshot:
Bild

Verfasst: 25.03.2007 16:00
von Kaeru Gaman
wtf :shock:

das is ja mal NE SAUGEILE IDEE! :allright:

Verfasst: 25.03.2007 16:38
von AND51
Nette Idee, es scheint auch in einigen Fällen zu funktionieren.
Genauso habe ich aber auch einige Situationen gehabt, bei denen die jeweilige Anwendung abgeschissen ist und danach Fehler hinterließen: Dateien/Ordner waren nicht mehr löschbar oder Elemente wurden nicht mehr richtig auf dem Bildschirm angezeigt.

Wie du schon gesagt hast, man muss es auf eigene Gefahr benutzen.

Thorium [img]http://www.purebasic.fr/german/images/avatars/112674267544954745601d2.gif[/img] hat geschrieben:Vorteil bei der UMTS-Verbindung ohne Verbindungssoftware ist: konstantere Geschwindigkeit, etwas höherer Ping und wesentlich höhere Stabilität.
Ich wusste gar nicht, dass es vorteilhaft ist, hohe Pings zu haben :lol:

Verfasst: 25.03.2007 16:42
von Thorium
AND51 hat geschrieben:
Thorium [img]http://www.purebasic.fr/german/images/avatars/112674267544954745601d2.gif[/img] hat geschrieben:Vorteil bei der UMTS-Verbindung ohne Verbindungssoftware ist: konstantere Geschwindigkeit, etwas höherer Ping und wesentlich höhere Stabilität.
Ich wusste gar nicht, dass es vorteilhaft ist, hohe Pings zu haben :lol:
*g* Sorry, sollte natürlich niedrigerer heissen. :oops:

Verfasst: 22.10.2007 16:29
von X0r
Cool. Kannst du das bitte hochladen, Thorium?

Verfasst: 22.10.2007 21:53
von pede
klingt interessant, aber der downloadlink funzt nicht...

Wäre es für dich ein Problem den Quelltext online zu stellen?
Ich versteh natürlich auch, wenn du es nicht machen möchtest, da es ja auch zu weniger konstruktiven Zwecken gebrauchen kann :roll:

Verfasst: 26.10.2007 17:12
von Thorium
pede hat geschrieben: Wäre es für dich ein Problem den Quelltext online zu stellen?
Nein. :)

Code: Alles auswählen

;/-----------------------------\
;| ProcessCrasher              |
;|                             |
;| Version 1.01                |
;| by Thorium                  |
;| written in PureBasic 4.10   |
;|                             |
;| compatible with:            |
;| -Windows 95 or higher       |
;| -Windows 2000 or higher     |
;\-----------------------------/

EnableExplicit

#AppTitle = "ProcessCrasher"
#CrashFailedText = "Failed to crash process!"
#UpdateInterval = 250

Enumeration
  #MainWindow
EndEnumeration

Enumeration
  #ListGad
EndEnumeration

Structure ProcessInfo
  Name.s
  Path.s
  ID.l
  ParentID.l
  ThreadsCnt.l
  PriorityClass.l
  Icon.l
EndStructure

#CrashCodeLen = 4

DataSection
  CrashCode:
  Data.b $33,$C0,$F7,$F0
EndDataSection

Global OS.l
Global Dim ProcessList.ProcessInfo(0)
Global ProcessListCnt.l
Global SystemAppIcon.l

Procedure OpenMainWindow()
  If OpenWindow(#MainWindow,216,0,590,290,"ProcessCrasher v1.01 by Thorium",#PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar)
    If CreateGadgetList(WindowID(#MainWindow))
      ListIconGadget(#ListGad,0,0,590,290,"Name",150,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListGad,1,"Path",250)
      AddGadgetColumn(#ListGad,2,"PID",50)
      AddGadgetColumn(#ListGad,3,"Parent PID",75)
    EndIf
  EndIf
EndProcedure

Procedure GetProcessList()
  Define.l ProcessSnapHandle,ModuleSnapHandle,RetVal,i,ProcessID,ExePath,IconHandle
  Define.PROCESSENTRY32 ProcessEntry
  Define.MODULEENTRY32 ModuleEntry

  ReDim ProcessList.ProcessInfo(0)
  ProcessListCnt = 0
  ProcessEntry\dwSize = SizeOf(ProcessEntry)
  ModuleEntry\dwSize = SizeOf(ModuleEntry)

  ;laufende Prozesse ermitteln
  ExePath = AllocateMemory(1024)
  ProcessSnapHandle = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS,0)
  RetVal = Process32First_(ProcessSnapHandle,ProcessEntry)
    
  While RetVal = #True
    ProcessListCnt = ProcessListCnt + 1
    ReDim ProcessList.ProcessInfo(ProcessListCnt)
    ProcessList(ProcessListCnt)\Name = PeekS(@ProcessEntry\szExeFile)
    If OS = #PB_OS_Windows_95 Or OS = #PB_OS_Windows_98 Or OS = #PB_OS_Windows_ME
      ProcessList(ProcessListCnt)\Name = GetFilePart(ProcessList(ProcessListCnt)\Name)    
    EndIf
    ProcessList(ProcessListCnt)\ID = ProcessEntry\th32ProcessID
    ProcessList(ProcessListCnt)\ParentID = ProcessEntry\th32ParentProcessID
    ProcessList(ProcessListCnt)\ThreadsCnt = ProcessEntry\cntThreads
    ProcessList(ProcessListCnt)\PriorityClass = ProcessEntry\pcPriClassBase

    If ProcessEntry\th32ProcessID <> 0
      ModuleSnapHandle = CreateToolhelp32Snapshot_(#TH32CS_SNAPMODULE,ProcessEntry\th32ProcessID)
      If ModuleSnapHandle
        If Module32First_(ModuleSnapHandle,ModuleEntry)
          ProcessList(ProcessListCnt)\Path = GetPathPart(Trim(PeekS(@ModuleEntry\szExePath)))
        EndIf
        CloseHandle_(ModuleSnapHandle)
      EndIf
    EndIf
    
    PokeS(ExePath,ProcessList(ProcessListCnt)\Path + ProcessList(ProcessListCnt)\Name)
    IconHandle = ExtractIcon_(0,ExePath,0)
    If IconHandle = 0
      IconHandle = SystemAppIcon
    EndIf
    ProcessList(ProcessListCnt)\Icon = IconHandle
    
    RetVal = Process32Next_(ProcessSnapHandle,ProcessEntry)
  Wend
  CloseHandle_(ProcessSnapHandle)
  FreeMemory(ExePath)
EndProcedure

Procedure FillProcessList()
  Define.l i

  ClearGadgetItemList(#ListGad)
  
  For i = 1 To ProcessListCnt
    AddGadgetItem(#ListGad,i-1,ProcessList(i)\Name,ProcessList(i)\Icon)
    SetGadgetItemText(#ListGad,i-1,ProcessList(i)\Path,1)
    SetGadgetItemText(#ListGad,i-1,Hex(ProcessList(i)\ID),2)
    SetGadgetItemText(#ListGad,i-1,Hex(ProcessList(i)\ParentID),3)
  Next
EndProcedure

Procedure.l CrashByInjection(ProcessID.l)
  Define.l ProcessHandle,CrashCodeAddr,BytesWritten
  
  ProcessHandle = OpenProcess_(#PROCESS_ALL_ACCESS,0,ProcessID)
  If ProcessHandle = 0
    ProcedureReturn 1
  EndIf
  CrashCodeAddr = VirtualAllocEx_(ProcessHandle,0,#CrashCodeLen,#MEM_COMMIT | #MEM_RESERVE,#PAGE_EXECUTE_READWRITE)
  If CrashCodeAddr = 0
    CloseHandle_(ProcessHandle)
    ProcedureReturn 1
  EndIf
  If WriteProcessMemory_(ProcessHandle,CrashCodeAddr,?CrashCode,#CrashCodeLen,@BytesWritten) = 0
    CloseHandle_(ProcessHandle)
    ProcedureReturn 1
  EndIf
  If CreateRemoteThread_(ProcessHandle,0,0,CrashCodeAddr,0,0,0) = 0
    CloseHandle_(ProcessHandle)
    ProcedureReturn 1
  EndIf
  CloseHandle_(ProcessHandle)
  ProcedureReturn 0
EndProcedure

Procedure CrashProcess(Index.l)
  If CrashByInjection(ProcessList(Index)\ID) = 1
    MessageRequester(#AppTitle,#CrashFailedText,#MB_ICONERROR)
  EndIf
EndProcedure

Procedure UpdateProcessList()
  Define.l i,i2,OldProcessListCnt
  Dim OldProcessList.ProcessInfo(ProcessListCnt)
  
  For i = 1 To ProcessListCnt
    OldProcessList(i)\Name = ProcessList(i)\Name
    OldProcessList(i)\Path = ProcessList(i)\Path
    OldProcessList(i)\ID = ProcessList(i)\ID
    OldProcessList(i)\Icon = ProcessList(i)\Icon
  Next
  OldProcessListCnt = ProcessListCnt
  
  For i = 1 To OldProcessListCnt
    If OldProcessList(i)\Icon <> SystemAppIcon
      DestroyIcon_(OldProcessList(i)\Icon)
    EndIf
  Next
  
  GetProcessList()
  
  If OldProcessListCnt = ProcessListCnt
    For i = 1 To ProcessListCnt
      If OldProcessList(i)\Name <> ProcessList(i)\Name Or OldProcessList(i)\Path <> ProcessList(i)\Path Or OldProcessList(i)\ID <> ProcessList(i)\ID
        FillProcessList()
        Break
      EndIf
    Next
  Else
    FillProcessList()
  EndIf
EndProcedure

Define.l Event,Index,UpdateStartTime,i
Define.s ProcessToCrash

OS = OSVersion()
If OS = #PB_OS_Windows_NT3_51 Or OS = #PB_OS_Windows_NT_4
  MessageRequester(#AppTitle, "Unsupported Windows version!",#MB_ICONEXCLAMATION)
  End
EndIf

If CountProgramParameters() > 0
  ProcessToCrash = LCase(ProgramParameter(0))
  GetProcessList()
  For i = 1 To ProcessListCnt
    If ProcessToCrash = LCase(ProcessList(i)\Name)
      CrashByInjection(ProcessList(i)\ID)
    EndIf  
  Next
  End
EndIf

SystemAppIcon = LoadIcon_(0,#IDI_APPLICATION)
OpenMainWindow()
GetProcessList()
FillProcessList()

Repeat
  
  UpdateStartTime = ElapsedMilliseconds()
  Event = WaitWindowEvent(#UpdateInterval)
  Select Event
    
    Case #PB_Event_SizeWindow
      ResizeGadget(#ListGad,#PB_Ignore,#PB_Ignore,WindowWidth(#MainWindow),WindowHeight(#MainWindow))
    
    Case #PB_Event_Gadget
      Select EventType()
        Case #PB_EventType_LeftDoubleClick
          Index = GetGadgetState(#ListGad)
          If Index > -1
            CrashProcess(Index+1)
          EndIf
        
      EndSelect

  EndSelect
  
  If ElapsedMilliseconds() => UpdateStartTime + #UpdateInterval
    UpdateProcessList()
  EndIf
    
Until Event = #PB_Event_CloseWindow

Verfasst: 27.10.2007 03:31
von Thorium
So ich hab mal die Links korrigiert für Download und Screenshot. War ungültig wegen Providerwechsel.

Verfasst: 28.10.2007 15:35
von pede
Wow super danke...

:allright: