super_hacker 0.3.2 → 0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5aa432d0e7c5593baf90160981725364e9f2ded390f01a00da4689a85024ddf5
4
- data.tar.gz: a64f0506bda82e1117109c308b67a59b0b25431a191c344206f2e74b82611b01
3
+ metadata.gz: 6344ea97d8312d099759fba3b91db896788828f0c3b3601781b95f43d75065ec
4
+ data.tar.gz: bbb5d3143c26d73b2434b0bcd98139d08e02bfb485dae4052136b2e251b92ea1
5
5
  SHA512:
6
- metadata.gz: eb69e50072983bf89324efb57ec8acd8415d550622774c5b54cc1a61d3b8e73fe7006a6af75441ebba8b3e8a13104f5ba5a521b5b01556e9103850ffd29a61e1
7
- data.tar.gz: 52a42187e079ced485f9491a33dada02a3bdb8b8c7ffbcf1cc7c8ec039ee85af092f4f7f1e1a8e448fa29245b59e84513b1d032860a01cbfb89b14727fd05cdd
6
+ metadata.gz: f9f3c1b10f9ddb229a92370ee62a3319dcccfc0d6c841ff1cf5d39722c4e893b654496c0b8f004f866c66e3337df1d703d4bbd7c265d666c14eaec1e5385582e
7
+ data.tar.gz: 59f64767e8ac92407f390c0c7770d77afd6809bd9150e1354eab6c356da979b028c2bad68c358b3433df588caf05483ff855565aa79ccf4591457f47fa0b3604
data/exe/super_hacker CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "./lib/super_hacker"
4
- hacker = Hacker.new
3
+ require "super_hacker"
4
+ hacker = SuperHacker::Hacker.new
5
5
  hacker.step
@@ -1,49 +0,0 @@
1
- #CreateCode
2
- class CodeGenerator
3
- def initialize
4
- end
5
- #単語毎に区切って表示
6
- def type_word_code(str,split_sleep = 0.02,typing_sleep = 0.02)
7
- str.chars do |s|
8
- #もし空白なら空白用のスリープ時間を適用
9
- if s == ' ' || s == '\t'
10
- sleep(split_sleep)
11
- print s
12
- else
13
- sleep(typing_sleep)
14
- print s
15
- end
16
- end
17
- puts
18
- end
19
-
20
- #プログレスバーの表示
21
- def print_progres()
22
- 100.times do |num|
23
- print "#{num}%\r"
24
- sleep 0.025
25
- STDOUT.flush
26
- end
27
- end
28
-
29
- #CSVファイルの読み込み
30
- def read_csv(file_name,sleep_time = 0.001,word_sleep = 0.02)
31
- csv_data = CSV.read(file_name, headers: true)
32
- csv_data.each do |data|
33
- #もしテキストがなければ改行して次の文字へ
34
- if data["text"].nil?
35
- puts
36
- next
37
- end
38
-
39
- #sleep_timeが設定されていれば、csvファイルのほうを有効にする
40
- if data["sleep_time"].nil? == false
41
- type_word_code(data["text"],word_sleep,data["sleep_time"].to_f)
42
- else
43
- #csvデータを表示する
44
- type_word_code(data["text"],word_sleep,sleep_time)
45
- end
46
- end
47
- end
48
-
49
- end
data/lib/super_hacker.rb CHANGED
@@ -1,101 +1,148 @@
1
- require './lib/super_hacker/version'
2
1
  require 'csv'
3
2
  require 'securerandom'
4
3
  require './lib/code_generator'
5
4
 
6
- class Hacker
7
- def initialize
8
- @cg = CodeGenerator.new()
9
- end
10
-
11
- #IPアドレスを入力するまでのシーン
12
- def scene_input_ip
13
- ip = "192.168.#{rand(1..99)}.#{rand(1..99)}"
14
- @cg.type_word_code("You are Get IP address #{ip}")
15
- @cg.type_word_code("Plz Input IP address")
16
- print "[IP]> "
17
- user_input_ip = gets.chomp()
18
- #比較結果を返す
19
- user_input_ip == ip
20
- end
21
-
22
- #loginするまでのシーン
23
- def scene_login
24
- #ダウンロード成功、色々流れてくる。
25
- @cg.type_word_code("[CONNECTION SUCCESS]",0.02,0.01)
26
- @cg.type_word_code("Downloading..",0.02,0.01)
27
- @cg.print_progres()
28
- @cg.read_csv("./csv/download.csv",0.00001,0.00001)
29
-
30
- #パスワードを入力させる
31
- create_password = SecureRandom.base64(5)
32
- @cg.type_word_code("You are get Pass Word: #{create_password}")
33
- @cg.type_word_code("Plz Input Pass Word")
34
- print "[PassWord]> "
35
- password = gets.chomp()
36
-
37
- #比較結果を返す
38
- create_password == password
39
- end
40
-
41
- #成功
42
- def scene_success
43
- @cg.read_csv("./csv/success.csv",0.001,0.001)
44
- end
45
-
46
- #失敗
47
- def scene_faild
48
- @cg.read_csv("./csv/faild.csv",0.001,0.001)
49
- end
50
-
51
- #実装部分
52
- def step
53
- #初期化csvファイルの読み込み
54
- @cg.read_csv('./csv/init.csv')
5
+ module SuperHacker
6
+ class Hacker
7
+ def initialize
8
+ @cg = CodeGenerator.new()
9
+ end
55
10
 
