This seems like a simple task that has been driving me nuts. The CRUD API section has the following question: First, try to update any city’s name to be ‘flag’. Then, delete any city. Once done, search for a city named ‘flag’ to get the flag.
I literally copied the example in the lesson and replaced the IP:PORT.
I had no issues deleting a record and reading records. I have tried modifying ‘city_name’ in case the SQL db uses something else, but I kept getting the same error. Interesting enough, if I replace my json data with empty brackets, I get another error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘where city_name=‘Houston’’
Even the error shows that I am using the correct column name. I’m completely lost.
I just used this with no issues: curl http://142.93.39.188:30592/api.php/city/London -X PUT -d '{"city_name":"flag"}' -H "Content-Type: application/json"
Reset the target machine and try one more time. If you get it to work, keep this thread in mind: Web requests - crud api
I just tried your curl request and I’m still getting the same issue. I tried the PUT method first with no success. Below you will see me use GET with success. I then reset the machine and tried again. No luck.
Nice! Yeah, I was using the pwnbox, think about using it for certain exercises when you are having trouble. Especially when copying commands from the section. Windows may handle the examples from the course differently because the authors have wrote them with Linux in mind.
What do you want me to tell you about the curl command? I’d rather you tell me about the issue you are having and we go from there. That way when other people have the same issue they will know how to deal with it and they won’t just be copying and pasting commands from the forum.
-onthesauce
Question: First, try to update any city’s name to be ‘flag’. Then, delete any city. Once done, search for a city named ‘flag’ to get the flag.
Answer: ??
Can you Please teach a little about this question and then it’s solution.
That’s what all I wanted to say.
Question: First, try to update any city’s name to be ‘flag’. Then, delete any city. Once done, search for a city named ‘flag’ to get the flag.
Answer: ??
Can you Please teach a little about this question and then it’s solution.
That’s what all I wanted to say.
curl http://<SERVER_IP>:/api.php/city/London -X PUT -d ‘{“city_name”:“flag”}’ -H "Content-Type: application/json
curl http://<SERVER_IP>:/api.php/city/Birmingham -X DELETE -H “Content-Type: application/json”
curl http://<SERVER_IP>:/api.php/city/flag
HTB{crud_4p!_m4n // I just wrote half of the flag bcoz you have to do it man , above code is fine , I guess you forgot to write -H "Content-Type stuff "
I’m not sure if you’re replying to me, but I did have all the exact headers needed. No flag is needed since I solved this anyway by running the requests through a browser and not curl.