Jump to content
ukrodriguez

5800 5900 vnc port scan?

Recommended Posts

Posted

Aproape orice scanner de porturi "stie" sa ii poti seta pe ce porturi sa scaneze. Daca intrebi daca exista astfel de compuri cu porturile astea deschise pe Interweb, ieri erau vreo 4-5 milioane ;)

Posted (edited)

am incercat 3 pagini de google, si nu am facut decat sa ma virusez. am scanat un host pe care era deschis portul (caci il am de mult) si totusi niciun soft nu mi-a detectat asta. sa fie provideru meu de vina? hmmm

a, si tot la subiect am citit putin pe google, cum ca porturile 5800-5900 sunt filtrate nu sunt open, si ca trebuie incercat port sweep, nu port scan.

Edited by ukrodriguez
Posted (edited)
package futai;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Scanner;
import java.util.StringTokenizer;

/*
PT UN BOSS DE BOSS!! CEL MAI MARE PATRON!
*/
public class Futai {

public static void main(String[] args) throws IOException {

Scanner in = new Scanner(System.in);

System.out.println("Baga ip start");
String ipStart = in.nextLine();
System.out.println("Baga ip sfarsit");
String ipEnd = in.nextLine();
int x = 0;

long start = host2long(ipStart);
long end = host2long(ipEnd);
for (long i = start; i <= end; i++) {

if (isOpen(long2dotted(i), 5900)) {
System.out.print(" VIN MILIOANELE CU SACU!! gasite: " + x++ + "\r");
}

}

}

public static long host2long(String host) {
long ip = 0;
if (!Character.isDigit(host.charAt(0))) {
return -1;
}
int[] addr = ip2intarray(host);
if (addr == null) {
return -1;
}
for (int i = 0; i < addr.length; ++i) {
ip += ((long) (addr[i] >= 0 ? addr[i] : 0)) << 8 * (3 - i);
}
return ip;
}

public static int[] ip2intarray(String host) {
int[] address = {-1, -1, -1, -1};
int i = 0;
StringTokenizer tokens = new StringTokenizer(host, ".");
if (tokens.countTokens() > 4) {
return null;
}
while (tokens.hasMoreTokens()) {
try {
address[i++] = Integer.parseInt(tokens.nextToken()) & 0xFF;
} catch (NumberFormatException nfe) {
return null;
}
}
return address;
}

public static String long2dotted(long address) {
StringBuilder sb = new StringBuilder();
for (int i = 0, shift = 24; i < 4; i++, shift -= 8) {
long value = (address >> shift) & 0xff;
sb.append(value);
if (i != 3) {
sb.append('.');
}
}
return sb.toString();
}

public static boolean isOpen(String ip, int port) throws IOException {

InetSocketAddress adr = new InetSocketAddress(ip, port);
Socket socket = new Socket();
socket.bind(null);
String addr = null;
try {
socket.connect(adr, 250);
return true;
} catch (IOException e) {
return false;
}

}

}

Edited by Bolovanus
Posted
package futai;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Scanner;
import java.util.StringTokenizer;

/*
PT UN BOSS DE BOSS!! CEL MAI MARE PATRON!
*/
public class Futai {

public static void main(String[] args) throws IOException {

Scanner in = new Scanner(System.in);

System.out.println("Baga ip start");
String ipStart = in.nextLine();
System.out.println("Baga ip sfarsit");
String ipEnd = in.nextLine();
int x = 0;

long start = host2long(ipStart);
long end = host2long(ipEnd);
for (long i = start; i <= end; i++) {

if (isOpen(long2dotted(i), 5900)) {
System.out.print(" VIN MILIOANELE CU SACU!! gasite: " + x++ + "\r");
}

}

}

public static long host2long(String host) {
long ip = 0;
if (!Character.isDigit(host.charAt(0))) {
return -1;
}
int[] addr = ip2intarray(host);
if (addr == null) {
return -1;
}
for (int i = 0; i < addr.length; ++i) {
ip += ((long) (addr[i] >= 0 ? addr[i] : 0)) << 8 * (3 - i);
}
return ip;
}

public static int[] ip2intarray(String host) {
int[] address = {-1, -1, -1, -1};
int i = 0;
StringTokenizer tokens = new StringTokenizer(host, ".");
if (tokens.countTokens() > 4) {
return null;
}
while (tokens.hasMoreTokens()) {
try {
address[i++] = Integer.parseInt(tokens.nextToken()) & 0xFF;
} catch (NumberFormatException nfe) {
return null;
}
}
return address;
}

public static String long2dotted(long address) {
StringBuilder sb = new StringBuilder();
for (int i = 0, shift = 24; i < 4; i++, shift -= 8) {
long value = (address >> shift) & 0xff;
sb.append(value);
if (i != 3) {
sb.append('.');
}
}
return sb.toString();
}

public static boolean isOpen(String ip, int port) throws IOException {

InetSocketAddress adr = new InetSocketAddress(ip, port);
Socket socket = new Socket();
socket.bind(null);
String addr = null;
try {
socket.connect(adr, 250);
return true;
} catch (IOException e) {
return false;
}

}

}

dude, observ ca sursa este scrisa in java. asa ca am pus mana, am descarcat eclipsa, new project-new class-run

am intordus adresa start si adresa end in consola, dupa care, ce sa vezi, nu-mi face print programelul.

am si cateva warnings in code.

tie iti afiseaza rezultatele?

gresesc eu ceva

ms mult

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...