Beispiel #1
0
    def __init__(self, proxies={'http': 'http://127.0.0.1:8080',
        'https': 'http://127.0.0.1:8080'}):
        """
        Creates an instance of the ZAP api client.

        :Parameters:
           - `proxies`: dictionary of ZAP proxies to use.
           
        Note that all of the other classes in this directory are generated
        new ones will need to be manually added to this file
        """
        self.__proxies = proxies
        
        self.acsrf = acsrf(self)
        self.ajaxSpider = ajaxSpider(self)
        self.ascan = ascan(self)
        self.authentication = authentication(self)
        self.autoupdate = autoupdate(self)
        self.brk = brk(self)
        self.context = context(self)
        self.core = core(self)
        self.forcedUser = forcedUser(self)
        self.httpsessions = httpSessions(self)
        self.importLogFiles = importLogFiles(self)
        self.params = params(self)
        self.pnh = pnh(self)
        self.pscan = pscan(self)
        self.script = script(self)
        self.search = search(self)
        self.selenium = selenium(self)
        self.sessionManagement = sessionManagement(self)
        self.spider = spider(self)
        self.users = users(self)
Beispiel #2
0
    def __init__(self, proxies={'http': 'http://127.0.0.1:8080',
        'https': 'http://127.0.0.1:8080'}):
        """
        Creates an instance of the ZAP api client.

        :Parameters:
           - `proxies`: dictionary of ZAP proxies to use.
           
        Note that all of the other classes in this directory are generated
        new ones will need to be manually added to this file
        """
        self.__proxies = proxies
        
        self.acsrf = acsrf(self)
        self.ajaxSpider = ajaxSpider(self)
        self.ascan = ascan(self)
        self.authentication = authentication(self)
        self.autoupdate = autoupdate(self)
        self.brk = brk(self)
        self.context = context(self)
        self.core = core(self)
        self.forcedUser = forcedUser(self)
        self.httpsessions = httpSessions(self)
        self.importLogFiles = importLogFiles(self)
        self.params = params(self)
        self.pnh = pnh(self)
        self.pscan = pscan(self)
        self.script = script(self)
        self.search = search(self)
        self.selenium = selenium(self)
        self.sessionManagement = sessionManagement(self)
        self.spider = spider(self)
        self.users = users(self)
Beispiel #3
0
    def __init__(self, instrument, granularity, units, clargs):
        self.accountID, token = authentication()
        self.client = API(access_token=token)
        self.units = units
        self.clargs = clargs
        self.pt = PriceTable(instrument, granularity)
        # fetch First Candle data
        params = {"count": 1, "from": self.clargs.Orbdate}
        r = instruments.InstrumentsCandles(instrument=instrument,
                                           params=params)
        rv = self.client.request(r)
        if len(rv) == 0:
            logger.error(
                "No candle data available for specified date:{d}".format(
                    d=self.clargs.Orbdate))

        # and calculate indicators
        for crecord in rv['candles']:
            if crecord['complete'] is True:
                self.high = float(crecord['mid']['h'])
                self.low = float(crecord['mid']['l'])
        ORBdetails = ORB(self.pt, self.client, self.high, self.low)
        self.pt.setHandler("onAddItem", ORBdetails.calculate)
        self.indicators = [ORBdetails]
        self.state = NEUTRAL  # overall state based on calculated indicators
        self.unit_ordered = False

        self._botstate()
Beispiel #4
0
def main():
    """Build the magic!"""
    args = get_args()
    uname = args.uname

    if auth.authentication(uname):
        itf.build_itf()
    else:
        print("Sorry! You're not authorized.")
Beispiel #5
0
def prepareTweetyAPI():
    # Get access and key from another class
    auth = authentication()

    consumer_key = auth.getconsumer_key()
    consumer_secret = auth.getconsumer_secret()

    access_token = auth.getaccess_token()
    access_token_secret = auth.getaccess_token_secret()

    # Authentication
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.secure = True
    auth.set_access_token(access_token, access_token_secret)

    api = tweepy.API(auth)
    return api
Beispiel #6
0
def get_user_informations(tweet):

    print("User ID \t:" + str(tweet.user.id))
    print("User image profil \t:" + tweet.user.profile_image_url_https)
    print("User Name \t:" + tweet.user.name)
    print("User URL \t: %s", tweet.user.url)
    print("User profil text color \t:" + tweet.user.profile_text_color)
    print("User background image url \t:" + tweet.user.profile_background_image_url)
    print("User Friends count \t:" + str(tweet.user.friends_count))
    print("User Screen name \t:" + tweet.user.screen_name)
    print("User Verified \t:" + str(tweet.user.verified))
    print("User Favorite count \t:" + str(tweet.user.favourites_count))

    if hasattr(tweet.user, 'time_zone'):
    print("User Time zone \t: %s", tweet.user.time_zone)
    print("User UTC Offset \t:" + str(tweet.user.utc_offset))
    print("User Status count \t:" + str(tweet.user.statuses_count))

    print("User Description \t: %s", tweet.user.description)
    print("User Follower count \t:" + str(tweet.user.followers_count))
    print("User Created at \t:" + str(tweet.user.created_at))


