intwin(){ char flag[128]; FILE *file = fopen("flag.txt","r"); if (!file) { printf("Missing flag.txt. Contact an admin if you see this on remote."); exit(1); } fgets(flag, 128, file); puts(flag); }
intvuln(){ char password[64]; puts("Enter the secret word: "); gets(&password); if(strcmp(password, "password123") == 0){ puts("Logged in! The flag is somewhere else though..."); } else { puts("Login failed!"); } return0; }
char password[64]; int ways_to_leave_your_lover = 0; int what_i_cant_drive = 0; int when_im_walking_out_on_center_circle = 0; int which_highway_to_take_my_telephones_to = 0; int when_i_learned_the_truth = 0; printf("Enter the secret word: "); gets(&password); if(strcmp(password, "password123") == 0){ puts("Logged in! Let's just do some quick checks to make sure everything's in order..."); if (ways_to_leave_your_lover == 50) { if (what_i_cant_drive == 55) { if (when_im_walking_out_on_center_circle == 245) { if (which_highway_to_take_my_telephones_to == 61) { if (when_i_learned_the_truth == 17) { char flag[128]; FILE *f = fopen("flag.txt","r"); if (!f) { printf("Missing flag.txt. Contact an admin if you see this on remote."); exit(1); } fgets(flag, 128, f); printf(flag); return; } } } } } puts("Nope, something seems off."); } else { puts("Login failed!"); } }
get '/' do db = SQLite3::Database.new "quills.db" @row = db.execute( "select * from quills" )
erb :index end
get '/quills' do erb :quills
end
post '/quills' do db = SQLite3::Database.new "quills.db" cols = params[:cols] lim = params[:limit] off = params[:offset] blacklist = ["-", "/", ";", "'", "\""] blacklist.each { |word| if cols.include? word return"beep boop sqli detected!" end }
if !/^[0-9]+$/.match?(lim) || !/^[0-9]+$/.match?(off) return"bad, no quills for you!" end
@app.route("/") defmain_page() -> Response: if"X-Forwarded-For"in request.headers: # https://stackoverflow.com/q/18264304/ # Some people say first ip in list, some people say last # I don't know who to believe # So just believe both ips: List[str] = request.headers["X-Forwarded-For"].split(", ") ifnot ips: return text_response("How is it even possible to have 0 IPs???", 400) if ips[0] != ips[-1]: return text_response( "First and last IPs disagree so I'm just going to not serve this request.", 400, ) ip: str = ips[0] if ip != "1.3.3.7": return text_response("I don't trust you >:(", 401) return text_response("Hello 1337 haxx0r, here's the flag! " + FLAG) else: return text_response("Please run the server through a proxy.", 400)