Skip to content

Instantly share code, notes, and snippets.

@httpmurilo
Last active April 3, 2024 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save httpmurilo/e744e3b096d695e92c4253b33830d882 to your computer and use it in GitHub Desktop.
Save httpmurilo/e744e3b096d695e92c4253b33830d882 to your computer and use it in GitHub Desktop.
easy-to-use sql injection with java
public class Main {
public static void main(String[] args) {
String fileName = "nomes.txt";
String baseUrl = "http://localhost:8080/api/user/search?name=";
try (BufferedReader br = new BufferedReader(new FileReader(fileName))) {
String line;
while ((line = br.readLine()) != null) {
String urlWithParam = baseUrl + line.trim();
System.out.println("Fazendo requisição para: " + urlWithParam);
makeHttpRequest(urlWithParam);
}
} catch (IOException e) {
e.printStackTrace();
}
}
private static void makeHttpRequest(String urlString) {
try {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
int responseCode = conn.getResponseCode();
System.out.println("Código de resposta: " + responseCode);
conn.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment