Exemple #1
0
    extractor.graph.node_hints[extractor.graph.nodes.index(node)] = {
        'ignorable': ignorable_areas
    }


def activate_app(node, world):
    screen = world.machine.automation.grab_screen()
    world.machine.automation.mouse.click(screen.size[0] / 2,
                                         screen.size[1] / 2)
    return True


if __name__ == '__main__':
    test_files = configuration.get_config(
    )["configurations"]["uac on"]["test files"]
    extractor = base_extractor.BaseExtractor(
        '7zip_uac_on_2', '\\utils\\runurl.py ' + test_files + '7z920.exe')

    # speedy launch doesnt work well with elevated processes
    extractor.use_fast_run_command = False

    extractor.graph.add_post_create_node_hook(
        'User Access Control',
        lambda node, world: customize_uac_node(extractor, node, world))

    extractor.graph.add_post_create_node_hook(
        'User Access Control_2',
        lambda node, world: customize_uac_node_2(extractor, node, world))

    extractor.graph.add_pre_create_node_hook(3, activate_app)

    #Ignore 'Browse For Folder' dialog as we dont care for windows native dialog
'''
Copyright (c) 2011-2013 F-Secure
See LICENSE for details
'''

from model_extraction import base_extractor, configuration
from model_extraction.ui import window_scrap

if __name__ == '__main__':
    test_files = configuration.get_default_config()["test files"]
    extractor = base_extractor.BaseExtractor(
        '7zip_newer', '\\utils\\runurl.py ' + test_files + '7z_newer.vbs')

    #Ignore 'Browse For Folder' dialog as we dont care for windows native dialog
    extractor.add_boundary_node('Browse For Folder')

    extractor.scrap_method = lambda node, world, scraper_hints, node_hints: window_scrap.custom_scraper(
        node, world)

    extractor.crawl_application()
Exemple #3
0
            # edge.custom['test value'] = [{'name': 'valid', 'value': '{+ctrl}a{-ctrl}demo'}]
            break
    '''
    ok_edge = [edge for edge in node.edges if edge.ui_type == 'text'][0]

    valid_edge = extractor.inject_edge(
        node, ok_edge.location, 'Valid serial',
        'normal')  # ok_edge.location or None, to get the text...
    valid_edge.method = enter_valid_serial
    valid_edge.method_source_code = ('press_ok', INSTALL_APP_TEMPLATE)

    demo_edge = extractor.inject_edge(node, ok_edge.location, 'Demo serial',
                                      'normal')
    demo_edge.method = enter_demo_serial
    demo_edge.method_source_code = ('press_ok', INSTALL_APP_TEMPLATE)


if __name__ == '__main__':
    test_files = configuration.get_default_config()["test files"]
    extractor = base_extractor.BaseExtractor(
        'serial_2', '\\utils\\runurl.py ' + test_files + 'installwserial.exe')

    extractor.scrap_method = lambda node, world, scraper_hints, node_hints: window_scrap.custom_scraper(
        node, world)

    extractor.graph.add_post_create_node_hook(
        'Please Type In Your Installation Key And Click Ok',
        lambda node, world: add_input_values(node, world, extractor))

    extractor.crawl_application()
'''
Copyright (c) 2011-2013 F-Secure
See LICENSE for details
'''

from model_extraction import base_extractor, configuration, image2
from model_extraction.ui import hybrid_scraper

if __name__ == '__main__':
    test_files = configuration.get_default_config()["test files"]
    extractor = base_extractor.BaseExtractor(
        'click_for_next',
        '\\utils\\runurl.py ' + test_files + 'click_for_next.exe')

    #Customize look of desktop node for small icon
    extractor.scrap_method = hybrid_scraper.scrap
    #style the root node image
    extractor.root_node_image = "../desktop.png"

    extractor.crawl_application()

    # By default one path will be taken after selecting minimal install
    # but we want also to explore what happens when the user selects full
    # install, which we know it goes somewhere else.
    # So we clone the next edge, start a crawl session, navigate specific
    # steps in specific order and then let the crawler discover the rest

    select_installation_2 = extractor.graph.get_node(
        "Please Select Type Of Installation_2")
    next_2 = select_installation_2.get_edge("Next").clone()
    next_2.name = "Next_2"
    Not all builds have lang selection...
    '''
    for edge in node.edges:
        if ("window" in edge.custom and
          edge.custom['window'].get("class", '') == "ComboBox"):
            node_index = node.graph.nodes.index(node)
            edge_index = node.edges.index(edge)             
            extractor.crawler.ignorable_edges.append((node_index,
                                                           edge_index))
    
