Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.genuinevm.sniffy;
- import java.net.*;
- import java.util.*;
- public class Sniffy {
- boolean debug = false;
- List<String> urlList = new ArrayList<>();
- SortedMap<String, List<String>> map = (
- Collections.synchronizedSortedMap(
- new TreeMap<String, List<String>>(
- (k1, k2) -> {
- String[] str1 = k1.split("\\.");
- String[] str2 = k2.split("\\.");
- if (str1.length != 4)
- throw new NumberFormatException();
- int[] is1 = {
- Integer.parseInt(str1[0], 10),
- Integer.parseInt(str1[1], 10),
- Integer.parseInt(str1[2], 10),
- Integer.parseInt(str1[3], 10)
- };
- int[] is2 = {
- Integer.parseInt(str2[0], 10),
- Integer.parseInt(str2[1], 10),
- Integer.parseInt(str2[2], 10),
- Integer.parseInt(str2[3], 10)
- };
- for (int i = 0; i < 4; i++) {
- int i1 = is1[i];
- int i2 = is2[i];
- if (i1 == i2)
- continue;
- if (i1 < i2)
- return -1;
- else
- return 1;
- }
- return 0;
- }
- )
- )
- );
- Sniffy() {
- urlList.add("steampowered.com");
- urlList.add("valvesoftware.com");
- urlList.add("store.steampowered.com");
- urlList.add("cdn.store.steampowered.com");
- urlList.add("media.steampowered.com");
- urlList.add("storefront.steampowered.com");
- urlList.add("cdn.steamcommunity.com");
- urlList.add("support.steampowered.com");
- urlList.add("translation.steampowered.com");
- urlList.add("store.valvesoftware.com");
- urlList.add("source.valvesoftware.com");
- urlList.add("steamcommunity.com");
- urlList.add("api.steampowered.com");
- urlList.add("cafe.steampowered.com");
- urlList.add("client-download.steampowered.com");
- for (int i = 0; i < 100; i++) {
- urlList.add("media" + i + ".steampowered.com");
- urlList.add("cdn" + i + ".store.steampowered.com");
- urlList.add("cdn" + i + ".steamcommunity.com");
- urlList.add("cloud-" + i + ".steampowered.com");
- urlList.add("content" + i + ".steampowered.com");
- }
- for (int i = 0; i < 500; i++) {
- urlList.add("valve" + Integer.toString(i, 10) + ".cs.steampowered.com");
- }
- }
- void run() {
- System.out.println("# Generated by DNSniffy");
- urlList.stream().parallel().forEach(this::getIP);
- map.forEach(this::output);
- }
- void getIP(String s) {
- try {
- InetAddress address = InetAddress.getByName(new URL("http://" + s).getHost());
- String key = address.getHostAddress();
- synchronized (map) {
- map.putIfAbsent(key, new ArrayList<>());
- map.get(key).add(s);
- if (s.replaceAll("[^.]", "").length() <= 1)
- map.get(key).add("www." + s);
- }
- }
- catch (Exception e) {
- if (debug)
- System.out.println("# ERROR: " + s);
- }
- }
- void output(String k, List<String> v) {
- Collections.sort(v, (s1, s2) -> s1.compareToIgnoreCase(s2));
- String line = "";
- for (int i = 0; i < v.size(); i++) {
- String tmp = v.get(i);
- line += buffer(tmp, " ", ((i * 36) - line.length() + tmp.length()), true);
- }
- System.out.println(buffer(k, " ", 18, false) + line);
- }
- String buffer(String input, String buffer, int max, boolean leading) {
- while (input.length() < max) {
- if (input.length() >= max)
- break;
- if (leading)
- input = buffer + input;
- else
- input = input + buffer;
- }
- return input;
- }
- }
Advertisement