diff --git a/.gitignore b/.gitignore index 24d177f..8141237 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ test/ .vscode/ .idea -geckodriver.log \ No newline at end of file +geckodriver.log +*.iml \ No newline at end of file diff --git a/docs/find_net.png b/docs/find_net.png deleted file mode 100644 index fbc030f..0000000 Binary files a/docs/find_net.png and /dev/null differ diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index dbd5ee5..0000000 --- a/docs/index.html +++ /dev/null @@ -1,2 +0,0 @@ -

With findsth find Wonderful website


- diff --git "a/docs/\345\256\211\350\243\205selenium\347\232\204chrome\346\217\222\344\273\266.md" "b/docs/\345\256\211\350\243\205selenium\347\232\204chrome\346\217\222\344\273\266.md" deleted file mode 100644 index 0341613..0000000 --- "a/docs/\345\256\211\350\243\205selenium\347\232\204chrome\346\217\222\344\273\266.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 安装selenium的chrome插件 - -1. [下载](https://sites.google.com/a/chromium.org/chromedriver/downloads) -2. 将下载地址配置到PATH - -## 网址 --[入门教程](https://testerhome.com/topics/18640) diff --git a/findsth.py b/findsth.py deleted file mode 100644 index 35890c8..0000000 --- a/findsth.py +++ /dev/null @@ -1,56 +0,0 @@ -import webbrowser -import sys -import requests -import logging -import time -from multiprocessing.dummy import Pool as ThreadPool - -protocol='http' -topDomainName=['.com','.cn','.net','.de','.fi','.co.jp', '.ru','.me', '.edu', '.af', '.ag', '.ai', '.ar', '.au', '.bd', '.bh', '.bn', '.bo', '.br', '.bz', '.co', '.cu', '.cy', '.do', '.ec', '.eg', '.et', '.fj', '.gh', '.gi', '.gt', '.hk', '.jm', '.kh', '.kw', '.lb', '.ly', '.mm', '.mt', '.mx', '.my', '.na', '.nf', '.ng', '.ni', '.np', '.om', '.pa', '.pe', '.pg', '.ph', '.pk', '.pr', '.py', '.qa', '.sa', '.sb', '.sg', '.sl', '.sv', '.tj', '.tr', '.tw', '.ua', '.uy', '.vc', '.vn'] -argv=sys.argv[1:] -print(argv) -start = time.time() - -logging.basicConfig(level=logging.INFO) -domains = [] -urls=[] -for i in range(len(topDomainName)): - aTop=topDomainName[i] - for j in range(len(argv)): - domainName=argv[j] - url=protocol + '://' + 'www.' + domainName + aTop - logging.info('url is: %s',url) - domains.append(url) - url=protocol + '://' + domainName + aTop - domains.append(url) - -print(domains) - -def con(url): - try: - res = requests.get(url, timeout=10) - code = res.status_code - except requests.exceptions.ReadTimeout: - code = -1 - except requests.exceptions.ConnectionError: - code = -1 - except requests.exceptions.TooManyRedirects: - code = -1 - logging.info('url: %s, code: %d'%(url, code)) - if code == 200: - urls.append(url) - -pool = ThreadPool(10) -pool.map(con, domains) -pool.close() -pool.join() - -availableCount = len(urls) -logging.info('availableCount: %d',availableCount) -for i in range(availableCount): - logging.info('Openning: %s',urls[i]) - webbrowser.open_new_tab(urls[i]) -end = time.time() -logging.info('Costs seconds: %f s', end - start) -#webbrowser.open_new_tab(url) - diff --git a/findsth_open_in_broswer.py b/findsth_open_in_broswer.py deleted file mode 100644 index 453b09b..0000000 --- a/findsth_open_in_broswer.py +++ /dev/null @@ -1,17 +0,0 @@ -from selenium import webdriver - -def open_in_chrome_incognito(url): - chrome_options = webdriver.ChromeOptions() - chrome_options.add_argument("--incognito") - - driver = webdriver.Chrome(chrome_options=chrome_options) - - driver.get(url) - -def main(): - open_in_chrome_incognito("https://www.baidu.com") - open_in_chrome_incognito("https://www.qq.com") - -if __name__ == '__main__': - main() - diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..749079a --- /dev/null +++ b/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + com.yitianyigexiangfa.findsth + findsth + 1.0 + + + + org.apache.maven.plugins + maven-compiler-plugin + + 6 + 6 + + + + + + + + org.springframework + spring-beans + 5.1.8.RELEASE + + + + org.springframework + spring-core + 5.1.8.RELEASE + + + + org.springframework + spring-context + 5.1.8.RELEASE + + + + org.springframework + spring-expression + 5.1.8.RELEASE + + + + \ No newline at end of file diff --git a/silkBag/twisted/chat.py b/silkBag/twisted/chat.py deleted file mode 100644 index 3eebd0d..0000000 --- a/silkBag/twisted/chat.py +++ /dev/null @@ -1,47 +0,0 @@ -from twisted.internet.protocol import Factory -from twisted.protocols.basic import LineReceiver -from twisted.internet import reactor - -class Chat(LineReceiver): - def __init__(self, users): - self.users = users - self.name = None - self.state = "GETNAME" - - def connectionMade(self): - self.sendLine("What's your name?") - - def connectionLost(self, reason): - if self.name in self.users: - del self.users[self.name] - - def lineReceived(self, line): - if self.state == "GETNAME": - self.handle_GETNAME(line) - else: - self.handle_CHAT(line) - - def handle_GETNAME(self, name): - if name in self.users: - self.sendLine("Name taken, please choose another.") - return - self.sendLine("Welcome, %s!" % (name,)) - self.name = name - self.users[name]= self - self.state = "CHAT" - - def handle_CHAT(self, message): - message = "<%s> %s"% (self.name, message) - for name, protocol in self.users.iteritems(): - if protocol != self: - protocol.sendLine(message) - -class ChatFactory(Factory): - def __init__(self): - self.users = {} - - def buildProtocol(self, addr): - return Chat(self.users) - -reactor.listenTCP(8123, ChatFactory()) -reactor.run() diff --git a/src/main/java/com/yitianyigexiangfa/findsth/Application.java b/src/main/java/com/yitianyigexiangfa/findsth/Application.java new file mode 100644 index 0000000..5725fd2 --- /dev/null +++ b/src/main/java/com/yitianyigexiangfa/findsth/Application.java @@ -0,0 +1,38 @@ +package com.yitianyigexiangfa.findsth; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.Charset; + +/** + * @author Bill Lau + * @date 2019-07-28 + */ +public class Application { + + + public static void main(String[] args) throws IOException { + URL url = new URL("https://www.baidu.com"); + HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection(); + httpURLConnection.connect(); + String responseMessage = httpURLConnection.getResponseMessage(); + System.out.println(responseMessage); + int responseCode = httpURLConnection.getResponseCode(); + System.out.println(responseCode); + InputStream is = httpURLConnection.getInputStream(); + StringBuffer sb=new StringBuffer(); + int length=0; + byte[] data=new byte[1024]; + while ((length=is.read(data))!=-1){ + String s=new String(data, Charset.forName("utf-8")); + sb.append(s); + } + String message=sb.toString(); + System.out.println(message); + is.close(); + httpURLConnection.disconnect(); + } + +} diff --git a/src/main/java/com/yitianyigexiangfa/findsth/constant/FindSthConstant.java b/src/main/java/com/yitianyigexiangfa/findsth/constant/FindSthConstant.java new file mode 100644 index 0000000..f3e7e03 --- /dev/null +++ b/src/main/java/com/yitianyigexiangfa/findsth/constant/FindSthConstant.java @@ -0,0 +1,22 @@ +package com.yitianyigexiangfa.findsth.constant; + +/** + * @author Bill Lau + * @date 2019-07-28 + */ +public class FindSthConstant { + + private static String[] TOP_DOMAIN_NAMES = new String[]{".com",".cn",".net",".de", + ".fi",".co.jp", ".ru",".me", ".edu", ".af", ".ag", ".ai", ".ar", + ".au", ".bd", ".bh", ".bn", ".bo", ".br", ".bz", ".co", ".cu", + ".cy", ".do", ".ec", ".eg", ".et", ".fj", ".gh", ".gi", ".gt", + ".hk", ".jm", ".kh", ".kw", ".lb", ".ly", ".mm", ".mt", ".mx", + ".my", ".na", ".nf", ".ng", ".ni", ".np", ".om", ".pa", ".pe", + ".pg", ".ph", ".pk", ".pr", ".py", ".qa", ".sa", ".sb", ".sg", + ".sl", ".sv", ".tj", ".tr", ".tw", ".ua", ".uy", ".vc", ".vn"}; + + + public static String[] getTopDomainNames() { + return TOP_DOMAIN_NAMES; + } +}