Last active
April 3, 2024 01:28
-
-
Save httpmurilo/e744e3b096d695e92c4253b33830d882 to your computer and use it in GitHub Desktop.
easy-to-use sql injection with java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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