if __name__ == '__main__':
    test_files = configuration.get_default_config()["test files"]
    project_name = "##PROJECT_NAME##"
    file_name = "##FILENAME##"
    extractor = base_extractor.BaseExtractor(project_name,
                                             '\\utils\\runurl.py %s%s' % (test_files, file_name),
                                             live_transmit=True)

    #style the root node image
    extractor.root_node_image = "../desktop.png"
    
    #Ignore 'Browse For Folder' dialog as we dont care for windows native dialogs
    extractor.add_boundary_node('Browse For Folder')
    
    extractor.scrap_method = lambda node, world, scraper_hints, node_hints: window_scrap.custom_scraper(node, world)

    #dropdown / comboboxes not yet supported during crawling, ignore them for now
    extractor.graph.add_post_create_node_hook(-1, lambda node, world: ignore_comboboxes(extractor, node, world))
    
    extractor.crawl_application()
    #Following lines will associate the events collected with the performed user actions (edge executions)
'''
Copyright (c) 2011-2013 F-Secure
See LICENSE for details
'''

from model_extraction import base_extractor, configuration
from model_extraction.ui import window_scrap

if __name__ == '__main__':
    test_files = configuration.get_default_config()["test files"]
    extractor = base_extractor.BaseExtractor(
        '7zipWinScraper', '\\utils\\runurl.py ' + test_files + '7z920.exe')

    #Ignore 'Browse For Folder' dialog as we dont care for windows native dialog
    extractor.add_boundary_node('Browse For Folder')

    extractor.scrap_method = lambda node, world, scraper_hints, node_hints: window_scrap.custom_scraper(
        node, world)

    extractor.crawl_application()
Exemple #7
0
    ignorable_areas = []
    edge = node.get_edge("Change when these notifications appear")
    ignorable_areas.append(edge.location)
    node.edges.pop(node.edges.index(edge))

    extractor.graph.node_hints[extractor.graph.nodes.index(node)] = {
        'ignorable': ignorable_areas
    }


if __name__ == '__main__':
    test_files = configuration.get_config(
    )["configurations"]["uac on"]["test files"]
    extractor = base_extractor.BaseExtractor('7zip_uac_on',
                                             '\\utils\\runurl.py ' +
                                             test_files + '7z920.exe',
                                             config_name='uac on',
                                             live_transmit=True)

    #style the root node image
    extractor.root_node_image = "../desktop.png"

    extractor.graph.add_post_create_node_hook(
        'User Account Control',
        lambda node, world: customize_uac_node(extractor, node, world))

    #Ignore 'Browse For Folder' dialog as we dont care for windows native dialog
    extractor.add_boundary_node('Browse For Folder')

    extractor.scrap_method = hybrid_scraper.scrap
        },

    in the same file, change the line for the default config, for example:
        "default configuration": "instrumented machine"
        
Then you're ready to run this example
'''

from model_extraction import base_extractor, configuration
from model_extraction.ui import window_scrap
from model_extraction.correlator import Correlator

if __name__ == '__main__':
    test_files = configuration.get_default_config()["test files"]
    extractor = base_extractor.BaseExtractor(
        'instrumentation',
        '\\utils\\runurl.py ' + test_files + 'instrumentation.exe',
        config_name='instrumented and prepared')

    extractor.scrap_method = lambda node, world, scraper_hints, node_hints: window_scrap.custom_scraper(
        node, world)

    #style the root node image
    extractor.root_node_image = "../desktop.png"

    extractor.crawl_application()
    #Following lines will associate the events collected with the performed user actions (edge executions)
    correlator = Correlator(extractor.world, extractor.crawler.timeline)
    correlator.correlate_events()
    extractor.project.graph.save_nodes()