yptools 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yptools/help/yp_help.rb +7 -1
- data/lib/yptools/portscan/yp_portscan.rb +50 -0
- data/lib/yptools.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8223853ebcd90eb9fcd7f20d91a01eaac8b926ee69e2291dbfe6ee9976eaec0
|
4
|
+
data.tar.gz: 7605e3081dbb09c6d4cc654431e0341a0fb9b21c039d4134ca4c71f1512d42c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c3e46af8e5bbc9e380976f96b33e09a6a2c938d95e4bf8954fab587b3378af78d2f56b4013fa359a7b11d95317aa4e1a66c67a4148bfe3654da6013a91ac430
|
7
|
+
data.tar.gz: 01e1e766ea8dcf4a48e0862376c279847214cbeaf3aeadd511e92ece81945d50ce1ce8f29ee57266cb14d7acf42073d0094d7331e59ede4c6613c519114b6a12
|
data/lib/yptools/help/yp_help.rb
CHANGED
@@ -3,11 +3,13 @@ class YPHelp
|
|
3
3
|
def self.message
|
4
4
|
puts %q{
|
5
5
|
|
6
|
+
🤖🤖🤖 - 智能聊天、绘画(OpenAI)
|
6
7
|
chatgpt: use [yptools chatgpt] 创建会话列表与 chatgpt 聊天,会记录上下内容(科学上网)
|
7
8
|
[yptools chatgpt ...] 快速与 chatgpt 沟通,不会记录上下内容
|
8
9
|
|
9
10
|
openai: use [yptools openaiimg ...] 根据文本描述生成图像(eg: yptools openaiimg '老虎和狮子大战' )
|
10
11
|
|
12
|
+
🚀🚀🚀 - iOS开发者(IOS Developer)
|
11
13
|
autocre: use [yptools autocre ...] 自动化工具命令
|
12
14
|
use [yptools autocre -objc ...] 根据 json 自动创建 Objective-C 数据库操作文件 .h|.m 文件。(依赖三方库 FMDB )
|
13
15
|
use [yptools autocre -init] 构建数据库操作文件的json模板
|
@@ -25,8 +27,12 @@ class YPHelp
|
|
25
27
|
xpj: use [yptools xpj ...] use xcodeproj api
|
26
28
|
use [yptools xpj check] 检查当前目录项目文件是否存在引用的问题
|
27
29
|
|
30
|
+
🤡🤡🤡 - hacker
|
31
|
+
portscan: use [yptools portscan <ip地址或域名> [<端口范围>]] 扫描指定 IP 端口是否开放
|
32
|
+
|
33
|
+
💩💩💩 - 帮助(help)
|
28
34
|
help: use [yptools help] 查看帮助
|
29
|
-
|
35
|
+
|
30
36
|
}
|
31
37
|
end
|
32
38
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
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
|
11
|
+
|
12
|
+
port_range=(${all_port//-/ })
|
13
|
+
timeout=0.02
|
14
|
+
ip_address=#{port}
|
15
|
+
|
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)
|
49
|
+
end
|
50
|
+
end
|
data/lib/yptools.rb
CHANGED
@@ -11,6 +11,7 @@ require_relative 'yptools/package/yp_package'
|
|
11
11
|
require_relative 'yptools/autocre/yp_autocre'
|
12
12
|
require_relative 'yptools/autocre/yp_autoinit'
|
13
13
|
require_relative 'yptools/chatai/yp_chatai'
|
14
|
+
require_relative 'yptools/portscan/yp_portscan'
|
14
15
|
|
15
16
|
class YPTools
|
16
17
|
|
@@ -102,6 +103,13 @@ class YPTools
|
|
102
103
|
yp_log_fail "'yptools xpj ..' 参数缺失"
|
103
104
|
self.help
|
104
105
|
end
|
106
|
+
when 'portscan'
|
107
|
+
if argvs.size > 1
|
108
|
+
self.portscan argvs
|
109
|
+
else
|
110
|
+
yp_log_fail "'yptools portscan ..' 参数缺失"
|
111
|
+
self.help
|
112
|
+
end
|
105
113
|
else
|
106
114
|
self.help
|
107
115
|
end
|
@@ -158,6 +166,12 @@ class YPTools
|
|
158
166
|
YPChatAI.openaiimg(message)
|
159
167
|
end
|
160
168
|
|
169
|
+
def self.portscan(argvs)
|
170
|
+
port = argvs[1]
|
171
|
+
range = argvs[2]
|
172
|
+
YPPortScan.portscan(port,range)
|
173
|
+
end
|
174
|
+
|
161
175
|
end
|
162
176
|
|
163
177
|
|
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.
|
4
|
+
version: 1.1.1
|
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-
|
11
|
+
date: 2023-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/yptools/log/yp_log.rb
|
142
142
|
- lib/yptools/mgc/yp_makegarbagecode.rb
|
143
143
|
- lib/yptools/package/yp_package.rb
|
144
|
+
- lib/yptools/portscan/yp_portscan.rb
|
144
145
|
- lib/yptools/update/yp_update.rb
|
145
146
|
- lib/yptools/xcodeproj/yp_xcodeproj.rb
|
146
147
|
homepage: https://github.com/HansenCCC/YPTools.git
|