Exemple #1
0
# -*- coding: utf-8 -*-
"""
this module instantiate a zombie object that will send a random tweet through a
specific twitter account. The purpose behind is to keep an account look active by posting
some random status on it

Created on Tue May 19 16:18:26 2015

@author: giotto
"""
import sys
from modules.twitter_agent import Twitter_hunts

if __name__ == "__main__":
    account = 'giannirage'
    if len(sys.argv) == 1:
        pass
    elif len(sys.argv) == 2:
        account = sys.argv[1]
    zombie = Twitter_hunts()
    zombie.logs('zombie')
    zombie.apis_loader(account)

    zombie.zombi_twitter_account()
    zombie.disconnector()
Exemple #2
0
                                    args=args, kwargs=db)
        retweeters_hunt = \
            multiprocessing.Process(name='retweeters_hunt',
                                    target=intrusion.retweeters_hunt,
                                    args=args, kwargs=db)
        mentions_hunt =\
            multiprocessing.Process(name='mentions_hunt',
                                    target=intrusion.mentions_hunt,
                                    args=args, kwargs=db)

        timeline_hunt.start()
        time.sleep(120)
        retweeters_hunt.start()
        time.sleep(5)
        mentions_hunt.start()

        timeline_hunt.join()
        retweeters_hunt.join()
        mentions_hunt.join()
 #       intrusion.connector('_basic_schema',**db)
#        intrusion.control_table_inserter()

        # the 'open' prevents a sys.exit(0) which wouldn't allow eventual extra
        # codes in the module where this function is called and after this
        # function is called
        intrusion.disconnector()

    except KeyboardInterrupt:
        print("You interrompted the process and exited the program.\
        See ya next time")
Exemple #3
0
        nodes_hunt=Twitter_hunts()
  #      nodes_hunt.connector('_basic_schema',**db)
  #      nodes_hunt.connector(**db)

        tweets_hunt=multiprocessing.Process(name='tweets_hunt',target=nodes_hunt.tweets_hunt, args=args,kwargs=db)
        nodes_hunt.tweets_hunt(*args,**db)
        args.append('-v')
        retweeters_hunt=multiprocessing.Process(name='retweeters_hunt',target=nodes_hunt.retweeters_hunt,args=args,kwargs=db)
        mentions_hunt=multiprocessing.Process(name='mentions_hunt',target=nodes_hunt.mentions_hunt,args=args,kwargs=db)

        tweets_hunt.start()
        time.sleep(60)
        retweeters_hunt.start()
        time.sleep(2)
        mentions_hunt.start()

        tweets_hunt.join()
        retweeters_hunt.join()
        mentions_hunt.join()
##############################################################

      #  nodes_hunt.connector('_basic_schema',**db)
       # nodes_hunt.control_table_inserter()

        #the 'open' prevents a sys.exit(0) which wouldn't allow eventual extra codes in the module where this function is called and after this function is called
        nodes_hunt.disconnector()

    except KeyboardInterrupt:
        print("You interrompted the main process and exited the program. See ya next time")
def followers_followers_hunt(*args, **kwargs):
    try:
        args = []
        db = {'database': 'twitter', 'schema': ''}
        #   apis_slot='_giannirage'
        apis_slot = '_fragglecologne'
        if '-v' in sys.argv or '--verbose' in sys.argv:
            args.append('-v')
        if '-t' in sys.argv or '--test' in sys.argv:
            args.append('-t')

        if '--unlimited' in sys.argv or '-u' in sys.argv:
            args.append('-u')

        debug_schema = 'ITB_Berlin'
        max_number_subprocesses = 1

        sub_processes = []
        ###################################################
        if len(sys.argv) == 1:
            apis_slot = '_fragglecologne'
            args.append('-v')
            db['schema'] = debug_schema
            print 'Debug Mode, --Verbose: Y'
            print 'Writing on: '
            for key in db:
                print key, db[key]
        elif len(sys.argv) > 1:
            for arg in sys.argv:
                arg = str(arg)
                if arg.startswith('-') or arg.startswith(
                        '/') or arg.startswith('\\') or arg.endswith('.py'):
                    continue
                elif arg.startswith('_'):
                    apis_slot = arg
                else:
                    try:
                        max_number_subprocesses = int(arg)
                    except ValueError:
                        db['schema'] = arg

        intrusion = Twitter_hunts()

        for index in range(max_number_subprocesses):
            # args has to be build in this way due to the index
            edge_hunter_args = [index, max_number_subprocesses, apis_slot
                                ] + args
            edge_hunter = multiprocessing.Process(
                name='followers_followers_hunt' + str(index + 1),
                target=intrusion.followers_followers_hunt,
                args=edge_hunter_args,
                kwargs=db)
            sub_processes + [edge_hunter]
            edge_hunter.start()
            # launching the same processes at the same time could cause some a
            # recurrencies on some specific activity wih the db
            time.sleep(60)
        for hunter in sub_processes:
            hunter.join()

            intrusion.disconnector()

    except KeyboardInterrupt:
        print(
            "You interrompted the main process and exited the program. See ya next time"
        )