示例#1
0
文件: s_05.py 项目: qwergram/Snowman
def office_login():
    do("powershell start microsoft-edge:http://aka.ms/365")
    script1 = """WinActivate, Sign in to your account
    PixelGetColor, EOffice, 1894, 283, RGB
    PixelGetColor, ELock, 358, 125, RGB
    PixelGetColor, EBar, 1957, 572, RGB

    send, !{tab}
    sleep, 500
    send, %EOffice%%ELock%%EBar%{enter}"""

    script2 = """WinActivate, Sign in to your account
    sleep, 500
    Send, {fname}.{lname}@mssummit.net{tab}
    sleep, 500
    Send, P@ssword1
    sleep 200
    send {tab}
    sleep 200
    send {space}
    sleep, 500
    send {enter}"""

    while True:
        time.sleep(5)
        if str(BetaScript(script1, True)) == str('0xEB3C000x107C100xF'):
            break
        else:
            p("Waiting 5 seconds...")

    time.sleep(.75)
    BetaScript(script2.format(fname=usernames()['fname'], lname=usernames()['lname'], tab="{tab}", space="{space}", enter="{enter}"))
    return True
示例#2
0
文件: s_04.py 项目: qwergram/Snowman
def setup_to_internet():
    do("control.exe /name Microsoft.NetworkAndSharingCenter", "ignore")
    time.sleep(.75)

    script = """WinActivate, Network and Sharing Center
    sleep, 500
    IfWinActive, Network and Sharing Center
    send, #{up}
    sleep, 750
    click, 690, 380
    sleep, 750
    send, {down 2}{enter}
    sleep, 500
    send, MSFTOPEN{tab}
    sleep, 500
    send, n
    sleep, 500
    send, {tab}{space}{enter}
    sleep, 750
    send, {tab}{enter}
    sleep, 500
    send, !{f4}"""

    p("Plug in ethernet cable now if you wish to!")
    for x in range(3):
        winsound.Beep(2000, 500)
        time.sleep(.5)

    BetaScript(script)
示例#3
0
文件: s_04.py 项目: qwergram/Snowman
def setup_to_internet():
    do("control.exe /name Microsoft.NetworkAndSharingCenter", "ignore")
    time.sleep(.75)

    script = """WinActivate, Network and Sharing Center
    sleep, 500
    IfWinActive, Network and Sharing Center
    send, #{up}
    sleep, 750
    click, 690, 380
    sleep, 750
    send, {down 2}{enter}
    sleep, 500
    send, MSFTOPEN{tab}
    sleep, 500
    send, n
    sleep, 500
    send, {tab}{space}{enter}
    sleep, 750
    send, {tab}{enter}
    sleep, 500
    send, !{f4}"""

    p("Plug in ethernet cable now if you wish to!")
    for x in range(3):
        winsound.Beep(2000, 500)
        time.sleep(.5)

    BetaScript(script)
示例#4
0
def main(args):
    if not args or args[0] == '-h': usage()
    errors = []
    with open(args[0]) as f:
        golden = json.load(f)
    ggrammar = golden['[grammar]']
    gstart = golden['[start]']

    with open(args[1]) as f:
        mined = json.load(f)
    mgrammar = mined['[grammar]']
    mstart = mined['[start]']

    command = args[2]
    directory = args[3]
    count = int(args[4])
    key = args[5]
    os.makedirs(directory, exist_ok=True)
    fuzzer = F.LimitFuzzer(ggrammar)
    i = 0
    correct = 0
    seen = set()
    timeout = 0
    while True:
        try:
            v = fuzzer.fuzz(gstart)
            if not v.strip(): continue
            if v in seen: continue
            seen.add(v)
            fn = '%s/%s.input.x' % (directory, key)
            with open(fn, 'w+') as f:
                print(v, end='', file=f)
            o = util.do([command, fn])
            if o.returncode != 0:
                continue
            else:
                #print(repr(v))
                i += 1
                o = util.do(["python3", "./src/parser.py", args[1], fn],
                            timeout=60)
                if o.returncode == 0:
                    correct += 1
                    #print('parsed. %d/%d (timeout: %d)' % (correct, i, timeout))
                else:
                    print(
                        'not parsed %d/%d (timeout: %d)' %
                        (i - correct, i, timeout), o.stdout, o.stderr)
        except RecursionError:
            print('recursion.')
            pass
        except subprocess.TimeoutExpired:
            timeout += 1
            print('timedout.')
            pass
        if i >= count: break
    with open("%s/%s.precision_" % (directory, key), 'w+') as f:
        print('%s result: %d/%d (timeout: %d)' % (key, correct, i, timeout),
              file=f)
    return errors
示例#5
0
文件: s_02.py 项目: qwergram/Snowman
def launch_start_up_programs():
    warmups = [[
        "powershell start microsoft-edge:http://bing.com", "MicrosoftEdge.exe"
    ], ["control.exe /name Microsoft.NetworkAndSharingCenter", None]]
    for cmd, killcmd in warmups:
        for x in range(2):
            do(cmd, "ignore")
            time.sleep(2 - x)
            kill(killcmd, True)
