Beispiel #1
0
# FYI
import logging
logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s: %(message)s',
                    datefmt='%H:%M:%S')
#logging.disable(logging.INFO) # uncomment to block debug log messages

# Read the image parameters
logging.info('Reading the screenshot parameters from configure_initial.ini...')
config = ConfigParser()
config.read('config_initial.ini')

logging.info('Locating the screenshot of I am not robot...')
# location of checkbox of I am not robot
robotLoc = pyautogui.locateCenterOnScreen(imPath('images', 'reg.png'))

#click I am not a robot
pyautogui.click(robotLoc)

logging.info("Locating the screenshot of refresh...")
# location of refresh
refreshLoc = pyautogui.locateCenterOnScreen(imPath('images', 'refresh.png'))
# add 20 in Y direction taken into accout the offset introduced by error message
refreshLoc = (refreshLoc[0], refreshLoc[1] + 20)

# need to make sure street sign is shown
while (pyautogui.locateCenterOnScreen(imPath('images',
                                             'ifstreet.png')) == None):
    # click the refresh button
    logging.info("Not street sign, refreshing...")
Beispiel #2
0
verifyImg = literal_eval(strVerifyImg)

logging.info('Program Started. Press Ctrl-C to abort at any time.')
logging.info('To interrupt mouse movement, move mouse to upper left corner.')

problems = 0
streetSigns = 0
solves = 0
attempts = 0

startTime = time.time()
while True:
    #click I am not a robot
    logging.info("Clicking 'I am not a robot'...")
    pyautogui.click(robotLoc)
    while (pyautogui.locateOnScreen(imPath('images', 'pass.png'),
                                    region=passImg) == None):
        # Keep refreshing if it's not street sign
        while (pyautogui.locateOnScreen(imPath('images', 'ifstreet.png'),
                                        region=streetTitle) == None):
            # click the refresh button
            logging.info("Not street sign, refreshing...")
            problems = problems + 1
            pyautogui.click(refreshLoc)
        # Download image
        pyautogui.PAUSE = 0.05
        logging.info("Downloading street sign...")
        # copye image url
        rightClickImage(imageLoc)
        pyautogui.press('o')
        # get clipboard data
Beispiel #3
0
# In[3]:


# create the image of work region
logging.info('Creating the screenshot of work region...')
getImage(workRegion, 'images', 'work.png')


# In[4]:


# create the reg image to find the checkbox of "I am not robot"
logging.info('Creating the screenshot of I am not robot...')
getImage(robotImg, 'images', 'reg.png')
# location of checkbox of I am not robot
robotLoc = pyautogui.locateCenterOnScreen(imPath('images', 'reg.png'))


# In[5]:


#click I am not a robot
pyautogui.click(robotLoc)
# create the reg image to find the refresh
logging.info("Creating the screenshot of refresh...")
getImage(refreshImg, 'images', 'refresh.png')
# location of refresh
refreshLoc = pyautogui.locateCenterOnScreen(imPath('images', 'refresh.png'))
# add 20 in Y direction taken into accout the offset introduced by error message
refreshLoc = (refreshLoc[0], refreshLoc[1] + 20)
strStreetTitle = config.get('images', 'streetSign')
streetTitle = literal_eval(strStreetTitle)
# screenshot parameters for street signs
strImageLoc = config.get('images', 'image')
imageLoc = literal_eval(strImageLoc)
# screenshot parameters for checkmark sign
strPassImg = config.get('images', 'pass')
passImg = literal_eval(strPassImg)

logging.info('Program Started. Press Ctrl-C to abort at any time.')
logging.info('To interrupt mouse movement, move mouse to upper left corner.')

#click I am not a robot
logging.info("Clicking 'I am not a robot'...")
pyautogui.click(robotLoc)
while(pyautogui.locateOnScreen(imPath('images', 'pass.png'), region = passImg) == None):
    # Keep refreshing if it's not street sign
    while(pyautogui.locateOnScreen(imPath('images', 'ifstreet.png'), region = streetTitle) == None):
        # click the refresh button
        logging.info("Not street sign, refreshing...")
        pyautogui.click(refreshLoc)
    # Download image
    pyautogui.PAUSE = 0.05
    logging.info("Downloading streen sign...")
    # copye image url
    rightClickImage(imageLoc)
    pyautogui.press('o')
    # get clipboard data
    win32clipboard.OpenClipboard()
    url = win32clipboard.GetClipboardData()
    win32clipboard.CloseClipboard()
Beispiel #5
0
nextLoc = literal_eval(strNextLoc)

# screenshot parameters for street signs
strImageLoc = config.get('images', 'image')
imageLoc = literal_eval(strImageLoc)

logging.info('Program Started. Press Ctrl-C to abort at any time.')
logging.info('To interrupt mouse movement, move mouse to upper left corner.')

#click I am not a robot
logging.info("Clicking 'I am not a robot'...")
pyautogui.click(robotLoc)
i = 0
while (i < 100):
    # Keep refreshing if it's not street sign
    while (pyautogui.locateCenterOnScreen(imPath('images',
                                                 'ifstreet.png')) == None):
        # click the refresh button
        logging.info("Not street sign, refreshing...")
        pyautogui.click(refreshLoc)

    # Take a screenshot of image
    logging.info("Taking screenshot of streen sign...")
    name = 'payload' + str(i) + '.jpg'
    getImage(imageLoc, 'test', name)
    logging.info("Refreshing...")
    pyautogui.click(refreshLoc)
    i = i + 1

logging.info("Succeeded!!")