Example #1
0
    def report_me(y, m, t, on_tor):
        path = 'temp/0/'
        list_file = []
        for x in os.listdir(path):
            if 'txt' in x and y + '_' + m + '_' in x:
                list_file.append(x)

        for i in range(len(list_file)):
            soup = BeautifulSoup(open('{0}{1}_{2}_{3}.txt'.format(path, str(y), str(m), str(i))))
            if soup.find('h3', {'class': 'post-title entry-title'}).contents[0]:
                title = soup.find('h3', {'class': 'post-title entry-title'}).contents[0]
                title = title.strip('\n')
                title = title.encode('utf-8')

            if title == t:
                logging.debug("- Intercept for post: {}-".format(str(t)))
                if on_tor['USE']:
                    socks.setdefaultproxy()
                    EmailNotifiers.interceptCall('{0}{1}_{2}_{3}.txt'.format(path, str(y), str(m), str(i)))
                    socks.setdefaultproxy(socks.SOCKS5, str(on_tor['P_SERVER']), int(on_tor['P_PORT']), True)
                    socket.socket = socks.socksocket
                else:
                    EmailNotifiers.interceptCall('{0}{1}_{2}_{3}.txt'.format(path, str(y), str(m), str(i)))