if __name__ == '__main__':

    # Get access and key from another class
    auth = authentication()

    consumer_key = auth.getconsumer_key()
    consumer_secret = auth.getconsumer_secret()

    access_token = auth.getaccess_token()
    access_token_secret = auth.getaccess_token_secret()

    # Authentication
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.secure = True
    auth.set_access_token(access_token, access_token_secret)

    api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True, retry_count=10, retry_delay=5, retry_errors=5)

    streamListener = TwitterStreamListener()
    myStream = tweepy.Stream(auth=api.auth, listener=streamListener)

    myStream.filter(track=['michael'], async=True)
Beispiel #7
0
def main(argv):
    jiraBaseUrl = ''
    jformBaseUrl = ''
    issueUrl = ''
    sessionUrl = 'rest/auth/1/session'
    jiraNumber = ''
    
    jiraAuthUrl = jiraBaseUrl + sessionUrl
    jformAuthUrl = jformBaseUrl + sessionUrl
    jiraIssueUrl = jiraBaseUrl + issueUrl + jiraNumber
    jformIssueUrl = jformBaseUrl + issueUrl 
    jiraRemoteLink = jiraIssueUrl + "/remotelink"
    jiraIntenalLink = jiraIssueUrl + "/issueLink"
    #user inputs
    username = ''
    password = ''
    techDesignLink = ''
    pullRequestLink = 'http://www.google.com'
    
    loginData = {'username':username, 'password':password}
    isAuthenticatedUser = False
    
    userAuthentication = authentication()
    basicData = BasicData()
    jira = Jira()
    
    jiraAuthenticatedUser = userAuthentication.authenticate(jiraAuthUrl,loginData)
    jFormAuthenticatedUser = userAuthentication.authenticate(jformAuthUrl,loginData)
    if(jiraAuthenticatedUser.status_code == 200 and jFormAuthenticatedUser.status_code == 200):
        isAuthenticatedUser = True
    else:
        return HttpResponse("Username or password is incorrect",content_type='text/plain')
        exit(0)   
    
    if(isAuthenticatedUser):
       jFormCreated = jira.createJForm(jformIssueUrl, basicData.getCookieData(jFormAuthenticatedUser), techDesignLink, pullRequestLink )
        if(jiraCreated.status_code == 200):
            jformResponseJson = jFormCreated.json()
        jira.addlinksToJira(jiraRemoteLink, basicData.getCookieData(jiraAuthenticatedUser), techDesignLink, "Tech Desgin"  )
        jira.addlinksToJira(jiraRemoteLink, basicData.getCookieData(jiraAuthenticatedUser), pullRequestLink, "Review Link"  )#
        
        jformLink = jformBaseUrl + "browse/" + jFormCreated['key']
        jira.addInternalLinksToJira(jiraRemoteLink, basicData.getCookieData(jiraAuthenticatedUser), jFormCreated, jformResponseJson)
Beispiel #8
0
    def __init__(self, proxies=None, apikey=None):
        """
        Creates an instance of the ZAP api client.

        :Parameters:
           - `proxies`: dictionary of ZAP proxies to use.

        Note that all of the other classes in this directory are generated
        new ones will need to be manually added to this file
        """
        self.__proxies = proxies or {
            'http': 'http://127.0.0.1:8080',
            'https': 'http://127.0.0.1:8080'
        }
        self.__apikey = apikey

        self.acsrf = acsrf(self)
        self.ajaxSpider = ajaxSpider(self)
        self.ascan = ascan(self)
        self.authentication = authentication(self)
        self.authorization = authorization(self)
        self.autoupdate = autoupdate(self)
        self.brk = brk(self)
        self.context = context(self)
        self.core = core(self)
        self.forcedUser = forcedUser(self)
        self.httpsessions = httpSessions(self)
        self.importLogFiles = importLogFiles(self)
        self.params = params(self)
        self.pnh = pnh(self)
        self.pscan = pscan(self)
        self.reveal = reveal(self)
        self.script = script(self)
        self.search = search(self)
        self.selenium = selenium(self)
        self.sessionManagement = sessionManagement(self)
        self.spider = spider(self)
        self.stats = stats(self)
        self.users = users(self)

        # not very nice, but prevents warnings when accessing the ZAP API via https
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
Beispiel #9
0
    def __init__(self, proxies=None, apikey=None):
        """
        Creates an instance of the ZAP api client.

        :Parameters:
           - `proxies`: dictionary of ZAP proxies to use.

        Note that all of the other classes in this directory are generated
        new ones will need to be manually added to this file
        """
        self.__proxies = proxies or {
            'http': 'http://127.0.0.1:8080',
            'https': 'http://127.0.0.1:8080'
        }
        self.__apikey = apikey

        self.acsrf = acsrf(self)
        self.ajaxSpider = ajaxSpider(self)
        self.ascan = ascan(self)
        self.authentication = authentication(self)
        self.authorization = authorization(self)
        self.autoupdate = autoupdate(self)
        self.brk = brk(self)
        self.context = context(self)
        self.core = core(self)
        self.forcedUser = forcedUser(self)
        self.httpsessions = httpSessions(self)
        self.importLogFiles = importLogFiles(self)
        self.params = params(self)
        self.pnh = pnh(self)
        self.pscan = pscan(self)
        self.reveal = reveal(self)
        self.script = script(self)
        self.search = search(self)
        self.selenium = selenium(self)
        self.sessionManagement = sessionManagement(self)
        self.spider = spider(self)
        self.stats = stats(self)
        self.users = users(self)

        # not very nice, but prevents warnings when accessing the ZAP API via https
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
Beispiel #10
0
def connect_twitter():
    # Get access and key from another class
    auth = authentication()

    consumer_key = auth.getconsumer_key()
    consumer_secret = auth.getconsumer_secret()

    access_token = auth.getaccess_token()
    access_token_secret = auth.getaccess_token_secret()

    # Authentication
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.secure = True
    auth.set_access_token(access_token, access_token_secret)

    api = tweepy.API(auth,
                     wait_on_rate_limit=True,
                     wait_on_rate_limit_notify=True,
                     retry_count=10,
                     retry_delay=5,
                     retry_errors=5)
    return api
