Example #1
0
def followers_hunt(*args, **kwargs):
    try:
        args = []
        db = {
            'database': 'twitter',
            'schema': ''}

        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 = 'giannirage'

        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

        args.append(apis_slot)

        intrusion = Twitter_hunts()
        intrusion.followers_list_hunt(*args, **db)

    except KeyboardInterrupt:
        print("You interrompted the process and exited the program. See ya next time")
Example #2
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()
Example #3
0
                elif arg.startswith('_'):
                    apis_slot=arg

                else:
                    db['schema']=arg

        args.append(apis_slot)

        #lang_paramter MUST be the first argument in args
        args=[lang_parameters,]+args

        #a graphic visualization of the whole hunt
        #graphviz = GraphvizOutput(output_file=str(time.strftime("%Y%m%d"))+'_'+str(db['schema'])+'_nodes_hunt.png')
        #with PyCallGraph(output=graphviz):

        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()
Example #4
0
            if arg.startswith('-')or arg.startswith('/')or \
                    arg.startswith('\\')or arg.endswith('.py'):
                continue
            elif arg.startswith('_'):
                apis_slot = arg
            else:
                db['schema'] = arg
    db['schema'] = str(db['schema'])
    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')
    args.append(apis_slot)
    try:

        intrusion = Twitter_hunts()
        timeline_hunt = \
            multiprocessing.Process(name='timeline_hunt',
                                    target=intrusion.timeline_hunt,
                                    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)
Example #5
0
     for key in db:
         print key, db[key]
 elif len(sys.argv)>1: 
     for arg in sys.argv:
         arg=str(arg.lower())
         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
             
 try:        
     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+1,max_number_subprocesses,apis_slot]+args
         edge_hunter=multiprocessing.Process(name='edges_id_hunt'+str(index+1),target=intrusion.followers_id_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(30)
     for hunter in sub_processes:
         hunter.join() 
 
 except KeyboardInterrupt:
     print("You interrompted the main process and exited the program. See ya next time")        
     sys.exit(1)
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"
        )
Example #7
0
Created on Sat Apr 04 12:40:45 2015

@author: giotto
"""
import sys
from modules.twitter_agent import Twitter_hunts
#from pycallgraph import PyCallGraph
#from pycallgraph.output import GraphvizOutput

if __name__ == "__main__":
    args = []
    db = {'database': 'twitter', 'schema': 'world_trends'}

    apis_slot = '_fragglecologne'
    args.append(apis_slot)
    if '-t' in sys.argv or '--test' in sys.argv:
        args.append('-t')

    try:
        # a graphic visualization of the whole hunt
        #graphviz = GraphvizOutput(output_file='trends_hunt.png')
        # with PyCallGraph(output=graphviz):

        intrusion = Twitter_hunts()
        intrusion.trends_hunt(*args, **db)

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