Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.66 KB | None | 0 0
  1. __author__="Diego & Oscar"
  2. __date__ ="$08/16/2010 09:53:59 PM$"
  3. from os import path, walk
  4. from ftplib import FTP
  5. from smtplib import SMTP
  6. import mimetypes
  7. from email.MIMEText import MIMEText
  8. class Log_finder(object):
  9.     def __init__(self):
  10.         self.ftp_server=""
  11.         self.ftp_user=""
  12.         self.ftp_pass=""
  13.         self.smtp_server=""
  14.         self.smtp_user=""
  15.         self.smtp_pass=""
  16.         self.archivosLogs=[]
  17.     def conecter(self):
  18.         fserver = self.ftp_server
  19.         fuser=self.ftp_user
  20.         fpass=self.ftp_pass
  21.         sserver=self.smtp_server
  22.         suser=self.smtp_user
  23.         spass=self.smtp_pass
  24.         try:
  25.             ftp = FTP(fserver)
  26.             ftp.login(user=fuser,passwd=fpass)
  27.         except BaseException, e:
  28.             print '\n [-] Error: %s ' %(e)
  29.         else:
  30.             print "[*]Sucessfuly conencted to: %s" %(fserver)
  31.         try:
  32.             smtp = SMTP(sserver,587)
  33.             smtp.ehlo()
  34.             smtp.starttls()
  35.             smtp.ehlo()
  36.             smtp.login(suser,spass)
  37.         except BaseException, e:
  38.             print '\n [-] Error: %s ' %(e)
  39.         else:
  40.             print "[*]Sucessfuly conencted to: %s" %(sserver)
  41.  
  42.  
  43.  
  44.  
  45.     def buscador(self):
  46.         path_to_search = raw_input("Please enter the path to scan: ")
  47.         for root, dirs, files in walk(path_to_search):
  48.             for archivo in files:
  49.             (shortname, extension) = path.splitext(archivo)
  50.             if extension=='.log':
  51.                 self.archivosLog.append(path.join(root, archivo))
  52.             for i in self.archivosLogs:
  53.  
  54.  
  55.  if __name__ == '__main__':
  56.     Log = Log_finder()
  57.     Log.conecter()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement