コード例 #1
0
def try_password(options, password, output=None, k=0):

    p = SAPRouter(type=SAPRouter.SAPROUTER_ADMIN,
                  version=options.router_version)
    p.adm_command = 2
    p.adm_password = password
    p = str(SAPNI() / p)

    import fau_timer
    fau_timer.init()
    fau_timer.send_request(options.remote_host, options.remote_port, p, len(p))
    fau_timer.calculate_time()
    cpuSpeed = fau_timer.get_speed()
    cpuTicks = fau_timer.get_cpu_ticks()
    time = fau_timer.get_time()

    if options.verbose:
        print("Request time: CPU Speed: %s Hz CPU Ticks: %s Time: %s nanosec" %
              (cpuSpeed, cpuTicks, time))

    # Write the time to the output file
    if output:
        output.write("%i,%s,%s\n" % (k, password, time))

    return time
コード例 #2
0
def try_password(options, password, output=None, k=0):

    p = SAPRouter(type=SAPRouter.SAPROUTER_ADMIN, version=options.router_version)
    p.adm_command = 2
    p.adm_password = password
    p = str(SAPNI() / p)

    fau_timer.init()
    fau_timer.send_request(options.remote_host, options.remote_port, p, len(p))
    fau_timer.calculate_time()
    cpu_peed = fau_timer.get_speed()
    cpu_ticks = fau_timer.get_cpu_ticks()
    time = fau_timer.get_time()

    if options.verbose:
        print("Request time: CPU Speed: %s Hz CPU Ticks: %s Time: %s nanosec" % (cpu_peed, cpu_ticks, time))

    # Write the time to the output file
    if output:
        output.write("%i,%s,%s\n" % (k, password, time))

    return time
コード例 #3
0
ファイル: runme.py プロジェクト: lrq3000/fau-timer
# Open file for output
f = open('output.csv', 'w')

# Do the request "times" times
for i in range(times):
        # initialize fau_timer
        fau_timer.init()

        # Send the request and measure the response time
        if i%2 == 0:
                fau_timer.send_request(host, 80, request_a)
        else:
                fau_timer.send_request(host, 80, request_b)

        # Now get the ticks and the time from fau_timer
        fau_timer.calculate_time()

        # Get the current cpu speed
        cpuSpeed = fau_timer.get_speed()
        print "Request %i: CPU Speed: %s Hz" % (i, cpuSpeed)

        # Get the time the request has taken in cpu ticks
        cpuTicks = fau_timer.get_cpu_ticks()
        print "Request %i: CPU Ticks: %s" % (i, cpuTicks)

        # Get the time the request has taken in nanoseconds
        time = fau_timer.get_time()
        print "Request %i: Time: %s nanosec" % (i, time)

        # Get the response from the server
        response = fau_timer.get_response()
コード例 #4
0
# Open file for output
f = open('output.csv', 'w')

# Do the request "times" times
for i in range(times):
    # initialize fau_timer
    fau_timer.init()

    # Send the request and measure the response time
    if i % 2 == 0:
        fau_timer.send_request(host, 80, request_a)
    else:
        fau_timer.send_request(host, 80, request_b)

    # Now get the ticks and the time from fau_timer
    fau_timer.calculate_time()

    # Get the current cpu speed
    cpuSpeed = fau_timer.get_speed()
    print "Request %i: CPU Speed: %s Hz" % (i, cpuSpeed)

    # Get the time the request has taken in cpu ticks
    cpuTicks = fau_timer.get_cpu_ticks()
    print "Request %i: CPU Ticks: %s" % (i, cpuTicks)

    # Get the time the request has taken in nanoseconds
    time = fau_timer.get_time()
    print "Request %i: Time: %s nanosec" % (i, time)

    # Get the response from the server
    response = fau_timer.get_response()