示例#6
0
文件: s_02.py 项目: qwergram/Snowman
def launch_start_up_programs():
    warmups = [
        ["powershell start microsoft-edge:http://bing.com", "MicrosoftEdge.exe"],
        ["control.exe /name Microsoft.NetworkAndSharingCenter", None]
    ]
    for cmd, killcmd in warmups:
        for x in range(2):
            do(cmd, "ignore")
            time.sleep(2-x)
            kill(killcmd, True)
示例#7
0
文件: s_07.py 项目: qwergram/Snowman
def set_username():
    script = """
    send #{up}
    sleep 500
    click 547 350
    sleep 500
    send {fname} {lname}
    sleep 500
    send {enter}
    """

    do("control userpasswords", "ignore")
    time.sleep(2)
    BetaScript(script.format(fname=usernames()['fname'], lname=usernames()['lname'], enter='{enter}', up='{up}'))
    time.sleep(1)
    kill()
def main(args):
    errors = []
    with open(args[0]) as f:
        s = json.load(f)
    grammar = s['[grammar]']
    start = s['[start]']
    key = args[1]
    command = args[2]
    directory = args[3]
    count = int(args[4])
    os.makedirs(directory, exist_ok=True)
    fuzzer = F.LimitFuzzer(grammar)
    i = 0
    seen = set()
    while True:
        try:
            v = fuzzer.fuzz(start)
            if not v.strip(): continue
            if v in seen: continue
            seen.add(v)
            print(repr(v))
            fn = '%s/%s.input.x' % (directory, key)
            with open(fn, 'w+') as f:
                print(v, end='', file=f)
            o = util.do([command, fn])
            if o.returncode != 0:
                continue
            else:
                i += 1
                with open('%s/%s.input.%d' % (directory, key, i), 'w+') as fn:
                    print(v, end='', file=fn)
        except RecursionError:
            pass
        if i >= count: break
    return errors
示例#9
0
def set_username():
    script = """
    send #{up}
    sleep 500
    click 547 350
    sleep 500
    send {fname} {lname}
    sleep 500
    send {enter}
    """

    do("control userpasswords", "ignore")
    time.sleep(2)
    BetaScript(
        script.format(fname=usernames()['fname'],
                      lname=usernames()['lname'],
                      enter='{enter}',
                      up='{up}'))
    time.sleep(1)
    kill()
示例#10
0
def install_office():
    office_login()
    f = download_office_exe()
    do(f)

    while True:
        p("Checking to see if build completed...")
        time.sleep(3),
        check = os.path.exists(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16")
        check = check and os.path.isfile(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\excel.exe"
        )
        check = check and os.path.isfile(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\lync.exe"
        )
        check = check and os.path.isfile(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\msaccess.exe"
        )
        check = check and os.path.isfile(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\mspub.exe"
        )
        check = check and os.path.isfile(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\onenote.exe"
        )
        check = check and os.path.isfile(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\outlook.exe"
        )
        check = check and os.path.isfile(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\powerpnt.exe"
        )
        check = check and os.path.isfile(
            "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\winword.exe"
        )
        if check:
            time.sleep(5)
            kill("OfficeC2RClient.exe", True)
            return True
        else:
            p("Error Code: MA_365II")
示例#11
0
def office_login():
    do("powershell start microsoft-edge:http://aka.ms/365")
    script1 = """WinActivate, Sign in to your account
    PixelGetColor, EOffice, 1894, 283, RGB
    PixelGetColor, ELock, 358, 125, RGB
    PixelGetColor, EBar, 1957, 572, RGB

    send, !{tab}
    sleep, 500
    send, %EOffice%%ELock%%EBar%{enter}"""

    script2 = """WinActivate, Sign in to your account
    sleep, 500
    Send, {fname}.{lname}@mssummit.net{tab}
    sleep, 500
    Send, P@ssword1
    sleep 200
    send {tab}
    sleep 200
    send {space}
    sleep, 500
    send {enter}"""

    while True:
        time.sleep(5)
        if str(BetaScript(script1, True)) == str('0xEB3C000x107C100xF'):
            break
        else:
            p("Waiting 5 seconds...")

    time.sleep(.75)
    BetaScript(
        script2.format(fname=usernames()['fname'],
                       lname=usernames()['lname'],
                       tab="{tab}",
                       space="{space}",
                       enter="{enter}"))
    return True
示例#12
0
文件: s_05.py 项目: qwergram/Snowman
def install_office():
    office_login()
    f = download_office_exe()
    do(f)

    while True:
        p("Checking to see if build completed...")
        time.sleep(3),
        check = os.path.exists("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16")
        check = check and os.path.isfile("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\excel.exe")
        check = check and os.path.isfile("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\lync.exe")
        check = check and os.path.isfile("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\msaccess.exe")
        check = check and os.path.isfile("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\mspub.exe")
        check = check and os.path.isfile("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\onenote.exe")
        check = check and os.path.isfile("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\outlook.exe")
        check = check and os.path.isfile("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\powerpnt.exe")
        check = check and os.path.isfile("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\winword.exe")
        if check:
            time.sleep(5)
            kill("OfficeC2RClient.exe", True)
            return True
        else:
            p("Error Code: MA_365II")
示例#13
0
def launch_edge():
    do("powershell start microsoft-edge:http://aka.ms/365")
    time.sleep(.5)