[Ruby] ManProcess 0.1

Iniciado por BigBear, 16 Febrero 2012, 18:14 PM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Un simple programa para manejar los procesos en Windows.

Código (ruby) [Seleccionar]

#!usr/bin/ruby
#ManProcess 0.1
#Coded By Doddy H

require "win32ole"

def head()
  print "\n\n-- == Man Process 0.1 == --\n\n"
end

def copyright()
  print "\n\n(C) Doddy Hackman 2012\n\n"
  exit(1)
end

def retor()
  print "\n\n[+] Press any key to continue\n\n"
  gets.chomp
end

while 1
  head()
  print "1 - Show Process\n"
  print "2 - Close Process\n"
  print "3 - Exit\n\n\n"
  print "[+] Option : "
  op = gets.chomp
  if op == "1"
    print "\n\n[+] Getting process...\n\n"
    nave = WIN32OLE.connect("winmgmts://")
    pro = nave.ExecQuery("select * from win32_process")
    pro.each do |po|
      print "[+] Name : ",po.Caption," [+] PID : ",po.ProcessId,"\n"
    end
    retor()

  elsif op == "2"
    print "\n\n[+] Name : "
    name = gets.chomp
    k = WIN32OLE.connect("winmgmts://")
    control = k.ExecQuery("select * from Win32_process where name='#{name}'")
    control.each do |pro|
      pro.Terminate
    end
    print "\n\n[+] Process Closed\n\n"
    gets.chomp
  elsif op == "3"
    copyright()
  else
    print "\n\n[-] Bad Option\n\n"
    retor()
  end
end


# The End ?