알고리즘/codefightsDB

24>websiteHacking

Diademata 2019. 3. 25. 13:26
반응형

 Implement the missing code, denoted by ellipses. You may not modify the pre-existing code.

You've been dreaming about becoming a famous hacker all your life, and now it's time to make your dreams come true! You decided to start by finding a website that has some vulnerability, and you just found a doozy. This particular website has an open database users that contains information about the people using it. What's more, it stores the queries performed on this table on the client side, which makes it super simple to hack them.


The users table contains the following columns:


id - The unique user's ID;

login - The unique user's login;

name - The user's name;

type - The user's role type (which can be "user", "admin", "moderator", etc.).

The query you have access to gathers some information about the users who have the "user" type. You don't want to get caught, so you want to carefully update it so that the query will return the records of all existing types.


Your task is to update the existing query. Note: You should add something to the query, but don't rewrite it.



code>>


CREATE PROCEDURE websiteHacking()

    SELECT id,login,name

    FROM users

    WHERE type='user'

    union select id,login,name

    from users

    where type <> 'user'

    ORDER BY id


다른 사람 코드


CREATE PROCEDURE websiteHacking()

    SELECT id,login,name

    FROM users

    WHERE type='user'

    OR 1=1

    ORDER BY id



반응형

'알고리즘 > codefightsDB' 카테고리의 다른 글

25>nullIntern  (0) 2019.04.02
23>marketReport  (0) 2019.03.25
22>soccerPlayers  (0) 2019.03.25
21>travelDiary  (0) 2019.03.25
20>movieDirectors  (0) 2019.03.25