56
- loop do
57
- #メニュー表示
58
- @cg.read_csv('./csv/menu.csv')
11
+ #IPアドレスを入力するまでのシーン
12
+ def scene_input_ip
13
+ ip = "192.168.#{rand(1..99)}.#{rand(1..99)}"
14
+ @cg.type_word_code("You are Get IP address #{ip}")
15
+ @cg.type_word_code("Plz Input IP address")
16
+ print "[IP]> "
17
+ user_input_ip = gets.chomp()
18
+ #比較結果を返す
19
+ user_input_ip == ip
20
+ end
59
21
 
60
- print("(HACK_MENU)> ")
61
- input = gets.chomp
22
+ #loginするまでのシーン
23
+ def scene_login
24
+ #ダウンロード成功、色々流れてくる。
25
+ @cg.type_word_code("[CONNECTION SUCCESS]",0.02,0.01)
26
+ @cg.type_word_code("Downloading..",0.02,0.01)
27
+ @cg.print_progres()
28
+ @cg.read_csv("./csv/download.csv",0.00001,0.00001)
29
+
30
+ #パスワードを入力させる
31
+ create_password = SecureRandom.base64(5)
32
+ @cg.type_word_code("You are get Pass Word: #{create_password}")
33
+ @cg.type_word_code("Plz Input Pass Word")
34
+ print "[PassWord]> "
35
+ password = gets.chomp()
36
+
37
+ #比較結果を返す
38
+ create_password == password
39
+ end
62
40
 
63
- if input == "hax"
64
- #haxコードの表示
65
- @cg.read_csv('./csv/hax.csv',0.002,0.0001)
66
- @cg.read_csv('./csv/log.csv',0.002,0.0001)
41
+ #成功
42
+ def scene_success
43
+ @cg.read_csv("./csv/success.csv",0.001,0.001)
44
+ end
67
45
 
68
- #IPアドレスを入力させる
69
- if scene_input_ip == false
70
- @cg.type_word_code("You jare input mistakes..")
71
- scene_faild
72
- next
73
- end
46
+ #失敗
47
+ def scene_faild
48
+ @cg.read_csv("./csv/faild.csv",0.001,0.001)
49
+ end
74
50
 
75
- #loginするまでのシーン
76
- if scene_login == false
77
- @cg.type_word_code("You are input mistakes..")
78
- scene_faild
79
- next
51
+ #実装部分
52
+ def step
53
+ #初期化csvファイルの読み込み
54
+ @cg.read_csv('./csv/init.csv')
55
+
56
+ loop do
57
+ #メニュー表示
58
+ @cg.read_csv('./csv/menu.csv')
59
+
60
+ print("(HACK_MENU)> ")
61
+ input = gets.chomp
62
+
63
+ if input == "hax"
64
+ #haxコードの表示
65
+ @cg.read_csv('./csv/hax.csv',0.002,0.0001)
66
+ @cg.read_csv('./csv/log.csv',0.002,0.0001)
67
+
68
+ #IPアドレスを入力させる
69
+ if scene_input_ip == false
70
+ @cg.type_word_code("You jare input mistakes..")
71
+ scene_faild
72
+ next
73
+ end
74
+
75
+ #loginするまでのシーン
76
+ if scene_login == false
77
+ @cg.type_word_code("You are input mistakes..")
78
+ scene_faild
79
+ next
80
+ end
81
+
82
+ @cg.type_word_code("Infiltration succeeded")
83
+
84
+ #成功
85
+ scene_success
86
+
87
+ elsif input == "exit" || input == "quit"
88
+ #終了
89
+ @cg.type_word_code("bye..")
90
+ break
91
+ else
92
+ #入力ミス
93
+ @cg.type_word_code("[INPUT ERROR]")
80
94
  end
81
-
82
- @cg.type_word_code("Infiltration succeeded")
83
-
84
- #成功
85
- scene_success
86
-
87
- elsif input == "exit" || input == "quit"
88
- #終了
89
- @cg.type_word_code("bye..")
90
- break
91
- else
92
- #入力ミス
93
- @cg.type_word_code("[INPUT ERROR]")
94
95
  end
95
96
  end
96
- end
97
97
 
98
- end
98
+ end
99
+ #CreateCode
100
+ class CodeGenerator
101
+ def initialize
102
+ end
103
+ #単語毎に区切って表示
104
+ def type_word_code(str,split_sleep = 0.02,typing_sleep = 0.02)
105
+ str.chars do |s|
106
+ #もし空白なら空白用のスリープ時間を適用
107
+ if s == ' ' || s == '\t'
108
+ sleep(split_sleep)
109
+ print s
110
+ else
111
+ sleep(typing_sleep)
112
+ print s
113
+ end
114
+ end
115
+ puts
116
+ end
99
117
 
118
+ #プログレスバーの表示
119
+ def print_progres()
120
+ 100.times do |num|
121
+ print "#{num}%\r"
122
+ sleep 0.025
123
+ STDOUT.flush
124
+ end
125
+ end
100
126
 
127
+ #CSVファイルの読み込み
128
+ def read_csv(file_name,sleep_time = 0.001,word_sleep = 0.02)
129
+ csv_data = CSV.read(file_name, headers: true)
130
+ csv_data.each do |data|
131
+ #もしテキストがなければ改行して次の文字へ
132
+ if data["text"].nil?
133
+ puts
134
+ next
135
+ end
136
+
137
+ #sleep_timeが設定されていれば、csvファイルのほうを有効にする
138
+ if data["sleep_time"].nil? == false
139
+ type_word_code(data["text"],word_sleep,data["sleep_time"].to_f)
140
+ else
141
+ #csvデータを表示する
142
+ type_word_code(data["text"],word_sleep,sleep_time)
143
+ end
144
+ end
145
+ end
101
146
 
147
+ end
148
+ end
@@ -1,3 +1,3 @@
1
1
  module SuperHacker
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_hacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - kouta