Exemplo n.º 1
0
    def get(self,service):
        t = Team(None, "API_KEY")
        status = t.get_game_status()
        ownscore = status['scores']['151']['total_points']
        result = []
        top_ten = sorted([team['total_points'] for team in status['scores'].values()], reverse = True)[10]

        for target in t.get_targets(service):
            team_id = target['hostname'][4:]
            if status['scores'][team_id]['total_points'] > ownscore or status['scores'][team_id]['total_points'] >top_ten:
                result.append(target)
        return result
Exemplo n.º 2
0
from swpag_client import Team

t = Team("http://actf0.cse545.rev.fish/", "IeaL1xdIryga0Ubazn2Zi2Sh3Gf47RdN")
print(t.game_url)
#print(t.get_vm())
print(t.get_game_status())
print(t.get_service_list())
#t.get_targets(service_id)
services = t.get_service_list()
print('services:', services)
print()
for service in services:
    print('SERVICE NAME:', service)
    targets = t.get_targets(service_id)
    for target in targets:
        print('TARGET NAME:', target)
Exemplo n.º 3
0
from swpag_client import Team

t = Team("http://actf1.cse545.rev.fish/", "C8u0EDLS7oRLndF1u2TczzMgdDWQvtOS")
game_stat = t.get_game_status()
exp_srv = game_stat['exploited_services']
teams = t.get_team_list()
t_status = t.get_team_status()
tick_info = t.get_tick_info()
time_to_tick = tick_info['approximate_seconds_left']

#print(t.get_game_status())
services = t.get_service_list()
for service in services:
    print(service["service_id"])
    targets = t.get_targets(service["service_id"])
    for target in targets:
        print str(target)
Exemplo n.º 4
0
		service_ids.append(service['service_id'])

	return service_ids


if __name__ == '__main__':

	# insert information: game_url, team_token, team_id
	game_url = "http://34.211.129.130"
	team_token = "WOfdkzdhsZEIlPEIai49"
	team_id = "9"

	#create team object
	team = Team(game_url, team_token)

	game_status = team.get_game_status()
	service_ids = get_service_ids(team)

	while True:

		for id in service_ids:
			id_string = str(id)
			service_state = game_status['service_states'][team_id][id_string]['service_state']
			message = "TeamId: " + team_id + ", service_id: " + id_string + ", state: " + service_state
			print(message)
			# service_state can be "untested", "up", "down"
			if service_state == "down":
				print("Need recovery")
				backup_file_path = backup_map.get(id)
				original_file_path = original_file_path_map.get(id)
				recover_service(backup_file_path, original_file_path)