From 5c981762c6239cbb17884586c01e10164eb93bca Mon Sep 17 00:00:00 2001 From: orbiter Date: Sat, 14 May 2011 09:13:16 +0000 Subject: [PATCH] added bigrange option for network scan git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7721 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/CrawlStartScanner_p.html | 1 + htroot/CrawlStartScanner_p.java | 18 ++++++++++-------- source/net/yacy/cora/protocol/Scanner.java | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htroot/CrawlStartScanner_p.html b/htroot/CrawlStartScanner_p.html index 347fcf351..db10be8b8 100644 --- a/htroot/CrawlStartScanner_p.html +++ b/htroot/CrawlStartScanner_p.html @@ -46,6 +46,7 @@

Full Intranet Scan: #[intranethosts]#
+ bigrange #(intranetHint)#::
     Do not use intranet scan results, you are not in an intranet environment!
#(/intranetHint)#
Scan Cache
diff --git a/htroot/CrawlStartScanner_p.java b/htroot/CrawlStartScanner_p.java index 6b30b06c8..a1d2c2c80 100644 --- a/htroot/CrawlStartScanner_p.java +++ b/htroot/CrawlStartScanner_p.java @@ -94,6 +94,8 @@ public class CrawlStartScanner_p { if (repeat_unit.equals("seldays")) validTime = repeat_time * 24 * 60 * 60 * 1000; } + boolean bigrange = post.getBoolean("bigrange", false); + // case: an IP range was given; scan the range for services and display result if (post.containsKey("scan") && "hosts".equals(post.get("source", ""))) { final Set ia = new HashSet(); @@ -107,10 +109,10 @@ public class CrawlStartScanner_p { ia.add(Domains.dnsResolve(host)); } final Scanner scanner = new Scanner(ia, CONCURRENT_RUNNER, sb.isIntranetMode() ? 100 : 3000); - if (post.get("scanftp", "").equals("on")) scanner.addFTP(false); - if (post.get("scanhttp", "").equals("on")) scanner.addHTTP(false); - if (post.get("scanhttps", "").equals("on")) scanner.addHTTPS(false); - if (post.get("scansmb", "").equals("on")) scanner.addSMB(false); + if (post.get("scanftp", "").equals("on")) scanner.addFTP(bigrange); + if (post.get("scanhttp", "").equals("on")) scanner.addHTTP(bigrange); + if (post.get("scanhttps", "").equals("on")) scanner.addHTTPS(bigrange); + if (post.get("scansmb", "").equals("on")) scanner.addSMB(bigrange); scanner.start(); scanner.terminate(); if ("on".equals(post.get("accumulatescancache", "")) && !"scheduler".equals(post.get("rescan", ""))) { @@ -122,10 +124,10 @@ public class CrawlStartScanner_p { if (post.containsKey("scan") && "intranet".equals(post.get("source", ""))) { final Scanner scanner = new Scanner(Domains.myIntranetIPs(), CONCURRENT_RUNNER, sb.isIntranetMode() ? 100 : 3000); - if ("on".equals(post.get("scanftp", ""))) scanner.addFTP(false); - if ("on".equals(post.get("scanhttp", ""))) scanner.addHTTP(false); - if ("on".equals(post.get("scanhttps", ""))) scanner.addHTTPS(false); - if ("on".equals(post.get("scansmb", ""))) scanner.addSMB(false); + if ("on".equals(post.get("scanftp", ""))) scanner.addFTP(bigrange); + if ("on".equals(post.get("scanhttp", ""))) scanner.addHTTP(bigrange); + if ("on".equals(post.get("scanhttps", ""))) scanner.addHTTPS(bigrange); + if ("on".equals(post.get("scansmb", ""))) scanner.addSMB(bigrange); scanner.start(); scanner.terminate(); if ("on".equals(post.get("accumulatescancache", "")) && !"scheduler".equals(post.get("rescan", ""))) { diff --git a/source/net/yacy/cora/protocol/Scanner.java b/source/net/yacy/cora/protocol/Scanner.java index 926ab0cc1..0ed9274cc 100644 --- a/source/net/yacy/cora/protocol/Scanner.java +++ b/source/net/yacy/cora/protocol/Scanner.java @@ -202,7 +202,7 @@ public class Scanner extends Thread { /*for (Runner r: runner.keySet()) { if (r.age() > 3000) synchronized(r) { r.interrupt(); } }*/ - if (runner.size() >= this.runnerCount) Thread.sleep(30); + if (runner.size() >= this.runnerCount) Thread.sleep(20); } Runner runner = new Runner(uri); this.runner.put(runner, PRESENT);