From 10c2aaa5b9d72c5d72fb32620ecf6b122d45a8de Mon Sep 17 00:00:00 2001 From: dustoair <107600816+dustoair@users.noreply.github.com> Date: Sun, 14 Aug 2022 11:40:23 +0800 Subject: [PATCH] test for idea lic --- lic.ok | 32 ++++++++++++++++++++++++++++++++ main.go | 41 ++++++++++++++++++++++++++++++++--------- main_test.go | 24 ++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 lic.ok create mode 100644 main_test.go diff --git a/lic.ok b/lic.ok new file mode 100644 index 0000000..63c552a --- /dev/null +++ b/lic.ok @@ -0,0 +1,32 @@ +http://134.53.225.196 +http://213.183.100.136:8080 +http://212.73.75.141 +http://195.208.239.74 +http://51.140.137.126:8080 +http://124.70.15.86:3333 +http://bumblebee.bhasvic.ac.uk +http://lic-server.mephi.ru +https://jetbrains.cs.calvin.edu +http://adsk06.tpu.ru:8080 +https://jetbrains.magnolia-cms.com +https://jetbrains-license.learning.casareal.co.jp +https://jblicense2.wappworks.com +https://jetbrains.inexio.net +https://jetbrainsfls.indexexchange.com +https://license.fahai.org +https://jenkins.wf-wolves.de +http://xidea.online +http://idea.liyang.io +https://fls-jetbrains.spacetechies.com +https://fls.aventus.work +https://jbls.x-root.info +http://idea.imsxm.com +http://idea.shaofan.org +http://idea.liyang.io +https://jetbra.in +http://adsk06.tpu.ru:8080 +https://jetbrains.magnolia-cms.com +https://jetbrains.magnolia-cms.com +http://adsk06.tpu.ru:8080 +https://fls-jetbrains.spacetechies.com +https://jetbrains.magnolia-cms.com \ No newline at end of file diff --git a/main.go b/main.go index c5b864a..6a8117d 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ import ( ) func main() { - lines, err := readlines("target.txt") + lines, err := readlines("lic.txt") if err != nil { return } @@ -25,14 +25,17 @@ func main() { case strings.Index(line, "http://") == 0: fmt.Println("http proxy ", line) ipPort := strings.Split(line, "//")[1] - portStr := strings.Split(ipPort, ":")[1] - port, err := strconv.Atoi(portStr) - if err != nil { - fmt.Println("port error:", err) - } + lenIpPort := len(strings.Split(ipPort, ":")) ip := strings.Split(ipPort, ":")[0] - fmt.Println("ip ", ip) - fmt.Println("port ", port) + port := 80 + if lenIpPort == 2 { + portStr := strings.Split(ipPort, ":")[1] + port, err = strconv.Atoi(portStr) + if err != nil { + fmt.Println("port error:", err) + writeline("fail.txt", line) + } + } if isPortOpen(ip, port) { fmt.Println("port is open") fmt.Println("proxy ok") @@ -42,7 +45,27 @@ func main() { writeline("fail.txt", line) } case strings.Index(line, "https://") == 0: - fmt.Println("https proxy ", line) + fmt.Println("http proxy ", line) + ipPort := strings.Split(line, "//")[1] + lenIpPort := len(strings.Split(ipPort, ":")) + ip := strings.Split(ipPort, ":")[0] + port := 443 + if lenIpPort == 2 { + portStr := strings.Split(ipPort, ":")[1] + port, err = strconv.Atoi(portStr) + if err != nil { + fmt.Println("port error:", err) + writeline("fail.txt", line) + } + } + if isPortOpen(ip, port) { + fmt.Println("port is open") + fmt.Println("proxy ok") + writeline("success.txt", line) + } else { + fmt.Println("port is not open") + writeline("fail.txt", line) + } case strings.Index(line, "socks5://") == 0: fmt.Println("socks5 proxy ", line) case strings.Index(line, "socks4://") == 0: diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..73b80ec --- /dev/null +++ b/main_test.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "strings" + "testing" +) + +/* +* +@author: sre +@date: 2022/8/14 0014 +@desc: todo +* +*/ +func TestPorts(tt *testing.T) { + url := "http://134.53.225.196" + ipPort := strings.Split(url, "//")[1] + ip := strings.Split(ipPort, ":")[0] + //port := strings.Split(ipPort, ":")[1] + fmt.Println(ip) + fmt.Println(len(strings.Split(ipPort, ":"))) + +}