Beispiel #11
0
        return 'male'


def connect_couchdb(ip, db_name):
    couch = couchdb.Server(ip)
    #     couch.resource.credentials = ('wppaul', 'qwert12345')
    try:
        database = couch.create(db_name)
    except couchdb.http.PreconditionFailed as e:
        database = couch[db_name]
    return database


if __name__ == '__main__':
    # Get access and key from another class
    auth = authentication()

    consumer_key = auth.getconsumer_key()
    consumer_secret = auth.getconsumer_secret()
    access_token = auth.getaccess_token()
    access_token_secret = auth.getaccess_token_secret()

    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.secure = True
    auth.set_access_token(access_token, access_token_secret)

    #Connect Google Maps API
    gmaps = googlemaps.Client(key='AIzaSyCGwI22mO3khzq1_cttVxoBTK_auzfWEjI')

    #Connect Face++ API
    SERVER = 'http://api.us.faceplusplus.com/'
Beispiel #12
0
        request = driveService.files().get_media(fileId=file_id)
        fh = io.BytesIO()
        downloader = MediaIoBaseDownload(fh, request)
        done = False
        while done is False:
            status, done = downloader.next_chunk()
            print("Download %d%%." % int(status.progress() * 100))
        with io.open(filepath, 'wb') as f:
            fh.seek(0)
            f.write(fh.read())


scopes = 'https://www.googleapis.com/auth/drive'
clientSecretFile = 'client_secret.json'
applicationName = 'Drive API Python Quickstart'
authInst = authentication.authentication(scopes, clientSecretFile,
                                         applicationName)
credentials = authInst.get_credentials()

http = credentials.authorize(httplib2.Http())
driveService = discovery.build('drive', 'v3', http=http)

new_q = Provider(scopes, clientSecretFile, applicationName, authInst,
                 credentials, http, driveService, scriptpath)
new_q.list('testy', recursive=True)
# new_q.create_dir(directory='jeevan')
# print(new_q.search(directory='testy', filename='photo_test.jpg',recursive=True))
#new_q.put("photo_test.jpg")
#new_q.get("photo_test.jpg")
# new_q.delete("jeevan")
# new_q.get(source='./test_new_code', destination='testy', recursive=False)
#new_q.put(source='GDriveStorage.csv', destination='testy_arv', recursive=False)
Beispiel #13
0
import os
import searchtools, time
from authentication import authentication
from logger import Logger


# the root folder
projectFolder = (os.getcwd()+"/")
logger = Logger()


# Authenticates and makes sure all files are in the current directory
s = authentication(projectFolder)
missingMainfiles = s.mainFiles()
if missingMainfiles != None: print(missingMainfiles) #prints if there is a missing file

time.sleep(1)
# s.showFiles(isShow=True)
print ('show-manager by Tyrus Miles')

s = searchtools.searchtools(projectFolder)
while True:
    

    command = (input("\n\nEnter command (type help): ").lower()).split(" ")
    # try:
    if command[0] == '':
        break
    elif (command[0] == 'b') or (command[0] == 'bookmarks'):

        print('\nBOOKMARKS')
Beispiel #14
0
            notification('Google API is reaching the limit')
            return False

    # Twitter error list : https://dev.twitter.com/overview/api/response-codes
    
    def on_error(self, status_code):
        print(status_code)
        if status_code == 420:
            print('out of limit')
    
    
if __name__ == '__main__':
    print('begin')

    # Get access and key from another class
    auth = authentication()

    consumer_key = auth.getconsumer_key()
    consumer_secret = auth.getconsumer_secret()

    access_token = auth.getaccess_token()
    access_token_secret = auth.getaccess_token_secret()
 
 # create and connect to database
    couch = couchdb.Server('http://115.146.89.121:5984/')
    try:
        data_base = couch.create('melbourne_tweets')
    except couchdb.http.PreconditionFailed as e:
        data_base = couch['melbourne_tweets']

    gmaps = googlemaps.Client(key='AIzaSyDoYjw_LY3nG43wpnulJbLyuK2NcUXVsvo')